diff options
author | sinanmohd <sinan@sinanmohd.com> | 2025-06-10 22:06:02 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2025-06-10 23:05:27 +0530 |
commit | aee9216af6875662235fd8839a827e724e53c845 (patch) | |
tree | c8c11981828c93f30475ed4dcc27aa9fd27696cb /flake.nix | |
parent | a41037ef644dbacb3d577933fb3d93c210439b38 (diff) |
feat(flake/nixosModules): init
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 75 |
1 files changed, 28 insertions, 47 deletions
@@ -33,69 +33,50 @@ let lib = nixpkgs.lib; - makeGlobalImports = - host: - [ - ./global/common - ] - ++ lib.optional (builtins.pathExists ./global/${host}) ./global/${host}; - - makeHomeImports = - host: - makeGlobalImports host - ++ [ - ./home/common/home.nix - ] - ++ lib.optional (builtins.pathExists ./home/${host}) ./home/${host}/home.nix; - makeNixos = host: system: lib.nixosSystem { inherit system; - specialArgs = { inherit nixos-hardware; }; - modules = [ - alina.nixosModules.alina - sops-nix.nixosModules.sops + specialArgs = { + inherit alina; + inherit nixos-hardware; + }; + modules = [ + self.nixosModules.common ./os/${host}/configuration.nix - { - networking.hostName = host; - nix.nixPath = [ "nixpkgs=${nixpkgs}" ]; - } - - home-manager.nixosModules.home-manager - ( - { config, ... }: - let - username = config.global.userdata.name; - in - { - home-manager = { - useGlobalPkgs = true; - useUserPackages = false; - users.${username} = - { ... }: - { - imports = makeHomeImports host; - }; - }; - } - ) - ] ++ (makeGlobalImports host); + ]; }; makeHome = host: system: home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.${system}; - modules = makeHomeImports host; + modules = [ + ./home/common/home.nix + ] ++ lib.optional (builtins.pathExists ./home/${host}) ./home/${host}/home.nix; }; in { - nixosConfigurations = lib.genAttrs [ "cez" "kay" "lia" "fscusat" "dspace" ] ( - host: makeNixos host "x86_64-linux" - ); + nixosModules = lib.genAttrs [ "common" "server" "pc" ] (host: { + nix.nixPath = [ "nixpkgs=${nixpkgs}" ]; + imports = [ + ./os/${host}/configuration.nix + sops-nix.nixosModules.sops + home-manager.nixosModules.home-manager + ]; + }); + + nixosConfigurations = lib.genAttrs [ + "common" + "server" + "pc" + "cez" + "kay" + "lia" + "fscusat" + ] (host: makeNixos host "x86_64-linux"); homeConfigurations = lib.genAttrs [ "common" "wayland" "pc" "cez" ] ( host: makeHome host "x86_64-linux" |