summaryrefslogtreecommitdiff
path: root/sys/fs/default.nix
blob: 04b8acb5061c963e343c1055dfc90a8619b1fd7c (plain)
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
{ lib, config, ... }:
with lib; let
  cfg = config.local.fs;
in
{
  imports = [ ./btrfs.nix ./layout.nix ];

  options.local.fs = with lib.types; {
    impermanence = mkOption {
      type = bool;
      default = false;
    };

    boot.device = mkOption {
      type = str;
    };
  };

  config = {
    # !!!
    boot.tmpOnTmpfs = true;

    fileSystems."/" = mkIf cfg.impermanence {
      device = "tmpfs";
      fsType = "tmpfs";
      options = [ "size=1G" "mode=755" ];
    };

    fileSystems."/boot" = {
      inherit (cfg.boot) device;
      fsType = "vfat";
      options = [ "noatime" "umask=027" ];
    };
  };
}