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: enable overriding configuration.nix #66327
nixos-generate-config: enable overriding configuration.nix #66327
Conversation
# compatible, in order to avoid breaking some software such as database | ||
# servers. You should change this only after NixOS release notes say you | ||
# should. | ||
system.stateVersion = "''${\(qw(@release@))}"; # Did you read the comment? |
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.
Hrm, this is pretty ugly. Can the substitution be done here, and not in a perl escape?
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.
Great point. That should be possible I think. I'll fix it.
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.
Actually that seems worse, because then we have two kinds of substitution going on in this file.
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.
Well in my original commit there were actually already two substitutions going on. Now it's back to a single substituteAll
call as before.
@GrahamcOfBorg test nixos-generate-config |
ccc237e
to
3c8321c
Compare
Hm, the problem with |
That's true. I did make I could add to the option description:
|
@GrahamcOfBorg test nixos-generate-config |
3c8321c
to
810388a
Compare
@basvandijk Ah, I didn't notice you made it internal. In that case it's fine. |
I'm writing a custom NixOS installation ISO image for installing various machines. The image contains an interactive script that performs an automatic installation. After asking which disk to install to it will partition the disk, format the filesystems, mount them and then it will call
nixos-generate-config
to generate the initial/etc/nixos/configuration.nix
. I would like to automatically set some things in this initial configuration like enabling SSH, settingusers.users.root.openssh.authorizedKeys.keyFiles
and maybe some more settings. I could of course patch or overwrite/etc/nixos/configuration.nix
but that could destroy potentially useful stuff like the$bootLoaderConfig
. Overriding it in NixOS would be safer.Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)Notify maintainers
cc @edolstra @grahamc