diff options
Diffstat (limited to 'system/filesystemLayouts')
-rw-r--r-- | system/filesystemLayouts/filesystemLayouts.nix | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/system/filesystemLayouts/filesystemLayouts.nix b/system/filesystemLayouts/filesystemLayouts.nix new file mode 100644 index 00000000..2f7c8fc2 --- /dev/null +++ b/system/filesystemLayouts/filesystemLayouts.nix @@ -0,0 +1,62 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.system.filesystemLayout; +in { + options = { + cfg.enable = mkEnableOption (mdDoc "filesysetemLayout"); + cfg.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"; + }; + cfg.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.enabled { + fileSystems = { + "/" = { + device = "none"; + fsType = "tmpfs"; + options = ["defaults" "size=2G" "mode=755"]; + }; + "/nix" = { + device = cfg.mainDisk; + fsType = "btrfs"; + options = ["subvol=@nix" "compress-force=zstd:9"]; + }; + "/boot" = { + device = cfg.efiDisk; + fsType = "vfat"; + }; + + "/srv/home" = { + device = cfg.mainDisk; + fsType = "btrfs"; + options = ["subvol=@home" "compress-force=zstd:9"]; + }; + "/srv/nixos-config" = { + device = cfg.mainDisk; + fsType = "btrfs"; + options = ["subvol=@nixos-config" "compress-force=zstd:9"]; + }; + + "/etc/nixos" = { + device = "/srv/nix-config"; + options = ["bind"]; + }; + "/home" = { + device = "/srv/home"; + options = ["bind"]; + }; + }; + swapDevices = []; + }; +} |