From 17a60ede774c826590976b2ed42c06ba294d5831 Mon Sep 17 00:00:00 2001 From: "Casper V. Kristensen" Date: Tue, 6 Feb 2024 02:09:39 +0100 Subject: [PATCH] update readme --- README.md | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index fefad50..8a03f30 100644 --- a/README.md +++ b/README.md @@ -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 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 -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 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 ``` - -## Hardware Configuration +### Hardware Configuration `hosts/*/hardware.nix`, while initially generated by `nixos-generate-config --show-hardware-config`, _is_ manually modified. - -## Impermanence -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 +### 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). -## Debugging +## Useful Commands ```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 :lf . + # print the value of a configuration settings :p nixosConfigurations.omega.config.services.openssh.ports + # print _why_ the value is as it is (source of defaults, overwrites) :p nixosConfigurations.omega.options.services.openssh.ports + # print value of home-manager setting :p nixosConfigurations.omega.config.home-manager.users.caspervk.programs.ssh.matchBlocks + # print version of package in nixpkgs :p inputs.nixpkgs.outputs.legacyPackages.x86_64-linux.openssh.version ``` -