From ca28925120278989fd0fcf2643dc15646f005ea3 Mon Sep 17 00:00:00 2001 From: Drew Risinger Date: Mon, 14 Dec 2020 20:30:21 -0500 Subject: [PATCH] treewide: name -> pname where possible Changes "name = '...-${version}" -> "pname = '...'" syntax everywhere that is easy. This matches current best nixpkgs convention. The nixpkgs standard derivation will convert this to name = "${pname}-${version}" automatically. This also has the added benefit of adding the version to the filepath for several packages that didn't have it before. The only remaining files are ./artiq-full/extras.nix & ./artiq-fast/pkgs/python-deps.nix. extras.nix had a semi-confusing function that I didn't want to mess with. --- artiq-fast/default.nix | 15 ++++++++----- artiq-fast/pkgs/artiq.nix | 2 +- artiq-fast/pkgs/libartiq-support.nix | 2 +- artiq-fast/pkgs/llvm-or1k.nix | 4 ++-- artiq-fast/pkgs/llvmlite-artiq.nix | 2 +- artiq-fast/pkgs/openocd.nix | 2 +- artiq-fast/pkgs/python-deps.nix | 33 +++++++++++++++++----------- artiq-fast/pkgs/rust/cargo.nix | 2 +- artiq-fast/pkgs/rust/rustc.nix | 2 +- gluelogic/default.nix | 12 +++++----- 10 files changed, 44 insertions(+), 32 deletions(-) diff --git a/artiq-fast/default.nix b/artiq-fast/default.nix index 69e2f72..d98fd86 100644 --- a/artiq-fast/default.nix +++ b/artiq-fast/default.nix @@ -44,7 +44,8 @@ let condaNoarch = { conda-pythonparser = import ./conda/build.nix { inherit pkgs; } { - name = "conda-pythonparser"; + pname = "conda-pythonparser"; + inherit (pythonDeps.pythonparser) version; src = import ./conda/fake-source.nix { inherit pkgs; } { name = "pythonparser"; inherit (pythonDeps.pythonparser) version src; @@ -53,7 +54,8 @@ let }; }; conda-sipyco = import ./conda/build.nix { inherit pkgs; } { - name = "conda-sipyco"; + pname = "conda-sipyco"; + inherit (pythonDeps.sipyco) version; src = import ./conda/fake-source.nix { inherit pkgs; } { name = "sipyco"; inherit (pythonDeps.sipyco) version src; @@ -61,14 +63,16 @@ let }; }; conda-quamash = import ./conda/build.nix { inherit pkgs; } { - name = "conda-quamash"; + pname = "conda-quamash"; + inherit (pkgs.python3Packages.quamash) version; src = import ./conda/fake-source.nix { inherit pkgs; } { name = "quamash"; inherit (pkgs.python3Packages.quamash) version src; }; }; conda-qasync = import ./conda/build.nix { inherit pkgs; } { - name = "conda-qasync"; + pname = "conda-qasync"; + inherit (pythonDeps.qasync) version; src = import ./conda/fake-source.nix { inherit pkgs; } { name = "qasync"; inherit (pythonDeps.qasync) version src; @@ -80,7 +84,8 @@ let }; conda-artiq = import ./conda/artiq.nix { inherit pkgs; }; conda-asyncserial = import ./conda/build.nix { inherit pkgs; } { - name = "conda-asyncserial"; + pname = "conda-asyncserial"; + inherit (pythonDeps.asyncserial) version; src = import ./conda/fake-source.nix { inherit pkgs; } { name = "asyncserial"; inherit (pythonDeps.asyncserial) version src; diff --git a/artiq-fast/pkgs/artiq.nix b/artiq-fast/pkgs/artiq.nix index b4fd615..f2a89c2 100644 --- a/artiq-fast/pkgs/artiq.nix +++ b/artiq-fast/pkgs/artiq.nix @@ -1,7 +1,7 @@ { stdenv, lib, pythonDeps, fetchgit, git, python3Packages, qt5, binutils-or1k, binutils-arm, llvm-or1k, llvmlite-artiq, libartiq-support, lit, outputcheck }: python3Packages.buildPythonPackage rec { - name = "artiq-${version}"; + pname = "artiq"; version = import ./artiq-version.nix { inherit stdenv fetchgit git; }; src = import ./artiq-src.nix { inherit fetchgit; }; diff --git a/artiq-fast/pkgs/libartiq-support.nix b/artiq-fast/pkgs/libartiq-support.nix index fe1e590..20df430 100644 --- a/artiq-fast/pkgs/libartiq-support.nix +++ b/artiq-fast/pkgs/libartiq-support.nix @@ -1,6 +1,6 @@ { stdenv, fetchgit, git, rustc }: stdenv.mkDerivation rec { - name = "libartiq-support-${version}"; + pname = "libartiq-support"; version = import ./artiq-version.nix { inherit stdenv fetchgit git; }; src = import ./artiq-src.nix { inherit fetchgit; }; diff --git a/artiq-fast/pkgs/llvm-or1k.nix b/artiq-fast/pkgs/llvm-or1k.nix index b907569..b305485 100644 --- a/artiq-fast/pkgs/llvm-or1k.nix +++ b/artiq-fast/pkgs/llvm-or1k.nix @@ -25,10 +25,10 @@ let ''; in stdenv.mkDerivation rec { - name = "llvm-or1k"; + pname = "llvm-or1k"; + version = "6.0.0"; passthru.llvm-src = llvm-src; src = llvm-clang-src; - version = "6.0.0"; buildInputs = [ perl groff cmake libxml2 python libffi ] ++ stdenv.lib.optional stdenv.isLinux valgrind; diff --git a/artiq-fast/pkgs/llvmlite-artiq.nix b/artiq-fast/pkgs/llvmlite-artiq.nix index 9ec5c2c..525eca6 100644 --- a/artiq-fast/pkgs/llvmlite-artiq.nix +++ b/artiq-fast/pkgs/llvmlite-artiq.nix @@ -1,6 +1,6 @@ { stdenv, fetchFromGitHub, llvm-or1k, makeWrapper, python3, ncurses, zlib, python3Packages }: python3Packages.buildPythonPackage rec { - name = "llvmlite-artiq"; + pname = "llvmlite-artiq"; version = "0.23.0.dev"; src = fetchFromGitHub { rev = "158f9d3a898dbf055ca513d69505df288c681fea"; diff --git a/artiq-fast/pkgs/openocd.nix b/artiq-fast/pkgs/openocd.nix index 974c220..1864e1d 100644 --- a/artiq-fast/pkgs/openocd.nix +++ b/artiq-fast/pkgs/openocd.nix @@ -1,7 +1,7 @@ { stdenv, fetchFromGitHub, autoreconfHook, libftdi, libusb1, pkgconfig, hidapi }: stdenv.mkDerivation rec { - name = "openocd-mlabs-${version}"; + pname = "openocd-mlabs"; version = "0.10.0"; src = fetchFromGitHub { diff --git a/artiq-fast/pkgs/python-deps.nix b/artiq-fast/pkgs/python-deps.nix index 9966ec0..e577d55 100644 --- a/artiq-fast/pkgs/python-deps.nix +++ b/artiq-fast/pkgs/python-deps.nix @@ -3,7 +3,7 @@ rec { # User dependencies sipyco = python3Packages.buildPythonPackage rec { - name = "sipyco"; + pname = "sipyco"; version = "1.1"; src = fetchFromGitHub { owner = "m-labs"; @@ -15,7 +15,7 @@ rec { }; asyncserial = python3Packages.buildPythonPackage rec { - name = "asyncserial"; + pname = "asyncserial"; version = "0.1"; src = fetchFromGitHub { owner = "m-labs"; @@ -27,7 +27,7 @@ rec { }; pythonparser = python3Packages.buildPythonPackage rec { - name = "pythonparser"; + pname = "pythonparser"; version = "1.3"; src = fetchFromGitHub { owner = "m-labs"; @@ -40,7 +40,7 @@ rec { }; pyqtgraph-qt5 = python3Packages.buildPythonPackage rec { - name = "pyqtgraph_qt5-${version}"; + pname = "pyqtgraph_qt5"; version = "0.11.0"; doCheck = false; pythonImportsCheck = [ "pyqtgraph" ]; @@ -74,7 +74,8 @@ rec { # Development/firmware dependencies artiq-netboot = python3Packages.buildPythonPackage rec { - name = "artiq-netboot"; + pname = "artiq-netboot"; + version = "unstable-2020-10-15"; src = fetchgit { url = "https://git.m-labs.hk/m-labs/artiq-netboot.git"; @@ -84,8 +85,9 @@ rec { }; misoc = python3Packages.buildPythonPackage { - name = "misoc"; - + pname = "misoc"; + version = if misoc-new then "unstable-2020-10-06" else "unstable-2020-05-29"; + src = if misoc-new then (fetchFromGitHub { owner = "m-labs"; @@ -104,7 +106,7 @@ rec { # TODO: fix misoc bitrot and re-enable tests doCheck = false; - + propagatedBuildInputs = with python3Packages; [ pyserial jinja2 numpy asyncserial migen ]; meta = with stdenv.lib; { @@ -116,7 +118,8 @@ rec { }; migen = python3Packages.buildPythonPackage rec { - name = "migen"; + pname = "migen"; + version = "unstable-2020-11-11"; src = fetchFromGitHub { owner = "m-labs"; @@ -136,7 +139,8 @@ rec { }; microscope = python3Packages.buildPythonPackage rec { - name = "microscope"; + pname = "microscope"; + version = "unstable-2019-05-17"; src = fetchFromGitHub { owner = "m-labs"; @@ -156,7 +160,8 @@ rec { }; jesd204b = python3Packages.buildPythonPackage rec { - name = "jesd204b"; + pname = "jesd204b"; + version = "0.11"; src = fetchFromGitHub { owner = "m-labs"; @@ -193,7 +198,8 @@ rec { }; ramda = python3Packages.buildPythonPackage { - name = "ramda"; + pname = "ramda"; + version = "unstable-2019-02-01"; src = fetchFromGitHub { owner = "peteut"; @@ -221,7 +227,8 @@ rec { }; migen-axi = python3Packages.buildPythonPackage { - name = "migen-axi"; + pname = "migen-axi"; + version = "unstable-2020-11-11"; src = fetchFromGitHub { owner = "peteut"; diff --git a/artiq-fast/pkgs/rust/cargo.nix b/artiq-fast/pkgs/rust/cargo.nix index dad4047..ae7d880 100644 --- a/artiq-fast/pkgs/rust/cargo.nix +++ b/artiq-fast/pkgs/rust/cargo.nix @@ -7,7 +7,7 @@ rustPlatform.buildRustPackage rec { # Note: we can't build cargo 1.28.0 because rustc tightened the borrow checker rules and broke # backward compatibility, which affects old cargo versions. # There are also issues with asm/llvm_asm with recent rustc and cargo versions prior to 1.39. - name = "cargo-${version}"; + pname = "cargo"; version = "1.39.0"; src = fetchurl { url = "https://static.rust-lang.org/dist/rustc-1.39.0-src.tar.gz"; diff --git a/artiq-fast/pkgs/rust/rustc.nix b/artiq-fast/pkgs/rust/rustc.nix index ad452b1..12e9df0 100644 --- a/artiq-fast/pkgs/rust/rustc.nix +++ b/artiq-fast/pkgs/rust/rustc.nix @@ -26,7 +26,7 @@ let in stdenv.mkDerivation { - name = "rustc-${version}"; + pname = "rustc"; inherit version; inherit src; diff --git a/gluelogic/default.nix b/gluelogic/default.nix index 27ffe20..005eb6a 100644 --- a/gluelogic/default.nix +++ b/gluelogic/default.nix @@ -4,12 +4,12 @@ let ise = import ./ise.nix { inherit pkgs; }; vivado = import ../artiq-fast/vivado.nix { inherit pkgs; }; buildUrukulCpld = {version, src}: pkgs.stdenv.mkDerivation { - name = "urukul-cpld-${version}"; - inherit src; + pname = "urukul-cpld"; + inherit src version; buildInputs = [(pkgs.python3.withPackages(ps: [artiqpkgs.migen]))] ++ (builtins.attrValues ise); phases = ["buildPhase" "installPhase"]; buildPhase = "python $src/urukul_impl.py"; - installPhase = + installPhase = '' mkdir -p $out $out/nix-support cp build/urukul.jed $out @@ -17,12 +17,12 @@ let ''; }; buildMirnyCpld = {version, src}: pkgs.stdenv.mkDerivation { - name = "mirny-cpld-${version}"; - inherit src; + pname = "mirny-cpld"; + inherit src version; buildInputs = [(pkgs.python3.withPackages(ps: [artiqpkgs.migen]))] ++ (builtins.attrValues ise); phases = ["buildPhase" "installPhase"]; buildPhase = "python $src/mirny_impl.py"; - installPhase = + installPhase = '' mkdir -p $out $out/nix-support cp build/mirny.jed $out