GitHunt
SP

spacegauch0/nixos-dotfiles

My personal NixOS configuration files with flakes + home-manager, wayland + hyprland, network-manager, kitty, zsh, neovim, rofi

Welcome to my NixOS config files!

Version 1.0.0 NixOS

NixOS is a fully reproducible operating system based on the Nix package manager. A good guide on NixOS can be found here.

Neofetch
Dmenu
Neovim
Obsidian
Obsidian

๐Ÿ› ๏ธ What I use

What Item
OS NixOS \w Flakes && Home-Manager
Display Manager Wayland
Compositor HyprLand
Bar Waybar
Notification Manager Dunst
Audio Pipewire
App Launcher Rofi
Network Network-Manager
Take Screenshots Grim + Slurp + Wl-clipboard
Terminal Emulator Kitty
Shell Zsh
Wallpaper Manager Hyprpaper
Email client Thunderbird
Knowledge Management Obsidian
File Manager Thunar / Ranger
Editor Neovim
Browser Vivaldi
Change Brightness Brightnessctl

Vim plugins

Name Description
nvim-tree-lua Directory Tree
vim-stratify Fancy Start Screen
nerdtree Another Directory tree
surround-nvim Shortcut to surround a work with char
syntastic Code syntax checking for a lot of languages
YouCompleteMe Code completition for most languages
vim-airline Bottom bar with some informations
emmet-vim Amazing html completition
telescope-zoxide Fuzzy finder
fine-cmdline Better looking command line
nvim-colorizer-lua Show hex colors immediately
gitsigns-nvim Hilight text that has changes since last commit
copilot-nvim Github's AI assistant

๐Ÿ”ฉ My Hardware

๐Ÿ–ฅ๏ธ Computers

Name System Role Notes User
Desktop NixOS Main workstation for computation and Gaming i5-6500K 3.2 GHz, Nvidia 1060 3G, 16 GB ram DDR4, AC-Game Mechanical Keyboard, HP Monitor, Creative Speakers, Gaming Mouse santo
Hp Laptop NixOS University Note taking and Programming when I'm outside - lanto
Laptop Acer NixOS Tests and Backups - santo
Computerino Ubuntu Server Backups and Server - santo
Laptop 3 Archlinux - - -
Laptop 4 Debian - Too old to be useful -

๐Ÿ”Œ Devices

Nome Role Notes
Kingdian SSD Archlinux Boot 100 GB
USB Stick Installation Media 8 GB
Samsung A13 Main Phone
Samusng J6 Wifi Hotspot
Launchpad S App-launcher

โŒจ๏ธ My keyboard configuration

I use home row with the following settings

(deflayer homerow
  esc  f1   f2   f3   f4   f5   f6   f7   f8   f9   f10  f11  f12        ssrq slck pause
  grv  1    2    3    4    5    6    7    8    9    0    -    =    bspc  ins  home pgup  nlck kp/  kp*  kp-
  tab  q    w    e    r    t    y    u    i    o    p    [    ]    ret   del  end  pgdn  kp7  kp8  kp9  kp+
  caps @met_a @alt_s @ctl_d @sft_f @num_g h  @sft_j @ctl_k @alt_l @met_;  '  \           kp4  kp5  kp6
  lsft 102d z    x    c    v    b    n    m    ,    .    /    rsft            up         kp1  kp2  kp3  kprt
  lctl lmet lalt           spc                 ralt rmet cmp  rctl       left down rght  kp0  kp.
)

(deflayer numbers
  _    _    _    _    _    _    _    _    _    _    _    _    _          _    _    _
  _    _    _    _    _    _    _    _    _    _    _    _    _    _     _    _    _    _    _    _    _
  _    _    _    _    _    _    XX   /    7    8    9    -    _    _     _    _    _    _    _    _    _
  _    _    _    _    _    _    XX   *    4    5    6    +    _                         _    _    _
  _    _    _    _    _    _    XX   0    1    2    3    _    _               _         _    _    _    _
  _    _    _              _                   _    _    _    _          _    _    _    _    _
)


