Skip to content

unclechu/nixos-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My NixOS Configuration

Usage

This config is designed to be used with own precise nixos channel pin. Not that it wouldn’t work with default nixos-23.05 channel but I like to manually update it and to store the precise pin in the repo in order to be sure my machines are 100% in sync. In short, to have better reproducibility.

Please see --help info from this script:

channels/manage.raku --help

In order to fully setup channels you just have to run:

channels/manage.raku fetch
channels/manage.raku override

P.S. Mind that the second command (override) requires “sudo” access.

  1. Load into NixOS Live CD

  2. Prepare file system according to a hardware configuration of a machine (see hardware directory, write new one for new hardware) and mount everything into /mnt as the root of the system you’re about to build.

    N.B. Keep in mind that for encrypted /boot you need to use LUKS1 instead of LUKS2 because GRUB doesn’t support LUKS2.

  3. Clone this repo into /mnt/etc/nixos and cd to that dir:

    sudo mkdir /mnt/etc
    sudo git clone https://github.com/unclechu/nixos-config.git /mnt/etc/nixos
    cd /mnt/etc/nixos
  4. Fetch and override channels (for your booted NixOS Live CD):

    channels/manage.raku fetch
    channels/manage.raku override
  5. Link related hardware config as machine-specific.nix:

    sudo ln -s hardware/wenzel-nixos-pc.nix machine-specific.nix

    Or create a new one if it’s a new machine (you can use nixos-generate-config to create one automatically, see https://nixos.org/manual/nixos/stable/index.html#sec-installation-installing for details).

  6. Install:

    sudo nixos-install --no-root-passwd --root /mnt
  7. Change the password in order to be able to login:

    sudo nixos-enter --root /mnt -c 'passwd wenzel'
  8. Reboot into the built system:

    reboot
  9. After booting to the installed NixOS override channels for it:

    (cd /etc/nixos && channels/manage.raku override)

Building “audio” system profile

An alternative configuration optimized for real-time audio processing. It’s built as a separate system profile so that the default configuration is available as usual but you can boot to one for audio processing when you need it.

You can use build-audio-profile.sh script to build that configuration as a separate profile. If you provide either boot or switch subcommand argument it will also build the regular default profile using boot subcommand for nixos-rebuild so that the default profile boots by default and “audio” profile is available as an option.

./build-audio-profile.sh boot

Or (in case you are already booted to the “audio” system profile):

./build-audio-profile.sh switch

How to manage external dependencies

Apart from general “nixos” and “nixos-unstable” channels some another external dependencies (such as Home Manager and my own nix-utils) are managed using niv tool. Those dependencies are described in nix/sources.json.

You don’t need niv to install the dependencies, only to update them, remove or add a new one (but you also can as well manually edit that nix/sources.json file).

N.B. “nixos” channel can’t be managed by niv in a NixOS configuration because it’s imported even before configuration.nix is called. configuration.nix is called with pkgs argument which is imported already. Also all the root system dependencies are provided by that channel.

Author

Viacheslav Lotsmanov

License

MIT — For the code of this repository. Some third-party dependencies may have different licenses.