diff --git a/flake.lock b/flake.lock index 0de0dd2..d11c3a0 100644 --- a/flake.lock +++ b/flake.lock @@ -3,7 +3,6 @@ "home-manager": { "inputs": { "nixpkgs": [ - "modules", "nixpkgs" ] }, @@ -21,27 +20,9 @@ "type": "github" } }, - "modules": { - "inputs": { - "home-manager": "home-manager", - "nix-darwin": "nix-darwin", - "nixpkgs": "nixpkgs" - }, - "locked": { - "lastModified": 1, - "narHash": "sha256-FhENMA/zHvdxdkq1OQ27RoZ/AAIFKLMEFMSgA+/L4pA=", - "path": "modules/", - "type": "path" - }, - "original": { - "path": "modules/", - "type": "path" - } - }, "nix-darwin": { "inputs": { "nixpkgs": [ - "modules", "nixpkgs" ] }, @@ -93,8 +74,10 @@ }, "root": { "inputs": { - "modules": "modules", - "nixos-hardware": "nixos-hardware" + "home-manager": "home-manager", + "nix-darwin": "nix-darwin", + "nixos-hardware": "nixos-hardware", + "nixpkgs": "nixpkgs" } } }, diff --git a/flake.nix b/flake.nix index e44bcf4..90e5649 100644 --- a/flake.nix +++ b/flake.nix @@ -1,14 +1,28 @@ { inputs = { - modules = { - url = "path:modules/"; - }; nixos-hardware = { url = "github:NixOS/nixos-hardware/master"; }; + nixpkgs = { + url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + }; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nix-darwin = { + url = "github:LnL7/nix-darwin"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, modules, nixos-hardware }: + outputs = + { self + , nixos-hardware + , nixpkgs + , home-manager + , nix-darwin + }: let user = { name = "ari"; @@ -16,9 +30,15 @@ email = "ariel@sosnovsky.ca"; }; homeMangerVersion = "24.05"; + lib = (import modules/lib.nix { + nixpkgs = nixpkgs; + home-manager = home-manager; + nix-darwin = nix-darwin; + }); in { - nixosConfigurations."fwbook" = modules.lib.makeNixOsModule { + lib = lib; + nixosConfigurations."fwbook" = lib.makeNixOsModule { system = "x86_64-linux"; user = user; systemStateVersion = "23.11"; @@ -45,7 +65,12 @@ hardware = { enable = true; }; }; configuration = { ... }: { - imports = [ nixos-hardware.nixosModules.framework-13-7040-amd ]; + imports = [ + nixos-hardware.nixosModules.framework-13-7040-amd + (import ./hosts/fwbook.nix { + user = user; + }) + ]; }; }; }; diff --git a/modules/flake.lock b/modules/flake.lock deleted file mode 100644 index a53ea32..0000000 --- a/modules/flake.lock +++ /dev/null @@ -1,69 +0,0 @@ -{ - "nodes": { - "home-manager": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1715930644, - "narHash": "sha256-W9pyM3/vePxrffHtzlJI6lDS3seANQ+Nqp+i58O46LI=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "e3ad5108f54177e6520535768ddbf1e6af54b59d", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, - "nix-darwin": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1715901937, - "narHash": "sha256-eMyvWP56ZOdraC2IOvZo0/RTDcrrsqJ0oJWDC76JTak=", - "owner": "LnL7", - "repo": "nix-darwin", - "rev": "ffc01182f90118119930bdfc528c1ee9a39ecef8", - "type": "github" - }, - "original": { - "owner": "LnL7", - "repo": "nix-darwin", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1716062047, - "narHash": "sha256-OhysviwHQz4p2HZL4g7XGMLoUbWMjkMr/ogaR3VUYNA=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "02923630b89aa1ab36ef8e422501a6f4fd4b2016", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "home-manager": "home-manager", - "nix-darwin": "nix-darwin", - "nixpkgs": "nixpkgs" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/modules/flake.nix b/modules/flake.nix deleted file mode 100644 index a6d27f7..0000000 --- a/modules/flake.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ - description = "Main Flake"; - inputs = { - nixpkgs = { - url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - }; - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - nix-darwin = { - url = "github:LnL7/nix-darwin"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - }; - outputs = { self, home-manager, nix-darwin, nixpkgs }: { - lib = { - makeImports = { ... }@attrs: [ (import ./main.nix attrs) ]; - makeNixOsModule = { system, configuration ? null, ... }@attrs: - nixpkgs.lib.nixosSystem { - system = system; - modules = (self.lib.makeImports attrs) - ++ (if attrs.home-manager.enable then - [ home-manager.nixosModules.default ] - else - [ ]) - ++ (if (isNull configuration) then [ configuration ] else [ ]); - }; - makeDarwinModule = - { system ? "x86_64-darwin", user, configuration ? null, ... }@attrs: - nix-darwin.lib.darwinSystem { - modules = (self.lib.makeImports attrs) - ++ (if attrs.home-manager.enable then [ - home-manager.darwinModules.home-manager - (import ./macos-home-manager.nix { user = user; }) - ] else - [ ]) - ++ (if (isNull configuration) then [ configuration ] else [ ]) ++ [ - (import ./macos.nix { - user = user; - system = system; - }) - ]; - darwinPackages = self.darwinConfigurations."default".pkgs; - }; - }; - }; -} diff --git a/modules/lib.nix b/modules/lib.nix new file mode 100644 index 0000000..f50faa9 --- /dev/null +++ b/modules/lib.nix @@ -0,0 +1,34 @@ +{ nixpkgs +, home-manager +, nix-darwin +}: +{ + makeImports = { ... }@attrs: [ (import ./main.nix attrs) ]; + makeNixOsModule = { system, configuration ? null, ... }@attrs: + nixpkgs.lib.nixosSystem { + system = system; + modules = (self.lib.makeImports attrs) + ++ (if attrs.home-manager.enable then + [ home-manager.nixosModules.default ] + else + [ ]) + ++ (if (isNull configuration) then [ configuration ] else [ ]); + }; + makeDarwinModule = + { system ? "x86_64-darwin", user, configuration ? null, ... }@attrs: + nix-darwin.lib.darwinSystem { + modules = (self.lib.makeImports attrs) + ++ (if attrs.home-manager.enable then [ + home-manager.darwinModules.home-manager + (import ./macos-home-manager.nix { user = user; }) + ] else + [ ]) + ++ (if (isNull configuration) then [ configuration ] else [ ]) ++ [ + (import ./macos.nix { + user = user; + system = system; + }) + ]; + darwinPackages = self.darwinConfigurations."default".pkgs; + }; +}