start modularising NixOS config for several hosts
First step in modularising the NixOS config, with a focus on separation of host-specific and common configs. Common modules still need to be split up and refined, several TODOs and FIXUPs remain in code. But the config builds fine on thinknix. Roughly based on/ inspired by https://johns.codes/blog/organizing-system-configs-with-nixos#using-nixos
This commit is contained in:
parent
0639633b0d
commit
993308a2d3
11 changed files with 239 additions and 159 deletions
33
flake.nix
33
flake.nix
|
@ -14,6 +14,7 @@
|
|||
url = "github:nix-community/lanzaboote/v0.3.0";
|
||||
# deliberately do _not_ follow the nixpkgs input here, because paranoia and test coverage
|
||||
};
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
|
||||
nur.url = "github:nix-community/NUR";
|
||||
# TODO: possible make this a flake as well
|
||||
|
@ -25,24 +26,27 @@
|
|||
};
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs, nur, lanzaboote, ... }@inputs:
|
||||
{ self, nixpkgs, nur, lanzaboote, flake-utils, ... }@inputs:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
# FIXME: allow different systems
|
||||
systems = flake-utils.lib.system;
|
||||
# necessary to make the top-level inputs available to system configuration
|
||||
defaultModules = [
|
||||
{ _module.args = { inherit inputs; }; }
|
||||
];
|
||||
mkSystem = system: extraModules:
|
||||
nixpkgs.lib.nixosSystem rec {
|
||||
modules = defaultModules ++ extraModules;
|
||||
inherit system;
|
||||
};
|
||||
in
|
||||
{
|
||||
|
||||
nixosConfigurations.thinknix = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [ ./nixos/configuration.nix lanzaboote.nixosModules.lanzaboote ];
|
||||
# necessary to make the top-level inputs available to system configuration
|
||||
specialArgs = {
|
||||
#TODO: for system, consider moving to flake-utils
|
||||
inherit inputs system;
|
||||
};
|
||||
nixosConfigurations = {
|
||||
thinknix = mkSystem systems.x86_64-linux [ ./hosts/thinknix inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t440s lanzaboote.nixosModules.lanzaboote ];
|
||||
framenix = mkSystem systems.x86_64-linux [ ./hosts/framenix inputs.nixos-hardware.nixosModules.framework-13-7040-amd lanzaboote.nixosModules.lanzaboote ];
|
||||
};
|
||||
# FIXME: see mkHomemanager
|
||||
homeConfigurations.spiollinux = inputs.home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs;
|
||||
|
||||
modules = [
|
||||
{
|
||||
|
@ -58,8 +62,7 @@
|
|||
# Optionally use extraSpecialArgs
|
||||
# to pass through arguments to home.nix
|
||||
extraSpecialArgs = {
|
||||
#TODO: for system, consider moving to flake-utils
|
||||
inherit inputs system;
|
||||
inherit inputs;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue