home-environment: replace option 'mode' with option 'executable'

nix-store only allows modes 'r--' and 'r-x'
This commit is contained in:
Cornelius Mika 2017-09-06 10:17:27 +02:00
parent 2524d92e2b
commit afa573952c
2 changed files with 12 additions and 9 deletions

View file

@ -124,18 +124,21 @@ in
''; '';
}; };
mode = mkOption { executable = mkOption {
type = types.str; type = types.bool;
default = "444"; default = false;
description = "The permissions to apply to the file."; description = "Make file executable.";
}; };
}; };
config = { config = {
target = mkDefault name; target = mkDefault name;
source = mkIf (config.text != null) ( source = mkIf (config.text != null)
mkDefault (pkgs.writeText "home-file" config.text) (mkDefault (pkgs.writeTextFile {
); name = "home-file";
text = config.text;
executable = config.executable;
}));
}; };
}) })
); );
@ -419,7 +422,7 @@ in
mkdir -pv "$(dirname "$out/${v.target}")" mkdir -pv "$(dirname "$out/${v.target}")"
ln -sv "${v.source}" "$out/${v.target}" ln -sv "${v.source}" "$out/${v.target}"
else else
install -D -m${v.mode} "${v.source}" "$out/${v.target}" install -D -m${if v.executable then "+x" else "-x"} "${v.source}" "$out/${v.target}"
fi fi
'' ''
) cfg.file ) cfg.file

View file

@ -72,7 +72,7 @@ in
}; };
home.file.".xsession" = { home.file.".xsession" = {
mode = "555"; executable = true;
text = '' text = ''
if [[ -e "$HOME/.profile" ]]; then if [[ -e "$HOME/.profile" ]]; then
. "$HOME/.profile" . "$HOME/.profile"