diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index e7f28c670bed..74ed92de0c09 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -104,6 +104,7 @@ ./programs/shadow.nix ./programs/shell.nix ./programs/spacefm.nix + ./programs/singularity.nix ./programs/ssh.nix ./programs/ssmtp.nix ./programs/sysdig.nix diff --git a/nixos/modules/programs/singularity.nix b/nixos/modules/programs/singularity.nix new file mode 100644 index 000000000000..86153d933855 --- /dev/null +++ b/nixos/modules/programs/singularity.nix @@ -0,0 +1,20 @@ +{ config, pkgs, lib, ... }: + +with lib; +let + cfg = config.programs.singularity; +in { + options.programs.singularity = { + enable = mkEnableOption "Singularity"; + }; + + config = mkIf cfg.enable { + environment.systemPackages = [ pkgs.singularity ]; + systemd.tmpfiles.rules = [ "d /var/singularity/mnt/session 0770 root root -" + "d /var/singularity/mnt/final 0770 root root -" + "d /var/singularity/mnt/overlay 0770 root root -" + "d /var/singularity/mnt/container 0770 root root -" + "d /var/singularity/mnt/source 0770 root root -"]; + }; + +} diff --git a/pkgs/applications/virtualization/singularity/default.nix b/pkgs/applications/virtualization/singularity/default.nix index 236cb8f31e66..662805438958 100644 --- a/pkgs/applications/virtualization/singularity/default.nix +++ b/pkgs/applications/virtualization/singularity/default.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation rec { name = "singularity-${version}"; - version = "2.4"; + version = "2.4.2"; enableParallelBuilding = true; @@ -28,6 +28,9 @@ stdenv.mkDerivation rec { patchShebangs . ''; + configureFlags = "--localstatedir=/var"; + installFlags = "CONTAINER_MOUNTDIR=dummy CONTAINER_FINALDIR=dummy CONTAINER_OVERLAY=dummy SESSIONDIR=dummy"; + fixupPhase = '' patchShebangs $out for f in $out/libexec/singularity/helpers/help.sh $out/libexec/singularity/cli/*.exec $out/libexec/singularity/bootstrap-scripts/*.sh ; do @@ -42,7 +45,7 @@ stdenv.mkDerivation rec { owner = "singularityware"; repo = "singularity"; rev = version; - sha256 = "1hi1ag1lb2x4djbz4x34wix83ymx0g9mzn2md6yrpiflc1d85rjz"; + sha256 = "0cpa2yp82g9j64mgr90p75ddk85kbj1qi1r6hy0sz17grqdlaxl4"; }; nativeBuildInputs = [ autoreconfHook makeWrapper ]; diff --git a/pkgs/build-support/singularity-tools/default.nix b/pkgs/build-support/singularity-tools/default.nix index 62cf13e52021..60271e592a23 100644 --- a/pkgs/build-support/singularity-tools/default.nix +++ b/pkgs/build-support/singularity-tools/default.nix @@ -96,6 +96,7 @@ rec { echo creating singularity image.create -s $((1 + size * 4 / 1024 + ${toString extraSpace})) $out echo importing + mkdir -p /var/singularity/mnt/container tar -c . | singularity image.import $out '');