mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-18 14:28:15 +00:00
specialisation: escape specialisation name
The specialisation name is included in home.extraBuilderCommands without being properly escaped and checked. This commit fixes that.
This commit is contained in:
parent
f6ac8a3414
commit
486b066025
1 changed files with 7 additions and 1 deletions
|
@ -71,10 +71,16 @@ with lib;
|
|||
};
|
||||
|
||||
config = mkIf (config.specialisation != { }) {
|
||||
assertions = map (n: {
|
||||
assertion = !lib.hasInfix "/" n;
|
||||
message =
|
||||
"<name> in specialisation.<name> cannot contain a forward slash.";
|
||||
}) (attrNames config.specialisation);
|
||||
|
||||
home.extraBuilderCommands = let
|
||||
link = n: v:
|
||||
let pkg = v.configuration.home.activationPackage;
|
||||
in "ln -s ${pkg} $out/specialisation/${n}";
|
||||
in "ln -s ${pkg} $out/specialisation/${escapeShellArg n}";
|
||||
in ''
|
||||
mkdir $out/specialisation
|
||||
${concatStringsSep "\n" (mapAttrsToList link config.specialisation)}
|
||||
|
|
Loading…
Add table
Reference in a new issue