sane.persist.root-on-tmpfs -> sane.root-on-tmpfs

This commit is contained in:
Colin 2023-11-09 00:15:04 +00:00
parent 539ee010ab
commit 6acd363f55
4 changed files with 23 additions and 22 deletions

View File

@ -10,6 +10,7 @@
./image.nix
./persist
./ports.nix
./root-on-tmpfs.nix
./services
./sops.nix
./ssh.nix

View File

@ -183,11 +183,6 @@ in
default = false;
type = types.bool;
};
sane.persist.root-on-tmpfs = mkOption {
default = false;
type = types.bool;
description = "define / fs root to be a tmpfs. make sure to mount some other device to /nix";
};
sane.persist.sys = mkOption {
description = "directories (or files) to persist to disk, relative to the fs root /";
default = {};
@ -203,7 +198,6 @@ in
};
imports = [
./root-on-tmpfs.nix
./stores
];

View File

@ -1,16 +0,0 @@
{ config, lib, ... }:
let
cfg = config.sane.persist;
in
{
fileSystems."/" = lib.mkIf (cfg.enable && cfg.root-on-tmpfs) {
device = "none";
fsType = "tmpfs";
options = [
"mode=755"
"size=1G"
"defaults"
];
};
}

22
modules/root-on-tmpfs.nix Normal file
View File

@ -0,0 +1,22 @@
{ config, lib, ... }:
{
options = with lib; {
sane.root-on-tmpfs = mkOption {
default = false;
type = types.bool;
description = "define / fs root to be a tmpfs. make sure to mount some other device to /nix";
};
};
config = lib.mkIf config.sane.root-on-tmpfs {
fileSystems."/" = {
device = "none";
fsType = "tmpfs";
options = [
"mode=755"
"size=1G"
"defaults"
];
};
};
}