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

[WIP] nix.nix: split, align and reuse macros from NixOS #329

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

ShamrockLee
Copy link
Contributor

This PR demonstrates the possibility to reuse/inherit NixOS macros.

The original Nix-related options and config in the NixOS modules are mostly inside nixos/modules/services/system/nix-daemon.nix, making it hard to reuse without also getting those privilege-required part of implementation. The good news is that the configuration-related part has been split out and become nixos/modules/config/nix.nix, nixos/modules/config/nix-flakes.nix, nixos/modules/config/nix-channel.nix and nixos/modules/config/nix-remote-build.nix, making it much easier to reuse.

This PR first align the behavior of nix.nix with the NixOS upstream, and then split out nix-flakes.nix and nix-channel.nix. Finally, it imports the upstream nix.nix and nix-flakes.nix to replace the local interface and implementation.

In NixOS 23.11, `option.nix.extraConfig` was already renamed into
`option.nix.extraOption`, and no alias was left.

We no longer need the alias `option.nix.extraConfig` anymore.
Align this behavior with Nixpkgs/NixOS.
Add `option.nix.enable` to ease integration with NixOS macros.

Hard-code `{ config.nix.enable = true; }`.
Decouple the modules, enable ones to import/disable them separately, and
to align with the upstream Nixpkgs/NixOS module system.
@ShamrockLee ShamrockLee force-pushed the nix-reuse-upstream branch 2 times, most recently from dca29b6 to 8be0c07 Compare February 17, 2024 17:33
@ShamrockLee ShamrockLee force-pushed the nix-reuse-upstream branch 2 times, most recently from c11b06d to 1781d93 Compare February 19, 2024 05:02
@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Feb 19, 2024

fakedroid now builds and runs.

The check failure might indicate the need to update the test interface (to supply with the nixpkgs argument, etc.).

@t184256 Could you give me some hint where the test cases resides and which file is likely to be responsible for injecting the arguments?

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.

2 participants