This is my (tejing's) personal NixOS configuration flake.
It isn't really intended for actual use by others, but examining the code may be interesting. Even so, it should build even without the keys to git-crypt unlock it, since I use self.lib.readSecret/self.lib.importSecret to access the encrypted files, and provide a non-secret default value for the case where they aren't unlocked.
The information below is outdated. I am in the process of a major restructure of the repository using flake-parts. Once the new form and abstractions stabilize, I will update the README to document them.
- My nixos config is split into many profiles which can be found under
nixosConfigurations/tejingdesk/. - My home-manager config is split into many profiles which can be found under
homeConfigurations/tejing/.
File layout generally follows the flake output structure through the use of various forms of self.lib.importAll, which imports every .nix file and every directory with a default.nix, to form an attrset.
I've tried to expose components that may be useful on their own as flake outputs, accessing them through self in my main configuration.
- I use
my.*options, which are also re-supplied through themymodule argument, in both home-manager and nixos. This hierarchy contains components fromself, and configuration options for any locally defined modules.my.libcontains the output ofself.libFunc, applied to whatever nixpkgs instance is appropriate, orself.libif there is no appropriate nixpkgs instance available.my.pkgscontains the output ofself.packagesFunc, applied to whatever nixpkgs instance is appropriate.my.overlaysisself.overlays
- I expose my packages through the
self.packagesFuncoutput, which I then use to createself.packages.*.self.packagesFuncaccepts a nixpkgs instantiation (apkgsvalue) as an input, and uses it to generate the output packages. This way, I can expose these packages as external outputs, but also incorporate them into my nixos config and have overlays and unfree options and such apply. Not to mention my config evaluates faster if I don't have to instantiate nixpkgs multiple times. - I incorporate system-specific, but non-package, values into my personal
lib, rather than throwing them in with my packages, as nixpkgs does. This, however, means there are multiple versions of mylib. Non-system-specificlibcomponents are defined inlib/and make it intoself.lib. System-specificlibcomponents are defined inlibFunc/and can only be accessed whenlibhas been instantiated with a specific nixpkgs instance, such as inself.libFor.${system}. - I expose my flake inputs as
self.inputs, which can be useful for getting at things withnix eval.
self.packages.*.hredpackages hred through node2nix. It's the best tool I know to grab meaningful datastructures from html. Pipe the output into jq and you have a very versatile web scraping tool. I don't think there's anything better short of a headless browser.self.overlays.editline-urxvt-home-end-fixpatches editline to recognize thehomeandendkeys correctly inurxvt, makingnix replmuch easier to work with in that terminal emulator. The patch has been accepted upstream, but has not yet made it into a release.self.overlays.steam-fix-screensavergets around a longtime bug in the steam client which causes it to prevent screesaver activation as long as the steam client is running at all, even just in the system tray. It does this byLD_PRELOADing a special library that stubs the sdl call being used to accomplish it. Note that this overlay won't work for everyone out of the box, because it needs to know which$PLATFORMvalues to build for. These can be specified easily by altering an attrset in the overlay code. See the comment there for more information.self.packages.*.starsectorpackages starsector throughbuildFHSUserEnv. I tried making it work through patchelf as well as by using a nixpkgs-built JVM, but both failed. It's ugly, but it works. It also redirects all relevant saved state to${STARSECTOR_CONFIG_DIR:-$HOME/.config/starsector}.self.homeModules.sfeedis a module to generate a fairly complex~/.sfeed/sfeedrcfrom structured data, and automate running ofsfeed_update. It allows overrides ofsfeed_update's functions to be specified together with the feed, and applied by case-match on the feed name at runtime. It also uses resholve to sanity check and avoid PATH dependence in the producedsfeedrc.