From 775016294500a8e36295781f2b33e0ee4642cfab Mon Sep 17 00:00:00 2001 From: jopejoe1 Date: Thu, 12 Oct 2023 17:47:24 +0200 Subject: [PATCH] Update scripts --- modules/auto-update/default.nix | 4 ++-- modules/services/repo-sync/default.nix | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/modules/auto-update/default.nix b/modules/auto-update/default.nix index 2d27b35..ee7b45d 100644 --- a/modules/auto-update/default.nix +++ b/modules/auto-update/default.nix @@ -1,10 +1,10 @@ -{ pkgs, config, ... }: +{ lib, pkgs, config, ... }: { system.autoUpgrade = { enable = true; randomizedDelaySec = "30min"; - flake = if config.services.archisteamfarm.enable then "$(${pkgs.coreutils}/bin/rm -rf /var/lib/update-repo && ${pkgs.git}/bin/git clone git@codeberg.org:jopejoe1/nix-conf.git /var/lib/update-repo -q --depth=1 && ${pkgs.git}/bin/git -C /var/lib/update-repo am /home/jopejoe1/.config/patches/0001-add-liscense.patch -q)/var/lib/update-repo" else "github:jopejoe1/nix-conf"; + flake = if config.services.archisteamfarm.enable then "$(${pkgs.coreutils}/bin/rm -rf /var/lib/update-repo && ${lib.getExe pkgs.git} clone git@codeberg.org:jopejoe1/nix-conf.git /var/lib/update-repo -q --depth=1 && ${lib.getExe pkgs.git} -C /var/lib/update-repo am /home/jopejoe1/.config/patches/0001-add-liscense.patch -q)/var/lib/update-repo" else "github:jopejoe1/nix-conf"; dates = "hourly"; }; } diff --git a/modules/services/repo-sync/default.nix b/modules/services/repo-sync/default.nix index 61ba1cb..cea4a49 100644 --- a/modules/services/repo-sync/default.nix +++ b/modules/services/repo-sync/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: { systemd.timers."repo-sync" = { @@ -12,14 +12,16 @@ systemd.services."repo-sync" = { script = '' - ${pkgs.git}/bin/git clone git@codeberg.org:jopejoe1/nix-conf.git /var/lib/repo-sync - ${pkgs.git}/bin/git -C /var/lib/repo-sync remote add github git@github.com:jopejoe1/nix-conf.git - ${pkgs.git}/bin/git -C /var/lib/repo-sync remote add gitlab git@gitlab.com:jopejoe1/nix-conf.git - ${pkgs.git}/bin/git -C /var/lib/repo-sync pull -r github main - ${pkgs.git}/bin/git -C /var/lib/repo-sync pull -r gitlab main - ${pkgs.git}/bin/git -C /var/lib/repo-sync push origin - ${pkgs.git}/bin/git -C /var/lib/repo-sync push github - ${pkgs.git}/bin/git -C /var/lib/repo-sync push gitlab + ${lib.getExe pkgs.git} clone git@codeberg.org:jopejoe1/nix-conf.git /var/lib/repo-sync + ${lib.getExe pkgs.git} -C /var/lib/repo-sync remote add github git@github.com:jopejoe1/nix-conf.git + ${lib.getExe pkgs.git} -C /var/lib/repo-sync remote add gitlab git@gitlab.com:jopejoe1/nix-conf.git + ${lib.getExe pkgs.git} -C /var/lib/repo-sync pull -r github main + ${lib.getExe pkgs.git} -C /var/lib/repo-sync pull -r gitlab main + ${lib.getExe pkgs.nix} flake update /var/lib/repo-sync + ${lib.getExe pkgs.git} -C /var/lib/repo-sync commit -m "flack.lock updated on `$(${pkgs.coreutils}/bin/date)`" + ${lib.getExe pkgs.git} -C /var/lib/repo-sync push origin + ${lib.getExe pkgs.git} -C /var/lib/repo-sync push github + ${lib.getExe pkgs.git} -C /var/lib/repo-sync push gitlab ${pkgs.coreutils}/bin/rm -r /var/lib/repo-sync ''; path = [pkgs.openssh];