-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
Initial home contents #41858
Initial home contents #41858
Conversation
} | ||
if (defined $new_home && $u->{initialHomeContents}) { | ||
system("cp --recursive --preserve=mode --no-preserve=owner $u->{initialHomeContents}/. $u->{home}"); | ||
system("chown -R $u->{uid}, $u->{gid}, $u->{home}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the motivation for copying and not symlinking, as we do with |
Pretty sure it's so users can tweak it to their likings themselves and programs that require the ability to change them won't have problems |
It depends a bit on the use-case I guess. For some use-cases you'd want the home directory to be read-only (and a symlink to) For most users you'd want a writable home directory. Since many applications will presume they can write there it makes sense to copy the actual file contents and make sure all files are writable for the user, thus not relying on |
Seems like also when a new user is created, it isn't getting chmodded correctly, leaving me unable to login through SDDM (Xauthority unable to be written?). Chmodding my home directory non-recursively to 700 does fix the issue. Properly chmodded home (isaac) vs. what it's getting chmodded to when user is created (testing14). I'm not sure if it's related to this PR or not but I didn't seem to start having issues until I applied the patch to a local copy of the nixos-18.03 channel. Possibly related to this? https://github.com/bobvanderlinden/nixpkgs/blob/e406c2d95d497da3ca6d05ac0c0a84188d372bed/nixos/modules/config/update-users-groups.pl#L218 |
I understand this change is intended to mimic the functionality of The module could use an option similar to
This means that like with |
@emmanuelrosa Yes, that's what I was thinking as well. Is it possible to make files writable in Also, this idea ties in with home-manager (https://github.com/rycee/home-manager) and nixuser (#9250). It's a bit messy since people cannot agree on a single solution it seems. @tenten8401 It should now be fixed in the latest commit. |
Fixed it locally on my end before I ran the tests with the bad chmod. I can try wiping nixos-18.03 and applying the patch again if you'd like. |
This kind of imperative, one-time configuration mechanism seems pretty incompatible with the declarative approach in NixOS. As a general rule, the configuration resulting from a reconfiguration ( |
From the top of my head (and my index).
"Nix as a dotfiles manager" thread on old ML by Arseniy Seroka
Date: Mon, 01 Dec 2014 00:29:58 +0400
#9073, #9250, https://github.com/rycee/home-manager.
|
Only real good way I can think of doing this while remaining declarative is to look at the diff of the previous revision and the current revision and applying it to all the files in the home directory, that way it'd update files as needed to comply with the central declarative configuration file. I don't know of a good way to go about this however. |
@edolstra I agree that this is not declarative and it won't work when changing things up. That's why I named it @tenten8401 I think applying only changes would be confusing, as it has the same issues as described above. The alternative is still to use the same setup as Would this (handling home as we do with |
Closing this one, because there is not much incentive to merge this. |
Motivation for this change
See #33586. This change will allow setting the files that should reside inside newly created home directories. This is similar to
/etc/skel
in other distros.This is especially useful for cases where users need predefined
.config
that should not affect other users.The following NixOS configuration is now possible:
Let me know whether this is the right approach. An alternative I've been thinking of was using a similar scheme as
etc
uses, where each content (and its target in home) can be defined as a structure, instead of defining a directory where the contents is copied from.Let me know what you think!
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)