Skip to content

maydayv7/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

Version License Size NixOS

This repository 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.my.to. You can follow along with my NixOS Desktop Series

Desktop Pictures

Note: These may be outdated

Hyprland
Hyprland
GNOME Desktop
GNOME Desktop
XFCE Desktop
XFCE Desktop
Pantheon Desktop
Pantheon Desktop
Older...
GNOME 44
GNOME 44
GNOME 41
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 Desktop Environments
  • Incorporates PipeWire, Wayland, ...!
  • Automatically builds and deploys my Website
  • Authentication Credentials Management using the sops Module and gnupg Keys
  • Comprehensive User Configuration using the tightly integrated home-manager module, with support for configuring shared user configuration, global conditionals and user-specific configuration
  • Ephemeral, Opt-In File System State using the impermanence module and ZFS
  • Support for Secure Boot using lanzaboote
  • Support for Multiple Programming Language Development shells integrated with direnv and lorri
  • Automatic packages Updates using update.sh
  • Install Media and Device Images using nixos-generators image generation modules
  • Syntax Formatting using treefmt and treefmt-nix
  • Support for source filters with nix-filter
  • Support for Base16 color theming using stylix
  • Support for declaratively installing Flatpak applications using nix-flatpak
  • Wrapped wine Applications using Emmanuel's Wrapper
  • Support for Android Virtualisation using Waydroid
  • Declaratively Configured Windows VM using the WFVM module

Programs

Type Programs
Editors nano, VS Code
Shells bash, zsh
Terminal Blackbox, xfce4 Terminal, Kitty
Browser Firefox
Desktop Environments GNOME, XFCE, Pantheon
Compositors Hyprland, Picom

Structure

Overview of File Hierarchy

Outputs
$ nix flake show
github:maydayv7/dotfiles
├───apps
│   └───x86_64-linux
│       ├───default: app
│       ├───install: app
│       └───nixos: app
├───channels
│   └───x86_64-linux
│       ├───stable: package channel
│       └───unstable: package channel
├───checks
│   └───x86_64-linux
│       ├───Device-gnome: derivation 'nixos-rebuild'
│       ├───Device-xfce: derivation 'nixos-rebuild'
│       └───treefmt: derivation 'treefmt-check'
├───devShells
│   └───x86_64-linux
│       ├───cc: development environment 'C'
│       ├───default: development environment 'devShell'
│       ├───format: development environment 'Formatter'
│       ├───java: development environment 'Java'
│       ├───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'
├───installMedia: device install media
├───legacyPackages
│   └───x86_64-linux (References 'stable' channel)
├───lib: utility library functions
├───nixosConfigurations
│   ├───futura: NixOS configuration
│   └───vortex: NixOS configuration
├───overlays
├───packages
│   └───x86_64-linux
│       ├───install: package 'install'
│       └───nixos: package 'nixos'
├───templates
│   └───default: template: My NixOS Configuration
└───vmConfigurations
    └───Windows: Virtual Machine
┌── flake.nix
├── flake.lock
├── files
├── site
├── devices
│   ├── systems.nix
│   └── vm
├── users
│   └── passwords
├── secrets
├── shells
├── checks
├── lib
│   ├── build.nix
│   ├── map.nix
│   └── pack.nix
├── scripts
│   ├── install.nix
│   └── nixos.nix
├── packages
│   └── overlays
└── modules
    ├── configuration.nix
    ├── apps
    ├── base
    ├── gui
    ├── hardware
    ├── nix
    ├── shell
    └── user
  • flake.nix: toplevel configuration file and repository version control
    flake-parts is used for modularization

  • files: dotfiles and program configuration

  • site: personal website generated using zola

  • devices: system configuration for various devices

  • systems.nix: list of supported system architectures

  • vm: declarative configuration to build multiple virtual machines

  • users: individual user-specific configuration

  • secrets: authentication credentials management using sops-nix

  • shells: sand-boxed shells for development purposes

  • checks: configuration checks and continuous integration

  • lib: custom functions designed for conveniently defining configuration

  • scripts: useful system management scripts

  • packages: locally built custom packages

  • overlays: overrides for pre-built packages

  • modules: custom configuration modules for additional functionality

  • configuration.nix: builds system configuration

Installation

Already Installed

In case you want to use my configuration as-is for a fresh NixOS install, you can try the following steps:

