fix(package): nix-derivation-hash: purify
This commit is contained in:
@@ -1,9 +1,13 @@
|
|||||||
{
|
{
|
||||||
writeShellScriptBin,
|
writeShellScriptBin,
|
||||||
bash,
|
bash,
|
||||||
|
nix,
|
||||||
}: let
|
}: let
|
||||||
# Use folder name as name of this system
|
# Use folder name as name of this system
|
||||||
name = builtins.baseNameOf ./.;
|
name = builtins.baseNameOf ./.;
|
||||||
in writeShellScriptBin name /* sh */ ''
|
in writeShellScriptBin name /* sh */ ''
|
||||||
|
set -a
|
||||||
|
BIN_NIX_HASH="${nix}/bin/nix-hash"
|
||||||
|
set +a
|
||||||
${bash}/bin/sh ${./${name}.sh} "$@"
|
${bash}/bin/sh ${./${name}.sh} "$@"
|
||||||
''
|
''
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
path="$1"
|
path="$1"
|
||||||
base_path_name="$(basename "$path")"
|
base_path_name="$(basename "$path")"
|
||||||
sha256="$(nix-hash --type sha256 "$path")"
|
sha256="$("$BIN_NIX_HASH" --type sha256 "$path")"
|
||||||
temp_dir="$(mktemp -d)"
|
temp_dir="$(mktemp -d)"
|
||||||
temp_file="${temp_dir}/${base_path_name}.str"
|
temp_file="${temp_dir}/${base_path_name}.str"
|
||||||
printf "source:sha256:%s:/nix/store:%s" "$sha256" "$base_path_name" > "$temp_file"
|
printf "source:sha256:%s:/nix/store:%s" "$sha256" "$base_path_name" > "$temp_file"
|
||||||
nix-hash --type sha256 --truncate --base32 --flat "$temp_file"
|
"$BIN_NIX_HASH" --type sha256 --truncate --base32 --flat "$temp_file"
|
||||||
|
|
||||||
rm -rf "${temp_dir:?}"
|
rm -rf "${temp_dir:?}"
|
||||||
|
|||||||
Reference in New Issue
Block a user