Nix Flakes configuration for MacOS, NixOS and WSL
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 39## Installation 40 41> TODO: write the documentation to install easely a new host with a few steps 42 43## Machines 44 45| Hostname | Motherboard | CPU | GPU | RAM | OS | Usage | Status | 46| :------------- | :-------------------------------- | :------------------- | :------------ | :--: | :-: | :------: | :----: | 47| `andhrimnir` | Aorus B450 Elite | AMD Ryzen 3 3300X | Nvidia 1060 | 16Go | ❄️ | 🖥️ - 🎮️ | 🟢️ | 48| `elli` | HP ProDesk 400 G1 DM | Intel Pentium G3250T | - | 8Go | ❄️ | 💾️ | 🟠 | 49| `loki` | ASUS ROG STRIX B760-I GAMING WIFI | Intel i5 13600kf | Nvidia 4070ti | 32Go | ❄️ | 🎮️ | 🟢️ | 50| `nanna` | Lenovo Legion Y530 15ICH | Intel i5 | Nvidia 1050ti | 16Go | ❄️ | 🖥️ - 🎮️ | 🟢️ | 51| `njord` | - | Apple M2 Pro | Apple M2 Pro | 32Go | 🍎️ | 🖥️ | 🟢️ | 52| `sunna` | ASUS ROG STRIX G15 | Intel i7 10870H | Nvidia 2060 | 16Go | ❄️ | 🖥️ | 🔴 | 53| `syn` | Raspberry Pi3 b+ | - | - | 1Go | ❄️ | 💾️ | 🔴 | 54| `vali` | WSL | - | - | - | ❄️ | 💾️ | 🔴 | 55 56<details> 57 <summary>Annotations</summary> 58 59 - 🎮️ : Gamingstation 60 - 💾️ : Server 61 - ☁️ : Virtual Machime 62 - 🖥️ : Workstation 63 - 🧨️ : Testing purpose 64 - ❄️ : NixOS 65 - 🍎️ : MacOS 66 - 👹️ : FreeBSD with [NixBSD](https://github.com/nixos-bsd/nixbsd) 67</details> 68 69## Folder structure 70 71This 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. 72 73The only things not treated as it are the custom packages inside the packages folder. 74 75> [!NOTE] 76> This is my current idea of what will look the folders, it can change in the future. 77 78``` 79. 80├── modules/ 81│ ├── features/ # Feature definitions 82│ ├── hjem/ # Hjem modules (not using flake-parts modules) 83│ ├── hosts/ # machines configurations 84│ ├── lib/ # Custom library (mostly factories) 85│ ├── packages/ # Custom packages derivations (per-system) 86│ ├── tools/ # Basic tools configurations (flake-parts, hjem, impermanence, ...) 87│ ├── users/ # Users configurations 88│ └── default.nix # Modules entrypoint with auto-import 89├── secrets/ # Secrets files used by agenix 90│ └── secrets.nix # Secrets entrypoint 91├── flake.nix # Configuration entrypoint 92└── justfile # Command helper 93``` 94 95## Commands 96 97You can get all recipes using the `just` command and running one of the available commands below with `just <command> <arguments*>`: 98 99```sh 100Available recipes: 101 boot hostname=hostname # Build a new configuration 102 clean # Cleanup all unused packages and generations 103 format # Format code 104 size # Print size of the nix store 105 switch hostname=hostname # Rebuild the system 106 update # Update dependencies 107``` 108 109## Documentations 110 111These are the things that help me the most to understand Nix ecosystem and help me build my configuration from scratch. 112 113You can retrieve dotfiles that inspired me inside my [`dotfiles` star list](https://github.com/stars/Cosmeak/lists/useful-dotfiles). 114 115- [Flakes book](https://nixos-and-flakes.thiscute.world/) 116- [Nix Language](https://nix.dev/) 117- [Nix Tour](https://nixcloud.io/tour/?id=introduction/nix) 118- [Dentritic Pattern explanation](https://github.com/Doc-Steve/dendritic-design-with-flake-parts) 119 120## Troubleshooting 121 122- If the rebuild command failed because an experimental feature is disabled use this command: 123```sh 124sudo -E NIX_CONFIG="experimental-features = nix-command flakes pipe-operators" nixos-rebuild switch --flake . 125```