diff --git a/flake.lock b/flake.lock index bbfc80b7..acb7395e 100644 --- a/flake.lock +++ b/flake.lock @@ -135,7 +135,9 @@ "nixpkgs": [ "nixpkgs" ], - "pypi-deps-db": "pypi-deps-db" + "pypi-deps-db": [ + "pypi-deps-db" + ] }, "locked": { "lastModified": 1654084003, @@ -170,11 +172,11 @@ "pypi-deps-db": { "flake": false, "locked": { - "lastModified": 1643877077, - "narHash": "sha256-jv8pIvRFTP919GybOxXE5TfOkrjTbdo9QiCO1TD3ZaY=", + "lastModified": 1669590640, + "narHash": "sha256-w7HNNhdrYX1ystc/Djo5nEy2YjoYoxmRMrsqCyIF3pg=", "owner": "DavHau", "repo": "pypi-deps-db", - "rev": "da53397f0b782b0b18deb72ef8e0fb5aa7c98aa3", + "rev": "982b6cdf6552fb9296e1ade29cf65a2818cbbd6b", "type": "github" }, "original": { @@ -217,6 +219,7 @@ "home-manager": "home-manager", "mach-nix": "mach-nix", "nixpkgs": "nixpkgs", + "pypi-deps-db": "pypi-deps-db", "ragenix": "ragenix", "scalpel": "scalpel", "tree": "tree", diff --git a/flake.nix b/flake.nix index c7c3fd40..9c47cd5e 100644 --- a/flake.nix +++ b/flake.nix @@ -37,11 +37,16 @@ sops-nix.follows = "empty"; }; }; + pypi-deps-db = { + url = "github:DavHau/pypi-deps-db"; + flake = false; + }; mach-nix = { url = "mach-nix/3.5.0"; inputs = { nixpkgs.follows = "nixpkgs"; flake-utils.follows = "utils"; + pypi-deps-db.follows = "pypi-deps-db"; }; }; arcexprs = { diff --git a/outputs.nix b/outputs.nix index 35549b04..073ea9a3 100644 --- a/outputs.nix +++ b/outputs.nix @@ -35,87 +35,104 @@ }; }).impure; lib = inputs.nixpkgs.lib; - inherit (lib.attrsets) mapAttrs; -in utils.lib.mkFlake { - inherit self inputs; - supportedSystems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ]; - channelsConfig.allowUnfree = true; + inherit (lib.lists) fold; + inherit (lib.attrsets) mapAttrs recursiveUpdate; + recursiveMergeAttrs = listOfAttrsets: fold (attrset: acc: recursiveUpdate attrset acc) {} listOfAttrsets; +in recursiveMergeAttrs [ + (utils.lib.mkFlake { + inherit self inputs; + supportedSystems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ]; + channelsConfig.allowUnfree = true; - hostDefaults = { - system = "x86_64-linux"; - modules = [ - tree.system.modules - ]; - extraArgs = { - inherit inputs tree; - }; - }; - - hosts = let - outputForSystem = system: { - "x86_64-linux" = "nixosConfigurations"; - "aarch64-darwin" = "darwinConfigurations"; - }.${system}; - builderForSystem = system: { - "x86_64-linux" = nixpkgs.lib.nixosSystem; - "aarch64-darwin" = darwin.lib.darwinSystem; - }.${system}; - modulesForSystem = system: { - "x86_64-linux" = [ - home-manager.nixosModules.home-manager - ragenix.nixosModules.age - tree.nixos.modules - ]; - "aarch64-darwin" = [ - home-manager.darwinModules.home-manager - ragenix.nixosModules.age - tree.darwin.modules - ]; - }.${system}; - mapSystem = system: name: path: { - inherit system; - output = outputForSystem system; - builder = builderForSystem system; - modules = (modulesForSystem system) ++ [ - path - ]; - extraArgs = { - machine = name; - }; - }; - in mapAttrs (mapSystem "x86_64-linux") tree.nixos.systems - // mapAttrs (mapSystem "aarch64-darwin") tree.darwin.systems; - - outputsBuilder = channels: { - nixosConfigurations = mapAttrs(_: sys: sys.extendModules { - modules = [ scalpel.nixosModule ]; - specialArgs = { - prev = sys; - }; - }) self.nixosConfigurations; - - homeManagerConfigurations = mapAttrs (name: path: home-manager.lib.homeManagerConfiguration { - pkgs = channels.nixpkgs; - extraSpecialArgs = { - inherit channels inputs tree; - machine = name; - nixos = {}; - }; + hostDefaults = { + system = "x86_64-linux"; modules = [ tree.system.modules - tree.home.common - path ]; - }) tree.home.profiles; - - inherit tree; - }; - - devShells = { - "python" = mach-nix.mkPythonShell { - python = "python310"; - requirements = '' - ''; + extraArgs = { + inherit inputs tree; + }; }; - }; -} + + hosts = let + outputForSystem = system: { + "x86_64-linux" = "nixosConfigurations"; + "aarch64-darwin" = "darwinConfigurations"; + }.${system}; + builderForSystem = system: { + "x86_64-linux" = nixpkgs.lib.nixosSystem; + "aarch64-darwin" = darwin.lib.darwinSystem; + }.${system}; + modulesForSystem = system: { + "x86_64-linux" = [ + home-manager.nixosModules.home-manager + ragenix.nixosModules.age + tree.nixos.modules + ]; + "aarch64-darwin" = [ + home-manager.darwinModules.home-manager + ragenix.nixosModules.age + tree.darwin.modules + ]; + }.${system}; + mapSystem = system: name: path: { + inherit system; + output = outputForSystem system; + builder = builderForSystem system; + modules = (modulesForSystem system) ++ [ + path + ]; + extraArgs = { + machine = name; + }; + }; + in mapAttrs (mapSystem "x86_64-linux") tree.nixos.systems + // mapAttrs (mapSystem "aarch64-darwin") tree.darwin.systems; + + outputsBuilder = channels: { + nixosConfigurations = mapAttrs(_: sys: sys.extendModules { + modules = [ scalpel.nixosModule ]; + specialArgs = { + prev = sys; + }; + }) self.nixosConfigurations; + + homeManagerConfigurations = mapAttrs (name: path: home-manager.lib.homeManagerConfiguration { + pkgs = channels.nixpkgs; + extraSpecialArgs = { + inherit channels inputs tree; + machine = name; + nixos = {}; + }; + modules = [ + tree.system.modules + tree.home.common + path + ]; + }) tree.home.profiles; + + devShells = { + rust = with channels.nixpkgs; mkShell { + nativeBuildInputs = [ + cargo + rustc + rustfmt + rustPackages.clippy + rust-analyzer + ]; + RUST_SRC_PATH = rustPlatform.rustLibSrc; + }; + }; + inherit tree; + }; + }) + (utils.lib.eachDefaultSystem (system: { + devShells.python = nixpkgs.legacyPackages."${system}".mkShell { + buildInputs = let + pythonWithPkgs = mach-nix.lib."${system}".mkPython { + ignoreDataOutdated = true; + python = "python310"; + }; in [ pythonWithPkgs ]; + }; + })) +]