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

Set default flake directory as /etc/nix-darwin #741

Merged
merged 1 commit into from
Jul 13, 2024

Conversation

Enzime
Copy link
Collaborator

@Enzime Enzime commented Jul 15, 2023

@emilazy
Copy link
Collaborator

emilazy commented Jul 15, 2023

If we do this, should we also switch the non-flakes default (I guess that might be backwards-incompatible?) and update the README?

@Enzime Enzime force-pushed the default-flake-location branch 2 times, most recently from 4e604a8 to c91f823 Compare July 15, 2023 01:13
@Enzime
Copy link
Collaborator Author

Enzime commented Jul 15, 2023

@emilazy my preference would not be to do any breaking changes while we don't have release channels, and this PR only affects behaviour for users who have a flake present in /etc/nix-darwin which should be no one currently. With regard to the documentation, I'm thinking of updating it separately as the instructions there still work but it'll take some rework to incorporate explaining putting your config in /etc/nix-darwin vs $HOME (and how to symlink /etc/nix-darwin).

@emilazy
Copy link
Collaborator

emilazy commented Jul 15, 2023

Okay, sure; I'm in favour. Could maybe make the instructions clearer around #740 when adjusting the docs too.

@LnL7
Copy link
Owner

LnL7 commented Jul 15, 2023

I'm not sure that introducing inconsistent locations is a good idea. For changing this in general with compatibility in mind, we could add detection for the global location and fallback to a per-user config so both cases work.

With NIX_PATH it is relatively easy for a user to specify their own default location, does something equivalent exist for nixos with the flake location?

@emilazy
Copy link
Collaborator

emilazy commented Jul 15, 2023

I think there's already inconsistency since the installer etc. use ~/.nixpkgs/darwin-configuration.nix but the flake docs talk about ~/.config/darwin, and it's been like that for a long time now. Maybe we could introduce this and change the docs for flakes, and then handle moving non-flakes configurations over and the attendant backwards compatibility concerns afterwards, since this wouldn't be introducing any new inconsistency?

does something equivalent exist for nixos with the flake location

Unfortunately I don't think so. Though maybe one has been added since I last checked. I can think of multiple ways to do it but I don't know which are any good. I always just manually specified the location. Some people sudo ln -s ~/flake /etc/nixos, which seems reasonable.

@Enzime
Copy link
Collaborator Author

Enzime commented Jul 9, 2024

I've updated this PR to search /etc/nix-darwin first then fallback to ~/.config/nix-darwin (current directory mentioned in the README) and ~/.nixpkgs which is hardcoded in a lot of locations in the codebase.

I think we should migrate to /etc/nix-darwin in a different PR and properly deprecate the old paths and update the docs.

This PR is now ready to merge as it is no longer opinionated about the default flake directory.

null2264 added a commit to null2264/dotfiles that referenced this pull request Jul 10, 2024
So that we're able to do `darwin-rebuild --flake .` since there's no
default flake path at the moment. There's however a PR that'll set
nix-darwin default flake path to `~/.config/nix-darwin` (or
`/etc/nix-darwin`).

REF:
 - LnL7/nix-darwin#721
 - LnL7/nix-darwin#741
Copy link
Collaborator

@emilazy emilazy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made a symlink and my configuration activated successfully; LGTM.

@Enzime Enzime merged commit 5ce8503 into LnL7:master Jul 13, 2024
6 checks passed
@Enzime Enzime deleted the default-flake-location branch July 13, 2024 04:35
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

Successfully merging this pull request may close these issues.

Use flake.nix by default if it exists
4 participants