Repository: pinpox/nixos
Branch: main
Commit: 3537c4ac42ef
Files: 402
Total size: 758.3 KB
Directory structure:
gitextract_pevrk36z/
├── .envrc
├── .github/
│ ├── FUNDING.yml
│ └── workflows/
│ ├── check-upstream-todos.yml
│ └── manual.yml
├── .gitignore
├── .pre-commit-config.yaml
├── .woodpecker/
│ └── x86-64-linux.yaml
├── LICENSE
├── README.md
├── clan-service-modules/
│ ├── machine-type/
│ │ ├── default.nix
│ │ ├── desktop.nix
│ │ ├── mobile.nix
│ │ ├── nextcloud-desktop.nix
│ │ ├── scanners.nix
│ │ └── server.nix
│ ├── monitoring/
│ │ ├── alert-rules.nix
│ │ ├── alertmanager-irc-relay.nix
│ │ ├── blackbox.nix
│ │ ├── default.nix
│ │ ├── grafana.nix
│ │ ├── loki.nix
│ │ ├── node-exporter.nix
│ │ └── prometheus.nix
│ ├── navidrome.nix
│ └── thelounge.nix
├── flake.nix
├── formatter.nix
├── home-manager/
│ ├── colorscheme.nix
│ ├── modules/
│ │ ├── audio-recording/
│ │ │ └── default.nix
│ │ ├── calendar/
│ │ │ └── default.nix
│ │ ├── chromium/
│ │ │ └── default.nix
│ │ ├── claude-code/
│ │ │ └── default.nix
│ │ ├── credentials/
│ │ │ ├── age-recipients
│ │ │ └── default.nix
│ │ ├── easyeffects/
│ │ │ └── default.nix
│ │ ├── email/
│ │ │ ├── aerc-style.nix
│ │ │ └── default.nix
│ │ ├── firefox/
│ │ │ ├── default.nix
│ │ │ └── userchrome.css.mustache
│ │ ├── fonts/
│ │ │ └── default.nix
│ │ ├── foot/
│ │ │ └── default.nix
│ │ ├── games/
│ │ │ └── default.nix
│ │ ├── git/
│ │ │ └── default.nix
│ │ ├── go/
│ │ │ └── default.nix
│ │ ├── grobi/
│ │ │ └── default.nix
│ │ ├── gtk/
│ │ │ ├── banana.nix
│ │ │ └── default.nix
│ │ ├── helix/
│ │ │ └── default.nix
│ │ ├── k9s/
│ │ │ └── default.nix
│ │ ├── kanshi/
│ │ │ └── default.nix
│ │ ├── mako/
│ │ │ └── default.nix
│ │ ├── mpv/
│ │ │ └── default.nix
│ │ ├── neomutt/
│ │ │ └── default.nix
│ │ ├── newsboat/
│ │ │ └── default.nix
│ │ ├── obs-studio/
│ │ │ └── default.nix
│ │ ├── pandoc/
│ │ │ └── default.nix
│ │ ├── pi-mono/
│ │ │ └── default.nix
│ │ ├── rio/
│ │ │ ├── config/
│ │ │ │ └── rio/
│ │ │ │ ├── config.toml
│ │ │ │ └── themes/
│ │ │ │ ├── pinpox-dark.toml
│ │ │ │ ├── pinpox-light.toml
│ │ │ │ ├── wildcharm-dark.toml
│ │ │ │ └── wildcharm-light.toml
│ │ │ └── default.nix
│ │ ├── river/
│ │ │ ├── default.nix
│ │ │ ├── json.lua
│ │ │ ├── layout.lua
│ │ │ └── river-config
│ │ ├── shell/
│ │ │ ├── default.nix
│ │ │ ├── fish.nix
│ │ │ ├── starship.nix
│ │ │ ├── zellij-chooser
│ │ │ ├── zsh.nix
│ │ │ ├── zshrc
│ │ │ ├── zshrc-coffee
│ │ │ └── zshrc-extra
│ │ ├── ssh/
│ │ │ ├── default.nix
│ │ │ ├── ssh-key-cert.pub
│ │ │ └── ssh-key.pub
│ │ ├── sway/
│ │ │ └── default.nix
│ │ ├── swaylock/
│ │ │ ├── default.nix
│ │ │ └── style.css
│ │ ├── taskwarrior/
│ │ │ └── default.nix
│ │ ├── theme-switcher/
│ │ │ ├── default.nix
│ │ │ └── toggle-theme.sh
│ │ ├── tmux/
│ │ │ ├── default.nix
│ │ │ └── tmux.conf
│ │ ├── waybar/
│ │ │ ├── default.nix
│ │ │ └── style.css
│ │ ├── xdg/
│ │ │ └── default.nix
│ │ ├── zed/
│ │ │ └── default.nix
│ │ ├── zellij/
│ │ │ └── default.nix
│ │ └── zk/
│ │ ├── config.toml
│ │ ├── default.md
│ │ ├── default.nix
│ │ └── journal.md
│ └── profiles/
│ ├── common.nix
│ ├── desktop/
│ │ └── default.nix
│ ├── mobile/
│ │ └── default.nix
│ └── server/
│ └── default.nix
├── images/
│ ├── configuration.nix
│ └── raspi.nix
├── inventory.json
├── inventory.nix
├── machines/
│ ├── birne/
│ │ ├── configuration.nix
│ │ └── hardware-configuration.nix
│ ├── clementine/
│ │ ├── configuration.nix
│ │ ├── disko.nix
│ │ └── facter.json
│ ├── fichte/
│ │ ├── configuration.nix
│ │ ├── disko-config-btrfs.nix
│ │ └── facter.json
│ ├── kartoffel/
│ │ ├── configuration.nix
│ │ ├── hardware-configuration.nix
│ │ └── retiolum.nix
│ ├── kfbox/
│ │ ├── configuration.nix
│ │ ├── hardware-configuration.nix
│ │ └── retiolum.nix
│ ├── kiwi/
│ │ ├── configuration.nix
│ │ ├── disko-config-btrfs.nix
│ │ ├── framework.nix
│ │ ├── ollama-local.nix
│ │ └── opencrow-geninf.nix
│ ├── limette/
│ │ ├── configuration.nix
│ │ ├── disko-config-btrfs.nix
│ │ └── disko-config-zfs.nix
│ ├── porree/
│ │ ├── blog.nix
│ │ ├── caddy.nix
│ │ ├── configuration.nix
│ │ ├── hardware-configuration.nix
│ │ ├── nostr/
│ │ │ └── nostr.json
│ │ └── retiolum.nix
│ ├── tanne/
│ │ ├── configuration.nix
│ │ └── disko-config-btrfs.nix
│ ├── traube/
│ │ ├── configuration.nix
│ │ ├── disko.nix
│ │ └── facter.json
│ └── uconsole/
│ ├── configuration.nix
│ └── disko-config.nix
├── modules/
│ ├── bluetooth/
│ │ └── default.nix
│ ├── caddy-security/
│ │ └── default.nix
│ ├── calibre-web/
│ │ └── default.nix
│ ├── ci/
│ │ └── default.nix
│ ├── clan-common/
│ │ └── default.nix
│ ├── environment/
│ │ └── default.nix
│ ├── fonts/
│ │ └── default.nix
│ ├── forgejo/
│ │ └── default.nix
│ ├── gitea/
│ │ └── default.nix
│ ├── hedgedoc/
│ │ └── default.nix
│ ├── hello/
│ │ ├── default.nix
│ │ └── test.nix
│ ├── home-assistant/
│ │ └── default.nix
│ ├── http2irc/
│ │ └── default.nix
│ ├── immich/
│ │ └── default.nix
│ ├── jitsi-matrix-presence/
│ │ └── default.nix
│ ├── kf-homepage/
│ │ ├── default.nix
│ │ └── page/
│ │ └── index.html
│ ├── locale/
│ │ └── default.nix
│ ├── lvm-grub/
│ │ └── default.nix
│ ├── miniflux/
│ │ └── default.nix
│ ├── minio/
│ │ ├── default.nix
│ │ └── policies/
│ │ ├── nextcloud-external.json
│ │ └── restic.json
│ ├── networking/
│ │ └── default.nix
│ ├── nextcloud/
│ │ └── default.nix
│ ├── nix-common/
│ │ └── default.nix
│ ├── ntfy-sh/
│ │ └── default.nix
│ ├── opencloud/
│ │ └── default.nix
│ ├── opencrow/
│ │ └── default.nix
│ ├── openssh/
│ │ ├── ca.pub
│ │ └── default.nix
│ ├── owncast/
│ │ └── default.nix
│ ├── paperless/
│ │ ├── default.nix
│ │ └── django-apps/
│ │ └── paperless_perms/
│ │ ├── __init__.py
│ │ └── apps.py
│ ├── radio/
│ │ └── default.nix
│ ├── restic/
│ │ └── default.nix
│ ├── screego/
│ │ └── default.nix
│ ├── sound/
│ │ └── default.nix
│ ├── storagebox/
│ │ └── default.nix
│ ├── twitch-first/
│ │ └── default.nix
│ ├── unbound-desktop/
│ │ └── default.nix
│ ├── unifi-controller/
│ │ └── default.nix
│ ├── vaultwarden/
│ │ └── default.nix
│ ├── vikunja/
│ │ └── default.nix
│ ├── virtualisation/
│ │ └── default.nix
│ ├── wastebin/
│ │ └── default.nix
│ ├── wayland/
│ │ └── default.nix
│ ├── web-vm/
│ │ └── default.nix
│ ├── yubikey/
│ │ └── default.nix
│ └── zsh/
│ └── default.nix
├── overlays/
│ ├── default.nix
│ └── nextcloud.patch
├── packages/
│ ├── fritzbox_exporter/
│ │ └── default.nix
│ ├── groups-relay/
│ │ └── default.nix
│ ├── hello-custom/
│ │ └── default.nix
│ ├── machine-report/
│ │ ├── default.nix
│ │ └── machine_report.sh
│ ├── manual/
│ │ ├── default.nix
│ │ └── template.html
│ ├── mqtt2prometheus/
│ │ └── default.nix
│ ├── noctalia-askpass/
│ │ └── default.nix
│ ├── raspi-image
│ ├── river-luatile/
│ │ └── default.nix
│ ├── smartmon-script/
│ │ ├── default.nix
│ │ └── smartmon.py
│ ├── woodpecker-pipeline/
│ │ └── default.nix
│ ├── zsh-abbrev-alias/
│ │ └── default.nix
│ ├── zsh-async/
│ │ └── default.nix
│ └── zsh-colored-man-pages/
│ └── default.nix
├── templates/
│ └── default/
│ └── flake.nix
├── users/
│ ├── pinpox-wraps/
│ │ ├── chromium/
│ │ │ └── default.nix
│ │ └── ffmpeg/
│ │ └── default.nix
│ ├── pinpox.nix
│ └── root.nix
├── utils/
│ └── default.nix
└── vars/
├── per-machine/
│ ├── birne/
│ │ ├── data-mesher-node-identity/
│ │ │ ├── identity.pub/
│ │ │ │ └── value
│ │ │ └── peer.id/
│ │ │ └── value
│ │ ├── dm-pull-deploy-status-key/
│ │ │ └── signing.pub/
│ │ │ └── value
│ │ ├── minio/
│ │ │ └── .validation-hash
│ │ ├── restic-server/
│ │ │ └── .validation-hash
│ │ ├── state-version/
│ │ │ └── version/
│ │ │ └── value
│ │ ├── wireguard/
│ │ │ └── publickey/
│ │ │ └── value
│ │ ├── wireguard-wg-clan/
│ │ │ ├── ipv4/
│ │ │ │ └── value
│ │ │ └── publickey/
│ │ │ └── value
│ │ ├── wireguard-wg-clan-ip/
│ │ │ └── ipv4/
│ │ │ └── value
│ │ └── yggdrasil/
│ │ ├── address/
│ │ │ └── value
│ │ └── publicKey/
│ │ └── value
│ ├── clementine/
│ │ ├── data-mesher-node-identity/
│ │ │ ├── identity.pub/
│ │ │ │ └── value
│ │ │ └── peer.id/
│ │ │ └── value
│ │ ├── dm-pull-deploy-status-key/
│ │ │ └── signing.pub/
│ │ │ └── value
│ │ ├── punchcard/
│ │ │ └── .validation-hash
│ │ ├── punchcard2/
│ │ │ └── .validation-hash
│ │ ├── state-version/
│ │ │ └── version/
│ │ │ └── value
│ │ ├── trippy-track/
│ │ │ └── .validation-hash
│ │ ├── twitch-first/
│ │ │ └── .validation-hash
│ │ ├── wireguard-wg-clan/
│ │ │ └── publickey/
│ │ │ └── value
│ │ ├── wireguard-wg-clan-ip/
│ │ │ └── ipv4/
│ │ │ └── value
│ │ ├── wireguard-wg-tunnel/
│ │ │ └── publickey/
│ │ │ └── value
│ │ ├── wireguard-wg-tunnel-ip/
│ │ │ └── ipv4/
│ │ │ └── value
│ │ ├── yggdrasil/
│ │ │ ├── address/
│ │ │ │ └── value
│ │ │ └── publicKey/
│ │ │ └── value
│ │ └── zerotier/
│ │ ├── zerotier-ip/
│ │ │ └── value
│ │ └── zerotier-network-id/
│ │ └── value
│ ├── fichte/
│ │ ├── data-mesher-node-identity/
│ │ │ ├── identity.pub/
│ │ │ │ └── value
│ │ │ └── peer.id/
│ │ │ └── value
│ │ ├── dm-pull-deploy-status-key/
│ │ │ └── signing.pub/
│ │ │ └── value
│ │ ├── state-version/
│ │ │ └── version/
│ │ │ └── value
│ │ └── yggdrasil/
│ │ ├── address/
│ │ │ └── value
│ │ └── publicKey/
│ │ └── value
│ ├── kartoffel/
│ │ ├── data-mesher-node-identity/
│ │ │ ├── identity.pub/
│ │ │ │ └── value
│ │ │ └── peer.id/
│ │ │ └── value
│ │ ├── dm-pull-deploy-status-key/
│ │ │ └── signing.pub/
│ │ │ └── value
│ │ ├── state-version/
│ │ │ └── version/
│ │ │ └── value
│ │ ├── wireguard/
│ │ │ └── publickey/
│ │ │ └── value
│ │ ├── wireguard-wg-clan/
│ │ │ └── publickey/
│ │ │ └── value
│ │ ├── wireguard-wg-clan-ip/
│ │ │ └── ipv4/
│ │ │ └── value
│ │ └── yggdrasil/
│ │ ├── address/
│ │ │ └── value
│ │ └── publicKey/
│ │ └── value
│ ├── kfbox/
│ │ ├── caddy/
│ │ │ └── .validation-hash
│ │ ├── cert-irc/
│ │ │ ├── .validation-hash
│ │ │ ├── irc.crt/
│ │ │ │ └── value
│ │ │ └── irc.fullchain.crt/
│ │ │ └── value
│ │ ├── cert-music/
│ │ │ ├── .validation-hash
│ │ │ ├── music.crt/
│ │ │ │ └── value
│ │ │ └── music.fullchain.crt/
│ │ │ └── value
│ │ ├── data-mesher-host-key/
│ │ │ └── public_key/
│ │ │ └── value
│ │ ├── data-mesher-node-identity/
│ │ │ ├── identity.pub/
│ │ │ │ └── value
│ │ │ └── peer.id/
│ │ │ └── value
│ │ ├── dex/
│ │ │ └── .validation-hash
│ │ ├── dm-pull-deploy-status-key/
│ │ │ └── signing.pub/
│ │ │ └── value
│ │ ├── go-karma-bot/
│ │ │ └── .validation-hash
│ │ ├── hedgedoc/
│ │ │ └── .validation-hash
│ │ ├── jitsi-presence/
│ │ │ └── .validation-hash
│ │ ├── restic-exporter/
│ │ │ └── .validation-hash
│ │ ├── state-version/
│ │ │ └── version/
│ │ │ └── value
│ │ ├── vikunja/
│ │ │ └── .validation-hash
│ │ ├── wireguard/
│ │ │ └── publickey/
│ │ │ └── value
│ │ ├── wireguard-wg-clan/
│ │ │ ├── ipv4/
│ │ │ │ └── value
│ │ │ └── publickey/
│ │ │ └── value
│ │ ├── wireguard-wg-clan-ip/
│ │ │ └── ipv4/
│ │ │ └── value
│ │ ├── wireguard-wg-star/
│ │ │ ├── ipv6/
│ │ │ │ └── value
│ │ │ └── publickey/
│ │ │ └── value
│ │ └── yggdrasil/
│ │ ├── address/
│ │ │ └── value
│ │ └── publicKey/
│ │ └── value
│ ├── kiwi/
│ │ ├── cert-claw/
│ │ │ ├── .validation-hash
│ │ │ ├── claw.crt/
│ │ │ │ └── value
│ │ │ └── claw.fullchain.crt/
│ │ │ └── value
│ │ ├── data-mesher-host-key/
│ │ │ └── public_key/
│ │ │ └── value
│ │ ├── data-mesher-node-identity/
│ │ │ ├── identity.pub/
│ │ │ │ └── value
│ │ │ └── peer.id/
│ │ │ └── value
│ │ ├── dm-pull-deploy-status-key/
│ │ │ └── signing.pub/
│ │ │ └── value
│ │ ├── openclaw/
│ │ │ └── .validation-hash
│ │ ├── opencrow/
│ │ │ └── .validation-hash
│ │ ├── opencrow-email/
│ │ │ └── .validation-hash
│ │ ├── opencrow-eversports/
│ │ │ └── .validation-hash
│ │ ├── opencrow-geninf/
│ │ │ └── pubkey/
│ │ │ └── value
│ │ ├── opencrow-geninf-user/
│ │ │ └── pubkey/
│ │ │ └── value
│ │ ├── opencrow-nextcloud/
│ │ │ └── .validation-hash
│ │ ├── opencrow-nextcloud-work/
│ │ │ └── .validation-hash
│ │ ├── opencrow-nostr-bot/
│ │ │ └── nostr-public-key/
│ │ │ └── value
│ │ ├── opencrow-nostr-user/
│ │ │ └── nostr-public-key/
│ │ │ └── value
│ │ ├── state-version/
│ │ │ └── version/
│ │ │ └── value
│ │ ├── tor_tor/
│ │ │ └── hostname/
│ │ │ └── value
│ │ ├── wireguard-wg-clan/
│ │ │ ├── ipv4/
│ │ │ │ └── value
│ │ │ └── publickey/
│ │ │ └── value
│ │ ├── wireguard-wg-clan-ip/
│ │ │ └── ipv4/
│ │ │ └── value
│ │ ├── wireguard-wg-star/
│ │ │ ├── ipv6/
│ │ │ │ └── value
│ │ │ └── publickey/
│ │ │ └── value
│ │ ├── wireguard-wg-tunnel/
│ │ │ └── publickey/
│ │ │ └── value
│ │ ├── wireguard-wg-tunnel-ip/
│ │ │ └── ipv4/
│ │ │ └── value
│ │ ├── yggdrasil/
│ │ │ ├── address/
│ │ │ │ └── value
│ │ │ └── publicKey/
│ │ │ └── value
│ │ └── zerotier/
│ │ └── zerotier-ip/
│ │ └── value
│ ├── limette/
│ │ ├── data-mesher-node-identity/
│ │ │ ├── identity.pub/
│ │ │ │ └── value
│ │ │ └── peer.id/
│ │ │ └── value
│ │ ├── dm-pull-deploy-status-key/
│ │ │ └── signing.pub/
│ │ │ └── value
│ │ ├── state-version/
│ │ │ └── version/
│ │ │ └── value
│ │ ├── wireguard/
│ │ │ └── publickey/
│ │ │ └── value
│ │ ├── wireguard-wg-clan/
│ │ │ └── publickey/
│ │ │ └── value
│ │ ├── wireguard-wg-clan-ip/
│ │ │ └── ipv4/
│ │ │ └── value
│ │ └── yggdrasil/
│ │ ├── address/
│ │ │ └── value
│ │ └── publicKey/
│ │ └── value
│ ├── porree/
│ │ ├── alertmanager-ntfy/
│ │ │ └── .validation-hash
│ │ ├── caddy/
│ │ │ └── .validation-hash
│ │ ├── caddy-basicauth/
│ │ │ └── .validation-hash
│ │ ├── cert-prometheus/
│ │ │ ├── .validation-hash
│ │ │ ├── prometheus.crt/
│ │ │ │ └── value
│ │ │ └── prometheus.fullchain.crt/
│ │ │ └── value
│ │ ├── cert-status/
│ │ │ ├── .validation-hash
│ │ │ ├── status.crt/
│ │ │ │ └── value
│ │ │ └── status.fullchain.crt/
│ │ │ └── value
│ │ ├── data-mesher-node-identity/
│ │ │ ├── identity.pub/
│ │ │ │ └── value
│ │ │ └── peer.id/
│ │ │ └── value
│ │ ├── dm-pull-deploy-status-key/
│ │ │ └── signing.pub/
│ │ │ └── value
│ │ ├── matrix-hook/
│ │ │ └── .validation-hash
│ │ ├── opencrow/
│ │ │ └── .validation-hash
│ │ ├── opencrow-email/
│ │ │ └── .validation-hash
│ │ ├── opencrow-eversports/
│ │ │ └── .validation-hash
│ │ ├── opencrow-local/
│ │ │ └── .validation-hash
│ │ ├── opencrow-nextcloud/
│ │ │ └── .validation-hash
│ │ ├── opencrow-nextcloud-work/
│ │ │ └── .validation-hash
│ │ ├── restic-exporter/
│ │ │ └── .validation-hash
│ │ ├── state-version/
│ │ │ └── version/
│ │ │ └── value
│ │ ├── tor_tor/
│ │ │ └── hostname/
│ │ │ └── value
│ │ ├── vaultwarden/
│ │ │ └── .validation-hash
│ │ ├── wireguard/
│ │ │ └── publickey/
│ │ │ └── value
│ │ ├── wireguard-wg-clan/
│ │ │ └── publickey/
│ │ │ └── value
│ │ ├── wireguard-wg-clan-ip/
│ │ │ └── ipv4/
│ │ │ └── value
│ │ ├── wireguard-wg-star/
│ │ │ ├── ipv6/
│ │ │ │ └── value
│ │ │ └── publickey/
│ │ │ └── value
│ │ └── yggdrasil/
│ │ ├── address/
│ │ │ └── value
│ │ └── publicKey/
│ │ └── value
│ ├── tanne/
│ │ ├── data-mesher-node-identity/
│ │ │ ├── identity.pub/
│ │ │ │ └── value
│ │ │ └── peer.id/
│ │ │ └── value
│ │ ├── dm-pull-deploy-status-key/
│ │ │ └── signing.pub/
│ │ │ └── value
│ │ ├── state-version/
│ │ │ └── version/
│ │ │ └── value
│ │ └── yggdrasil/
│ │ ├── address/
│ │ │ └── value
│ │ └── publicKey/
│ │ └── value
│ ├── traube/
│ │ ├── data-mesher-node-identity/
│ │ │ ├── identity.pub/
│ │ │ │ └── value
│ │ │ └── peer.id/
│ │ │ └── value
│ │ ├── dm-pull-deploy-status-key/
│ │ │ └── signing.pub/
│ │ │ └── value
│ │ ├── opencrow/
│ │ │ └── .validation-hash
│ │ ├── opencrow-traube/
│ │ │ └── .validation-hash
│ │ ├── state-version/
│ │ │ └── version/
│ │ │ └── value
│ │ └── yggdrasil/
│ │ ├── address/
│ │ │ └── value
│ │ └── publicKey/
│ │ └── value
│ ├── tunnelmonster/
│ │ ├── abiotic-docker/
│ │ │ └── .validation-hash
│ │ ├── porkbun-dns/
│ │ │ └── .validation-hash
│ │ └── state-version/
│ │ └── version/
│ │ └── value
│ └── uconsole/
│ ├── data-mesher-node-identity/
│ │ ├── identity.pub/
│ │ │ └── value
│ │ └── peer.id/
│ │ └── value
│ ├── dm-pull-deploy-status-key/
│ │ └── signing.pub/
│ │ └── value
│ ├── state-version/
│ │ └── version/
│ │ └── value
│ ├── wireguard-wg-clan/
│ │ └── publickey/
│ │ └── value
│ ├── wireguard-wg-clan-ip/
│ │ └── ipv4/
│ │ └── value
│ └── yggdrasil/
│ ├── address/
│ │ └── value
│ └── publicKey/
│ └── value
└── shared/
├── bulletin-signing-key/
│ └── signing.pub/
│ └── value
├── data-mesher-ca/
│ └── ca.pub/
│ └── value
├── data-mesher-network/
│ └── network.pub/
│ └── value
├── data-mesher-network-key/
│ └── public_key/
│ └── value
├── data-mesher-signing-key/
│ └── signing.pub/
│ └── value
├── dm-dns/
│ ├── .validation-hash
│ └── zone.conf/
│ └── value
├── dm-dns-signing-key/
│ └── signing.pub/
│ └── value
├── dm-pull-deploy-signing-key/
│ └── signing.pub/
│ └── value
├── dm-wallpaper-signing-key/
│ └── signing.pub/
│ └── value
├── dm-wg-star-wg-star-signing-key/
│ └── signing.pub/
│ └── value
├── dns-mesher/
│ ├── .validation-hash
│ ├── entries/
│ │ └── value
│ └── zone.conf/
│ └── value
├── pki-root-ca/
│ └── ca.crt/
│ └── value
├── restic-cert/
│ ├── .validation-hash
│ └── restic-cert/
│ └── value
├── restic-credentials/
│ └── .validation-hash
├── restic-credentials-backblaze/
│ └── .validation-hash
├── restic-kfbox/
│ └── .validation-hash
├── sftp-credentials/
│ └── ssh-public-key/
│ └── value
├── step-ca/
│ └── ca.crt/
│ └── value
├── storagebox-ssh/
│ └── ssh-public-key/
│ └── value
└── zerotier-controller/
├── zerotier-ip/
│ └── value
└── zerotier-network-id/
└── value
================================================
FILE CONTENTS
================================================
================================================
FILE: .envrc
================================================
use flake
================================================
FILE: .github/FUNDING.yml
================================================
github: [pinpox]
buy_me_a_coffee: pinpox
================================================
FILE: .github/workflows/check-upstream-todos.yml
================================================
name: Check Upstream TODOs
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "0 0 * * 0" # Weekly on Sunday
jobs:
check-todos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check for resolved upstream TODOs
run: |
#!/bin/bash
set -e
# Find all TODO comments with GitHub PR/issue links
echo "Searching for TODO comments with GitHub links..."
# Search for TODO (with or without colon) followed by GitHub URLs
TODO_PATTERN="TODO:?\s*https://github\.com/[^/]+/[^/]+/(pull|issues)/[0-9]+"
# Find all matches and extract URLs
TODOS=$(grep -r -n -E "$TODO_PATTERN" . --exclude-dir=.git --exclude-dir=.github || true)
if [ -z "$TODOS" ]; then
echo "No TODO comments with GitHub links found."
exit 0
fi
echo "Found TODO comments:"
echo "$TODOS"
echo ""
# Extract unique URLs from the matches
URLS=$(echo "$TODOS" | grep -oE "https://github\.com/[^/]+/[^/]+/(pull|issues)/[0-9]+" | sort -u)
FAILED=false
FAILED_LOCATIONS=""
for URL in $URLS; do
echo "Checking: $URL"
# Find all locations where this URL appears
LOCATIONS=$(echo "$TODOS" | grep -F "$URL" || true)
# Extract owner, repo, type (pull or issues), and number from URL
if [[ $URL =~ https://github\.com/([^/]+)/([^/]+)/(pull|issues)/([0-9]+) ]]; then
OWNER="${BASH_REMATCH[1]}"
REPO="${BASH_REMATCH[2]}"
TYPE="${BASH_REMATCH[3]}"
NUMBER="${BASH_REMATCH[4]}"
# Use GitHub API to check status
if [ "$TYPE" == "pull" ]; then
echo " Checking PR #$NUMBER in $OWNER/$REPO..."
API_URL="https://api.github.com/repos/$OWNER/$REPO/pulls/$NUMBER"
STATE=$(curl -s -H "Accept: application/vnd.github.v3+json" "$API_URL" | jq -r '.state // "unknown"')
MERGED=$(curl -s -H "Accept: application/vnd.github.v3+json" "$API_URL" | jq -r '.merged // false')
if [ "$STATE" == "closed" ] && [ "$MERGED" == "true" ]; then
echo " ❌ FAIL: PR #$NUMBER is MERGED! Remove TODO and workaround."
echo " Locations:"
while IFS= read -r line; do
echo " $line"
done <<< "$LOCATIONS"
FAILED=true
FAILED_LOCATIONS="$FAILED_LOCATIONS$LOCATIONS"$'\n'
elif [ "$STATE" == "closed" ] && [ "$MERGED" == "false" ]; then
echo " ⚠️ PR #$NUMBER is closed but not merged."
elif [ "$STATE" == "open" ]; then
echo " ✅ PR #$NUMBER is still open."
else
echo " ⚠️ Could not determine PR status (state: $STATE, merged: $MERGED)"
fi
else
echo " Checking Issue #$NUMBER in $OWNER/$REPO..."
API_URL="https://api.github.com/repos/$OWNER/$REPO/issues/$NUMBER"
STATE=$(curl -s -H "Accept: application/vnd.github.v3+json" "$API_URL" | jq -r '.state // "unknown"')
if [ "$STATE" == "closed" ]; then
echo " ❌ FAIL: Issue #$NUMBER is CLOSED! Remove TODO and workaround."
echo " Locations:"
while IFS= read -r line; do
echo " $line"
done <<< "$LOCATIONS"
FAILED=true
FAILED_LOCATIONS="$FAILED_LOCATIONS$LOCATIONS"$'\n'
elif [ "$STATE" == "open" ]; then
echo " ✅ Issue #$NUMBER is still open."
else
echo " ⚠️ Could not determine issue status (state: $STATE)"
fi
fi
else
echo " ⚠️ Could not parse URL: $URL"
fi
echo ""
done
if [ "$FAILED" == "true" ]; then
echo "❌ One or more upstream issues/PRs have been resolved!"
echo "Please review and remove the corresponding TODO comments and workarounds."
echo ""
echo "Summary of resolved TODOs:"
echo "$FAILED_LOCATIONS"
exit 1
else
echo "✅ All upstream issues/PRs are still unresolved."
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
================================================
FILE: .github/workflows/manual.yml
================================================
name: Build and Deploy Manual
on:
push:
branches:
- main
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v20
- name: Build manual
run: |
nix build '.#manual' --show-trace -vv -L
mkdir docs
curl https://nixos.org/favicon.ico -o docs/favicon.ico
cp result/index.html docs/index.html
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.0
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs # The folder the action should deploy.
================================================
FILE: .gitignore
================================================
result
### Vim
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
Sessionx.vim
# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
tags.lock
tags.temp
.direnv
.env
================================================
FILE: .pre-commit-config.yaml
================================================
repos:
- repo: local
hooks:
- id: treefmt
name: treefmt
entry: nix fmt
language: system
pass_filenames: false
# - id: nix lint
# name: Nix lint
# entry: nix run 'nixpkgs#nix-linter'
# files: \.nix$
# language: system
================================================
FILE: .woodpecker/x86-64-linux.yaml
================================================
{
"labels": {
"backend": "local",
"platform": "linux/amd64"
},
"steps": [
{
"commands": [
"nix flake show"
],
"image": "bash",
"name": "Nix flake show"
},
{
"commands": [
"attic login lounge-rocks https://cache.lounge.rocks $ATTIC_KEY --set-default"
],
"environment": {
"ATTIC_KEY": {
"from_secret": "attic_key"
}
},
"image": "bash",
"name": "Setup Attic"
},
{
"commands": [
"nix-fast-build --no-nom --skip-cached --attic-cache lounge-rocks:nix-cache --flake \".#ciBuilds.x86_64-linux\""
],
"image": "bash",
"name": "Build all machines and push to cache"
},
{
"commands": [
"nix build --print-out-paths '.#ciBuilds.x86_64-linux.birne' -o 'result-birne'"
],
"failure": "ignore",
"image": "bash",
"name": "Build birne"
},
{
"commands": [
"nix path-info --closure-size -h $(readlink -f 'result-birne')"
],
"failure": "ignore",
"image": "bash",
"name": "Show birne info"
},
{
"commands": [
"nix build --print-out-paths '.#ciBuilds.x86_64-linux.clementine' -o 'result-clementine'"
],
"failure": "ignore",
"image": "bash",
"name": "Build clementine"
},
{
"commands": [
"nix path-info --closure-size -h $(readlink -f 'result-clementine')"
],
"failure": "ignore",
"image": "bash",
"name": "Show clementine info"
},
{
"commands": [
"nix build --print-out-paths '.#ciBuilds.x86_64-linux.fichte' -o 'result-fichte'"
],
"failure": "ignore",
"image": "bash",
"name": "Build fichte"
},
{
"commands": [
"nix path-info --closure-size -h $(readlink -f 'result-fichte')"
],
"failure": "ignore",
"image": "bash",
"name": "Show fichte info"
},
{
"commands": [
"nix build --print-out-paths '.#ciBuilds.x86_64-linux.kartoffel' -o 'result-kartoffel'"
],
"failure": "ignore",
"image": "bash",
"name": "Build kartoffel"
},
{
"commands": [
"nix path-info --closure-size -h $(readlink -f 'result-kartoffel')"
],
"failure": "ignore",
"image": "bash",
"name": "Show kartoffel info"
},
{
"commands": [
"nix build --print-out-paths '.#ciBuilds.x86_64-linux.kfbox' -o 'result-kfbox'"
],
"failure": "ignore",
"image": "bash",
"name": "Build kfbox"
},
{
"commands": [
"nix path-info --closure-size -h $(readlink -f 'result-kfbox')"
],
"failure": "ignore",
"image": "bash",
"name": "Show kfbox info"
},
{
"commands": [
"nix build --print-out-paths '.#ciBuilds.x86_64-linux.kiwi' -o 'result-kiwi'"
],
"failure": "ignore",
"image": "bash",
"name": "Build kiwi"
},
{
"commands": [
"nix path-info --closure-size -h $(readlink -f 'result-kiwi')"
],
"failure": "ignore",
"image": "bash",
"name": "Show kiwi info"
},
{
"commands": [
"nix build --print-out-paths '.#ciBuilds.x86_64-linux.limette' -o 'result-limette'"
],
"failure": "ignore",
"image": "bash",
"name": "Build limette"
},
{
"commands": [
"nix path-info --closure-size -h $(readlink -f 'result-limette')"
],
"failure": "ignore",
"image": "bash",
"name": "Show limette info"
},
{
"commands": [
"nix build --print-out-paths '.#ciBuilds.x86_64-linux.porree' -o 'result-porree'"
],
"failure": "ignore",
"image": "bash",
"name": "Build porree"
},
{
"commands": [
"nix path-info --closure-size -h $(readlink -f 'result-porree')"
],
"failure": "ignore",
"image": "bash",
"name": "Show porree info"
},
{
"commands": [
"nix build --print-out-paths '.#ciBuilds.x86_64-linux.tanne' -o 'result-tanne'"
],
"failure": "ignore",
"image": "bash",
"name": "Build tanne"
},
{
"commands": [
"nix path-info --closure-size -h $(readlink -f 'result-tanne')"
],
"failure": "ignore",
"image": "bash",
"name": "Show tanne info"
}
],
"when": [
{
"event": "manual"
},
{
"branch": "main",
"event": "push"
}
]
}
================================================
FILE: LICENSE
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
================================================
FILE: README.md
================================================

**Configuration checks:** [](https://build.lounge.rocks/repos/9)
All Module options are documented at: https://pinpox.github.io/nixos/
This repository includes all configurations for my NixOS machines. Feel free to
use parts of it as you please, but keep it mind it is intended mostly for
personal use. I've written posts about certain aspects of this setup on my
[personal blog](https://pablo.tools/posts).
# Overview
The structure of this repository is meant to allow easy manual deployment while
being [clan](https://clan.lol) compatible. Individual hosts are defined in
`/machines/` and import re-usable parts of the configuration as
needed. Deployment and management is done with [clan](https://clan.lol), and
secrets are stored in [passage](https://github.com/FiloSottile/passage), which
uses age for encryption.
The current hosts are:
| Configuration | Type | Location | Description |
| --------------------------------- | ------- | --------- | ------------------------------------ |
| [kartoffel](./machines/kartoffel) | Desktop | local | Main desktop workstation |
| [kiwi](./machines/kiwi) | Laptop | local | Framework 13 (AMD AI 300 series) |
| [limette](./machines/limette) | Laptop | local | Notebook |
| [fichte](./machines/fichte) | Laptop | local | ThinkPad T490 |
| [tanne](./machines/tanne) | Laptop | local | ThinkPad T480s |
| [uconsole](./machines/uconsole) | Handheld| local | Clockwork uConsole (RPi CM4) |
| [birne](./machines/birne) | Server | local | Local NAS |
| [porree](./machines/porree) | Server | netcup.de | Server for pablo.tools |
| [kfbox](./machines/kfbox) | Server | netcup.de | Server for 0cx.de |
| [clementine](./machines/clementine) | Server | netcup.de | Server for megaclan3000.de |
| [traube](./machines/traube) | Server | local | aarch64 server |
# Deployment
Deployment is done via [clan CLI](https://clan.lol) provided via the flake's
default nix shell. I use [direnv](https://direnv.net/) to automatically start it
when entering the repository's directory. Run `direnv allow` on the first time,
after that, deployment can be done via:
```sh
clan machines update
```
## Repository Organization
The configuration is organized as follows:
- `machines/`: Host-specific configurations
- `modules`: System-level NixOS modules
- `home-manager/modules`: User-level home-manager modules for specific applications
- `home-manager/profiles`: Profiles that combine multiple home-manager modules
- `home-manager/packages`: Custom packages for applications not present in nixpkgs
- `clan-service-modules`: [Clan](https://clan.lol) services
# Contributing?
While contributions don't make much sense for a personal configuration repository,
I'm always happy to get hints, tips and constructive criticism. If you find something
that could be done in a better way, please let me know!
================================================
FILE: clan-service-modules/machine-type/default.nix
================================================
{
_class = "clan.service";
manifest.name = "machine-type";
manifest.readme = "Machine classification/profiles";
roles.server.perInstance.nixosModule = ./server.nix;
roles.server.description = "Server machine settings, no GUI";
roles.desktop.perInstance.nixosModule = ./desktop.nix;
roles.desktop.description = "Desktop machine settings, including wayland and sway";
roles.mobile.perInstance.nixosModule = ./mobile.nix;
roles.mobile.description = "Mobile/ARM device settings, lightweight desktop";
# Common configuration for all macine types
perMachine.nixosModule =
{ lib, ... }:
{
security.acme.acceptTerms = true;
security.acme.defaults.email = lib.mkDefault "letsencrypt@pablo.tools";
clan.core.settings.state-version.enable = true;
hardware.enableRedistributableFirmware = true;
hardware.enableAllHardware = true;
};
}
================================================
FILE: clan-service-modules/machine-type/desktop.nix
================================================
{
config,
pkgs,
lib,
nur,
flake-self,
wl-harmonograph,
promterm,
home-manager,
...
}:
{
imports = [
./nextcloud-desktop.nix
home-manager.nixosModules.home-manager
];
services.fwupd.enable = true;
services.acpid.enable = true;
services.upower.enable = true;
# To build raspi images
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
# Enable networkmanager
networking.networkmanager.enable = true;
# Often hangs
systemd.services = {
NetworkManager-wait-online.enable = lib.mkForce false;
systemd-networkd-wait-online.enable = lib.mkForce false;
};
hardware.keyboard.qmk.enable = true;
services.udev.packages = [
# pkgs.via
pkgs.qmk-udev-rules # For QMK/Via
pkgs.libsigrok # For pulseview
];
# DON'T set useGlobalPackages! It's not necessary in newer
# home-manager versions and does not work with configs using
# nixpkgs.config`
home-manager.useUserPackages = true;
# Backup files before overwriting them with home-manager
home-manager.backupFileExtension = "hm-backup";
# Pass all flake inputs to home-manager modules aswell so we can use them
# there.
# home-manager.extraSpecialArgs = flake-self.inputs;
home-manager.extraSpecialArgs = {
inherit
wl-harmonograph
flake-self
nur
promterm
;
# Pass system configuration (top-level "config") to home-manager modules,
# so we can access it's values for conditional statements. Writing is NOT possible!
system-config = config;
};
nixpkgs.overlays = [
nur.overlays.default
flake-self.overlays.default
];
# TODO parametrize the username
home-manager.users.pinpox = flake-self.homeConfigurations.desktop;
# Hardware accelleration
hardware.graphics = {
enable = true;
enable32Bit = true;
};
pinpox = {
defaults = {
bluetooth.enable = true;
environment.enable = true;
storagebox = {
enable = true;
mountOnAccess = true;
};
fonts.enable = true;
locale.enable = true;
locale.automatic-timezone = true;
networking.enable = true;
nix.enable = true;
sound.enable = true;
zsh.enable = true;
yubikey.enable = true;
lvm-grub.enable = true;
# home-manager.enable = true;
# home-manager.configuration = flake-self.homeConfigurations.desktop;
};
virtualisation = {
docker.enable =false;
virt-manager.enable = true;
virtualbox.enable = false;
};
services = {
unbound-desktop.enable = false;
wayland.enable = true;
openssh.enable = true;
restic-client = {
enable = true;
backup-paths-onsite = [
"/home/pinpox/Notes"
"/home/pinpox"
"/home/pinpox/.mozilla/firefox/pinpox/places.sqlite"
# "*/.local/share/password-store"
# "*/.passage"
# "*/.gnupg"
# "*/.ssh"
];
backup-paths-offsite = [
"/home/pinpox/.mozilla/firefox/pinpox/places.sqlite"
"/home/pinpox/Notes"
"/home/pinpox"
];
};
};
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# irc-announce irc.hackint.org 6697 testbot992 '#lounge-rocks2' 1 "test2"
# pkgs.nur.repos.mic92.irc-announce
firefox
openspec
gcc
comma
acpi
arandr
binutils
file
git
gnumake
killall
lm_sensors
neovim
nixpkgs-review
nix-init
nix-update
nodejs
ripgrep
time
usbutils
wget
];
services.logind.settings.Login.RuntimeDirectorySize = "20G";
boot = {
# Use GRUB2 as EFI boot loader.
loader.grub.useOSProber = true;
tmp.useTmpfs = false;
};
programs.dconf.enable = true;
# For user-space mounting things like smb:// and ssh:// in thunar etc. Dbus
# is required.
services.gvfs = {
enable = true;
# Default package does not support all protocols. Use the full-featured
# gnome version
package = lib.mkForce pkgs.gnome.gvfs;
};
}
================================================
FILE: clan-service-modules/machine-type/mobile.nix
================================================
{
config,
pkgs,
lib,
nur,
flake-self,
promterm,
home-manager,
...
}:
{
imports = [
home-manager.nixosModules.home-manager
];
services.acpid.enable = true;
services.upower.enable = true;
# US QWERTY for TTY (mobile devices don't have colemak keyboards)
console.keyMap = lib.mkForce "us";
# Enable networkmanager
networking.networkmanager.enable = true;
# Often hangs
systemd.services = {
NetworkManager-wait-online.enable = lib.mkForce false;
systemd-networkd-wait-online.enable = lib.mkForce false;
};
# DON'T set useGlobalPackages! It's not necessary in newer
# home-manager versions and does not work with configs using
# nixpkgs.config`
home-manager.useUserPackages = true;
# Backup files before overwriting them with home-manager
home-manager.backupFileExtension = "hm-backup";
# Pass all flake inputs to home-manager modules aswell so we can use them
# there.
home-manager.extraSpecialArgs = {
inherit
flake-self
nur
promterm
;
# Pass system configuration (top-level "config") to home-manager modules,
# so we can access it's values for conditional statements. Writing is NOT possible!
system-config = config;
};
nixpkgs.overlays = [
nur.overlays.default
flake-self.overlays.default
];
# TODO parametrize the username
home-manager.users.pinpox = flake-self.homeConfigurations.mobile;
# Hardware accelleration
hardware.graphics = {
enable = true;
};
pinpox = {
defaults = {
bluetooth.enable = true;
environment.enable = true;
fonts.enable = false; # Disabled - noto-fonts-color-emoji can't cross-compile
locale.enable = true;
locale.automatic-timezone = true;
networking.enable = true;
nix.enable = true;
sound.enable = false;
zsh.enable = true;
};
services = {
wayland.enable = true;
openssh.enable = true;
};
};
# List packages installed in system profile
environment.systemPackages = with pkgs; [
gcc
comma
acpi
binutils
file
git
gnumake
killall
neovim
ripgrep
time
usbutils
wget
];
programs.dconf.enable = true;
# Disable speech-dispatcher to avoid pulling in mbrola-voices (675MB)
services.speechd.enable = lib.mkForce false;
# Override fontconfig defaults to avoid noto-fonts-color-emoji
# which requires Python tools that can't cross-compile
fonts.fontconfig.defaultFonts.emoji = lib.mkForce [ ];
# Disable default font packages (includes noto-fonts-color-emoji)
fonts.enableDefaultPackages = false;
# Disable modemmanager - cross-compilation is broken
networking.modemmanager.enable = false;
}
================================================
FILE: clan-service-modules/machine-type/nextcloud-desktop.nix
================================================
{
# Nextcloud on the desktop
services.davfs2 = {
enable = true;
# settings.globalSection.use_locks = false;
# TODO: Note: Ordinary users can mount a davfs2 file system if they are a
# member of the group dav_group as defined in the system wide
# configuration. Make sure the option 'dav_group' is enabled in the system
# wide configuration file.
};
# fileSystems."/home/pinpox/Nextcloud" = {
# device = "https://files.pablo.tools/remote.php/dav/files/pinpox";
# fsType = "davfs";
# options = [
# "user"
# "rw"
# "noauto" # I'll mount it manually
# ];
# };
}
================================================
FILE: clan-service-modules/machine-type/scanners.nix
================================================
{
hardware.sane.enable = true;
users.users.pinpox.extraGroups = [
"scanner"
"lp"
];
}
================================================
FILE: clan-service-modules/machine-type/server.nix
================================================
{
restic-exporter,
lib,
pkgs,
config,
...
}:
with lib;
{
imports = [
restic-exporter.nixosModules.default
];
# Limit log size for journal
services.journald.extraConfig = "SystemMaxUse=1G";
environment.systemPackages = with pkgs; [
universal-ctags
git
gnumake
go
htop
neovim
nix-index
nixfmt
ripgrep
wget
ncdu
duf
tmux
];
pinpox.defaults = {
environment.enable = true;
locale.enable = true;
nix.enable = true;
zsh.enable = true;
networking.enable = true;
};
pinpox.services.openssh.enable = true;
# Backups
pinpox.services = {
restic-client = {
enable = true;
backup-paths-onsite = [
config.services.postgresqlBackup.location
"/home"
"/root"
];
};
};
# Backup Postgres, if it is running
services.postgresqlBackup = {
enable = config.services.postgresql.enable;
startAt = "*-*-* 01:15:00";
location = "/var/backup/postgresql";
backupAll = true;
};
# Remove wayland dependencies on server machine type
nixpkgs.overlays = [
(final: super: {
passage = super.passage.override {
wl-clipboard = null;
xclip = null;
};
neovim = super.neovim.override {
waylandSupport = false;
};
})
];
}
================================================
FILE: clan-service-modules/monitoring/alert-rules.nix
================================================
{ lib, meta }:
let
# docker's filesystems disappear quickly, leading to false positives
deviceFilter = ''path!~"^(/var/lib/docker|/nix/store).*"'';
in
lib.mapAttrsToList
(name: opts: {
alert = name;
expr = opts.condition;
for = opts.time or "2m";
labels = { };
annotations.description = opts.description;
})
({
# prometheus_too_many_restarts = {
# condition = ''changes(process_start_time_seconds{job=~"prometheus|alertmanager"}[15m]) > 2'';
# description = "Prometheus has restarted more than twice in the last 15 minutes. It might be crashlooping.";
# };
# alert_manager_config_not_synced = {
# condition = ''count(count_values("config_hash", alertmanager_config_hash)) > 1'';
# description = "Configurations of AlertManager cluster instances are out of sync.";
# };
#alert_manager_e2e_dead_man_switch = {
# condition = "vector(1)";
# description = "Prometheus DeadManSwitch is an always-firing alert. It's used as an end-to-end test of Prometheus through the Alertmanager.";
#};
# prometheus_not_connected_to_alertmanager = {
# condition = "prometheus_notifications_alertmanagers_discovered < 1";
# description = "Prometheus cannot connect the alertmanager\n VALUE = {{ $value }}\n LABELS = {{ $labels }}";
# };
# prometheus_rule_evaluation_failures = {
# condition = "increase(prometheus_rule_evaluation_failures_total[3m]) > 0";
# description = "Prometheus encountered {{ $value }} rule evaluation failures, leading to potentially ignored alerts.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}";
# };
# prometheus_template_expansion_failures = {
# condition = "increase(prometheus_template_text_expansion_failures_total[3m]) > 0";
# time = "0m";
# description = "Prometheus encountered {{ $value }} template text expansion failures\n VALUE = {{ $value }}\n LABELS = {{ $labels }}";
# };
# promtail_file_lagging = {
# condition = ''abs(promtail_file_bytes_total - promtail_read_bytes_total) > 1e6'';
# time = "15m";
# description = ''{{ $labels.instance }} {{ $labels.job }} {{ $labels.path }} has been lagging by more than 1MB for more than 15m.'';
# };
filesystem_full_80percent = {
condition = ''100 - ((node_filesystem_avail_bytes{fstype!="rootfs",mountpoint="/"} * 100) / node_filesystem_size_bytes{fstype!="rootfs",mountpoint="/"}) > 80'';
time = "10m";
description = "{{$labels.instance}} device {{$labels.device}} on {{$labels.mountpoint}} got less than 20% space left on its filesystem.";
};
# filesystem_inodes_full = {
# condition = ''disk_inodes_free / disk_inodes_total < 0.10'';
# time = "10m";
# description = "{{$labels.instance}} device {{$labels.device}} on {{$labels.mountpoint}} got less than 10% inodes left on its filesystem.";
# };
# daily_task_not_run = {
# # give 6 hours grace period
# condition = ''time() - task_last_run{state="ok",frequency="daily"} > (24 + 6) * 60 * 60'';
# description = "{{$labels.instance}}: {{$labels.name}} was not run in the last 24h";
# };
# TODO for backups:
# - Has not run
# - No data for a wheek
# - Too old
# - to drastic file or size change
# description = "status of ${name} is unknown: no data for a day";
# description = "{{$labels.instance}}: {{$labels.name}} was not run in the last week";
# description = "status of restic is unknown: no data for a week";
# homeassistant = {
# condition = ''
# homeassistant_entity_available{domain="persistent_notification", entity!="persistent_notification.http_login"} >= 0'';
# description =
# "homeassistant notification {{$labels.entity}} ({{$labels.friendly_name}}): {{$value}}";
# };
swap_using_20percent = {
condition = "node_memory_SwapTotal_bytes - (node_memory_SwapCached_bytes + node_memory_SwapFree_bytes) > node_memory_SwapTotal_bytes * 0.2";
time = "30m";
description = "{{$labels.instance}} is using 20% of its swap space for at least 30 minutes.";
};
systemd_service_failed = {
condition = ''node_systemd_unit_state{state="failed"} == 1'';
description = "{{$labels.instance}} failed to (re)start service {{$labels.name}}.";
};
restic_backup_too_old = {
condition = ''(time() - restic_snapshots_latest_time)/(60*60) > 24'';
description = "{{$labels.instance}} not backed up for more than 24 hours. ({{$value}})";
};
host_down = {
condition = ''up{job="node-stats", instance!~"limette.${meta.domain}:9100|kartoffel.${meta.domain}:9100"} == 0'';
description = "{{$labels.instance}} is down!";
};
# service_not_running = {
# condition = ''systemd_units_active_code{name=~"teamspeak3-server.service|tt-rss.service", sub!="running"}'';
# description = "{{$labels.instance}} should have a running {{$labels.name}}.";
# };
ram_using_90percent = {
condition = "node_memory_Buffers_bytes + node_memory_MemFree_bytes + node_memory_Cached_bytes < node_memory_MemTotal_bytes * 0.1";
time = "1h";
description = "{{$labels.instance}} is using at least 90% of its RAM for at least 1 hour.";
};
cpu_using_90percent = {
condition = ''100 - (avg by (instance) (irate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) >= 90'';
time = "10m";
description = "{{$labels.instance}} is running with cpu usage > 90% for at least 10 minutes: {{$value}}";
};
reboot = {
condition = "node_boot_time_seconds < 300";
description = "{{$labels.instance}} just rebooted.";
};
uptime = {
condition = "(time() - node_boot_time_seconds ) / (60*60*24) > 30";
description = "Uptime monster: {{$labels.instance}} has been up for more than 30 days.";
};
flake_nixpkgs_outdated = {
condition = ''(time() - flake_input_last_modified{input="nixpkgs"}) / (60*60*24) > 30'';
description = "Nixpkgs outdated: Nixpkgs on {{$labels.instance}} has not been updated in 30 days";
};
/*
ping = {
condition = "ping_result_code{type!='mobile'} != 0";
description = "{{$labels.url}}: ping from {{$labels.instance}} has failed!";
};
ping_high_latency = {
condition = "ping_average_response_ms{type!='mobile'} > 5000";
description = "{{$labels.instance}}: ping probe from {{$labels.source}} is encountering high latency!";
};
*/
http_status = {
condition = ''probe_http_status_code{instance!~"https://megaclan3000.de"} != 200'';
description = "http request failed from {{$labels.instance}}: {{$labels.result}}!";
};
/*
http_match_failed = {
condition = "http_response_response_string_match == 0";
description = "{{$labels.server}} : http body not as expected; status code: {{$labels.status_code}}!";
};
dns_query = {
condition = "dns_query_result_code != 0";
description = "{{$labels.domain}} : could retrieve A record {{$labels.instance}} from server {{$labels.server}}: {{$labels.result}}!";
};
secure_dns_query = {
condition = "secure_dns_state != 0";
description = "{{$labels.domain}} : could retrieve A record {{$labels.instance}} from server {{$labels.server}}: {{$labels.result}} for protocol {{$labels.protocol}}!";
};
connection_failed = {
condition = "net_response_result_code != 0";
description = "{{$labels.server}}: connection to {{$labels.port}}({{$labels.protocol}}) failed from {{$labels.instance}}";
};
healthchecks = {
condition = "hc_check_up == 0";
description = "{{$labels.instance}}: healtcheck {{$labels.job}} fails!";
};
*/
cert_expiry = {
condition = "(probe_ssl_earliest_cert_expiry - time())/(3600*24) < 30";
description = "{{$labels.instance}}: The TLS certificate will expire in less than 30 days: {{$value}}s";
};
# ignore devices that disabled S.M.A.R.T (example if attached via USB)
# smart_errors = {
# condition = ''smart_device_health_ok{enabled!="Disabled"} != 1'';
# description =
# "{{$labels.instance}}: S.M.A.R.T reports: {{$labels.device}} ({{$labels.model}}) has errors.";
# };
oom_kills = {
condition = "increase(node_vmstat_oom_kill[5m]) > 0";
description = "{{$labels.instance}}: OOM kill detected";
};
/*
unusual_disk_read_latency = {
condition =
"rate(diskio_read_time[1m]) / rate(diskio_reads[1m]) > 0.1 and rate(diskio_reads[1m]) > 0";
description = ''
{{$labels.instance}}: Disk latency is growing (read operations > 100ms)
'';
};
unusual_disk_write_latency = {
condition =
"rate(diskio_write_time[1m]) / rate(diskio_write[1m]) > 0.1 and rate(diskio_write[1m]) > 0";
description = ''
{{$labels.instance}}: Disk latency is growing (write operations > 100ms)
'';
};
*/
host_memory_under_memory_pressure = {
condition = "rate(node_vmstat_pgmajfault[1m]) > 1000";
description = "{{$labels.instance}}: The node is under heavy memory pressure. High rate of major page faults: {{$value}}";
};
# ext4_errors = {
# condition = "ext4_errors_value > 0";
# description =
# "{{$labels.instance}}: ext4 has reported {{$value}} I/O errors: check /sys/fs/ext4/*/errors_count";
# };
# alerts_silences_changed = {
# condition = ''abs(delta(alertmanager_silences{state="active"}[1h])) >= 1'';
# description =
# "alertmanager: number of active silences has changed: {{$value}}";
# };
})
================================================
FILE: clan-service-modules/monitoring/alertmanager-irc-relay.nix
================================================
{ pkgs, config, ... }:
let
am-irc-conf = {
# listening host/port.
http_host = "localhost";
http_port = 8667;
# Connect to this IRC host/port.
irc_host = "irc.hackint.org";
irc_port = 6697;
# irc_host_password = "myserver_password";
irc_nickname = "alertus-maximus";
irc_nickname_password = "mynickserv_key";
irc_realname = "myrealname";
irc_channels = [ { name = "#lounge-rocks-log"; } ];
msg_once_per_alert_group = false;
# Use PRIVMSG instead of NOTICE (default) to send messages.
use_privmsg = true;
# Define how IRC messages should be formatted.
msg_template = "⚠ ⚠ ⚠ [{{.Labels.instance}}] - {{ .Labels.alertname }} is {{.Status}} ⚠ ⚠ ⚠ {{.Annotations.description}} (@pinpox act accordingly)";
# Note: When sending only one message per alert group the default
# msg_template is set to
# "Alert {{ .GroupLabels.alertname }} for {{ .GroupLabels.job }} is {{ .Status }}"
# Set the internal buffer size for alerts received but not yet sent to IRC.
alert_buffer_size = 2048;
};
confPath = pkgs.writeText "config.yml" (builtins.toJSON am-irc-conf);
in
{
# User and group
users.groups."alertmanager-irc-relay" = { };
users.users."alertmanager-irc-relay" = {
isSystemUser = true;
group = "alertmanager-irc-relay";
};
# Service
systemd.services.alertmanager-irc-relay = {
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${pkgs.alertmanager-irc-relay}/bin/alertmanager-irc-relay --config ${confPath}";
User = config.users.users.alertmanager-irc-relay.name;
Group = config.users.users.alertmanager-irc-relay.name;
};
};
}
================================================
FILE: clan-service-modules/monitoring/blackbox.nix
================================================
{ pkgs, ... }:
{
services.prometheus.exporters.blackbox = {
enable = true;
# Default port is 9115
# Listen on 0.0.0.0, but we only open the firewall for wg-clan
openFirewall = false;
configFile = pkgs.writeTextFile {
name = "blackbox-exporter-config";
text = ''
modules:
http_2xx:
prober: http
timeout: 5s
http:
valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
valid_status_codes: [] # Defaults to 2xx
method: GET
no_follow_redirects: false
fail_if_ssl: false
fail_if_not_ssl: false
tls_config:
insecure_skip_verify: false
preferred_ip_protocol: "ip4" # defaults to "ip6"
ip_protocol_fallback: true # fallback to "ip6"
'';
};
};
networking.firewall.interfaces.wg-clan.allowedTCPPorts = [ 9115 ];
}
================================================
FILE: clan-service-modules/monitoring/default.nix
================================================
{ lib, ... }:
{
_class = "clan.service";
manifest.name = "monitoring";
manifest.description = "Prometheus/Loki/Grafana monitoring stack";
manifest.readme = ''
Self-hosted monitoring with one role per component (prometheus, loki,
grafana, blackbox, node-exporter, alertmanager-irc-relay)
'';
manifest.categories = [ "Monitoring" ];
manifest.exports.out = [ "endpoints" "auth" ];
roles.node-exporter = {
description = "Prometheus node-exporter for host metrics (assign to every host you want scraped)";
perInstance.nixosModule = ./node-exporter.nix;
};
roles.loki = {
description = "Loki log aggregation server";
perInstance.nixosModule = ./loki.nix;
};
roles.grafana = {
description = "Grafana dashboard server";
interface =
{ lib, meta, ... }:
{
options = {
domain = lib.mkOption {
type = lib.types.str;
default = "status.${meta.domain}";
example = "dashboards.example.com";
description = "Domain for grafana";
};
oidc = {
enable = lib.mkEnableOption "OIDC-only authentication (e.g. via Authelia). Disables the local login form.";
issuer = lib.mkOption {
type = lib.types.str;
default = "";
example = "https://auth.example.com";
description = "Base URL of the OIDC provider (Authelia). Used to derive auth/token/userinfo endpoints.";
};
clientId = lib.mkOption {
type = lib.types.str;
default = "grafana";
description = "OIDC client ID registered with the provider";
};
providerName = lib.mkOption {
type = lib.types.str;
default = "Authelia";
description = "Display name shown on the Grafana login button";
};
};
};
};
perInstance =
{
settings,
roles,
meta,
mkExports,
...
}:
let
# TODO The generator shoudl be independeat of authelia or kanidm. Use a dependant one for authelia to create the hash
# TODO maybe we do not need a generato cofig at all, have a default?
# Generator definition without runtimeInputs (pkgs isn't available
# at inventory-eval time). Each nixosModule that declares this
# generator adds runtimeInputs locally where pkgs IS available.
oidcGenerator = lib.optionalAttrs settings.oidc.enable {
share = true;
files.client_secret = {
owner = "grafana";
group = "authelia-main";
mode = "0440";
};
files.client_secret_hash.owner = "authelia-main";
script = ''
mkdir -p $out
openssl rand -hex 32 > $out/client_secret
authelia crypto hash generate argon2 --password "$(cat $out/client_secret)" \
| sed 's/^Digest: //' > $out/client_secret_hash
'';
};
in
{
exports = mkExports (
{ endpoints.hosts = [ settings.domain ]; }
// lib.optionalAttrs settings.oidc.enable {
auth.client = {
clientId = settings.oidc.clientId;
clientName = "Grafana";
redirectUris = [ "https://${settings.domain}/login/generic_oauth" ];
scopes = [
"openid"
"profile"
"email"
"groups"
];
public = false;
};
auth.varsGenerator = oidcGenerator;
}
);
nixosModule = import ./grafana.nix {
inherit settings roles meta oidcGenerator;
};
};
};
roles.blackbox = {
description = "Prometheus blackbox-exporter for HTTP/TLS probes";
perInstance.nixosModule = ./blackbox.nix;
};
roles.alertmanager-irc-relay = {
description = "Relay alertmanager notifications to an IRC channel";
perInstance.nixosModule = ./alertmanager-irc-relay.nix;
};
roles.prometheus = {
description = "Prometheus server (with bundled alertmanager). Discovers node-exporter and blackbox role members automatically.";
interface =
{ lib, meta, ... }:
{
options = {
domain = lib.mkOption {
type = lib.types.str;
default = "prometheus.${meta.domain}";
example = "metrics.example.com";
description = "Domain for the prometheus web UI (reverse proxied via caddy)";
};
blackboxTargets = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ "https://pablo.tools" ];
example = [ "https://github.com" ];
description = "Targets to monitor with the blackbox-exporter";
};
jsonTargets = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
example = [ "http://birne.pin/restic-ahorn.json" ];
description = "Targets to probe with the json-exporter";
};
webExternalUrl = lib.mkOption {
type = lib.types.str;
default = "https://vpn.prometheus.pablo.tools";
description = "Prometheus web external URL";
};
alertmanagerWebExternalUrl = lib.mkOption {
type = lib.types.str;
default = "https://vpn.alerts.pablo.tools";
description = "Alertmanager web external URL";
};
};
};
perInstance =
{
settings,
roles,
meta,
mkExports,
...
}:
let
# oauth2-proxy OIDC generator definition (without runtimeInputs —
# added by each nixosModule where pkgs is available).
# Produces: client_secret (raw), client_secret_hash (argon2 for
# authelia), envfile (oauth2-proxy env with client+cookie secrets).
prometheusOidcGenerator = {
share = true;
files.client_secret = {
owner = "oauth2_proxy";
group = "authelia-main";
mode = "0440";
};
files.client_secret_hash.owner = "authelia-main";
files.envfile = {
owner = "oauth2_proxy";
mode = "0400";
};
script = ''
mkdir -p $out
CLIENT_SECRET=$(openssl rand -hex 32)
COOKIE_SECRET=$(openssl rand -hex 16)
printf '%s' "$CLIENT_SECRET" > $out/client_secret
authelia crypto hash generate argon2 --password "$CLIENT_SECRET" \
| sed 's/^Digest: //' > $out/client_secret_hash
printf 'OAUTH2_PROXY_CLIENT_SECRET=%s\nOAUTH2_PROXY_COOKIE_SECRET=%s\n' \
"$CLIENT_SECRET" "$COOKIE_SECRET" > $out/envfile
'';
};
in
{
exports = mkExports (
{ endpoints.hosts = [ settings.domain ]; }
// {
auth.client = {
clientId = "prometheus";
clientName = "Prometheus";
redirectUris = [ "https://${settings.domain}/oauth2/callback" ];
scopes = [
"openid"
"profile"
"email"
"groups"
];
public = false;
};
auth.varsGenerator = prometheusOidcGenerator;
}
);
nixosModule = import ./prometheus.nix {
inherit settings roles meta prometheusOidcGenerator;
};
};
};
}
================================================
FILE: clan-service-modules/monitoring/grafana.nix
================================================
{ settings, roles, meta, oidcGenerator }:
{ config, lib, pkgs, ... }:
let
prometheusHosts = builtins.attrNames (roles.prometheus.machines or { });
lokiHosts = builtins.attrNames (roles.loki.machines or { });
oidc = settings.oidc;
in
{
# SMTP password file
clan.core.vars.generators."grafana".prompts.smtp-password.persist = true;
# OIDC client secret — declared here so the producing host (where grafana
# runs) has the files. The same generator definition is also exported via
# auth.varsGenerator so the authelia host declares it too (share=true).
# runtimeInputs is added here (not in the export) because pkgs is only
# available inside nixosModule, not at inventory-eval time.
clan.core.vars.generators."authelia-oidc-${oidc.clientId}" = lib.mkIf oidc.enable (
oidcGenerator
// {
runtimeInputs = with pkgs; [
coreutils
openssl
authelia
gnused
];
}
);
# Grafana secret key for signing
clan.core.vars.generators."grafana-secret-key" = {
files."secret-key".owner = "grafana";
runtimeInputs = [ pkgs.openssl ];
script = ''
openssl rand -hex 32 > "$out/secret-key"
'';
};
# Backup Graphana dir, contains stateful config
pinpox.services.restic-client.backup-paths-offsite = [ "/var/lib/grafana" ];
# Reverse proxy
services.caddy = {
enable = true;
virtualHosts."${settings.domain}".extraConfig = "reverse_proxy 127.0.0.1:9005";
};
# Graphana fronend
services.grafana = {
enable = true;
settings = {
server = {
domain = settings.domain;
root_url = "https://${settings.domain}/";
# Default is 3000
http_port = 9005;
http_addr = "127.0.0.1";
};
security.secret_key = "$__file{${config.clan.core.vars.generators."grafana-secret-key".files."secret-key".path}}";
# Mail notifications
smtp = {
enabled = true;
host = "smtp.sendgrid.net:587";
user = "apikey";
passwordFile = "${config.clan.core.vars.generators."grafana".files."smtp-password".path}";
fromAddress = "status@pablo.tools";
};
}
// lib.optionalAttrs oidc.enable {
# SCIM is enabled by default in recent Grafana versions and intercepts
# OIDC user provisioning, causing "Failed to create user: user not
# found". Disable it so the standard generic_oauth flow can create users.
feature_toggles.enableSCIM = false;
# OIDC-only login: hide the username/password form, do not auto-create
# local users via signup, redirect straight to the OIDC provider.
auth = {
disable_login_form = true;
signout_redirect_url = "${oidc.issuer}/logout";
# Self-healing OIDC user linking: if user_auth has no row for the
# OIDC subject (e.g. fresh DB restore, or Authelia rebuilt and the
# sub UUID changed), Grafana falls back to matching by email and
# auto-creates the user_auth link. Safe here because Authelia is a
# fully trusted IdP we control.
oauth_allow_insecure_email_lookup = true;
};
users = {
# Must be true so the OIDC provisioning path can create new users.
# disable_login_form = true (above) already prevents the local signup
# form from being rendered, so this only enables OIDC-initiated signup.
allow_sign_up = true;
auto_assign_org = true;
auto_assign_org_role = "Admin";
};
"auth.generic_oauth" = {
enabled = true;
name = oidc.providerName;
icon = "signin";
auto_login = true;
client_id = oidc.clientId;
client_secret = "$__file{${config.clan.core.vars.generators."authelia-oidc-${oidc.clientId}".files.client_secret.path}}";
scopes = "openid profile email groups";
empty_scopes = false;
auth_url = "${oidc.issuer}/api/oidc/authorization";
token_url = "${oidc.issuer}/api/oidc/token";
api_url = "${oidc.issuer}/api/oidc/userinfo";
login_attribute_path = "preferred_username";
email_attribute_path = "email";
name_attribute_path = "name";
groups_attribute_path = "groups";
# Authelia already restricts who can reach the client via its
# authorization policy, so anyone who successfully logs in is granted
# Admin in Grafana.
role_attribute_path = "'Admin'";
allow_sign_up = true;
use_pkce = true;
};
};
# TODO provision the dashboards as currently configured
provision.datasources.settings = {
datasources =
lib.optional (prometheusHosts != [ ]) {
name = "Prometheus";
url = "http://${builtins.head prometheusHosts}.${meta.domain}:9090";
type = "prometheus";
isDefault = true;
}
++ lib.optional (lokiHosts != [ ]) {
name = "loki";
url = "http://${builtins.head lokiHosts}.${meta.domain}:3100";
type = "loki";
};
};
};
}
================================================
FILE: clan-service-modules/monitoring/loki.nix
================================================
{ ... }:
let
port-loki = 3100;
in
{
pinpox.services.restic-client.backup-paths-exclude = [ "/var/lib/loki" ];
networking.firewall = {
enable = true;
interfaces.wg-clan.allowedTCPPorts = [ port-loki ];
};
services.loki = {
enable = true;
configuration = {
auth_enabled = false;
server.http_listen_port = port-loki;
ingester = {
lifecycler = {
address = "0.0.0.0";
ring = {
kvstore.store = "inmemory";
replication_factor = 1;
};
final_sleep = "0s";
};
# Any chunk not receiving new logs in this time will be flushed
chunk_idle_period = "1h";
# All chunks will be flushed when they hit this age, default is 1h
max_chunk_age = "1h";
# Loki will attempt to build chunks up to 1.5MB, flushing first if
# chunk_idle_period or max_chunk_age is reached first
chunk_target_size = 1048576;
# Must be greater than index read cache TTL if using an index cache (Default
# index read cache TTL is 5m)
chunk_retain_period = "30s";
};
schema_config.configs = [
{
from = "2020-10-24";
store = "boltdb-shipper";
object_store = "filesystem";
schema = "v13";
index = {
prefix = "index_";
period = "24h";
};
}
];
storage_config = {
boltdb_shipper = {
active_index_directory = "/var/lib/loki/boltdb-shipper-active";
cache_location = "/var/lib/loki/boltdb-shipper-cache";
# Can be increased for faster performance over longer query periods,
# uses more disk space
cache_ttl = "24h";
};
filesystem.directory = "/var/lib/loki/chunks";
};
limits_config = {
reject_old_samples = true;
reject_old_samples_max_age = "168h";
allow_structured_metadata = false;
};
table_manager = {
retention_deletes_enabled = false;
retention_period = "0s";
};
compactor.working_directory = "/var/lib/loki/boltdb-shipper-compactor";
};
};
}
================================================
FILE: clan-service-modules/monitoring/node-exporter.nix
================================================
{ ... }:
{
services.prometheus.exporters.node = {
enable = true;
# Default port is 9100
# Listen on 0.0.0.0, but we only open the firewall for wg-clan
openFirewall = false;
enabledCollectors = [
"cgroups"
"systemd"
];
extraFlags = [ "--collector.textfile.directory=/etc/nix" ];
};
networking.firewall.interfaces.wg-clan.allowedTCPPorts = [ 9100 ];
}
================================================
FILE: clan-service-modules/monitoring/prometheus.nix
================================================
{ settings, roles, meta, prometheusOidcGenerator }:
{
lib,
pkgs,
config,
flake-self,
pinpox-utils,
...
}:
let
nodeExporterHosts = builtins.attrNames (roles."node-exporter".machines or { });
in
{
clan.core.vars.generators."restic-exporter" = pinpox-utils.mkEnvGenerator [
"RESTIC_PASSWORD"
"AWS_ACCESS_KEY_ID"
"AWS_SECRET_ACCESS_KEY"
"RESTIC_REPOSITORY"
];
# OIDC client secret generator — declared here so the producing host has the
# files. The same definition is exported via auth.varsGenerator so the
# authelia host also declares it (share=true). runtimeInputs added here
# because pkgs isn't available at inventory-eval time.
clan.core.vars.generators."authelia-oidc-prometheus" = prometheusOidcGenerator // {
runtimeInputs = with pkgs; [
coreutils
openssl
authelia
gnused
];
};
# oauth2-proxy sits between Caddy and Prometheus and handles the OIDC
# client flow against Authelia. Prometheus itself stays on 127.0.0.1:9090
# (loopback only); the only way to reach it is through oauth2-proxy on
# 127.0.0.1:4180, which Caddy reverse-proxies as ${settings.domain}.
services.oauth2-proxy = {
enable = true;
provider = "oidc";
clientID = "prometheus";
keyFile = config.clan.core.vars.generators."authelia-oidc-prometheus".files.envfile.path;
oidcIssuerUrl = "https://auth.pablo.tools";
redirectURL = "https://${settings.domain}/oauth2/callback";
upstream = [ "http://127.0.0.1:9090" ];
httpAddress = "http://127.0.0.1:4180";
cookie.secure = true;
cookie.refresh = "1h";
email.domains = [ "*" ];
setXauthrequest = true;
reverseProxy = true;
extraConfig = {
skip-provider-button = true;
# Authelia's prometheus client is registered with require_pkce = true,
# so oauth2-proxy must send a PKCE code_challenge on the authorize
# request and the matching verifier on the token exchange.
code-challenge-method = "S256";
# Authelia's authorization_policies already restrict who can reach this
# client; oauth2-proxy doesn't need to enforce its own allowlist.
};
};
# Reverse proxy for the prometheus web UI. The pki clan service auto-issues
# a TLS cert for ${settings.domain} and prepends a `tls` directive to this
# vhost; dm-dns distributes a CNAME so any clan-internal host can resolve
# it. Caddy hands traffic to oauth2-proxy, which performs the OIDC dance
# against Authelia and (if authorized) proxies upstream to Prometheus.
services.caddy = {
enable = true;
virtualHosts."${settings.domain}".extraConfig = "reverse_proxy 127.0.0.1:4180";
};
services.prometheus = {
enable = true;
# Bind to localhost only — defense in depth on top of the host firewall.
# The only way in from outside the host is via Caddy → oauth2-proxy →
# 127.0.0.1:9090.
listenAddress = "127.0.0.1";
# Disable config checks. They will fail because they run sandboxed and
# can't access external files, e.g. the secrets stored in /run/keys
# https://github.com/NixOS/nixpkgs/blob/d89d7af1ba23bd8a5341d00bdd862e8e9a808f56/nixos/modules/services/monitoring/prometheus/default.nix#L1732-L1738
checkConfig = false;
webExternalUrl = settings.webExternalUrl;
extraFlags = [
"--log.level=debug"
"--storage.tsdb.retention.size='6GB'"
];
ruleFiles = [
(pkgs.writeText "prometheus-rules.yml" (
builtins.toJSON {
groups = [
{
name = "alerting-rules";
rules = import ./alert-rules.nix { inherit lib meta; };
}
];
}
))
];
alertmanagers = [ { static_configs = [ { targets = [ "localhost:9093" ]; } ]; } ];
scrapeConfigs = [
{
job_name = "backup-reports";
scrape_interval = "60m";
metrics_path = "/probe";
static_configs = [ { targets = settings.jsonTargets; } ];
relabel_configs = [
{
source_labels = [ "__address__" ];
target_label = "__param_target";
}
{
source_labels = [ "__param_target" ];
target_label = "instance";
}
{
target_label = "__address__";
replacement = "127.0.0.1:7979"; # The blackbox exporter's real hostname:port.
}
];
}
# TODO: move restic-client to a clan service so this can be discovered
# via roles..machines instead of filtering flake-self.
{
job_name = "restic-exporter";
scrape_interval = "1h";
metrics_path = "/probe";
static_configs = [
{
targets = (
builtins.attrNames (
lib.filterAttrs (
n: v: v.config.pinpox.services.restic-client.enable
) flake-self.nixosConfigurations
)
);
}
];
relabel_configs = [
{
source_labels = [ "__address__" ];
target_label = "__param_target";
}
{
source_labels = [ "__param_target" ];
target_label = "instance";
}
{
target_label = "__address__";
replacement = "127.0.0.1:${builtins.toString config.services.restic-exporter.port}";
}
];
}
{
job_name = "blackbox";
scrape_interval = "2m";
metrics_path = "/probe";
params = {
module = [ "http_2xx" ];
};
static_configs = [ { targets = settings.blackboxTargets; } ];
relabel_configs = [
{
source_labels = [ "__address__" ];
target_label = "__param_target";
}
{
source_labels = [ "__param_target" ];
target_label = "instance";
}
{
target_label = "__address__";
replacement = "127.0.0.1:9115"; # The blackbox exporter's real hostname:port.
}
];
}
{
job_name = "node-stats";
static_configs = [
{
# Hosts assigned the "node-exporter" role of this monitoring instance
targets = map (h: "${h}.${meta.domain}:9100") nodeExporterHosts;
}
];
}
];
alertmanager = {
enable = true;
# port = 9093; # Default
listenAddress = "127.0.0.1";
webExternalUrl = settings.alertmanagerWebExternalUrl;
environmentFile = /var/src/secrets/alertmanager/envfile;
configuration = {
route = {
receiver = "all";
group_by = [ "instance" ];
group_wait = "30s";
group_interval = "2m";
repeat_interval = "24h";
};
receivers = [
{
name = "all";
webhook_configs = [
{ url = "http://127.0.0.1:11000/alert"; } # matrix-hook
{ url = with config.services.alertmanager-ntfy; "http://${httpAddress}:${httpPort}"; } # alertmanger-ntfy
];
}
];
};
};
};
}
================================================
FILE: clan-service-modules/navidrome.nix
================================================
{ ... }:
{
_class = "clan.service";
manifest.name = "navidrome";
manifest.description = "Navidrome music streaming server";
manifest.readme = "Self-hosted music streaming server with subsonic API";
manifest.categories = [ "Media" ];
manifest.exports.out = [ "endpoints" ];
roles.default = {
description = "Sets up navidrome music server with caddy reverse proxy";
interface =
{ lib, meta, ... }:
{
options = {
host = lib.mkOption {
type = lib.types.str;
default = "music.${meta.domain}";
description = "Host serving the navidrome instance";
example = "party.0cx.de";
};
};
};
perInstance =
{
settings,
mkExports,
...
}:
{
exports = mkExports { endpoints.hosts = [ settings.host ]; };
nixosModule =
{ config, ... }:
{
config = {
# Reverse proxy
services.caddy = {
enable = true;
virtualHosts."${settings.host}".extraConfig =
"reverse_proxy 127.0.0.1:${toString config.services.navidrome.settings.Port}";
};
# Mount storagebox
pinpox.defaults.storagebox = {
enable = true;
mountOnAccess = false;
};
# Add navidrome user to storage-users group for access to storagebox
users.users.navidrome.extraGroups = [ "storage-users" ];
# Set up navidrome
services.navidrome = {
enable = true;
settings.Port = 4533;
settings.Address = "127.0.0.1";
settings.MusicFolder = "${config.pinpox.defaults.storagebox.mountPoint}/music";
};
# Ensure storagebox is mounted before navidrome starts
systemd.services.navidrome = {
requires = [ "mnt-storagebox.mount" ];
after = [ "mnt-storagebox.mount" ];
};
};
};
};
};
}
================================================
FILE: clan-service-modules/thelounge.nix
================================================
{ ... }:
{
_class = "clan.service";
manifest.name = "thelounge";
manifest.description = "The Lounge IRC client and bouncer";
manifest.readme = "Self-hosted IRC client and bouncer with web interface";
manifest.categories = [ "Communication" ];
manifest.exports.out = [ "endpoints" ];
roles.default = {
description = "Sets up The Lounge IRC client with caddy reverse proxy";
interface =
{ lib, meta, ... }:
{
options = {
host = lib.mkOption {
type = lib.types.str;
default = "irc.${meta.domain}";
description = "Host serving the The Lounge instance.";
};
};
};
perInstance =
{
settings,
mkExports,
...
}:
{
exports = mkExports { endpoints.hosts = [ settings.host ]; };
nixosModule =
{ config, ... }:
{
config = {
# Reverse proxy
services.caddy = {
enable = true;
virtualHosts."${settings.host}".extraConfig =
"reverse_proxy 127.0.0.1:${toString config.services.thelounge.port}";
};
# Set up The Lounge
services.thelounge = {
enable = true;
port = 9090;
public = false;
extraConfig = {
host = "127.0.0.1";
reverseProxy = true;
storagePolicy = {
enabled = true;
maxAgeDays = 365;
deletionPolicy = "everything";
};
theme = "morning";
};
};
# Backup paths
pinpox.services.restic-client.backup-paths-offsite = [
"/var/lib/thelounge/certificates"
"/var/lib/thelounge/config.js"
# Don't backup logs for now - too big.
# "/var/lib/thelounge/logs"
# "/var/lib/thelounge/packages"
"/var/lib/thelounge/sts-policies.json"
"/var/lib/thelounge/users"
"/var/lib/thelounge/vapid.json"
];
};
};
};
};
}
================================================
FILE: flake.nix
================================================
{
description = "My machines";
inputs = {
wrappers.url = "github:lassulus/wrappers";
wrappers.inputs.nixpkgs.follows = "nixpkgs";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable?shallow=1";
clan-core.url = "https://git.clan.lol/clan/clan-core/archive/main.tar.gz";
clan-core.inputs.nixpkgs.follows = "nixpkgs";
clan-core.inputs.disko.follows = "disko";
clan-core.inputs.data-mesher.follows = "data-mesher";
data-mesher.url = "git+https://git.clan.lol/clan/data-mesher";
data-mesher.inputs.nixpkgs.follows = "nixpkgs";
clan-community.url = "https://git.clan.lol/clan/clan-community/archive/main.tar.gz";
clan-community.inputs.clan-core.follows = "clan-core";
clan-community.inputs.nixpkgs.follows = "nixpkgs";
rio.url = "github:pinpox/rio";
rio.inputs.nixpkgs.follows = "nixpkgs";
rio.inputs.systems.follows = "clan-core/systems";
khard.url = "github:lucc/khard";
khard.inputs.nixpkgs.follows = "nixpkgs";
gif-searcher.url = "github:pinpox/gif-searcher";
gif-searcher.inputs.nixpkgs.follows = "nixpkgs";
nix-index-database.url = "github:nix-community/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
disko.url = "github:nix-community/disko/latest";
disko.inputs.nixpkgs.follows = "nixpkgs";
jitsi-matrix-presence.url = "github:pinpox/jitsi-matrix-presence";
jitsi-matrix-presence.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
aoe-taunt-discord-bot.url = "github:pinpox/aoe-taunt-discord-bot";
aoe-taunt-discord-bot.inputs.nixpkgs.follows = "nixpkgs";
pinpox-keys.url = "https://github.com/pinpox.keys";
pinpox-keys.flake = false;
pinpox-neovim.url = "github:pinpox/pinpox-neovim";
pinpox-neovim.inputs.nixpkgs.follows = "nixpkgs";
radio.url = "github:pinpox/radio";
radio.inputs.nixpkgs.follows = "nixpkgs";
mc3000.url = "github:pinpox/mc3000";
mc3000.inputs.nixpkgs.follows = "nixpkgs";
naersk.url = "github:nix-community/naersk/master";
naersk.inputs.nixpkgs.follows = "nixpkgs";
promterm.url = "github:pinpox/promterm";
promterm.inputs = {
nixpkgs.follows = "nixpkgs";
naersk.follows = "naersk";
};
go-karma-bot.url = "github:pinpox/go-karma-bot";
go-karma-bot.inputs.nixpkgs.follows = "nixpkgs";
retiolum.url = "git+https://git.thalheim.io/Mic92/retiolum";
retiolum.inputs.nixpkgs.follows = "nixpkgs";
flake-compat.url = "github:edolstra/flake-compat";
flake-compat.flake = false;
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
distro.url = "path:/home/pinpox/code/github.com/generational-infrastructure/distro";
distro.inputs.nixpkgs.follows = "nixpkgs";
distro.inputs.opencrow.follows = "opencrow";
distro.inputs.treefmt-nix.follows = "treefmt-nix";
nur.url = "github:pinpox/NUR";
nur.inputs.nixpkgs.follows = "nixpkgs";
nur.inputs.flake-parts.follows = "clan-core/flake-parts";
wl-harmonograph.url = "github:pinpox/wl-harmonograph";
wl-harmonograph.inputs.nixpkgs.follows = "nixpkgs";
restic-exporter.url = "github:pinpox/restic-exporter";
restic-exporter.inputs.nixpkgs.follows = "nixpkgs";
restic-exporter.inputs.flake-utils.follows = "age-plugin-picohsm/flake-utils";
alertmanager-ntfy = {
url = "github:pinpox/alertmanager-ntfy";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-compat.follows = "flake-compat";
flake-utils.follows = "age-plugin-picohsm/flake-utils";
};
};
matrix-hook.url = "github:pinpox/matrix-hook";
matrix-hook.inputs = {
nixpkgs.follows = "nixpkgs";
flake-compat.follows = "flake-compat";
flake-utils.follows = "age-plugin-picohsm/flake-utils";
};
# ZSH plugins
zsh-abbrev-alias.url = "github:momo-lab/zsh-abbrev-alias";
zsh-abbrev-alias.flake = false;
zsh-colored-man-pages.url = "github:ael-code/zsh-colored-man-pages";
zsh-colored-man-pages.flake = false;
jj-zsh-prompt.url = "github:pinpox/jj-zsh-prompt";
jj-zsh-prompt.inputs.nixpkgs.follows = "nixpkgs";
zsh-async.url = "github:mafredri/zsh-async";
zsh-async.flake = false;
nix-apple-fonts = {
url = "github:pinpox/nix-apple-fonts";
inputs.flake-compat.follows = "flake-compat";
inputs.flake-utils.follows = "age-plugin-picohsm/flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
treefmt-nix.follows = "clan-core/treefmt-nix";
age-plugin-picohsm.url = "github:pinpox/age-plugin-picohsm";
age-plugin-picohsm.inputs.nixpkgs.follows = "nixpkgs";
passage-secret-service.url = "github:pinpox/passage-secret-service";
passage-secret-service.inputs.nixpkgs.follows = "nixpkgs";
llm-agents.url = "github:numtide/llm-agents.nix";
llm-agents.inputs.nixpkgs.follows = "nixpkgs";
llm-agents.inputs.treefmt-nix.follows = "treefmt-nix";
opencrow.url = "github:pinpox/opencrow";
opencrow.inputs.nixpkgs.follows = "nixpkgs";
opencrow.inputs.treefmt-nix.follows = "treefmt-nix";
mics-skills.url = "github:Mic92/mics-skills";
mics-skills.inputs.nixpkgs.follows = "nixpkgs";
mics-skills.inputs.treefmt-nix.follows = "treefmt-nix";
twitch-first.url = "github:pinpox/twitch-first";
twitch-first.inputs.nixpkgs.follows = "nixpkgs";
trippy-track.url = "github:pinpox/trippy-track";
trippy-track.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{ self, ... }@inputs:
with inputs;
let
# System types to support.
supportedSystems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
# Nixpkgs instantiated for supported system types.
nixpkgsFor = forAllSystems (
system:
import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
}
);
# treefmt configuration
treefmtEval = import ./formatter.nix { inherit treefmt-nix nixpkgsFor forAllSystems; };
clan = clan-core.lib.clan {
# this needs to point at the repository root
inherit self;
# Vars backend configuration (moved from machine-level)
vars.settings.secretStore = "password-store";
# Make inputs and the flake itself accessible as module parameters.
# Technically, adding the inputs is redundant as they can be also
# accessed with flake-self.inputs.X, but adding them individually
# allows to only pass what is needed to each module.
specialArgs = {
flake-self = self;
}
// inputs;
# Register custom clan service modules
# desktop, localsend, wireguard-star moved to clan-community
modules."@pinpox/navidrome" = ./clan-service-modules/navidrome.nix;
modules."@pinpox/thelounge" = ./clan-service-modules/thelounge.nix;
modules."@pinpox/machine-type" = ./clan-service-modules/machine-type;
modules."@pinpox/monitoring" = ./clan-service-modules/monitoring;
inventory = import ./inventory.nix { inherit self; };
};
in
{
devShells = forAllSystems (
system: with nixpkgsFor.${system}; {
default = pkgs.mkShell {
packages = [
clan-core.packages.${system}.clan-cli
treefmtEval.${system}.config.build.wrapper
];
};
}
);
# Custom packages added via the overlay are selectively exposed here, to
# allow using them from other flakes that import this one.
packages =
forAllSystems (
system: with nixpkgsFor.${system}; {
inherit
hello-custom
fritzbox_exporter
mqtt2prometheus
smartmon-script
machine-report
woodpecker-pipeline
manual
;
}
)
// {
# Flashable SD card image for uconsole (uses binfmt emulation)
# Build with: nix build .#uconsole-image
# Then flash with: dd if=result/main.raw of=/dev/sdX bs=4M status=progress
# Build the image on the remote server
# ssh root@build01.clan.lol \
# 'nix build github:pinpox/nixos#packages.aarch64-linux.uconsole-image -L'
# Download image (compressed)
# ssh root@build01.clan.lol \
# 'zstd -c \
# $(nix build github:pinpox/nixos#packages.aarch64-linux.uconsole-image --print-out-paths)/main.raw' > \
# uconsole.img.zst
# Decompress
# zstd -d uconsole.img.zst
aarch64-linux = (forAllSystems (s: { })).aarch64-linux // {
uconsole-image = self.nixosConfigurations.uconsole.config.system.build.diskoImages;
};
};
# Expose overlay to flake outputs, to allow using it from other flakes.
# Flake inputs are passed to the overlay so that the packages defined in
# it can use the sources pinned in flake.lock
overlays.default = final: prev: (import ./overlays inputs self pinpox-utils) final prev;
# Use treefmt for 'nix fmt'
formatter = forAllSystems (system: treefmtEval.${system}.config.build.wrapper);
# Expose treefmt check for CI
checks = forAllSystems (system: {
formatting = treefmtEval.${system}.config.build.check self;
});
# Machine toplevels for CI builds and cache pushing
ciBuilds = forAllSystems (
system:
nixpkgs.lib.mapAttrs' (
name: config:
nixpkgs.lib.nameValuePair name config.config.system.build.toplevel
) (nixpkgs.lib.filterAttrs (_: config: config.pkgs.stdenv.hostPlatform.system == system) self.nixosConfigurations)
);
# Each subdirectory in ./templates/ is a
# template, which can be used for new proects with:
# `nix flake init`
templates = builtins.listToAttrs (
map (name: {
inherit name;
value = {
path = ./templates + "/${name}";
description = (import (./templates + "/${name}/flake.nix")).description;
};
}) (builtins.attrNames (builtins.readDir ./templates))
);
# Output all modules in ./modules/ to flake. Modules should be in
# individual subdirectories and contain a default.nix file.
# Each subdirectory in ./modules/ is a nixos module
nixosModules = builtins.listToAttrs (
map (name: {
inherit name;
value = import (./modules + "/${name}");
}) (builtins.attrNames (builtins.readDir ./modules))
);
# Each subdirectory in ./machines/ is a host config. Clan
# auto-imports all machines from ./machines
inherit (clan.config) clanInternals;
nixosConfigurations = clan.config.nixosConfigurations;
clan = clan.config;
# Each subdirectory in ./home-manager/profiles/ is a
# home-manager profile
homeConfigurations = builtins.listToAttrs (
map
(name: {
inherit name;
value =
{ ... }:
{
imports = [
(./home-manager/profiles + "/${name}")
]
++ (builtins.attrValues self.homeManagerModules);
};
})
(
builtins.attrNames (
nixpkgs.lib.filterAttrs (n: v: v == "directory") (builtins.readDir ./home-manager/profiles)
)
)
);
# Each subdirectory in ./home-manager/modules/ is a
# home-manager module
homeManagerModules = builtins.listToAttrs (
map (name: {
inherit name;
value = import (./home-manager/modules + "/${name}");
}) (builtins.attrNames (builtins.readDir ./home-manager/modules))
);
};
}
================================================
FILE: formatter.nix
================================================
{
treefmt-nix,
nixpkgsFor,
forAllSystems,
}:
forAllSystems (
system:
treefmt-nix.lib.evalModule nixpkgsFor.${system} {
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
flake-edit.enable = true;
nixfmt.package = nixpkgsFor.${system}.nixfmt;
prettier.enable = true;
shellcheck.enable = true;
shfmt.enable = true;
};
settings.formatter = {
prettier.includes = [
"*.md"
"*.yaml"
"*.yml"
"*.json"
"*.toml"
];
shellcheck.includes = [ "*.sh" ];
shfmt.includes = [ "*.sh" ];
};
}
)
================================================
FILE: home-manager/colorscheme.nix
================================================
{ lib, ... }:
with lib;
let
colornames = [
"Black"
"BrightBlack"
"White"
"BrightWhite"
"Yellow"
"BrightYellow"
"Green"
"BrightGreen"
"Cyan"
"BrightCyan"
"Blue"
"BrightBlue"
"Magenta"
"BrightMagenta"
"Red"
"BrightRed"
];
in
{
options.pinpox.colors = builtins.listToAttrs (
map (c: {
name = c;
value = mkOption { type = types.str; };
}) colornames
);
config.pinpox.colors = {
Black = "000000"; # 000000
BrightBlack = "262626"; # 262626
White = "d0d0d0"; # d0d0d0
BrightWhite = "ffffff"; # ffffff
Red = "d7005f"; # d7005f
BrightRed = "ff5f87"; # ff5f87
Green = "00af5f"; # 00af5f
BrightGreen = "00d75f"; # 00d75f
Yellow = "d78700"; # d78700
BrightYellow = "ffaf00"; # ffaf00
Blue = "0087d7"; # 0087d7
BrightBlue = "00afff"; # 00afff
Magenta = "d787d7"; # d787d7
BrightMagenta = "ff87ff"; # ff87ff
Cyan = "00afaf"; # 00afaf
BrightCyan = "00d7d7"; # 00d7d7
};
}
================================================
FILE: home-manager/modules/audio-recording/default.nix
================================================
{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.pinpox.defaults.audio-recording;
plugins = with pkgs; [
# Instruments
x42-avldrums
zynaddsubfx
# Effects
calf
lsp-plugins
zam-plugins
talentedhack
gxplugins-lv2
distrho
];
in
{
# These settings yield 10ms@1024 spls latency in reaper for me:
# pw-metadata -n settings 0 clock.force-quantum 1024
# pw-metadata -n settings 0 clock.force-rate 96000
options.pinpox.defaults.audio-recording.enable =
mkEnableOption "audio production setup (DAW and plugins)";
config = mkIf cfg.enable {
home.packages =
with pkgs;
[
reaper
alsa-scarlett-gui
]
# Some plugins also have a binary, so we also add them to PATH
++ plugins;
# Place vst, vst3, clap, lv2 and ladspa plugins in the according
# directories where reaper will look for them
home.file =
let
all-audio-plugins = pkgs.symlinkJoin {
name = "all-audio-plugins";
paths = plugins;
};
in
{
all-lv2 = {
recursive = true;
source = "${all-audio-plugins}/lib/lv2";
target = ".lv2";
};
all-clap = {
recursive = true;
source = "${all-audio-plugins}/lib/clap";
target = ".clap";
};
all-vst = {
recursive = true;
source = "${all-audio-plugins}/lib/vst";
target = ".vst";
};
all-vst3 = {
recursive = true;
source = "${all-audio-plugins}/lib/vst3";
target = ".vst3";
};
all-ladspa = {
recursive = true;
source = "${all-audio-plugins}/lib/ladspa";
target = ".ladspa";
};
};
};
}
================================================
FILE: home-manager/modules/calendar/default.nix
================================================
{
config,
lib,
pkgs,
flake-inputs,
...
}:
with lib;
let
cfg = config.pinpox.defaults.calendar;
in
{
options.pinpox.defaults.calendar.enable = mkEnableOption "Calendar config";
config = mkIf cfg.enable {
programs.vdirsyncer.enable = true;
services.vdirsyncer.enable = true;
programs.khal.enable = true;
programs.khal.settings = {
default.default_calendar = "Kalender";
# view = {
# agenda_event_format = "{calendar-color}{cancelled}{start-end-time-style} {title}{repeat-symbol}{reset}";
# };
};
programs.khard.enable = true;
programs.khard.package = flake-inputs.khard.packages."x86_64-linux".default;
# khard.settings is broken, it does not support subsections, so we write
# the file directly
xdg.configFile."khard/khard.conf".source = pkgs.writeTextFile {
name = "khard.conf";
text = ''
[addressbooks]
[[mailbox]]
path = ~/.local/share/office/contacts/mailbox/*
type = discover
[[gmail]]
path = ~/.local/share/office/contacts/gmail/*
type = discover
[[nextcloud]]
path = ~/.local/share/office/contacts/nextcloud/*
type = discover
[general]
debug = no
default_action = list
# These are either strings or comma seperated lists
editor = nvim, -i, NONE
merge_editor = nvim, -d
'';
};
accounts.contact.accounts = {
"nextcloud" = {
vdirsyncer = {
enable = true;
collections = [
"from a"
"from b"
];
metadata = [
"color"
"displayname"
];
userNameCommand = [
"${pkgs.passage}/bin/passage"
"vdirsyncer-nextcloud-user"
];
};
remote = {
type = "carddav";
url = "https://files.pablo.tools";
passwordCommand = [
"${pkgs.passage}/bin/passage"
"vdirsyncer-nextcloud"
];
};
local = {
type = "filesystem";
path = "/home/pinpox/.local/share/office/contacts/nextcloud";
};
};
"mailbox" = {
vdirsyncer = {
enable = true;
collections = [
"from a"
"from b"
];
metadata = [
"color"
"displayname"
];
userNameCommand = [
"${pkgs.passage}/bin/passage"
"vdirsyncer-mailbox-user"
];
};
remote = {
type = "carddav";
url = "https://dav.mailbox.org/carddav/";
passwordCommand = [
"${pkgs.passage}/bin/passage"
"vdirsyncer-mailbox"
];
};
local = {
type = "filesystem";
path = "/home/pinpox/.local/share/office/contacts/mailbox";
};
};
"gmail" = {
vdirsyncer = {
enable = true;
collections = [
"from a"
"from b"
];
metadata = [
"color"
"displayname"
];
clientIdCommand = [
"${pkgs.passage}/bin/passage"
"vdirsyncer-gmail-clientid"
];
clientSecretCommand = [
"${pkgs.passage}/bin/passage"
"vdirsyncer-gmail-clientsecret"
];
tokenFile = "/home/pinpox/.local/share/vdirsyncer-contacts-gmail-token";
};
remote = {
type = "google_contacts";
};
local = {
type = "filesystem";
path = "/home/pinpox/.local/share/office/contacts/gmail";
};
};
};
accounts.calendar.accounts = {
"nextcloud" = {
khal = {
enable = true;
type = "discover";
priority = 1;
};
vdirsyncer = {
enable = true;
collections = [
"from a"
"from b"
];
metadata = [
"color"
"displayname"
];
userNameCommand = [
"${pkgs.passage}/bin/passage"
"vdirsyncer-nextcloud-user"
];
};
remote = {
type = "caldav";
url = "https://files.pablo.tools/";
passwordCommand = [
"${pkgs.passage}/bin/passage"
"vdirsyncer-nextcloud"
];
};
local = {
type = "filesystem";
path = "/home/pinpox/.local/share/office/calendars/nextcloud";
};
};
"mailbox" = {
khal = {
enable = true;
type = "discover";
priority = 1;
};
vdirsyncer = {
enable = true;
collections = [
"from a"
"from b"
];
metadata = [
"color"
"displayname"
];
userNameCommand = [
"${pkgs.passage}/bin/passage"
"vdirsyncer-mailbox-user"
];
};
remote = {
type = "caldav";
url = "https://dav.mailbox.org/caldav/";
passwordCommand = [
"${pkgs.passage}/bin/passage"
"vdirsyncer-mailbox"
];
};
local = {
type = "filesystem";
path = "/home/pinpox/.local/share/office/calendars/mailbox";
};
};
"icloud" = {
khal = {
enable = true;
type = "discover";
priority = 2;
};
vdirsyncer = {
enable = true;
collections = [
"from a"
"from b"
];
metadata = [
"color"
"displayname"
];
userNameCommand = [
"${pkgs.passage}/bin/passage"
"vdirsyncer-icloud-user"
];
};
remote = {
type = "caldav";
url = "https://caldav.icloud.com/";
passwordCommand = [
"${pkgs.passage}/bin/passage"
"vdirsyncer-icloud"
];
};
local = {
type = "filesystem";
path = "/home/pinpox/.local/share/office/calendars/icloud";
};
};
"gmail" = {
khal = {
enable = true;
type = "discover";
priority = 3;
};
vdirsyncer = {
enable = true;
collections = [
"from a"
"from b"
];
metadata = [
"color"
"displayname"
];
clientIdCommand = [
"${pkgs.passage}/bin/passage"
"vdirsyncer-gmail-clientid"
];
clientSecretCommand = [
"${pkgs.passage}/bin/passage"
"vdirsyncer-gmail-clientsecret"
];
tokenFile = "/home/pinpox/.local/share/vdirsyncer-calendar-gmail-token";
};
remote = {
type = "google_calendar";
};
local = {
type = "filesystem";
path = "/home/pinpox/.local/share/office/calendars/gmail";
};
};
};
};
}
================================================
FILE: home-manager/modules/chromium/default.nix
================================================
{ config, lib, ... }:
with lib;
let
cfg = config.pinpox.programs.chromium;
in
{
options.pinpox.programs.chromium.enable = mkEnableOption "chromium browser";
config = mkIf cfg.enable {
programs.chromium = {
enable = true;
extensions = [
{ id = "nngceckbapebfimnlniiiahkandclblb"; } # Bitwarden
{ id = "cjpalhdlnbpafiamejdnhcphjbkeiagm"; } # Ublock Origin
{ id = "gcbommkclmclpchllfjekcdonpmejbdp"; } # HTTPS everywhere
{ id = "mmpokgfcmbkfdeibafoafkiijdbfblfg"; } # Merge windows
{ id = "agldajbhchobfgjcmmigehfdcjbmipne"; } # Blank Dark New Tab
];
};
};
}
================================================
FILE: home-manager/modules/claude-code/default.nix
================================================
{
pkgs,
config,
lib,
flake-self,
...
}:
with lib;
let
cfg = config.pinpox.programs.claude-code;
mics-skills = flake-self.inputs.mics-skills;
mics-packages = mics-skills.packages.${pkgs.stdenv.hostPlatform.system};
firefoxPrefs = {
"xpinstall.signatures.required" = false;
"extensions.autoDisableScopes" = 0;
"extensions.enabledScopes" = 15;
"browser.shell.checkDefaultBrowser" = false;
"datareporting.policy.dataSubmissionEnabled" = false;
"toolkit.telemetry.reportingpolicy.firstRun" = false;
"browser.uiCustomization.state" = builtins.toJSON {
placements = {
widget-overflow-fixed-list = [ ];
unified-extensions-area = [ ];
nav-bar = [
"back-button"
"forward-button"
"stop-reload-button"
"urlbar-container"
"downloads-button"
"browser-cli-controller_thalheim_io-browser-action"
"unified-extensions-button"
];
toolbar-menubar = [ "menubar-items" ];
TabsToolbar = [ "tabbrowser-tabs" "new-tab-button" "alltabs-button" ];
PersonalToolbar = [ "personal-bookmarks" ];
};
seen = [ "browser-cli-controller_thalheim_io-browser-action" ];
dirtyAreaCache = [ "nav-bar" ];
currentVersion = 20;
newElementCount = 0;
};
};
userJs = pkgs.writeText "browser-cli-user.js" (concatStringsSep "\n" (
mapAttrsToList (k: v: "user_pref(${builtins.toJSON k}, ${builtins.toJSON v});") firefoxPrefs
));
browser-cli-firefox = pkgs.writeShellScriptBin "browser-cli-firefox" ''
set -euo pipefail
PROFILE="$(mktemp -d)"
trap 'rm -rf "$PROFILE"' EXIT
cp ${userJs} "$PROFILE/user.js"
mkdir -p "$PROFILE/extensions"
cp ${mics-packages.browser-cli-extension}/browser-cli-extension.xpi \
"$PROFILE/extensions/browser-cli-controller@thalheim.io.xpi"
exec ${pkgs.firefox-devedition}/bin/firefox-devedition \
--no-remote -profile "$PROFILE" "$@"
'';
in
{
imports = [
mics-skills.homeModules.default
];
options.pinpox.programs.claude-code = {
enable = mkEnableOption "claude-code";
};
config = mkIf cfg.enable {
home.packages = [
pkgs.claude-code
browser-cli-firefox
];
programs.mics-skills = {
enable = true;
package = mics-packages;
skills = [ "browser-cli" ];
};
# Declarative settings via settings.local.json (merged with mutable settings.json)
home.file.".claude/settings.local.json".text = builtins.toJSON {
permissions.allow = [
"Bash(browser-cli:*)"
"Bash(browser-cli-firefox:*)"
"Bash(browser-cli-server:*)"
"Read(/tmp/**)"
];
};
# Supplement the browser-cli skill with browser launch instructions
home.file.".claude/skills/browser-cli-setup/SKILL.md".text = ''
---
name: browser-cli-setup
description: How to start Firefox with the browser-cli extension pre-installed. Use this before using browser-cli commands.
---
# Starting the browser
Before using `browser-cli`, you must launch Firefox Developer Edition
with the browser-cli extension already installed. Run:
```bash
browser-cli-firefox &
```
This starts Firefox Developer Edition with a temporary profile that has:
- The browser-cli WebExtension pre-installed
- Extension signature checks disabled
- Telemetry disabled
After the browser is running, use `browser-cli` commands as documented
in the browser-cli skill.
'';
};
}
================================================
FILE: home-manager/modules/credentials/age-recipients
================================================
age15m0pgtr06pqaql2wx8e2xqupcctzkf0dk0cc06hv3cjcgpe5u3ns59jaun
age1picohsm1qjpqjd9pnlh8zem6wwz62ml9z995fsdz9e23dumamjj0nl4cq0m5dx5v5mm5njelm3hmv4w3mfs5mzvks3xtu6k723jr0am49hrk9mduxvxpps
================================================
FILE: home-manager/modules/credentials/default.nix
================================================
{
config,
pkgs,
lib,
...
}:
with lib;
let
cfg = config.pinpox.defaults.credentials;
in
{
options.pinpox.defaults.credentials.enable = mkEnableOption "credentials defaults";
config = mkIf cfg.enable {
# Set up passage store directory with remote configured (but not cloned)
# On a fresh machine, just run: passage git pull
home.activation.setupPassageStore = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
STORE_DIR="${config.home.homeDirectory}/.passage/store"
if [ ! -d "$STORE_DIR/.git" ]; then
run mkdir -p "$STORE_DIR"
run ${pkgs.git}/bin/git -C "$STORE_DIR" init -b master
run ${pkgs.git}/bin/git -C "$STORE_DIR" remote add origin "gitea@git.0cx.de:pinpox/passage.git"
run ${pkgs.git}/bin/git -C "$STORE_DIR" config branch.master.remote origin
run ${pkgs.git}/bin/git -C "$STORE_DIR" config branch.master.merge refs/heads/master
fi
'';
# List of public keys (recipients) to encrypt to.
# Use `age-plugin-picohsm --list` to get the HSM key if needed. The second
# key is an offline last-resort backup key
home.sessionVariables.PASSAGE_RECIPIENTS_FILE = "${./age-recipients}";
programs.zsh.sessionVariables.PASSAGE_RECIPIENTS_FILE = "${./age-recipients}";
# The file ~/.config/age/identities still needs to be generated.
# Run `age-plugin-picohsm -list` and put the age-key identity
# (AGE-PLUGIN-PICOHSM-XXXXX) into the file. For sops, the recipients should
# be added as a comment in the line before. Full format example:
#
# # recipient: age1picohsm1qjpqxxxxxxxxxxxxxxxxxxxxxxxxx
# AGE-PLUGIN-PICOHSM-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
home.sessionVariables.PASSAGE_IDENTITIES_FILE = "$HOME/.config/age/identities";
programs.zsh.sessionVariables.PASSAGE_IDENTITIES_FILE = "$HOME/.config/age/identities";
# SOPS uses the same identity file as passage
home.sessionVariables.SOPS_AGE_KEY_FILE = "$HOME/.config/age/identities";
programs.zsh.sessionVariables.SOPS_AGE_KEY_FILE = "$HOME/.config/age/identities";
# The nixos agent is better
services.ssh-agent.enable = false;
};
}
================================================
FILE: home-manager/modules/easyeffects/default.nix
================================================
{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.pinpox.programs.easyeffects;
in
{
options.pinpox.programs.easyeffects = {
enable = mkEnableOption "EasyEffects audio effects";
};
config = mkIf cfg.enable {
services.easyeffects = {
enable = true;
# preset = "my-preset";
# extraPresets = {
# my-preset = {
# input = {
# blocklist = [
#
# ];
# "plugins_order" = [
# "rnnoise#0"
# ];
# "rnnoise#0" = {
# bypass = false;
# "enable-vad" = false;
# "input-gain" = 0.0;
# "model-path" = "";
# "output-gain" = 0.0;
# release = 20.0;
# "vad-thres" = 50.0;
# wet = 0.0;
# };
# };
# };
# };
};
# Add easyeffects to home packages
home.packages = with pkgs; [
easyeffects
];
};
}
================================================
FILE: home-manager/modules/email/aerc-style.nix
================================================
{ config, ... }:
with config.pinpox.colors;
{
"*.default" = true;
"*error.bold" = true;
"statusline*.default" = true;
"border.bg" = "#${Black}";
"border.fg" = "#${Blue}";
"completion_pill.reverse" = true;
"default.bg" = "#${Black}";
"dirlist_default.selected.bg" = "#${BrightBlack}";
"dirlist_default.selected.fg" = "#${White}";
"dirlist_recent.selected.bg" = "#${White}";
"dirlist_recent.selected.fg" = "#${BrightBlack}";
"dirlist_unread.fg" = "#${BrightGreen}";
"dirlist_unread.selected.bg" = "#${BrightBlack}";
"dirlist_unread.selected.fg" = "#${BrightGreen}";
"error.fg" = "#${BrightRed}";
"header.bold" = true;
"header.fg" = "#${BrightBlue}";
"msglist_default.selected.bg" = "#${White}";
"msglist_default.selected.fg" = "#${BrightBlack}";
"msglist_deleted.fg" = "#${BrightRed}";
"msglist_deleted.selected.reverse" = "toggle";
"msglist_marked.fg" = "#${BrightYellow}";
"msglist_marked.selected.bg" = "#${BrightBlack}";
"msglist_marked.selected.fg" = "#${BrightYellow}";
"msglist_read.selected.bg" = "#${BrightBlack}";
"msglist_read.selected.fg" = "#${White}";
"msglist_result.fg" = "#${BrightYellow}";
"msglist_result.selected.bg" = "#${BrightBlack}";
"msglist_unread.bold" = true;
"msglist_unread.fg" = "#${BrightGreen}";
"msglist_unread.selected.bg" = "#${BrightBlack}";
"selector_chooser.bold" = true;
"selector_focused.reverse" = true;
"statusline_default.bg" = "#${Magenta}";
"statusline_default.fg" = "#${BrightWhite}";
"statusline_error.fg" = "#${BrightRed}";
"statusline_error.reverse" = true;
"success.fg" = "#${BrightGreen}";
"tab.bg" = "#${Blue}";
"tab.fg" = "#${White}";
"tab.selected.bg" = "#${BrightWhite}";
"tab.selected.fg" = "#${Blue}";
"title.reverse" = true;
"warning.fg" = "#${BrightYellow}";
}
================================================
FILE: home-manager/modules/email/default.nix
================================================
{
config,
pkgs,
lib,
...
}:
with lib;
let
cfg = config.pinpox.defaults.email;
in
{
options.pinpox.defaults.email.enable = mkEnableOption "email client config";
config = mkIf cfg.enable {
accounts.email.maildirBasePath = "Mail";
programs.aerc = {
extraConfig.general.unsafe-accounts-conf = true;
enable = true;
# stylesets.pinpox = (import ./aerc-style.nix { inherit config;});
extraConfig = {
ui = {
# styleset-name = "pinpox";
icon-attachment = "a ";
icon-old = "";
icon-replied = "↩ ";
};
compose.address-book-cmd = "carddav-query %s";
filters = {
"text/plain" = "colorize";
"text/calendar" = "calendar";
"message/delivery-status" = "colorize";
"message/rfc822" = "colorize";
#text/html=pandoc -f html -t plain | colorize
"text/html" = "! html";
#text/html=! w3m -T text/html -I UTF-8
#text/*=bat -fP --file-name="$AERC_FILENAME"
#application/x-sh=bat -fP -l sh
#image/*=catimg -w $(tput cols) -
#subject,~Git(hub|lab)=lolcat -f
#from,thatguywhodoesnothardwraphismessages=wrap -w 100 | colorize
".headers" = "colorize";
"image/*" = "${pkgs.libsixel}/bin/img2sixel - ";
# image/*=catimg -w$(tput cols) -
};
};
};
accounts.email.accounts = {
pablo_tools = {
folders = {
# send = "SENT";
inbox = "INBOX";
};
aerc.enable = true;
address = "mail@pablo.tools";
aliases = [
"git@pablo.tools"
"github@pablo.tools"
"pablo1@mailbox.org"
];
realName = "Pablo Ovelleiro Corral";
primary = true;
maildir.path = "pablo_tools";
signature = {
text = ''
Pablo Ovelleiro Corral
Web: https://pablo.tools
Matrix: @pinpox:matrix.org
Github: https://github.com/pinpox
'';
showSignature = "append";
};
userName = "pablo1@mailbox.org";
passwordCommand = "passage show mailbox.org/himalaya";
imap = {
host = "imap.mailbox.org";
tls.enable = true;
};
smtp = {
host = "smtp.mailbox.org";
port = 465;
};
};
};
};
}
================================================
FILE: home-manager/modules/firefox/default.nix
================================================
{
config,
pkgs,
lib,
...
}:
with lib;
let
cfg = config.pinpox.programs.firefox;
in
{
options.pinpox.programs.firefox.enable = mkEnableOption "firefox browser";
config = mkIf cfg.enable {
# Browserpass
programs.browserpass = {
enable = true;
# browsers = [ "chromium" "firefox" ];
browsers = [ "firefox" ];
};
programs.firefox = {
enable = true;
package = pkgs.firefox;
profiles = {
pinpox = {
# containers = {
# # dangerous = {
# # color = "red";
# # icon = "fruit";
# # id = 2;
# # };
# work = {
# color = "blue";
# icon = "cart";
# id = 1;
# };
# };
search = {
force = true;
engines = {
"Nix Options" = {
urls = [
{
template = "https://search.nixos.org/options";
params = [
{
name = "channel";
value = "unstable";
}
{
name = "query";
value = "{searchTerms}";
}
];
}
];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@no" ];
};
"Nix Packages" = {
urls = [
{
template = "https://search.nixos.org/packages";
params = [
{
name = "type";
value = "packages";
}
{
name = "query";
value = "{searchTerms}";
}
];
}
];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@np" ];
};
};
};
extensions.packages = with pkgs.nur.repos.rycee.firefox-addons; [
bitwarden
darkreader
web-search-navigator
ublock-origin
simple-tab-groups
];
isDefault = true;
settings = {
# 0 => blank page
# 1 => your home page(s) {default}
# 2 => the last page viewed in Firefox
# 3 => previous session windows and tabs
"browser.startup.page" = "3";
# Set the homepage
"browser.startup.homepage" = "https://nixos.org";
# Export bookmarks to bookmarks.html when closing firefox
"browser.bookmarks.autoExportHTML" = "true";
# Path where to export. Default is:
# ~/.mozilla/firefox/pinpox/bookmarks.html
# "browser.bookmarks.file" =
# "browser.display.background_color" = "#${config.pinpox.colors.Black}";
# "browser.display.foreground_color" = "#${config.pinpox.colors.White}";
"browser.display.use_system_colors" = "true";
"browser.anchor_color" = "#${config.pinpox.colors.Yellow}";
"browser.display.use_document_colors" = "false";
# "browser.search.region" = "GB";
# "browser.search.isUS" = false;
# "distribution.searchplugins.defaultLocale" = "en-GB";
# "general.useragent.locale" = "en-GB";
# "browser.bookmarks.showMobileBookmarks" = true;
# TODO if possible, enable sync (log in)
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"extensions.activeThemeID" = "default-theme@mozilla.org";
"devtools.theme" = "dark";
"dom.security.https_only_mode" = "true"; # HTTPS everywhere
# Disable password managger
"signon.rememberSignons" = "false";
"signon.autofillForms" = "false";
"signon.autofillForms.http" = "false";
};
# userChrome = builtins.readFile
# (utils.renderMustache "userChrome.css" ./userchrome.css.mustache
# { colors = config.pinpox.colors; font = fonts; });
# TODO
userContent = ''
@import url("userChrome.css");
/* Removes white loading page */
@-moz-document url(about:blank), url(about:newtab), url(about:home) {
html:not(#ublock0-epicker), html:not(#ublock0-epicker) body, #newtab-customize-overlay {
background: var(--mff-bg) !important;
}
}
'';
};
};
};
};
}
================================================
FILE: home-manager/modules/firefox/userchrome.css.mustache
================================================
:root {
/* Minimal Functional Fox variables*/
--mff-bg: #{{colors.Black}};
--mff-icon-color: #{{colors.Blue}};
--mff-nav-toolbar-padding: 8px;
--mff-sidebar-bg: var(--mff-bg);
--mff-sidebar-color: #{{colors.White}};
--mff-tab-border-radius: 0px;
--mff-tab-color: #{{colors.White}};
--mff-tab-font-family: "{{font.normal}}";
--mff-tab-font-size: 11pt;
--mff-tab-font-weight: 500;
--mff-tab-height: 32px;
--mff-tab-pinned-bg: #{{colors.Magenta}};
--mff-tab-selected-bg: #{{colors.BrightBlack}};
--mff-tab-selected-fg: #{{colors.Yellow}};
--mff-tab-soundplaying-bg: #{{colors.Magenta}};
--mff-urlbar-color: #{{colors.White}};
--mff-urlbar-focused-color: #{{colors.Blue}};
--mff-urlbar-font-family: "{{font.normal}}";
--mff-urlbar-font-size: 12pt;
--mff-urlbar-font-weight: 500;
--mff-urlbar-results-color: #{{colors.White}};
--mff-urlbar-results-font-family: "{{font.normal}}";
--mff-urlbar-results-font-size: 12pt;
--mff-urlbar-results-font-weight: 500;
--mff-urlbar-results-url-color: #{{colors.Blue}};
/* --mff-tab-selected-bg: linear-gradient(90deg, rgba(232,74,95,1) 0%, rgba(255,132,124,1) 50%, rgba(254,206,168,1) 100%); */
/* --mff-urlbar-font-weight: 500; */
/* Overriden Firefox variables*/
--autocomplete-popup-background: var(--mff-bg) !important;
--default-arrowpanel-background: var(--mff-bg) !important;
--default-arrowpanel-color: #{{colors.White}}!important;
--lwt-toolbarbutton-icon-fill: var(--mff-icon-color) !important;
--panel-disabled-color: #{{colors.White}}00;
--toolbar-bgcolor: var(--mff-bg) !important;
--urlbar-separator-color: transparent !important;
}
/* Tabs */
.tab-background[selected="true"] {
background: var(--mff-tab-selected-bg) !important;
}
.tab-text[selected="true"] {
color: #{{colors.Yellow}} !important;
}
.tab-background:not[visuallyselected] {
background: var(--mff-tab-selected-bg) !important;
colors: red;
opacity: 0.5 !important;
}
/* This positions the tabs under the navaigator container */
#titlebar {
-moz-box-ordinal-group: 3 !important;
}
.tabbrowser-tab::after,
.tabbrowser-tab::before {
border-left: none !important;
}
.tab-background {
border: none !important;
background: #{{colors.BrightBlack}} !important;
}
.tabbrowser-arrowscrollbox {
margin-inline-start: 4px !important;
margin-inline-end: 0px !important;
}
.tab-close-button {
display: none !important;
}
.tab-text {
font-family: var(--mff-tab-font-family);
font-weight: var(--mff-tab-font-weight);
font-size: var(--mff-tab-font-size) !important;
color: var(--mff-tab-color);
}
/* Show the favicon for tabs that are pinned */
hbox.tab-content[pinned=true] .tab-icon-image {
display: initial !important;
}
hbox.tab-content[pinned=true] .tab-text {
display: none !important;
}
#tabbrowser-tabs {
--tab-loading-fill: #033433 !important;
}
.tab-label-container:not([textoverflow]) {
display: flex;
overflow: hidden;
justify-content: center;
width: 50% !important;
max-width: 50% !important;
min-width: 50% !important;
}
.tab-line {
display: none !important;
}
.tabbrowser-tab {
border-radius: var(--mff-tab-border-radius) !important;
border-width: 0;
height: var(--mff-tab-height) !important;
margin-bottom: 4px !important;
margin-inline-end: 4px !important;
margin-top: 4px !important;
max-height: var(--mff-tab-height) !important;
min-height: var(--mff-tab-height) !important;
}
.tabbrowser-tab[soundplaying="true"] {
background-color: var(--mff-tab-soundplaying-bg) !important;
}
.tab-icon-sound {
display: none !important;
}
/* Toolbar */
.urlbar-icon > image {
fill: var(--mff-icon-color) !important;
color: var(--mff-icon-color) !important;
}
.toolbarbutton-text {
color: var(--mff-icon-color) !important;
}
.urlbar-icon {
color: var(--mff-icon-color) !important;
}
.toolbarbutton-icon {
/* filter: drop-shadow(0 0 0.75rem crimson); */
}
#urlbar-results {
font-family: var(--mff-urlbar-results-font-family);
font-weight: var(--mff-urlbar-results-font-weight);
font-size: var(--mff-urlbar-results-font-size) !important;
color: var(--mff-urlbar-results-color) !important;
}
.urlbarView-row[type="bookmark"] > span{
color: green !important;
}
.urlbarView-row[type="switchtab"] > span{
color: orange !important;
}
.urlbarView-url, .search-panel-one-offs-container {
color: var(--mff-urlbar-results-url-color) !important;
font-family: var(--mff-urlbar-font-family);
font-weight: var(--mff-urlbar-results-font-weight);
font-size: var(--mff-urlbar-font-size) !important;
}
.urlbarView-favicon, .urlbarView-type-icon {
display: none !important;
}
#urlbar-input {
font-size: var(--mff-urlbar-font-size) !important;
color: var(--mff-urlbar-color) !important;
font-family: var(--mff-urlbar-font-family) !important;
font-weight: var(--mff-urlbar-font-weight)!important;
text-align: center !important;
}
#tracking-protection-icon-container, #identity-box {
display: none;
}
#back-button > .toolbarbutton-icon{
--backbutton-background: transparent !important;
border: none !important;
}
toolbar {
background-image: none !important;
}
#urlbar-background {
opacity: .98 !important;
}
#navigator-toolbox, toolbaritem {
border: none !important;
}
#urlbar-background {
background-color: var(--mff-bg) !important;
border: none !important;
}
.toolbar-items {
background-color: var(--mff-bg) !important;
}
#sidebar-search-container {
background-color: var(--mff-sidebar-bg) !important;
}
box.panel-arrowbox {
display: none;
}
box.panel-arrowcontent {
border-radius: 8px !important;
border: none !important;
}
tab.tabbrowser-tab {
overflow: hidden;
}
tab.tabbrowser-tab:hover {
box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
image#star-button {
display: none;
}
toolbar#nav-bar {
padding: var(--mff-nav-toolbar-padding) !important;
}
toolbar#nav-bar {
padding: 4px !important;
}
#urlbar {
max-width: 70% !important;
margin: 0 15% !important;
/* position: unset!important; */;
}
#urlbar-input:focus {
color: var(--mff-urlbar-focused-color) !important;
}
.megabar[breakout-extend="true"]:not([open="true"]) > #urlbar-background {
box-shadow: none !important;
background-color: transparent !important;
}
toolbarbutton {
box-shadow: none !important;
}
/* Sidebar */
.close-icon, .urlbar-icon {
fill: var(--mff-icon-color) !important;
}
.sidebar-placesTree {
color: var(--mff-sidebar-color) !important;
}
#sidebar-box {
--sidebar-background-color: var(--mff-sidebar-bg) !important;
}
splitter#sidebar-splitter {
opacity: 0 !important;
}
splitter#sidebar-splitter {
border: none !important;
background-color: transparent !important;
}
image#sidebar-icon {
display: none;
}
/* Arrow panel */
.panel-arrowcontent {
padding: 0px !important;
margin: 0px !important;
}
toolbarseparator {
display: none;
}
================================================
FILE: home-manager/modules/fonts/default.nix
================================================
{ config, lib, ... }:
with lib;
let
cfg = config.pinpox.defaults.fonts;
in
{
options.pinpox = {
defaults.fonts.enable = mkEnableOption "font defaults";
font = {
normal = {
family = mkOption {
type = types.str;
default = "Berkeley Mono";
};
style = mkOption {
type = types.str;
default = "Regular";
};
};
bold = {
family = mkOption {
type = types.str;
default = "Berkeley Mono";
};
style = mkOption {
type = types.str;
default = "Bold";
};
};
italic = {
family = mkOption {
type = types.str;
default = "Berkeley Mono";
};
style = mkOption {
type = types.str;
default = "Regular Italic";
};
};
size = 10;
};
};
config = mkIf cfg.enable {
fonts.fontconfig.enable = true;
# home.packages =
# [ flake-inputs.nix-apple-fonts.packages."x86_64-linux".sf-mono ];
};
}
================================================
FILE: home-manager/modules/foot/default.nix
================================================
{
lib,
pkgs,
config,
...
}:
with lib;
let
cfg = config.pinpox.programs.foot;
in
{
options.pinpox.programs.foot.enable = mkEnableOption "foot terminal emulator";
config = mkIf cfg.enable {
home.packages = with pkgs; [
nerd-fonts.inconsolata
foot
];
programs.foot = {
enable = true;
server.enable = true;
settings = {
main = {
term = "xterm-256color";
font = "Berkeley Mono:size=13";
# dpi-aware = "yes"; # Defaults to auto
};
scrollback.lines = 10000;
cursor = {
style = "beam";
blink = "yes";
# beam-thickness =
};
colors = {
alpha = "0.9";
# background = "${config.pinpox.colors.White}";
# foreground = "${config.pinpox.colors.Black}";
background = "${config.pinpox.colors.Black}";
foreground = "${config.pinpox.colors.White}";
## Normal/regular colors (color palette 0-7)
regular0 = "${config.pinpox.colors.Black}"; # black
regular1 = "${config.pinpox.colors.Red}"; # red
regular2 = "${config.pinpox.colors.Green}"; # green
regular3 = "${config.pinpox.colors.Yellow}"; # yellow
regular4 = "${config.pinpox.colors.Blue}"; # blue
regular5 = "${config.pinpox.colors.Magenta}"; # magenta
regular6 = "${config.pinpox.colors.Cyan}"; # cyan
regular7 = "${config.pinpox.colors.White}"; # white
## Bright colors (color palette 8-15)
bright0 = "${config.pinpox.colors.BrightBlack}"; # black
bright1 = "${config.pinpox.colors.BrightRed}"; # red
bright2 = "${config.pinpox.colors.BrightGreen}"; # green
bright3 = "${config.pinpox.colors.BrightYellow}"; # yellow
bright4 = "${config.pinpox.colors.BrightBlue}"; # blue
bright5 = "${config.pinpox.colors.BrightMagenta}"; # magenta
bright6 = "${config.pinpox.colors.BrightCyan}"; # cyan
bright7 = "${config.pinpox.colors.BrightWhite}"; # white
};
# mouse = {
# hide-when-typing = "yes";
# };
};
};
};
}
================================================
FILE: home-manager/modules/games/default.nix
================================================
{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.pinpox.programs.games;
in
{
options.pinpox.programs.games.enable = mkEnableOption "games";
config = mkIf cfg.enable {
home.packages = with pkgs; [ retroarch-free ];
};
}
================================================
FILE: home-manager/modules/git/default.nix
================================================
{
pkgs,
config,
lib,
...
}:
with lib;
let
cfg = config.pinpox.defaults.git;
prePushHook = pkgs.writeShellApplication {
name = "pre-push";
runtimeInputs = [ pkgs.jq ];
text = ''
[ -f flake.lock ] || exit 0
matches=$(jq -r '
.nodes | to_entries[]
| select(
.value.locked.type == "path"
or ((.value.locked.url // "") | startswith("file://"))
)
| "\(.key): \(.value.locked.path // .value.locked.url)"
' flake.lock)
if [ -n "$matches" ]; then
echo "warning: local-path inputs in flake.lock:" >&2
echo "$matches" >&2
if [ -e /dev/tty ]; then
read -r -p "Push anyway? [y/N] " reply < /dev/tty
[[ "$reply" =~ ^[Yy]$ ]] || { echo "aborted." >&2; exit 1; }
else
echo "error: no tty for confirmation — refusing push" >&2
exit 1
fi
fi
'';
};
in
{
options.pinpox.defaults.git.enable = mkEnableOption "git defaults";
config = mkIf cfg.enable {
home.packages = with pkgs; [
tig
jjui
];
programs = {
lazygit = {
enable = true;
# https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md
settings = {
# reporting = "off";
# update.method = "never";
shortTimeFormat = "15h:30:13";
gui.showFileTree = true;
os = {
edit = "nvim {{filename}}";
editAtLine = "nvim +{{line}} {{filename}}";
editAtLineAndWait = "nvim --remote-wait +{{line}} {{filename}}";
editInTerminal = true;
};
};
};
git = {
enable = true;
lfs.enable = true;
ignores = [
"tags"
"*.swp"
"result"
".claude"
];
settings = {
init.defaultBranch = "main";
core.hooksPath = "${prePushHook}/bin";
pull = {
rebase = true;
autostash = true;
twohead = "ort";
};
push = {
default = "simple";
autoSetupRemote = true;
};
# rerere = {
# autoUpdate = true
# enabled = true
# };
branch = {
autoSetupRebase = "always";
autoSetupMerge = "always";
};
rebase = {
stat = true;
autoStash = true;
autoSquash = true;
updateRefs = true;
};
help.autocorrect = 10;
signing = {
format = "ssh";
key = "~/.ssh/key.pub";
signByDefault = true;
};
alias = {
s = "status";
d = "diff";
a = "add";
c = "commit";
p = "push";
o = "checkout";
co = "checkout";
uncommit = "reset --soft HEAD^";
comma = "commit --amend";
reset-pr = "reset --hard FETCH_HEAD";
force-push = "push --force-with-lease";
};
user.email = "git@pablo.tools";
user.name = "pinpox";
};
};
};
# [kiwi] evaluation warning: pinpox profile: The option `programs.git.aliases' defined in `/nix/store/fsc89mqrbiij6pnl4vrf0l0plv0i8pp6-source/clan-service-modules/machine-type/desktop.nix' has been renamed to `programs.git.settings.alias'.
# [kiwi] evaluation warning: pinpox profile: The option `programs.git.extraConfig' defined in `/nix/store/fsc89mqrbiij6pnl4vrf0l0plv0i8pp6-source/clan-service-modules/machine-type/desktop.nix' has been renamed to `programs.git.settings'.
programs.jujutsu = {
enable = true;
settings = {
merge-tools.meld.merge-args = [
"$left"
"$base"
"$right"
"-o"
"$output"
"--auto-merge"
];
signing = {
behavior = "own";
backend = "ssh";
key = "~/.ssh/key.pub";
allowed-signers = "~/.ssh/allowed_signers";
};
ui = {
pager = "less -FRX";
default-command = "log";
merge-editor = [
"meld"
"$left"
"$base"
"$right"
"-o"
"$output"
];
};
user = {
email = "git@pablo.tools";
name = "pinpox";
};
};
};
};
}
================================================
FILE: home-manager/modules/go/default.nix
================================================
{ config, lib, ... }:
with lib;
let
cfg = config.pinpox.programs.go;
in
{
options.pinpox.programs.go.enable = mkEnableOption "go compiler";
config = mkIf cfg.enable {
programs = {
go = {
enable = true;
env.GOPATH = "/home/pinpox/.go";
# packages = {
# "golang.org/x/text" =
# builtins.fetchGit "https://go.googlesource.com/text";
# "golang.org/x/time" =
# builtins.fetchGit "https://go.googlesource.com/time";
# };
};
};
};
}
================================================
FILE: home-manager/modules/grobi/default.nix
================================================
{
config,
pkgs,
lib,
...
}:
with lib;
let
cfg = config.pinpox.defaults.grobi;
in
{
options.pinpox.defaults.grobi.enable = mkEnableOption "grobi defaults";
config = mkIf cfg.enable {
services = {
grobi = {
# enable = true;
enable = false;
# executeAfter = [ " " ];
rules = [
{
name = "kartoffel";
outputs_connected = [
"DVI-D-0"
"DP-0"
"DVI-D-1"
];
configure_row = [
"DVI-D-0"
"DP-0"
"DVI-D-1"
];
atomic = true;
execute_after = [
''
${pkgs.xorg.xrandr}/bin/xrandr \
--output DVI-D-0 --mode 1920x1200 --pos 3460x0 --rotate normal \
--output DP-0 --primary --mode 2560x1440 --pos 900x0 --rotate normal \
--output DVI-D-1 --mode 1440x900 --pos 0x0 --rotate right \
--output DP-1 --off \
--output HDMI-0 --off
''
];
}
];
};
};
};
}
================================================
FILE: home-manager/modules/gtk/banana.nix
================================================
{
config,
pkgs,
...
}:
{
config = {
home.pointerCursor = {
name = "Banana";
size = 32;
package = pkgs.banana-cursor;
x11.enable = true;
gtk.enable = true;
};
wayland.windowManager.sway.config.seat."*".xcursor_theme =
"${config.gtk.cursorTheme.name} ${toString config.gtk.cursorTheme.size}";
gtk.cursorTheme = {
name = "Banana";
size = 32;
package = pkgs.banana-cursor;
};
};
}
================================================
FILE: home-manager/modules/gtk/default.nix
================================================
{
config,
pkgs,
lib,
...
}:
with lib;
let
cfg = config.pinpox.defaults.gtk;
# TODO use flake inputs
materia-theme = pkgs.fetchFromGitHub {
owner = "nana-4";
repo = "materia-theme";
rev = "76cac96ca7fe45dc9e5b9822b0fbb5f4cad47984";
sha256 = "sha256-0eCAfm/MWXv6BbCl2vbVbvgv8DiUH09TAUhoKq7Ow0k=";
# Old version
# "e329aaee160c82e85fe91a6467c666c7f9f2a7df";
# sha256 = "1qmq5ycfpzv0rcp5aav4amlglkqy02477i4bdi7lgpbn0agvms6c";
fetchSubmodules = true;
};
materia_colors = pkgs.writeTextFile {
name = "gtk-generated-colors";
text = ''
BTN_BG=${config.pinpox.colors.BrightBlack}
BTN_FG=${config.pinpox.colors.BrightWhite}
FG=${config.pinpox.colors.White}
BG=${config.pinpox.colors.Black}
HDR_BTN_BG=${config.pinpox.colors.BrightBlack}
HDR_BTN_FG=${config.pinpox.colors.White}
ACCENT_BG=${config.pinpox.colors.Green}
ACCENT_FG=${config.pinpox.colors.Black}
HDR_FG=${config.pinpox.colors.White}
HDR_BG=${config.pinpox.colors.BrightBlack}
MATERIA_SURFACE=${config.pinpox.colors.BrightBlack}
MATERIA_VIEW=${config.pinpox.colors.BrightBlack}
MENU_BG=${config.pinpox.colors.BrightBlack}
MENU_FG=${config.pinpox.colors.BrightWhite}
SEL_BG=${config.pinpox.colors.Blue}
SEL_FG=${config.pinpox.colors.Magenta}
TXT_BG=${config.pinpox.colors.BrightBlack}
TXT_FG=${config.pinpox.colors.BrightWhite}
WM_BORDER_FOCUS=${config.pinpox.colors.White}
WM_BORDER_UNFOCUS=${config.pinpox.colors.BrightBlack}
UNITY_DEFAULT_LAUNCHER_STYLE=False
NAME=generated
MATERIA_COLOR_VARIANT=dark
MATERIA_STYLE_COMPACT=True
'';
};
in
{
options.pinpox.defaults.gtk.enable = mkEnableOption "gtk defaults";
imports = [ ./banana.nix ];
config = mkIf cfg.enable {
nixpkgs.overlays = [
(self: super: {
rendersvg = self.runCommand "rendersvg" { } ''
mkdir -p $out/bin
ln -s ${self.resvg}/bin/resvg $out/bin/rendersvg
'';
generated-gtk-theme = self.stdenv.mkDerivation {
name = "generated-gtk-theme";
src = materia-theme;
buildInputs = with self; [
sassc
bc
which
rendersvg
meson
ninja
dart-sass
gtk4.dev
optipng
];
MATERIA_COLORS = materia_colors;
phases = [
"unpackPhase"
"installPhase"
];
installPhase = ''
HOME=/build
chmod 777 -R .
patchShebangs .
mkdir -p $out/share/themes
mkdir bin
sed -e 's/handle-horz-.*//' -e 's/handle-vert-.*//' -i ./src/gtk-2.0/assets.txt
echo "Changing colours:"
./change_color.sh -o Generated "$MATERIA_COLORS" -i False -t "$out/share/themes"
chmod 555 -R .
'';
};
})
];
# GTK settings
gtk = {
enable = true;
font = {
name = "Berkeley Mono";
# package = pkgs.iosevka;
};
iconTheme = {
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
theme = {
name = "Generated";
package = pkgs.generated-gtk-theme;
};
};
home.sessionVariables.GTK_THEME = "Generated";
# Set default dark theme via dconf (can be changed at runtime)
dconf.settings = {
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
};
};
};
}
================================================
FILE: home-manager/modules/helix/default.nix
================================================
{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.pinpox.programs.helix;
in
{
options.pinpox.programs.helix = {
enable = mkEnableOption "Helix editor configuration";
};
config = mkIf cfg.enable {
programs.helix = {
enable = true;
# https://docs.helix-editor.com/languages.html
languages = {
language = [
{
name = "nix";
auto-format = false;
formatter.command = "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt";
}
];
};
settings = {
editor = {
indent-guides.render = true;
bufferline = "multiple";
cursorline = true;
cursor-shape = {
insert = "bar";
normal = "block";
select = "underline";
};
lsp.display-messages = true;
};
theme = "catppuccin_mocha";
keys = {
normal = {
";" = "command_mode";
"C-g" = [
":new"
":insert-output ${pkgs.lazygit}/bin/lazygit"
":buffer-close!"
":redraw"
];
};
select = {
";" = "command_mode";
};
};
};
};
# Add helix to home packages
home.packages = with pkgs; [
helix
];
};
}
================================================
FILE: home-manager/modules/k9s/default.nix
================================================
{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.pinpox.programs.k9s;
in
{
options.pinpox.programs.k9s.enable = mkEnableOption "k9s kubernetes CLI";
config = mkIf cfg.enable {
home.packages = [ pkgs.k9s ];
xdg = {
enable = true;
configFile.k9s_theme = {
target = "k9s/skin.yml";
text = builtins.toJSON {
k9s = {
body = {
fgColor = "#cad3f5";
bgColor = "#24273a";
logoColor = "#cba6f7";
};
info = {
fgColor = "#74c7ec";
sectionColor = "#8aadf4";
};
frame = {
border = {
fgColor = "#cba6f7";
focusColor = "#f5bde6";
};
menu = {
fgColor = "#eed49f";
keyColor = "#8aadf4";
numKeyColor = "#f5bde6";
};
crumbs = {
fgColor = "#cad3f5";
bgColor = "#8aadf4";
activeColor = "#74c7ec";
};
status = {
newColor = "#a6da95";
modifyColor = "#68f288";
addColor = "#74c7ec";
errorColor = "#ed8796";
highlightcolor = "#8aadf4";
killColor = "#747c9e";
completedColor = "#5b6078";
};
title = {
fgColor = "#8bd5ca";
bgColor = "#5b6078";
highlightColor = "#74c7ec";
counterColor = "#cba6f7";
filterColor = "#5b6078";
};
};
views = {
table = {
fgColor = "#cad3f5";
bgColor = "#24273a";
cursorColor = "#8bd5ca";
header = {
fgColor = "#24273a";
bgColor = "#8aadf4";
};
};
yaml = {
keyColor = "#8bd5ca";
colonColor = "#aee2da";
valueColor = "#a6da95";
};
logs = {
fgColor = "#cad3f5";
bgColor = "#24273a";
};
};
};
};
};
};
};
}
================================================
FILE: home-manager/modules/kanshi/default.nix
================================================
{
config,
pkgs,
lib,
...
}:
with lib;
let
cfg = config.pinpox.programs.kanshi;
in
{
options.pinpox.programs.kanshi.enable = mkEnableOption "kanshi screen setup";
config = mkIf cfg.enable {
home.packages = with pkgs; [ kanshi ];
# output eDP-1 mode 1920x1080 position 0,0
# output DP-1 mode 2560x1440 position 1080,0
# output DP-2 mode 2560x1440 position 3640,0
services.kanshi = {
enable = true;
settings = [
{
profile.name = "laptop-only";
profile.outputs = [
{
criteria = "eDP-1";
mode = "2880x1920@120Hz";
scale = 2.0;
}
];
}
{
profile.name = "laptop-external-right";
profile.outputs = [
{
criteria = "eDP-1";
mode = "2880x1920@120Hz";
position = "0,0";
scale = 2.0;
status = "enable";
}
{
criteria = "Lenovo Group Limited Y27h-30 U3V040YW";
mode = "2560x1440";
position = "1440,0";
status = "enable";
}
];
}
];
};
};
}
================================================
FILE: home-manager/modules/mako/default.nix
================================================
{
pkgs,
config,
lib,
...
}:
with lib;
let
cfg = config.pinpox.programs.mako;
in
{
options.pinpox.programs.mako.enable = mkEnableOption "mako notifications";
config = mkIf cfg.enable {
# Needed for firefox and thunderbird
home.packages = [ pkgs.libnotify ];
services.mako = {
enable = true;
settings = {
anchor = "top-right";
background-color = "#285577FF";
border-color = "#4C7899FF";
# progressColor = "over #5588AAFF";
text-color = "#FFFFFFFF";
border-radius = "5";
border-size = "5";
default-timeout = "10000"; # In milliseconds
# extraConfig = '''';
font = "Berkeley Mono 12";
# %a Application name
# %s Notification summary
# %b Notification body
# %g Number of notifications in the current group
# %i Notification id
# format = "%s\\n%b";
# groupBy = "";
height = "200";
width = "300";
# iconPath = "";
icons = "true";
margin = "10";
padding = "5";
};
};
};
}
================================================
FILE: home-manager/modules/mpv/default.nix
================================================
{
lib,
pkgs,
config,
...
}:
with lib;
let
cfg = config.pinpox.programs.mpv;
in
{
options.pinpox.programs.mpv.enable = mkEnableOption "mpv media player";
config = mkIf cfg.enable {
programs.mpv = {
enable = true;
config = {
# Screenshot settings
screenshot-directory = "~/Pictures";
screenshot-format = "png";
screenshot-template = "photo-%F-%T";
# Low latency for camera preview
profile = "low-latency";
untimed = "yes";
};
# Rotation for webcam (applied to v4l2 protocol)
profiles = {
"protocol.av" = {
vf = "rotate=PI";
};
};
bindings = {
# Screenshot bindings
"s" = "screenshot";
"MBTN_LEFT" = "screenshot";
};
};
};
}
================================================
FILE: home-manager/modules/neomutt/default.nix
================================================
{ config, lib, ... }:
with lib;
let
cfg = config.pinpox.programs.neomutt;
in
{
options.pinpox.programs.neomutt.enable = mkEnableOption "neomutt mail client";
config = mkIf cfg.enable {
programs.neomutt = {
enable = true;
sidebar = {
enable = true;
};
extraConfig = ''
set imap_user = "pablo1@mailbox.org"
set imap_pass = "`pass mailbox.org/pablo1@mailbox.org`"
'';
};
};
}
================================================
FILE: home-manager/modules/newsboat/default.nix
================================================
{ config, lib, ... }:
with lib;
let
cfg = config.pinpox.programs.newsboat;
splitString = str: builtins.filter builtins.isString (builtins.split "\n" str);
in
{
options.pinpox.programs.newsboat.enable = mkEnableOption "newsboat RSS reader";
config = mkIf cfg.enable {
programs.newsboat = {
enable = true;
autoReload = true;
urls = [
# https://hackaday.com/blog/feed/
{
title = "nixOS mobile";
tags = [
"nixos"
"nix"
];
url = "https://mobile.nixos.org/index.xml";
}
{
title = "r/NixOS";
tags = [
"nixos"
"nix"
"reddit"
];
url = "https://www.reddit.com/r/NixOS.rss";
}
{
title = "NixOS weekly";
tags = [
"nixos"
"nix"
];
url = "https://weekly.nixos.org/feeds/all.rss.xml";
}
]
++ (map (x: {
url = x;
tags = [ "rss" ];
}) (splitString (builtins.readFile ./newsboat/rss.txt)))
++ (map (x: {
url = x;
tags = [ "podcast" ];
}) (splitString (builtins.readFile ./newsboat/podcast.txt)))
++ (map (x: {
url = x;
tags = [ "youtube" ];
}) (splitString (builtins.readFile ./newsboat/youtube.txt)));
};
};
}
================================================
FILE: home-manager/modules/obs-studio/default.nix
================================================
{
lib,
pkgs,
config,
system-config,
...
}:
with lib;
let
cfg = config.pinpox.programs.obs-studio;
droidcam-port = 5201;
in
{
options.pinpox.programs.obs-studio.enable = mkEnableOption "obs-studio";
config = mkIf cfg.enable {
# assertions = [
# {
# assertion = (builtins.elem droidcam-port system-config.networking.firewall.allowedTCPPorts);
# message = "Port ${toString droidcam-port}/tcp is not open in the firewall, but required by droidcam";
# }
# ];
home.packages = [
pkgs.uxplay # AirPlay Unix mirroring server
pkgs.slurp
pkgs.xdg-desktop-portal
pkgs.xdg-desktop-portal-gtk
];
programs.obs-studio = {
enable = true;
plugins = with pkgs.obs-studio-plugins; [
obs-pipewire-audio-capture
# droidcam-obs
wlrobs
# obs-vintage-filter
# obs-teleport
obs-backgroundremoval
input-overlay
];
};
};
}
================================================
FILE: home-manager/modules/pandoc/default.nix
================================================
{ config, lib, ... }:
with lib;
let
cfg = config.pinpox.programs.pandoc;
in
{
options.pinpox.programs.pandoc.enable = mkEnableOption "pandoc config";
config = mkIf cfg.enable {
programs.pandoc = {
enable = true;
citationStyles = [ ];
# templates = {
# "default.latex" = path/to/your/template;
# };
defaults = {
metadata = {
author = "Pablo Ovelleiro Corral";
};
# pdf-engine = "xelatex";
# citeproc = true;
};
};
};
}
================================================
FILE: home-manager/modules/pi-mono/default.nix
================================================
{
lib,
pkgs,
config,
...
}:
with lib;
let
cfg = config.pinpox.programs.pi;
# Generate models.json from the declarative provider config
modelsJson = pkgs.writeText "models.json" (
builtins.toJSON { providers = cfg.providers; }
);
in
{
options.pinpox.programs.pi = {
enable = mkEnableOption "pi coding agent";
package = mkOption {
type = types.package;
default = pkgs.pi;
description = "The pi package to install.";
};
extensions = mkOption {
type = types.attrsOf types.path;
default = { };
description = ''
Extension name to source path mappings. Each entry is symlinked into
`~/.pi/agent/extensions/`. Sources can be local paths, fetchGit
results, or built packages.
Pi auto-discovers extensions from `~/.pi/agent/extensions/` — both
single `.ts` files and directories with an `index.ts` entry point.
Note: Extensions that require `npm install` (i.e. have runtime
dependencies in package.json) need to be built first or installed
via `pi install` instead.
'';
example = literalExpression ''
{
my-extension = ./extensions/my-extension.ts;
}
'';
};
providers = mkOption {
type = types.attrsOf types.attrs;
default = { };
description = ''
Model provider configurations, keyed by provider name. All providers
are merged and written to `~/.pi/agent/models.json` as a read-only
symlink. Pi only reads this file, never writes to it.
Can be set from multiple modules (e.g. machine-specific configs)
and Nix will merge them.
'';
example = literalExpression ''
{
ollama = {
baseUrl = "http://100.96.100.103:11434/v1";
api = "openai-completions";
apiKey = "dummy";
compat = {
supportsDeveloperRole = false;
supportsReasoningEffort = false;
};
models = [
{ id = "llama3.3:latest"; contextWindow = 128000; maxTokens = 32000; }
];
};
}
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
home.file = mkMerge [
# Symlink extensions into the auto-discovery directory
(mapAttrs' (name: src: {
name = ".pi/agent/extensions/${name}";
value.source = src;
}) cfg.extensions)
# models.json as read-only symlink (only when providers are configured)
(mkIf (cfg.providers != { }) {
".pi/agent/models.json".source = modelsJson;
})
];
};
}
================================================
FILE: home-manager/modules/rio/config/rio/config.toml
================================================
# Modifier to line-height. Default is `1.0`
line-height = 1.06
# Environment variables
env-vars = ["TERM=xterm-256color"]
# Don't confirm before exiting Rio
confirm-before-quit = false
[adaptive-theme]
light = "wildcharm-light"
dark = "wildcharm-dark"
# light = "pinpox-light"
# dark = "pinpox-dark"
# Hide the cursor while typing
# hide-cursor-when-typing = false
# Ignore theme selection foreground color
# ignore-selection-foreground-color = false
# Startup directory
#
# Directory the shell is started in. If this is unset the working
# directory of the parent process will be used.
#
# This configuration only has effect if use-fork is disabled.
#
# Example:
# working-dir = "/Users/raphael/Documents/"
# Use fork
#
# Defaults for POSIX-based systems (Windows is not configurable):
# MacOS: spawn processes
# Linux/BSD: fork processes
#
# Example:
# use-fork = false
# Cursor
#
# shape - Default cursor shape is 'block'
# Other available options are: 'underline', 'beam' or 'hidden'
#
# blinking - Whether the cursor blinks. The default is false
#
# blinking-interval - Cursor update on milliseconds interval
#
# [cursor]
# shape = 'block'
# blinking = false
# blinking-interval = 800
# Editor
#
# Default editor on Linux and MacOS is "vi",
# on Windows it is "notepad".
#
# Whenever the key binding `OpenConfigEditor` is triggered it will
# use the value of the editor along with the rio configuration path.
[editor]
program = "nvim"
# args = []
# Window configuration
#
# • width - define the initial window width.
# Default: 600
#
# • height - define the initial window height.
# Default: 400
#
# • mode - define how the window will be created
# - "Windowed" (default) is based on width and height
# - "Maximized" window is created with maximized
# - "Fullscreen" window is created with fullscreen
#
# • opacity - Set window opacity
#
# • blur - Set blur on the window background. Changing this config requires restarting Rio to take effect.
#
# • decorations - Set window decorations, options: "Enabled", "Disabled", "Transparent", "Buttonless"
#
# • colorspace - Set the color space for the window
# - "srgb" (default on non-macOS)
# - "display-p3" (default on macOS)
# - "rec2020"
#
# Example:
[window]
# width = 600
# height = 400
# mode = "windowed"
opacity = 0.95
blur = true
# decorations = "enabled"
# colorspace = "display-p3"
# Renderer
#
# • Performance: Set WGPU rendering performance
# - High: Adapter that has the highest performance. This is often a discrete GPU.
# - Low: Adapter that uses the least possible power. This is often an integrated GPU.
#
# • Backend: Set WGPU rendering backend
# - Automatic: Leave Sugarloaf/WGPU to decide
# - GL: Supported on Linux/Android, and Windows and macOS/iOS via ANGLE
# - Vulkan: Supported on Windows, Linux/Android
# - DX12: Supported on Windows 10
# - Metal: Supported on macOS/iOS
#
# • disable-unfocused-render: This property disable renderer processes while Rio is unfocused.
#
# • level: Configure renderer level
# - Available options: 0 and 1.
# Higher the level more rendering features and computations
# will be done like enable font ligatures or emoji support.
# For more information please check the docs.
#
# • filters: A list of paths to RetroArch slang shaders. Might not work with OpenGL.
#
# Example:
# [renderer]
# performance = "high"
# backend = "automatic"
# disable-unfocused-render = false
# level = 1
# filters = []
# Keyboard
#
# use-kitty-keyboard-protocol - Enable Kitty Keyboard protocol
#
# disable-ctlseqs-alt - Disable ctlseqs with ALT keys
# - For example: Terminal.app does not deal with ctlseqs with ALT keys
#
# ime-cursor-positioning - Enable IME cursor positioning
# - When enabled, the IME input popup will appear at the cursor position
# - Default is true
#
# Example:
# [keyboard]
# use-kitty-keyboard-protocol = false
# disable-ctlseqs-alt = false
# ime-cursor-positioning = true
# Fonts
#
# Configure fonts used by the terminal
#
# Note: You can set different font families but Rio terminal
# will always look for regular font bounds whene
#
# You can also set family on root to overwrite all fonts.
#
# You can also specify extra fonts to load
# [fonts]
# extras = [{ family = "Microsoft JhengHei" }]
#
# In case you want to specify any font feature:
# [fonts]
# features = ["ss02", "ss03", "ss05", "ss19"]
#
# Note: Font features do not have support to live reload on configuration,
# so to reflect your changes, you will need to close and reopen Rio.
#
# You can also map the specified Unicode codepoints to a particular font.
# symbol-map = [
# { start = "2297", end = "2299", font-family = "Cascadia Code NF" }
# ]
[fonts]
# You can also disable font hinting. Font hinting is enabled by default.
# hinting = false
size = 16.6
family = "Berkeley Mono"
[fonts.emoji]
family = "Noto Emoji"
[fonts.regular]
style = "Normal"
[fonts.bold]
style = "Normal"
weight = 800
[fonts.italic]
style = "Italic"
[fonts.bold-italic]
style = "Italic"
weight = 800
# [hints]
# # Characters used for hint labels
# alphabet = "jfkdls;ahgurieowpq"
#
# # URL hint example
# [[hints.rules]]
# regex = "(https://|http://)[^\u{0000}-\u{001F}\u{007F}-\u{009F}<>\"\\s{-}\\^⟨⟩`\\\\]+"
# hyperlinks = true
# post-processing = true
# persist = false
#
# [hints.rules.action]
# command = "xdg-open" # Linux/BSD
# # command = "open" # macOS
# # command = { program = "cmd", args = ["/c", "start", ""] } # Windows
#
# [hints.rules.binding]
# key = "O"
# mods = ["Control", "Shift"]
# Scroll
#
# You can change how many lines are scrolled each time by setting this option.
#
# Scroll calculation for canonical mode will be based on `lines = (accumulated scroll * multiplier / divider)`,
# If you want a quicker scroll, keep increasing the multiplier.
# If you want to reduce scroll speed you will need to increase the divider.
# You can use both properties also to find the best scroll for you.
#
# Multiplier default is 3.0.
# Divider default is 1.0.
# Example:
# [scroll]
# multiplier = 3.0
# divider = 1.0
# Navigation
#
# "mode" - Define navigation mode
# • NativeTab (MacOS only)
# • Bookmark
# • BottomTab
# • TopTab
# • Plain
#
# "hide-if-single" - Hide navigation UI if is single.
# "clickable" - Enable click on tabs to switch.
# "use-current-path" - Use same path whenever a new tab is created (Note: requires `use-fork` to be set to false).
# "color-automation" - Set a specific color for the tab whenever a specific program is running, or in a specific directory.
#
# Example:
# [navigation]
# mode = "bookmark"
# clickable = false
# hide-if-single = true
# use-current-path = false
# color-automation = []
# Shell
#
# You can set `shell.program` to the path of your favorite shell, e.g. `/bin/fish`.
# Entries in `shell.args` are passed unmodified as arguments to the shell.
#
# Default:
# - (macOS) user login shell
# - (Linux/BSD) user login shell
# - (Windows) powershell
#
# Example 1 using fish shell from bin path:
#
# [shell]
# program = "/bin/fish"
# args = ["--login"]
#
# Example 2 for Windows using powershell
#
# [shell]
# program = "pwsh"
# args = []
#
# Example 3 for Windows using powershell with login
#
# [shell]
# program = "pwsh"
# args = ["-l"]
#
# Example 4 for MacOS with tmux installed by homebrew
#
# [shell]
# program = "/opt/homebrew/bin/tmux"
# args = ["new-session", "-c", "/var/www"]
# Colors
#
# Colors definition will overwrite any property in theme
# (considering if theme folder does exists and is being used)
#
# Example:
# [colors]
# background = '#0F0D0E'
# foreground = '#F9F4DA'
# cursor = '#F38BA3'
# tabs = '#443d40'
# tabs-active = '#F38BA3'
# green = '#0BA95B'
# red = '#ED203D'
# blue = '#12B5E5'
# yellow = '#FCBA28'
# Bindings
#
# Create custom Key bindings for Rio terminal
# More information in: https://raphamorim.io/rio/docs/key-bindings
#
# Example:
# [bindings]
# keys = [
# { key = "q", with = "super", action = "Quit" },
# # Bytes[27, 91, 53, 126] is equivalent to "\x1b[5~"
# { key = "home", with = "super | shift", bytes = [27, 91, 53, 126] }
# ]
# Platform
#
# Rio now allows you to have different configurations per OS
# You can write ovewrite properties like `Shell`, `Navigation`
# and `Window`.
#
# Example:
# [shell]
# # default (in this case will be used only on MacOS)
# program = "/bin/fish"
# args = ["--login"]
#
# [platform]
# # Microsoft Windows overwrite
# windows.shell.program = "pwsh"
# windows.shell.args = ["-l"]
#
# # Linux overwrite
# linux.shell.program = "tmux"
# linux.shell.args = ["new-session", "-c", "/var/www"]
# Log level
#
# This property enables log level filter and file. The default level is "OFF" and the logs are not logged to a file as default.
#
# Example:
# [developer]
# log-level = "OFF"
# enable-log-file = false
================================================
FILE: home-manager/modules/rio/config/rio/themes/pinpox-dark.toml
================================================
[colors]
background = '#24273a'
black = '#24273a'
blue = '#8aadf4'
cursor = '#e8f0ff'
cyan = '#8bd5ca'
foreground = '#e8f0ff'
green = '#a6da95'
magenta = '#cba6f7'
red = '#ed8796'
tabs = '#363a4f'
tabs-active = '#494d64'
white = '#e8f0ff'
yellow = '#eed49f'
dim-black = '#1e2030'
dim-blue = '#7891d0'
dim-cyan = '#73b9a8'
dim-foreground = '#b0b7d0'
dim-green = '#8cb77d'
dim-magenta = '#ad92d5'
dim-red = '#c9707d'
dim-white = '#b0b7d0'
dim-yellow = '#d1bc87'
light-black = '#5b6078'
light-blue = '#74c7ec'
light-cyan = '#aee2da'
light-foreground = '#747c9e'
light-green = '#68f288'
light-magenta = '#f5bde6'
light-red = '#ff5370'
light-white = '#747c9e'
light-yellow = '#fab387'
================================================
FILE: home-manager/modules/rio/config/rio/themes/pinpox-light.toml
================================================
[colors]
background = '#e8f0ff'
black = '#e8f0ff'
blue = '#1e66f5'
cursor = '#24273a'
cyan = '#179299'
foreground = '#24273a'
green = '#40a02b'
magenta = '#8839ef'
red = '#d20f39'
tabs = '#e1e4e8'
tabs-active = '#ccd0da'
white = '#24273a'
yellow = '#df8e1d'
dim-black = '#dce0e8'
dim-blue = '#1752c9'
dim-cyan = '#127680'
dim-foreground = '#1c1f2e'
dim-green = '#357f23'
dim-magenta = '#722fc3'
dim-red = '#a90c2e'
dim-white = '#1c1f2e'
dim-yellow = '#b57418'
light-black = '#5b6078'
light-blue = '#267ff5'
light-cyan = '#1da6ad'
light-foreground = '#2c2f3d'
light-green = '#4db332'
light-magenta = '#9c46f5'
light-red = '#e42144'
light-white = '#363a4f'
light-yellow = '#f29d23'
================================================
FILE: home-manager/modules/rio/config/rio/themes/wildcharm-dark.toml
================================================
[colors]
background = '#000000'
black = '#000000'
blue = '#0087d7'
cursor = '#ffffff'
cyan = '#00afaf'
foreground = '#d0d0d0'
green = '#00af5f'
magenta = '#d787d7'
red = '#d7005f'
tabs = '#1c1c1c'
tabs-active = '#303030'
white = '#d0d0d0'
yellow = '#d78700'
dim-black = '#262626'
dim-blue = '#005faf'
dim-cyan = '#008787'
dim-foreground = '#8a8a8a'
dim-green = '#008700'
dim-magenta = '#875f87'
dim-red = '#af005f'
dim-white = '#8a8a8a'
dim-yellow = '#af8700'
light-black = '#767676'
light-blue = '#00afff'
light-cyan = '#00d7d7'
light-foreground = '#ffffff'
light-green = '#00d75f'
light-magenta = '#ff87ff'
light-red = '#ff5f87'
light-white = '#ffffff'
light-yellow = '#ffaf00'
================================================
FILE: home-manager/modules/rio/config/rio/themes/wildcharm-light.toml
================================================
[colors]
background = '#ffffff'
black = '#000000'
blue = '#005faf'
cursor = '#000000'
cyan = '#008787'
foreground = '#000000'
green = '#008700'
magenta = '#870087'
red = '#af0000'
tabs = '#e4e4e4'
tabs-active = '#d0d0d0'
white = '#ffffff'
yellow = '#af5f00'
dim-black = '#262626'
dim-blue = '#00305f'
dim-cyan = '#005f5f'
dim-foreground = '#585858'
dim-green = '#005f00'
dim-magenta = '#5f005f'
dim-red = '#870000'
dim-white = '#d0d0d0'
dim-yellow = '#875f00'
light-black = '#585858'
light-blue = '#0087d7'
light-cyan = '#00afaf'
light-foreground = '#262626'
light-green = '#00af5f'
light-magenta = '#af00af'
light-red = '#d70000'
light-white = '#ffffff'
light-yellow = '#d78700'
================================================
FILE: home-manager/modules/rio/default.nix
================================================
{
lib,
pkgs,
config,
...
}:
with lib;
let
cfg = config.pinpox.programs.rio;
in
{
options.pinpox.programs.rio.enable = mkEnableOption "rio terminal emulator";
config = mkIf cfg.enable {
home.packages = with pkgs; [ rio ];
xdg.enable = true;
xdg.configFile.rio.source = ./config/rio;
};
}
================================================
FILE: home-manager/modules/river/default.nix
================================================
{
config,
pkgs,
lib,
...
}:
with lib;
let
cfg = config.pinpox.programs.river;
start-river =
pkgs.writeShellScriptBin "start-river" # sh
''
export WLR_DRM_NO_MODIFIERS=1
dbus-launch --sh-syntax --exit-with-session ${pkgs.river-classic}/bin/river
'';
screenshot-region =
pkgs.writeShellScriptBin "screenshot-region" # sh
''
${pkgs.slurp}/bin/slurp | ${pkgs.grim}/bin/grim -g - - | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png
'';
screenshot-region-file =
pkgs.writeShellScriptBin "screenshot-region-file" # sh
''
${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" $(date +'%s_grim.png')
'';
in
{
options.pinpox.programs.river.enable = mkEnableOption "river window manager";
config = mkIf cfg.enable {
# Sets --indicator for network-manager-applet, which makes it work in river
xsession.preferStatusNotifierItems = true;
# Install these packages for my user
home.packages = with pkgs; [
river-classic
river-luatile
# way-displays
waybar
wl-clipboard
wlr-randr
start-river
screenshot-region
screenshot-region-satty
screenshot-region-file
];
xdg = {
enable = true;
configFile = {
# River configuration files
river-config = {
target = "river/init";
source = ./river-config;
executable = true;
};
river-config-extra = {
target = "river/init_exta";
text = # sh
''
riverctl map-switch normal lid close spawn ${pkgs.swaylock}/bin/swaylock
# riverctl map normal Super F12 spawn '${pkgs.slurp}/bin/slurp | ${pkgs.grim}/bin/grim -g - - | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png'
# riverctl map normal Super F12 spawn ${screenshot-region}
riverctl map normal Super p spawn "${pkgs.tofi}/bin/tofi-run"
${pkgs.mako}/bin/mako &
waybar
# ${pkgs.wlr-randr}/bin/wlr-randr --output eDP-1 --mode 1920x1080 --pos 0,0 \
# --output DP-1 --mode 2560x1440 --pos 4480,0 \
# --output DP-2 --mode 2560x1440@164.54 --pos 1920,0
# wlr-randr --output eDP-1 --on --mode 1920x1080 --pos 0,0 --output DP-1 --on --mode 2560x1440 --pos 4480,0 --output DP-2 --on --mode 2560x1440 --pos 1920,0
'';
executable = true;
};
# river-luatile layouts
luatile-layout = {
target = "river-luatile/layout.lua";
source = ./layout.lua;
};
luatile-json = {
target = "river-luatile/json.lua";
source = ./json.lua;
};
};
};
};
}
================================================
FILE: home-manager/modules/river/json.lua
================================================
--
-- json.lua
--
-- Copyright (c) 2020 rxi
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy of
-- this software and associated documentation files (the "Software"), to deal in
-- the Software without restriction, including without limitation the rights to
-- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-- of the Software, and to permit persons to whom the Software is furnished to do
-- so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
--
local json = { _version = "0.1.2" }
-------------------------------------------------------------------------------
-- Encode
-------------------------------------------------------------------------------
local encode
local escape_char_map = {
[ "\\" ] = "\\",
[ "\"" ] = "\"",
[ "\b" ] = "b",
[ "\f" ] = "f",
[ "\n" ] = "n",
[ "\r" ] = "r",
[ "\t" ] = "t",
}
local escape_char_map_inv = { [ "/" ] = "/" }
for k, v in pairs(escape_char_map) do
escape_char_map_inv[v] = k
end
local function escape_char(c)
return "\\" .. (escape_char_map[c] or string.format("u%04x", c:byte()))
end
local function encode_nil(val)
return "null"
end
local function encode_table(val, stack)
local res = {}
stack = stack or {}
-- Circular reference?
if stack[val] then error("circular reference") end
stack[val] = true
if rawget(val, 1) ~= nil or next(val) == nil then
-- Treat as array -- check keys are valid and it is not sparse
local n = 0
for k in pairs(val) do
if type(k) ~= "number" then
error("invalid table: mixed or invalid key types")
end
n = n + 1
end
if n ~= #val then
error("invalid table: sparse array")
end
-- Encode
for i, v in ipairs(val) do
table.insert(res, encode(v, stack))
end
stack[val] = nil
return "[" .. table.concat(res, ",") .. "]"
else
-- Treat as an object
for k, v in pairs(val) do
if type(k) ~= "string" then
error("invalid table: mixed or invalid key types")
end
table.insert(res, encode(k, stack) .. ":" .. encode(v, stack))
end
stack[val] = nil
return "{" .. table.concat(res, ",") .. "}"
end
end
local function encode_string(val)
return '"' .. val:gsub('[%z\1-\31\\"]', escape_char) .. '"'
end
local function encode_number(val)
-- Check for NaN, -inf and inf
if val ~= val or val <= -math.huge or val >= math.huge then
error("unexpected number value '" .. tostring(val) .. "'")
end
return string.format("%.14g", val)
end
local type_func_map = {
[ "nil" ] = encode_nil,
[ "table" ] = encode_table,
[ "string" ] = encode_string,
[ "number" ] = encode_number,
[ "boolean" ] = tostring,
}
encode = function(val, stack)
local t = type(val)
local f = type_func_map[t]
if f then
return f(val, stack)
end
error("unexpected type '" .. t .. "'")
end
function json.encode(val)
return ( encode(val) )
end
-------------------------------------------------------------------------------
-- Decode
-------------------------------------------------------------------------------
local parse
local function create_set(...)
local res = {}
for i = 1, select("#", ...) do
res[ select(i, ...) ] = true
end
return res
end
local space_chars = create_set(" ", "\t", "\r", "\n")
local delim_chars = create_set(" ", "\t", "\r", "\n", "]", "}", ",")
local escape_chars = create_set("\\", "/", '"', "b", "f", "n", "r", "t", "u")
local literals = create_set("true", "false", "null")
local literal_map = {
[ "true" ] = true,
[ "false" ] = false,
[ "null" ] = nil,
}
local function next_char(str, idx, set, negate)
for i = idx, #str do
if set[str:sub(i, i)] ~= negate then
return i
end
end
return #str + 1
end
local function decode_error(str, idx, msg)
local line_count = 1
local col_count = 1
for i = 1, idx - 1 do
col_count = col_count + 1
if str:sub(i, i) == "\n" then
line_count = line_count + 1
col_count = 1
end
end
error( string.format("%s at line %d col %d", msg, line_count, col_count) )
end
local function codepoint_to_utf8(n)
-- http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=iws-appendixa
local f = math.floor
if n <= 0x7f then
return string.char(n)
elseif n <= 0x7ff then
return string.char(f(n / 64) + 192, n % 64 + 128)
elseif n <= 0xffff then
return string.char(f(n / 4096) + 224, f(n % 4096 / 64) + 128, n % 64 + 128)
elseif n <= 0x10ffff then
return string.char(f(n / 262144) + 240, f(n % 262144 / 4096) + 128,
f(n % 4096 / 64) + 128, n % 64 + 128)
end
error( string.format("invalid unicode codepoint '%x'", n) )
end
local function parse_unicode_escape(s)
local n1 = tonumber( s:sub(1, 4), 16 )
local n2 = tonumber( s:sub(7, 10), 16 )
-- Surrogate pair?
if n2 then
return codepoint_to_utf8((n1 - 0xd800) * 0x400 + (n2 - 0xdc00) + 0x10000)
else
return codepoint_to_utf8(n1)
end
end
local function parse_string(str, i)
local res = ""
local j = i + 1
local k = j
while j <= #str do
local x = str:byte(j)
if x < 32 then
decode_error(str, j, "control character in string")
elseif x == 92 then -- `\`: Escape
res = res .. str:sub(k, j - 1)
j = j + 1
local c = str:sub(j, j)
if c == "u" then
local hex = str:match("^[dD][89aAbB]%x%x\\u%x%x%x%x", j + 1)
or str:match("^%x%x%x%x", j + 1)
or decode_error(str, j - 1, "invalid unicode escape in string")
res = res .. parse_unicode_escape(hex)
j = j + #hex
else
if not escape_chars[c] then
decode_error(str, j - 1, "invalid escape char '" .. c .. "' in string")
end
res = res .. escape_char_map_inv[c]
end
k = j + 1
elseif x == 34 then -- `"`: End of string
res = res .. str:sub(k, j - 1)
return res, j + 1
end
j = j + 1
end
decode_error(str, i, "expected closing quote for string")
end
local function parse_number(str, i)
local x = next_char(str, i, delim_chars)
local s = str:sub(i, x - 1)
local n = tonumber(s)
if not n then
decode_error(str, i, "invalid number '" .. s .. "'")
end
return n, x
end
local function parse_literal(str, i)
local x = next_char(str, i, delim_chars)
local word = str:sub(i, x - 1)
if not literals[word] then
decode_error(str, i, "invalid literal '" .. word .. "'")
end
return literal_map[word], x
end
local function parse_array(str, i)
local res = {}
local n = 1
i = i + 1
while 1 do
local x
i = next_char(str, i, space_chars, true)
-- Empty / end of array?
if str:sub(i, i) == "]" then
i = i + 1
break
end
-- Read token
x, i = parse(str, i)
res[n] = x
n = n + 1
-- Next token
i = next_char(str, i, space_chars, true)
local chr = str:sub(i, i)
i = i + 1
if chr == "]" then break end
if chr ~= "," then decode_error(str, i, "expected ']' or ','") end
end
return res, i
end
local function parse_object(str, i)
local res = {}
i = i + 1
while 1 do
local key, val
i = next_char(str, i, space_chars, true)
-- Empty / end of object?
if str:sub(i, i) == "}" then
i = i + 1
break
end
-- Read key
if str:sub(i, i) ~= '"' then
decode_error(str, i, "expected string for key")
end
key, i = parse(str, i)
-- Read ':' delimiter
i = next_char(str, i, space_chars, true)
if str:sub(i, i) ~= ":" then
decode_error(str, i, "expected ':' after key")
end
i = next_char(str, i + 1, space_chars, true)
-- Read value
val, i = parse(str, i)
-- Set
res[key] = val
-- Next token
i = next_char(str, i, space_chars, true)
local chr = str:sub(i, i)
i = i + 1
if chr == "}" then break end
if chr ~= "," then decode_error(str, i, "expected '}' or ','") end
end
return res, i
end
local char_func_map = {
[ '"' ] = parse_string,
[ "0" ] = parse_number,
[ "1" ] = parse_number,
[ "2" ] = parse_number,
[ "3" ] = parse_number,
[ "4" ] = parse_number,
[ "5" ] = parse_number,
[ "6" ] = parse_number,
[ "7" ] = parse_number,
[ "8" ] = parse_number,
[ "9" ] = parse_number,
[ "-" ] = parse_number,
[ "t" ] = parse_literal,
[ "f" ] = parse_literal,
[ "n" ] = parse_literal,
[ "[" ] = parse_array,
[ "{" ] = parse_object,
}
parse = function(str, idx)
local chr = str:sub(idx, idx)
local f = char_func_map[chr]
if f then
return f(str, idx)
end
decode_error(str, idx, "unexpected character '" .. chr .. "'")
end
function json.decode(str)
if type(str) ~= "string" then
error("expected argument of type string, got " .. type(str))
end
local res, idx = parse(str, next_char(str, 1, space_chars, true))
idx = next_char(str, idx, space_chars, true)
if idx <= #str then
decode_error(str, idx, "trailing garbage")
end
return res
end
return json
================================================
FILE: home-manager/modules/river/layout.lua
================================================
package.path = package.path .. ";/home/pinpox/.config/river-luatile/?.lua"
json = require "json"
print("river-luatile started!")
-- You can define your global state here
main_ratio = 0.65
gaps = 10
smart_gaps = false
current_layout = "rivertile"
output_layouts = { }
-- The most important function - the actual layout generator
--
-- The argument is a table with:
-- * Focused tags
-- * Window count
-- * Output width
-- * Output height
--
-- The return value must be a table with exactly `count` entries. Each entry is a table with four
-- numbers:
-- * X coordinate
-- * Y coordinate
-- * Window width
-- * Window height
argumunts = {}
function handle_metadata(args)
return { name = output_layouts[args.output] }
end
-- We choose from one of the existing layouts defined in the table further down
function handle_layout(args)
-- print(args.output)
arguments = args
-- Default to rivertile as layout for all outputs
if output_layouts[args.output] == nil then
output_layouts[args.output] = "rivertile"
end
return layouts[output_layouts[args.output]](args)
end
-- This example is a simplified version of `rivertile`
function handle_layout_rivertile(args)
print("handle_layout() reached!")
-- print(json.encode(args))
local retval = {}
if args.count == 1 then
if smart_gaps then
table.insert(retval, { 0, 0, args.width, args.height })
else
table.insert(retval, { gaps, gaps, args.width - gaps * 2, args.height - gaps * 2 })
end
elseif args.count > 1 then
local main_w = (args.width - gaps * 3) * main_ratio
local side_w = (args.width - gaps * 3) - main_w
local main_h = args.height - gaps * 2
local side_h = (args.height - gaps) / (args.count - 1) - gaps
table.insert(retval, {
gaps,
gaps,
main_w,
main_h,
})
for i = 0, (args.count - 2) do
table.insert(retval, {
main_w + gaps * 2,
gaps + i * (side_h + gaps),
side_w,
side_h,
})
end
end
-- print(json.encode(retval))
return retval
end
-- Monocle layout: Show just one big window, but not fullscreen
function handle_layout_monocle(args)
local retval = {}
offset = 20
gap = 5
for i = 0, (args.count -1) do
table.insert(retval, {
gap + i*offset,
gap + i*offset,
(args.width - gap *2) - (args.count -1) * offset,
(args.height - gap *2) - (args.count -1) * offset,
})
end
return retval
end
-- IMPORTANT: User commands send via `riverctl send-layout-cmd` are treated as lua code.
-- Active tags are stored in `CMD_TAGS` global variable.
-- Here is an example of a function that can be mapped to some key
-- Run with `riverctl send-layout-cmd luatile "toggle_gaps()"`
local gaps_alt = 0
function toggle_gaps()
print("toggle_gaps() reached!")
local tmp = gaps
gaps = gaps_alt
gaps_alt = tmp
end
-- Change output to a specific layout
function layout_switch(layout_name)
if layouts[layout_name] ~= nil then
current_layout = layout_name
end
end
-- Cycle layout of an output
function layout_cycle()
print("CYCLING LAYOUTS")
current_layout = output_layouts[CMD_OUTPUT]
-- TODO this could be nicer with a cycle
if current_layout == "rivertile" then
current_layout = "monocle"
elseif current_layout == "monocle" then
current_layout = "rivertile"
end
output_layouts[CMD_OUTPUT] = current_layout
end
-- Add all layouts here that should be supported
layouts = {
rivertile = handle_layout_rivertile,
monocle = handle_layout_monocle,
-- grid = handle_layout_grid,
}
================================================
FILE: home-manager/modules/river/river-config
================================================
#!/usr/bin/env bash
# This is the example configuration file for river.
#
# If you wish to edit this, you will probably want to copy it to
# $XDG_CONFIG_HOME/river/init or $HOME/.config/river/init first.
#
# See the river(1), riverctl(1), and rivertile(1) man pages for complete
# documentation.
# Set keyboard layout
# riverctl keyboard-layout -variant colemak us
riverctl keyboard-layout -variant colemak -options "caps:swapescape" us
# Super+Return to start an instance of foot (https://codeberg.org/dnkl/foot)
riverctl map normal Super Return spawn foot
# Super+Shif+Q to close the focused view
riverctl map normal Super+Shift Q close
# Super+Shift+E to exit river
riverctl map normal Super+Shift E exit
# Focus should follow the mouse
riverctl focus-follows-cursor normal
# riverctl focus-follows-cursor disabled
# Super+Tab and Super+Shift+Tab to focus the next/previous view in the layout
# stack
riverctl map normal Super Tab focus-view next
riverctl map normal Super+Shift Tab focus-view previous
# TODO focus-view has not implemeted left/down/right/left (yet)
# riverctl map normal Super H focus-view left
# riverctl map normal Super J focus-view down
# riverctl map normal Super K focus-view up
# riverctl map normal Super L focus-view right
# Super+Shift+J and Super+Shift+K to swap the focused view with the next/previous
# view in the layout stack
riverctl map normal Super+Shift J swap next
riverctl map normal Super+Shift K swap previous
# Super+H and Super+L to decrease/increase the main ratio of rivertile(1)
riverctl map normal Super+Shift H send-layout-cmd rivertile "main-ratio -0.05"
riverctl map normal Super+Shift L send-layout-cmd rivertile "main-ratio +0.05"
# Super+Period and Super+Comma to focus the next/previous output
riverctl map normal Super Period focus-output right
riverctl map normal Super Comma focus-output left
# Super+Shift+{Period,Comma} to send the focused view to the next/previous output
# TODO use -current-tags once PR has reached release
# https://github.com/riverwm/river/commit/b3698150708bec276454c0ff7c707d9dab446b1e
# riverctl map normal Super+Shift Period send-to-output -current-tags right
# riverctl map normal Super+Shift Comma send-to-output -current-tags left
riverctl map normal Super+Shift Period send-to-output right
riverctl map normal Super+Shift Comma send-to-output left
# Super+Return to bump the focused view to the top of the layout stack
riverctl map normal Super+Shift Return zoom
# Super+Shift++ and Super+Shift+- to increment/decrement the main count of rivertile(1)
riverctl map normal Super+Shift + send-layout-cmd rivertile "main-count +1"
riverctl map normal Super+Shift - send-layout-cmd rivertile "main-count -1"
# Super+Alt+{H,J,K,L} to move views
riverctl map normal Super+Alt H move left 100
riverctl map normal Super+Alt J move down 100
riverctl map normal Super+Alt K move up 100
riverctl map normal Super+Alt L move right 100
# Super+Alt+Control+{H,J,K,L} to snap views to screen edges
riverctl map normal Super+Alt+Control H snap left
riverctl map normal Super+Alt+Control J snap down
riverctl map normal Super+Alt+Control K snap up
riverctl map normal Super+Alt+Control L snap right
# Super+Alt+Shift+{H,J,K,L} to resize views
riverctl map normal Super+Alt+Shift H resize horizontal -100
riverctl map normal Super+Alt+Shift J resize vertical 100
riverctl map normal Super+Alt+Shift K resize vertical -100
riverctl map normal Super+Alt+Shift L resize horizontal 100
# Super + Left Mouse Button to move views
riverctl map-pointer normal Super BTN_LEFT move-view
# Super + Right Mouse Button to resize views
riverctl map-pointer normal Super BTN_RIGHT resize-view
# Super + Middle Mouse Button to toggle float
riverctl map-pointer normal Super BTN_MIDDLE toggle-float
for i in $(seq 1 9)
do
tags=$((1 << ($i - 1)))
# Super+[1-9] to focus tag [0-8]
riverctl map normal Super $i set-focused-tags $tags
# Super+Shift+[1-9] to tag focused view with tag [0-8]
riverctl map normal Super+Shift $i set-view-tags $tags
# Super+Control+[1-9] to toggle focus of tag [0-8]
riverctl map normal Super+Control $i toggle-focused-tags $tags
# Super+Shift+Control+[1-9] to toggle tag [0-8] of focused view
riverctl map normal Super+Shift+Control $i toggle-view-tags $tags
done
# Super+0 to focus all tags
# Super+Shift+0 to tag focused view with all tags
all_tags=$(((1 << 32) - 1))
riverctl map normal Super 0 set-focused-tags $all_tags
riverctl map normal Super+Shift 0 set-view-tags $all_tags
# Super+Shift+Space to toggle float
riverctl map normal Super+Shift Space toggle-float
# Super+Space to cycle layouts
riverctl map normal Super Space send-layout-cmd luatile 'layout_cycle()'
# Super+F to toggle fullscreen
riverctl map normal Super F toggle-fullscreen
# Super+{Up,Right,Down,Left} to change layout orientation
riverctl map normal Super Up send-layout-cmd rivertile "main-location top"
riverctl map normal Super Right send-layout-cmd rivertile "main-location right"
riverctl map normal Super Down send-layout-cmd rivertile "main-location bottom"
riverctl map normal Super Left send-layout-cmd rivertile "main-location left"
# Declare a passthrough mode. This mode has only a single mapping to return to
# normal mode. This makes it useful for testing a nested wayland compositor
riverctl declare-mode passthrough
# Super+F11 to enter passthrough mode
riverctl map normal Super F11 enter-mode passthrough
# Super+F11 to return to normal mode
riverctl map passthrough Super F11 enter-mode normal
# Various media key mapping examples for both normal and locked mode which do
# not have a modifier
for mode in normal locked
do
# Eject the optical drive (well if you still have one that is)
# riverctl map $mode None XF86Eject spawn 'eject -T'
# Control pulse audio volume with pamixer (https://github.com/cdemoulins/pamixer)
riverctl map $mode None XF86AudioRaiseVolume spawn 'pamixer -i 5'
riverctl map $mode None XF86AudioLowerVolume spawn 'pamixer -d 5'
riverctl map $mode None XF86AudioMute spawn 'pamixer --toggle-mute'
riverctl map $mode Super F12 spawn 'amixer set Capture toggle' # Mute microphone
# Control MPRIS aware media players with playerctl (https://github.com/altdesktop/playerctl)
riverctl map $mode None XF86AudioMedia spawn 'playerctl play-pause'
riverctl map $mode None XF86AudioPlay spawn 'playerctl play-pause'
riverctl map $mode None XF86AudioPrev spawn 'playerctl previous'
riverctl map $mode None XF86AudioNext spawn 'playerctl next'
done
# Set background and border color
riverctl background-color 0x #002b36
riverctl border-color-focused 0x418fdd
riverctl border-color-unfocused 0x586e75
# Set keyboard repeat rate
riverctl set-repeat 50 300
# Warp cursor when changing focus with keyboard
riverctl set-cursor-warp on-output-change
# Use lswt to get IDs of windows
# Make all views with an app-id that starts with "float" and title "foo" start floating.
riverctl rule-add float -app-id 'float*' -title 'foo'
# Float firefox screenshare indicator
riverctl rule-add float -title 'Firefox — Sharing Indicator'
# Make all views with app-id "bar" and any title use client-side decorations
riverctl rule-add csd -app-id "bar"
# Make specific applications use server-side decorations
riverctl rule-add ssd -app-id firefox
riverctl rule-add ssd -app-id pavucontrol
riverctl rule-add ssd -app-id thunderbird
# Needed to make xdg-desktop-portal-wlr work (screensharing)
dbus-update-activation-environment --systemd WAYLAND_DISPLAY WAYLAND_DESKTOP
# Set the default layout generator to be river-luatile and start it.
# River will send the process group of the init executable SIGTERM on exit.
riverctl default-layout luatile
# riverctl default-layout rivertile
# rivertile -view-padding 6 -outer-padding 6 &
river-luatile &
# Read nixos-generated config part
/home/pinpox/.config/river/init_exta
================================================
FILE: home-manager/modules/shell/default.nix
================================================
{ config, lib, ... }:
with lib;
let
cfg = config.pinpox.defaults.shell;
colors = config.pinpox.colors;
in
{
options.pinpox.defaults.shell = {
enable = mkEnableOption "shell defaults";
abbrev-aliases = mkOption {
type =
with types;
listOf (submodule {
options = {
alias = mkOption { type = str; };
command = mkOption { type = str; };
global = mkOption {
type = bool;
default = false;
description = "Expand alias everywhere, not only at the beginning of a line.";
};
recursive = mkOption {
type = bool;
default = false;
description = "Expand aliases recursively";
};
eval = mkOption {
type = bool;
default = false;
description = "Evaluate subshells on expansion";
};
};
});
example = [
{
alias = "nfu";
command = "nix flake update --commit-lock-file";
}
{
global = true;
alias = "G";
command = "| rg -i";
}
];
description = ''
Aliases for abbrev-allias ZSH plugin
https://github.com/momo-lab/zsh-abbrev-alias
'';
};
};
imports = [
./starship.nix
./zsh.nix
# ./fish.nix
];
config = mkIf cfg.enable {
programs.direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
# https://direnv.net/man/direnv.toml.1.html
# config = {};
};
pinpox.defaults.shell.abbrev-aliases = [
# Aliases expanded only at beginning of lines
{
alias = "flakeinit";
command = "nix flake init -t github:pinpox/nixos";
}
{
alias = "g";
command = "git";
}
{
alias = "o";
command = "xdg-open";
}
{
alias = "q";
command = "exit";
}
{
alias = "snvim";
command = "sudo -E nvim";
}
{
alias = "v";
command = "nvim";
}
{
alias = "nfu";
command = "nix flake update --commit-lock-file";
}
# {
# alias = "yt-dlp-mp4";
# command = "nix run nixpkgs#yt-dlp -- -S res,ext:mp4:m4a --recode mp4 ";
# }
{
alias = "rm-orig";
command = ''find . -name "*.orig" -type f -delete'';
}
# Global aliases, get expanded everywhere
{
global = true;
alias = "G";
command = "| rg -i";
}
{
global = true;
alias = "P";
command = "| paste";
}
];
programs.fzf = {
enable = true;
enableZshIntegration = true;
defaultOptions = [
"--height 40%"
"--layout=reverse"
"--border"
"--inline-info"
"--color 'fg:#${colors.White}'" # Text
"--color 'bg:#${colors.Black}'" # Background
"--color 'preview-fg:#${colors.White}'" # Preview window text
"--color 'preview-bg:#${colors.Black}'" # Preview window background
"--color 'hl:#${colors.Yellow}'" # Highlighted substrings
"--color 'fg+:#${colors.Blue}'" # Text (current line)
"--color 'bg+:#${colors.BrightBlack}'" # Background (current line)
"--color 'gutter:#${colors.BrightBlack}'" # Gutter on the left (defaults to bg+)
"--color 'hl+:#${colors.Magenta}'" # Highlighted substrings (current line)
"--color 'info:#${colors.Magenta}'" # Info line (match counters)
"--color 'border:#${colors.Blue}'" # Border around the window (--border and --preview)
"--color 'prompt:#${colors.White}'" # Prompt
"--color 'pointer:#${colors.Magenta}'" # Pointer to the current line
"--color 'marker:#${colors.Magenta}'" # Multi-select marker
"--color 'spinner:#${colors.Magenta}'" # Streaming input indicator
"--color 'header:#${colors.White}'" # Header
];
};
programs.dircolors = {
enable = true;
enableZshIntegration = true;
};
programs.pazi = {
enable = true;
enableZshIntegration = true;
};
programs.htop = {
enable = true;
settings.tree_view = true;
};
programs.jq.enable = true;
programs.bat = {
enable = true;
# TODO: This should pick up the correct colors for the generated theme. Otherwise
# it is possible to generate a custom bat theme to ~/.config/bat/config
config = {
theme = "base16";
};
};
};
}
================================================
FILE: home-manager/modules/shell/fish.nix
================================================
{ pkgs, promterm, ... }:
{
programs = {
fzf.enableFishIntegration = true;
dircolors.enableFishIntegration = true;
pazi.enableFishIntegration = true;
};
programs.fish = {
enable = true;
functions = {
gitignore = "curl -sL https://www.gitignore.io/api/$argv";
fish_command_not_found = "echo Did not find command $argv[1]";
# Create and change to a directory
take = ''mkdir -p -- "$1" && cd -- "$1"'';
# Create and change to a new temporary directory
ttake = "cd $(mktemp -d)";
# Use `line 10 /etc/hosts` to get 10th line of file
line = ''awk "NR == $1" "$2"'';
};
plugins = [
{
# https://github.com/gazorby/fifc
name = "fifc";
src = pkgs.fetchFromGitHub {
owner = "gazorby";
repo = "fifc";
rev = "a01650cd432becdc6e36feeff5e8d657bd7ee84a";
sha256 = "sha256-Ynb0Yd5EMoz7tXwqF8NNKqCGbzTZn/CwLsZRQXIAVp4=";
};
}
];
shellAbbrs = {
o = "xdg-open";
q = "exit";
snvim = "sudo -E nvim";
v = "nvim";
# Global aliases, get expanded everywhere
# abbrev-alias -g G = "| rg -i"
# abbrev-alias - g P="| tb"
#TODO
};
shellAliases = rec {
# Eza ls replacement
ls = "${pkgs.eza}/bin/eza --group-directories-first";
l = "${ls} -lbF --git --icons";
ll = "${l} -G";
la = "${ls} -lbhHigmuSa@ --time-style=long-iso --git --color-scale --icons";
lt = "${ls} --tree --level=2 --icons";
# Git
gs = "${pkgs.git}/bin/git status";
# Pastebin (termbin.com)
tb = "${pkgs.netcat-gnu}/bin/nc termbin.com 9999";
# Frequendly used folders
cdn = "cd ~/code/github.com/pinpox/nixos";
cdnh = "cd ~/code/github.com/pinpox/nixos-home";
# Other
pt = "${promterm.defaultPackage.x86_64-linux}/bin/promterm 'https://vpn.prometheus.pablo.tools/api/v1/alerts'";
lsblk = "lsblk -o name,mountpoint,label,size,type,uuid";
c = "${pkgs.bat}/bin/bat -n --decorations never";
cc = "${pkgs.clang}/bin/clang -Wall -Wextra -pedantic -std=c99 -Wshadow -Weverything";
qr = "${pkgs.qrencode}/bin/qrencode -t utf8 -o-";
top = "${pkgs.htop}/bin/htop";
weather = "${pkgs.curl}/bin/curl -4 http://wttr.in/Koeln";
#radio = "${
#pkgs.mpv}/bin/mpv http://lassul.us:8000/radio.ogg";
zzz = "systemctl suspend";
serve = "${pkgs.miniserve}/bin/miniserve";
za = "${./zellij-chooser}";
upterm = "${pkgs.upterm}/bin/upterm host --server ssh://upterm.thalheim.io:2323 --force-command 'zellij attach pair-programming' -- zellij attach --create pair-programming";
};
};
}
================================================
FILE: home-manager/modules/shell/starship.nix
================================================
{ ... }:
{
programs.starship = {
enable = false;
enableBashIntegration = true;
enableZshIntegration = true;
settings = {
character = {
success_symbol = "[»](bold green)";
error_symbol = "[×](bold red) ";
};
aws = {
disabled = true;
};
python = {
disabled = true;
};
nix_shell = {
symbol = "❄ ";
};
git_status = {
ahead = "↑";
behind = "↓";
diverged = "↕";
modified = "!";
staged = "±";
renamed = "→";
};
directory = {
truncate_to_repo = false;
fish_style_pwd_dir_length = 2;
substitutions = {
"~/code/github.com/pinpox/nixos" = "";
};
};
};
};
}
================================================
FILE: home-manager/modules/shell/zellij-chooser
================================================
#!/usr/bin/env bash
ZJ_SESSIONS=$(zellij list-sessions -n)
NO_SESSIONS=$(echo "${ZJ_SESSIONS}" | wc -l)
if [ "${NO_SESSIONS}" -ge 2 ]; then
zellij attach "$(echo "${ZJ_SESSIONS}" | fzf | cut -d' ' -f1)"
else
zellij attach -c
fi
================================================
FILE: home-manager/modules/shell/zsh.nix
================================================
{
flake-inputs,
pkgs,
promterm,
lib,
config,
...
}:
{
programs.zsh = {
enable = true;
autosuggestion = {
enable = true;
highlight = "fg=8";
};
enableCompletion = true;
autocd = true;
dotDir = "${config.xdg.configHome}/zsh";
sessionVariables = {
RPS1 = ""; # Disable the right side prompt that "walters" theme introduces
ZDOTDIR = "/home/pinpox/.config/zsh";
# Override prezto's default LESS which includes -z-4 (negative scroll
# window size), rejected by less >= 691
LESS = "-g -i -M -R -S -w -X -z4";
};
initContent =
let
abbrevs = lib.concatStrings (
map (
a:
let
opt = lib.strings.optionalString;
in
''
abbrev-alias ${opt a.global "-g "}${opt a.eval "-e "}${opt a.recursive "-r "}${a.alias}="${a.command}"
''
) config.pinpox.defaults.shell.abbrev-aliases
);
functions = ''
function "="() { printf "%s\n" "$@" | ${pkgs.bc}/bin/bc }
function ai() {
echo "$@" | $##{pkgs.shell-gpt}/bin/sgpt
}
function aip() {
wl-paste | $##{pkgs.shell-gpt}/bin/sgpt
}
# Create a temporary, detached worktree of the current git repo.
# Great for quick hot-fixes.
twork () {
local wtpath="$(mktemp -d)"
git worktree add --detach $wtpath
cd $wtpath
}
# Jump to a code project with FZF using Ctrl+j
fzf_cd_widget() {
local base="/home/pinpox/code"
local rel full
rel=$(
find "$base" -maxdepth 3 -type d \
| grep -E '(/.*){6}' \
| sed "s|^$base/||" \
| fzf --preview "BASE=$base sh -c '${pkgs.eza}/bin/eza \
--group-directories-first --tree --level=2 --icons \"\$BASE/\$0\"' {}"
) || return
full="$base/$rel"
cd "$full" || return
if [[ -n "$ZLE_NAME" ]]; then
zle reset-prompt
fi
}
zle -N fzf_cd_widget
bindkey '^J' fzf_cd_widget
${lib.optionalString (pkgs.stdenv.hostPlatform.system == "x86_64-linux") ''
# Power profile function using ryzenadj (x86_64 only)
power-profile() {
if [ $# -ne 4 ]; then
echo "Usage: power-profile "
echo "Example: power-profile PERFORMANCE 30000 35000 35000"
return 1
fi
local name=$1
local stapm=$2 # Sustained power limit
local fast=$3 # Short burst power limit (instant peak response)
local slow=$4 # Slow burst power limit (~5-10s)
sudo ${lib.getExe pkgs.ryzenadj} --stapm-limit=$stapm --fast-limit=$fast --slow-limit=$slow && \
echo "Power profile set to: $name (''${stapm}mW/''${fast}mW/''${slow}mW)"
}
''}
'';
in
lib.mkMerge [
(lib.mkOrder 550 ((builtins.readFile ./zshrc) + ''
unsetopt nomatch
''))
abbrevs
(builtins.readFile ./zshrc-extra)
(builtins.readFile ./zshrc-coffee)
functions
];
history = {
expireDuplicatesFirst = true;
ignoreSpace = false;
save = 15000;
share = true;
};
dirHashes = {
# Allows addressing directorys by shortname, e.g. `cd ~notes`
docs = "$HOME/Documents";
notes = "$HOME/Notes";
downloads = "$HOME/Downloads";
nix-config = "/home/pinpox/code/github.com/pinpox/nixos";
clan = "$HOME/code/git.clan.lol/clan/clan-core";
clan-infra = "$HOME/code/git.clan.lol/clan/clan-infra";
};
shellAliases = rec {
remote-review = ''nixpkgs-review pr --build-args="--builders 'ssh://pinpox@build-box.nix-community.org'"'';
# eza ls replacement
ls = "${pkgs.eza}/bin/eza --group-directories-first";
l = "${ls} -lbF --git --icons";
ll = "${l} -G";
la = "${ls} -lbhHigmuSa@ --time-style=long-iso --git --color-scale --icons";
lt = "${ls} --tree --level=2 --icons";
nb = "nix build --no-link --print-out-paths -L";
ne = "nix eval --strict --json";
# Git
gs = "${pkgs.git}/bin/git status";
# Pastebin (termbin.com)
tb = "${pkgs.netcat-gnu}/bin/nc termbin.com 9999";
# Frequendly used folders
cdn = "cd ~/code/github.com/pinpox/nixos";
cdnh = "cd ~/code/github.com/pinpox/nixos-home";
# Other
lsblk = "lsblk -o name,mountpoint,label,size,type,uuid";
c = "${pkgs.bat}/bin/bat -n --decorations never";
cc = "${pkgs.clang}/bin/clang -Wall -Wextra -pedantic -std=c99 -Wshadow -Weverything";
qr = "${pkgs.qrencode}/bin/qrencode -t utf8 -o-";
top = "${pkgs.htop}/bin/htop";
weather = "${pkgs.curl}/bin/curl -4 http://wttr.in/Koeln";
# radio = "${
#pkgs.mpv}/bin/mpv http://lassul.us:8000/radio.ogg";
# ${pkgs.yubikey-manager}/bin/ykman oath accounts code | \
yotp = ''
${pkgs.fzf}/bin/fzf | awk '{print $2}' | ${pkgs.xclip}/bin/xclip -sel clip
'';
zzz = "systemctl suspend";
picohsm-add-to-agent = "ssh-add -e ${pkgs.opensc}/lib/opensc-pkcs11.so 2>/dev/null; SSH_ASKPASS=${lib.getExe pkgs.noctalia-askpass} SSH_ASKPASS_REQUIRE=prefer ssh-add -s ${pkgs.opensc}/lib/opensc-pkcs11.so";
serve = "${pkgs.miniserve}/bin/miniserve";
za = "${./zellij-chooser}";
upterm = "${pkgs.upterm}/bin/upterm host --server ssh://upterm.thalheim.io:2323 --force-command 'zellij attach pair-programming' -- zellij attach --create pair-programming";
} // lib.optionalAttrs (pkgs.stdenv.hostPlatform.system == "x86_64-linux") {
# x86_64-only aliases
gif = "${flake-inputs.gif-searcher.packages.x86_64-linux.default}/bin/show-gif";
gifi = "${flake-inputs.gif-searcher.packages.x86_64-linux.gif-infinite}/bin/show-gif";
pt = "${promterm.defaultPackage.x86_64-linux}/bin/promterm 'https://vpn.prometheus.pablo.tools/api/v1/alerts'";
# Power profile aliases (requires ryzenadj)
power-performance = "power-profile PERFORMANCE 30000 35000 35000";
power-balanced = "power-profile BALANCED 25000 33000 33000";
power-saver = "power-profile POWER-SAVER 26000 30000 15000";
power-ultra-saver = "power-profile ULTRA-POWER-SAVER 10000 20000 10000";
};
prezto = {
enable = true;
# prompt.theme = "pure";
# Case insensitive completion
caseSensitive = true;
# Autoconvert .... to ../..
editor.dotExpansion = true;
# Prezto modules to load
# pmodules = [ "utility" "editor" "directory" "completion"];
pmodules = [
"utility"
"editor"
"directory"
# "prompt"
];
terminal.autoTitle = true;
};
plugins = [
{
name = "zsh-forgit";
src = pkgs.zsh-forgit;
file = "share/zsh/zsh-forgit/forgit.plugin.zsh";
}
{
name = "fast-syntax-highlighting";
file = "fast-syntax-highlighting.plugin.zsh";
src = "${pkgs.zsh-fast-syntax-highlighting}/share/zsh/site-functions";
}
{
name = "zsh-nix-shell";
file = "nix-shell.plugin.zsh";
src = "${pkgs.zsh-nix-shell}/share/zsh-nix-shell";
}
{
name = "zsh-abbrev-alias";
file = "abbrev-alias.plugin.zsh";
src = "${pkgs.zsh-abbrev-alias}/share/zsh-abbrev-alias";
}
{
name = "zsh-colored-man-pages";
file = "colored-man-pages.plugin.zsh";
src = "${pkgs.zsh-colored-man-pages}/share/zsh-colored-man-pages";
}
{
name = "zsh-fzf-tab";
file = "fzf-tab.plugin.zsh";
src = "${pkgs.zsh-fzf-tab}/share/fzf-tab";
}
{
name = "zsh-async";
file = "async.zsh";
src = "${pkgs.zsh-async}/share/zsh-async";
}
];
};
}
================================================
FILE: home-manager/modules/shell/zshrc
================================================
# zsh-prompt.zsh - Nushell-style prompt for zsh
#
# Set HOST_COLOR before sourcing this file, e.g.:
# HOST_COLOR="magenta"
# HOST_COLOR="#ff79c6"
# source /path/to/zsh-prompt.zsh
#
# Supports named colors (red, green, magenta, ...), 256-palette
# numbers (0-255), and hex colors (#rrggbb).
HOST_COLOR="${HOST_COLOR:-default}"
zmodload zsh/datetime
setopt PROMPT_SUBST
# Short hostname locally, user@hostname over SSH
if [[ -n "$SSH_CONNECTION" ]]; then
_PROMPT_HOST="${USER}@${HOST}"
else
_PROMPT_HOST="${HOST%%.*}"
fi
# Derive HOST_COLOR from hostname hash if not explicitly set.
# Maps hash bytes into the 20-180 range for readable white text on top.
if [[ -z "$HOST_COLOR" || "$HOST_COLOR" == "default" ]]; then
_hc_hash=$(printf '%s' "$HOST" | md5sum)
_hc_r=$(( 16#${_hc_hash[1,2]} % 161 + 20 ))
_hc_g=$(( 16#${_hc_hash[3,4]} % 161 + 20 ))
_hc_b=$(( 16#${_hc_hash[5,6]} % 161 + 20 ))
HOST_COLOR="$(printf '#%02x%02x%02x' $_hc_r $_hc_g $_hc_b)"
unset _hc_r _hc_g _hc_b _hc_hash
fi
# Resolve HOST_COLOR into raw ANSI escape sequences so that hex
# colors (#rrggbb) work alongside named/256 colors.
if [[ "$HOST_COLOR" == "#"* ]]; then
_hc_hex="${HOST_COLOR#\#}"
_hc_r=$((16#${_hc_hex[1,2]}))
_hc_g=$((16#${_hc_hex[3,4]}))
_hc_b=$((16#${_hc_hex[5,6]}))
_prompt_hc_fg=$'\e[38;2;'"${_hc_r};${_hc_g};${_hc_b}"'m'
_prompt_hc_bg=$'\e[48;2;'"${_hc_r};${_hc_g};${_hc_b}"'m'
else
_prompt_hc_fg="$(print -Pn "%F{${HOST_COLOR}}")"
_prompt_hc_bg="$(print -Pn "%K{${HOST_COLOR}}")"
fi
unset _hc_hex _hc_r _hc_g _hc_b
# Vi mode indicator
_vi_mode_indicator=" "
function zle-keymap-select {
case $KEYMAP in
vicmd) _vi_mode_indicator="> " ;;
viins|main) _vi_mode_indicator=" " ;;
esac
zle reset-prompt
}
zle -N zle-keymap-select
function zle-line-init {
_vi_mode_indicator=" "
}
zle -N zle-line-init
# Command duration tracking
_prompt_cmd_start=0
_prompt_preexec() {
_prompt_cmd_start=$EPOCHREALTIME
}
_prompt_format_duration() {
local -i ms=$1
if (( ms < 1000 )); then
printf '%dms' $ms
elif (( ms < 60000 )); then
local -i sec=$(( ms / 1000 ))
local -i rem=$(( ms % 1000 ))
if (( rem > 0 )); then
printf '%dsec %dms' $sec $rem
else
printf '%dsec' $sec
fi
elif (( ms < 3600000 )); then
local -i min=$(( ms / 60000 ))
local -i sec=$(( (ms % 60000) / 1000 ))
if (( sec > 0 )); then
printf '%dmin %dsec' $min $sec
else
printf '%dmin' $min
fi
else
local -i hr=$(( ms / 3600000 ))
local -i min=$(( (ms % 3600000) / 60000 ))
if (( min > 0 )); then
printf '%dhr %dmin' $hr $min
else
printf '%dhr' $hr
fi
fi
}
# Computed prompt segments (rebuilt each precmd)
_prompt_segments=""
_prompt_precmd() {
local exit_code=$?
# Duration
local duration=""
if (( _prompt_cmd_start > 0 )); then
local -i elapsed_ms=$(( (EPOCHREALTIME - _prompt_cmd_start) * 1000 ))
duration="$(_prompt_format_duration $elapsed_ms)"
_prompt_cmd_start=0
fi
# JJ branches (skip on gitbutler/* git branches)
local jj_branches=""
local git_branch
git_branch=$(command git symbolic-ref --short HEAD 2>/dev/null)
if [[ "$git_branch" != gitbutler/* ]]; then
local jj_out
jj_out=$(PAGER=cat command jj log -r 'trunk()..@ & bookmarks()' -T 'bookmarks.join("\n") ++ "\n"' --no-graph --ignore-working-copy 2>/dev/null)
if [[ $? -eq 0 && -n "$jj_out" ]]; then
jj_out="${jj_out//$'\n'/ }"
jj_out="${jj_out%% }"
jj_out="${jj_out## }"
[[ -n "$jj_out" ]] && jj_branches="$jj_out"
fi
fi
# Build segments
# Path: bold underline, red for root
if (( EUID == 0 )); then
_prompt_segments="%U%B%F{red}%~%f%b%u"
else
_prompt_segments="%U%B%~%b%u"
fi
# Nix shell name
[[ -n "$name" ]] && _prompt_segments+=" %F{red}${name}%f"
# Duration (dark gray italic)
[[ -n "$duration" ]] && \
_prompt_segments+=$' %F{240}%{\e[3m%}'"${duration}"$'%{\e[23m%}%f'
# JJ branches (magenta)
[[ -n "$jj_branches" ]] && \
_prompt_segments+=" %F{magenta}${jj_branches}%f"
# Last exit code (red bold)
(( exit_code != 0 )) && \
_prompt_segments+=" %F{red}%B×${exit_code}%b%f"
# Background jobs (yellow)
local njobs=${(Mw)#jobstates}
(( njobs > 0 )) && \
_prompt_segments+=" %F{yellow}[${njobs}]%f"
}
precmd_functions+=(_prompt_precmd)
preexec_functions+=(_prompt_preexec)
PROMPT=$'\n''%{${_prompt_hc_fg}%}╭%{${_prompt_hc_bg}%}%F{white}%B ${_PROMPT_HOST} %b%k%f ${_prompt_segments}'$'\n''%{${_prompt_hc_fg}%}╰▶ %f${_vi_mode_indicator}'
# Show nix-shell packages in right prompt
if [[ -n "$IN_NIX_SHELL" ]]; then
RPROMPT="%F{blue}${IN_NIX_SHELL} ${NIX_SHELL_PACKAGES}%f"
else
RPROMPT=""
fi
================================================
FILE: home-manager/modules/shell/zshrc-coffee
================================================
function coffee {
# Hide cursor
tput civis
# Restore cursor on exit
trap 'tput cnorm; clear; return 0' EXIT INT TERM
local frame1=' ) (
( ) )
) ( (
_______)_
.-'"'"'---------|
( C|/\/\/\/\/|
'"'"'-./\/\/\/\/|
'"'"'_________'"'"'
'"'"'-------'"'"'
pinpox went for coffee.
brb.
'
local frame2=' ( )
) ( (
( ) )
_______(_
.-'"'"'---------|
( C|/\/\/\/\/|
'"'"'-./\/\/\/\/|
'"'"'_________'"'"'
'"'"'-------'"'"'
pinpox went for coffee.
brb.
'
while true; do
clear
echo "$frame1"
sleep 0.5
clear
echo "$frame2"
sleep 0.5
done
}
================================================
FILE: home-manager/modules/shell/zshrc-extra
================================================
# Create and change to a directory
take () { mkdir -p -- "$1" && cd -- "$1"; }
# Create and change to a new temporary directory
ttake () { cd $(mktemp -d) }
# Use `line 10 /etc/hosts` to get 10th line of file
line () { awk "NR == $1" "$2" }
# Bind up and down keys to history matching partial input
bindkey "$terminfo[kcuu1]" history-search-backward
bindkey "$terminfo[kcud1]" history-search-forward
# Init h (https://github.com/zimbatm/h)
eval "$(h --setup ~/code)"
# fzf-compete files with ctrl+t
bindkey -s "^T" 'pazi_cd --pipe="fzf"^M'
# Make tab-completion case-insensitive
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
# fzf-tab: https://github.com/Aloxaf/fzf-tab?tab=readme-ov-file#configure
# set list-colors to enable filename colorizing
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
# preview directory's content with eza when completing cd
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
# Wastebin
# command | paste
function paste() {
jq -Rns '{text: inputs}' | curl -s -H 'Content-Type: application/json' \
--data-binary @- https://paste.0cx.de | jq -r '. | "https://paste.0cx.de\(.path)"'
}
# Self-hosted transfer.sh sharing. Expects ~/.netrc with crendentials in this format:
# machine transfer.0cx.de login my-super-user password super-secret-password
# transfer file.txt
transfer () {
if [ $# -eq 0 ]
then
echo "No arguments specified.\nUsage:\n transfer \n ... | transfer " >&2
return 1
fi
if tty -s
then
file="$1"
file_name=$(basename "$file")
if [ ! -e "$file" ]
then
echo "$file: No such file or directory" >&2
return 1
fi
if [ -d "$file" ]
then
file_name="$file_name.zip" ,
(
cd "$file" && zip -r -q - .
) | curl -n --progress-bar --upload-file "-" "https://transfer.0cx.de/$file_name" | tee /dev/null,
else
cat "$file" | curl -n --progress-bar --upload-file "-" "https://transfer.0cx.de/$file_name" | tee /dev/null
fi
else
file_name=$1
curl -n --progress-bar --upload-file "-" "https://transfer.0cx.de/$file_name" | tee /dev/null
fi
}
function delta_sidebyside {
if [[ COLUMNS -ge 140 ]]; then
export DELTA_FEATURES='side-by-side'
else
export DELTA_FEATURES=''
fi
}
trap delta_sidebyside WINCH
# Checkout a Gitea PR by number, setting up SSH remote and upstream tracking
tea-pr() {
local pr="$1"
[[ -z "$pr" ]] && { echo "Usage: tea-pr "; return 1; }
local head
head=$(tea pr view "$pr" --output json --fields index,head \
| jq -r ".[] | select(.index==\"${pr}\") | .head")
if [[ -z "$head" ]]; then
echo "Error: PR #${pr} not found"
return 1
fi
local owner branch
if [[ "$head" == *:* ]]; then
owner="${head%%:*}"
branch="${head#*:}"
else
owner=""
branch="$head"
fi
if [[ -z "$owner" ]]; then
git fetch origin "$branch"
git checkout -b "pr-${pr}" "origin/${branch}"
else
local remote="pulls/${owner}"
git remote add "$remote" "gitea@git.clan.lol:${owner}/clan-core.git" 2>/dev/null
git fetch "$remote" "$branch"
git checkout -b "pr-${pr}" "${remote}/${branch}"
git branch --set-upstream-to="${remote}/${branch}"
fi
echo "PR #${pr}: on branch pr-${pr}"
}
autoload -z edit-command-line
zle -N edit-command-line
# Allow jumping between prompts in foot with Ctrl+Shift+x/z
precmd() {
print -Pn "\e]133;A\e\\"
}
================================================
FILE: home-manager/modules/ssh/default.nix
================================================
{
config,
lib,
...
}:
with lib;
let
cfg = config.pinpox.programs.ssh;
in
{
options.pinpox.programs.ssh.enable = mkEnableOption "SSH configuration";
config = mkIf cfg.enable {
programs.ssh = {
enable = true;
enableDefaultConfig = false;
matchBlocks = {
"*" = {
extraOptions = {
ForwardAgent = "no";
ServerAliveInterval = "0";
ServerAliveCountMax = "3";
Compression = "no";
AddKeysToAgent = "yes";
HashKnownHosts = "no";
UserKnownHostsFile = "~/.ssh/known_hosts";
ControlMaster = "no";
ControlPath = "~/.ssh/master-%r@%n:%p";
ControlPersist = "no";
PKCS11Provider = "/run/current-system/sw/lib/opensc-pkcs11.so";
# CertificateFile = "~/.ssh/cert.pub";
CertificateFile = "${./ssh-key-cert.pub}";
};
};
"ap-oben" = {
hostname = "UAP-ProOBEN.lan";
user = "pinpox";
extraOptions = {
PubkeyAcceptedAlgorithms = "+ssh-rsa";
HostkeyAlgorithms = "+ssh-rsa";
};
};
"ap-mitte" = {
hostname = "UAP-ProMITTE.lan";
user = "pinpox";
extraOptions = {
PubkeyAcceptedAlgorithms = "+ssh-rsa";
HostkeyAlgorithms = "+ssh-rsa";
};
};
"ap-unten" = {
hostname = "UAP-ProUNTEN.lan";
user = "pinpox";
extraOptions = {
PubkeyAcceptedAlgorithms = "+ssh-rsa";
HostkeyAlgorithms = "+ssh-rsa";
};
};
};
};
};
}
================================================
FILE: home-manager/modules/ssh/ssh-key-cert.pub
================================================
ecdsa-sha2-nistp256-cert-v01@openssh.com AAAAKGVjZHNhLXNoYTItbmlzdHAyNTYtY2VydC12MDFAb3BlbnNzaC5jb20AAAAg+QuBDYto1/9245C9ZBOC3u0xdyrn4jJ8ZDIlhiH06N0AAAAIbmlzdHAyNTYAAABBBCdOfrnazSXp7ZmHcePXSd4leP3Qafr4fmDr3w+AxwRChSn1zzLPjV8CvD/PdMU7jQA0HS/1ItREurmZCKS/ZnQAAAAAAAAAAAAAAAEAAAAOcGlucG94QHBpY29oc20AAAASAAAABnBpbnBveAAAAARyb290AAAAAAAAAAD//////////wAAAAAAAACCAAAAFXBlcm1pdC1YMTEtZm9yd2FyZGluZwAAAAAAAAAXcGVybWl0LWFnZW50LWZvcndhcmRpbmcAAAAAAAAAFnBlcm1pdC1wb3J0LWZvcndhcmRpbmcAAAAAAAAACnBlcm1pdC1wdHkAAAAAAAAADnBlcm1pdC11c2VyLXJjAAAAAAAAAAAAAAAzAAAAC3NzaC1lZDI1NTE5AAAAIAPcS8NMzwYLvKFOXeTZwX/W6ua0zIzs4zA0PW0xz62iAAAAUwAAAAtzc2gtZWQyNTUxOQAAAEDKiqLPktLn4KmCn5moBjxxLmEeAX18MIytub9xwVwqfWfTLXr1COR3UXQ5A1i4rZzaVS9G/G6LnTNLfU/2NJcH ssh-key
================================================
FILE: home-manager/modules/ssh/ssh-key.pub
================================================
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCdOfrnazSXp7ZmHcePXSd4leP3Qafr4fmDr3w+AxwRChSn1zzLPjV8CvD/PdMU7jQA0HS/1ItREurmZCKS/ZnQ= ssh-key
================================================
FILE: home-manager/modules/sway/default.nix
================================================
{
config,
pkgs,
lib,
wl-harmonograph,
...
}:
with lib;
let
cfg = config.pinpox.programs.sway;
start-sway =
pkgs.writeShellScriptBin "start-sway" # sh
''
export WLR_DRM_NO_MODIFIERS=1
# dbus-launch --sh-syntax --exit-with-session ${pkgs.sway}/bin/sway
${pkgs.sway}/bin/sway --unsupported-gpu
'';
# Wrapper that ensures only one noctalia-shell instance is running, so we can
# use exec_always and pick up new versions on update
start-noctalia = pkgs.writeShellApplication {
name = "start-noctalia";
runtimeInputs = [
pkgs.procps
pkgs.noctalia-shell
pkgs.himalaya
pkgs.python3
];
text = ''
# Kill any running instance (matches the quickshell process loading
# noctalia-shell's shell.qml). Ignore failure if none is running.
pkill -f 'quickshell.*noctalia-shell' || true
# Wait for the old process(es) to actually exit so the new instance
# can claim the IPC socket cleanly.
for _ in $(seq 1 50); do
pgrep -f 'quickshell.*noctalia-shell' >/dev/null || break
sleep 0.1
done
exec noctalia-shell
'';
};
in
{
options.pinpox.programs.sway = {
enable = mkEnableOption "sway window manager";
keyboardVariant = mkOption {
type = types.str;
default = "colemak";
description = "Keyboard variant for sway input (empty string for standard US layout)";
};
};
config = mkIf cfg.enable (
let
c = config.pinpox.colors;
# Dark theme color scheme (current)
darkColors = ''
client.focused #${c.BrightBlue} #${c.Blue} #${c.Black} #${c.BrightBlue} #${c.Blue}
client.focused_inactive #${c.BrightWhite} #${c.BrightBlack} #${c.BrightWhite} #${c.BrightBlack} #${c.BrightBlack}
client.unfocused #${c.BrightBlack} #${c.Black} #${c.BrightBlack} #${c.BrightBlack} #${c.Black}
client.urgent #${c.BrightRed} #${c.Red} #${c.White} #${c.Red} #${c.Red}
'';
# Light theme color scheme (inverted contrast)
lightColors = ''
client.focused #${c.Blue} #${c.BrightBlue} #${c.Black} #${c.Blue} #${c.BrightBlue}
client.focused_inactive #${c.BrightBlack} #${c.White} #${c.Black} #${c.BrightBlack} #${c.BrightBlack}
client.unfocused #${c.White} #${c.BrightWhite} #${c.BrightBlack} #${c.White} #${c.BrightWhite}
client.urgent #${c.Red} #${c.BrightRed} #${c.Black} #${c.Red} #${c.BrightRed}
'';
# Script to update Sway colors based on theme preference
swayThemeSwitcher = pkgs.writeShellScript "sway-theme-switcher" ''
theme="$1"
if [[ "$theme" == "prefer-light" ]]; then
${pkgs.sway}/bin/swaymsg '${lightColors}'
else
${pkgs.sway}/bin/swaymsg '${darkColors}'
fi
'';
in
{
# Animated harmonograph wallpaper service
systemd.user.services.wl-harmonograph =
let
wl-harmonograph-pkg = wl-harmonograph.packages.x86_64-linux.default;
fg = builtins.concatStringsSep "," [
c.Red
c.Green
c.Blue
c.Yellow
c.Cyan
c.Magenta
c.BrightBlue
];
in
{
Unit = {
Description = "Animated harmonograph wallpaper";
PartOf = [ "sway-session.target" ];
After = [ "sway-session.target" "kanshi.service" ];
Wants = [ "kanshi.service" ];
};
Service = {
ExecStart = "${wl-harmonograph-pkg}/bin/wl-harmonograph";
Environment = [
"HARMONOGRAPH_FG=${fg}"
"HARMONOGRAPH_BG=${c.Black},${c.BrightBlack}"
];
Restart = "on-failure";
RestartSec = 2;
};
Install = {
WantedBy = [ "sway-session.target" ];
};
};
# Enable theme switcher and register Sway's theme script
pinpox.services.theme-switcher = {
scripts = [ "${swayThemeSwitcher}" ];
};
xdg.portal.config.sway = {
# Use xdg-desktop-portal-gtk for every portal interface...
default = [ "gtk" ];
# ... except for the ScreenCast, Screenshot and Secret
"org.freedesktop.impl.portal.ScreenCast" = "wlr";
"org.freedesktop.impl.portal.Screenshot" = "wlr";
# ignore inhibit bc gtk portal always returns as success,
# despite sway/the wlr portal not having an implementation,
# stopping firefox from using wayland idle-inhibit
"org.freedesktop.impl.portal.Inhibit" = "none";
};
# laucher
programs.tofi = {
enable = true;
settings = {
width = "100%";
height = "100%";
border-width = "0";
outline-width = "0";
padding-left = "35%";
padding-top = "35%";
result-spacing = "25";
num-results = "5";
font = config.pinpox.font.normal.family;
background-color = "#${c.Black}A0";
text-color = "#${c.White}";
selection-color = "#${c.BrightBlue}";
selection-match-color = "#${c.Magenta}";
input-color = "#${c.BrightWhite}";
prompt-text = "\"\"";
placeholder-text = "yes?";
placeholder-color = "#${c.Yellow}";
};
};
home.packages = with pkgs; [
wl-clipboard
wlr-randr
start-sway
font-awesome
line-awesome
];
wayland.windowManager.sway = {
enable = true;
config = rec {
seat = {
"*" = {
xcursor_theme = "${config.gtk.cursorTheme.name} ${toString config.gtk.cursorTheme.size}";
};
};
keybindings = lib.mkOptionDefault {
# Terminal
"${modifier}+Return" = "exec rio";
# Launcher
"${modifier}+p" = ''
exec ${lib.getExe pkgs.noctalia-shell} ipc call launcher toggle
'';
# OpenCrow chat panel
"${modifier}+a" = ''
exec ${lib.getExe pkgs.noctalia-shell} ipc call plugin:opencrow-chat toggle
'';
# Url
"${modifier}+Shift+p" = ''
exec ${pkgs.firefox}/bin/firefox --new-window $(cat ~/.local/share/tofi-bookmarks | ${pkgs.tofi}/bin/tofi)
'';
# Toggle microphone mute
"${modifier}+m" =
let
mic-toggle =
pkgs.writeShellScriptBin "mic-toggle" # sh
''
source=$(${pkgs.pulseaudio}/bin/pactl get-default-source)
${pkgs.pulseaudio}/bin/pactl set-source-mute "$source" toggle
'';
in
"exec ${mic-toggle}/bin/mic-toggle";
# Cycle in tabbed with win+tab
"${modifier}+Shift+Tab" = "focus prev";
"${modifier}+Tab" = "focus next";
# Screen lock
"${modifier}+Shift+l" = "exec ${pkgs.swaylock}/bin/swaylock";
# Scratchpad
"${modifier}+u" =
"exec swaymsg '[app_id=\"dropdown\"] scratchpad show; [app_id=\"dropdown\"] resize set width 100 ppt height 100 ppt; [app_id=\"dropdown\"] move container to position 0 px 0 px'";
# Screen brightness
"XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%+";
"XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
# Volume key
"XF86AudioMute" = "exec ${pkgs.pamixer}/bin/pamixer --toggle-mute";
"XF86AudioLowerVolume" = "exec ${pkgs.pamixer}/bin/pamixer -d 5";
"XF86AudioRaiseVolume" = "exec ${pkgs.pamixer}/bin/pamixer -i 5";
# Media keys
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
# "Airplane" button
# "XF86RFKill" =
# "Gear" button
# "XF86AudioMedia" =
# Screenshots
"Print" = "exec screenshot-region";
"Shift+Print" = "exec screenshot-region-file";
};
modifier = "Mod4"; # Win key
terminal = "rio";
floating.modifier = "Mod4";
startup = [
{
command =
let
init-dropdown = pkgs.writeShellScript "init-dropdown" ''
# Start the terminal
${pkgs.rio}/bin/rio --app-id=dropdown &
# Wait for it to be moved to scratchpad by window rules
sleep 0.5
# Fix position while it's in scratchpad (this ensures correct position on first show)
${pkgs.sway}/bin/swaymsg '[app_id="dropdown"] scratchpad show'
${pkgs.sway}/bin/swaymsg '[app_id="dropdown"] resize set width 100 ppt height 100 ppt'
${pkgs.sway}/bin/swaymsg '[app_id="dropdown"] move container to position 0 px 0 px'
${pkgs.sway}/bin/swaymsg '[app_id="dropdown"] move scratchpad'
'';
in
"${init-dropdown}";
always = true;
}
{
command = lib.getExe start-noctalia;
always = true;
}
];
# Application/window specific rules
window.commands = [
{
command = "floating enable, border pixel 0";
criteria.class = "^Audacious$";
}
{
command = "floating enable";
criteria.title = "Firefox — Sharing Indicator";
}
{
command = "floating enable, border pixel 0, move scratchpad";
criteria.app_id = "dropdown";
}
];
input = {
"*" = {
xkb_layout = "us";
}
// lib.optionalAttrs (cfg.keyboardVariant != "") {
xkb_variant = cfg.keyboardVariant;
};
};
focus.wrapping = "workspace";
colors =
let
c = config.pinpox.colors;
in
{
focused = {
background = "#${c.Blue}";
border = "#${c.BrightBlue}";
childBorder = "#${c.Blue}";
indicator = "#${c.BrightBlue}";
text = "#${c.Black}";
};
focusedInactive = {
background = "#${c.BrightWhite}";
border = "#${c.BrightBlack}";
childBorder = "#${c.BrightWhite}";
indicator = "#${c.BrightBlack}";
text = "#${c.White}";
};
unfocused = {
background = "#${c.Black}";
border = "#${c.BrightBlack}";
childBorder = "#${c.Black}";
indicator = "#${c.BrightBlack}";
text = "#${c.BrightBlack}";
};
urgent = {
background = "#${c.Red}";
border = "#${c.Black}";
childBorder = "#${c.Red}";
indicator = "#${c.Red}";
text = "#${c.White}";
};
};
bars = [
];
fonts = {
names = [ "Berkeley Mono" ];
size = 11.0;
};
workspaceAutoBackAndForth = true;
# Default to tabbed layout
workspaceLayout = "tabbed";
gaps = {
smartGaps = true;
smartBorders = "on";
bottom = 3;
top = 3;
horizontal = 3;
vertical = 3;
inner = 3;
left = 3;
right = 3;
outer = 3;
};
};
};
}
);
}
================================================
FILE: home-manager/modules/swaylock/default.nix
================================================
{ lib, config, ... }:
with lib;
let
cfg = config.pinpox.programs.swaylock;
in
{
options.pinpox.programs.swaylock.enable = mkEnableOption "swaylock screenlocker";
config = mkIf cfg.enable {
programs.swaylock = {
enable = true;
settings = {
# Turn the screen into the given color instead of white.
color = "${config.pinpox.colors.Black}";
# Sets the indicator to show even if idle.
indicator-idle-visible = false;
# Sets the indicator radius.
indicator-radius = 100;
# Sets the color of the line between the inside and ring.
line-color = "${config.pinpox.colors.White}";
# Show current count of failed authentication attempts.
show-failed-attempts = true;
# Sets the color of the ring of the indicator.
ring-color = "${config.pinpox.colors.Green}";
# Sets the color of the text.
text-color = "${config.pinpox.colors.White}";
# Sets the font of the text.
font = "Berkeley Mono";
# Sets a fixed font size for the indicator text.
font-size = 24;
# Sets the color of the inside of the indicator when invalid.
inside-wrong-color = "${config.pinpox.colors.Red}";
# When an empty password is provided, do not validate it.
ignore-empty-password = true;
# Sets the color of backspace highlight segments.
bs-hl-color = "${config.pinpox.colors.Magenta}";
# Sets the color of the layout text.
layout-text-color = "${config.pinpox.colors.White}";
};
};
};
}
# -i, --image [[