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

Change the configuration folder #1345

Open
danielo515 opened this issue Feb 19, 2025 · 3 comments
Open

Change the configuration folder #1345

danielo515 opened this issue Feb 19, 2025 · 3 comments

Comments

@danielo515
Copy link

Hello, nix newie here.
I want to use nix-darwin to have reproducible configurations for my mac, ideally with a one-line install script.
Up until now I have been managing this with a weird mix of chezmoi and other tools, but I wanted to start from scratch nix style.

The installation instructions ask me to put my config files directly on /etc/nix-darwin which feels a bit weird to me.
I see previously the location was ~/.config/nix-darwin which is much more aligned with my expectations.
However, I tried following that path, but the installation failed. Then I just moved the files to /etc/nix-darwin and everything started to work just fine.

Is there any guidance you can offer to being able to have my nix-config files live in the same place as my other dotfiles used to live (which is my chezmoi folder)

@Enzime
Copy link
Collaborator

Enzime commented Feb 20, 2025

You can set environment.etc.nix-darwin.source = "/Users/.../.config/nix-darwin"; so that nix-darwin will create a symlink at /etc/nix-darwin and then darwin-rebuild switch will work without requiring --flake

@danielo515
Copy link
Author

Thanks for your answer.

I saw somethig similar but different in the docs here:

https://github.com/LnL7/nix-darwin/wiki/Changing-the-configuration.nix-location

but it says that then I will need to change the initial "command" to kickstart my configuration dotfiles.
It also says something weird, which is this:

By default nix-darwin looks for ~/.nixpkgs/darwin-configuration.nix

That is different from where the config is in reality (/etc/nix-darwin) and wonder if the docs is no longer valid.

Where is that config mentioned? where should I put it? Can I use a relative symlink like ~/.config/nix-darwin ?

@Enzime
Copy link
Collaborator

Enzime commented Feb 20, 2025

I've removed that page from the wiki, it hasn't been maintained and it's no longer accurate.

You can add the code I mentioned inside your nix-darwin configuration files, and you can't use a relative symlink as far as I'm aware

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

No branches or pull requests

2 participants