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

Add capability to let impemanence create the persistentStoragePath #163

Closed

Conversation

portiatrivisonno
Copy link

Add option createPersistentStoragePath (bool) which, if set, creates the directory persistentStoragePath during activation phase. The default is set to true as I think this is what most people expect and also avoids some permissions mismatches (see below). If you do not agree for whatever reason, feel free to drop the commit enabling it by default.

The permission mismatch might also be related to #139.

More Background

Beginning of the story is, that I bootstrapped a new system with this config:

  environment.persistence."home" = {
    persistentStoragePath = "/persist/user/this/dir/does/not/yet/exist";
    users."me" = {
      directories = [
        "cooldir"
      ];
    };
  };

After rebooting, cooldir was created by owned by root. It took me a while but the problem is/was that impermanence failed to create /home/me/cooldir inside the persistentStoragePath location (because that directory does not exist). However, a bind entry was created in /etc/fstab which triggered systemd-fstab-generator to generated that mount and in the process also create the missing directories but with root permissions.

With this PR the config could look like

  environment.persistence."home" = {
    persistentStoragePath = "/persist/user/this/dir/does/not/yet/exist";
    createPersistentStoragePath = true;
    users."me" = {
      directories = [
        "cooldir"
      ];
    };
  };

Create the root of the persistent storage, namely the directory
environment.persistence.<name>.persistentStoragePath if it does not
exist.

The directory is created as root with its usual permissions.
Add option createPersistentStoragePath (default false) which controls
the creation of the directory persistentStoragePath.

The default is false which is the current behaviour of impermanence.
Change default of createPersistentStoragePath to true, i.e. create the
persistentStoragePath directory by default.  This is most likely what
most users expect.  It also avoids the silent permission mismatch by
letting the systemd-fstab-generator(8) create the directory structure.
@talyz
Copy link
Collaborator

talyz commented Oct 16, 2024

Fixed by #193.

@talyz talyz closed this Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants