This is my first post and I hope I am posting it in the right section. I want to create a new distro, based on NixOS. Regarding the same, I have many questions, but let me start with a few basic ones:
How do I build a default NixOS ISO, similar to the one we can download from the website. I understand the code is available here and here.
Once I can build the default ISO, I will try to change the parts that I need.
How do I copy files in /etc/skel or any other folder in the ISO when building it? The purpose is to copy configuration files in the distro’s ISO
How can I install flatpaks inside the iso? (or run any other command for the ISO) Note, I am not talking about installing flatpaks after installing the iso, but to bake them in the ISO itself. In other words, run
flatpak install flathub org.kde.kleopatra -y
During the ISO build process, so when the user will install the ISO, the Flatpak will already be there.
Answer to any of these questions will be appreciated. Thanks in advance.
Thanks for your reply. I tried it, and I was able to build an ISO. But it was not the one which is distributed publically. The one I got only booted in a terminal. It did not launch gnome and Calamares like the public ISO does.
Do let me know if there is any way to find out how the NixOS team is generating the ISO that they publically distribute.
I am coming from an imperative background and have some experience in building Fedora distributions. In Fedora, we create a mock chroot and then modify the iso as needed using a kickstart file.
I understand that NixOS is declarative. Towards the same, I have the following questions/observations:
I am OK with not installing flatpaks in the ISO. I will miss the permissions, but it’s not a dealbreaker for me.
During the customization of the ISO, certain files need to be copied into some of the chroot folders, such as:
/etc/skel
/etc/xdg/autostart
/etc/xdg/xfce4/
/usr/local/bin
/usr/share/
/var/lib/
So, how can I copy my own custom files and folders inside the ISO when building it, in folders shown above? Or in general, how to copy files/folders inside the ISO? What are the best practices?
So, how can I copy my own custom files and folders inside the ISO when building it, in folders shown above? Or in general, how to copy files/folders inside the ISO?
You add them to your configuration.nix. For configs in /etc you do something like this:
The resulting iso will only contain a bootloader and a nix store, everything else will be created by the activation script on boot according to your configuration.nix. This approach makes it possible to have really cool things like Erase your darlings.