Note: You can 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 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.gpg and private.gpg in a secure location

  4. Import all required GPG Keys into a convenient location (like /etc/gpg) using gpg --homedir DIR import 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 nixos 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 devices (bear in mind that the name of the file must be same as the HOSTNAME of your device), and if required, hardware configuration using the hardware.modules option. Do keep in mind that the filesystems must be appropriately created and labeled as defined here.

  7. Finally, run nixos-rebuild switch --flake /etc/nixos#HOSTNAME (as root) to switch to the configuration!

Minimal Configuration

The lib.build.device function can be used to generate the full configuration minimally
Read this for definition information

Example flake.nix:

{
  description = "Minimal NixOS Configuration";

  ## System Repositories ##
  inputs = {
    ## Package Repositories ##
    # NixOS Package Repository
    nixpkgs.follows = "dotfiles/nixpkgs";

    ## Configuration Modules ##
    # My PC Dotfiles
    dotfiles.url = "github:maydayv7/dotfiles";
  };

  ## System Configuration ##
  outputs = inputs: let
    lib = with inputs; nixpkgs.lib // dotfiles.lib;
  in {
    nixosConfigurations.host = lib.build.device {
      name = "HOST_NAME";
      system = "x86_64-linux";

      imports = [
        # Generate using 'nixos-generate-config'
        ./hardware-configuration.nix

        # Passwords
        {
          users.extraUsers = {
            root.hashedPassword = "HASHED_PASSWORD";
            recovery.initialHashedPassword = "HASHED_PASSWORD";
          };
        }
      ];

      timezone = "Continent/City";
      locale = "US";

      kernel = "zen";
      kernelModules = ["nvme"];

      gui = {};
      hardware = {
        boot = "efi";
        cores = 4;
        filesystem = "simple";
        modules = [ /* Imported from 'nixos-hardware' */];
      };

      # Default User
      user = {
        name = "nixos";
        description = "Default User";
        minimal = true;
        password = "HASHED_PASSWORD"; # Generate using 'mkpasswd -m sha-512'
      };
    };
  };
}
From Scratch

Download the latest NixOS .iso from the Releases page and burn it to a USB using a flashing utility such as Etcher

[!IMPORTANT] These instructions are mainly intended for personal use. 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

Additional Install Media

If Nix is already installed on your system, you may run the following command to build the Install Media:
Replace VARIANT with the name of Install Media to create

nix build github:maydayv7/dotfiles#installMedia.VARIANT.config.system.build.isoImage

You can also download the NixOS .iso from here and run the install script using the following command:

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.formats.iso

Partition Scheme

Note that the install script automatically creates and labels all the required partitions, so it is recommended that only the partition table on the disk be created and have enough free space

Name Label Format Size (minimum)
BOOT Partition ESP vfat 500M
ROOT Partition System ZFS 25G
SWAP Area swap swap 4G
DATA Partition Files ZFS 10G

[!NOTE] For the advanced filesystem scheme only

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 nixos 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. You can check out the list of links below to resourceful Nix documentation/tutorials/projects that may be helpful in your endeavour

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 not tested with anything else The hardware.modules option can be used to load relevant configuration from nixos-hardware

See this for additional information

Build

While rebuilding system with Flakes, make sure that any file with unstaged changes will not be included. Use git add . in cases where the git tree is dirty

Branches

There are two branches, stable and develop (when required). The stable branch consists of configuration that builds without failure, and the develop branch is a bleeding-edge testbed

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 in order to automatically check the configuration syntax on every commit (using and statix) and format it (using treefmt), update the inputs every week, build the configuration and upload the build cache to Cachix as well as publish the Install Media .iso to a draft Release upon creation of a tag (You can also find GitLab CI/CD configuration in .gitlab). A git hook is used to check the commit message to adhere to the Conventional Commits specification

Variables

Home Manager

The home-manager module is used in tandem with the system configuration in order to define user-specific configuration. The config.user.homeConfig option has been declared in modules/user/default.nix independent of the original module, from which the final configuration is built, in order to prevent infinite recursion while configuring multiple users per system. The system config can be accessed using the sys parameter in home-manager modules

Links

