Banner

NixOS License Last commit

This directory contains the configuration and dotfiles for my continuously evolving multi-PC setup (using Nix). All the devices I own, controlled by code. It also builds and deploys my website to maydayv7.dev.

Pictures **_Note:_** These may be outdated | ![Hyprland](./files/images/desktop/hyprland.jpg) | | :----------------------------------------------: | | _Hyprland_ | | ![GNOME Desktop](./files/images/desktop/gnome.jpg) | | :------------------------------------------------: | | _GNOME Desktop_ | | Windows | | :--------------------------------------------: | | ![Windows](./files/images/desktop/windows.png) | | |
Theming - [Starship](https://starship.rs/) Prompt Theme: Minimal, blazing-fast, and infinitely customizable prompt for any shell - [Bibata Cursor](https://github.com/ful1e5/Bibata_Cursor): Compact and material designed cursor set - [Papirus Icon Theme](https://github.com/PapirusDevelopmentTeam/papirus-icon-theme): Pixel perfect icon theme for Linux - [Catppuccin](https://github.com/catppuccin) Theme: A community-driven Pastel Theme consisting of 4 soothing warm Flavors with 26 eye-candy Colors each - [Adwaita GTK3](https://github.com/lassekongo83/adw-gtk3): Theme from `libadwaita` ported to GTK3 - [KvLibadwaita](https://github.com/GabePoel/KvLibadwaita) Kvantum Theme: Integrates QT Apps with GNOME Desktop - Firefox [GNOME Theme](https://github.com/rafaelmardojai/firefox-gnome-theme): GNOME Theme for the Mozilla Firefox Browser - VS Code [Adwaita Theme](https://github.com/piousdeer/vscode-adwaita): Integrates Visual Studio Code with GNOME Desktop - Discord [GNOME Theme](https://github.com/ricewind012/discord-gnome-theme): A GNOME theme for Discord, following the Adwaita style & GNOME HIG - Obsidian [Adwaita Theme](https://github.com/birneee/obsidian-adwaita-theme): A GNOME Adwaita theme for Obsidian
Older... | ![Pantheon Desktop](./files/images/desktop/pantheon.jpg) | | :------------------------------------------------------: | | _Pantheon Desktop_ | | [![XFCE Desktop](./files/images/desktop/xfce.jpg)](https://www.reddit.com/r/unixporn/comments/19efxry/xfce_functional_and_beautiful/) | | :-----------------------------------------------------------------------------------------------------------------------------------: | | _XFCE Desktop_ | | ![GNOME 45](./files/images/desktop/old/gnome_45.jpg) | | :--------------------------------------------------: | | _GNOME 45_ | | ![GNOME 44](./files/images/desktop/old/gnome_44.jpg) | | :--------------------------------------------------: | | _GNOME 44_ | | [![GNOME 41](./files/images/desktop/old/gnome_41.jpg)](https://www.reddit.com/r/unixporn/comments/ssb7mf/gnome_my_dream/) | | :-----------------------------------------------------------------------------------------------------------------------: | | _GNOME 41_ |

Features

Built with Nix

  • Device-Agnostic
  • Convenient and Automated
  • Hermetically Reproducible
  • Declarative and Derivational
  • Atomic, Generational and Immutable

Notable Features

  • Supports multiple users and devices
  • Configuration for multiple DEs and Compositors
  • Incorporates PipeWire, Wayland, ...!
  • Automatically builds and deploys my Website
  • Credentials management using the sops-nix module and gnupg keys
  • Comprehensive User Configuration using the home-manager module
  • Support for NixOS on WSL with shared CLI configuration
  • Ephemeral, opt-in filesystem state using the impermanence module and ZFS
  • Declarative disk partitioning and installation using disko
  • Support for Secure Boot using lanzaboote
  • Multiple development shells integrated with direnv and lorri
  • Automatic packages updates using update.sh
  • Syntax formatting using treefmt
  • Support for source filters with nix-filter
  • Support for Base16 color theming using stylix
  • Support for declaratively installing Flatpak applications using nix-flatpak
  • Support for Android Virtualisation using Waydroid
  • Support for VFIO PCI Device Passthrough with a declarative, performant Windows VM using NixVirt and Looking Glass (see my blog post)

Programs

Type Programs
Editors nano, micro, VS Code
Shells bash, zsh
Terminal Ghostty, Kitty
Browser Firefox
Desktops GNOME, Hyprland, Niri

Structure

Overview of File Hierarchy

Outputs
$ nix flake show
github:maydayv7/dotfiles
├───apps
│   └───x86_64-linux
│       ├───hyprutils: app
│       ├───install: app
│       └───os: app
├───checks
│   └───x86_64-linux
│       ├───configurations:nixos:install: derivation
│       ├───configurations:nixos:futura: derivation
│       ├───configurations:nixos:valkyrie: derivation
│       ├───configurations:nixos:vortex: derivation
│       ├───configurations:nixos:wsl: derivation
│       └───treefmt: derivation 'treefmt-check'
├───devShells
│   └───x86_64-linux
│       ├───cc: development environment 'C'
│       ├───android: development environment 'Android'
│       ├───default: development environment 'devShell'
│       ├───format: development environment 'nix-shell'
│       ├───java: development environment 'Java'
│       ├───js: development environment 'JavaScript'
│       ├───lua: development environment 'Lua'
│       ├───python: development environment 'Python'
│       ├───rust: development environment 'Rust'
│       ├───sql: development environment 'SQL'
│       ├───video: development environment 'Video'
│       └───website: development environment 'Website'
├───files: 'dotfiles' and program configuration
├───formatter
│   └───x86_64-linux: package 'treefmt'
├───homeConfigurations
│   ├───navya@futura: Home Manager configuration
│   ├───v7@valkyrie: Home Manager configuration
│   ├───v7@vortex: Home Manager configuration
│   └───v7@wsl: Home Manager configuration
├───legacyPackages
│   └───x86_64-linux (Default package channel)
├───modules: dendritic configuration modules
├───nixosConfigurations
│   ├───futura: NixOS configuration
│   ├───install: NixOS configuration
│   ├───valkyrie: NixOS configuration
│   ├───vortex: NixOS configuration
│   └───wsl: NixOS configuration
├───overlays
├───packages
│   └───x86_64-linux
│       ├───install: package 'os-install'
│       ├───os: package 'os'
│       └───website: package 'website-stable'
├───patchedPkgs: patched package source
└───templates
    └───default: template: My NixOS Configuration
┌── flake.nix
├── flake.lock
├── files
├── site
├── secrets
│   └── passwords
├── shells
├── scripts
│   ├── install.nix
│   └── os.nix
├── packages
│   ├── overlays
│   └── patches
└── modules
    ├── core
    ├── lib
    ├── hosts
    ├── users
    ├── apps
    ├── desktop
    ├── games
    ├── gui
    ├── hardware
    ├── shell
    ├── system
    └── virt
  • flake.nix: toplevel configuration file and repository version control
    flake-parts is used for modularization, following the dendritic pattern

  • files: dotfiles and program configuration

  • site: personal website generated using zola
  • secrets: authentication credentials and user passwords managed using sops-nix
  • shells: sand-boxed shells for development purposes
  • scripts: useful system management scripts
  • packages: locally built custom packages
  • overlays: overrides for pre-built packages
  • modules: custom configuration modules for additional functionality
  • lib: custom functions designed for conveniently defining configuration

Installation

Already Installed To use my configuration as-is for a fresh NixOS installation, you can try the following steps: **_Note:_** Run `nix develop` in the repository to install all required dependencies 1. Prepare `/etc/nixos`:
sudo mkdir /etc/nixos
   sudo chown $USER /etc/nixos && sudo chmod ugo+rw /etc/nixos
   cd /etc/nixos
   
2. Clone this repository (and preferably initialize it using `git`):
nix flake init -t github:maydayv7/dotfiles
   git init
   
3. Install `gnupg` and generate a GPG Key for yourself (if you don't already have one), and include it in the [`secrets.yaml`](./secrets/secrets.yaml) file (using `gpg --list-keys`). You can use the following commands to generate the GPG key (Ultimate trust and w/o passphrase is preferred): _Replace_ **_USER_** _,_ **_EMAIL_** _and_ **_COMMENT_**
gpg --full-generate-key
   1
   4096
   0
   y
   USER
   EMAIL
   COMMENT
   O
   gpg --output public.pgp --armor --export USER@EMAIL
   gpg --output private.pgp --armor --export-secret-key USER@EMAIL
   
_Save the keys `public.pgp` and `private.pgp` in a secure location_ 4. Import all required GPG Keys into a convenient location (like `/etc/gpg`) using gpg --homedir DIR --import KEY_FILE and specify it at `config.sops.gnupg.home` (Required for decryption of `secrets` on boot, can also be on an external drive) 5. Make new `secrets` and `passwords` in the desired directories by appending the paths to `secrets.yaml` and then using the following command (The [`os`](./scripts/README.md) script can be used to simplify the process): _Replace_ **_PATH_** _with the path to the `secret`_
sops --config /path/to/secrets.yaml -i PATH
6. Add device-specific configuration by creating a new file in [`modules/hosts`](./modules/hosts), setting its `system.fs` options. The disk layout is then handled by [`disko`](./modules/system/filesystem.nix), which expects the partitions to carry the `ESP`, `System` and `swap` labels. 7. Finally, run `nixos-rebuild switch --flake /etc/nixos#HOSTNAME` (as `root`) to switch to the configuration!
From Scratch > [!IMPORTANT] > These instructions are mainly intended for personal use To download the Install Media, click on the latest successful run listed [here](https://github.com/maydayv7/dotfiles/actions/workflows/install.yml) and download the image artifact. Burn it to a USB using a flashing utility such as [Etcher](https://www.balena.io/etcher/). The image supports both UEFI and legacy BIOS USB boot with Secure Boot disabled. > [!TIP] > In order to directly use the configuration, you must first create a clone of this repository and follow steps 2 to 6 from the first section, and preferably create your own install media
Build If Nix is already installed on your system, you may run the following command to build the Install Media image:
nix build github:maydayv7/dotfiles#nixosConfigurations.install.config.system.build.images.iso
To build and run the `install` script, use the following commands:
nix build github:maydayv7/dotfiles#install
sudo ./result/bin/os-install
If you want to create an `.iso` image of the entire system, run the following command: _Replace_ **_DEVICE_** _with the name of Device to build_
nix build github:maydayv7/dotfiles#nixosConfigurations.DEVICE.config.system.build.images.iso
#### Partition Scheme > [!WARNING] > The `install` script **erases the entire target disk** and creates the layout below automatically. | Partition | Label | Format | Size | | :--------- | :----: | :-------------------------------------------- | :------------------------------ | | EFI System | ESP | `vfat` | 1 GiB | | SWAP Area | swap | `swap` | `system.fs.swap` (8GiB default) | | System | System | `ext4` (`simple`) / ZFS `fspool` (`advanced`) | Remaining space | > [!NOTE] > The layout is derived from the device's `system.fs.scheme`. > The `advanced` scheme additionally creates the encrypted `fspool` datasets - `system/root` (opt-in state), `system/nix`, `data` and `reserve` #### Procedure To install the OS, just boot the Live USB and run `sudo os-install` _If the image doesn't boot, try disabling the `secure boot` and `RAID` options from `BIOS`_ After the reboot, run `os setup` to finish the install _In case you are using the `advanced` filesystem scheme, you may need to set the boot flag `zfs_force=1` on first boot_
Build It Yourself If you really want to get dirty with Nix and decide to invest oodles of your time into building your own configuration, this repository can be used as inspiration. Follow along with my [NixOS Desktop](https://maydayv7.dev/series/nixos-desktop/) Series **Welcome** to the Nix Community! ;)

Notes

Caution

This repository contains my personal configuration, and may cause undesirable effects on other systems. It may also be subject to rapid undocumented changes, and uses Nix Flakes, an experimental feature.

Note

Required Nix Version >= 2.19

It is not recommended to use NixOS if you are a beginner just starting out, without acquaintance with either the command-line or functional programming languages, since the learning curve is steep, debugging issues is difficult, documentation is shallow, and the effort required/time spent isn't worth the hassle for a novice/casual user.

Platform

May change according to available hardware

This configuration works well with an Intel CPU + iGPU, and is currently being improved to support an AMD APU + Nvidia GPU. Any other setup is untested.

See this for additional information

Cache

The system build cache is publicly hosted using Cachix at maydayv7-dotfiles, and can be used while building the system to prevent rebuilding from scratch

Continuous Integration

This repository makes use of GitHub Actions to evaluate configurations, update inputs and custom packages, build the Install Media .iso every month, and upload the build cache to Cachix. A git hook is used to check the commit message to adhere to the Conventional Commits specification

Variables

If you like this project, consider leaving a star