Initial commit
This commit is contained in:
5
lib/default.nix
Normal file
5
lib/default.nix
Normal file
@@ -0,0 +1,5 @@
|
||||
final: prev: {
|
||||
fs = import ./fs.nix final prev;
|
||||
mkSecret = import ./mkSecret.nix;
|
||||
}
|
||||
// (import ./mkUser.nix { lib = final; })
|
24
lib/fs.nix
Normal file
24
lib/fs.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
final: prev:
|
||||
let
|
||||
filesystem = fsType: path: device: options: {
|
||||
fileSystems.${path} =
|
||||
{ inherit device fsType; }
|
||||
// final.optionalAttrs (options != null) { inherit options; };
|
||||
};
|
||||
|
||||
in {
|
||||
btrfs = filesystem "btrfs";
|
||||
ntfs = filesystem "ntfs-3g";
|
||||
ext4 = filesystem "ext4";
|
||||
vfat = filesystem "vfat";
|
||||
zfs = filesystem "zfs";
|
||||
tmpfs = filesystem "tmpfs";
|
||||
|
||||
swap = device: {swapDevices = [{inherit device;}];};
|
||||
|
||||
luks = mapper: device: additional: {
|
||||
boot.initrd.luks.devices.${mapper} = {
|
||||
inherit device;
|
||||
} // additional;
|
||||
};
|
||||
}
|
5
lib/mkSecret.nix
Normal file
5
lib/mkSecret.nix
Normal file
@@ -0,0 +1,5 @@
|
||||
group: {
|
||||
generator.script = "alnum";
|
||||
mode = "440";
|
||||
inherit group;
|
||||
}
|
8
lib/mkUser.nix
Normal file
8
lib/mkUser.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{ lib }: {
|
||||
mkUser = password: wheel: {
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "video" "libvirtd" "lp" (if wheel then "wheel" else "") ];
|
||||
} // (if (lib.hasPrefix "/" password)
|
||||
then {hashedPasswordFile = password;}
|
||||
else {hashedPassword = password;});
|
||||
}
|
Reference in New Issue
Block a user