Why is there no "installer" for NixOS?

I think this was the goal with nixpart (linked above and again here for convenience). @aszlig do you have any words of advice about the state of that effort or what you think it might take to complete a similar one?

You can use NixOS as your daily driver without having to write expressions in an exotic functional programming language that isn’t used anywhere else. You only need to do that to add a new package to nixpkgs or override an existing one, but since nix repo is one of the largest and most up-to-date, it’s not often you need to do that.

And configuration.nix is mostly just a big JSON file, it’s easy to add packages and other config options to it without writing any actual programs or scripts.

4 Likes

I like graphical installers because they save me time, compared to checking partitioning commands, and because I think (I wonder whether I could be wrong) that I’m much less likely to accidentally format the wrong partition and lose data if I have a graphical representation of my disks. So I’d love a graphical installer for NixOS even if all it did was partitioning and generating a minimal config and putting me into an editor.

2 Likes

Yes, there absolutely needs to be support for graphical configuration management after the installation as well.

do you have any words of advice about the state of that effort or what you think it might take to complete a similar one?

The current state of that effort is pretty much stalled since I’m currently busy with entirely unrelated things and I highly doubt that I’ll get back to it soonish. That said, it does bother me that we only have a heavily monkey-patched version of nixpart for the NixOps Hetzner backend and not what I had in mind as a more generic solution.

If you want to work on a similar implementation, be sure to look at the device tree representation that we’ve worked out back then:

Here is the implementation: https://github.com/NixOS/nixpkgs/tree/0a18f5953217308f94ea777130bf2efa0f748d29/nixos/modules/tasks/storage

What’s essentially missing is the actual partitioner that takes the storage configuration and applies the delta between the device tree of the current system and the device tree of that configuration.

1 Like

I created nixos-up for precisely this purpose: GitHub - samuela/nixos-up: The fastest NixOS install there is! 🏎️🏁. It’s a TUI you can run directly from the installer ISO and it takes care of everything to get you into a working NixOS install as quickly as possible!

5 Likes

Thanks gang. A lot of really good information here.

@hmenke, My main concern is about partition tables and filesystem configurations. The installer is great once you have a suitable configuration.nix file. However, there will be things that will be unique between deployments, I.e. name and configuration of network interfaces, time zone, user accounts, language and the type of environment. I would expect having good and secure default templates for servers, desktops, laptops, gaming, etc configuration will also make it more accessible to more people. (Perhaps use a Union function to more than one role can be configured.) One of the things I teach my team is that a component of good software are good defaults. I think this a way to provide that.

@Carlos, you are right, bad defaults will always ruin your day, but I think more days has been ruined because of brave amateurs making mistakes such as having insecure configurations. Ideally by providing good defaults, we can can get assumptions evaluated by the larger community and hopefully pick up on badness. I expect that the expert users will still do their thing their way and that’s fine, but we should also look out for the less experienced users in our community.

@wkral really like the idea of a declarative initial system setup. My thought is that the installer should be able to generate this configuration file for you.

@pxc, thanks for the bullet point whish list. Some great ideas there. I’ve been wondering about how to integrate things like the option and package search into the installer.

@pxc, @aszlig, @samuela Thanks for all the links, I have been casually reading through them. If you guys like to exchange notes, I’ve been putting together my own lazy man’s installer at: GitHub - wmarais/nixos-installer: A simple script to install NixOs.

What you can see from the scripts, I have three HDD configurations all running on LVM.

  1. No Encryption - Generally for VMs running either in data centres with high physical security, or VMs on encrypted PCs etc.
  2. Partial Encryption (Root Only) - Encrypt the root and swap partitions, but leave /boot unencrypted. (faster booting than full encryption).
  3. Full Encryption - Everything is encrypted and you need to enter the password twice, first to unlock for grub boot, then for linux boot.

One of the big issues I had found was that the hardware-configuration.nix file refer to device by UUID which is not super useful for a generic file system configuration. One of the things I’ve been doing is to run on gpt only and name the partitions. Then I can refer to them by part-label. That way I can deploy the exact configuration on every VM that my team deploys. This would be an example of a default I would recommend be changed to make a more portable deployment. This is shown in the example: https://github.com/wmarais/nixos-installer/blob/265ae3029db4a3c89d2da9ec13bdef52b9149440/hdd_setup/gen_fs_conf.sh

It also generate a default filesystem layout and a default configuration for a few things. (Still missing the bash, vim, git, etc configurations.) My idea would be to extend this with a UI and pull in the good ideas and existing work from the community where it exist.

Thanks all.

4 Likes

Do it! Don’t listen to the gatekeepers! There are lots of barriers to entry to NixOS, and a graphical installer both removes one of those barriers for a large group of worthy people, as well as makes life nicer for another large group of people. At with removing any barrier, it will accelerate the removal of other barriers.

If some of you think that doing some other than building a graphical installer is more valuable, then by god, get to it. No need to discourage other people while you’re doing your own part.

12 Likes

Pretty new to NixOS myself, but started working on some modules for calamares that generate a configuration based on some presets. See: GitHub - vlinkz/calamares-nixos-extensions: NixOS calamares [maintainer=@vlinkz]. I also made a pr to fix the currently broken calamares modules. So far also have only tested basic installs with efi and ext4 filesystem, but results seem promising. Does anyone have any suggestions on what a default configuration file should look like? So far I just modified the default gnome configuration with a few extras: https://github.com/vlinkz/calamares-nixos-extensions/blob/ef141de81bb4238dbb52ab0c91a4e3d4d7edfcaf/modules/nixos-customize-config/main.py#L36

