mirror of
https://github.com/alyraffauf/nixcfg.git
synced 2024-11-25 14:31:54 -05:00
hosts: update README.md
This commit is contained in:
parent
8138d5e104
commit
e6bbe0c64f
|
@ -1,5 +1,38 @@
|
||||||
# Hosts
|
# Hosts
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
Host-specific configuration + common modules that aren't better expressed as options & flake outputs. All hosts are configured with [agenix](https://github.com/ryantm/agenix), [disko](https://github.com/nix-community/disko), and [nixhw](https://github.com/alyraffauf/nixhw).
|
||||||
|
|
||||||
|
## Automatic Updates
|
||||||
|
|
||||||
|
These hosts update themselves automatically, once a day, by rebuilding from one of two sources: directly from this repository's master branch or from [FlakeHub](https://flakehub.com/). This can be adjusted by overriding the value of `config.environment.variables.FLAKE`.
|
||||||
|
|
||||||
|
FlakeHub allows [semantic versioning](https://flakehub.com/docs/features/semver), which means that these hosts build from the lattest tag published to FlakeHub with format `v0.0.0`. I try to follow the [semantic versioning 2.0](https://github.com/semver/semver/blob/master/semver.md) standard, though this may not always be the case.
|
||||||
|
|
||||||
|
You can access the latest tagged commit from this repository with this url: [https://flakehub.com/f/alyraffauf/nixcfg/\*.tar.gz](https://flakehub.com/f/alyraffauf/nixcfg/*.tar.gz).
|
||||||
|
|
||||||
|
## Declarative WiFi Connections
|
||||||
|
|
||||||
|
WiFi networks can be configured declaratiely in `wifi.nix` using `config.networking.networkmanager.ensureProfiles.profiles`, provided by nixpkgs. I also provide helper functions for common wifi security types.
|
||||||
|
|
||||||
|
[nm2nix](https://github.com/janik-haag/nm2nix) can generate nix code for all WiFi networks currently configured in `/etc/NetworkManager/system-connections/` and `/run/NetworkManager/system-connections` with the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo su -c "cd /etc/NetworkManager/system-connections && nix --extra-experimental-features 'nix-command flakes' run github:Janik-Haag/nm2nix | nix --extra-experimental-features 'nix-command flakes' run nixpkgs#nixfmt-rfc-style"
|
||||||
|
```
|
||||||
|
|
||||||
|
Secrets (passwords, certificates, and identities) are supported, but must be declared and available as variables with agenix. They will be replaced upon activation with `envsubst`.
|
||||||
|
|
||||||
|
In short,
|
||||||
|
|
||||||
|
1. Manually configure the WiFi network on one device.
|
||||||
|
1. Export configuration to nix with `nm2nix`.
|
||||||
|
1. Add secrets to `secrets/wifi.age` as variables (e.g. `MYPSK=1234567890`)
|
||||||
|
1. Edit the code generated by `nm2nix` to reference `$MYPSK` instead of directly declaring the WPA password.
|
||||||
|
1. Commit and push changes.
|
||||||
|
1. Rebuild hosts as required to propogate your new WiFi configuration.
|
||||||
|
|
||||||
## Provisioning New Devices
|
## Provisioning New Devices
|
||||||
|
|
||||||
1. Create `hosts/$HOSTNAME/default.nix` and other host-specific nix modules (e.g. `disko.nix`,`hardware.nix`, and `home.nix`).
|
1. Create `hosts/$HOSTNAME/default.nix` and other host-specific nix modules (e.g. `disko.nix`,`hardware.nix`, and `home.nix`).
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
# common
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
Common modules for my nix hosts that aren't better expressed as options & flake outputs.
|
|
||||||
|
|
||||||
## Declarative WiFi Connections
|
|
||||||
|
|
||||||
WiFi networks can be configured declaratiely in `wifi.nix` using `config.networking.networkmanager.ensureProfiles.profiles`, provided by nixpkgs. I also provide helper functions for common wifi security types.
|
|
||||||
|
|
||||||
[nm2nix](https://github.com/janik-haag/nm2nix) can generate nix code for all WiFi networks currently configured in `/etc/NetworkManager/system-connections/` and `/run/NetworkManager/system-connections` with the following command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo su -c "cd /etc/NetworkManager/system-connections && nix --extra-experimental-features 'nix-command flakes' run github:Janik-Haag/nm2nix | nix --extra-experimental-features 'nix-command flakes' run nixpkgs#nixfmt-rfc-style"
|
|
||||||
```
|
|
||||||
|
|
||||||
Secrets (passwords, certificates, and identities) are supported, but must be declared and available as variables with agenix. They will be replaced upon activation with `envsubst`.
|
|
||||||
|
|
||||||
In short,
|
|
||||||
|
|
||||||
1. Manually configure the WiFi network on one device.
|
|
||||||
1. Export configuration to nix with `nm2nix`.
|
|
||||||
1. Add secrets to `secrets/wifi.age` as variables (e.g. `MYPSK=1234567890`)
|
|
||||||
1. Edit the code generated by `nm2nix` to reference `$MYPSK` instead of directly declaring the WPA password.
|
|
||||||
1. Commit and push changes.
|
|
||||||
1. Rebuild hosts as required to propogate your new WiFi configuration.
|
|
|
@ -60,6 +60,7 @@
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
system.autoUpgrade = {
|
system.autoUpgrade = {
|
||||||
enable = true;
|
enable = true;
|
||||||
allowReboot = true;
|
allowReboot = true;
|
||||||
|
|
Loading…
Reference in a new issue