about summary refs log tree commit diff
path: root/pkgs/build-support/singularity-tools
diff options
context:
space:
mode:
authorYueh-Shun Li <44064051+ShamrockLee@users.noreply.github.com>2023-01-29 01:02:47 +0800
committerYueh-Shun Li <44064051+ShamrockLee@users.noreply.github.com>2023-02-08 17:42:03 +0800
commitb33d6407cc37c9f4fe112692fb0b74a45fc7e7a3 (patch)
tree0c42223e0bd6070bc819d8118dafdb519ba482a9 /pkgs/build-support/singularity-tools
parent2f04861c8ad1aaa69d532f34b63bb03da9912ae7 (diff)
singularity-tool: format expression
Diffstat (limited to 'pkgs/build-support/singularity-tools')
-rw-r--r--pkgs/build-support/singularity-tools/default.nix57
1 files changed, 31 insertions, 26 deletions
diff --git a/pkgs/build-support/singularity-tools/default.nix b/pkgs/build-support/singularity-tools/default.nix
index 46df792bdf6c8..bf542e3070086 100644
--- a/pkgs/build-support/singularity-tools/default.nix
+++ b/pkgs/build-support/singularity-tools/default.nix
@@ -10,8 +10,8 @@
 , gawk
 , util-linux
 , runtimeShell
-, e2fsprogs }:
-
+, e2fsprogs
+}:
 rec {
   shellScript = name: text:
     writeScript name ''
@@ -20,35 +20,39 @@ rec {
       ${text}
     '';
 
-  mkLayer = {
-    name,
-    contents ? [],
-  }:
-    runCommand "singularity-layer-${name}" {
-      inherit contents;
-    } ''
+  mkLayer =
+    { name
+    , contents ? [ ]
+    ,
+    }:
+    runCommand "singularity-layer-${name}"
+      {
+        inherit contents;
+      } ''
       mkdir $out
       for f in $contents ; do
         cp -ra $f $out/
       done
     '';
 
-  buildImage = {
-    name,
-    contents ? [],
-    diskSize ? 1024,
-    runScript ? "#!${stdenv.shell}\nexec /bin/sh",
-    runAsRoot ? null,
-    memSize ? 512
-  }:
-    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" {
+  buildImage =
+    { name
+    , contents ? [ ]
+    , diskSize ? 1024
+    , runScript ? "#!${stdenv.shell}\nexec /bin/sh"
+    , runAsRoot ? null
+    , memSize ? 512
+    }:
+    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"
+          {
             buildInputs = [ singularity e2fsprogs util-linux gawk ];
             layerClosure = writeReferencesToFile layer;
             preVM = vmTools.createEmptyImage {
@@ -106,5 +110,6 @@ rec {
             TMPDIR=$(pwd -P) singularity build $out ./img
           '');
 
-    in result;
+    in
+    result;
 }