1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-13 20:30:02 +00:00

environment.etc: provide proper error message when source is missing

This commit is contained in:
Daiderd Jordan 2017-01-05 00:37:14 +01:00
parent d83fd3ae59
commit 8e3ae405ab
No known key found for this signature in database
GPG key ID: D02435D05B810C96

View file

@ -7,6 +7,7 @@ with lib;
let
fileName = file: last (splitString "/" file);
mkDefaultIf = cond: value: mkIf cond (mkDefault value);
drv = mkTextDerivation (fileName name) config.text;
@ -51,7 +52,10 @@ in
config = {
source = mkIf (config.text != "") (mkDefault drv);
source = mkMerge
[ (mkDefaultIf (config.text != "") drv)
(mkDefaultIf (config.text == "") (abort "environment.etc.${name}.text is empty but no source was defined."))
];
};
}