Skip to content

dafitt/dotfiles

Repository files navigation

My daily driver's SnowfallπŸŒ¨οΈπŸ‚ NixOS❄️ desktop flake

Hyprland-ricing

My dotfiles are not perfekt, but they strive to be:

  • fully declarative πŸ“
  • highly structured 🧱
  • modular πŸŽ›οΈ
  • a consistent look'n'feel ✨
  • KISS (keep it stupid simple)πŸ₯΄

Notes

This flake can and will radically change as I learn, discover new things and have new ideas.

Programs and Features

Operating System πŸ’» NixOS
Window manager πŸͺŸ Gnome with extensions, Hyprland with plugins
Login manager πŸ”’ gdm, greetd, tty
Session locking πŸ”’ hyprlock
Terminal ⌨️ kitty
Shell 🐚 fish
Prompt ➑️ starship
File manager πŸ“ nautilus, pcmanfm, yazi
Editor ✏️ VSCodium
Web 🌍 Firefox, Librewolf, Epiphany
Theming 🎨 Stylix - modified catppuccin 🌿 Mocha
Networking 🌐 networkmanager, connman
Virtualization πŸͺŸ virt-manager, bottles

Installation

On a new host machine

  1. Install NixOS

  2. Dotfiles preparation: mandatory changes to my dotfiles

    1. git clone https://github.com/dafitt/dotfiles.git

    2. Add a new system-configuration to /systems/<architecture>/<host>/default.nix (available dafitt-nixos options can be found at templates/system/default.nix)

    3. Copy and import hardware-configuration.nix!

    4. Set the correct system.stateVersion

    5. Add a new home-configuration to homes/<architecture>/<user>[@<host>]/default.nix (available dafitt-home options can be found at templates/home/default.nix)

    6. Commit all changes:

      git add . && git commit -m "systems: added new host"
      
    7. Uncomment nixConfig in flake.nix and enter nix develop on your first build for faster build time

  3. System preparation

    1. Remove (or save) some files for the Home-manager so that the first build is not interrupted:
      rm ~/.config/user-dirs.dirs ~/.config/mimeapps.list ~/.config/fish/config.fish ~/.config/hypr/hyprland.conf
      
  4. Build

    1. nix-shell and then nix develop

    2. sudo nixos-rebuild boot --flake .#<host>

    3. Check for home-manager errors systemctl status home-manager-<user>.service and resolve them if necessary

    • NOTE First install: may take some time; especially flatpaks
  5. reboot

  6. Personal imperative setup:

    1. Configure monitor setup with nwg-displays
    2. Syncthing setup
    3. firefox: Sync Login
      1. NoScript
      2. 1Password
      3. Sidebery
    4. pavucontrol: Set standard audio output
    5. vscode: codeium plugin

Usage

Flake

Some basic flake commands

Shell environment

nix-shell shell.nix # only when on legacy-nix: enables flakes & git (works only locally)

nix develop github:dafitt/dotfiles#default

Overview

nix flake show github:dafitt/dotfiles

Build and switch configuration

NixOS & Home-manager:

nixos-rebuild switch --flake .#<host>

Home-manager standalone:

home-manager switch --flake .#<user>@<host>

Update flake inputs

nix flake update --commit-lock-file

# specific input
nix flake lock --update-input [input]

Rollback

NixOS confituration: sudo nixos-rebuild switch --rollback

Home-manager standalone: Home-manager documentation

Code formatting

nix fmt [./folder] [./file.nix]

snowfallorg/flake

snowfallorg/flake provides some faster to type commands:

nix shell github:snowfallorg/flake

flake dev
flake test
flake switch
flake update

# Explore flake
flake show github:dafitt/dotfiles
flake option github:dafitt/dotfiles --pick

SUPER_CONTROL - System and Hyprland control
SUPER - Window control
SUPER_ALT - Applications
SHIFT - reverse, grab, move

