Skip to content

NixOS flake with automatically generated options to enable and disable users for specific hosts and a special module layer for options

License

Notifications You must be signed in to change notification settings

S1rDev10us/dotfiles

Repository files navigation

S1rDev10us/dotfiles

⚠️ warning, this readme is not always up to date with the current system configuration, I am not focused on making sure this readme is updated accurately and my configuration is constantly in development

Repo description

This repo contains the dotfiles for my NixOS config.

If you want to try it out you need to create a new host and potentially a new user account and then run just switch

If you want to setup a Windows dualboot you need to set Windows to use UTC time instead of local time

This configuration is constantly in development and may also not reflect the current state of my config.

Feel free to take elements and inspiration from this config in order to create your own

Structure

There are two config directories for each user in a system.

They have a set of options that are only applied when using home manager and a set of options that are applied when using NixOS and home manager

The home manager specific configuration is in ./users/${user}/default.nix and the shared system config is in ./hosts/${host}/default.nix

Those options are not evaluated by the usual home manager or nix modules system, instead they are evaluated ahead of time. This means that that config's settings can be used to get the stateVersion (and potentially the system architecture in the future)

Modules for NixOS and home manager as well as shared modules are stored in the modules folder (under the nix, home and common folders respectively)

The options for the aforementioned system config are stored in the options directory and are recursively gathered. The options that they generate are documented below

The NixOS and home manager configs also gather a few specific files for their config so that if you need to specify configuration that is unique to that computer or user then you can do so.

These files are:

  • Home manager:
    • ./users/${user}/home.nix
    • ./hosts/${host}/home.nix
  • NixOS:
    • ./hosts/${host}/configuration.nix
    • ./hosts/${host}/hardware-configuration.nix

Modules in system specific files cannot affect the main system options and the config for the options can't control the systems directly

The overall structure of the system is as follows:

(Modules with ! aren't optional, modules with _ are home manager specific and modules with - are NixOS specific)

dotfiles
| hosts
| ⌞ ${host}
|   | _home.nix
|   | !default.nix
|   | -configuration.nix
|   ⌞ -hardware-configuration.nix
| modules
| | common
| | ⌞ *
| | nix
| | ⌞ -*
| ⌞ home
|  ⌞ _*
| options
| ⌞ *
⌞ users
  ⌞ ${user}
    | default.nix
    ⌞ _home.nix

Hosts

Hostname Environment Use case State Device description
Hydra NixOS Linux learning device Old silver laptop
Amphisbaena NixOS Dualboot Main work device Thin black laptop
Minotaur WSL on Amphisbaena Linux features on windows ^
Cerberus NixOS VM on Amphisbaena Using Linux more often ^
Chimaera NixOS Dualboot Gaming and streaming 🚧 Large white desktop

✅ yes

⛔ no

🚧 in progress

Features

  • Individual configs for different machines by customizing data in the hosts folder
  • Update home manager and NixOS together or separately
  • Templates for various project types in resources/templates

Host config options

  • stateVersion = a string that is used for the stateVersion
  • batteryManagement.enable = enable battery management
  • coding.enable = enable generic code editors
  • environment
    • hyprland.enable = enable hyprland
    • gnome.enable = enable gnome
    • KDE.enable = enable KDE
  • fun.enable = enable fun tools like fastfetch
  • gamedev.enable = enable game development tools
  • gaming.enable = enable games
  • grub
    • enable = enable grub
    • useEfi = enable grub EFI support
    • windowsLocation = uuid of windows partition
  • GUI.enable = enable GUI packages
  • WSL.enable = enable WSL support
  • VM.enable = enable vm support
  • users.${user}
    • enable = enable this user
    • admin = give this user admin permissions

Potential issues

When using a wsl config like minotaur it may occasionally throw an error along the lines of Failed to mount /lib/modules/5.15.146.1-microsoft-standard-WSL2.. This is because you have updated your WSL version without changing the mount path of the wsl config. To fix this go to the hardware-configuration for the system and change the line that has that mount path to respect your current WSL version. (You can get your WSL version with WSL --version, the line you're looking for is "Kernel version")

Inspirations

A few of the configs that I've taken ideas from include:

(A more up to date and comprehensive list of what I've looked at)

No doubt I've missed a few from when I was first getting into nix but I am thankful to everyone who left their config on the internet for me to learn from.

Stargazers over time

Stargazers over time