Make maintenance more robust
This commit is contained in:
parent
451e71a08e
commit
a18d7d446c
|
@ -5,16 +5,22 @@ let
|
||||||
configPath = "${config.home.homeDirectory}/git/config";
|
configPath = "${config.home.homeDirectory}/git/config";
|
||||||
modeFile = "${config.home.homeDirectory}/${opts.modeFile}";
|
modeFile = "${config.home.homeDirectory}/${opts.modeFile}";
|
||||||
modeDir = "${config.home.homeDirectory}/${opts.modeDir}";
|
modeDir = "${config.home.homeDirectory}/${opts.modeDir}";
|
||||||
|
configGit = "${pkgs.git}/bin/git -C ${configPath}";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ (import ./wallpaper.nix { inherit modeFile; }) ];
|
imports = [ (import ./wallpaper.nix { inherit modeFile; }) ];
|
||||||
home.packages = builtins.attrValues rec {
|
home.packages = builtins.attrValues rec {
|
||||||
maintenance = pkgs.writeShellScriptBin "maintenance" ''
|
maintenance = pkgs.writeShellScriptBin "maintenance" ''
|
||||||
set -e
|
set -ex
|
||||||
git -C ~/git/config pull --ff-only
|
${configGit} fetch
|
||||||
git -C ~/git/config submodule update
|
if [[ "$1" == "--only-on-update" && "$(${configGit} rev-parse master)" == "$(${configGit} rev-parse origin/master)" ]]; then
|
||||||
update-modes
|
echo "Git repo up-to-date, not doing anything."
|
||||||
sudo -A update-system
|
exit 0;
|
||||||
|
fi
|
||||||
|
${configGit} merge --ff-only origin/master master
|
||||||
|
${configGit} submodule update
|
||||||
|
${updateModes}/bin/update-modes
|
||||||
|
/var/run/current-system/bin/sudo -A /var/run/current-system/bin/update-system
|
||||||
'';
|
'';
|
||||||
activateMode = pkgs.writeHaskellScript { name = "activate-mode"; } ''
|
activateMode = pkgs.writeHaskellScript { name = "activate-mode"; } ''
|
||||||
getMode :: IO Text
|
getMode :: IO Text
|
||||||
|
|
Loading…
Reference in a new issue