Keybind Dispatcher Command
SUPER_ALT G exec codium
SUPER_ALT M exec thunderbird
SUPER_ALT W exec firefox
SUPER_ALT B exec pypr toggle bluetooth
SUPER_CONTROL Q exit
SUPER_CONTROL R exec hyprctl reload && forcerendererreload
SUPER_CONTROL ADIAERESIS exec poweroff
SUPER_CONTROL ODIAERESIS exec poweroff --reboot
SUPER UDIAERESIS exec systemctl suspend
SUPER DELETE exec hyprctl kill
SUPER X killactive
SUPER P pseudo
SUPER S togglesplit
SUPER H swapnext
SUPER_SHIFT H swapnext prev
SUPER F fullscreen
SUPER A fullscreen 1
SUPER V togglefloating
SUPER B pin
SUPER left movefocus l
SUPER right movefocus r
SUPER up movefocus u
SUPER down movefocus d
SUPER Tab cyclenext
SUPER_SHIFT left movewindow l
SUPER_SHIFT right movewindow r
SUPER_SHIFT up movewindow u
SUPER_SHIFT down movewindow d
SUPER_SHIFT Tab swapnext
SUPER_ALT left resizeactive -100 0
SUPER_ALT right resizeactive 100 0
SUPER_ALT up resizeactive 0 -100
SUPER_ALT down resizeactive 0 100
SUPER 1 workspace 1
SUPER 2 workspace 2
SUPER 3 workspace 3
SUPER 4 workspace 4
SUPER 5 workspace 5
SUPER 6 workspace 6
SUPER 7 workspace 7
SUPER 8 workspace 8
SUPER 9 workspace 9
SUPER 0 workspace 10
SUPER D workspace name:D
SUPER code:87 workspace 1
SUPER code:88 workspace 2
SUPER code:89 workspace 3
SUPER code:83 workspace 4
SUPER code:84 workspace 5
SUPER code:85 workspace 6
SUPER code:79 workspace 7
SUPER code:80 workspace 8
SUPER code:81 workspace 9
SUPER code:91 workspace 10
SUPER code:86 workspace +1
SUPER code:82 workspace -1
SUPER backspace workspace previous
SUPER mouse_down workspace -1
SUPER mouse_up workspace +1
SUPER_SHIFT 1 movetoworkspacesilent 1
SUPER_SHIFT 2 movetoworkspacesilent 2
SUPER_SHIFT 3 movetoworkspacesilent 3
SUPER_SHIFT 4 movetoworkspacesilent 4
SUPER_SHIFT 5 movetoworkspacesilent 5
SUPER_SHIFT 6 movetoworkspacesilent 6
SUPER_SHIFT 7 movetoworkspacesilent 7
SUPER_SHIFT 8 movetoworkspacesilent 8
SUPER_SHIFT 9 movetoworkspacesilent 9
SUPER_SHIFT 0 movetoworkspacesilent 10
SUPER_SHIFT code:87 movetoworkspacesilent 1
SUPER_SHIFT code:88 movetoworkspacesilent 2
SUPER_SHIFT code:89 movetoworkspacesilent 3
SUPER_SHIFT code:83 movetoworkspacesilent 4
SUPER_SHIFT code:84 movetoworkspacesilent 5
SUPER_SHIFT code:85 movetoworkspacesilent 6
SUPER_SHIFT code:79 movetoworkspacesilent 7
SUPER_SHIFT code:80 movetoworkspacesilent 8
SUPER_SHIFT code:81 movetoworkspacesilent 9
SUPER_SHIFT code:91 movetoworkspacesilent 10
SUPER_SHIFT code:86 movetoworkspacesilent +1
SUPER_SHIFT code:82 movetoworkspacesilent -1
SUPER_CTRL left movecurrentworkspacetomonitor l
SUPER_CTRL right movecurrentworkspacetomonitor r
SUPER_CTRL up movecurrentworkspacetomonitor u
SUPER_CTRL down movecurrentworkspacetomonitor d
PRINT exec grimblast copysave output /home/david/Pictures/$(date +'%F-%T_%N.png')
SUPER PRINT exec grimblast --notify --freeze copysave area /home/david/Pictures/$(date +'%F-%T_%N.png')
ALT PRINT exec satty --filename - --fullscreen --output-filename /home/david/Pictures/$(date +'%F-%T_%N.png')
SUPER_ALT PRINT exec satty --filename - --output-filename /home/david/Pictures/$(date +'%F-%T_%N.png')
SUPER_ALT U exec gnome-characters
SUPER_ALT K exec wl-copy
XF86Calculator exec gnome-calculator
SUPER_ALT V exec wl-copy'
SUPER L exec hyprlock
SUPER_ALT A exec pypr toggle pavucontrol
XF86AudioPlay exec playerctl play-pause
XF86AudioPause exec playerctl play-pause
XF86AudioStop exec playerctl stop
XF86AudioNext exec playerctl next
XF86AudioPrev exec playerctl previous
CTRL XF86AudioRaiseVolume exec playerctl position 1+
CTRL XF86AudioLowerVolume exec playerctl position 1-
ALT XF86AudioNext exec playerctld shift
ALT XF86AudioPrev exec playerctld unshift
ALT XF86AudioPlay exec systemctl --user restart playerctld
SUPER O invertactivewindow
SUPER acute hyprexpo:expo toggle
SUPER E exec pypr expose
SUPER Z exec pypr zoom
SUPER minus exec pypr zoom --0.5
SUPER plus exec pypr zoom ++0.5
SUPER_ALT mouse_down exec pypr zoom ++0.5
SUPER_ALT mouse_up exec pypr zoom --0.5
SUPER_ALT mouse:274 exec pypr zoom
SUPER ODIAERESIS exec pypr toggle_dpms
SUPER Y exec pypr toggle_special minimized
SUPER_SHIFT Y togglespecialworkspace minimized
XF86AudioMute exec swayosd-client --output-volume mute-toggle
ALT XF86AudioMute exec swayosd-client --input-volume mute-toggle
XF86AudioMicMute exec swayosd-client --input-volume mute-toggle
Caps_Lock exec swayosd-client --caps-lock
SUPER W exec killall -SIGUSR1 .waybar-wrapped
SUPER_ALT PERIOD exec 1password
SUPER_ALT P exec pypr toggle btop
SUPER_ALT E exec micro
SUPER_ALT F exec nautilus
SUPER SPACE exec fuzzel
SUPER_ALT Z exec xdg-open https://localhost:8384
SUPER RETURN exec kitty
SUPER_ALT T exec pypr toggle kitty
SUPER_ALT N exec pypr toggle networkmanager
XF86KbdBrightnessUp exec light -s sysfs/leds/kbd_backlight -A 10
XF86KbdBrightnessDown exec light -s sysfs/leds/kbd_backlight -U 10
XF86AudioRaiseVolume execr swayosd-client --output-volume raise
XF86AudioLowerVolume execr swayosd-client --output-volume lower
ALT XF86AudioRaiseVolume exec swayosd-client --input-volume raise
ALT XF86AudioLowerVolume exec swayosd-client --input-volume lower
XF86MonBrightnessUp exec swayosd-client --brightness raise
XF86MonBrightnessDown exec swayosd-client --brightness lower
SUPER mouse:272 movewindow
SUPER mouse:273 resizewindow

