diff --git a/overlay.nix b/overlay.nix index 1be5bdf1..1e2f350a 100644 --- a/overlay.nix +++ b/overlay.nix @@ -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 { }; diff --git a/pkgs/nix-portable/default.nix b/pkgs/nix-portable/default.nix index a1b3c6e7..f0818f3a 100644 --- a/pkgs/nix-portable/default.nix +++ b/pkgs/nix-portable/default.nix @@ -1,6 +1,5 @@ with builtins; { - bwrap, nix, proot, unzip, @@ -17,23 +16,25 @@ with builtins; "bashInteractive" ], - busybox, cacert ? pkgs.cacert, compression ? "zstd -19 -T0", - gnutar ? pkgs.pkgsStatic.gnutar, lib ? pkgs.lib, - perl ? pkgs.perl, pkgs ? import {}, - 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, + 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 "${inp.proot}/bin/proot"; # TODO: why don't they use Static proot here? + 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