nixos-config/system/nix.nix
Felix Schröter 7d3f467586
fix(system): ignore seven-modules in nixos-upgrade's flake updates
Prevents nixos-upgrade from failing due to interactive git authorization.
2025-06-08 22:58:13 +02:00

53 lines
1 KiB
Nix

{
inputs,
config,
pkgs,
lib,
...
}:
let
inherit (inputs.self.outputs) nixConfig;
in
{
nixpkgs.config.allowUnfree = true;
nix.package = pkgs.lix;
nix.gc = {
automatic = true;
dates = "04:00";
options = "--delete-older-than 30d";
};
nix.settings = {
trusted-users = [ "@wheel" ];
auto-optimise-store = true;
substituters = nixConfig.extra-substituters;
trusted-public-keys = nixConfig.extra-trusted-public-keys;
};
system.autoUpgrade = {
enable = true;
dates = "03:00";
flake = "/etc/nixos";
};
programs.git = {
enable = true;
config.safe.directory = [ "/etc/nixos" ];
};
systemd.services.nixos-upgrade.preStart =
let
inputsToIgnore = [
"self"
"seven-modules"
];
inputsToUpdate = lib.filter (i: !(lib.elem i inputsToIgnore)) (lib.attrNames inputs);
inputsToUpdateStr = lib.concatStringsSep " " inputsToUpdate;
in
''
nix flake update ${inputsToUpdateStr} --flake ${config.system.autoUpgrade.flake}
'';
}