Nix Flakes configuration for MacOS, NixOS and WSL
at main 126 lines 5.7 kB view raw view rendered
1<div align="center"> 2 <h1> asgard </h1> 3</div> 4 5> [!IMPORTANT] 6> This configuration is under constant construction so some things may be remove or add accordings to my needs but i want to keep all even if it's not used anymore. 7> 8> Since this configuration is made for my own needs, you can take inspiration and some configuration but do not expect it to work on your side. 9> 10> Any damage caused by this configuration is not my responsibility, so use it at your own risks. 11 12## Table of Contents 13 14- [Features & Capabilities](#features--capabilities) 15- [Machines](#machines) 16- [Installation](#installation) 17- [Folder Structure](#folder-structure) 18- [Commands](#commands) 19- [Documentations](#documentations) 20- [Troubleshooting](#troubleshooting) 21 22## Features & Capabilities 23 24This repository want this to be multi-user and multi-host so there is some workaround to make things work like i want and keep it simple. 25 26- [x] NixOS 27- [x] Nix Darwin 28- [ ] WSL (not used anymore) 29- [ ] Nix BSD (in wait of a stable state to be used anywhere else than a vm) 30- [ ] MicroVM for servers (astro/microvm) 31- [ ] Secrets management (agenix) 32- [ ] Secure Boot (lanzaboot) 33- [ ] Persistant storage (impermanence) 34- [ ] Disk configuration (disko) 35- [ ] Encrypted disks (?) 36- [ ] Home management (hjem) 37- [-] Automatic updates (*cannot be entirely done, since tangled does not support pipeline based on time.*) 38- Network topology (nix-topology) 39 40## Installation 41 42> TODO: write the documentation to install easely a new host with a few steps 43 44## Machines 45 46| Hostname | Motherboard | CPU | GPU | RAM | OS | Usage | Status | 47| :------------- | :-------------------------------- | :------------------- | :------------ | :--: | :-: | :------: | :----: | 48| `andhrimnir` | Aorus B450 Elite | AMD Ryzen 3 3300X | Nvidia 1060 | 16Go | ❄️ | 🖥️ - 🎮️ | 🟢️ | 49| `elli` | HP ProDesk 400 G1 DM | Intel Pentium G3250T | - | 8Go | ❄️ | 💾️ | 🟠 | 50| `loki` | ASUS ROG STRIX B760-I GAMING WIFI | Intel i5 13600kf | Nvidia 4070ti | 32Go | ❄️ | 🎮️ | 🟢️ | 51| `nanna` | Lenovo Legion Y530 15ICH | Intel i5 | Nvidia 1050ti | 16Go | ❄️ | 🖥️ - 🎮️ | 🟢️ | 52| `njord` | - | Apple M2 Pro | Apple M2 Pro | 32Go | 🍎️ | 🖥️ | 🟢️ | 53| `sunna` | ASUS ROG STRIX G15 | Intel i7 10870H | Nvidia 2060 | 16Go | ❄️ | 🖥️ | 🔴 | 54| `syn` | Raspberry Pi3 b+ | - | - | 1Go | ❄️ | 💾️ | 🔴 | 55| `vali` | WSL | - | - | - | ❄️ | 💾️ | 🔴 | 56 57<details> 58 <summary>Annotations</summary> 59 60 - 🎮️ : Gamingstation 61 - 💾️ : Server 62 - ☁️ : Virtual Machime 63 - 🖥️ : Workstation 64 - 🧨️ : Testing purpose 65 - ❄️ : NixOS 66 - 🍎️ : MacOS 67 - 👹️ : FreeBSD with [NixBSD](https://github.com/nixos-bsd/nixbsd) 68</details> 69 70## Folder structure 71 72This repository use a `dentritic pattern` to make everything work with ease. With this pattern, every file is a modules (modules, configurations, ...), so everything needs to be inside the modules folders and imported as it. 73 74The only things not treated as it are the custom packages inside the packages folder. 75 76> [!NOTE] 77> This is my current idea of what will look the folders, it can change in the future. 78 79``` 80. 81├── modules/ 82│ ├── features/ # Feature definitions 83│ ├── hjem/ # Hjem modules (not using flake-parts modules) 84│ ├── hosts/ # machines configurations 85│ ├── lib/ # Custom library (mostly factories) 86│ ├── packages/ # Custom packages derivations (per-system) 87│ ├── tools/ # Basic tools configurations (flake-parts, hjem, impermanence, ...) 88│ ├── users/ # Users configurations 89│ └── default.nix # Modules entrypoint with auto-import 90├── secrets/ # Secrets files used by agenix 91│ └── secrets.nix # Secrets entrypoint 92├── flake.nix # Configuration entrypoint 93└── justfile # Command helper 94``` 95 96## Commands 97 98You can get all recipes using the `just` command and running one of the available commands below with `just <command> <arguments*>`: 99 100```sh 101Available recipes: 102 boot hostname=hostname # Build a new configuration 103 clean # Cleanup all unused packages and generations 104 format # Format code 105 size # Print size of the nix store 106 switch hostname=hostname # Rebuild the system 107 update # Update dependencies 108``` 109 110## Documentations 111 112These are the things that help me the most to understand Nix ecosystem and help me build my configuration from scratch. 113 114You can retrieve dotfiles that inspired me inside my [`dotfiles` star list](https://github.com/stars/Cosmeak/lists/useful-dotfiles). 115 116- [Flakes book](https://nixos-and-flakes.thiscute.world/) 117- [Nix Language](https://nix.dev/) 118- [Nix Tour](https://nixcloud.io/tour/?id=introduction/nix) 119- [Dentritic Pattern explanation](https://github.com/Doc-Steve/dendritic-design-with-flake-parts) 120 121## Troubleshooting 122 123- If the rebuild command failed because an experimental feature is disabled use this command: 124```sh 125sudo -E NIX_CONFIG="experimental-features = nix-command flakes pipe-operators" nixos-rebuild switch --flake . 126```