From fa8878d87bb7861b5cbf20dae0f053d97dd01030 Mon Sep 17 00:00:00 2001 From: Mohamed Gaber Date: Fri, 27 Jun 2025 01:34:28 +0300 Subject: [PATCH 1/2] nix: rebase flake on nix-eda sample flake https://github.com/fossi-foundation/nix-eda/blob/main/docs/flake-template.nix --- flake.lock | 28 ++++++++++++++++++---- flake.nix | 68 +++++++++++++++++++++++++----------------------------- 2 files changed, 54 insertions(+), 42 deletions(-) diff --git a/flake.lock b/flake.lock index 8aaa070..62f7da8 100644 --- a/flake.lock +++ b/flake.lock @@ -1,24 +1,42 @@ { "nodes": { + "nix-eda": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1750505071, + "narHash": "sha256-+6V4BZu5ydULvzg+seKH1Nv9m7YOtydg70ZSqCZ+9Fw=", + "owner": "fossi-foundation", + "repo": "nix-eda", + "rev": "0572ad4c916c9609d3fcde416a8792462ca204a1", + "type": "github" + }, + "original": { + "owner": "fossi-foundation", + "repo": "nix-eda", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1726447378, - "narHash": "sha256-2yV8nmYE1p9lfmLHhOCbYwQC/W8WYfGQABoGzJOb1JQ=", + "lastModified": 1733120037, + "narHash": "sha256-En+gSoVJ3iQKPDU1FHrR6zIxSLXKjzKY+pnh9tt+Yts=", "owner": "nixos", "repo": "nixpkgs", - "rev": "086b448a5d54fd117f4dc2dee55c9f0ff461bdc1", + "rev": "f9f0d5c5380be0a599b1fb54641fa99af8281539", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-24.05", + "ref": "nixos-24.11", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "nix-eda": "nix-eda" } } }, diff --git a/flake.nix b/flake.nix index dfe7502..02d6ce7 100644 --- a/flake.nix +++ b/flake.nix @@ -1,49 +1,43 @@ -# Copyright 2024 Efabless Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. { inputs = { - nixpkgs.url = github:nixos/nixpkgs/nixos-24.05; + nix-eda.url = "github:fossi-foundation/nix-eda"; }; outputs = { self, - nixpkgs, + nix-eda, ... - }: { - # Helper functions - forAllSystems = function: - nixpkgs.lib.genAttrs [ - "x86_64-linux" - "aarch64-linux" - "x86_64-darwin" - "aarch64-darwin" - ] ( - system: - function (import nixpkgs { - inherit system; + }: let + nixpkgs = nix-eda.inputs.nixpkgs; + lib = nixpkgs.lib; + in { + overlays = { + default = lib.composeManyExtensions [ + ( + nix-eda.composePythonOverlay (pkgs': pkgs: pypkgs': pypkgs: let + callPythonPackage = lib.callPackageWith (pkgs' // pkgs'.python3.pkgs); + in { + ipm = callPythonPackage ./default.nix {}; }) - ); + ) + ]; + }; - # Outputs - packages = self.forAllSystems (pkgs: let - callPackage = pkgs.lib.callPackageWith (pkgs // self.packages.${pkgs.system}); - callPythonPackage = pkgs.lib.callPackageWith (pkgs // pkgs.python3.pkgs // self.packages.${pkgs.system}); - in - let self = { - ipm = callPythonPackage ./default.nix {}; - default = self.ipm; - }; in self + legacyPackages = nix-eda.forAllSystems ( + system: + import nix-eda.inputs.nixpkgs { + inherit system; + overlays = [nix-eda.overlays.default self.overlays.default]; + } + ); + + packages = nix-eda.forAllSystems ( + system: let + pkgs = self.legacyPackages."${system}"; + in { + inherit (pkgs.python3.pkgs) ipm; + default = pkgs.python3.pkgs.ipm; + } ); }; } From dd37b9849c4741e1f3ed635e796ee2d4ff94f71e Mon Sep 17 00:00:00 2001 From: Mohamed Gaber Date: Fri, 27 Jun 2025 01:40:02 +0300 Subject: [PATCH 2/2] nix: better python version compat --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 02d6ce7..129e448 100644 --- a/flake.nix +++ b/flake.nix @@ -15,7 +15,7 @@ default = lib.composeManyExtensions [ ( nix-eda.composePythonOverlay (pkgs': pkgs: pypkgs': pypkgs: let - callPythonPackage = lib.callPackageWith (pkgs' // pkgs'.python3.pkgs); + callPythonPackage = lib.callPackageWith (pkgs' // pypkgs'); in { ipm = callPythonPackage ./default.nix {}; })