4 Commits

Author SHA1 Message Date
Jörg Thalheim
f5c8f11da0 nix-unstable-static: bump nix 2023-07-20 12:59:44 +02:00
Jörg Thalheim
019b4effa9 nix-unstable-static: add a PATH entry that can be used to bind mount more binaries into the system 2023-07-20 12:59:36 +02:00
Jörg Thalheim
e380dbbda5 nix-unstable-static: add an unprivileged nix user that can be used without entrypoint 2023-07-20 12:59:36 +02:00
Jörg Thalheim
23c51fe60b nix-unstable-static: drop unused openssl 2023-07-20 12:21:18 +02:00

View File

@@ -6,21 +6,20 @@
, python3
, removeReferencesTo
, runCommand
, buildPackages
}:
let
inherit (pkgsStatic)
bashInteractive
busybox
cacert
openssl
;
cacert;
bash = bashInteractive;
# Get nix from Hydra because the nixpkgs one is not fully static
nixStaticBin = fetchurl {
url = "https://hydra.nixos.org/build/181573550/download/1/nix";
hash = "sha256-zO2xJhQIrLtL/ReTlcorjwsaTO1W5Rnr+sXwcLcujok=";
url = "https://hydra.nixos.org/build/228458395/download/1/nix";
hash = "sha256-H361lUdMpBpBVwInBmpAXKAwjPIf740Jg9Nht0NV66s=";
};
nixSymlinks = [
@@ -64,6 +63,11 @@ let
# Add user home folder
mkdir home
# Create an unpriveleged user that we can use also without the run-as-user.sh script
chmod +w $PWD/etc/group $PWD/etc/passwd
${buildPackages.shadow}/bin/groupadd --prefix $PWD -g 9000 nixuser
${buildPackages.shadow}/bin/useradd --prefix $PWD -m -d /tmp -u 9000 -g 9000 -G nixuser nixuser
# Add SSL CA certs
cp -a "${cacert}/etc/ssl/certs/ca-bundle.crt" etc/ssl/certs/ca-bundle.crt
@@ -117,7 +121,8 @@ let
Env = [
"NIX_BUILD_SHELL=/bin/bash"
"PAGER=cat"
"PATH=/bin"
# /host/bin can be used to extend the image with additional binaries
"PATH=/bin:/host/bin"
"SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt"
];
};