move stateVersion to flake

This commit is contained in:
Peder Bergebakken Sundt 2024-01-11 01:00:20 +01:00
parent e59bfab7a6
commit 6528ccbcde
7 changed files with 19 additions and 74 deletions

View File

@ -121,14 +121,9 @@
#"riscv64-linux"
];
mkModule = hostname: domain: system: inputs: modules: ({ lib, ... }: {
#TODO: fix infinite recursion:
/** /
_module.args = lib.mkFinal {
inherit inputs;
flakes = mkFlakeView inputs system;
};
/**/
mkModule = hostname: domain: system: inputs: stateVersion: modules: ({ lib, ... }: {
system.stateVersion = lib.mkDefault stateVersion; # TODO: home-manager
imports = [
./base.nix
"${self}/hosts/${hostname}"
@ -137,13 +132,11 @@
] ++ modules;
#++ inputs.flake-programs-sqlite.nixosModules.programs-sqlite; # TODO: make work
sops = {
defaultSopsFile = lib.mkIf (builtins.pathExists ./secrets/${hostname}.yaml)
sops.defaultSopsFile = lib.mkIf (builtins.pathExists ./secrets/${hostname}.yaml)
./secrets/${hostname}.yaml;
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
age.keyFile = "/var/lib/sops-nix/key.txt";
age.generateKey = true;
};
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
sops.age.keyFile = "/var/lib/sops-nix/key.txt";
sops.age.generateKey = true;
home-manager.useGlobalPkgs = true; # go brrr, reuse overrides
home-manager.extraSpecialArgs = {
@ -169,7 +162,7 @@
nix.registry.nixpkgs.flake = inputs.nixpkgs;
nix.registry.nixpkgs-unstable.flake = inputs.unstable;
nix.registry.nixpkgs-git = {
from.id = "nixpkgs";
from.id = "nixpkgs-git";
from.type = "indirect";
to.type = "github";
to.owner = "NixOS";
@ -182,24 +175,24 @@
"nixpkgs-git=github:NixOS/nixpkgs/nixos-unstable-small"
];
});
mkConfig = hostname: domain: system: inputs: modules: inputs.nixpkgs.lib.nixosSystem {
mkConfig = hostname: domain: system: inputs: stateVersion: modules: inputs.nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
flakes = mkFlakeView inputs system;
};
modules = [ (mkModule hostname domain system inputs modules) ];
modules = [ (mkModule hostname domain system inputs stateVersion modules) ];
};
mkHosts = mk: with nixos-hardware.nixosModules; {
# TODO: move nixos-hardware imports to the nixos configs?
#attrpath "hostname" "domain" "system" inputs [ modules ... ]
noximilien = mk "noximilien" "pbsds.net" "x86_64-linux" inputs-2311 [ common-pc common-pc-ssd common-cpu-intel ];
brumlebasse = mk "brumlebasse" "pbsds.net" "x86_64-linux" inputs-2311 [ common-pc common-pc-ssd common-cpu-amd ];
nord = mk "nord" "pbsds.net" "x86_64-linux" inputs-2305 [ common-pc common-pc-ssd common-cpu-intel-cpu-only common-cpu-intel-sandy-bridge common-gpu-amd common-hidpi ];
sopp = mk "sopp" "pbsds.net" "x86_64-linux" inputs-2305 [ common-pc common-pc-ssd common-cpu-intel common-gpu-nvidia-nonprime ];
bolle = mk "bolle" "pbsds.net" "x86_64-linux" inputs-2311 [ common-pc common-pc-ssd common-cpu-intel ];
eple = mk "eple" "pbsds.net" "x86_64-linux" inputs-2311 [ common-pc common-pc-ssd common-cpu-intel ];
garp = mk "garp" "pbsds.net" "x86_64-linux" inputs-2305 [ common-pc common-pc-ssd common-cpu-intel-cpu-only common-gpu-nvidia-nonprime ];
#attrpath "hostname" "domain" "system" inputs "state" [ modules ... ]
noximilien = mk "noximilien" "pbsds.net" "x86_64-linux" inputs-2311 "22.11" [ common-pc common-pc-ssd common-cpu-intel ];
brumlebasse = mk "brumlebasse" "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ common-pc common-pc-ssd common-cpu-amd ];
nord = mk "nord" "pbsds.net" "x86_64-linux" inputs-2305 "22.11" [ common-pc common-pc-ssd common-cpu-intel-cpu-only common-cpu-intel-sandy-bridge common-gpu-amd common-hidpi ];
sopp = mk "sopp" "pbsds.net" "x86_64-linux" inputs-2305 "23.05" [ common-pc common-pc-ssd common-cpu-intel common-gpu-nvidia-nonprime ];
bolle = mk "bolle" "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ common-pc common-pc-ssd common-cpu-intel ];
eple = mk "eple" "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ common-pc common-pc-ssd common-cpu-intel ];
garp = mk "garp" "pbsds.net" "x86_64-linux" inputs-2311 "23.11" [ common-pc common-pc-ssd common-cpu-intel-cpu-only common-gpu-nvidia-nonprime ];
#gomperud smattkuken skrytebiffen skalkesnerken balleby brumlebasse bingus skjrlaltatjlstad
#bergjlot snortheimsmoen ditlefsen skrukkerud podebusk zmaragd makrell alfnes blix urke eple hasselknippe pytte uddu imdorf rosenqvist
};
@ -215,7 +208,7 @@
flakes-2305 = mkFlakeView inputs-2305 system;
});
nixosModules = mkHosts mkModule;
nixosModules = mkHosts mkModule;
nixosConfigurations = mkHosts mkConfig;
packages = forAllSystems ({ inputs, pkgs, flakes, ... }: {

View File

@ -55,12 +55,4 @@
# TODO: remove? Move?
programs.dconf.enable = true;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
}

View File

@ -49,12 +49,4 @@
# TODO: remove? Move?
programs.dconf.enable = true;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # Did you read the comment?
}

View File

@ -50,12 +50,4 @@
# TODO: remove? Move?
programs.dconf.enable = true;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
}

View File

@ -62,12 +62,4 @@
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # Did you read the comment?
}

View File

@ -75,12 +75,4 @@
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.11"; # Did you read the comment?
}

View File

@ -132,12 +132,4 @@
# TODO: remove? Move?
programs.dconf.enable = true;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.11"; # Did you read the comment?
}