These are my dotfiles (configuration files) for my NixOS setup(s).
Stylix (and base16.nix, of course) is amazing, allowing you to theme your entire system with base16-themes.
Using this I have a lot of themes (I add more sometimes) I can switch between on-the-fly. Visit the themes directory for more info and screenshots!
Separate Nix files can be imported as modules using an import block:
imports = [ ./import1.nix
./import2.nix
...
];
This conveniently allows configurations to be (*cough cough) modular (ba dum, tssss).
I have my modules separated into three subdirectories:
- System-level - stored in the system directory
- User-level - stored in the user directory
More detailed information on these specific modules are in the system directory and user directory respectively.
I wrote some reinstall notes for myself here (install.org).
Check them out if you’d like to try out my config in a VM or base your config on mine.
In some cases, since I use nixpgs-unstable
, I must patch nixpkgs. This can be done inside of a flake via:
nixpkgs-patched = (import nixpkgs { inherit system; }).applyPatches {
name = "nixpkgs-patched";
src = nixpkgs;
patches = [
./example-patch.nix
(builtins.fetchurl {
url = "https://asdf1234.patch";
sha256 = "sha256:qwerty123456...";
})
];
};
# configure pkgs
pkgs = import nixpkgs-patched { inherit system; };
# configure lib
lib = nixpkgs.lib;
Patches can either be local or remote, so you can even import unmerged pull requests by using fetchpatch
and the raw patch url, i.e: https://github.com/NixOS/nixpkgs/pull/example.patch.
I currently curate patches local to this repo in the patches directory.
Configurations for all my machines are in hosts.
Some Nix commands are confusing, really long to type out, or require me to be in the directory with my dotfiles. To solve this, I wrote a wrapper script called phoenix, which calls various scripts in the root of this directory.
TLDR:
phoenix sync
- Synchronize system state with configphoenix build
- Build all host configurations and push results to attic (requires attic config to be setup)phoenix update
- Update all flake inputs without synchronizing system and home-manager statesphoenix update INPUT
- Update only the specifiedINPUT
(see inputs in flake.nix)
phoenix refresh
- Call synchronization posthooks (mainly to refresh stylix and some dependent daemons)phoenix pull
- Pull changes from upstream git and attempt to merge local changes (I use this to update systems other than my main system)phoenix lock
- Ensure that all “system-level” files cannot be edited by an unprivileged userphoenix unlock
- Relax permissions so all dotfiles can be edited by a normal user (use temporarily for git or other operations)phoenix gc
- Garbage collect the system and user nix storesphoenix gc full
- Delete everything not currently in usephoenix gc 15d
- Delete everything older than 15 daysphoenix gc 30d
- Delete everything older than 30 daysphoenix gc Xd
- Delete everything older than X days
Didn’t think this would get that many stars on GitHub, yet here we are: