Make release secret decrypt find Nix tools
This commit is contained in:
parent
ec407be894
commit
83da429854
2 changed files with 33 additions and 2 deletions
|
|
@ -15,6 +15,27 @@ runs:
|
||||||
ROOT_INPUT='${{ inputs.root }}'
|
ROOT_INPUT='${{ inputs.root }}'
|
||||||
ROOT="$(cd "$ROOT_INPUT" && pwd)"
|
ROOT="$(cd "$ROOT_INPUT" && pwd)"
|
||||||
|
|
||||||
|
resolve_nix_bin() {
|
||||||
|
local candidate
|
||||||
|
for candidate in \
|
||||||
|
"${NIX_BIN:-}" \
|
||||||
|
"$(command -v nix 2>/dev/null || true)" \
|
||||||
|
/nix/var/nix/profiles/default/bin/nix \
|
||||||
|
"${HOME:-}/.nix-profile/bin/nix" \
|
||||||
|
"${HOME:-}/.local/state/nix/profile/bin/nix" \
|
||||||
|
/Users/runner/.nix-profile/bin/nix \
|
||||||
|
/Users/runner/.local/state/nix/profile/bin/nix \
|
||||||
|
/home/runner/.nix-profile/bin/nix \
|
||||||
|
/home/runner/.local/state/nix/profile/bin/nix \
|
||||||
|
; do
|
||||||
|
if [[ -n "$candidate" && -x "$candidate" ]]; then
|
||||||
|
printf '%s\n' "$candidate"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
resolve_decrypt_tool() {
|
resolve_decrypt_tool() {
|
||||||
local candidate
|
local candidate
|
||||||
for candidate in \
|
for candidate in \
|
||||||
|
|
@ -46,9 +67,11 @@ runs:
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if command -v nix >/dev/null 2>&1; then
|
local nix_bin
|
||||||
|
nix_bin="$(resolve_nix_bin || true)"
|
||||||
|
if [[ -n "$nix_bin" ]]; then
|
||||||
local built
|
local built
|
||||||
built="$(nix build --no-link "$ROOT#agenix" --print-out-paths 2>/dev/null | tail -n 1 || true)"
|
built="$("$nix_bin" --extra-experimental-features 'nix-command flakes' build --no-link "$ROOT#agenix" --print-out-paths 2>/dev/null | tail -n 1 || true)"
|
||||||
if [[ -n "$built" && -x "$built/bin/agenix" ]]; then
|
if [[ -n "$built" && -x "$built/bin/agenix" ]]; then
|
||||||
printf 'agenix:%s\n' "$built/bin/agenix"
|
printf 'agenix:%s\n' "$built/bin/agenix"
|
||||||
return 0
|
return 0
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,14 @@ fi
|
||||||
source_nix_profile || true
|
source_nix_profile || true
|
||||||
export PATH="${HOME}/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:${PATH}"
|
export PATH="${HOME}/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:${PATH}"
|
||||||
|
|
||||||
|
if [[ -n "${GITHUB_PATH:-}" ]]; then
|
||||||
|
{
|
||||||
|
echo "${HOME}/.nix-profile/bin"
|
||||||
|
echo "/nix/var/nix/profiles/default/bin"
|
||||||
|
echo "/nix/var/nix/profiles/default/sbin"
|
||||||
|
} >> "${GITHUB_PATH}"
|
||||||
|
fi
|
||||||
|
|
||||||
config_root="${XDG_CONFIG_HOME:-$HOME/.config}"
|
config_root="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||||
config_file="${config_root}/nix/nix.conf"
|
config_file="${config_root}/nix/nix.conf"
|
||||||
if [[ -e "${config_file}" && ! -w "${config_file}" ]]; then
|
if [[ -e "${config_file}" && ! -w "${config_file}" ]]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue