Installation - hxrmonlka/alice GitHub Wiki
Note
This page is not a full guide, though consider this a reference since it doesn't go through the minimal install method.
- The current NixOS release is 26.05. The graphical ISO for 64-bit Intel/AMD is at
https://channels.nixos.org/nixos-26.05/latest-nixos-graphical-x86_64-linux.iso. - To get started, either use:
-
elinks+ddin the terminal. - In an actual Desktop Environment, use a browser. (it's this simple.)
-
- You must install
elinksusing your package manager first, for me on Bedrock Linux, it would be something like this:brl strat void xbps-install elinks. - Using the
elinkscommand, visit the NixOS Download page with:$ elinks https://nixos.org/download/
- You'll then be in a somewhat readable interface that lets you navigate through the page with arrow keys.
- Just find the section where it says: "NixOS: the Linux distribution", you can easily search for this text by pressing
/. - On the highlighted link of your preferred architecture of the ISO image, you may press
→to follow link and download.
-
ddis the best tool for writing/burning an ISO image into a disk, I've been using it every time I destroy my Gentoo install. (In which I'm kinda proud of?) - Check which device you want to write the ISO image in with
lsblk. - An example of using
dd, writenixos-sample.isoto/dev/sdX:
root # dd if=nixos-sample.iso of=/dev/sdX bs=4M status=progress oflag=sync
- to explain what some options do that weren't mentioned beforehand,
-
bs=4Mbasically tellsddto write 4MB chunks rather than the usual 512 bytes. -
status=progressonly shows progression. -
oflag=syncsynchronous output: After every write, data is flushed to the external drive.
-
- After it's done writing, you can now boot into the external drive.
Note
Before proceeding to boot into the media, you might not be able to boot to it at first, especially if it's your first time doing this in a new machine, and it could be that you either: forgot to set the boot order correctly, or you forgot to turn off Secure Boot.
- In the live environment, you may proceed with the installation as is.
- Optional 'requirements':
- Use BTRFS as the root filesystem.
- Set GNOME as the Desktop Environment on install.
- Set username as
alice.
- Here's a table of my good ol' partitions:
| Partition | Filesystem | Mountpoint | Size |
|---|---|---|---|
| /dev/sda1 | FAT32 | /boot | 1024MiB |
| /dev/sda2 | linuxswap | N/A | 1.5 * RAM in my usual case. |
| /dev/sda3 | BTRFS | / | The rest of the disk space. |
- Please take a look at this page if you don't know how to make a space for swap: What about swap space?
- Making BTRFS subvolumes for root is pointless as the installer actually handles that automatically.
- Reboot to the newly NixOS install afterwards, you can do so after a while of waiting for the installer to finish. Check the box right beside "Reboot Now" and press OK.
Warning
A portion of the code within Alice is hardcoded to /home/alice. If you use a different username on install, change these files:
-
modules/hosts/serpentine/settings/user.nix(home directory) -
modules/hosts/serpentine/settings/programs.nix(thenhflake path) -
modules/home/alice/core.nix(home directory) -
modules/home/alice/cursor.nix(cursor target directory) -
modules/home/alice/desktop/dms.nix(configHome)
If you think you did something wrong during install, you can cancel and get back at it.
- You're finally within the operating system, but you're still not done yet. The procedure will be more straightforward though.
- In a terminal (GNOME Console, if you chose GNOME),
nanois the only reliable text editor you can use. So, in this case, either usenix-shellto install Vim/Neovim temporarily:user $ nix-shell -p vim # Feel free to replace this with your preferred editor. - OR just use
nanofor an immediate act, usesudo -iif you're going to be moving back and forth toconfiguration.nixmultiple times, it saves a bit of time than to type your password every time:user $ sudo -i root # nano /etc/nixos/configuration.nix
- In
configuration.nix, we will need to add a few lines:{ nix = { settings = { experimental-features = [ "nix-command" "flakes" ]; substituters = [ "https://attic.xuyh0120.win/lantian" ]; trusted-public-keys = [ "lantian:EeAUQ+W+6r7EtwnmYjeVwx5kOGEBpjlBfPlzGlTNvHc=" "noctalia.cachix.org-1:pCOR47nnMEo5thcxNDtzWpOxNFQsBRglJzxWPp3dkU4=" ]; }; }; # This is non-mandatory, you can ignore this line. # Although if you want to follow through this, # make sure you remove networking.networkmanager.enable = true; # Somewhere in the configuration.nix. networking = { hostName = "nixos"; # Change hostname to your liking~ networkmanager = { enable = true; wifi.macAddress = "random"; }; }; }
- Enabling flakes lets the
nixcommand useflake.nix. This is mandatory. Thelantiansubstituter is the binary cache of the CachyOS kernel (nix-cachyos-kernel), which Serpentine uses. With it, you don't compile the kernel yourself. Adding only "nix-command" and "flakes" is completely fine, but then the kernel builds from source. - To clone alice, we need to have git installed in our system. Either use
nix-shell -p gitor add git to theenvironment.systemPackagesblock:{ environment.systemPackages = with pkgs; [ # vim wget git # <- We're going to use this for cloning Alice. ]; }
- After you're done editing
configuration.nix, you can now rebuild your system:root # nixos-rebuild switch - But why rebuild now? Nix settings configured just now are not applied to the system yet; they still need to be rebuilt.
- You may choose to use the
--offlineflag for this rebuild.
- You will need to clone the Alice repository with git.
test-denis the working branch, so clone that one. I recommend cloning the repository to$HOME/.local/share/aliceas it doesn't clutter your home directory. Unlike mine. :(
user $ git clone -b test-den --single-branch https://github.com/hxrmonlka/alice.git- Again, if you decide to use nix-shell to temporarily use git:
user $ nix-shell -p git
[nix-shell:~/.local/share/alice]$ git clone ...- Serpentine sets
programs.nh.flake = "/home/alice/alice". The commandnh os switchwithout arguments looks in that path. Clone Alice to/home/alice/alice, or change that line inmodules/hosts/serpentine/settings/programs.nix.
- Alice doesn't automatically fetch your
hardware-configuration.nixwithin/etc/nixos/or something like that, you will need to add yourhardware-configuration.nixsomewhere in./modules/hardware/profiles. That directory holds the profiles that exist now:a15.nix,noct.nixandqemu.nix. - A good way of copying the whole
hardware-configuration.nixfile is to first, remove the comments at the very top, assuming it's only three lines, you can check it out:
user $ cat /etc/nixos/hardware-configuration.nix | head -n 3
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.- Remove it with
nanoor with your preferred editor:
root # nano /etc/nixos/hardware-configuration.nix
- Alternatively, you can use
sedto the three lines we just saw earlier if it is available in your environment:
root # sed -i '1,3d' /etc/nixos/hardware-configuration.nix
- You then copy the output of
catusing wl-clipboard from nixpkgs, you'll either install it through systemPackages or nix-shell.
user $ nix-shell -p wl-clipboard
[nix-shell:~]$ cat /etc/nixos/hardware-configuration.nix | wl-copy
[nix-shell:~]$ # Within $HOME/.local/share/alice
[nix-shell:~]$ cd .local/share/alice
[nix-shell:~/.local/share/alice]$ wl-paste > modules/hardware/profiles/my-hardware-config.nix- And there you have it, you've finally added your hardware config to Alice.
- Alice wires each hardware profile as a module in
flake.custom.hardwareModules. Follow that, asnoct.nixdoes. - It is clearer to copy the text inside
my-hardware-config.nix, and then make a new one. - Copy your hardware config file, this command assumes you're still at
$HOME/.local/share/alice:
user $ cat modules/hardware/profiles/my-hardware-config.nix | wl-copy- The next step is to use what you've copied into a new file. Put the header lines first, paste your hardware config after the
=sign, and end the file with a semicolon and a closing brace. - It should look something like this:
{ self, inputs, ... }: {
flake.custom.hardwareModules.myHardwareConfig = { config, lib, pkgs, modulesPath, ... }: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [];
boot.kernelModules = [];
boot.extraModulePackages = [];
};
}- Your own file has more lines (file systems, swap, microcode). The structure stays the same. Do not forget the semicolon after the closing brace of your pasted module.
- You'll notice that it looks very off in terms of readability. But that's okay, it can be fixed by Neovim later.
- For now, we plan on wiring this module into a host. In this case, a good example would be
serpentine, within./modules/hosts/serpentine, you'll find itsconfiguration.nixfile. Open it. - From there, you'd want to first remove the other hardware profile it uses and add the one you created:
self.custom.hardwareModules.intelSettings
- self.custom.hardwareModules.noctHardware
+ self.custom.hardwareModules.myHardwareConfig
self.custom.hardwareModules.otdSettings- If you do not want to change Serpentine, make a new host. See Hosts.
- In your preferred host, you can use a different driver in which is absolutely customizable. These modules are:
- flake.*
- custom.hardwareModules.*
- hardwareAmd
- hardwareIntel
- hardwareNvidia
- vulkan
- nixosModules.*
- hardwareFramework
- custom.hardwareModules.*
- flake.*
- These are wired into
configuration.nixordefault.nix, within a host. Serpentine uses Intel, for example. The legacy profile is used, to configure it, go tomodules/hardware/settings/. See Intel, AMD and Nvidia for the options. - After making changes, you may stage your changes with
git add .beforenh os switch, take a look at the project to see what it does: nh. - home-manager is wired into
configuration.nix, and it is installed as a NixOS module, so the system rebuild also applies your home configuration. On the first build, your hostname is still the one from the installer, so name the host:nh os switch .#serpentine. Yes, you can usenix-shellfor this temporarily. After that first build, the hostname isserpentineand plainnh os switchworks. Right after that, you're pretty much good to go.
Tip
Did you forget to remove the old my-hardware-config.nix?
Make sure to do nh clean all / nix-collect-garbage -d right after building Alice!
- If you want to test a host before you install it, use the dev shell in the repository:
user $ nix develop
user $ build-vm serpentine-
build-vm <host>builds the host as a QEMU VM and starts it. Without a host name, it lists the available hosts.