| .. | ||
| workflows | ||
| README.md | ||
| swarselsystems_preview.png | ||
Disclaimer
You probably do not want to use this setup verbatim. This is made to fit my specific use cases, and I do not guarantee best practises everywhere. Changes are made on a daily basis.
That being said, there is a lot of general configuration that you probably can use without changes; if you only want to use this repository as a starting point for your own configuration, you should be fine. See below for more information. Also, if you see something that can be done more efficiently or better in general, please let me know! :)
~SwarselSystems~
| Shell: | zsh |
| DM: | greetd |
| WM: | SwayFX |
| Bar: | Waybar |
| Editor: | Emacs |
| Terminal: | kitty |
| Launcher: | fuzzel |
| Alerts: | mako |
| Browser: | firefox |
| Theme: | city-lights (managed by stylix) |
Overview
- Literate configuration for Nix and Emacs (SwarselSystems.org)
- Configuration based on flakes for personal hosts as well as servers on:
- NixOS)
- home-manager only (no full NixOS) with support from nixGL
- nix-darwin
- nix-on-droid
- Streamlined configuration and deployment pipeline:
- Framework for packages, overlays, and modules
- Dynamically generated host configurations
- Limited local installer (no secrets handling) with a supported demo build
- Fully autonomous remote deployment using nixos-anywhere and disko (with secrets handling)
- Improved nix tooling
- Support for advanced features:
- Secrets handling using sops-nix (pls no pwn ❤️)
- Management of non-file-based secrets using private repo
- Full Yubikey support
- LUKS-encryption
- Secure boot using lanzaboote
- BTRFS-based Impermanence
Documentation
If you are mainly interested in how I configured this system, check out this page:
SwarselSystems literate configuration
This file will take you through my design process, in varying amounts of detail.
Otherwise, the files that are possibly of biggest interest are found here:
Getting started
Demo configuration
If you just want to see if this configuration is for you, run this command on any system that has nix installed:
nix run --experimental-features 'nix-command flakes' github:Swarsel/.dotfiles#rebuild -- -u <YOUR_USERNAME>
This will activate the chaostheatre configuration on your system, which is a de-facto mirror of my main configuration with secret-based settings removed.
Please keep in mind that this limited installer will make local changes to the cloned repository in order to be able to install it (otherwise the builder would fail at fetching my private secrets repository). As such, this should only be used to evaluate the system - if you want to use it longterm, you will need to create a fork and make some changes.
Deployment
The deployment process for this configuration is mostly automated, there are only a few steps that are needed to be done manually. You can choose between a remote deployment strategy that is also able to deploy new age keys for sops for you and a local installer that will only install the system without any secret handling.
Remote deployment (recommended if you have at least one running system)
- Fork this repo, and write your own host config at
hosts/nixos/<YOUR_CONFIG_NAME>/default.nix(you can use one of the other configurations as a template. Also see https://github.com/Swarsel/.dotfiles/tree/main/modules for a list of all additional options). At the very least, you should replace thesecrets/directory with your own secrets and replace the SSH public keys with your own ones. I personally recommend to use the literate configuration andorg-babel-tangle-filein Emacs, but you can also simply edit the separate.nixfiles. - Have a system with
nixavailable booted (this does not need to be installed, i.e. you can use a NixOS installer image; a custom minimal installer ISO can be built by runningjust isoin the root of this repo) - Make sure that your Yubikey is plugged in or that you have your SSH key available (and configured)
- Run
bootstrap -n <CONFIGURATION_NAME> -d <TARGET_IP>
nix run --experimental-features 'nix-command flakes' github:Swarsel/.dotfiles#install -- -n <CONFIGURATION_NAME> -d <TARGET_IP>
Alternatively (if you run this on a system that is not yet running this configuration), you can also run nix run --experimental-features 'nix-command flakes' github:Swarsel/.dotfiles -- -n <CONFIGURATION_NAME> -d <TARGET_IP> (this runs the same program as the command above).
4) Follow the installers instructions:
- you will have to choose a disk encryption password (if you want that feature)
- you will have to confirm once that the target system has rebooted
- you will have to enter the root password once during the final system install
- That should be it! The installer will take care of setting up disks, secrets, and the rest of the hardware configuration! You will still have to sign in manually to some webservices etc.
Local deployment (recommended for setting up the first system)
- Boot the latest install ISO from this repository on an UEFI system.
- Run
swarsel-install -d <TARGET_DISK> -f <FLAKE> - Reboot
Alternatively, to install this from any NixOS live ISO, run nix run --experimental-features 'nix-command flakes' github:Swarsel/.dotfiles#install -- -d <TARGET_DISK> -f <FLAKE> at step 2.
General Nix tips 8 useful links
Below is a small list of tips that should be helpful no matter if you are new to the nix ecosystem:
- Once you have the experimental feature
nix-commandenabled, you can temporarily install any package usingnix shell nixpkgs#<PACKAGE_NAME>- this can be e.g. useful if you accidentally removed home-manager from your packages on a non-NixOS machine.- The
nix [...]commands are generally very useful, more info can be found here: https://nixos.org/manual/nix/stable/command-ref/new-cli/nix
- The
- These links are your best friends:
- Flake output reference: https://nixos-and-flakes.thiscute.world/other-usage-of-flakes/outputs
- or more general, the NixOS & Flakes Book
- Also useful is the NixOS wiki, but some pages are outdated, so use with some care
- You can find public repositories with modules at https://nur.nix-community.org/ (you should check what you are installing however):
- I like to use this for rycee's firefox extensions: https://nur.nix-community.org/repos/rycee/
- When you are trying to setup a new configuration part, GitHub code search can really help you to find a working configuration.
- getting packages at a different version than your target (or not packaged at all) can be done in most cases easily with fetchFromGithub (https://ryantm.github.io/nixpkgs/builders/fetchers/)
- you can easily install old revisions of packages using https://lazamar.co.uk/nix-versions/. You can conveniently spawn a shell with a chosen package available using
vershell <NIXPKGS_REVISION> <PACKAGE>. Just make sure to pick a revision that has flakes enabled, otherwise you will need the legacy way of spawning the shell (see the link for more info) - List of nerdfonts: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/data/fonts/nerd-fonts/manifests/fonts.json
- List of pre-commit-hooks: https://devenv.sh/reference/options/#pre-commithooks
- Stylix configuration options: https://danth.github.io/stylix/
- Waybar configuration: https://github.com/Alexays/Waybar/wiki
Attributions, Acknowledgements, Inspirations, etc.
These are in random order (also known as 'the order in which I discovered them'). I would like to express my gratitude to:
- All the great people who have contributed code for the nix-community, with special mentions for (this list is unfairly incomplete):
- All the people who have inspired me with their configurations (sadly also highly incomplete):
- theSuess with their home-manager
- hlissner with their dotfiles
- drduh with their YubiKey-Guide
- AntonHakansson with their nixos-config
- Guekka with their blog
- NotAShelf with their nyx
- Misterio77 with their nix-config
- 0xdade with their blog
- EmergentMind with their nix-config
- librephoenix with their nixos-config
If you feel that I forgot to pay you tribute for code that I used in this repository, please shoot me a message and I will fix it :)