From ce70726bf680ae708c1cd5c272629a7654caac9f Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Tue, 8 Oct 2024 10:13:27 +0200 Subject: [PATCH] Build specinvoke from source The one contained in the CPU SPEC ISO is built for x86, and there is no binary for RISC-V. --- overlay.nix | 1 + pkgs/spec-cpu/mini.nix | 4 ++-- pkgs/spec-cpu/specinvoke.nix | 30 ++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 pkgs/spec-cpu/specinvoke.nix diff --git a/overlay.nix b/overlay.nix index 2840409..2eeee5c 100644 --- a/overlay.nix +++ b/overlay.nix @@ -14,6 +14,7 @@ final: prev: spec-cpu-tools = final.callPackage ./pkgs/spec-cpu/tools.nix { }; spec-cpu = final.callPackage ./pkgs/spec-cpu/default.nix { }; spec-cpu-mini = final.callPackage ./pkgs/spec-cpu/mini.nix { }; + specinvoke = final.callPackage ./pkgs/spec-cpu/specinvoke.nix { }; spec-cpu-clang = final.callPackage ./pkgs/spec-cpu/default.nix { stdenv = final.stdenvClangEpi; }; blis = ((prev.blis.override { diff --git a/pkgs/spec-cpu/mini.nix b/pkgs/spec-cpu/mini.nix index b002f59..033d978 100644 --- a/pkgs/spec-cpu/mini.nix +++ b/pkgs/spec-cpu/mini.nix @@ -2,6 +2,7 @@ stdenv , spec-cpu , spec-cpu-tools +, specinvoke }: stdenv.mkDerivation rec { @@ -49,9 +50,8 @@ stdenv.mkDerivation rec { mkdir -p $out/bin echo -e "#!$SHELL\necho $out" > $out/bin/spec-cpu-mini chmod +x $out/bin/spec-cpu-mini - cp $(command -v specinvoke) $out/bin + cp ${specinvoke}/bin/specinvoke $out/bin ''; - nativeBuildInputs = [ spec-cpu-tools ]; enableParallelBuilding = false; hardeningDisable = [ "all" ]; dontStrip = true; diff --git a/pkgs/spec-cpu/specinvoke.nix b/pkgs/spec-cpu/specinvoke.nix new file mode 100644 index 0000000..61be2d0 --- /dev/null +++ b/pkgs/spec-cpu/specinvoke.nix @@ -0,0 +1,30 @@ +{ + stdenv +, libarchive +, spec-cpu-tools +, runCommandNoCC +}: + +let + version = spec-cpu-tools.version; + tar = runCommandNoCC "specinvoke-${version}.tar" { + src = spec-cpu-tools.src; + nativeBuildInputs = [ libarchive ]; + } '' + mkdir iso + bsdtar -C iso -xf $src + cp iso/install_archives/tools-src.tar $out + ''; +in stdenv.mkDerivation { + pname = "specinvoke"; + version = version; + src = tar; + sourceRoot = "tools/src/specinvoke/"; + # Almost no bugs + preInstall = '' + mkdir -p $out/bin + ''; + enableParallelBuilding = false; + hardeningDisable = [ "all" ]; + dontStrip = true; +}