config/profiles/auto-upgrade.nix

51 lines
2.5 KiB
Nix
Raw Normal View History

2023-06-24 19:11:49 +02:00
{ config, pkgs, lib, inputs, ... }:
2024-06-06 21:31:22 +02:00
# TODO: make /etc/nixos a symlink to the in-store flake? - bad idea, horrible error recovery
# TODO: make /etc/nixos a writeable checkout of repo?
2023-06-24 19:11:49 +02:00
{
2024-02-11 02:08:03 +01:00
2023-06-24 19:11:49 +02:00
system.autoUpgrade.enable = true;
#system.autoUpgrade.allowReboot = true; # reboot after a kernel (module) or initrd upgrade, consider also setting `rebootWindow`
2024-09-15 22:02:48 +02:00
environment.etc."current-system-flake".source = inputs.self;
# workaround for https://github.com/NixOS/nix/issues/6895
environment.etc."current-system-flake-inputs.json".source
= pkgs.writers.writeJSON "flake-inputs.json" (
lib.flip lib.mapAttrs inputs (name: input:
# inputs.*.sourceInfo sans outPath, since writeJSON will otherwise serialize sourceInfo like derivation
lib.filterAttrs (key: val: !builtins.elem key ["outPath"]) (input.sourceInfo or {})
// { store-path = input.outPath; } # comment this line if you don't want to retain a store reference to the flake inputs
)
);
2024-02-11 05:00:48 +01:00
2024-06-06 21:31:22 +02:00
#system.autoUpgrade.flake = inputs.self.outPath; # a nix store path
2023-06-24 19:11:49 +02:00
#system.autoUpgrade.flake = "github:pbsds/nix-config"; # TODO: use this instead?
2024-07-31 01:49:16 +02:00
#system.autoUpgrade.flake = "git+https://gitea.noximilien.pbsds.net/pbsds/config.git";
system.autoUpgrade.flake = "git+https://git.pvv.ntnu.no/pederbs/config.git";
2024-02-11 05:00:48 +01:00
2023-06-24 19:11:49 +02:00
system.autoUpgrade.flags = [
2024-06-06 21:31:22 +02:00
"-L" # print build logs
2023-06-24 19:11:49 +02:00
"--no-write-lock-file" # no write new flakelock, as the in-store flake is read-only
2024-09-14 00:30:14 +02:00
"--option" "access-tokens" "" # don't risk an expired github token blocking the upgrade
2024-06-06 21:31:22 +02:00
# fetch new inputs
#"--recreate-lock-file" # update all
2024-09-13 23:02:32 +02:00
#"--override-input" "nixpkgs-edge" # deprecated in nix 2.22, removed in lix 2.90
"--refresh"
"--override-input" "nixpkgs-edge" "github:NixOS/nixpkgs/nixos-unstable"
"--override-input" "nixpkgs-2405" "github:NixOS/nixpkgs/nixos-24.05"
"--override-input" "nixpkgs-2311" "github:NixOS/nixpkgs/nixos-23.11"
"--override-input" "home-manager-edge" "github:nix-community/home-manager/master"
"--override-input" "home-manager-2405" "github:nix-community/home-manager/release-24.05"
"--override-input" "home-manager-2311" "github:nix-community/home-manager/release-23.11"
"--override-input" "nix-index-database" "github:Mic92/nix-index-database"
"--override-input" "nixos-hardware" "github:NixOS/nixos-hardware"
2023-06-24 19:11:49 +02:00
];
2024-07-08 22:30:11 +02:00
# lots of "empty" updates
boot.loader.grub.configurationLimit = 15;
boot.loader.systemd-boot.configurationLimit = 15;
boot.loader.generic-extlinux-compatible.configurationLimit = 15;
2023-06-24 19:11:49 +02:00
}