Commit a1318915 authored by Yueh-Shun Li's avatar Yueh-Shun Li
Browse files

singularity-tools: deprecate build helpers mkLayer and shellScript

Deprecate singularity-tools.mkLayer and singularity-tools.shellScript,
for they are no longer related to image building.

Use writers.writeBash instead of singularity-tools.shellScript.
parent d3692ddf
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -126,6 +126,8 @@

- `singularity-tools` have the `storeDir` argument removed from its override interface and use `builtins.storeDir` instead.

- Two build helpers in `singularity-tools`, i.e., `mkLayer` and `shellScript`, are deprecated, as they are no longer involved in image-building. Maintainers will remove them in future releases.

- The `budgie` and `budgiePlugins` scope have been removed and their packages
  moved into the top level scope (i.e., `budgie.budgie-desktop` is now
  `budgie-desktop`)
+38 −20
Original line number Diff line number Diff line
@@ -5,8 +5,10 @@
  runCommand,
  vmTools,
  writeClosure,
  writers,
  writeScript,
  # Native build inputs
  buildPackages,
  e2fsprogs,
  util-linux,
  # Build inputs
@@ -19,15 +21,24 @@ let
  defaultSingularity = singularity;
in
rec {
  # TODO(@ShamrockLee): Remove after Nixpkgs 24.11 branch-off.
  shellScript =
    lib.warn
      "`singularity-tools.shellScript` is deprecated. Use `writeScript`, `writeShellScripts` or `writers.writeBash` instead."
      (
        name: text:
        writeScript name ''
          #!${runtimeShell}
          set -e
          ${text}
    '';
        ''
      );

  # TODO(@ShamrockLee): Remove after Nixpkgs 24.11 branch-off.
  mkLayer =
    lib.warn
      "`singularity-tools.mkLayer` is deprecated, as it is no longer used to implement `singularity-tools.buildImages`."
      (
        {
          name,
          contents ? [ ],
@@ -39,7 +50,8 @@ rec {
          for f in $contents ; do
            cp -ra $f $out/
          done
    '';
        ''
      );

  buildImage =
    {
@@ -53,8 +65,14 @@ rec {
    }:
    let
      projectName = singularity.projectName or "singularity";
      runAsRootFile = shellScript "run-as-root.sh" runAsRoot;
      runScriptFile = shellScript "run-script.sh" runScript;
      runAsRootFile = buildPackages.writers.writeBash "run-as-root.sh" ''
        set -e
        ${runAsRoot}
      '';
      runScriptFile = writers.writeBash "run-script.sh" ''
        set -e
        ${runScript}
      '';
      result = vmTools.runInLinuxVM (
        runCommand "${projectName}-image-${name}.sif"
          {