Initial commit

This commit is contained in:
2025-08-20 18:24:02 +03:00
commit 2dec42d487
116 changed files with 6591 additions and 0 deletions

5
lib/default.nix Normal file
View 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
View 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
View File

@@ -0,0 +1,5 @@
group: {
generator.script = "alnum";
mode = "440";
inherit group;
}

8
lib/mkUser.nix Normal file
View 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;});
}