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/darwin.nix | 22 ++++++++++++++++++++++ modules/flake/home.nix | 22 ++++++++++++++++++++++ modules/flake/nixos.nix | 45 +++++++++++++++++++++++++++++++++++++++++++++ modules/flake/systems.nix | 9 +++++++++ 4 files changed, 98 insertions(+) create mode 100644 modules/flake/darwin.nix create mode 100644 modules/flake/home.nix create mode 100644 modules/flake/nixos.nix create mode 100644 modules/flake/systems.nix (limited to 'modules/flake') diff --git a/modules/flake/darwin.nix b/modules/flake/darwin.nix new file mode 100644 index 0000000..84eb74d --- /dev/null +++ b/modules/flake/darwin.nix @@ -0,0 +1,22 @@ +{ inputs, config, self, ... }: + +{ + flake.darwinConfigurations = { + lilith = inputs.nix-darwin.lib.darwinSystem { + system = "aarch64-darwin"; + specialArgs = { inherit inputs; host = "lilith"; }; + modules = [ + inputs.home-manager.darwinModules.home-manager + { + home-manager.extraSpecialArgs = { inherit inputs; }; + home-manager.sharedModules = [ config.flake.homeModules.default ]; + } + (self + /hosts/lilith/configuration.nix) + { + nixpkgs.config.allowUnfree = true; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + } + ]; + }; + }; +} diff --git a/modules/flake/home.nix b/modules/flake/home.nix new file mode 100644 index 0000000..288b558 --- /dev/null +++ b/modules/flake/home.nix @@ -0,0 +1,22 @@ +{ inputs, self, ... }: + +let + inherit (inputs.nixpkgs) lib; + import-tree = inputs.import-tree.withLib lib; + + homeModuleFiles = import-tree.leafs (self + /modules/home); +in +{ + imports = [ + inputs.home-manager.flakeModules.home-manager + ]; + + flake.homeModules = { + default = { + imports = homeModuleFiles ++ [ + inputs.nixcord.homeModules.nixcord + inputs.spicetify-nix.homeManagerModules.spicetify + ]; + }; + }; +} 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) + ]; + }; + }; +} diff --git a/modules/flake/systems.nix b/modules/flake/systems.nix new file mode 100644 index 0000000..e66e2e1 --- /dev/null +++ b/modules/flake/systems.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + # Define systems for perSystem (even if we don't use it much) + systems = [ + "x86_64-linux" + "aarch64-darwin" + ]; +} -- cgit v1.3.1