update readme

This commit is contained in:
Casper V. Kristensen 2024-02-06 02:09:39 +01:00
parent 19409ad8a5
commit 17a60ede77

View file

@ -9,7 +9,8 @@ installation can still be done through the terminal.
For [impermanence](https://nixos.wiki/wiki/Impermanence), partitioning should be done as outlined in the [tmpfs For [impermanence](https://nixos.wiki/wiki/Impermanence), partitioning should be done as outlined in the [tmpfs
as root](https://elis.nu/blog/2020/05/nixos-tmpfs-as-root/) blogpost, but with `/nix` as a [LUKS-encrypted file as root](https://elis.nu/blog/2020/05/nixos-tmpfs-as-root/) blogpost, but with `/nix` as a [LUKS-encrypted file
system](https://nixos.org/manual/nixos/stable/index.html#sec-luks-file-systems). The boot partition will not be system](https://nixos.org/manual/nixos/stable/index.html#sec-luks-file-systems). The boot partition will not be
encrypted, since that is poorly supported by systemd-boot. Persistent files will be saved under `/nix/persist`. encrypted, since that is poorly supported by systemd-boot. Persistent files will be saved under `/nix/persist`. To
find out which of our darlings will be erased on reboot do `tree -x /` or `ncdu -x /`.
The following is based on the [tmpfs as root](https://elis.nu/blog/2020/05/nixos-tmpfs-as-root/) blogpost, the NixOS The following is based on the [tmpfs as root](https://elis.nu/blog/2020/05/nixos-tmpfs-as-root/) blogpost, the NixOS
manual's [partitioning](https://nixos.org/manual/nixos/stable/index.html#sec-installation-manual-partitioning), manual's [partitioning](https://nixos.org/manual/nixos/stable/index.html#sec-installation-manual-partitioning),
@ -83,40 +84,45 @@ mkpasswd > /mnt/nix/persist/passwordfile
chmod 400 /mnt/nix/persist/passwordfile chmod 400 /mnt/nix/persist/passwordfile
``` ```
### Hardware Configuration
## Hardware Configuration
`hosts/*/hardware.nix`, while initially generated by `nixos-generate-config --show-hardware-config`, _is_ manually `hosts/*/hardware.nix`, while initially generated by `nixos-generate-config --show-hardware-config`, _is_ manually
modified. modified.
### State Version
## Impermanence Nixpkgs uses `stateVersion` so sparingly that auditing the entire nixpkgs repo is [easy
To find out which of our darlings will be erased on reboot do `tree -x /`.
## Upgrading
```bash
sudo nixos-rebuild switch --flake .
```
## State Version
Nixpkgs uses `stateVersion` so sparingly that
auditing the entire nixpkgs repo is [easy
enough](https://sourcegraph.com/search?q=context%3Aglobal+repo%3A%5Egithub%5C.com%3FNixOS%2Fnixpkgs%24++lang%3ANix+stateVersion+AND+23.11). enough](https://sourcegraph.com/search?q=context%3Aglobal+repo%3A%5Egithub%5C.com%3FNixOS%2Fnixpkgs%24++lang%3ANix+stateVersion+AND+23.11).
## Debugging ## Useful Commands
```bash ```bash
# upgrade system
sudo nixos-rebuild switch --flake .
# start build environment with user's default shell instead of bash
nix develop --command $SHELL
# nix shell with python packages
# https://discourse.nixos.org/t/nix-shell-for-python-packages/16575
# https://github.com/NixOS/nix/issues/5567
nix shell --impure --expr 'with builtins.getFlake "nixpkgs"; with legacyPackages.x86_64-linux; python3.withPackages (ps: with ps; [ numpy ])'
```
### Debugging
```bash
# load flake into repl
nix repl nix repl
:lf . :lf .
# print the value of a configuration settings # print the value of a configuration settings
:p nixosConfigurations.omega.config.services.openssh.ports :p nixosConfigurations.omega.config.services.openssh.ports
# print _why_ the value is as it is (source of defaults, overwrites) # print _why_ the value is as it is (source of defaults, overwrites)
:p nixosConfigurations.omega.options.services.openssh.ports :p nixosConfigurations.omega.options.services.openssh.ports
# print value of home-manager setting # print value of home-manager setting
:p nixosConfigurations.omega.config.home-manager.users.caspervk.programs.ssh.matchBlocks :p nixosConfigurations.omega.config.home-manager.users.caspervk.programs.ssh.matchBlocks
# print version of package in nixpkgs # print version of package in nixpkgs
:p inputs.nixpkgs.outputs.legacyPackages.x86_64-linux.openssh.version :p inputs.nixpkgs.outputs.legacyPackages.x86_64-linux.openssh.version
``` ```