diff --git a/default.nix b/default.nix index 6785039..d9ff899 100644 --- a/default.nix +++ b/default.nix @@ -23,7 +23,6 @@ magic-vlsi, netgen, volare, - octave, xschem, ngspice, @@ -69,7 +68,6 @@ klayout-gdsfactory magic-vlsi netgen - octave ngspice xschem ]; diff --git a/flake.lock b/flake.lock index ac6bfc1..7580fb1 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ ] }, "locked": { - "lastModified": 1722113426, - "narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=", + "lastModified": 1728330715, + "narHash": "sha256-xRJ2nPOXb//u1jaBnDP56M7v5ldavjbtR6lfGqSvcKg=", "owner": "numtide", "repo": "devshell", - "rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae", + "rev": "dd6b80932022cea34a019e2bb32f6fa9e494dfef", "type": "github" }, "original": { @@ -23,6 +23,7 @@ }, "flake-compat": { "locked": { + "lastModified": 1696426674, "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "revCount": 57, @@ -39,11 +40,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1727685714, - "narHash": "sha256-WI7eCVT8fp4k6Iizky0UeFr/3vPnOat1P1gr+tLufRk=", + "lastModified": 1733237725, + "narHash": "sha256-K9OVkEkd/hXOoXk1tqhlcdVniwLxba+3BJGhN+v9zmM=", "owner": "efabless", "repo": "nix-eda", - "rev": "3fc4884a62cd3b62230ee90b9687f5aaebe98543", + "rev": "6f2bcc5fdf1092d5e51b164de8c862ac4f39a7e2", "type": "github" }, "original": { @@ -84,11 +85,11 @@ ] }, "locked": { - "lastModified": 1715167549, - "narHash": "sha256-QzMKToqiDQzMjBM2TW1VGMUxSLj70Uk4IdJVjIdkd5c=", + "lastModified": 1724178650, + "narHash": "sha256-p+Li/z3l7ShRSIKUrxVK+7uGhSvqPE7jOW4FA4k3SIw=", "owner": "efabless", "repo": "volare", - "rev": "b72ce150b80f67278d4c6b025183fb3941cab993", + "rev": "0090420799258d29adca54c8951d38bb8b605aeb", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index b3f854d..d42227e 100644 --- a/flake.nix +++ b/flake.nix @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. { + description = "open-source framework for automatic circuit characterization"; + nixConfig = { extra-substituters = [ "https://openlane.cachix.org" @@ -37,66 +39,108 @@ volare, devshell, ... - }: { + }: let + nixpkgs = nix-eda.inputs.nixpkgs; + lib = nixpkgs.lib; + in { # Common - input-overlays = [ - (import ./nix/overlay.nix) - (devshell.overlays.default) - ]; - + overlays = { + default = lib.composeManyExtensions [ + (import ./nix/overlay.nix) + (nix-eda.flakesToOverlay [volare]) + ( + pkgs': pkgs: let + callPackage = lib.callPackageWith pkgs'; + in { + colab-env = callPackage ./nix/colab-env.nix {}; + } + ) + ( + nix-eda.composePythonOverlay (pkgs': pkgs: pypkgs': pypkgs: let + callPythonPackage = lib.callPackageWith (pkgs' // pkgs'.python3.pkgs); + in { + cace = callPythonPackage ./default.nix {}; + }) + ) + (pkgs': pkgs: let + callPackage = lib.callPackageWith pkgs'; + in + {} + // lib.optionalAttrs pkgs.stdenv.isLinux { + cace-docker = callPackage ./nix/docker.nix { + createDockerImage = nix-eda.createDockerImage; + cace = pkgs'.python3.pkgs.cace; + }; + }) + ]; + }; + # Helper functions createCaceShell = import ./nix/create-shell.nix; - # Outputs - packages = - nix-eda.forAllSystems { - current = self; - withInputs = [nix-eda volare]; - } ( - util: let - self = with util; - { - colab-env = callPackage ./nix/colab-env.nix {}; - cace = callPythonPackage ./default.nix {}; - default = self.cace; - } - // (pkgs.lib.optionalAttrs (pkgs.stdenv.isLinux) {cace-docker = callPackage ./nix/docker.nix {createDockerImage = nix-eda.createDockerImage;};}); - in - self - ); + # Packages + legacyPackages = nix-eda.forAllSystems ( + system: + import nix-eda.inputs.nixpkgs { + inherit system; + overlays = [devshell.overlays.default nix-eda.overlays.default self.overlays.default]; + } + ); - devShells = nix-eda.forAllSystems {withInputs = [self devshell nix-eda volare];} ( - util: - with util; rec { - default = - callPackage (self.createCaceShell { - }) {}; - notebook = callPackage (self.createCaceShell { - extra-packages = with pkgs; [ - jupyter - ]; - }) {}; - dev = callPackage (self.createCaceShell { - extra-packages = with pkgs; [ - ]; - extra-python-packages = with pkgs.python3.pkgs; [ - setuptools - build - twine - black # blue - ]; - }) {}; - docs = callPackage (self.createCaceShell { - extra-packages = with pkgs; [ - ]; - extra-python-packages = with pkgs.python3.pkgs; [ - sphinx - myst-parser - furo - sphinx-autobuild - ]; - }) {}; + packages = nix-eda.forAllSystems ( + system: let + pkgs = (self.legacyPackages."${system}"); + in { + inherit (pkgs) colab-env; + inherit (pkgs.python3.pkgs) cace; + default = pkgs.python3.pkgs.cace; + } + // lib.optionalAttrs pkgs.stdenv.isLinux { + inherit (pkgs) cace-docker; } ); + + # devshells + + devShells = nix-eda.forAllSystems ( + system: let + pkgs = self.legacyPackages."${system}"; + callPackage = lib.callPackageWith pkgs; + in { + # These devShells are rather unorthodox for Nix devShells in that they + # include the package itself. For a proper devShell, try .#dev. + default = + callPackage (self.createCaceShell { + }) {}; + notebook = callPackage (self.createCaceShell { + extra-packages = with pkgs; [ + jupyter + ]; + }) {}; + # Normal devShells + dev = callPackage (self.createCaceShell { + extra-packages = with pkgs; [ + ]; + extra-python-packages = with pkgs.python3.pkgs; [ + setuptools + build + twine + black # blue + ]; + include-cace = false; + }) {}; + docs = callPackage (self.createCaceShell { + extra-packages = with pkgs; [ + ]; + extra-python-packages = with pkgs.python3.pkgs; [ + sphinx + myst-parser + furo + sphinx-autobuild + ]; + include-cace = false; + }) {}; + } + ); }; } diff --git a/nix/colab-env.nix b/nix/colab-env.nix index c42d588..c7e9a71 100644 --- a/nix/colab-env.nix +++ b/nix/colab-env.nix @@ -13,11 +13,10 @@ # limitations under the License. { system, - cace, python3, symlinkJoin, }: symlinkJoin { name = "cace-colab-env"; - paths = cace.includedTools; + paths = python3.pkgs.cace.includedTools; } diff --git a/nix/create-shell.nix b/nix/create-shell.nix index b410363..2db0969 100644 --- a/nix/create-shell.nix +++ b/nix/create-shell.nix @@ -13,10 +13,10 @@ # limitations under the License. { extra-packages ? [], - extra-python-packages ? [] + extra-python-packages ? [], + include-cace ? true }: ({ lib, - cace, git, zsh, delta, @@ -27,12 +27,10 @@ python3, devshell, }: let + cace = python3.pkgs.cace; cace-env = ( python3.withPackages (pp: - with pp; - [ - cace - ] + (if include-cace then [cace] else cace.propagatedBuildInputs) ++ extra-python-packages) ); cace-env-sitepackages = "${cace-env}/${cace-env.sitePackages}";