nix-config icon indicating copy to clipboard operation
nix-config copied to clipboard

Configuration for NixOS and user home (dot files).

#+TITLE: nix-config Configuration for NixOS and user home (dot files). It is provided via Nix flakes and includes the following components:

  • lib :: library functions to be used with flakes or within Nix.
    • ~kebabCaseToCamelCase~ :: convert kebab case to camel case (hello-world -> helloWorld)
    • ~listNixFilesRecursiveToAttrs~ :: given a directory list all nix files recursively and create a flat attribute set with a key corresponding to each file path.
    • ~modulesFromDir~ :: given a directory create an attribute set for each module and create a default module importing all those modules.
  • homeConfigurations :: user configuration for [[https://github.com/nix-community/home-manager][Home Manager]].
  • homeModules :: modules that can be used together with [[https://github.com/nix-community/home-manager][Home Manager]].
  • nixosConfigurations :: host configurations for [[https://github.com/NixOS/nixpkgs][NixOS]].
  • nixosModules :: modules that can be used together with [[https://github.com/NixOS/nixpkgs][NixOS]].
  • overlays :: custom overlays.
    • default :: package overlay including a subset of packages.
    • fromInputs :: composed overlay from all input overlays.
  • packages :: packages not in the default nixpkgs.
    • drduh-gpg-conf :: GPG config per drduh recommendation.
    • drduh-yubikey-guide :: The drduh YubiKey guide readable via the terminal.
    • yubikeyInstallerImage :: YubiKey Installer ISO.
  • Usage Show what is provided: #+BEGIN_SRC sh nix flake show #+END_SRC

Switch both system (NixOS) and home: #+BEGIN_SRC sh nix run nixpkgs#nixos-rebuild -- switch --flake . #+end_src

Switch home only: #+BEGIN_SRC sh nix run home-manager -- switch --flake . #+end_src

Update all inputs: #+BEGIN_SRC sh nix flake update #+end_src

Update a single input: #+BEGIN_SRC sh nix flake lock --update-input nixpkgs #+end_src

  • Development Use a local input during development: #+begin_src sh nix flake lock --override-input nixpkgs path:../nixpkgs #+end_src

  • Non-NixOS ** Default shell If you use a custom shell, you need to manually set the default shell, this is done by: #+BEGIN_SRC sh echo $HOME/.nix-profile/bin/fish | sudo tee -a /etc/shells chsh -s $HOME/.nix-profile/bin/fish #+END_SRC

  • YubiKey ISO Used to create a safe environment for YubiKey operations having all the necessary tools.

Build the ISO: #+begin_src sh nix build -L .#yubikeyInstallerImage #+end_src

Copy the ISO to a USB-key/storage device: #+begin_src sh sudo dd if=result/iso/*.iso of=/dev/sda status=progress sync #+end_src

  • Tasks ** TODO Extract some inline stuff into external files ** TODO GC helpers? ** TODO Home manager config for qutebrowser + dicts ** TODO Look into if more PA config is needed:
  • [[https://github.com/dejanr/dotfiles/blob/ef9c27cf93a17e0af4bdf5cc378d2808b5326afa/nix/config/nixpkgs/roles/multimedia.nix#L35][Sample]] ** TODO Script to regenerate hardware-config for current host ** TODO Make YubiKey steps into an flake app