This repository has been archived on 2024-07-08. You can view files and clone it, but cannot push or open issues or pull requests.
nix-config-tn/README.md

104 lines
3.6 KiB
Markdown
Raw Normal View History

2024-03-13 06:55:17 -05:00
# Truxnell's homelab
2024-03-25 04:05:18 -05:00
[![NixOS](https://img.shields.io/badge/NIXOS-5277C3.svg?style=for-the-badge&logo=NixOS&logoColor=white)](https://nixos.org)
2024-03-26 06:21:39 -05:00
[![NixOS](https://img.shields.io/badge/NixOS-23.11-blue?style=for-the-badge&logo=nixos&logoColor=white)](https://nixos.org)
[![MIT License](https://img.shields.io/github/license/truxnell/nix-config?style=for-the-badge)](https://github.com/truxnell/nix-config/blob/ci/LICENSE)
2024-04-07 00:00:14 -05:00
[![renovate](https://img.shields.io/badge/renovate-enabled-%231A1F6C?logo=renovatebot)](https://developer.mend.io/github/truxnell/nix-config)
2024-03-25 03:54:22 -05:00
[![built with garnix](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgarnix.io%2Fapi%2Fbadges%2Ftruxnell%2Fnix-config%3Fbranch%3Dmain)](https://garnix.io)
2024-04-07 00:00:14 -05:00
![Code Comprehension](https://img.shields.io/badge/Code%20comprehension-26%25-red)
2024-03-25 03:54:22 -05:00
Leveraging nix, nix-os and other funny magic man words to apply machine and home configurations
2024-03-13 06:55:17 -05:00
[Repository Documentation](https://truxnell.github.io/nix-config/)
2024-03-13 06:55:17 -05:00
## Background
Having used a variety of infracture as code solutions - and having found them lacking in some areas, it is time to give nix a go.
Frustrations with other methods tend to be bitrot and config drift - very annoying to want to do a quick disaster recovery and find your have different versions of modules/utilities, breaking changes in code you didnt catch, etc.
## Getting started
2024-03-15 04:11:01 -05:00
To Install
```
# nixos-rebuild switch --flake github:truxnell/nix-config#HOST
```
2024-03-13 06:55:17 -05:00
## Goals
- [ ] Learn nix
- [ ] Mostly reproduce features from my existing homelab
- [ ] Replace existing ubuntu-based 'NAS'
- [ ] Expand usage to other shell environments such as WSL, etc
- [ ] handle secrets - decide between sweet and simple SOPS or re-use my doppler setup.
2024-04-11 04:42:26 -05:00
- [ ] keep it simple, use trusted boring tools
2024-03-13 06:55:17 -05:00
## TODO
- [ ] Github Actions update fly.io instances (Bitwarden)
- [ ] Bring over hosts
2024-03-30 23:21:02 -05:00
- [x] DNS01 Raspi4
- [x] DNS02 Raspi4
- [x] NAS
2024-03-30 23:21:02 -05:00
- [x] Latop
2024-03-31 05:40:11 -05:00
- [x] Gaming desktop
2024-03-13 06:55:17 -05:00
- [ ] WSL
- [ ] JJY emulator Raspi4
- [x] Documentation!
- [x] ssh_config build from computers?
- [x] Modularise host to allow vm builds and hw builds
- [x] Add license
- [x] Add taskfiles
2024-04-11 04:42:26 -05:00
## Checklist
### Adding new node
- Ensure secrets are grabbed from note and all sops re-encrypte with task sops:re-encrypt
- Add to relevant github action workflows
- Add to .github/settings.yaml for PR checks
2024-03-13 06:55:17 -05:00
## Applying configuration changes on a local machine can be done as follows:
```sh
cd ~/dotfiles
sudo nixos-rebuild switch --flake .
# This will automatically pick the configuration name based on the hostname
```
Applying configuration changes to a remote machine can be done as follows:
```sh
cd ~/dotfiles
nixos-rebuild switch --flake .#nameOfMachine --target-host machineToSshInto --use-remote-sudo
```
2024-03-24 02:50:38 -05:00
## Hacking at nix files
Eval config to see what keys are being set.
```bash
nix eval .#nixosConfigurations.rickenbacker.config.security.sudo.WheelNeedsPassword
nix eval .#nixosConfigurations.rickenbacker.config.mySystem.security.wheelNeedsPassword
```
2024-03-31 05:40:11 -05:00
And browsing whats at a certain level in options.
```bash
nix eval .#nixosConfigurations.rickenbacker.config.home-manager.users.truxnell --apply builtins.attrNames --json
```
2024-03-24 02:50:38 -05:00
Quickly run a flake to see what the next error message is as you hack.
```bash
nixos-rebuild dry-run --flake . --fast --impure
```
2024-03-13 06:55:17 -05:00
## Links & References
- [Misterio77/nix-starter-config](https://github.com/Misterio77/nix-starter-configs)
- [billimek/dotfiles](https://github.com/billimek/dotfiles/)
- [Erase your Darlings](https://grahamc.com/blog/erase-your-darlings/)
- [NixOS Flakes](https://www.tweag.io/blog/2020-07-31-nixos-flakes/)