Loading pkgs/build-support/singularity-tools/default.nix +31 −26 Original line number Diff line number Diff line Loading @@ -10,8 +10,8 @@ , gawk , util-linux , runtimeShell , e2fsprogs }: , e2fsprogs }: rec { shellScript = name: text: writeScript name '' Loading @@ -20,11 +20,13 @@ rec { ${text} ''; mkLayer = { name, contents ? [], mkLayer = { name , contents ? [ ] , }: runCommand "singularity-layer-${name}" { runCommand "singularity-layer-${name}" { inherit contents; } '' mkdir $out Loading @@ -33,22 +35,24 @@ rec { done ''; buildImage = { name, contents ? [], diskSize ? 1024, runScript ? "#!${stdenv.shell}\nexec /bin/sh", runAsRoot ? null, memSize ? 512 buildImage = { name , contents ? [ ] , diskSize ? 1024 , runScript ? "#!${stdenv.shell}\nexec /bin/sh" , runAsRoot ? null , memSize ? 512 }: let layer = mkLayer { let layer = mkLayer { inherit name; contents = contents ++ [ bash runScriptFile ]; }; runAsRootFile = shellScript "run-as-root.sh" runAsRoot; runScriptFile = shellScript "run-script.sh" runScript; result = vmTools.runInLinuxVM ( runCommand "singularity-image-${name}.img" { runCommand "singularity-image-${name}.img" { buildInputs = [ singularity e2fsprogs util-linux gawk ]; layerClosure = writeReferencesToFile layer; preVM = vmTools.createEmptyImage { Loading Loading @@ -106,5 +110,6 @@ rec { TMPDIR=$(pwd -P) singularity build $out ./img ''); in result; in result; } Loading
pkgs/build-support/singularity-tools/default.nix +31 −26 Original line number Diff line number Diff line Loading @@ -10,8 +10,8 @@ , gawk , util-linux , runtimeShell , e2fsprogs }: , e2fsprogs }: rec { shellScript = name: text: writeScript name '' Loading @@ -20,11 +20,13 @@ rec { ${text} ''; mkLayer = { name, contents ? [], mkLayer = { name , contents ? [ ] , }: runCommand "singularity-layer-${name}" { runCommand "singularity-layer-${name}" { inherit contents; } '' mkdir $out Loading @@ -33,22 +35,24 @@ rec { done ''; buildImage = { name, contents ? [], diskSize ? 1024, runScript ? "#!${stdenv.shell}\nexec /bin/sh", runAsRoot ? null, memSize ? 512 buildImage = { name , contents ? [ ] , diskSize ? 1024 , runScript ? "#!${stdenv.shell}\nexec /bin/sh" , runAsRoot ? null , memSize ? 512 }: let layer = mkLayer { let layer = mkLayer { inherit name; contents = contents ++ [ bash runScriptFile ]; }; runAsRootFile = shellScript "run-as-root.sh" runAsRoot; runScriptFile = shellScript "run-script.sh" runScript; result = vmTools.runInLinuxVM ( runCommand "singularity-image-${name}.img" { runCommand "singularity-image-${name}.img" { buildInputs = [ singularity e2fsprogs util-linux gawk ]; layerClosure = writeReferencesToFile layer; preVM = vmTools.createEmptyImage { Loading Loading @@ -106,5 +110,6 @@ rec { TMPDIR=$(pwd -P) singularity build $out ./img ''); in result; in result; }