at 23.11-beta 93 lines 2.9 kB view raw
1{ callPackage 2, fetchFromGitHub 3, nixos 4, conmon 5}: 6let 7 apptainer = callPackage 8 (import ./generic.nix rec { 9 pname = "apptainer"; 10 version = "1.2.4"; 11 projectName = "apptainer"; 12 13 src = fetchFromGitHub { 14 owner = "apptainer"; 15 repo = "apptainer"; 16 rev = "refs/tags/v${version}"; 17 hash = "sha256-VaVOepfjMBf8F56S1Clpn8HPw65MNQMoZsQguKQ4Sg0="; 18 }; 19 20 # Update by running 21 # nix-prefetch -E "{ sha256 }: ((import ./. { }).apptainer.override { vendorHash = sha256; }).goModules" 22 # at the root directory of the Nixpkgs repository 23 vendorHash = "sha256-Y0gOqg+WGgssXGEYHc9IFwiIpkb3hetlQI89vseAQPc="; 24 25 extraDescription = " (previously known as Singularity)"; 26 extraMeta.homepage = "https://apptainer.org"; 27 }) 28 { 29 # Apptainer doesn't depend on conmon 30 conmon = null; 31 32 # Apptainer builders require explicit --with-suid / --without-suid flag 33 # when building on a system with disabled unprivileged namespace. 34 # See https://github.com/NixOS/nixpkgs/pull/215690#issuecomment-1426954601 35 defaultToSuid = null; 36 }; 37 38 singularity = callPackage 39 (import ./generic.nix rec { 40 pname = "singularity-ce"; 41 version = "4.0.2"; 42 projectName = "singularity"; 43 44 src = fetchFromGitHub { 45 owner = "sylabs"; 46 repo = "singularity"; 47 rev = "refs/tags/v${version}"; 48 hash = "sha256-R+vAKYR4lJmC7PIITYyg4UeGYjGXoPqqUai3HmPzwG0="; 49 }; 50 51 # Update by running 52 # nix-prefetch -E "{ sha256 }: ((import ./. { }).singularity.override { vendorHash = sha256; }).goModules" 53 # at the root directory of the Nixpkgs repository 54 vendorHash = "sha256-z3VozeMpaqh4ddZxB3xqo25Gm+8JYeIwASOq+Mmerr4="; 55 56 # Do not build conmon and squashfuse from the Git submodule sources, 57 # Use Nixpkgs provided version 58 extraConfigureFlags = [ 59 "--without-conmon" 60 "--without-squashfuse" 61 ]; 62 63 extraDescription = " (Sylabs Inc's fork of Singularity, a.k.a. SingularityCE)"; 64 extraMeta.homepage = "https://sylabs.io/"; 65 }) 66 { 67 defaultToSuid = true; 68 }; 69 70 genOverridenNixos = package: packageName: (nixos { 71 programs.singularity = { 72 enable = true; 73 inherit package; 74 }; 75 }).config.programs.singularity.packageOverriden.overrideAttrs (oldAttrs: { 76 meta = oldAttrs.meta // { 77 description = ""; 78 longDescription = '' 79 This package produces identical store derivations to `pkgs.${packageName}` 80 overriden and installed by the NixOS module `programs.singularity` 81 with default configuration. 82 83 This is for binary substitutes only. Use pkgs.${packageName} instead. 84 ''; 85 }; 86 }); 87in 88{ 89 inherit apptainer singularity; 90 91 apptainer-overriden-nixos = genOverridenNixos apptainer "apptainer"; 92 singularity-overriden-nixos = genOverridenNixos singularity "singularity"; 93}