Skip to content

mitchty/nix

Repository files navigation

Note if you are using anything here as a reference be aware I’m refactoring/rebuilding all of this gihugic hack using flake-parts etc…

Consider the primary branch as legacy and old and busted. Not all the new hotness is ready yet though while I rebuild this setup from the ground up to be a lot less sus based on my past few years of learning nix and flakes and finding out how I did things was.... less than optimal or plain up just “wrong”. Live and learn.

You’ve been warned!

My home network nix flake setup

So my goal with all this is to get as much into a NixOS layout for home. Now that Flakes are “kinda/sorta” out it seems the best time to convert everything over to flakes.

Nix resources

Because nix isn’t exactly a “common” thing to encounter as a programming language/package manager…

NixOS option search, for when you want to know what you can set. https://search.nixos.org/options https://nixos.org/manual/nix/stable/language/builtins.html?search=mkIf

Home-manager equivalent.

https://mipmip.github.io/home-manager-option-search/?query=

A nice cli that searches both is https://github.com/mlvzk/manix

Potent Notables

So what in here is worth looking at exactly? Well this is a combined NixOS and x86 Macos setup with home manager. That is, while its incomplete I manage both my macos laptop and any/all NixOS nodes from this shared flake repo.

There is also iso generation and autoinstall setup as well, for that reference this autoinstall module. As well as the generators in flake.nix (search for iso).

My current setup is basically build an iso that will autoinstall nixos onto a system then poweroff/reboot and from there I can pivot that install into this install via deploy-rs.

On the deploy-rs note, the flake file also has those.

Rough usage

So the flake has deploy targets setup already for deploy-rs, to update/rebuild all NixOS nodes run:

clear; nix flake check --show-trace && nix run github:serokell/deploy-rs -- -s .

Or use the wrapper function+script in lib.sh and rebuild script:

wtf rebuild

To run a deploy without running nix flake check:

CHECK=anyvalue wtf rebuild

And should be good to go. Caveats on how/where deploy-rs can deploy to aside. Aka that without builder setup cannot deploy to a macos system from linux. This is on my TODO list to fix at some point.

Layout

Since I’m trying to document things a bit more a bit of layout convention explanation:

  • bin Simply a directory for any pertinent scripts that use this repo. Note none of these scripts end up in /nix/store.
  • src Source for stuff in bin.
  • hosts Host specific data, e.g. mostly generated nix configuration files.
  • img Nixos specific directory where iso or disk image outputs get dumped.
  • modules General directory for any modules for nixos, nix-darwin, and home-manager. Should be intended to encompass “stuff with options”. Also includes the img autoinstall module used for iso builds.
  • patches Any patch files that may be needed for things like CVE’s that might not yet be upstream yet in nixpkgs or anywhere else.
  • secrets Any secret related data for age and/or git-transcrypt. Basically “private junk hiding in plain sight”.
  • static Bucket for any static files, which generally amounts to either fragments or full bits of files like say .profile that the rest of the flake will use.

Todo’s

Macos

Nice lists of open source stuff to poke at someday. https://github.com/serhii-londar/open-source-mac-os-apps https://github.com/jaywcjlove/awesome-mac

Macos Emacs

Try out more patches from here? https://tdodge.consulting/blog/living-the-emacs-garbage-collection-dream

https://github.com/tyler-dodge/emacs/commit/b386047f311af495963ad6a25ddda128acc1d461.patch

Some interesting org packages here. https://github.com/chrisbarrett/nursery

Some interesting macos integration ideas. https://xenodium.com/emacs-macos-sharing-dwim-style-improved/ https://github.com/xenodium/dwim-shell-command/commit/20e782b4bf1ea01fecfce3cc8ac4c5a74518cd80

Need to try out xwidget support and nov-xwidget on macos https://macowners.club/posts/using-xwidgets-on-macos/ and https://github.com/chenyanming/nov-xwidget

Also need to start abusing anki+org notes for cards https://yiufung.net/post/anki-org/

And explore this for org notes to auto get graphviz images into docs. https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-dot.html

Set this up? https://en.liujiacai.net/2022/11/26/oh-my-github-1-0/

Fonts

Add or try em?

https://input.djr.com/info/ https://www.fontget.com/font/among-us https://www.fontget.com/font/among-us-filled/ https://www.monolisa.dev/ https://github.com/intel/intel-one-mono https://www.fontbolt.com/font/barbie-2023-font/

Linode

Need to get vps using nix as well now that 22.11 has image build support.

https://github.com/Vanilla-s-Lab/linode-nix/tree/master

Pipewire

Refs:

Need to get pipewire tested again, probably via this to do things simple first to see if newer pipewire is less fiddly:

services.pipewire = {
  enable = true;
  alsa.enable = true;
  alsa.support32Bit = true;
  jack.enable = true;
  pulse.enable = true;
  socketActivation = true;
};
programs.dconf.enable = true;
services.gnome.at-spi2-core.enable = true;

Network booting?

Might be fun to look into for a pi4 k8s cluster or something.

https://github.com/DeterminateSystems/nix-netboot-serve

Random notes

Cause I forget and this is a readme so why not stick it here:

List generations

List out nixos generations as root:

nix-env --list-generations --profile /nix/var/nix/profiles/system

Rollback to prior generation

Switch/rollback to prior generation, also as root:

nixos-rebuild switch --rollback

Rolling back to a specific generation

Cause sometimes nixos-rebuild switch –rollback isn’t enough or you have multiple generations that are no good.

nix-env --switch-generation $GENERATION --profile /nix/var/nix/profiles/system
/nix/var/nix/profiles/system/bin/switch-to-configuration switch