Replace /bin/sh, /usr/bin/env mounts by symlinks

This makes the arion-base image compatible with hosts other than
NixOS.
This commit is contained in:
Robert Hensing 2019-01-26 23:47:35 +01:00
parent bb5a8810e8
commit 89f5622f2e
5 changed files with 6 additions and 3 deletions

View file

@ -11,6 +11,7 @@ stdenv.mkDerivation {
mkdir -p $out/bin $out/share/arion mkdir -p $out/bin $out/share/arion
cp -a nix $out/share/arion/ cp -a nix $out/share/arion/
cp -a arion-image $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 \ substitute arion $out/bin/arion \
--subst-var-by path ${lib.makeBinPath [jq coreutils docker_compose]} \ --subst-var-by path ${lib.makeBinPath [jq coreutils docker_compose]} \
--subst-var-by nix_dir $out/share/arion/nix \ --subst-var-by nix_dir $out/share/arion/nix \

View file

@ -1,2 +1,3 @@
FROM scratch FROM scratch
COPY passwd /etc/passwd COPY passwd /etc/passwd
ADD tarball.tar.gz /

View file

@ -0,0 +1 @@
/run/system/bin/sh

View file

@ -0,0 +1 @@
/run/system/usr/bin/env

View file

@ -4,7 +4,7 @@
when the service.useHostStore option is set to true. when the service.useHostStore option is set to true.
*/ */
{ lib, config, ... }: { lib, config, pkgs, ... }:
let let
inherit (lib) mkOption types mkIf; inherit (lib) mkOption types mkIf;
in in
@ -21,8 +21,7 @@ in
service.build.context = "${../arion-image}"; service.build.context = "${../arion-image}";
service.volumes = [ service.volumes = [
"/nix/store:/nix/store" "/nix/store:/nix/store"
"/bin/sh:/bin/sh" "${pkgs.buildEnv { name = "container-system-env"; paths = [ pkgs.bashInteractive pkgs.coreutils ]; }}:/run/system"
"/usr/bin/env:/usr/bin/env"
]; ];
}; };
} }