AutoUpdate : Move from dotfiles to a separate module.

This commit is contained in:
Dmitry Voronin 2024-03-03 20:34:06 +03:00
parent d550bb7363
commit 035fbdfd00
5 changed files with 26 additions and 5 deletions

View file

@ -105,6 +105,7 @@
# Common modules used across all hosts.
nixosModules.common.imports = [
./module/common/AutoRebuild.nix
./module/common/Bash.nix
./module/common/Bootloader.nix
./module/common/Distrobox.nix
@ -225,7 +226,8 @@
modules = [
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
"${nixpkgs}/nixos/modules/installer/cd-dvd/channel.nix"
{ networking.wireless.enable = nixpkgs.lib.mkForce false; }
{ networking.wireless.enable = nixpkgs.lib.mkForce false; }
{ systemd.services.autoupdate.wantedBy = nixpkgs.lib.mkForce []; }
({ pkgs, ... }: { boot.kernelPackages = nixpkgs.lib.mkForce pkgs.linuxPackages; })
./module/Gnome.nix
];

View file

@ -0,0 +1,23 @@
{ pkgs, inputs, lib, config, ... }: {
systemd.services.autoupdate = {
description = "Automatically rebuild the system.";
wantedBy = [ "multi-user.target" ];
wants = [ "dotfiles.service" ];
after = [ "dotfiles.service" ];
serviceConfig.Type = "oneshot";
path = with pkgs; [
git
];
script = ''
${config.system.build.nixos-rebuild}/bin/nixos-rebuild boot --flake "/root/.config/linux/system#$HOSTNAME"
'';
};
systemd.timers.autoupdate = {
timerConfig = {
OnCalendar = "daily";
Persistent = true;
Unit = "autoupdate.service";
};
wantedBy = [ "timers.target" ];
};
}

View file

@ -29,7 +29,6 @@
${lib.getExe pkgs.git} clean -f
};
${lib.getExe pkgs.git} pull
[[ "$UID" = "0" ]] && [[ "$HOSTNAME" != "live" ]] && ${config.system.build.nixos-rebuild}/bin/nixos-rebuild boot --flake "/root/.config/linux/system#$HOSTNAME"
'';
};
timer = {

View file

@ -8,7 +8,4 @@
extraGroups = [ "networkmanager" ];
packages = with pkgs; [ ];
};
# Disable dconfload.
systemd.user.services.dconfload.wantedBy = lib.mkForce [ ];
}