diff options
author | Justin Bedo <cu@cua0.org> | 2021-10-29 17:39:01 +1100 |
---|---|---|
committer | Justin Bedo <cu@cua0.org> | 2021-10-29 17:39:01 +1100 |
commit | bac9248a5e08e8afdf5485a6e27cfe72e1ca5090 (patch) | |
tree | 8719a280b56122017d46b582cd3da8547dd3f548 /lib/slurm.nix | |
parent | ab809b8c77efdad9fb54d3591a0193a1cbe888d1 (diff) |
treewide reformatting and simplification
- simplify with statix
- reformat with nixpkgs-fmt
Diffstat (limited to 'lib/slurm.nix')
-rw-r--r-- | lib/slurm.nix | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/lib/slurm.nix b/lib/slurm.nix index c050628..8c9ad50 100644 --- a/lib/slurm.nix +++ b/lib/slurm.nix @@ -4,23 +4,34 @@ with lib; let escape = x: if builtins.typeOf x == "string" then escapeShellArg x else x; -in { ppn, mem, walltime, partition ? null, slurmFlags ? null -, salloc ? "/usr/bin/salloc", srun ? "/usr/bin/srun", ... }: +in +{ ppn +, mem +, walltime +, partition ? null +, slurmFlags ? null +, salloc ? "/usr/bin/salloc" +, srun ? "/usr/bin/srun" +, ... +}: drv: let ppnReified = if drv.multicore then ppn else 1; -in overrideDerivation drv ({ args, builder, name, ... }: { +in +overrideDerivation drv ({ args, builder, name, ... }: { builder = stdenv.shell; - args = let - slurm = writeScript "slurm" '' - #!${stdenv.shell} - NIX_BUILD_CORES=${toString ppnReified} + args = + let + slurm = writeScript "slurm" '' + #!${stdenv.shell} + NIX_BUILD_CORES=${toString ppnReified} - ${salloc} -c $NIX_BUILD_CORES --mem=${toString mem}G -t ${walltime} \ - -J "${name}" \ - ${optionalString (partition != null) "-p ${partition}"} \ - ${optionalString (slurmFlags != null) slurmFlags} \ - ${srun} ${builder} ${concatMapStringsSep " " escape args} - ''; + ${salloc} -c $NIX_BUILD_CORES --mem=${toString mem}G -t ${walltime} \ + -J "${name}" \ + ${optionalString (partition != null) "-p ${partition}"} \ + ${optionalString (slurmFlags != null) slurmFlags} \ + ${srun} ${builder} ${concatMapStringsSep " " escape args} + ''; - in [ "-c" slurm ]; + in + [ "-c" slurm ]; }) |