From 3b5a73c436eb22e0cda59469263490705e149cb9 Mon Sep 17 00:00:00 2001 From: schererleander Date: Fri, 9 Jan 2026 16:57:15 +0100 Subject: refactor: use flake-parts, change modules structure --- modules/flake/nixos.nix | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 modules/flake/nixos.nix (limited to 'modules/flake/nixos.nix') diff --git a/modules/flake/nixos.nix b/modules/flake/nixos.nix new file mode 100644 index 0000000..efc6d15 --- /dev/null +++ b/modules/flake/nixos.nix @@ -0,0 +1,45 @@ +{ inputs, config, self, ... }: + +let + inherit (inputs.nixpkgs) lib; + import-tree = inputs.import-tree.withLib lib; + + # Use import-tree.leafs to get list of NixOS module paths + nixosModuleFiles = import-tree.leafs (self + /modules/nixos); + + # Common NixOS modules for all hosts + commonNixosModules = nixosModuleFiles ++ [ + { + nixpkgs.config.allowUnfree = true; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + } + ]; + + # Home-manager modules for hosts that use it + homeManagerModules = [ + inputs.home-manager.nixosModules.home-manager + { + home-manager.extraSpecialArgs = { inherit inputs; }; + home-manager.sharedModules = [ config.flake.homeModules.default ]; + } + ]; +in +{ + flake.nixosConfigurations = { + adam = lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; host = "adam"; }; + modules = commonNixosModules ++ homeManagerModules ++ [ + (self + /hosts/adam/configuration.nix) + ]; + }; + + sachiel = lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; host = "sachiel"; }; + modules = commonNixosModules ++ [ + (self + /hosts/sachiel/configuration.nix) + ]; + }; + }; +} -- cgit v1.3.1