From 979117b6b8fb1e630d4a56c040fd8749d2d07b18 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 3 Feb 2013 14:19:05 +0100 Subject: [PATCH] Selectively allow /etc files to be disabled For instance, if you don't want NixOS to emit /etc/hosts, you can say: environment.etc.hosts.enable = false; --- modules/system/etc/etc.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/system/etc/etc.nix b/modules/system/etc/etc.nix index ce7fc543536..91fcdcf2435 100644 --- a/modules/system/etc/etc.nix +++ b/modules/system/etc/etc.nix @@ -6,7 +6,7 @@ with pkgs.lib; let - etc' = attrValues config.environment.etc; + etc' = filter (f: f.enable) (attrValues config.environment.etc); etc = pkgs.stdenv.mkDerivation { name = "etc"; @@ -46,6 +46,15 @@ in options = singleton ({ name, config, ... }: { options = { + enable = mkOption { + type = types.bool; + default = true; + description = '' + Whether this /etc file should be generated. This + option allows specific /etc files to be disabled. + ''; + }; + target = mkOption { description = '' Name of symlink (relative to