I'm looking forward to change keyboard layout soon

๐Ÿช› Use my config files

Clone my repo, then add .secrets/ directory with the file .secrets/github-access-token

Make sure there is no new line in the file (0x0a)

Build the system with with

sudo nixos-rebuild switch --flake .<profile-here> --impure

Or with the build.sh script

./build.sh system <profile-here>

impure lets you read gihub credentials from .secrets

I don't place my config in /etc/nixos/ but I have this repo on my home inside .config/nixos

๐Ÿ—๏ธ Structure

Take a look around (might not be updated to the lastest version)

โ”œโ”€โ”€ build.sh                        # Easy to use build script
โ”œโ”€โ”€ flake.lock                      # Lock file for flakes
โ”œโ”€โ”€ flake.nix                       # All flakes profiles are defined here
โ”œโ”€โ”€ home                            # Home Manager configurations
โ”‚ย ย  โ”œโ”€โ”€ lanto                       # Minimal user with just the necessary stuff
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ default.nix             
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ dev
โ”‚ย ย  โ”‚ย ย      โ”œโ”€โ”€ default.nix
โ”‚ย ย  โ”‚ย ย      โ””โ”€โ”€ git.nix             # Git configurations and setting up credentials
โ”‚ย ย  โ”œโ”€โ”€ santo                       # Power user with many programs
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ default.nix
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ dev
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ default.nix
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ git.nix
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ programs
โ”‚ย ย  โ”‚ย ย      โ””โ”€โ”€ default.nix
โ”‚ย ย  โ””โ”€โ”€ shared                      # Pakages and configurations shared between users
โ”‚ย ย      โ”œโ”€โ”€ default.nix
โ”‚ย ย      โ”œโ”€โ”€ desktop
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ default.nix
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ hyprland.conf       # Hyprland
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ hyprpaper.conf      # Wallpapers
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ i3.nix
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ neofetch.nix
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ ranger.nix
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ rofi.nix
โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ waybar.nix
โ”‚ย ย      โ”œโ”€โ”€ dev
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ default.nix
โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ neovim.nix          # Neovim Plugins
โ”‚ย ย      โ””โ”€โ”€ shells
โ”‚ย ย          โ”œโ”€โ”€ alacritty.nix
โ”‚ย ย          โ”œโ”€โ”€ bash.nix
โ”‚ย ย          โ”œโ”€โ”€ default.nix
โ”‚ย ย          โ”œโ”€โ”€ fhs.nix             # FHS filesystem
โ”‚ย ย          โ”œโ”€โ”€ kitty.nix           # I use kitty
โ”‚ย ย          โ”œโ”€โ”€ shell.nix
โ”‚ย ย          โ””โ”€โ”€ zsh.nix
โ”œโ”€โ”€ hosts                           # Configuration specific per machine
โ”‚ย ย  โ”œโ”€โ”€ acer-laptop                 # Backup / Second Laptop
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ configuration.nix
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ default.nix
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ hardware-configuration.nix
โ”‚ย ย  โ”œโ”€โ”€ desktop                     # Main workstation, nvidia drivers
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ configuration.nix
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ default.nix
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ hardware-configuration.nix
โ”‚ย ย  โ””โ”€โ”€ hp-laptop                   # Unversity note taking and programming
โ”‚ย ย      โ”œโ”€โ”€ configuration.nix
โ”‚ย ย      โ”œโ”€โ”€ default.nix
โ”‚ย ย      โ””โ”€โ”€ hardware-configuration.nix
โ”œโ”€โ”€ misc                            # Some notes I took that I might need in future
โ”‚ย ย  โ”œโ”€โ”€ powertop.md
โ”‚ย ย  โ””โ”€โ”€ screenshots
โ”‚ย ย      โ”œโ”€โ”€ 01.jpg
โ”‚ย ย      โ”œโ”€โ”€ 02.jpg
โ”‚ย ย      โ”œโ”€โ”€ 03.jpg
โ”‚ย ย      โ””โ”€โ”€ 04.jpg
โ”œโ”€โ”€ modules                         # System-wide configuration and packages
โ”‚ย ย  โ”œโ”€โ”€ cache-server.nix
โ”‚ย ย  โ”œโ”€โ”€ default.nix                 # All system packages
โ”‚ย ย  โ”œโ”€โ”€ memory-optimization.nix
โ”‚ย ย  โ”œโ”€โ”€ network-manager.nix
โ”‚ย ย  โ”œโ”€โ”€ nvidia.nix                  # Nvidia settings
โ”‚ย ย  โ””โ”€โ”€ users.nix
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ wallpapers                      # A bunch of wallpapers 
    โ”œโ”€โ”€ anime1.jpeg
    โ”œโ”€โ”€ anime2.jpeg
    โ”œโ”€โ”€ anime3.jpeg
    โ”œโ”€โ”€ fishing.png
    โ”œโ”€โ”€ free-as-in-freedom.jpeg
    โ”œโ”€โ”€ grass.jpg
    โ”œโ”€โ”€ lake.png
    โ”œโ”€โ”€ mountain.png
    โ”œโ”€โ”€ nixos-dark.png
    โ”œโ”€โ”€ nixos-light.png
    โ”œโ”€โ”€ only-grey.png
    โ””โ”€โ”€ telescope.png

