From bcece721779f6d983bf2cdd2d4f66dfa09378f2a Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Mon, 22 Apr 2024 20:42:49 +0800 Subject: [PATCH] singularity-tools: format with nixfmt-rfc-style (Nix RFC 166) --- .../singularity-tools/default.nix | 67 ++++++++++--------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/pkgs/build-support/singularity-tools/default.nix b/pkgs/build-support/singularity-tools/default.nix index cd10a9960421..ecca857eb79d 100644 --- a/pkgs/build-support/singularity-tools/default.nix +++ b/pkgs/build-support/singularity-tools/default.nix @@ -1,19 +1,21 @@ -{ runCommand -, lib -, stdenv -, storeDir ? builtins.storeDir -, writeScript -, singularity -, writeClosure -, bash -, vmTools -, gawk -, util-linux -, runtimeShell -, e2fsprogs +{ + runCommand, + lib, + stdenv, + storeDir ? builtins.storeDir, + writeScript, + singularity, + writeClosure, + bash, + vmTools, + gawk, + util-linux, + runtimeShell, + e2fsprogs, }: rec { - shellScript = name: text: + shellScript = + name: text: writeScript name '' #!${runtimeShell} set -e @@ -21,15 +23,13 @@ rec { ''; mkLayer = - { name - , contents ? [ ] + { + name, + contents ? [ ], # May be "apptainer" instead of "singularity" - , projectName ? (singularity.projectName or "singularity") + projectName ? (singularity.projectName or "singularity"), }: - runCommand "${projectName}-layer-${name}" - { - inherit contents; - } '' + runCommand "${projectName}-layer-${name}" { inherit contents; } '' mkdir $out for f in $contents ; do cp -ra $f $out/ @@ -40,13 +40,14 @@ rec { let defaultSingularity = singularity; in - { name - , contents ? [ ] - , diskSize ? 1024 - , runScript ? "#!${stdenv.shell}\nexec /bin/sh" - , runAsRoot ? null - , memSize ? 1024 - , singularity ? defaultSingularity + { + name, + contents ? [ ], + diskSize ? 1024, + runScript ? "#!${stdenv.shell}\nexec /bin/sh", + runAsRoot ? null, + memSize ? 1024, + singularity ? defaultSingularity, }: let projectName = singularity.projectName or "singularity"; @@ -55,7 +56,12 @@ rec { result = vmTools.runInLinuxVM ( runCommand "${projectName}-image-${name}.img" { - buildInputs = [ singularity e2fsprogs util-linux gawk ]; + buildInputs = [ + singularity + e2fsprogs + util-linux + gawk + ]; layerClosure = writeClosure contents; preVM = vmTools.createEmptyImage { size = diskSize; @@ -110,7 +116,8 @@ rec { echo "root:x:0:0:System administrator:/root:/bin/sh" > /etc/passwd echo > /etc/resolv.conf TMPDIR=$(pwd -P) ${projectName} build $out ./img - ''); + '' + ); in result;