summary refs log tree commit diff
path: root/nixos/modules/system/boot/tmp.nix
diff options
context:
space:
mode:
authorEmery Hemingway <emery@vfemail.net>2014-07-25 14:05:57 -0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-07-30 16:19:26 +0200
commit63d259df32ab969c46aa839a77e8d86cb8f734cf (patch)
tree37823fa540fdc124d84806bcf2f57f8d236efdef /nixos/modules/system/boot/tmp.nix
parent1cc6dc198466eb451beb2daa6314a345f1853dab (diff)
downloadnixpkgs-63d259df32ab969c46aa839a77e8d86cb8f734cf.tar
nixpkgs-63d259df32ab969c46aa839a77e8d86cb8f734cf.tar.gz
nixpkgs-63d259df32ab969c46aa839a77e8d86cb8f734cf.tar.bz2
nixpkgs-63d259df32ab969c46aa839a77e8d86cb8f734cf.tar.lz
nixpkgs-63d259df32ab969c46aa839a77e8d86cb8f734cf.tar.xz
nixpkgs-63d259df32ab969c46aa839a77e8d86cb8f734cf.tar.zst
nixpkgs-63d259df32ab969c46aa839a77e8d86cb8f734cf.zip
nixos: tmp on tmpfs option
/tmp cleaning is done by systemd rather than stage-2-init
enableEmergencyMode moved from systemd to seperate module
new option to mount tmp on tmpfs
new option to enable additional units shipped with systemd
Diffstat (limited to 'nixos/modules/system/boot/tmp.nix')
-rw-r--r--nixos/modules/system/boot/tmp.nix39
1 files changed, 39 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/tmp.nix b/nixos/modules/system/boot/tmp.nix
new file mode 100644
index 00000000000..5bf5e2eb2ec
--- /dev/null
+++ b/nixos/modules/system/boot/tmp.nix
@@ -0,0 +1,39 @@
+{ config, lib, ... }:
+
+with lib;
+
+{
+
+  ###### interface
+
+  options = {
+
+    boot.cleanTmpDir = mkOption {
+      type = types.bool;
+      default = false;
+      description = ''
+        Whether to delete all files in <filename>/tmp</filename> during boot.
+      '';
+    };
+
+    boot.tmpOnTmpfs = mkOption {
+      type = types.bool;
+      default = false;
+      description = ''
+         Whether to mount a tmpfs on <filename>/tmp</filename> during boot.
+      '';
+    };
+
+  };
+
+  ###### implementation
+
+  config = {
+
+    systemd.additionalUpstreamSystemUnits = optional config.boot.tmpOnTmpfs "tmp.mount";
+
+    systemd.tmpfiles.rules = optional config.boot.cleanTmpDir "D! /tmp 1777 root root";
+
+  };
+
+}
\ No newline at end of file