8000 GitHub - f4z3r/nix: My personal NixOS setup, with all the stuff I need, configured the way I want to use it. · GitHub
[go: up one dir, main page]

Skip to content
f4z3rPublic

About

My personal NixOS setup, with all the stuff I need, configured the way I want to use it.

Topics

Resources

Stars

40 stars

Watchers

2 watching

Forks

Repository files navigation

Gruvbox Material

f4z3r's NixOS Flake

GitHub last commit

A flake configuring my entire setup, just the way I like it...

Screenshots | Software | Static Configuration


Warning

Use at your own risk. I am updating this repository continuously, and much stuff will not work for you as I inject data (such as secrets, configs I want to protect, etc) only at runtime or during the build process. However, parts of the configuration can be useful to people (I hope), even if it is tailored to my (sometimes very specific) needs.

Screenshots

Supports quake terminals:

What Software Am I Using?

  • Channel: NixOS unstable
  • Package Manager: nix
  • Window Manager: hyprland
  • Bar: waybar
  • Layered Keyboard Mapping: kanata
  • Launcher: rofi
  • GTK Theme: Orchis Black
  • GTK Icon Theme: Papirus Dark
  • Terminal: ghostty
  • Multiplexer: tmux
  • Shell: fish
  • Editor: neovim
  • Prompt: starship
  • Audio: pipewire, mpd, ncmpcpp
  • Fonts: Monaspace Nerd Fonts (Monaspice)

NOTE: the entire setup is optimized for shortcuts to be nice with a Colemak Mod-DH setup. Specifically I am running the following setup: https://github.com/f4z3r/zmk-config-piantor-bt

More Details

My workflow runs around the following principles:

  1. On the most top level I work with Hyperland as the window manager. Its alt-key is alt and the focus is to reach workspaces with a single keystroke. On that level, rofi servers as a launcher and interface by which other applications can be triggered using shortcuts. sofa servers me quite well there.
  2. One level down, ghostty with fish in tmux should allow me to jump as quickly between projects as possible. I want to at be able to jump between two different projects as fast as possible. Here the alt-key is control. television plays a role as a selection engine/fuzzy finder.
  3. On the lowest level, nvim is used to navigate within projects. It serves both as a file manager and editor. Here grapple is used to move quickly between bookmarked files, marks are used to jump within a file, and television is again used as a picker. Finally executor is used as a minimal task runner. All other dependencies are only used for visual niceties. Plugins providing additional functionality are avoided if possible.

Update

# update channels
sudo nix-channel --update
# update flake lock file
nix flake update
# OR update only a single input
nix flake update nixpkgs-master
# rebuild system (impure needed due to external credentials for rclone)
sudo nixos-rebuild switch --impure --flake .#

Dynamic Theming

Themes cannot be implemented fully dynamically, as Nix's filesystems are read-only. Instead, you can choose to switch between themes (dark or light) in ./flake.nix and rebuild. You will need to reload the tmux configurations if a tmux instance is already running:

:source ~/.config/tmux/tmux.conf
88B4

Fast Switch

This also supports a fast switch of a theme that does not require rebuilding the configuration. For this simply run light in any fish shell to swich the following applications to light theme:

  • nvim
  • ghostty
  • fish
  • tmux

Ghostty will not reload the configuration automatically. This can be triggered by pressing ctrl-..

The override can be cleared using clight.

Build a Dev Image

This repository also contains a Docker image definition with a part of the setup. This can be built with:

nix build .#dev-image
docker load < result

The image is defined in docker.nix.

You can then run the image:

docker run \
  -v ./:/home/f4z3r/workspace/ \
  -it \
  ghcr.io/f4z3r/dev-environment:latest

Building a new image is done by adding a tag. Ensure that the tag is applied to a commit that actually modifies the image and is the latest commit on master.

Bootstrap New Computer

See docs/bootstrap.md.

ClamAV

ClamAV should be instantiated and installed by default. In order to set up the folder for the quarantine, run the following:

sudo mkdir -p /root/quarantine
# needed to run once or the service will fail
sudo freshclam

Secrets

Download the secrets.nix file from the encrypted storage. For security reasons this file is expected not to be in the build context. It should be placed under /home/f4z3r/opt/system/secrets/secrets.nix. A symlink is then placed in the repo root. This avoids leaking it if the file is commited as it needs to be staged to build. A git hook will stillprevent committing the secerts.nix symlink in the build context.

On top of that, some secrets such as a Brave search API key and OpenRouter key are put under ~/.config/f4z3r/secrets.fish:

set -gx OPENROUTER_API_KEY '...'
set -gx BRAVE_API_KEY '...'

Restic

Configure a rclone backend named gdrive. Store the rclone configuration under:

# can be found on proton drive
# ! do not use the same config as for sb sync actions, as that one is encrypted for additional
# protection !
/etc/nixos/rclone.conf

Rclone

Rclone is setup to sync the second brain between devices with an alias. In order to allow a simple sync without having to trust google to not eavesdrop, all files within the second brain are passed via the crypt encryption layer from Rclone before syncing. Both encryption and salt are protected by 512bit passphrases. The encrypted configuration can be found in the proton drive.

# copy from the proton drive to local and change premissions
sudo chmod 600 ~/.config/rclone/rclone.conf
# check that there are at least the following backends configured:
# - gdrive (used by restic directly, restic does encryption as well)
# - gdrive-crypt (used by to sync the second brain between devices, with rclone encryption layer)
rclone config

Once this is done, you can perform an initial sync using:

# you can also run with --dry-run first to check if the output matches your expectations
rclone bisync gdrive-crypt:/ ~/notes \
  --remove-empty-dirs \
  --exclude '/.**' \
  --exclude '**/.**' \
  --exclude '**/tags' \
  --compare size,modtime \
  -MP --fix-case \
  --conflict-suffix upstream,local \
  --resync

After which you can use ns to sync notes.

The above rlcone command can also be used when rclone runs into a larger issue and requires a resync.

ATTENTION: if the source of truth is your local copy, switch out the two targets in the above command.

Chart

This repository provides a Helm chart to deploy a containerized setup of this NixOS configuration into a Kubernetes/OpenShift cluster. This allows executing into the Pod and then have a fully featured development environment. The Helm chart can be found under chart/.

About

My personal NixOS setup, with all the stuff I need, configured the way I want to use it.

Topics

Resources

Stars

40 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0