This repository contains configurations for various programs & Nix(OS).
This Nix(OS) section of this repository is located in the nixos
directory. The structure & layout of this directory is as follows.
nix-shell '<home-manager>' -A install
nix profile install github:ryantm/agenix#agenix
- The
nixos/hosts
contains theconfiguration.nix
files for each of my computers that runs NixOS. - Each host is assigned a separate folder.
- The configuration that
flake.nix
uses is decided by the hostname of the system. - The creation of users is managed by the
configuration.nix
but all the user related configuration is handled byhome-manager
. The common link between the created user and configured user is just the username. This means that users with the same name on all systems will be configured the same way ifhome-manager
is used configure the user.
- The
nixos/users
directory is thehome-manager
section of the configuration. - Each username has a
username.nix
file that contains user levelhome-manager
managed configurations. - The
nixos/users/shared
directory contains modules that are shared across multiple users.
- This directory contains a
secrets.json
file (encrypted using git crypt). which should contain a JSON object. - This JSON object is made available to both the home-manager user configurations in
nixos/users
& system configurations innixos/hosts
via thesecrets
function parameter.
This is the entrypoint for both the home-manager
& NixOS
.
I have added a utility script to make working with git crypt easier (./scripts/run_with_creds.zsh
). If you want to run a command with git crypt unlock
before and git crypt lock
after. you can pass the command into this script and it'll do the unlock and cleanup for you.
here's an example
./scripts/run_with_creds.zsh sudo nixos-rebuild switch --flake './nixos#host'
The script also is careful to lock secrets using git crypt lock
if the command is interrupted for any reason.
After making any changes in the nixos/hosts
directory, you can install the changes to the current host configuration into NixOS using the following command on the host.
# TO BE RUN FROM THE ROOT OF THIS CLONED REPSITORY
./scripts/run_with_creds.zsh sudo nixos-rebuild switch --flake "./nixos"
# OR
./scripts/run_with_creds.zsh sudo nixos-rebuild switch --flake "./nixos#<NAME OF THE HOST HERE>"
Since we are using a nixos/flake.lock
file, we need to update the flake using the command below and rebuild the system as normal.
# TO BE RUN FROM THE ROOT OF THIS CLONED REPSITORY
nix flake update './nixos'
Any modifications to the nixos/users
directory can be installed using this home-manager
command
./scripts/run_with_creds.zsh home-manager switch --flake './nixos'
# OR
./scripts/run_with_creds.zsh home-manager switch --flake './nixos#<NAME OF THE USER HERE>'
Since we are using a nixos/flake.lock
file, we need to update the flake using the command below and rebuild using home-manager
.
# TO BE RUN FROM THE ROOT OF THIS CLONED REPSITORY
nix flake update './nixos'
category | programs |
---|---|
editors | (Neo)vim / (Doom)emacs |
shells | zsh / bash / starship |
wms | i3wm / polybar / rofi / picom |
terminals | alacritty / tmux |
notifications | dunst |
other | fastfetch / git |
click to expand
Since, neovim is handled by `home-manager` entirely, no additional steps are required to setup neovimclick to expand
doom emacs configuration files are installed by `home-manager` but installed doom emacs itself needs to be handled manually according to the instructions in doomemacs repository-- TODO:
-- TODO:
-- TODO:
-- TODO:
-- TODO: