lib: add filesystems
This commit is contained in:
parent
221804e83e
commit
036c94a2b1
2 changed files with 46 additions and 0 deletions
|
@ -64,6 +64,7 @@ rec {
|
||||||
};
|
};
|
||||||
|
|
||||||
disko = import ./disko.nix { inherit lib; };
|
disko = import ./disko.nix { inherit lib; };
|
||||||
|
filesystems = import ./filesystems.nix { inherit lib self; };
|
||||||
} // (
|
} // (
|
||||||
import ./digga.nix { inherit lib; }
|
import ./digga.nix { inherit lib; }
|
||||||
) // (
|
) // (
|
||||||
|
|
45
lib/filesystems.nix
Normal file
45
lib/filesystems.nix
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
{ lib, self }:
|
||||||
|
|
||||||
|
rec {
|
||||||
|
diskByUuid = uuid: "/dev/disk/by-uuid/${uuid}";
|
||||||
|
|
||||||
|
mkFilesystemDev = fsType: device: common: options: {
|
||||||
|
inherit device fsType;
|
||||||
|
options = common ++ options;
|
||||||
|
};
|
||||||
|
|
||||||
|
neededForBoot = self.lazy (fs: fs // { neededForBoot = true; });
|
||||||
|
|
||||||
|
mkFilesystemDev' = f: d: c: o:
|
||||||
|
neededForBoot (mkFilesystemDev f d c o);
|
||||||
|
|
||||||
|
mkFilesystem = fsType: uuid:
|
||||||
|
mkFilesystemDev fsType (diskByUuid uuid);
|
||||||
|
|
||||||
|
mkFilesystem' = f: d: c: o:
|
||||||
|
neededForBoot (mkFilesystemDev f d c o);
|
||||||
|
|
||||||
|
|
||||||
|
mkEFI = uuid: neededForBoot {
|
||||||
|
device = diskByUuid uuid;
|
||||||
|
fsType = "vfat";
|
||||||
|
};
|
||||||
|
mkTmpfs = name: size: neededForBoot {
|
||||||
|
device = name;
|
||||||
|
fsType = "tmpfs";
|
||||||
|
options = [ "defaults" "size=${size}" "mode=755" ];
|
||||||
|
};
|
||||||
|
mkBtrfs' = options: uuid: extraOptions: {
|
||||||
|
device = diskByUuid uuid;
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = options ++ extraOptions;
|
||||||
|
};
|
||||||
|
mkBtrfs = mkBtrfs' [
|
||||||
|
"autodefrag"
|
||||||
|
"noatime"
|
||||||
|
"ssd"
|
||||||
|
"compress=zstd:1"
|
||||||
|
];
|
||||||
|
|
||||||
|
mkSwap = uuid: { device = diskByUuid uuid; };
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue