summary refs log tree commit diff stats
path: root/system/file_system_layouts/default.nix
blob: 9d03a052380a4df957b850e69b1da29d1651f2a7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{
  modulesPath,
  config,
  lib,
  ...
}:
with lib; let
  cfg = config.system.fileSystemLayouts;
in {
  options.system.fileSystemLayouts = {
    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";
    };
  };
  config = {
    fileSystems = {
      "/" = {
        device = "tmpfs";
        fsType = "tmpfs";
        options = ["defaults" "size=2G" "mode=755"];
      };
      "/nix" = {
        device = cfg.mainDisk;
        fsType = "btrfs";
        options = ["subvol=nix" "compress-force=zstd"];
      };
      "/srv" = {
        device = cfg.mainDisk;
        fsType = "btrfs";
        options = ["subvol=storage" "compress-force=zstd"];
      };
      "/boot" = {
        device = cfg.mainDisk;
        options = ["subvol=boot" "compress-force=zstd"];
      };

      "/etc/nixos" = {
        device = "/srv/nix-config";
        options = ["bind"];
      };
    };
  };
}