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.
|
# Common modules used across all hosts.
|
||||||
nixosModules.common.imports = [
|
nixosModules.common.imports = [
|
||||||
|
./module/common/AutoRebuild.nix
|
||||||
./module/common/Bash.nix
|
./module/common/Bash.nix
|
||||||
./module/common/Bootloader.nix
|
./module/common/Bootloader.nix
|
||||||
./module/common/Distrobox.nix
|
./module/common/Distrobox.nix
|
||||||
|
@ -226,6 +227,7 @@
|
||||||
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
|
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
|
||||||
"${nixpkgs}/nixos/modules/installer/cd-dvd/channel.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; })
|
({ pkgs, ... }: { boot.kernelPackages = nixpkgs.lib.mkForce pkgs.linuxPackages; })
|
||||||
./module/Gnome.nix
|
./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} clean -f
|
||||||
};
|
};
|
||||||
${lib.getExe pkgs.git} pull
|
${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 = {
|
timer = {
|
||||||
|
|
|
@ -8,7 +8,4 @@
|
||||||
extraGroups = [ "networkmanager" ];
|
extraGroups = [ "networkmanager" ];
|
||||||
packages = with pkgs; [ ];
|
packages = with pkgs; [ ];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Disable dconfload.
|
|
||||||
systemd.user.services.dconfload.wantedBy = lib.mkForce [ ];
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue