-
-
Notifications
You must be signed in to change notification settings - Fork 16.7k
nixos-generate-config: introduce templates #327740
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
amozeo
wants to merge
15
commits into
NixOS:master
from
amozeo:nixos/tools/nixos-generate-config-templates
Closed
nixos-generate-config: introduce templates #327740
amozeo
wants to merge
15
commits into
NixOS:master
from
amozeo:nixos/tools/nixos-generate-config-templates
Conversation
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
there must be a way to fix versionSuffix for non-flake environments
also: split template applying from the main check of existence of configuration.nix
In bash it's convention for "" to represent false, and "1" true. The `buildingAttribute` variable didn't honor that before.
Otherwise we'd run into trouble when a filename contained e.g. a space
To more accurately represent what it does
Opens the file that would be built from
Previously, `nixos-rebuild -A foo` would build the `default.nix` in the current directory, while `nixos-rebuild` without `-A` would not use file-based building at all. This difference compared to what `nix-build` would do is confusing. Furthermore, using `default.nix` is not great, because there's many of those files all around, and they're almost never for NixOS. This commit fixes those two issues by: - Removing support for using `default.nix` as a default when using `--attr` - If it exists, using the `<nixos-system>` entry in NIX_PATH as the default - Otherwise, use the `system.nix` file in the current directory or any of its parents, if it exists, as a default - Otherwise, use `/etc/nixos/system.nix` as a default While `system.nix` could be conflated with the `system` Nixpkgs argument, there's no practical way for this to cause problems, because `system` is never specified in a file. Having this finally allows using `nixos-rebuild` without any arguments and without any `NIX_PATH` entries, effectively a way to declaratively use NixOS from just /etc/nixos!
closing in favor of #333788 |
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
6.topic: flakes
The experimental Nix feature
6.topic: lib
The Nixpkgs function library
6.topic: nixos
Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS
8.has: module (update)
This PR changes an existing module in `nixos/`
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.
Description of changes
Introduces templates to nixos-generate-config. These templates are additional files that are copied over to destination directory.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.