From 4f7f2770baecc5f72ca9e90d7996c0a1554bda1b Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Mon, 8 Feb 2021 17:40:52 +1100 Subject: refactor slurm implementation to allow for overlays --- default.nix | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) (limited to 'default.nix') diff --git a/default.nix b/default.nix index 0859085..2e98d6d 100644 --- a/default.nix +++ b/default.nix @@ -50,24 +50,18 @@ let whisper = callBionix ./tools/whisper.nix { }; star = callBionix ./tools/star.nix { }; - slurm = attrs: - bionix.extend (self: super: - with self; rec { - slurmDefs = { - ppn = 1; - mem = 1; - walltime = "24:00:00"; - partition = null; - slurmFlags = null; - salloc = "/usr/bin/salloc"; - srun = "/usr/bin/srun"; - } // attrs; - slurm = attrs: - (callPackage ./lib/slurm.nix { }) (slurmDefs // attrs); - exec = f: x: y: - slurm (builtins.intersectAttrs slurmDefs x) (super.exec f - (builtins.removeAttrs x (builtins.attrNames slurmDefs)) y); - }); + slurm-run = callPackage ./lib/slurm.nix { }; + slurm-exec = f: x: y: + slurm-run x (f (builtins.removeAttrs x [ + "ppn" + "mem" + "walltime" + "partition" + "slurmFlags" + "salloc" + "srun" + ]) y); + slurm = bionix.extend (self: super: { exec = super.slurm-run; }); qsub = attrs: bionix.extend (self: super: with self; rec { @@ -190,7 +184,8 @@ let overlayByType = { lambda = bionix: overlay: - bionix.extend overlay; + bionix.extend + (self: super: nixpkgs.lib.recursiveUpdate super (overlay self super)); path = bionix: path: overlay bionix (import path); }; overlay = bionix: overlay: -- cgit v1.2.3