From 20054ad03415176ea5353fb957e286a74896cdc6 Mon Sep 17 00:00:00 2001 From: Saji Date: Tue, 24 Sep 2024 20:52:44 -0500 Subject: [PATCH] add amaranth-boards, wip main package --- flake.nix | 21 ++++++++++++++++++--- python.nix | 14 +++++++++++++- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 4296013..9824f9d 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,7 @@ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; }; - outputs = inputs@{ nixpkgs, flake-utils, ... }: + outputs = inputs@{ self, nixpkgs, flake-utils, ... }: let python-overlay = import ./python.nix; systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ]; @@ -21,14 +21,29 @@ )); in { packages = forAllSystems (pkgs: { - sim = import ./sim/package.nix pkgs; + niar = pkgs.python3.buildPythonPackage { + name = "niar"; + version = pyproject-toml.project.version; + src = ./.; + pyproject = true; + build-system = [pkgs.python3.pdm-backend]; + + propagatedBuildInpusts = [ + pkgs.python3.amaranth + pkgs.python3.amaranth-boards + ]; + + doCheck = true; + nativeCheckInputs = [python3.pkgs.pytestCheckHook]; + }; }); devShells = forAllSystems (pkgs: { default = pkgs.mkShell { packages = with pkgs; [ - (python3.withPackages (ps: with ps; [ + (python3.withPackages (pypkgs: with pypkgs; [ amaranth + amaranth-boards ])) yosys nextpnr diff --git a/python.nix b/python.nix index 5f96544..8b2cff1 100644 --- a/python.nix +++ b/python.nix @@ -8,11 +8,23 @@ final: prev: { owner = "amaranth-lang"; repo = "amaranth"; rev = "e30d822a7d93ee615e70e95a9958051dcc794802"; - hash = "sha256-A46CMWGvqUFTp3geFFccUM9M7iECmNndzWm2GxA8XbE"; + # hash = "sha256-A46CMWGvqUFTp3geFFccUM9M7iECmNndzWm2GxA8XbE"; + hash = "sha256-sCUipI7HcuTg3sJscoSI0UdIutnxGWSwbgpwWyZuFxk="; }; doCheck = false; # installCheckPhase = "${prev.python3.interpreter} -m unittest discover -t . -s tests -v"; }; + amaranth-boards = pyprev.amaranth-boards.overridePythonAttrs { + version = "0.1.dev250"; + src = prev.pkgs.fetchFromGitHub { + owner = "amaranth-lang"; + repo = "amaranth-boards"; + rev = "19b97324ecf9111c5d16377af79f82aad761c476"; + hash = "sha256-0uvn91i/yuIY75lL5Oxvozdw7Q2Uw83JWo7srgEYEpI="; + }; + build-system = [pyprev.pdm-backend]; + dontCheckRuntimeDeps = 1; + }; }; }; }