-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
nixos-generate-config: add --flake option #379750
base: master
Are you sure you want to change the base?
Conversation
Seems like this needs rebasing on a recent commit first? |
0f238de
to
481b89f
Compare
7ed3895
to
3b816db
Compare
ccd7db5
to
614c5ca
Compare
614c5ca
to
b91d914
Compare
@eclairevoyant You are right, it is rebased now. |
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.
IMO we should add something to the release notes as well.
outputs = inputs\@{ self, nixpkgs, ... }: { | ||
# NOTE: 'nixos' is the default hostname set by the installer | ||
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { | ||
system = "${pkgs.stdenv.hostPlatform.system}"; |
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.
system = "${pkgs.stdenv.hostPlatform.system}"; |
nixpkgs.hostPlatform
should already get set in hardware-configuration.nix
, and passing system
to lib.nixosSystem
is deprecated:
Lines 52 to 54 in 121c18d
Legacy inputs: | |
- `system`: Legacy alias for `nixpkgs.hostPlatform`, but this is already set in the generated `hardware-configuration.nix`, included by `configuration.nix`. |
{ | ||
inputs = { | ||
|
||
# NOTE: Replace "nixos-${config.system.nixos.release}" on new releases |
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.
# NOTE: Replace "nixos-${config.system.nixos.release}" on new releases | |
# NOTE: Replace "nixos-${config.system.nixos.release}" (after reading the release notes) on new releases |
This is an internal option. No backward compatibility is guaranteed. | ||
Use at your own risk! | ||
|
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.
Nit: this is probably superfluous, internal options don't even appear in the docs, so if someone found out about it, they are already looking at the code
# NOTE: 'nixos' is the default hostname set by the installer | ||
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { |
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.
# NOTE: 'nixos' is the default hostname set by the installer | |
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { | |
# NOTE: '${options.networking.hostName.default}' is the default hostname | |
nixosConfigurations.${options.networking.hostName.default} = nixpkgs.lib.nixosSystem { |
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.
LGTM, pending eclairevoyant's changes.
This adds a
--flake
option tonixos-generate-config
which optionally also generates aflake.nix
file alongside ofconfiguration.nix
andhardware-configuration.nix
. It gives people stumbling across tutorials that explain flake-based setups an easy starting point with a simple flake, without impacting existing or non-flake configusrations.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.