treewide: deprecate DRY_RUN_CMD and DRY_RUN_NULL
As a replacement, this adds the `run` helper function.
This commit is contained in:
parent
6b28ab2d79
commit
4256729006
25 changed files with 125 additions and 67 deletions
|
|
@ -163,7 +163,7 @@ in {
|
|||
(
|
||||
export XDG_CACHE_HOME=${escapeShellArg config.xdg.cacheHome}
|
||||
$VERBOSE_ECHO "Rebuilding bat theme cache"
|
||||
$DRY_RUN_CMD ${lib.getExe package} cache --build
|
||||
run ${lib.getExe package} cache --build
|
||||
)
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ in {
|
|||
trap "rm --force --recursive $TMP_DIR" EXIT
|
||||
cp "${ghHosts}" $TMP_DIR/
|
||||
export GH_CONFIG_DIR=$TMP_DIR
|
||||
$DRY_RUN_CMD ${getExe cfg.package} help 2>&1 > $DRY_RUN_NULL
|
||||
run --silence ${getExe cfg.package} help
|
||||
cp $TMP_DIR/hosts.yml "${ghHosts}"
|
||||
)
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ in {
|
|||
home.activation = {
|
||||
createGpgHomedir =
|
||||
hm.dag.entryBetween [ "linkGeneration" ] [ "writeBoundary" ] ''
|
||||
$DRY_RUN_CMD mkdir -m700 -p $VERBOSE_ARG ${escapeShellArg cfg.homedir}
|
||||
run mkdir -m700 -p $VERBOSE_ARG ${escapeShellArg cfg.homedir}
|
||||
'';
|
||||
|
||||
importGpgKeys = let
|
||||
|
|
@ -290,12 +290,11 @@ in {
|
|||
|
||||
importKey = { source, trust, ... }:
|
||||
# Import mutable keys
|
||||
optional cfg.mutableKeys
|
||||
"$DRY_RUN_CMD ${gpg} $QUIET_ARG --import ${source}"
|
||||
optional cfg.mutableKeys "run ${gpg} $QUIET_ARG --import ${source}"
|
||||
|
||||
# Import mutable trust
|
||||
++ optional (trust != null && cfg.mutableTrust)
|
||||
''$DRY_RUN_CMD importTrust "${source}" ${toString trust}'';
|
||||
''run importTrust "${source}" ${toString trust}'';
|
||||
|
||||
anyTrust = any (k: k.trust != null) cfg.publicKeys;
|
||||
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ in {
|
|||
home.activation = mkIf (mbsyncAccounts != [ ]) {
|
||||
createMaildir =
|
||||
hm.dag.entryBetween [ "linkGeneration" ] [ "writeBoundary" ] ''
|
||||
$DRY_RUN_CMD mkdir -m700 -p $VERBOSE_ARG ${
|
||||
run mkdir -m700 -p $VERBOSE_ARG ${
|
||||
concatMapStringsSep " " (a: a.maildir.absPath) mbsyncAccounts
|
||||
}
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ in {
|
|||
# In theory, mu is the only thing that creates that directory, and it is
|
||||
# only created during the initial index.
|
||||
if [[ ! -d "${dbLocation}" ]]; then
|
||||
$DRY_RUN_CMD ${
|
||||
run ${
|
||||
getExe cfg.package
|
||||
} init ${maildirOption} ${myAddresses} $VERBOSE_ARG;
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -110,13 +110,13 @@ in {
|
|||
if [[ ! -s "${userConf}" ]]; then
|
||||
# Ensure file's existence
|
||||
if [[ -v DRY_RUN ]]; then
|
||||
$DRY_RUN_CMD echo "include ${homeConf}" ">" "${userConf}"
|
||||
run echo "include ${homeConf}" ">" "${userConf}"
|
||||
else
|
||||
echo "include ${homeConf}" > "${userConf}"
|
||||
fi
|
||||
elif ! grep -qF "include ${homeConf}" ${escapeShellArg userConf}; then
|
||||
# Add include statement for Home Manager generated config.
|
||||
$DRY_RUN_CMD sed -i '1i include ${homeConf}' ${escapeShellArg userConf}
|
||||
run sed -i '1i include ${homeConf}' ${escapeShellArg userConf}
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
|
|
|||
|
|
@ -257,9 +257,9 @@ in {
|
|||
"${extensionPath}/.extensions-immutable.json" = {
|
||||
text = extensionJson;
|
||||
onChange = ''
|
||||
$DRY_RUN_CMD rm $VERBOSE_ARG -f ${extensionPath}/{extensions.json,.init-default-profile-extensions}
|
||||
run rm $VERBOSE_ARG -f ${extensionPath}/{extensions.json,.init-default-profile-extensions}
|
||||
$VERBOSE_ECHO "Regenerating VSCode extensions.json"
|
||||
$DRY_RUN_CMD ${getExe cfg.package} --list-extensions > /dev/null
|
||||
run ${getExe cfg.package} --list-extensions > /dev/null
|
||||
'';
|
||||
};
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue