Rewrote phoenix script
This commit is contained in:
@ -18,68 +18,81 @@
|
|||||||
config = {
|
config = {
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
attic-client
|
attic-client
|
||||||
# TODO rewrite this from scratch without wrappers
|
(pkgs.writeScriptBin "phoenix" ''
|
||||||
#(pkgs.writeScriptBin "phoenix" ''
|
if [[ $EUID -ne 0 ]]; then
|
||||||
# if [ "$1" = "sync" ]; then
|
echo "Error: This script must be run as root" 1>&2
|
||||||
# if [ "$#" = 1 ]; then
|
exit 1
|
||||||
# ${config.systemSettings.dotfilesDir}/scripts/sync.sh;
|
fi
|
||||||
# exit 0;
|
if [ "$1" = "sync" ]; then
|
||||||
# fi
|
if [ "$#" = 1 ]; then
|
||||||
# elif [ "$1" = "refresh" ]; then
|
exit 0;
|
||||||
# if [ "$#" -gt 1 ]; then
|
fi
|
||||||
# echo "Warning: The 'refresh' command has no subcommands (no $2 subcommand)";
|
elif [ "$1" = "update" ]; then
|
||||||
# fi
|
if [ "$#" -gt 1 ]; then
|
||||||
# ${config.systemSettings.dotfilesDir}/scripts/sync-posthook.sh;
|
echo "Warning: The 'update' command has no subcommands (no $2 subcommand)";
|
||||||
# exit 0;
|
fi
|
||||||
# elif [ "$1" = "update" ]; then
|
pushd ${config.systemSettings.dotfilesDir} &> /dev/null;
|
||||||
# ${config.systemSettings.dotfilesDir}/scripts/update.sh "''${@:2}";
|
nix flake update "''${@:2}";
|
||||||
# exit 0;
|
popd &> /dev/null;
|
||||||
# elif [ "$1" = "upgrade" ]; then
|
exit 0;
|
||||||
# if [ "$#" -gt 1 ]; then
|
elif [ "$1" = "pull" ]; then
|
||||||
# echo "Warning: The 'upgrade' command has no subcommands (no $2 subcommand)";
|
if [ "$#" -gt 1 ]; then
|
||||||
# fi
|
echo "Warning: The 'pull' command has no subcommands (no $2 subcommand)";
|
||||||
# ${config.systemSettings.dotfilesDir}/scripts/upgrade.sh;
|
fi
|
||||||
# exit 0;
|
exit 0;
|
||||||
# elif [ "$1" = "pull" ]; then
|
pushd ${config.systemSettings.dotfilesDir} &> /dev/null;
|
||||||
# if [ "$#" -gt 1 ]; then
|
git stash;
|
||||||
# echo "Warning: The 'pull' command has no subcommands (no $2 subcommand)";
|
git pull;
|
||||||
# fi
|
git stash apply;
|
||||||
# ${config.systemSettings.dotfilesDir}/scripts/pull.sh;
|
popd &> /dev/null;
|
||||||
# exit 0;
|
elif [ "$1" = "build" ]; then
|
||||||
# elif [ "$1" = "build" ]; then
|
if [ "$#" -gt 1 ]; then
|
||||||
# if [ "$#" -gt 1 ]; then
|
echo "Warning: The 'build' command has no subcommands (no $2 subcommand)";
|
||||||
# echo "Warning: The 'pull' command has no subcommands (no $2 subcommand)";
|
fi
|
||||||
# fi
|
pushd ${config.systemSettings.dotfilesDir} &> /dev/null;
|
||||||
# ${config.systemSettings.dotfilesDir}/scripts/build.sh;
|
nixos-rebuild build --flake .#snowfire;
|
||||||
# exit 0;
|
attic push emmet ./result;
|
||||||
# elif [ "$1" = "harden" ]; then
|
rm ./result;
|
||||||
# if [ "$#" -gt 1 ]; then
|
nixos-rebuild build --flake .#polarias;
|
||||||
# echo "Warning: The 'harden' command has no subcommands (no $2 subcommand)";
|
attic push emmet ./result;
|
||||||
# fi
|
rm ./result;
|
||||||
# ${config.systemSettings.dotfilesDir}/scripts/harden.sh;
|
nixos-rebuild build --flake .#zenith;
|
||||||
# exit 0;
|
attic push emmet ./result;
|
||||||
# elif [ "$1" = "soften" ]; then
|
rm ./result;
|
||||||
# if [ "$#" -gt 1 ]; then
|
nixos-rebuild build --flake .#stardust;
|
||||||
# echo "Warning: The 'soften' command has no subcommands (no $2 subcommand)";
|
attic push emmet ./result;
|
||||||
# fi
|
rm ./result;
|
||||||
# ${config.systemSettings.dotfilesDir}/scripts/soften.sh;
|
nixos-rebuild build --flake .#ori;
|
||||||
# exit 0;
|
attic push emmet ./result;
|
||||||
# elif [ "$1" = "gc" ]; then
|
rm ./result;
|
||||||
# if [ "$#" -gt 2 ]; then
|
exit 0;
|
||||||
# echo "Warning: The 'gc' command only accepts one argument (collect_older_than)";
|
elif [ "$1" = "lock" ]; then
|
||||||
# fi
|
if [ "$#" -gt 1 ]; then
|
||||||
# if [ "$2" = "full" ]; then
|
echo "Warning: The 'lock' command has no subcommands (no $2 subcommand)";
|
||||||
# sudo nix-collect-garbage --delete-old;
|
fi
|
||||||
# nix-collect-garbage --delete-old;
|
chown -R 0:0 ${config.systemSettings.dotfilesDir};
|
||||||
# elif [ "$2" ]; then
|
chown -R 0:0 ${config.systemSettings.secretsFlakeDir};
|
||||||
# sudo nix-collect-garbage --delete-older-than $2;
|
exit 0;
|
||||||
# nix-collect-garbage --delete-older-than $2;
|
elif [ "$1" = "unlock" ]; then
|
||||||
# else
|
if [ "$#" -gt 1 ]; then
|
||||||
# sudo nix-collect-garbage --delete-older-than 30d;
|
echo "Warning: The 'unlock' command has no subcommands (no $2 subcommand)";
|
||||||
# nix-collect-garbage --delete-older-than 30d;
|
fi
|
||||||
# fi
|
chown -R $DOAS_USER:users ${config.systemSettings.dotfilesDir};
|
||||||
# fi
|
chown -R $DOAS_USER:users ${config.systemSettings.secretsFlakeDir};
|
||||||
#'')
|
exit 0;
|
||||||
|
elif [ "$1" = "gc" ]; then
|
||||||
|
if [ "$#" -gt 2 ]; then
|
||||||
|
echo "Warning: The 'gc' command only accepts one argument (collect_older_than)";
|
||||||
|
fi
|
||||||
|
if [ "$2" = "full" ]; then
|
||||||
|
nix-collect-garbage --delete-old;
|
||||||
|
elif [ "$2" ]; then
|
||||||
|
nix-collect-garbage --delete-older-than $2;
|
||||||
|
else
|
||||||
|
nix-collect-garbage --delete-older-than 30d;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
'')
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user