- Showcase (Qtile)
- Introduction
- Getting Started
- Minimal Installation Process
- Nix-Flake: Beginning of a Journey
- Doom Emacs
- Congratulations! π
- Useful Links
- Special Thanks
A hamerspace containing a declarative NixOS environment consisting of many
hand-crafted configurations, ranging from: Kitty, Alacritty, Doom-Emacs, Zathura
to many other applications which can be found in the ./home
directory.
Warning This repository, similar to other dotfile/configuration repositories, is subjected to change.
The reader ought to read through the commit history before blindly cloning, fetching or updating the necessary files required to power up their NixOS environment!
In this README I will attempt to explain how to replicate my NixOS setup or achieve similar feats. If you find this guide not as useful as it was designed to be, do submit an issue requesting a change for the specific sections you found to be confusing. Or submit a push request (PR) to this repository and hopefully we can produce better results together!
Throughout my Nix journey, I've came across two interesting projects and among those projects are Nix-Flakes and Home-Manager. (Both projects will be introduced later in this README.) These projects have been setup in such manner that allows its users to carefully tune their system environments to their liking!
One should note that this project is still in its early stages! Henceforth one should familiarize themselves with the Risks that comes with the usage of such experimental features.
Here I advice you to follow to carefully written guide by the lovely NixOS members about partitions, how to setup your partitions & later format them to their desired file-systems.
Warning The following guide is written with
nixos-gnome-21.05.1205.b72bde7c4a1-x86_64-linux.iso
in mind. Meaning that the attempt to install your Nix-Flake system from the LiveUSB won't work. You should instead proceed with a minimal NixOS installation and later attempt to upgrade to your Nix-Flake system!
Setup your environment ot use the bleeding edge repository of NixOS and also add Home-Manager to your nix-channels:
sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos
sudo nix-channel --update
In
nixos-gnome-21.05.1205.b72bde7c4a1-x86_64-linux.iso
, it's unfortunately not possible to setup your flake based system without having Nix fail the installation process. Thus the user ought to install a minimal setup and later switch to their flake-based system after rebooting their minimal setup.
sudo mount /dev/disk/by-label/nixos /mnt
sudo mkdir -p /mnt/boot
sudo mount /dev/disk/by-label/boot /mnt/boot
To prevent future crashes throughout the installation process, enable your newly created swap partition:
sudo swapon /dev/sdX
Don't forget to append the following lines of code to your configuration.nix
:
nix.package = pkgs.nixUnstable;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
git clone
your desired repository and because this guide is written with my
personal flake repository in mind:
git clone https://github.com/Icy-Thought/Snowflake.git
Backup the contents of your current /etc/nixos
directory, you'll need your
auto-generated hardware-configuration.nix
file to later place it inside its
specified hosts/deviceX
(where deviceX
is the name of your device folder.
I prefer to keep my configurations inside my git repository for easier management, but you are free to do whatever you deem saner in the following installation process:
cd Snowflake
sudo ln -s flake.nix /etc/nixos
sudo ln -s flake.lock /etc/nixos
Create a directory inside the hosts
with the name of the desired hostname for
that device; let's call this directory X
.
mkdir -p hosts/X
Now create a default.nix
file inside that folder and for the sake of speeding
the process up.
Note I suggest you copy over my
thinkpad-e595/default.nix
to your directory (X
) and later customize it to your liking.
cd hosts && cp thinkpad-e595/default.nix X
Place your newly generated hardware-configuration.nix
inside your hosts/X
and make sure to import your hardware-configuration.nix
in the default.nix
file of your device folder.
(Example): ThinkPad-E595
defined as a valid system environment.
import = [ ./hardware-configuration.nix ];
Note By default, Nautilus & Dolphin does not hide system partitions from mounted devices category.
I have chosen to hide those partitions from the mounted devices category of the
mentioned file managers. I have also added several kernel parameters and other
device-specific configurations for my setup in this repository. (check
hosts/deviceX
)
What you are required to edit is:
fileSystems
entries indefault.nix
.- The specific parts which you wish to exclude from your setup, such as: kernel parameters, modules to disable, packages to be installed among other configurations.
(Example): hiding /boot
from Nautilus mounted devices.
fileSystems."/boot" = {
device = "/dev/disk/by-label/boot";
fsType = "vfat";
options = [ "x-gvfs-hide" ]; # For hiding boot partition entry in Nautilus.
};
Make sure to replace
/dev/disk/by-uuid/xyz
(orpartuuid
) with/dev/disk/by-label/X
, whereX
follows the label you have choosen to name your partitions with during your partition setup.
After completing your setup, there remains one command to be executed (device =
folder name of your device placed inside hosts
, which in this case is X
:
sudo nixos-rebuild switch --flake '/etc/nixos#X --impure
reboot
If you have replicated my setup, you need to do nothing but git clone
doom-emacs repository and enable the emacs
module in your X/default.nix
:
modules.desktop.editors.emacs.enable = true;
To proceed with the installation of doom-emacs on your newly installed/configured nix-flake system:
git clone --depth 1 https://github.com/hlissner/doom-emacs ~/.emacs.d
~/.emacs.d/bin/doom install
You have successful installed your/my personally hand-crafted/replicated Nix-Flake environment. I hope it suits your needs, if not then you are always welcome to propose changes or fork the project and customize the repository to your heart's content!
- NixOS Manual: A manual for the newcomer to read and understand different parts of the NixOS distribution.
- Home-Manager: Helps you
manage your
~/home
related configurations. - Nix Pills: A series written to familiarize the user with the Nix programming language.
- Nixpkgs Unstable: A manual which introduces the Nix-language to people unfamiliar with the wonders of this language.
- Nix Flake MVP: A written Nix guide by edolstra.
- A Tour of Nix: a beautifully crafted introduction into the Nix programming language.
- hlissner/dotfiles: nix-flake skeleton!