about summary refs log tree commit diff
path: root/pkgs/by-name/ne/nextpnr/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/ne/nextpnr/package.nix')
-rw-r--r--pkgs/by-name/ne/nextpnr/package.nix10
1 files changed, 7 insertions, 3 deletions
diff --git a/pkgs/by-name/ne/nextpnr/package.nix b/pkgs/by-name/ne/nextpnr/package.nix
index b6b2eb07bdc1..b3dee524f7a7 100644
--- a/pkgs/by-name/ne/nextpnr/package.nix
+++ b/pkgs/by-name/ne/nextpnr/package.nix
@@ -47,8 +47,12 @@ stdenv.mkDerivation rec {
     ++ (lib.optional enableGui qtbase)
     ++ (lib.optional stdenv.cc.isClang llvmPackages.openmp);
 
-  cmakeFlags =
-    [ "-DCURRENT_GIT_VERSION=${lib.substring 0 7 (lib.elemAt srcs 0).rev}"
+  cmakeFlags = let
+    # the specified version must always start with "nextpnr-", so add it if
+    # missing (e.g. if the user overrides with a git hash)
+    rev = main_src.rev;
+    version = if (lib.hasPrefix "nextpnr-" rev) then rev else "nextpnr-${rev}";
+  in ["-DCURRENT_GIT_VERSION=${version}"
       "-DARCH=generic;ice40;ecp5;gowin;himbaechel"
       "-DBUILD_TESTS=ON"
       "-DICESTORM_INSTALL_PREFIX=${icestorm}"
@@ -61,7 +65,7 @@ stdenv.mkDerivation rec {
       "-DHIMBAECHEL_GOWIN_DEVICES=all"
     ]
     ++ (lib.optional enableGui "-DBUILD_GUI=ON")
-    ++ (lib.optional (enableGui && stdenv.isDarwin)
+    ++ (lib.optional (enableGui && stdenv.hostPlatform.isDarwin)
         "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks");
 
   patchPhase = with builtins; ''