From 7a1cf0165f64befe1efa8a3929a9165336fb5e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Bon=C3=A9?= Date: Mon, 9 Mar 2026 15:38:44 +0100 Subject: [PATCH 1/6] Override upx to 5.1.0 (needed for linux/riscv64) --- overlay.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/overlay.nix b/overlay.nix index 1e2f350a..0e00a99e 100644 --- a/overlay.nix +++ b/overlay.nix @@ -61,6 +61,16 @@ let tagaspi = callPackage ./pkgs/tagaspi/default.nix { }; tampi = callPackage ./pkgs/tampi/default.nix { }; upc-qaire-exporter = prev.callPackage ./pkgs/upc-qaire-exporter/default.nix { }; + upx = prev.upx.overrideAttrs { + version = "5.1.0"; + src = final.fetchFromGitHub { + owner = "upx"; + repo = "upx"; + tag = "v5.1.0"; + fetchSubmodules = true; + hash = "sha256-FQtDHsbZ/JrgRLwc2Wd2F5ZcBdqrU0YIT9hGQ0k0D+w="; + }; + }; wxparaver = callPackage ./pkgs/paraver/default.nix { }; }; -- 2.51.2 From 2d86c3442defd3e1c2aa7b5cbc3e6df765c68d6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Bon=C3=A9?= Date: Mon, 9 Mar 2026 15:39:34 +0100 Subject: [PATCH 2/6] Use native zstd when building nix-portable --- pkgs/nix-portable/default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/nix-portable/default.nix b/pkgs/nix-portable/default.nix index dbe42415..ac5f8bff 100644 --- a/pkgs/nix-portable/default.nix +++ b/pkgs/nix-portable/default.nix @@ -49,7 +49,7 @@ let in stdenv.mkDerivation { name = "nix-portable-store-tarball"; - nativeBuildInputs = [ perl zstd ]; + nativeBuildInputs = [ perl pkgs.zstd ]; exportReferencesGraph = map (x: [("closure-" + baseNameOf x) x]) targets; buildCommand = '' storePaths=$(cat ${closureInfo}/store-paths) @@ -100,7 +100,9 @@ let export PATH="${out}/bin:\$PATH" ''; - caBundleZstd = pkgs.runCommand "cacerts" {} "cat ${cacert}/etc/ssl/certs/ca-bundle.crt | ${zstd}/bin/zstd -19 > $out"; + caBundleZstd = pkgs.runCommand "cacerts" { + nativeBuildInputs = [ pkgs.zstd ]; + } "cat ${cacert}/etc/ssl/certs/ca-bundle.crt | zstd -19 > $out"; bwrap = packStaticBin "${bwrapStatic}/bin/bwrap"; nixStatic = packStaticBin "${inp.nixStatic}/bin/nix"; -- 2.51.2 From eec3e7a7f2eb26a984e0d820b38b0ac97152b23a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Bon=C3=A9?= Date: Mon, 9 Mar 2026 15:51:49 +0100 Subject: [PATCH 3/6] Use nativeBuildInputs zip in nix-portable build --- pkgs/nix-portable/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/nix-portable/default.nix b/pkgs/nix-portable/default.nix index ac5f8bff..45a09a60 100644 --- a/pkgs/nix-portable/default.nix +++ b/pkgs/nix-portable/default.nix @@ -593,7 +593,7 @@ let runtimeScriptEscaped = replaceStrings ["\""] ["\\\""] runtimeScript; nixPortable = pkgs.runCommand pname { - nativeBuildInputs = [unixtools.xxd unzip]; + nativeBuildInputs = [unixtools.xxd unzip pkgs.zip]; meta = { homepage = "https://github.com/DavHau/nix-portable"; @@ -621,7 +621,7 @@ let unzip -vl $out/bin/nix-portable.zip - zip="${zip}/bin/zip -0" + zip="zip -0" $zip $out/bin/nix-portable.zip ${bwrap}/bin/bwrap $zip $out/bin/nix-portable.zip ${nixStatic}/bin/nix $zip $out/bin/nix-portable.zip ${zstd}/bin/zstd @@ -632,7 +632,7 @@ let fp=$(sha256sum $out/bin/nix-portable.zip | cut -d " " -f 1) sed -i "s/_FINGERPRINT_PLACEHOLDER_/$fp/g" $out/bin/nix-portable.zip # fix broken zip header due to manual modification - ${zip}/bin/zip -F $out/bin/nix-portable.zip --out $out/bin/nix-portable-fixed.zip + zip -F $out/bin/nix-portable.zip --out $out/bin/nix-portable-fixed.zip rm $out/bin/nix-portable.zip executable=${if bundledPackage == null then "" else bundledExe} -- 2.51.2 From c5b7122b31c7f976b302fab94557c955bd99b11b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Bon=C3=A9?= Date: Wed, 18 Mar 2026 12:24:55 +0100 Subject: [PATCH 4/6] Properly determine paths when cross-compiling --- pkgs/nix-portable/default.nix | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pkgs/nix-portable/default.nix b/pkgs/nix-portable/default.nix index 45a09a60..7d9c372c 100644 --- a/pkgs/nix-portable/default.nix +++ b/pkgs/nix-portable/default.nix @@ -19,6 +19,16 @@ with builtins; compression ? "zstd -19 -T0", lib ? pkgs.lib, pkgs ? import {}, + + # pkgs set from the host system (just for eval in installDynamic) + pkgsHost ? + if stdenv.hostPlatform == stdenv.buildPlatform then + pkgs + else + import pkgs.path { + system = pkgs.stdenv.hostPlatform.system; + }, + # hardcode executable to run. Useful when creating a bundle. bundledPackage ? null, @@ -86,9 +96,9 @@ let ''; installDynamic = pkgname: let - out = pkgs.${pkgname}.out; + out = builtins.unsafeDiscardStringContext pkgsHost.${pkgname}.out.outPath; in '' - if [ ! -e \$store${lib.removePrefix "/nix/store" pkgs.${pkgname}.out} ] ; then + if [ ! -e \$store${lib.removePrefix "/nix/store" out} ] ; then debug "Installing ${pkgname}" \$run \$store${lib.removePrefix "/nix/store" nix}/bin/nix build --impure --no-link --expr " (import ${nixpkgsSrc} {}).${pkgname}.out @@ -254,7 +264,7 @@ let fi # Override $SHELL with nix bashInteractive - export SHELL="${pkgs.bashInteractive.out}/bin/bash" + export SHELL="${builtins.unsafeDiscardStringContext pkgsHost.bashInteractive.out.outPath}/bin/bash" export PS1="\n\[\033[1;32m\][\[\e]0;\u@\h: \w\a\]\u@\h:\w]\$\[\033[0m\] " # unset bash function aliases -- 2.51.2 From a37f4435eb58c23473f36a0101d2cad7ab15461f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Bon=C3=A9?= Date: Wed, 18 Mar 2026 13:24:35 +0100 Subject: [PATCH 5/6] Expose packages for arm and riscv64 in flake --- flake.nix | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/flake.nix b/flake.nix index c9315dab..b0a44bc6 100644 --- a/flake.nix +++ b/flake.nix @@ -5,19 +5,14 @@ outputs = { self, nixpkgs, ... }: let + forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" "armv6l-linux" "armv7l-linux" "i686-linux" "riscv64-linux" ]; + mkConf = name: nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { inherit nixpkgs; theFlake = self; }; modules = [ "${self.outPath}/m/${name}/configuration.nix" ]; }; - # For now we only support x86 - system = "x86_64-linux"; - pkgs = import nixpkgs { - inherit system; - overlays = [ self.overlays.default ]; - config.allowUnfree = true; - }; -in + in { nixosConfigurations = { hut = mkConf "hut"; @@ -38,9 +33,15 @@ in overlays.default = self.bscOverlay; # full nixpkgs with our overlay applied - legacyPackages.${system} = pkgs; + legacyPackages = forAllSystems (system: + import nixpkgs { + inherit system; + overlays = [ self.overlays.default ]; + config.allowUnfree = true; + } + ); - hydraJobs = self.legacyPackages.${system}.bsc.hydraJobs; + hydraJobs = self.legacyPackages.x86_64-linux.bsc.hydraJobs; # propagate nixpkgs lib, so we can do bscpkgs.lib lib = nixpkgs.lib // { -- 2.51.2 From 49f0e263da7bdce04f7b14fa5de82075fa335f94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Bon=C3=A9?= Date: Wed, 18 Mar 2026 13:34:25 +0100 Subject: [PATCH 6/6] Add /home to pathsTopLevel in nix-portable --- pkgs/nix-portable/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/nix-portable/default.nix b/pkgs/nix-portable/default.nix index 7d9c372c..5fdd7f7d 100644 --- a/pkgs/nix-portable/default.nix +++ b/pkgs/nix-portable/default.nix @@ -309,7 +309,7 @@ let collectBinds(){ - pathsTopLevel="/boot /run /sys \$PWD /gpfs /tmp /scratch" + pathsTopLevel="/boot /run /sys \$PWD /gpfs /tmp /scratch /home" toBind="" for p in \$pathsTopLevel; do -- 2.51.2