Rework nix-portable derivation arguments

Reviewed-by: Rodrigo Arias Mallo <rodrigo.arias@bsc.es>
This commit is contained in:
2026-03-11 14:25:56 +01:00
parent 1b36c70512
commit 34238d81c7
2 changed files with 17 additions and 24 deletions

View File

@@ -39,15 +39,7 @@ let
nanos6Debug = final.nanos6.override { enableDebug = true; };
nixtools = callPackage ./pkgs/nixtools/default.nix { };
nixgen = callPackage ./pkgs/nixgen/default.nix { };
nix-portable = callPackage ./pkgs/nix-portable/default.nix {
busybox = final.pkgsStatic.busybox;
bwrap = final.pkgsStatic.bubblewrap;
gnutar = final.pkgsStatic.gnutar;
perl = final.pkgsBuildBuild.perl;
xz = final.pkgsStatic.xz;
zstd = final.pkgsStatic.zstd;
bashInteractive = final.pkgsStatic.bashInteractive;
};
nix-portable = callPackage ./pkgs/nix-portable/default.nix { };
nix-wrap = callPackage ./pkgs/nix-wrap/default.nix { };
nodes = callPackage ./pkgs/nodes/default.nix { };
nosv = callPackage ./pkgs/nosv/default.nix { };

View File

@@ -1,8 +1,6 @@
with builtins;
{
bwrap,
nix,
proot,
unzip,
zip,
unixtools,
@@ -17,23 +15,26 @@ with builtins;
"bashInteractive"
],
busybox,
cacert ? pkgs.cacert,
compression ? "zstd -19 -T0",
gnutar ? pkgs.pkgsStatic.gnutar,
lib ? pkgs.lib,
perl ? pkgs.perl,
pkgs ? import <nixpkgs> {},
xz ? pkgs.pkgsStatic.xz,
zstd ? pkgs.pkgsStatic.zstd,
nixStatic,
# hardcode executable to run. Useful when creating a bundle.
bundledPackage ? null,
...
nixStatic,
busyboxStatic ? pkgs.pkgsStatic.busybox,
bwrapStatic ? pkgs.pkgsStatic.bubblewrap,
prootStatic ? pkgs.pkgsStatic.proot,
zstdStatic ? pkgs.pkgsStatic.zstd,
perlBuildBuild ? pkgs.pkgsBuildBuild.perl,
}@inp:
with lib;
let
perl = perlBuildBuild;
pname =
if bundledPackage == null
then "nix-portable"
@@ -100,12 +101,12 @@ let
export PATH="${out}/bin:\$PATH"
'';
caBundleZstd = pkgs.runCommand "cacerts" {} "cat ${cacert}/etc/ssl/certs/ca-bundle.crt | ${inp.zstd}/bin/zstd -19 > $out";
caBundleZstd = pkgs.runCommand "cacerts" {} "cat ${cacert}/etc/ssl/certs/ca-bundle.crt | ${zstd}/bin/zstd -19 > $out";
bwrap = packStaticBin "${inp.bwrap}/bin/bwrap";
bwrap = packStaticBin "${bwrapStatic}/bin/bwrap";
nixStatic = packStaticBin "${inp.nixStatic}/bin/nix";
proot = packStaticBin "${inp.proot}/bin/proot";
zstd = packStaticBin "${inp.zstd}/bin/zstd";
proot = packStaticBin "${prootStatic}/bin/proot";
zstd = packStaticBin "${zstdStatic}/bin/zstd";
# the default nix store contents to extract when first used
storeTar = maketar ([ cacert nix nixpkgsSrc ] ++ lib.optional (bundledPackage != null) bundledPackage);
@@ -242,9 +243,9 @@ let
# install busybox
mkdir -p \$dir/busybox/bin
(base64 -d> "\$dir/busybox/bin/busybox" && chmod +x "\$dir/busybox/bin/busybox") << END
$(cat ${busybox}/bin/busybox | base64)
$(cat ${busyboxStatic}/bin/busybox | base64)
END
busyBins="${toString (attrNames (filterAttrs (d: type: type == "symlink") (readDir "${inp.busybox}/bin")))}"
busyBins="${toString (attrNames (filterAttrs (d: type: type == "symlink") (readDir "${busyboxStatic}/bin")))}"
for bin in \$busyBins; do
[ ! -e "\$dir/busybox/bin/\$bin" ] && ln -s busybox "\$dir/busybox/bin/\$bin"
done