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

View File

@ -55,12 +55,4 @@
# TODO: remove? Move? # TODO: remove? Move?
programs.dconf.enable = true; 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? # TODO: remove? Move?
programs.dconf.enable = true; 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? # TODO: remove? Move?
programs.dconf.enable = true; 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). # Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true; # 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). # Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true; # 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? # TODO: remove? Move?
programs.dconf.enable = true; 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?
} }