mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 06:30:28 +00:00
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
This commit is contained in:
parent
beba608705
commit
a3900340e4
1 changed files with 19 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue