mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 12:15:34 +03:00
nixos/stash: fix empty immutable plugins (#402574)
This commit is contained in:
commit
cfbe1487f1
1 changed files with 39 additions and 39 deletions
|
@ -324,47 +324,47 @@ let
|
||||||
'';
|
'';
|
||||||
apply =
|
apply =
|
||||||
srcs:
|
srcs:
|
||||||
optionalString (srcs != [ ]) (
|
pkgs.runCommand "stash-${kind}"
|
||||||
pkgs.runCommand "stash-${kind}"
|
{
|
||||||
{
|
inherit srcs;
|
||||||
inherit srcs;
|
nativeBuildInputs = [ pkgs.yq-go ];
|
||||||
nativeBuildInputs = [ pkgs.yq-go ];
|
preferLocalBuild = true;
|
||||||
preferLocalBuild = true;
|
}
|
||||||
}
|
''
|
||||||
''
|
mkdir -p $out
|
||||||
find $srcs -mindepth 1 -name '*.yml' | while read plugin_file; do
|
touch $out/.keep
|
||||||
grep -q "^#pkgignore" "$plugin_file" && continue
|
find $srcs -mindepth 1 -name '*.yml' | while read plugin_file; do
|
||||||
|
grep -q "^#pkgignore" "$plugin_file" && continue
|
||||||
|
|
||||||
plugin_dir=$(dirname $plugin_file)
|
plugin_dir=$(dirname $plugin_file)
|
||||||
out_path=$out/$(basename $plugin_dir)
|
out_path=$out/$(basename $plugin_dir)
|
||||||
mkdir -p $out_path
|
mkdir -p $out_path
|
||||||
ls $plugin_dir | xargs -I{} ln -sf "$plugin_dir/{}" $out_path
|
ls $plugin_dir | xargs -I{} ln -sf "$plugin_dir/{}" $out_path
|
||||||
|
|
||||||
env \
|
env \
|
||||||
plugin_id=$(basename $plugin_file .yml) \
|
plugin_id=$(basename $plugin_file .yml) \
|
||||||
plugin_name="$(yq '.name' $plugin_file)" \
|
plugin_name="$(yq '.name' $plugin_file)" \
|
||||||
plugin_description="$(yq '.description' $plugin_file)" \
|
plugin_description="$(yq '.description' $plugin_file)" \
|
||||||
plugin_version="$(yq '.version' $plugin_file)" \
|
plugin_version="$(yq '.version' $plugin_file)" \
|
||||||
plugin_files="$(find -L $out_path -mindepth 1 -type f -printf "%P\n")" \
|
plugin_files="$(find -L $out_path -mindepth 1 -type f -printf "%P\n")" \
|
||||||
yq -n '
|
yq -n '
|
||||||
.id = strenv(plugin_id) |
|
.id = strenv(plugin_id) |
|
||||||
.name = strenv(plugin_name) |
|
.name = strenv(plugin_name) |
|
||||||
(
|
(
|
||||||
strenv(plugin_description) as $desc |
|
strenv(plugin_description) as $desc |
|
||||||
with(select($desc == "null"); .metadata = {}) |
|
with(select($desc == "null"); .metadata = {}) |
|
||||||
with(select($desc != "null"); .metadata.description = $desc)
|
with(select($desc != "null"); .metadata.description = $desc)
|
||||||
) |
|
) |
|
||||||
(
|
(
|
||||||
strenv(plugin_version) as $ver |
|
strenv(plugin_version) as $ver |
|
||||||
with(select($ver == "null"); .version = "Unknown") |
|
with(select($ver == "null"); .version = "Unknown") |
|
||||||
with(select($ver != "null"); .version = $ver)
|
with(select($ver != "null"); .version = $ver)
|
||||||
) |
|
) |
|
||||||
.date = (now | format_datetime("2006-01-02 15:04:05")) |
|
.date = (now | format_datetime("2006-01-02 15:04:05")) |
|
||||||
.files = (strenv(plugin_files) | split("\n"))
|
.files = (strenv(plugin_files) | split("\n"))
|
||||||
' > $out_path/manifest
|
' > $out_path/manifest
|
||||||
done
|
done
|
||||||
''
|
'';
|
||||||
);
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue