Garuda Nix Subsystem
General information
The Garuda Nix Subsystem is a Nix flake, which allows easy dual boot with Garuda Linux. But it also provides a framework for pure NixOS, which provides opinionated defaults and a system which can be fully set up by toggling a few module options.
Quick links
- Using as subsystem to Garuda
- Using as module for NixOS
- ... coming soon™️
Devshell and how to enter it
This NixOS flake provides a devshell which contains all deployment tools as well as handy aliases for common tasks. The only requirement for using it is having the Nix package manager available. It can be installed on various distributions via the package manager or the following script (click me for more information):
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix -o nix-install.sh # Check its content afterwards
sh ./nix-install.sh install --diagnostic-endpoint=""
This installs the Nix packages with flakes already pre-enabled. After that, the shell can be invoked as follows:
nix develop # The intended way to use the devshell
nix-shell # Legacy, non-flakes way if flakes are not available for some reason
This also sets up pre-commit-hooks and shows the currently implemented tasks, which can be executed by running the command shown in the welcome message.
Quick start
Intro
The original idea behind this project was to use NixOS as a subsystem of Garuda. This means it can be installed easily from a running Garuda installation. This all works via BTRFS subvolumes, therefore any OS other than Garuda is considered unsupported for this method. Settings like users, passwords, and locales are automatically derived from Garuda and change with it. An option to partly share the /home
partition between Garuda and NixOS has also been provided.
At the time of writing, setting up a dr460nized desktop is the only option. This may or may not change in the future.
Installation
Our repo contains garuda-nix-subsystem
, which is the needed part to get going:
sudo pacman -S garuda-nix-subsystem # get the package
garuda-nix-subsystem install # trigger the installation process
The script will first install Nix, the package manager, and proceed by setting up the required subvolumes. After the process is finished, the subsystem may now be entered by rebooting and selecting the new Garuda Nix Subsystem
entry in GRUB.
Updating
The system may be updated by running sudo garuda-nix-subsystem update
from either Garuda or by running garuda-update
on Garuda Nix Subsystem. This sources the latest tagged commit from our Garuda Nix Subsystem repo, which also updates the flake's inputs and therefore all package versions.
To make use of this flake, you can use it as follows - we assume flakes to be enabled:
{
description = "My configuration";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
garuda.url = "gitlab:garuda-linux/garuda-nix-subsystem/stable";
};
outputs = { garuda, nixpkgs, ... }: {
nixosConfigurations = {
hostname = garuda.lib.garudaSystem {
system = "x86_64-linux";
modules = [
./configuration.nix # Your system configuration.
];
};
};
};
}
You may notice that we are using garuda.lib.garudaSystem
to build the derivation. garudaSystem
provides an opinionated system configuration similar to what Garuda Linux provides out of the box. It also exposes our modules which can then be referenced in our modules like garuda.*
. Then, build your configuration as usual. GNS defaults are generally lower priority than your settings, therefore it's easy to override most settings if needed.
You may also use any of the Chaotic Nyx's module or home-manager options. GNS nixpkgs
input follows the Nyx's nyxpkgs-unstable
(which updates daily from nixos-stable after caching has been successful) and shouldn't be overridden to profit from their package cache on Cachix.
An exemplary configuration.nix
could look as follows:
{ ... }: {
# Your hardware configuration
imports = [ ./hardware-configuration.nix ];
# Hostname
networking.hostName = "yourmachine";
# Enabling the dr460nized desktop version
# as well as the linux-cachyos kernel and gaming
# options and applications
garuda = {
dr460nized.enable = true;
gaming.enable = true;
performance-tweaks = {
cachyos-kernel = true;
enable = true;
};
};
}