-
Notifications
You must be signed in to change notification settings - Fork 7
Experiment: Using Determinate + nix-darwin in a way where nix-darwin doesn't manage Nix at all #50
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
Closed
grahamc
wants to merge
3
commits into
main
from
graham/fh-469-using-determinate-nix-darwin-in-away-where-nix-darwin-doesnt
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,3 +2,4 @@ result* | |
|
|
||
| # Test artifacts | ||
| tests/flake.lock | ||
| .direnv | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| { lib, ... }: { | ||
| # Disable some modules that conflict with determinate-nixd. | ||
| disabledModules = [ | ||
| # Wants to add an outdated Nix to the environment, manage nix.conf, manage the | ||
| # NIX_PATH, manage the Nix build users and group | ||
| "nix" | ||
|
|
||
| # Wants to configure various Nix settings that want to write to nix.conf | ||
| "nix/linux-builder.nix" | ||
|
|
||
| # Wants to configure NIX_PATH | ||
| "nix/nixpkgs-flake.nix" | ||
|
|
||
| # Wants to add to nix.conf | ||
| "services/hercules-ci-agent" | ||
|
|
||
| # Wants to configure the nix-daemon launchd unit, but determinate-nixd has its own | ||
| "services/nix-daemon.nix" | ||
| ]; | ||
|
|
||
| ### Setup bogus options so that some things still work as expected. | ||
|
|
||
| # determinate-nixd manages the Nix daemon. | ||
| options.nix.useDaemon = lib.mkOption { | ||
| type = lib.types.bool; | ||
| default = true; | ||
| internal = true; | ||
| }; | ||
|
|
||
| # Necessary for darwin-rebuild, etc. tools. | ||
| # https://github.com/LnL7/nix-darwin/blob/55d07816a0944f06a9df5ef174999a72fa4060c7/pkgs/nix-tools/default.nix#L8 | ||
| options.nix.package = lib.mkOption { | ||
| type = lib.types.package; | ||
| default = { | ||
| type = "derivation"; | ||
| outPath = "/nix/var/nix/profiles/default"; | ||
| }; | ||
| internal = true; | ||
| }; | ||
|
|
||
| # Necessary system/checks | ||
| # https://github.com/LnL7/nix-darwin/blob/a35b08d09efda83625bef267eb24347b446c80b8/modules/system/checks.nix#L350 | ||
| options.nix.configureBuildUsers = lib.mkOption { | ||
| type = lib.types.bool; | ||
| default = false; | ||
| internal = true; | ||
| }; | ||
|
|
||
| # Unconditionally set in the nix-darwin flake[1], but we disable the nixpkgs-flake | ||
| # module[2] since it would interfere with determinate-nixd. | ||
| # [1]: https://github.com/LnL7/nix-darwin/blob/55d07816a0944f06a9df5ef174999a72fa4060c7/flake.nix#L36 | ||
| # [2]: https://github.com/LnL7/nix-darwin/blob/55d07816a0944f06a9df5ef174999a72fa4060c7/modules/nix/nixpkgs-flake.nix | ||
| options.nixpkgs.flake = lib.mkOption { | ||
| internal = true; | ||
| }; | ||
|
|
||
| ### Modify config settings to prevent darwin-rebuild errors caused by determinate-nixd | ||
| ### doing things differently. | ||
|
|
||
| # Disable the activation script that attempts to reload the nix-daemon on config change | ||
| # -- it does it by name (org.nixos.nix-daemon) which is wrong for us, and | ||
| # determinate-nixd manages the nix.conf and can make decisions about reloading / | ||
| # restarting when it needs to[1][2]. | ||
| # [1]: https://github.com/LnL7/nix-darwin/blob/55d07816a0944f06a9df5ef174999a72fa4060c7/modules/nix/default.nix#L827-L836 | ||
| # [2]: https://github.com/LnL7/nix-darwin/blob/55d07816a0944f06a9df5ef174999a72fa4060c7/modules/system/activation-scripts.nix#L67 | ||
| config.system.activationScripts.nix-daemon.text = ""; | ||
|
|
||
| # determinate-nixd does not support nix-channels. Thus, don't try to verify them[1][2]. | ||
| # [1]: https://github.com/LnL7/nix-darwin/blob/55d07816a0944f06a9df5ef174999a72fa4060c7/modules/system/checks.nix#L321C5-L325 | ||
| # [2]: https://github.com/LnL7/nix-darwin/blob/55d07816a0944f06a9df5ef174999a72fa4060c7/modules/system/checks.nix#L158-L175 | ||
| config.system.checks.verifyNixChannels = false; | ||
|
|
||
| # Determinate.pkg can handle fixing build users itself. | ||
| config.system.checks.verifyBuildUsers = false; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
home-manager needs this to look like a package type or it errors out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a good comment to live in-code :)