- My daily driver's Snowfallπ¨οΈπ NixOSβοΈ desktop flake
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)π₯΄
This flake can and will radically change as I learn, discover new things and have new ideas.
- π₯ Multiple hosts
- π§ Standalone home
- βοΈποΈ Snowfall-lib structure
- βοΈ almost every module can be disabled
- βοΈπ² Snowfall-flake commands
- π¦ Declarative flatpaks
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 |
-
Install NixOS and enable the (experimental) nix feature flakes.
-
Dotfiles preparation: mandatory changes to my dotfiles
-
git clone https://github.com/dafitt/dotfiles.git
-
Read and understand my dotfiles' structure and code.
-
Add a your (new) system-configuration to
/systems/<architecture>/<host>/default.nix
(availabledafitt-nixos
options can be found at templates/system/default.nix) -
Copy and import
hardware-configuration.nix
! -
Set the correct
system.stateVersion
-
Add a new home-configuration to
homes/<architecture>/<user>[@<host>]/default.nix
(availabledafitt-home
options can be found at templates/home/default.nix) -
Commit all changes:
git add . && git commit -m "systems: added new host"
-
Uncomment
nixConfig
in flake.nix and enternix develop
on your first build for faster build time
-
-
Build
-
Enter
nix-shell
and thennix develop
-
sudo nixos-rebuild boot --flake .#<host>
-
Check for home-manager errors with
systemctl status home-manager-<user>.service
and resolve them if necessary
- NOTE: First install may take some time; especially with flatpaks enabled.
-
-
reboot
-
Personal imperative setup:
- Configure monitor setup with
nwg-displays
- Syncthing setup
- firefox: Sync Login
- NoScript
- 1Password
- Sidebery
- pavucontrol: Set standard audio output
- vscode: codeium plugin
- Configure monitor setup with
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
;
}
You can try using my modules through importing them:
# flake.nix
inputs = {
dafitt = { url = "github:dafitt/dotfiles"; inputs.nixpkgs.follows = "nixpkgs"; };
};
outputs = { nixpkgs, ... }@inputs: {
nixosConfigurations."<host>" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
# e.g.
inputs.dafitt.nixosModules."gnome"
inputs.dafitt.nixosModules."bootloader/systemd"
inputs.dafitt.homeManagerModules."stylix"
inputs.dafitt.homeManagerModules."browsers/firefox"
];
};
};
But it is certainly better to simply copy them into your dotfiles and adapt them to your needs.
What you have to customize:
- modules/nixos/time/default.nix: timezone
- modules/nixos/locale/default.nix: locale
- modules/home/browsers/firefox/default.nix:
- the default searx search engine is my own local instance/server, use a official one or setup your own
- custom firefox plugins
- systems/<architecure>/<host>/default.nix: your own host-configuration
-
hardware-configuration.nix
- maybe some host-specific
configuration.nix
: make sure to import it:imports = [ ./configuration.nix ];
-
- homes/<architecure>/<user>[@<host>]/default.nix: your own user with your home-configuration
Optionally:
- modules/home/desktops/hyprland/default.nix: familiar keybindings
- modules/home/stylix/default.nix: custom base16 theme / icon theme
- Packages and programs you need
Some basic flake commands
nix-shell shell.nix # only when on legacy-nix: enables flakes & git (works only locally)
nix develop github:dafitt/dotfiles#default
nix flake show github:dafitt/dotfiles
NixOS & Home-manager:
nixos-rebuild switch --flake .#<host>
Home-manager standalone:
home-manager switch --flake .#<user>@<host>
nix flake update --commit-lock-file
# specific input
nix flake lock --update-input [input]
NixOS: sudo nixos-rebuild switch --rollback
Home-manager standalone: see Home-manager documentation
nix fmt [./folder] [./file.nix]
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 table
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 |
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 |
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
.
Modules in modules/nixos/ are built with the standard nixos-rebuild
command.
Modules in modules/home/ are built with home-manager
(standalone) and 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
. snowfall-lib will create the user if it doesn't exist yet.
Some home-modules in my dotfiles are automatically activated, if the sister module in nixos-modules is enabled. See this line in modules/home/suiteGaming/default.nix for example:
options.dafitt.suiteGaming.enable = mkBoolOpt (osConfig.dafitt.suiteGaming.enable or false) "...
The special attribute set osConfig
which contains all the nixos-configuration is only present when building with nixos-rebuild
.
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.suiteGaming.enable) "Whether to 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/.
Manually reload the fontconfig cache using
fc-cache -r