Merge branch 'main' of ssh://code.8bitbuddhism.com/aires/nix-configuration
This commit is contained in:
commit
184a8a72aa
|
@ -252,7 +252,7 @@
|
|||
"locked": {
|
||||
"lastModified": 1717092160,
|
||||
"narHash": "sha256-dype0zRMyP94Uo8YC1vWQ6lkvXLYMep6+Xo7AW4K9cs=",
|
||||
"ref": "42ddf14d36d9fab1eb070f51fdf1991d1a21dde9",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "42ddf14d36d9fab1eb070f51fdf1991d1a21dde9",
|
||||
"revCount": 42,
|
||||
"type": "git",
|
||||
|
|
|
@ -8,6 +8,20 @@
|
|||
|
||||
let
|
||||
cfg = config.host.services.autoUpgrade;
|
||||
|
||||
# List of packages to include in each service's $PATH
|
||||
pathPkgs = with pkgs; [
|
||||
# Courtesy of https://discourse.nixos.org/t/how-to-use-other-packages-binary-in-systemd-service-configuration/14363
|
||||
coreutils
|
||||
gnutar
|
||||
xz.bin
|
||||
gzip
|
||||
git
|
||||
config.nix.package.out
|
||||
nh
|
||||
openssh
|
||||
sudo
|
||||
];
|
||||
in
|
||||
{
|
||||
options = {
|
||||
|
@ -31,22 +45,14 @@ in
|
|||
Type = "oneshot";
|
||||
User = "root";
|
||||
};
|
||||
path = with pkgs; [
|
||||
coreutils
|
||||
gnutar
|
||||
xz.bin
|
||||
gzip
|
||||
git
|
||||
config.nix.package.out
|
||||
nh
|
||||
openssh
|
||||
sudo
|
||||
];
|
||||
path = pathPkgs;
|
||||
script = ''
|
||||
cd ${config.users.users.aires.home}/Development/nix-configuration
|
||||
# Check if there are changes from Git
|
||||
cd ${config.secrets.nixConfigFolder}
|
||||
# Check if there are changes from Git.
|
||||
# Since we're running this as root, we need to su into the user who owns the config folder.
|
||||
sudo -u aires git fetch
|
||||
sudo -u aires git diff --exit-code main origin/main
|
||||
# If we have changes (git diff returns 1), pull changes and run the update
|
||||
if [ $? -eq 1 ]; then
|
||||
sudo -u aires git pull --recurse-submodules
|
||||
nh os switch
|
||||
|
@ -71,19 +77,12 @@ in
|
|||
Type = "oneshot";
|
||||
User = config.users.users.aires.name;
|
||||
};
|
||||
path = with pkgs; [
|
||||
# Courtesy of https://discourse.nixos.org/t/how-to-use-other-packages-binary-in-systemd-service-configuration/14363
|
||||
coreutils
|
||||
gnutar
|
||||
xz.bin
|
||||
gzip
|
||||
git
|
||||
config.nix.package.out
|
||||
openssh
|
||||
];
|
||||
path = pathPkgs;
|
||||
# Git diffing strategy courtesy of https://stackoverflow.com/a/40255467
|
||||
script = ''
|
||||
set -eu
|
||||
cd ${config.secrets.nixConfigFolder}
|
||||
# Make sure we're up-to-date
|
||||
git pull --recurse-submodules
|
||||
nix flake update --commit-lock-file
|
||||
git push
|
||||
|
|
Loading…
Reference in a new issue