4 Likes

@vlinkz Looks terrific to me, except maybe use pipewire these days, e.g.:


hardware.pulseaudio.enable = false; 
  
security.rtkit.enable = true; # for pipewire

services.pipewire = {
            enable = true;
            alsa.enable = true;
            alsa.support32Bit = true;
            pulse.enable = true;
            config.pipewire = {
                "context.properties" = {
                    "default.clock.rate" = 44100;
                };
            };
        };
        
4 Likes

I think it would be a pretty cool user experience to have something like GitHub - nix-gui/nix-gui: Use NixOS Without Coding as part of the installer.

A guided installation would be:

  • Grub installer / memtest menu
  • “Kiosk” calamares installer pages:
    • Select language / timezone
    • Guided partition editor + filesystem support
    • Select Nix channel?
      • latest stable (default)
      • unstable
    • run: attempt channel update
    • run: nixos-generate-config
    • run: Nixos-hardware step?
    • Nix-gui-like configuration editor
    • run: nixos-install step
    • Prompt: Continue exploring on DE, nixos-enter, or restart
9 Likes

Sorry for the slow reply, been off keys for a while getting the house ready for a new child. I have been reading all the messages on my phone, so thanks for those posting.

Just a quick update, I’m in the process of writting some prototypes, i.e. udev to detect all disk, LVM integration, CryptSetup integration, parted integration and some basic UI concepts. Nothing particularly useful at the moment, but trying to split the core functions into a library to implement both a CLI and GUI version (i.e. headless server installs using ncurses or similar and graphical / desktop install maybe using QT).

I still need to find a way to extract / make searchable all the nixos configuration options programatically. I’m still needing to poke the ZFS implementation a bit too. Those will be the last prototypes before I start architecting an implementation.

I’ll post some more as progress is made.

2 Likes

Just to chime in, I wouldn’t mind a graphical installer.
Especially for the initial partitioning and encryption, like many others I wrote my own script for that.
Maybe it could support Flakes as well, e.g. you can provide it the URL and it will install it. Not a huge task to do on the command line but might be handy.

2 Likes

I love the idea of a graphical installer for NixOS. Depending on its implementation it would allow different kinds of people to get into NixOS faster.

In my opinion, there are a lot of ways to go about this with two extreme cases:

  • Completely hide all of the nix expressions behind a GUI.
    • This would help a lot of people who are interested in NixOS’ qualities as a bulletproof distro, but have little interest in cracking open an editor and dealing with syntax errors and documentation.
  • Guide the user in crafting their own nix configuration.
    • This would be very helpful to people who want to get their feet wet but are not ready to make the upfront investment of reading the docs before they jump right in.

I am a strong believer in the second approach, because that one matches my personality. I imagine that having a step-by-step wizard that displays the resulting nix expressions on every step, linked to all the relevant documentation would have gotten me to NixOS sooner.

If anyone is working on an installer with an emphasis on “in your face” nix expressions and tutoring the user, I would be interested to help.

PS: on a related subject, anyone can recommend a tool/library that can parse and update a nix configuration file while keeping it in a readable form?

1 Like

nixfmt and rnix-lsp contain some prior art in that direction, I think.

2 Likes

I’ve found some success using rnix-parser in a small tool I’m working on called nix-editor. So far my plan with it is to use it as a stepping stone to more user friendly ways of editing nixos configuration files. I was thinking of something along the lines of Gnome’s dconf-editor that would keep the structure of a nixos configuration while being more user friendly. I also did look at nixui, when I started using nixos a few months ago, but found it to be not very easy to pick up or use.

I did some more work on my calamares modules and was able to get most of the basic features working, including configuring boot for both bios and efi systems, encrypted disks, and autologin. I also tested fresh installations using a modified iso image and it was able to install nixos without any issues, however, I agree with the general sentiment that given the lack of other graphical tools, new users would have no idea how to proceed after the installation was completed.

4 Likes

Can you share the ISO for testing?

What are the next steps? Should we wait to publish the graphical installer until we have a graphical configuration tool or can we say these are two separate tasks that we can improve one after another?

The manual has chapters for installation and changing configuration: NixOS 23.11 manual | Nix & NixOS

If we can replace reading the installation chapter with an intuitive tool, i think that’s a great improvement we should publish.

3 Likes

Here’s a link to an iso for testing: nixos-22.05.git.4b46a593ef0M-x86_64-linux.iso
sha256: 876c96c32e0156ef7c5391567a715744de7cfbca66a9141ed1ff1ad5b2e69e23
The iso was built against this file on my nixpkgs fork: installation-cd-graphical-calamares-gnome.nix

And as for when to publish, I think that this could be used without other tools for the time being, and I think could be helpful for some people. But my only concern would be users installing NixOS possibly without even reading the manual, and then being lost on what to do.

5 Likes

That could be remedied by making sure the installer points the user to the installation instructions, possibly on first boot so that they have a reference to hand.

Currently such users cannot install NixOS anyway, so this isn’t really a regression.

3 Likes