NixOS stable branch

To use nixpkgs stable branch, update the following inputs to the latest release (23.11 as an example) in flake.nix and rebuild the system.
ATTENTION! When the last release of nixpkgs is some time away, then you will likely need to refactor some changed options. So directly after a new release should be the best time to switch.

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
    unstable.url = "github:nixos/nixpkgs/nixos-unstable";
    home-manager = { url = "github:nix-community/home-manager/release-23.11"; inputs.nixpkgs.follows = "nixpkgs"; };
    stylix.url = "github:danth/stylix/release-23.11";
  };
}

To still let specific packages follow nixpkgs unstable while on the stable branch you can add a overlays/unstable/default.nix:

{ channels, ... }:

final: prev:
with channels.unstable; {
  # packages to get from inputs.unstable
  inherit
    gamescope
    lutris
    vscodium
    ;
}

Structure

I use snowfall-lib, so every default.nix is automatically imported.

My systems and homes are assembled using custom modules. Any custom module has at least one enable option which name matches the folder: config.dafitt.<myModule>.enable. Keep in mind some modules are enabled by default some are not. Special modules:

  • Desktops
    • desktops/gnome
    • desktops/hyprland
  • Suites (disabled by default)
    • Development
    • Editing
    • Gaming
    • Music
    • Office
    • Ricing
    • Social
    • Virtualization
    • Web
  • Firmly integrated, non-disableable
    • stylix (because of extensive usage of config.lib.stylix.colors)

Modules in modules/nixos/ are built with the standard nixos-rebuild command; modules/home/ with home-manager (standalone) or in addition to nixos-rebuild if the homes-hostname "<user>[@<host>]" matches with the host your building on (this is done by snowfall-lib with the systemd-service home-manager-<user>.service).

Some modules/home/ are automatically activated, if the sister module in modules/nixos/ is enabled. E.g. options.dafitt.Gaming.enableSuite = mkBoolOpt (osConfig.dafitt.Gaming.enableSuite or false) ".... The special attribute set osConfig is only present when building with nixos-rebuild.

To keep things simple I put hardware/system dependent configurations directly into systems/ themselves.

You want to build from here?

What you have to customize:

Optionally:

Troubleshooting

Some options in modules/home/ or homes/ are not being applied with nixos-rebuild

Check if your option is being set through osCfg. Like this:

enable = mkBoolOpt (osCfg.enable or config.dafitt.Gaming.enableSuite) "Enable steam.";

If that is the case and osCfg.enable is not null then the osCfg-option will be preferred. Even if it is false.

To solve this set your option to true in modules/nixos/ or systems/.

πŸ‘€, πŸ† and ❀️

About

My NixOS desktop

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages