From 45d079d445bb3d6c2df4e3c99349677eed78010b Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Mon, 8 Aug 2022 05:11:59 -0600 Subject: sys: implement primitive impermanence --- sys/fs/default.nix | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'sys/fs/default.nix') diff --git a/sys/fs/default.nix b/sys/fs/default.nix index 9f2f646..d24e357 100644 --- a/sys/fs/default.nix +++ b/sys/fs/default.nix @@ -1,19 +1,32 @@ { lib, config, ... }: with lib; let - cfg = config.local; + cfg = config.local.fs; in { imports = [ ./btrfs.nix ./layout.nix ]; - options.local.fs.boot.device = with lib.types; mkOption { - type = str; + 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.fs.boot) device; + inherit (cfg.boot) device; fsType = "vfat"; options = [ "noatime" "umask=027" ]; }; -- cgit v1.2.3