mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 11:45:45 +03:00
nixos/fish: fix completion generation for non-derivation packages
environment.systemPackages can include any package, which means it can be a top-level store path that is not a derivation and thus will not have a name attribute - their name is extracted from the path instead.
This commit is contained in:
parent
67ff218c7c
commit
3fd98e7fcb
1 changed files with 7 additions and 10 deletions
|
@ -258,16 +258,13 @@ in
|
|||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
};
|
||||
generateCompletions = package: pkgs.runCommand
|
||||
"${package.name}_fish-completions"
|
||||
(
|
||||
{
|
||||
inherit package;
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
}
|
||||
// optionalAttrs (package ? meta.priority) { meta.priority = package.meta.priority; }
|
||||
)
|
||||
generateCompletions = package: pkgs.runCommandLocal
|
||||
( with lib.strings; let
|
||||
storeLength = stringLength storeDir + 34; # Nix' StorePath::HashLen + 2 for the separating slash and dash
|
||||
pathName = substring storeLength (stringLength package - storeLength) package;
|
||||
in (package.name or pathName) + "_fish-completions")
|
||||
( { inherit package; } //
|
||||
optionalAttrs (package ? meta.priority) { meta.priority = package.meta.priority; })
|
||||
''
|
||||
mkdir -p $out
|
||||
if [ -d $package/share/man ]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue