AutoUpdate : Move from dotfiles to a separate module.
This commit is contained in:
parent
d550bb7363
commit
035fbdfd00
|
@ -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
|
||||
];
|
||||
|
|
23
.config/linux/system/module/common/AutoUpdate.nix
Normal file
23
.config/linux/system/module/common/AutoUpdate.nix
Normal 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" ];
|
||||
};
|
||||
}
|
|
@ -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 = {
|
||||
|
|
|
@ -8,7 +8,4 @@
|
|||
extraGroups = [ "networkmanager" ];
|
||||
packages = with pkgs; [ ];
|
||||
};
|
||||
|
||||
# Disable dconfload.
|
||||
systemd.user.services.dconfload.wantedBy = lib.mkForce [ ];
|
||||
}
|
||||
|
|
Reference in a new issue