๐Ÿ  home-manager

You can manage the user environment without sudo thanks to home manager. Inside flake.nix there is a profile for santo@home that imports the modules at home/santo/. You can build your profile with home-manager with this command:

home-manager switch --flake flake.nix#santo@home --impure

Or with my build script

./build.sh home santo@home

๐Ÿš nix-shell

For developement consistency, NixOS uses (enforces...) the use of nix-shell (or nix develop for flake configuration). You can create and enter into developement environment it with the command nix-shell. You can provide the packages with -p or use a configuration file like so:
modules/shell/shell.nix

{ pkgs ? import <nixpkgs> {} }: pkgs.mkShell {
  nativeBuildInputs = with pkgs.buildPackages; [
    libgcc
    # cargo
    # rustc
  ];
}

See modules/shell/shell.nix for more information.

Example usage

nix-shell -p gcc
nix-shell /path/to/shell/configuration.nix
nix develop nixpkgs#gcc

With nix develop you mantain in scope all your user programs

Run a FHS shell

nix-shell home/shared/fhs.nix

Run Appimage

nix-shell -p appimage-run
[nix-shell]$ appimage-run <your-appimage>

โฌ†๏ธ Upgrade the system

nix flake update

๐Ÿ—‘๏ธ Remove Garbage

Remove system versions and packages no longer used by new generations by 15 days

nix-channel --update
sudo nix-channel --update
sudo rm /nix/var/nix/gcroots/auto/*
nix-collect-garbage -d
sudo nix-collect-garbage -d
sudo nix-store --optimize

Create a new module

Create a file such as main-user.nix
Then add It into the configuration.nix file

imports = [
	./hardware-configuration.nix
	./main-user.nix
]

In main-user.nix

{ whatever, ... }:

{
   # Config here
}

Default

If you call a file default.nix, you can access It just bu importing It's folder

Finding options and functions

nix search nixpkgs <searchterm>

๐ŸŽฅ Resources

Videos

https://www.youtube.com/watch?v=CwfKlX3rA6E

https://www.youtube.com/watch?v=a67Sv4Mbxmc

https://www.youtube.com/watch?v=1ED9b7ERTzI

Sites

https://search.nixos.org/options?channel=23.11&from=0&size=50&sort=relevance&type=packages&query=git

https://search.nixos.org/packages?channel=23.11&show=git&from=0&size=50&sort=relevance&type=packages&query=git


TODO

  • Login Manager
spacegauch0/nixos-dotfiles | GitHunt