Comments (8)
I don't think you want to persist the entire .config
directory, since that kind of defeats the purpose of using the module.
To begin with, you need to use home-manager
as a NixOS module (in the nixos
directory of the home-manager
repo). This makes sure home-manager
's configuration is persisted and applied on boot, before you log in. This should also solve any directory conflicts, since it makes sure the bind mounts are set up very early in your session.
When you've made big changes to your configuration, you may have to run a nixos-rebuild boot
and reboot to not have to solve the directory conflicts manually.
from impermanence.
Oh, ok thanks, I mistakenly thought that was meant for Impermanence as a NixOS module.
I've added home-manager as a NixOS module, and tested adding a file to be persisted:
home.persistence."/persist/home/nate" = { directories = [ ]; files = [ ".config/testfile" ]; allowOther = true; };
The file doesn't exist, so when I run nixos-rebuild switch I do see it created in ~/.config. It shows as a symlink to /nix/store/mdqq8fgjc8fwx5k1qrhiki5hj1h7bcpp-home-manager-files/.config/testfile, which is a symlink to /nix/store/vfib3x4nhr4wdxmsgfy65qx478ln4vb8-persist-home-nate-config-testfile, which is a symlink to /persist/home/nate/.config/testfile. However, that file in /persist doesn't seem to exist. In fact, the .config directory doesn't even exist in /persist/home/nate.
If I do create the file in /persist manually though, everything works fine. It also happens for files that do exist. So for some reason it's not creating the actual files in the persistent directory.
from impermanence.
Oh, yeah, you're right. Apparently, I forgot to implement that logic - sorry about that. I've created #55 to address this; I would appreciate if you could try it out and make sure it solves this issue for you.
from impermanence.
Sorry, was busy with midterms and stuff :P. I see that it's now been merged, so I updated my flake.lock, and tested again with .config/testfile. I now see the .config directory in /persist/home/nate.
However, testfile itself doesn't exist. I tried again with a file that exists (~/hello.txt), and after rebuild switch boot and rebooting, the file in ~ is a symlink to the nix store, but the file contents are gone as the file doesn't exist. The chain of symlinks resolves to nothing as /persist/home/nate doesn't contain hello.txt.
If I run touch hello1.txt, the symlink is fixed and I now see the file in /persist/home/nate/hello1.txt.
from impermanence.
Yes, this is by design. When a symlink points to a nonexistent file, it's regarded as such by most programs. This means they will try to create the file, which in turn creates the real file the symlink targets. If we instead created empty files, many applications would consider them corrupt: they exist, but don't have the expected contents.
from impermanence.
Thanks, and this is even for files that already exist? So if I am persisting a file that exists in home, I should nixos rebuild boot, and then copy it manually to the persistent directory?
from impermanence.
Yes, that's correct. We don't automatically migrate any files, since that's hard or impossible to do atomically and can cause lots of issues with running applications.
from impermanence.
Cool, thanks for the help in resolving this issue!
from impermanence.
Related Issues (20)
- Add `/etc/nixos/*.nix` to the example ?
- Regression after using escapeSystemdPath HOT 3
- `user.*.directories` assertion is displaying incorrectly`
- Issues with bindfs: no entry in /etc/mtab HOT 1
- Persisting Steam breaks any game within it and also fails shutdown
- Boot does not revoke chmod permissions HOT 1
- [REQUEST] Declare `something.impermanence.enable` option for integration with other modules and easy way to disable impermanence HOT 1
- Handle bind mount of directory that already has content HOT 2
- `nixos-rebuild` fails due to the symlink, Impermanence created
- Best practice to split configuration HOT 1
- missing `x-gvfs-hidein` in mount
- Strategies to deal with `renameat(3)` on persisted files HOT 1
- Infinite recursion error when persisting anything in /var/ HOT 1
- Symlinks created via the home-manager module are broken HOT 1
- The importance of persisting `/var/lib/nixos` is not documented HOT 1
- Cannot use `users.users` without infinite recursion
- Empty list for home.persistence directories does not build HOT 3
- home-manager module cannot mount files to /persist. permission denied.
- Root cannot access directories persisted with home-manager HOT 1
- Opt-in Mirror Mode
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from impermanence.