Theming

  • Hyfetch: Snazzy CLI System Information Tool
  • Powerlevel10K Theme: ZSH Theme for the fancy-looking prompt with immense customization capabilities
  • Arc Theme: Flat GTK theme with transparent elements for various desktop shells, window managers and applications
  • Bibata Cursor: Compact and material designed cursor set
  • DNOME Discord Theme: Discord Theme inspired by Adwaita, designed to integrate Discord with GNOME
  • Nordic Discord Theme: Discord Theme using the Nord color palette
  • Firefox GNOME Theme: GNOME Theme for the Mozilla Firefox Browser, used for better desktop integration
  • Firefox Elementary Theme: Elementary OS Theme for the Mozilla Firefox Browser, used for better desktop integration
  • VS Code Adwaita Theme: Integrates Visual Studio Code with GNOME Desktop
  • VS Code Arc Theme: Port of the Arc Dark GTK Theme for Visual Studio Code
  • VS Code Elementary Theme: Integrates Visual Studio Code with Pantheon Desktop
  • KvLibadwaita Kvantum Theme: Integrates QT Apps with GNOME Desktop
  • Arc KDE Theme: Port of the Arc GTK Theme for Plasma Desktop
  • ULauncher Adwaita Theme: ULauncher Theme based on GNOME Desktop's Adwaita Dark Theme
  • ULauncher Arc Theme: An Arc Dark Theme for ULauncher
  • ULauncher Elementary Theme: ULauncher Themes for Elementary OS
  • Catppuccin Theme: A community-driven Pastel Theme consisting of 4 soothing warm Flavors with 26 eye-candy Colors each

Important Links

See: A Curated List of the Best Resources in the Nix Community

Other Sources

  • Tweag Article introducing Flakes
  • Serokell's Blog on Flakes
  • Jordan Isaac's Blog for porting configuration to Flakes
  • Jon Ringer's Videos on General NixOS Tooling and Hackery
  • Justin's Notes on using Nix
  • Lan Tian's Series of Blog Posts on NixOS
  • Christine's Blog Posts addressing NixOS Security
  • Graham and Elis' Blog Posts on Ephemeral Partition Schemes

Other Configurations

Here are some repositories that I may have shamelessly rummaged through for building my dotfiles:
Thanks a lot! ;)


You can navigate to the READMEs present in the various directories to know more about them

Changelog

vNEXT

  • Hyprland Improvements
    • Update to latest version
    • Desktop Icons
    • Keybindings List
    • Useful Submaps
    • Panel Improvements
    • Border Gradients
    • Revamp hyprutils Script
    • Compositor Shaders
    • Use clipse for Clipboard
    • Use amazing plugins
  • Add devcontainer for Github Codespaces
  • Reimplement support for specifying Package Channel for configuration build

v17

  • Re-expose lib.build.device
  • Add Hyprland Configuration
  • Refactor GNOME dconf
  • Overhaul XFCE Configuration
    • Use ULauncher
    • Use the Picom Compositor
  • Add Pantheon Desktop Configuration
  • Add VS Code Extensions Repository
  • Fix Android Virtualisation
  • Support running AppImages
  • Add multiple gui Modules
  • Refactor and add hardware.cpu
  • Add sql Shell
  • Actually persist ~/.local/share/Trash

v15

  • Use the flake-parts Flakes framework
  • Improve Syntax Formatting with treefmt-nix and drop pre-commit-hooks
  • Support declarative Flatpak application install
  • Update Nix to version 2.19
  • Enable Security & Hardening settings by default
  • Add Boot Recovery Settings
  • Support Secure Boot using lanzaboote
  • Allow patching Default Package Channel
  • Show package delta using nvd
  • Upgrade to GNOME 45
    • Update Extensions
  • Fix Emoji Support
  • Drop .templates
  • Multiple Refactors
    • Separate games and laptop module
    • Separate install Script
    • Stop exposing nixosModules
    • Fix user.homeConfig

v13

  • Follow NixOS Unstable
  • Improve nix-index
  • Move out proprietary files
  • Refactor Secrets
  • Drop deploy-rs Support
  • Remove inputs patching Support
  • Fix first boot installation
  • Add conditional to lib.map.files
  • Add gui.{wallpaper,wayland}

23.05 (v12)

  • Upgrade to NixOS v23.05 (Stoat)!
  • Drop cod, nix-linter, gedit, touchegg, vscode-server and mutter-rounded
  • Support Android Virtualisation using Waydroid
  • Drop compat Libraries
  • Refactor GNOME Experience
    • Use blackbox as default terminal
    • Use forge for tiling
    • Add keyboard shortcuts window using shortcuts
  • Improve XFCE Configuration and Handling
  • Improve Automatic Package Update Script
  • Enable ZFS encryption
  • Support Network Printing

22.11 (v11)

  • Upgrade to NixOS v22.05 (Quokka)!
  • Add lib.map.array
  • Improve nixos Script
  • Add gui.fonts.usershare
  • General Maintenance Updates
  • Use treefmt for Formatting Code

