diff options
Diffstat (limited to 'system/fileSystemLayouts/default.nix')
-rw-r--r-- | system/fileSystemLayouts/default.nix | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/system/fileSystemLayouts/default.nix b/system/fileSystemLayouts/default.nix new file mode 100644 index 00000000..bdbad630 --- /dev/null +++ b/system/fileSystemLayouts/default.nix @@ -0,0 +1,58 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.system.fileSystemLayouts; +in { + options.system.fileSystemLayouts = { + enable = mkEnableOption (mdDoc "fileSystemLayout"); + mainDisk = mkOption { + type = lib.types.path; + example = literalExpression "/dev/disk/by-uuid/0442cb6d-f13a-4635-b487-fa76189774c5"; + description = lib.mdDoc "Path to the main disk"; + }; + efiDisk = mkOption { + type = lib.types.path; + example = literalExpression "/dev/disk/by-uuid/5143-6136"; + description = lib.mdDoc "Path to the main disk"; + }; + }; + + config = mkIf cfg.enable { + fileSystems = { + "/" = { + device = "none"; + fsType = "tmpfs"; + options = ["defaults" "size=2G" "mode=755"]; + }; + "/nix" = { + device = cfg.mainDisk; + fsType = "btrfs"; + options = ["subvol=nix" "compress-force=zstd:15"]; + }; + "/srv" = { + device = cfg.mainDisk; + fsType = "btrfs"; + options = ["subvol=storage" "compress-force=zstd:15"]; + }; + "/boot" = { + device = cfg.efiDisk; + fsType = "vfat"; + }; + + "/etc/nixos" = { + device = "/srv/nix-config"; + options = ["bind"]; + }; + + "${config.users.users.soispha.home}/.config" = { + device = "none"; + fsType = "tmpfs"; + options = ["defaults" "size=1G" "mode=755"]; + }; + }; + swapDevices = []; + }; +} |