diff options
author | Robert Helgesson <robert@rycee.net> | 2017-02-21 21:41:05 +0100 |
---|---|---|
committer | Robert Helgesson <robert@rycee.net> | 2017-02-21 21:41:05 +0100 |
commit | a3900340e4823fa317972b7380da9aefd5615e1f (patch) | |
tree | 2c160d65db991ab344a39ba38352b092d5adb7d0 /modules/home-environment.nix | |
parent | beba60870505f8043d9fbe67f9c9dd0d0d031fba (diff) |
home-environment: check files for '.' prefix
Nix does not allow files whose name start with a '.' in the Nix store.
This commit makes a not of this fact in the `home.file.source` option
and also adds an assertion verifying that no such file is given.
Closes #4
Diffstat (limited to 'modules/home-environment.nix')
-rw-r--r-- | modules/home-environment.nix | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/modules/home-environment.nix b/modules/home-environment.nix index 70889eb5225..69a1a38ae34 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -114,7 +114,11 @@ in source = mkOption { type = types.path; - description = "Path of the source file."; + description = '' + Path of the source file. Note, the file name must not + start with a period since Nix will not allow such + names in the Nix store. + ''; }; mode = mkOption { @@ -206,6 +210,20 @@ in }; config = { + assertions = [ + (let + badFiles = + filter (hasPrefix ".") + (map (v: baseNameOf (toString v.source)) + (attrValues cfg.file)); + badFilesStr = toString badFiles; + in + { + assertion = badFiles == []; + message = "Source file names must not start with '.': ${badFilesStr}"; + }) + ]; + home.sessionVariables = let maybeSet = name: value: |