22.04 (v10)

  • Deprecate git-crypt Usage
  • Improve Installation Experience
  • Begin Work on Blog
  • Stabilize with multiple Bug-Fixes
Archive

v7.0

  • Create Website using Zola
  • Refine Compatibility Libraries
  • Refine Scripts
    • Use nix-shell Shebangs
    • Add lib.build.script
  • Support Visual Studio Code Editor
  • Use alejandra for formatting code

v5.0

  • Improve channels Usage
  • Support source Filters
  • Refine git Configuration
  • Use wine Application Wrapper
  • Use System Independent library
  • Add Support for Ephemeral /home
  • Add Configuration for XFCE Desktop
  • Bifurcate users and Refine User Configuration
  • Support Automatic packages Updates using update.sh
  • Add Support for Automatic Deployments using deploy-rs
  • Add Developer shells for Multiple Programming Languages integrated with lorri

v4.5

  • Use Calendar Versioning
  • Use nixConfig
  • Support Auto-Upgrade
  • Support Multiple Users per Device
  • Improve Security and Harden System
  • Use PipeWire (with low-latency) for audio
  • Use nixos-generators for Image Generation

v4.0

  • Use nixConfig

  • Bifurcate devices

    • Refactor lib.build.system into build.iso and build.device
  • Improve lib Handling

  • Improve Module Imports

  • Improve and Bifurcate docs

  • Handle scripts as packages

  • Improve configuration checks

  • Achieve system Independence

  • Add .editorconfig and nanorc

  • Refactor sops Encrypted Secrets

  • Stabilise and document templates

  • Fix devshells, repl and scripts

  • Fix Module Imports and inputs Patching

  • Improve Mime Types Handling with lib.xdg

  • Use advanced Ephemeral Root File System Layout with ZFS

  • Use flake-compat, nix-gaming and nix-wayland

  • Improve Code Consistency, reduce Complexity and fix Syntactic and Semantic Errors

v3.0

  • Upgrade to NixOS v21.11 (Porcupine)!
  • Improve Package Declaration
  • Add Support for Instant Nix REPL
  • Add Support for patching inputs
  • Improve usage of Developer Shells
  • Import Modules using nixosModules
  • Use home-manager as a Module
  • Merge Device and User Configuration
  • Move all program configuration and dotfiles to files
  • Use sops-nix at secrets for managing authentication credentials
  • Automatically map modules, packages, overlays, shells and inputs

v2.3

  • Add docs directory
  • Fix .iso Boot and Install Errors
  • Improve Scripts with error-checking
  • Add direnv support at shells
  • Add Support for Nix Developer Shells at shells
  • Use secrets as an input rather than as a submodule
  • Improve CI with automatic flake.lock update and dependency-checking
  • Bifurcate Flake outputs (as configuration.nix), scripts and overlays

v2.1

  • Simplify Installation
    • Add install Script
    • Add Support for creating Install Media
    • Add overhauled setup Script
    • Automatically build .iso and publish release using CI
  • Fix Home Activation

v2.0

  • Add BTRFS (opt-in state) Configuration
  • Improve Ephemeral Root Support with impermanence
  • Improve Installation Experience
  • Improve Home Activation
  • Bifurcate Modules and Roles
  • Reduce CI Time
  • Add the Office role

v1.0

  • Add Cachix Support
  • Add Nix Shell Support
  • Increase Readability
  • Improve Package Management
  • Under the hood CI changes

v0.7

  • Improve Secrets Management using Private Submodule at secrets
  • Overhaul Package Overrides
    • Use final: prev: instead of self: super:
    • Add support for NUR
    • Split System Scripts and import as overlay
    • Refactor Package Overrides into packages
  • Add archived dotfiles and revitalize existing ones
  • Improve Modulated Imports
  • Improve Fonts Management
  • Update README and scripts

v0.5

  • Added Support for Nix Flakes
  • Added Custom Libraries for Device and User Management
  • Created System Management Script
  • Updated README and install Script
  • Add full support for Multi-Device Configuration
  • Use Better Repository Management

v0.1

  • Added basic NixOS system configuration using GNOME and GTK+
  • Added hardware support for 2 devices
  • Added setup script
  • Added home-manager support and user dotfiles
  • Added Modulated Configuration
  • Added Support for Nix User Repository
  • Added Repository Pinning
  • Added Essential Package Overlays
  • Added Basic Password Management
  • Added README
Known Limitations
  • Home Configuration isn't be decoupled from System
  • Wine Applications have to be manually updated

Last Updated: May 2024

If you like this project, consider leaving a star

V 7
maydayv7@gmail.com