Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apptainer, singularity: use self-contained LOCALSTATEDIR by default #250949

Merged
merged 2 commits into from Nov 23, 2023

Conversation

ShamrockLee
Copy link
Contributor

@ShamrockLee ShamrockLee commented Aug 23, 2023

Description of changes

  • Use "$out/var/lib" for the LOCALSTATEDIR configuration option instead of the top-level "/var/lib". This change impacts the SESSIONDIR (container-run-time mount point) configuration, which is set to $LOCALSTATEDIR/<apptainer or singularity>/mnt/session. This detaches the packages from the top-level directory, rendering the NixOS module optional.
  • Add input argument externalLocalStateDir to optionally specify the path to external LOCALSTATEDIR if not null.
  • Add a new NixOS configuration option programs.singularity.enableExternalSysConfDir to specify whether to set the top-level "/var/lib" as LOCALSTATEDIR or not. Default it to true to keep the default behavior of programs.singularity unchanged.
  • Drop the obsolete directories under LOCALSTATEDIR, leaving only the SESSIONDIR.

Fixes #250581

Cc: @nobodyinperson, @jbedo

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Leave only the SESSIONDIR, which is "$LOCALSTATEDIR/$projectName/mnt/session"
Use "$out/var/lib" as LOCALSTATEDIR configuration value
by default intsead of "/var/lib"
as a way toward top-level-directory independent runtime.

Add input argument externalLocalStateDir to optionally specify the
path to external LOCALSTATEDIR if not null.

Add NixOS module option
programs.singularity.enableExternalLocalStateDir (default to true)
to use "/var/lib" as LOCALSTATEDIR.
@ShamrockLee ShamrockLee marked this pull request as ready for review August 23, 2023 10:57
@ofborg ofborg bot requested a review from jbedo August 23, 2023 11:35
@ShamrockLee ShamrockLee changed the title Apptainer localstatedir apptainer, singularity: use self-contained LOCALSTATEDIR by default Aug 24, 2023
Copy link
Contributor

@GaetanLepage GaetanLepage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !

Copy link
Contributor

@nobodyinperson nobodyinperson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this PR here and it works fine.

@vcunat vcunat removed their request for review November 16, 2023 18:49
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/1016/80

@infinisil infinisil merged commit bf01ec0 into NixOS:master Nov 23, 2023
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Apptainer is missing the /var/lib/apptainer/mnt/session directory
5 participants