Compare commits
1 commit
main
...
disko-test
| Author | SHA1 | Date | |
|---|---|---|---|
| 62e462a0df |
4 changed files with 92 additions and 80 deletions
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
stylix.url = "github:danth/stylix";
|
stylix.url = "github:danth/stylix";
|
||||||
base16.url = "github:SenchoPens/base16.nix";
|
base16.url = "github:SenchoPens/base16.nix";
|
||||||
|
disko.url = "github:nix-community/disko/latest";
|
||||||
|
|
||||||
anyrun.url = "github:Kirottu/anyrun";
|
anyrun.url = "github:Kirottu/anyrun";
|
||||||
oxicalc.url = "github:DashieTM/OxiCalc";
|
oxicalc.url = "github:DashieTM/OxiCalc";
|
||||||
|
|
@ -80,7 +81,8 @@
|
||||||
};
|
};
|
||||||
overlays = [
|
overlays = [
|
||||||
inputs.nur.overlays.default
|
inputs.nur.overlays.default
|
||||||
inputs.chaoticNyx.overlays.default];
|
inputs.chaoticNyx.overlays.default
|
||||||
|
];
|
||||||
};
|
};
|
||||||
pkgs = import inputs.nixpkgs {
|
pkgs = import inputs.nixpkgs {
|
||||||
system = currentSystem;
|
system = currentSystem;
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@
|
||||||
nixos = [
|
nixos = [
|
||||||
inputs.home-manager.nixosModules.home-manager
|
inputs.home-manager.nixosModules.home-manager
|
||||||
inputs.stylix.nixosModules.stylix
|
inputs.stylix.nixosModules.stylix
|
||||||
|
inputs.disko.nixosModules.disko
|
||||||
../base
|
../base
|
||||||
../home
|
../home
|
||||||
../modules
|
../modules
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,14 @@
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
defualtDiskId = lib.mkOption {
|
||||||
|
default = "TODO";
|
||||||
|
example = "/dev/disk/by-id/nvme-Force_MP510_19498249000129196385";
|
||||||
|
description = ''
|
||||||
|
The id of the disk to format
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
cpu = lib.mkOption {
|
cpu = lib.mkOption {
|
||||||
# TODO: how to enable arm?
|
# TODO: how to enable arm?
|
||||||
default = "amd";
|
default = "amd";
|
||||||
|
|
|
||||||
|
|
@ -3,35 +3,7 @@
|
||||||
config,
|
config,
|
||||||
options,
|
options,
|
||||||
...
|
...
|
||||||
}: let
|
}: {
|
||||||
driveModule = lib.types.submodule {
|
|
||||||
options = {
|
|
||||||
name = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
description = ''
|
|
||||||
The path of the drive.
|
|
||||||
Note that a / is already added at the beginning.
|
|
||||||
'';
|
|
||||||
default = "";
|
|
||||||
example = "drive2";
|
|
||||||
};
|
|
||||||
drive = lib.mkOption {
|
|
||||||
type = lib.types.attrsOf lib.types.anything;
|
|
||||||
description = "The attrs of the drive";
|
|
||||||
default = {};
|
|
||||||
example = {
|
|
||||||
device = "/dev/disk/by-label/DRIVE2";
|
|
||||||
fsType = "ext4";
|
|
||||||
options = [
|
|
||||||
"noatime"
|
|
||||||
"nodiratime"
|
|
||||||
"discard"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
options.mods = {
|
options.mods = {
|
||||||
drives = {
|
drives = {
|
||||||
useSwap = {
|
useSwap = {
|
||||||
|
|
@ -83,8 +55,72 @@ in {
|
||||||
|
|
||||||
config = (
|
config = (
|
||||||
lib.optionalAttrs (options ? fileSystems) {
|
lib.optionalAttrs (options ? fileSystems) {
|
||||||
fileSystems =
|
disko.devices = {
|
||||||
builtins.listToAttrs (
|
disk =
|
||||||
|
{
|
||||||
|
main = (lib.optionalAttrs config.mods.drives.defaultDrives.enable) {
|
||||||
|
device = "${config.conf.defaultDiskId}";
|
||||||
|
type = "disk";
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
root = {
|
||||||
|
start = "33G";
|
||||||
|
end = "30%";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "btrfs";
|
||||||
|
mountpoint = "/";
|
||||||
|
mountOptions = [
|
||||||
|
"noatime"
|
||||||
|
"nodiratime"
|
||||||
|
"discard"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
plainSwap = {
|
||||||
|
start = "1G";
|
||||||
|
end = "33G";
|
||||||
|
content = {
|
||||||
|
type = "swap";
|
||||||
|
discardPolicy = "both";
|
||||||
|
resumeDevice = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
boot = {
|
||||||
|
start = "0G";
|
||||||
|
end = "1G";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
mountOptions = [
|
||||||
|
"rw"
|
||||||
|
"fmask=0022"
|
||||||
|
"dmask=0022"
|
||||||
|
"noatime"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
home = {
|
||||||
|
start = "30%";
|
||||||
|
end = "100%";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "btrfs";
|
||||||
|
mountpoint = "/home";
|
||||||
|
mountOptions = [
|
||||||
|
"noatime"
|
||||||
|
"nodiratime"
|
||||||
|
"discard"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// builtins.listToAttrs (
|
||||||
map (
|
map (
|
||||||
{
|
{
|
||||||
name,
|
name,
|
||||||
|
|
@ -95,43 +131,8 @@ in {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
config.mods.drives.extraDrives
|
config.mods.drives.extraDrives
|
||||||
)
|
);
|
||||||
// (lib.optionalAttrs config.mods.drives.defaultDrives.enable) {
|
|
||||||
"/" = {
|
|
||||||
device = "/dev/disk/by-label/ROOT";
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = [
|
|
||||||
"noatime"
|
|
||||||
"nodiratime"
|
|
||||||
"discard"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
"/boot" = {
|
|
||||||
device = "/dev/disk/by-label/BOOT";
|
|
||||||
fsType = "vfat";
|
|
||||||
options = [
|
|
||||||
"rw"
|
|
||||||
"fmask=0022"
|
|
||||||
"dmask=0022"
|
|
||||||
"noatime"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
"/home" = {
|
|
||||||
device = "/dev/disk/by-label/HOME";
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = [
|
|
||||||
"noatime"
|
|
||||||
"nodiratime"
|
|
||||||
"discard"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
# TODO make this convert to choice of drives -> thanks to funny types this doesn't work...
|
|
||||||
swapDevices = lib.mkIf config.mods.drives.useSwap.enable [
|
|
||||||
{device = "/dev/disk/by-label/SWAP";}
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue