-
Notifications
You must be signed in to change notification settings - Fork 25
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
Customizable nix installer #40
base: calamares
Are you sure you want to change the base?
Customizable nix installer #40
Conversation
@vlinkz Would you be so kind, and give me a hint, if it is worth the time to rebase this PR-draft/if the idea of the PR is even wanted? |
@vlinkz ping |
Yeah definitely seems like a good idea. I'll try to take a deeper look tomorrow or later this week |
82a2893
to
65e3686
Compare
The code has just been rebased and has not yet been tested again |
08b81a2
to
7311feb
Compare
12d61df
to
ebd4312
Compare
An initial draft of a corresponding NixOS module can be found here: https://github.com/FriedrichAltheide/nixpkgs/commits/calamares-nixos-extensions-custom-installer/ |
Is there any initial feedback yet? |
@vlinkz ping |
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.
I like these changes and they make the code much cleaner. Tested the provided flake example for a custom calamares ISO with additional changes for my needs and it worked like expected. Would be nice if this PR gets merged.
Just played around with this PR. Sorry if this is the wrong forum / inappropriate (newbie to NixOS), but is there a way to override/disable certain snippets? In my case, I want to disable showing the "user" creation step in Calamares, but it's not clear if this PR provides a way to do it. Also huge fan of the example-custom-iso, really helped get me up to speed. |
@daniel-xoul-ai have a look at the unfree snippet in example-custom-iso/custom-calamares/default.nix |
@vlinkz any updates? |
@@ -805,6 +533,12 @@ def run(): | |||
|
|||
# Write the configuration.nix file | |||
libcalamares.utils.host_env_process_output(["cp", "/dev/stdin", config], None, cfg) | |||
# Format configuration file | |||
libcalamares.utils.host_env_process_output(["nixfmt", config], None) |
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.
Right now nixfmt
is not in the build ISO so installation fails
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.
Have you applied my proposed module changes before building the iso? https://github.com/FriedrichAltheide/nixpkgs/commits/calamares-nixos-extensions-custom-installer/
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.
Is there a reason we can’t just ensure the templates we ship are formatted so that the resulting config will be without an explicit formatting step?
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.
It would be possible to format the default snippets in a way that the default configuration would look nicely. Yet, this PR intends to add an easy way to build custom installers based on the default calamares installer (e.g, some default settings like proxy, SSO, or CA settings). Hence, it would be nice to format the generated configuration.nix, ensuring that it is formatted nicely for new users.
libcalamares.utils.host_env_process_output(["nixfmt", config], None) | ||
|
||
# Copy modules | ||
copyModules(root_mount_point, 'defaultConfigs/modules') |
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.
Right now this leaves an empty modules
folder in a users /etc/nixos
dir. Maybe we should remove modules/nixos/defaultConfigs/modules directory and add a check to copyModules
to return if the directory doesn't exist?
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.
I added the check, but have not tested the code again. The motivation was to either
- add an minimal example module for new users there or,
- simply leaving the folder, with an .gitkeep file, for the future
39f4fdc
to
ddfd65e
Compare
bc9d359
to
684a4fd
Compare
- Move previous config snippets into snippet files, used as default snippets (getCustomOrDefaultSnippet) - If a custom snippet is found in customConfigSnippets, it is used instead
@muellerbernd thanks for spotting Co-authored-by: Bernd Müller <[email protected]>
Fix this evaluation warning on the first rebuild after install: [test@nixos:~]$ sudo nixos-rebuild build building Nix... building the system configuration... evaluation warning: The option `services.xserver.displayManager.autoLogin' defined in `/etc/nixos/configuration.nix' has been renamed to `services.displayManager.autoLogin'. Original commit id: 41f9b1b Author: Bjørn Forsman <[email protected]> Co-authored-by: Bjørn Forsman <[email protected]>
684a4fd
to
38810ee
Compare
calamares-nixos-extensions does not currently allow you to easily create a custom installer with a customized configuration.nix.
This PR adds the idea of snippets (#15), where many of the previously defined variables containing config parts are moved into individual snippet files.
All default snippets are in the
defaultConfigs/snippets
directory. If you want to create a custom installer, simply place a copy of the snippet - with your changes - in the new `customConfigs/snippets' folder.It will then be used instead of the ones defined in this repository.
As well as snippets, modules can be defined by copying them into the
customConfigs/modules
folder. Note that if the module is also to be imported, the imports.snippet must be customised using the method above.Try this PR together with https://github.com/FriedrichAltheide/nixpkgs/commits/calamares-nixos-extensions-custom-installer/