My flake files which I use to manage my local and remote machines
https://git.disroot.org/Zonsopkomst/flake
common | ||
config | ||
desktop | ||
display | ||
hosts | ||
machines | ||
reference | ||
sops | ||
.directory | ||
.envrc | ||
.gitignore | ||
flake.lock | ||
flake.nix | ||
LICENSE.md | ||
README.org |
Flake Readme
My NixOS Configuraton File
This is my NixOS setup to manage multiple computers with a home-manager config structure using nix flakes.
Highlights:
Multiple NixOS configurations: desktop, laptop, and hopefully a test server and eventually a full transition over from my Ubuntu server.
How to:
-
NixOS Installation
- Install NixOS on a computer using the default Gnome installer from [https://nixos.org/download.html].
- Clone this repository [https://git.disroot.org/zonsopkomst] in the `/home/<username>/ directory.
-
Update `hosts`.
- Create the host in `flake.nix` similar to one of the preexisting ones.
-
Copy the `configuration.nix` and `hardware-configuration.nix` files from the `/etc/nixos` directory and move them to `hosts/<NEW_PC_NAME>/`.
- Link imports to `<common>.nix` shared files for things like bluetooth, systemd, and time (shared common resources).
- Make certain that the correct version of `NixOS` and `homemanager` are listed in both `configuration.nix` and `home.nix`.
- Declare packages either globally under `/hosts/<hostname>/configuration.nix` or for the user(s) under the `homemanager` sections.
-
Rebuild NixOS
- `cd flake`
-
`nix –experimental-features 'nix-command flakes' flake update`
- NOTE: 2 dashes in front of experimental, in case `git` makes it a long dash.
-
`nixos-rebuild switch –flake .#<hostname>`
- (<hostname> must be include the first time rebuilding, after the first rebuild, .# can be used and the system will know which hostname is to be used)
- NOTE: 2 dashes in front of flake, in case `git` makes it a long dash.
- Make sure to update `git` with all changes
Maintenance
- See `/config/.bashrc` for `alias`: `flkup` using `sudo nixos-rebuild switch –flake .#<hostname>` commands and other useful items
Sources
Nix Flakes: [https://nixos.wiki/wiki/Flakes]
home-manager: [https://github.com/nix-community/home-manager]
Home Manager as a NixOS Module: [https://nix-community.github.io/home-manager/index.html#sec-flakes-nixos-module]
Structure
Directory | What is it for? |
common | Shared configurations and modules |
config | Config files that are managed by NixOS |
desktop | Shared desktop configs |
display | Login Display managers |
hosts | The PCs deployed |
reference | Package list, git assets, notes, etc. |
flake.nix & flake.lock | Declared configuration using the above directories & configs |
Hosts
cLAN.lol meta.name = fosite
Hostname | Model | Type | RAM | Processor | Main Use |
weda | Dell Inspiron 15 | Laptop | 16GB | AMD Ryzen 5 (Cezanne) | Business |
frija | Acer Aspire 3 | Laptop | 4GB | AMD A9 | Testing |
tyr | Intel i5 | Desktop | 16GB | Intel i5 | Media |
tii | Dell Lattitude 5511 | Laptop | 16GB | Intel i5 Quad (i5-10400H) | Remote |
tuisto | AMD Ryzen 5 | Desktop | 16GB | AMD Ryzen 5 (Renoir) | Remote |
sintanne | Intel i5 | Desktop | 16GB | Intel i5-11320H | Remote |
thuner | AMD Ryzen 5 | Server | ??GB | AMD 2200G | Test Server |
frijheid | AMD Ryzen 5 | Server | 16GB | AMD 2200G | Main Server |