Kieran's opinionated (and probably slightly dumb) nix config
1# Kieran's Dots 2 3![nix rebuild with flake update](.github/images/nix-update.webp) 4 5> [!CAUTION] 6> These dots are highly prone to change / breakage. 7> 8> ~I am not a nix os expert (this is my first time touching nix), so I'm not sure if this will work or not. I'm just trying to get my dots up on github.~ 9> 10> After `284` successful days of these dots being in constant operation, many many rebuilds, and `364` commits these dots have been rock solid and I have no complaints. 11 12## The layout 13 14```bash 15~/dots # symlinked to /etc/nixos 16├── dots # any config files that need to be symlinked go here, e.g. my hyprland config 17│ └── wallpapers 18├── machines 19│ ├── atalanta # my macOS M4 machine 20│ ├── ember # my dell r210 server (in my basement) 21│ ├── moonlark # my framework 13 <dead> 22│ ├── nest # shared tilde server through hc 23│ ├── prattle # oracle cloud x86_64 server 24│ ├── tacyon # rpi 5 25│ └── terebithia # oracle cloud aarch64 server 26├── modules 27│ ├── home # home-manager modules 28│ │ ├── aesthetics # theming and wallpapers 29│ │ ├── apps # any app specific config 30│ │ │ └── crush # vendored for now 31│ │ ├── system # home-manager system configs 32│ │ └── wm # window managers; just hyprland for now 33│ │ └── hyprland 34│ └── nixos # nixos modules 35│ ├── apps # also app specific configs 36│ └── system # pam and my fancy wifi module for now 37└── secrets # keep your grubby hands (or paws) off my data 38 3916 directories 40``` 41 42## Installation 43 44> [!WARNING] 45> Also to note that this configuration will **not** work if you do not change any of the [secrets](./secrets) since they are encrypted. 46 47You could either install a NixOS machine (rn there is just `moonlark`), use the home-manager instructions, or use nix-darwin for macOS. 48 49### macOS with nix-darwin 50 51For macOS machines, you can use nix-darwin: 52 531. Install Nix using the determinate systems installer: 54 55```bash 56curl -fsSL https://install.determinate.systems/nix | sh -s -- install 57``` 58 592. Clone the repository: 60 61```bash 62git clone git@github.com:taciturnaxolotl/dots.git 63cd dots 64``` 65 663. Apply the configuration: 67 68```bash 69darwin-rebuild switch --flake .#atalanta 70``` 71 72### Home Manager 73 74Install nix via the determinate systems installer 75 76```bash 77curl -fsSL https://install.determinate.systems/nix | sh -s -- install --determinate 78``` 79 80then copy ssh keys and chmod them 81 82```bash 83scp .ssh/id_rsa* nest:/home/kierank/.ssh/ 84ssh nest chmod 600 ~/.ssh/id_rsa* 85``` 86 87and then clone the repo 88 89```bash 90git clone git@github.com:taciturnaxolotl/dots.git 91cd dots 92``` 93 94and execute the machine profile 95 96```bash 97nix-shell -p home-manager 98home-manager switch --flake .#nest 99``` 100 101setup atuin and import previous shell history 102 103```bash 104atuin login 105atuin import 106``` 107 108### NixOS 109 110> These instructions have been validated by installing on my friend's machine ([`Nat2-Dev/dots`](https://github.com/Nat2-Dev/dots)) 111 112#### Using nixos-anywhere (Recommended for remote installations) 113 114> [!INFO] 115> This only currently works with `prattle` and `terebithia` as they have the proper disko configs setup. 116 117For remote installations (like Oracle Cloud), use [nixos-anywhere](https://github.com/nix-community/nixos-anywhere): 118 119```bash 120nix run github:nix-community/nixos-anywhere -- \ 121 --flake .#prattle \ 122 --generate-hardware-config nixos-facter ./machines/prattle/facter.json \ 123 --build-on-remote \ 124 root@<ip-address> 125``` 126 127Replace `prattle` with your machine configuration and `<ip-address>` with your target machine's IP. 128 129> **Note**: Make sure your SSH key is in the target machine's `authorized_keys` and the machine configuration has the correct network settings. The `--generate-hardware-config nixos-facter` flag will generate a comprehensive hardware report using [nixos-facter](https://github.com/numtide/nixos-facter) instead of the traditional `nixos-generate-config`. 130 131#### Using the install script 132 133```bash 134curl -L https://raw.githubusercontent.com/taciturnaxolotl/dots/main/install.sh -o install.sh 135chmod +x install.sh 136./install.sh 137``` 138 139#### The manual way 140 141Install NixOS via the [official guide](https://nixos.org/download.html) 142 143Connect to wifi 144 145```bash 146wpa_passphrase your-ESSID your-passphrase | sudo tee /etc/wpa_supplicant.conf 147sudo systemctl restart wpa_supplicant 148``` 149 150Check with `ping 1.1.1.1` if that doesn't work then use `wpa_cli` 151 152```bash 153sudo systemctl start wpa_supplicant 154wpa_cli 155 156add_network 0 157 158set_network 0 ssid "put your ssid here" 159 160set_network 0 psk "put your password here" 161 162enable network 0 163 164exit 165``` 166 167Aquire root permissions while keeping your current context with 168 169```bash 170sudo -i 171``` 172 173Enable git and rebuild your flake with the following 174 175```bash 176sed -i 's/^{$/{\n programs.git.enable = true;/' /etc/nixos/configuration.nix 177nixos-rebuild switch 178``` 179 180Download the disk configuration and run it 181 182```bash 183curl -L https://github.com/taciturnaxolotl/dots/raw/main/moonlark/disk-config.nix -o /tmp/disk-config.nix 184nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode destroy,format,mount /tmp/disk-config.nix 185``` 186 187Run nixos generate config and cd into it 188 189```bash 190nixos-generate-config --root /mnt 191cd /mnt/etc/nixos 192``` 193 194Clone this repo to your `/mnt/etc/nixos` folder 195 196```bash 197rm * 198git clone https://github.com/taciturnaxolotl/dots.git . 199``` 200 201Add your ssh private key to `/mnt/etc/ssh/id_rsa` 202 203install the flake, and umount the filesystem, and then reboot 204 205```bash 206nixos-install --flake .#moonlark --no-root-passwd 207reboot 208``` 209 210Pray to the nix gods that it works 🙏 211 212If it worked then you should be able to login with the user `kierank` and the password `lolzthisaintsecure!` 213 214You should immediately change the password 215 216```bash 217passwd kierank 218``` 219 220Move the config to your local directory, link to `/etc/nixos`, and change permissions 221 222```bash 223sudo mv /etc/nixos ~/dots 224sudo ln -s ~/dots /etc/nixos 225sudo chown -R $(id -un):users ~/dots 226sudo chown kierank -R ~/dots 227sudo chown kierank -R ~/dots/.* 228``` 229 23017. Setup the fingerprint reader and verify it works (you may need to swipe your finger across the fingerprint sensor instead of simply laying it there) 231 232```bash 233sudo fprintd-enroll -f right-index-finger kierank 234sudo fprintd-verify kierank 235``` 236 237Finally enable [atuin](https://atuin.sh/) 238 239```bash 240atuin login 241atuin sync 242``` 243 244## some odd things 245 246for helix if you want the grammar to work you must run the following as per [this helix discussion](https://github.com/helix-editor/helix/discussions/10035#discussioncomment-13852637) 247 248```bash 249hx -g fetch 250hx -g build 251``` 252 253## Screenshots 254 255<details> 256 <summary>I've stuck the rest of the screenshots in a spoiler to preserve space</summary> 257<br/> 258 259**Last updated: 2024-12-27** 260 261![the github page of this repo](.github/images/github.webp) 262![nautilus file manager](.github/images/nautilus.webp) 263![neofetch](.github/images/neofetch.webp) 264![spotify with cava next to it](.github/images/spotify.webp) 265![zed with the hyprland config open](.github/images/zed.webp) 266![cool-retro-term with neofetch](.github/images/cool-retro-term.webp) 267 268</details> 269 270## Credits 271 272Thanks a bunch to the following people for their dots, configs, and general inspiration which i've shamelessly stolen from: 273 274- [NixOS/nixos-hardware](https://github.com/NixOS/nixos-hardware) 275- [hyprland-community/hyprnix](https://github.com/hyprland-community/hyprnix) 276- [spikespaz/dotfiles](https://github.com/spikespaz/dotfiles) 277- [Misterio77/nix-starter-configs](https://github.com/Misterio77/nix-starter-configs) 278- [mccd.space install guide](https://mccd.space/posts/git-to-deploy/) 279- [disco docs](https://github.com/nix-community/disko/blob/master/docs/quickstart.md) 280- [XDG_CONFIG_HOME setting](https://github.com/NixOS/nixpkgs/issues/224525) 281- [Daru-san/spicetify-nix](https://github.com/Daru-san/spicetify-nix) 282- [agenix](https://nixos.wiki/wiki/Agenix) 283- [wpa_supplicant env file docs](https://search.nixos.org/options?show=networking.wireless.environmentFile&from=0&size=50&sort=relevance&type=packages&query=networking.wireless) 284- [escaping nix variables](https://www.reddit.com/r/NixOS/comments/jmlohf/escaping_interpolation_in_bash_string/) 285- [nerd fonts cheat sheet](https://www.nerdfonts.com/cheat-sheet) 286- [setting the default shell in nix](https://www.reddit.com/r/NixOS/comments/z16mt8/cant_seem_to_set_default_shell_using_homemanager/) 287- [hyprwm/contrib](https://github.com/hyprwm/contrib) 288- [gtk with home manager](https://hoverbear.org/blog/declarative-gnome-configuration-in-nixos/) 289- [setting up the proper portals](https://github.com/NixOS/nixpkgs/issues/274554) 290- [tuigreet setup](https://github.com/sjcobb2022/nixos-config/blob/29077cee1fc82c5296908f0594e28276dacbe0b0/hosts/common/optional/greetd.nix) 291 292## 📜 License 293 294The code is licensed under `MIT`! That means MIT allows for free use, modification, and distribution of the software, requiring only that the original copyright notice and disclaimer are included in copies. All artwork and images are copyright reserved but may be used with proper attribution to the authors. 295 296<p align="center"> 297 <img src="https://raw.githubusercontent.com/taciturnaxolotl/carriage/master/.github/images/line-break.svg" /> 298</p> 299 300<p align="center"> 301 <i><code>&copy 2025-present <a href="https://github.com/taciturnaxolotl">Kieran Klukas</a></code></i> 302</p> 303 304<p align="center"> 305 <a href="https://github.com/taciturnaxolotl/dots/blob/master/LICENSE.md"><img src="https://img.shields.io/static/v1.svg?style=for-the-badge&label=License&message=MIT&logoColor=d9e0ee&colorA=363a4f&colorB=b7bdf8"/></a> 306</p>