Home Manager: Do you have often problems because read-only?

Hi folks,

I tested Home Manager both as NixOS module (with flake) and Standalone (with flake) and I’m very happy with it. Those few applications that I enabled and configured work just fine.

But I’m surprised that Home Manager follows Nix style and all configuration files are links to read-only files in Nix store. I understand the reason and read-only decoratively generated files make completely sense but in case of user apps, I’m surprised that it works.

In past I managed my dot files as Git repo and I know that a lot of apps constantly change their files, adding configuration like last position of the app window and other things that are not important. What is important is that a lot of apps expect writable configuration files.

How often do you hit the wall with read only configuration files for user apps? Is there a large number of apps that simply can’t be configured by Home Manager because of the read only nature?

Thank you.

It’s somewhat uncommon for me. Most applications that struggle being configured with read-only files are GUI applications, and have built-in configuration menus.

I use very few such applications - I don’t use gnome, which helps a lot, and besides some video games (whose data is largely synced by steam anyway, and whose configuration is too device-specific to be shared anyway) I use mostly TUI applications.

The main problem that comes to mind is Firefox, but home-manager has pretty good support for it. Usually, just as in the case of Firefox, there are a few files that can be made read-only without breaking the application in question (just the configuration menu, of course).

Ultimately the problem is just that I always end up with some imperative data still lying around, that can’t be perfectly reproduced. It’s a fairly limited set though - home-manager doesn’t need to control every single file, just enough that I don’t need to spend hours manually reconfiguring my desktop every time I need to reinstall it, or sync changes to a different computer.

I still need to try it, I have a laptop that I’m intending to set up with it and everything, but my final solution will probably be something like Erase your darlings: immutable infrastructure for mutable systems - Graham Christensen, to make sure I know exactly what is not reproducible, so that I can properly back it up (zfs seems especially nice for this purpose, trying to figure out how to boot with systemd-boot when using an encrypted zfs disc currently).


I was thinking that a nice middle ground would be to generate the file in Nix store but then don’t create a symlink - just copy the file. The downside would be some minor configuration loss every time for example home-manager.service is started but upside would be that application would never complain.


Yep, I’ve done that before (for an edopro package). You need it surprisingly rarely though.

1 Like

Yes, I hit this when trying to use the Coder Remote VS Code plugin with VS Code.

It wants to right to settings.json and I get “Error: EACCES: permission denied, open '/Users/phil/Library/Application Support/Code/User/settings.json”

Firefox is one of the few programs that handle this properly, in my opinion. The user writes their configuration in their own user.js file. Firefox reads this file and merges the content into its complete configuration, which it keeps in its prefs.js file.

Since Firefox never writes to user.js it can be managed though the Nix store.

I think it would be great if programs that want to modify their own configuration files were to adopt a setup similar to Firefox’s. Wouldn’t benefit just Home Manager, I think many would appreciate being able to keep track of which settings they’ve made manually and easily go back to a blank slate.


Mostly, yes, but afaik it is impossible to seed extension configuration from that, for example.

If it is in fact possible in some generic way and I’ve overlooked it you’d be the one to know how to do that, of course :wink:

Quick and dirty solution would be to deliberatively define a file:


And then add a user systemd service that runs after boot / login with a shell script that finds all files *.initial-configuration and copies it over that same path without the extenstion.

Definitely dirty from Nix perspective but should do the job.

ulauncher is very unhappy about it. Annoyingly it even complains about read only .css styles.
OSError: [Errno 30] Read-only file system: '/home/tilli/.config/ulauncher/user-themes/Catppuccin-Latte-Lavender/generated.css'

Is there a way to make files mutable but impernanent? (Not the entire home, just some home-manager managed files)

Looks like it is in fact trying to write that file.

Either way, the recursive option is made for cases like this, where you want the application to be able to write whatever it wants into a directory, but have specific fixed files generated by nix.

If you specifically want “mutable but impermanent”, the impermanence module for home-manager can achieve that.

omg, someone packaged edopro? That’s so cool!

“Packaged” I last used it years ago, sincerely doubt it’s still working. But feel free to give it a whirl if you like!

1 Like

Thanks, you inadvertently gave me a hint. The generated.css file doesn’t need to be part of the permanent file because it’s not actually part of the theme itself. I will remove it from my preset.

Yes, Impermanence will be my next project. But probably not for home. Not quite anal enough I think to opt in for every bit of required permanence.

1 Like

Unfortunately the directory is still not writable. But at least the superfluous file is gone.

  home.file.".config/ulauncher/" = {
    source = ./config;
    recursive = true;

› touch /home/tilli/.config/ulauncher/user-themes/Catppuccin-Latte-Lavender/generated.css touch: cannot touch '/home/tilli/.config/ulauncher/user-themes/Catppuccin-Latte-Lavender/generated.css': Read-only file system

PS: The entire directory still points into nix-store. Despite recursive.

› ls -ld /home/tilli/.config/ulauncher
lrwxrwxrwx 1 tilli users 80 Nov  5 18:59 /home/tilli/.config/ulauncher -> /nix/store/h22gispg2q1bh7crzzq45c19bs1xcv9g-home-manager-files/.config/ulauncher

Hum, it should be, otherwise my emacs configuration hasn’t been working for like 4 years and I haven’t noticed.

You sure you switched to the new configuration? No errors about having to use -b? Have you looked at the directory tree and checked what symlinks where? Any chance that specific file is an existing symlink?

I had to remove the directory to give home-manager a reason to re-create it. Now it works.
Thanks for the tip

1 Like