From b465376df8ba4b8ea4ad91576711ab65f359afa3 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Wed, 19 Sep 2018 06:09:17 +0200 Subject: populate: reference all packages using "pkgs" This fixes pop.pass's dependency on the caller's PATH for finding the pass executable, while at the same time keeping its argument consistent with the naming in other pop.$x functions. --- pkgs/populate/default.nix | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pkgs/populate/default.nix b/pkgs/populate/default.nix index 69f4ab3..b510e91 100644 --- a/pkgs/populate/default.nix +++ b/pkgs/populate/default.nix @@ -1,7 +1,7 @@ with import ../../lib; with shell; -{ coreutils, dash, findutils, git, jq, openssh, rsync, writeDash }: +{ coreutils, findutils, git, openssh, pass, rsync, writeDash }@pkgs: let check = { force, target }: let @@ -53,27 +53,27 @@ let in /* sh */ '' umask 0077 - tmp_dir=$(${coreutils}/bin/mktemp -dt populate-pass.XXXXXXXX) + tmp_dir=$(${pkgs.coreutils}/bin/mktemp -dt populate-pass.XXXXXXXX) trap cleanup EXIT cleanup() { rm -fR "$tmp_dir" } - ${findutils}/bin/find ${quote passPrefix} -type f | + ${pkgs.findutils}/bin/find ${quote passPrefix} -type f | while read -r gpg_path; do rel_name=''${gpg_path#${quote passPrefix}} rel_name=''${rel_name%.gpg} pass_date=$( - ${git}/bin/git -C ${quote pass.dir} log -1 --format=%aI "$gpg_path" + ${pkgs.git}/bin/git -C ${quote pass.dir} log -1 --format=%aI "$gpg_path" ) pass_name=${quote pass.name}/$rel_name tmp_path=$tmp_dir/$rel_name - ${coreutils}/bin/mkdir -p "$(${coreutils}/bin/dirname "$tmp_path")" - PASSWORD_STORE_DIR=${quote pass.dir} pass show "$pass_name" > "$tmp_path" - ${coreutils}/bin/touch -d "$pass_date" "$tmp_path" + ${pkgs.coreutils}/bin/mkdir -p "$(${pkgs.coreutils}/bin/dirname "$tmp_path")" + PASSWORD_STORE_DIR=${quote pass.dir} ${pkgs.pass}/bin/pass show "$pass_name" > "$tmp_path" + ${pkgs.coreutils}/bin/touch -d "$pass_date" "$tmp_path" done ${rsync' target /* sh */ "$tmp_dir"} @@ -93,7 +93,7 @@ let populate = target: name: source: let source' = source.${source.type}; target' = target // { path = "${target.path}/${name}"; }; - in writeDash "populate.${target'.host}.${name}" '' + in pkgs.writeDash "populate.${target'.host}.${name}" '' set -efu ${pop.${source.type} target' source'} ''; @@ -103,7 +103,7 @@ let if test -d "$source_path"; then source_path=$source_path/ fi - ${rsync}/bin/rsync \ + ${pkgs.rsync}/bin/rsync \ -e ${quote (ssh' target)} \ -vFrlptD \ --delete-excluded \ @@ -124,7 +124,7 @@ let ''; ssh' = target: concatMapStringsSep " " quote [ - "${openssh}/bin/ssh" + "${pkgs.openssh}/bin/ssh" "-l" target.user "-o" "ControlPersist=no" "-p" target.port @@ -133,7 +133,7 @@ let in -{ force ? false, source, target }: writeDash "populate.${target.host}" '' +{ force ? false, source, target }: pkgs.writeDash "populate.${target.host}" '' set -efu ${check { inherit force target; }} set -x -- cgit v1.2.3