diff --git a/arion.nix b/arion.nix index e7c51bb..276cf0a 100644 --- a/arion.nix +++ b/arion.nix @@ -11,6 +11,7 @@ stdenv.mkDerivation { mkdir -p $out/bin $out/share/arion cp -a nix $out/share/arion/ cp -a arion-image $out/share/arion/ + tar -czf $out/share/arion/arion-image/tarball.tar.gz -C arion-image/tarball . substitute arion $out/bin/arion \ --subst-var-by path ${lib.makeBinPath [jq coreutils docker_compose]} \ --subst-var-by nix_dir $out/share/arion/nix \ diff --git a/src/arion-image/Dockerfile b/src/arion-image/Dockerfile index 8c4159e..4aa6448 100644 --- a/src/arion-image/Dockerfile +++ b/src/arion-image/Dockerfile @@ -1,2 +1,3 @@ FROM scratch COPY passwd /etc/passwd +ADD tarball.tar.gz / diff --git a/src/arion-image/tarball/bin/sh b/src/arion-image/tarball/bin/sh new file mode 120000 index 0000000..261b8af --- /dev/null +++ b/src/arion-image/tarball/bin/sh @@ -0,0 +1 @@ +/run/system/bin/sh \ No newline at end of file diff --git a/src/arion-image/tarball/usr/bin/env b/src/arion-image/tarball/usr/bin/env new file mode 120000 index 0000000..5871f63 --- /dev/null +++ b/src/arion-image/tarball/usr/bin/env @@ -0,0 +1 @@ +/run/system/usr/bin/env \ No newline at end of file diff --git a/src/nix/service-host-store.nix b/src/nix/service-host-store.nix index bd3725f..e650d78 100644 --- a/src/nix/service-host-store.nix +++ b/src/nix/service-host-store.nix @@ -4,7 +4,7 @@ when the service.useHostStore option is set to true. */ -{ lib, config, ... }: +{ lib, config, pkgs, ... }: let inherit (lib) mkOption types mkIf; in @@ -21,8 +21,7 @@ in service.build.context = "${../arion-image}"; service.volumes = [ "/nix/store:/nix/store" - "/bin/sh:/bin/sh" - "/usr/bin/env:/usr/bin/env" + "${pkgs.buildEnv { name = "container-system-env"; paths = [ pkgs.bashInteractive pkgs.coreutils ]; }}:/run/system" ]; }; }