Unmanaged path already exists in files system: /etc/nix/nix.conf
Describe the bug
I got below error when switching (worked before):
2025-09-11T16:09:16Z INFO system_manager::register] Built system-manager profile /nix/store/qppk2byxpp45b96c95srn4y2761kyzc4-system-manager
[2025-09-11T16:09:16Z INFO system_manager::register] Creating new generation from /nix/store/qppk2byxpp45b96c95srn4y2761kyzc4-system-manager
[2025-09-11T16:09:16Z INFO system_manager::register] Registering GC root...
[2025-09-11T16:09:16Z INFO system_manager] Creating symlink: /nix/var/nix/gcroots/system-manager-current -> /nix/store/qppk2byxpp45b96c95srn4y2761kyzc4-system-manager
[2025-09-11T16:09:16Z INFO system_manager::register] Done
[2025-09-11T16:09:16Z INFO system_manager::activate] Activating system-manager profile: /nix/store/qppk2byxpp45b96c95srn4y2761kyzc4-system-manager
[2025-09-11T16:09:16Z INFO system_manager::activate] Running pre-activation assertions...
Evaluating pre-activation assertion osVersion...
All pre-activation assertions succeeded.
[2025-09-11T16:09:16Z INFO system_manager::activate] Reading state info from /var/lib/system-manager/state/system-manager-state.json
[2025-09-11T16:09:16Z INFO system_manager::activate] Activating etc files...
[2025-09-11T16:09:16Z INFO system_manager::activate::etc_files] Reading etc file definitions...
[2025-09-11T16:09:16Z INFO system_manager::activate::etc_files] Creating /etc entries in /etc
[2025-09-11T16:09:16Z INFO system_manager] Creating symlink: /etc/.system-manager-static -> /nix/store/zrgiwznvnzsd7cnk1v337bxii5kj3lx5-etc-static-env
[2025-09-11T16:09:16Z ERROR system_manager::activate::etc_files] Error while trying to link directory /etc/.system-manager-static/nix: Unmanaged path already exists in files
ystem, please remove it and run system-manager again: /etc/nix/nix.conf
To Reproduce
Steps to reproduce the behavior:
- Install nix with determine
- Edit /etc/nix/nix.conf
- Run system-manager switch
Expected behavior
No error
System information
❱ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04.3 LTS
Release: 24.04
Codename: noble
❱ nix --version
nix (Nix) 2.31.1
❱ sudo $(which system-manager) --version
system_manager 0.1.0
Additional context
It might be related to this: #257
A workaround I found was to rename the nix.conf file to something else (for example append a .bak). The rebuild works and I get a new nix.conf symlink in the same folder.
I think nix-darwin has a similar issue with Determinate Nix so we need to do this in our system-manager modules:
{
...
}:
{
config = {
nix = {
enable = false;
};
};
}
- https://github.com/nix-darwin/nix-darwin/issues/149
- https://github.com/nix-darwin/nix-darwin/issues/1298
- https://github.com/nix-darwin/nix-darwin/issues/1567
That way system-manager won't manage the system's Nix installation + configuration.
The conflict comes from the Determinate Nix daemon regenerating /etc/nix/nix.conf at startup. There's a !include nix.custom.conf directive in the generated Nix configuration.
If you still want system-manager to manage your system-wide Nix configuration with Determinate Nix installed, you'll need to use config.environment.etc to manage a /etc/nix/nix.custom.conf file:
{
pkgs,
...
}:
let
# https://github.com/NixOS/nixpkgs/blob/e643668fd71b949c53f8626614b21ff71a07379d/nixos/modules/config/nix.nix#L81-L92
nixConfFormat = pkgs.formats.nixConf { };
in
{
config = {
nix = {
enable = false;
};
environment = {
etc = {
"nix/nix.custom.conf" = {
source = nixConfFormat.generate "nix.conf" {
sandbox = true;
};
};
};
};
};
}
Thank you @commiterate. I no longer use system-manager, so I can not follow up with this ticket. Please close it if you think this is just a tool conflict without anything to fix in the system-manager itself.