diff --git a/legacy/dotfiles/.git-crypt/.gitattributes b/legacy/dotfiles/.git-crypt/.gitattributes new file mode 100644 index 0000000..665b10e --- /dev/null +++ b/legacy/dotfiles/.git-crypt/.gitattributes @@ -0,0 +1,4 @@ +# Do not edit this file. To specify the files to encrypt, create your own +# .gitattributes file in the directory where your files are. +* !filter !diff +*.gpg binary diff --git a/legacy/dotfiles/.git-crypt/keys/default/0/D15E4754FE1AEDA15A6D47029AB28AC10ECE533D.gpg b/legacy/dotfiles/.git-crypt/keys/default/0/D15E4754FE1AEDA15A6D47029AB28AC10ECE533D.gpg new file mode 100644 index 0000000..5b8cf6f Binary files /dev/null and b/legacy/dotfiles/.git-crypt/keys/default/0/D15E4754FE1AEDA15A6D47029AB28AC10ECE533D.gpg differ diff --git a/legacy/dotfiles/.gitattributes b/legacy/dotfiles/.gitattributes new file mode 100644 index 0000000..4037332 --- /dev/null +++ b/legacy/dotfiles/.gitattributes @@ -0,0 +1,2 @@ +/system/secrets/** filter=git-crypt diff=git-crypt +/home-manager/secrets/** filter=git-crypt diff=git-crypt diff --git a/legacy/dotfiles/.gitea/workflows/deploy.yml b/legacy/dotfiles/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..d4d76ca --- /dev/null +++ b/legacy/dotfiles/.gitea/workflows/deploy.yml @@ -0,0 +1,38 @@ +name: Build +on: + push: + branches: [main] + +jobs: + build: + runs-on: nix + steps: + - uses: https://github.com/actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Unlock git-crypt + run: | + git-crypt unlock /run/agenix/git-crypt-key-dotfiles + + - name: Build NixOS configuration (yarn) + run: | + nix build .#nixosConfigurations.yarn.config.system.build.toplevel -L + + - name: Record yarn store path for pull-update + continue-on-error: true + run: | + mkdir -p /var/lib/dotfiles-deploy + readlink -f result > /var/lib/dotfiles-deploy/yarn + nix-store --add-root /var/lib/dotfiles-deploy/yarn-gcroot -r "$(readlink -f result)" + + - name: Build NixOS configuration (mreow) + run: | + nix build .#nixosConfigurations.mreow.config.system.build.toplevel -L + + - name: Record mreow store path + continue-on-error: true + run: | + mkdir -p /var/lib/dotfiles-deploy + readlink -f result > /var/lib/dotfiles-deploy/mreow + nix-store --add-root /var/lib/dotfiles-deploy/mreow-gcroot -r "$(readlink -f result)" diff --git a/legacy/dotfiles/.gitignore b/legacy/dotfiles/.gitignore new file mode 100644 index 0000000..c4a847d --- /dev/null +++ b/legacy/dotfiles/.gitignore @@ -0,0 +1 @@ +/result diff --git a/legacy/dotfiles/AGENTS.md b/legacy/dotfiles/AGENTS.md new file mode 100644 index 0000000..b069751 --- /dev/null +++ b/legacy/dotfiles/AGENTS.md @@ -0,0 +1,168 @@ +# AGENTS.md + +## Project Overview + +NixOS dotfiles for two hosts using Nix flakes + home-manager: +- **mreow** — Framework 13 AMD AI 300 laptop, niri WM, greetd, swaylock +- **yarn** — Desktop, Jovian-NixOS (Steam deck mode), impermanence, sddm, pull-based updates from CI + +Secrets in `system/secrets/` and `home-manager/secrets/` are encrypted with git-crypt. **Never read or write files in those directories.** + +## Build & Deploy Commands + +```sh +# Build and apply (default: boot, or pass switch/test/build) +./deploy.sh # nixos-rebuild boot --flake . --use-remote-sudo +./deploy.sh switch # apply immediately +./deploy.sh test # apply without adding boot entry +./deploy.sh build # build only, no activation + +# Build a specific host without deploying +nix build .#nixosConfigurations.mreow.config.system.build.toplevel -L +nix build .#nixosConfigurations.yarn.config.system.build.toplevel -L + +# yarn pulls updates automatically on boot from the binary cache. +# CI builds the yarn closure, records the store path, and Harmonia serves it. +# To manually trigger the pull on yarn: +systemctl start pull-update + +# Format all Nix files (uses nixfmt-tree, declared in flake.nix) +nix fmt + +# Evaluate without building (quick syntax/type check) +nix eval .#nixosConfigurations.mreow.config.system.build.toplevel --no-build 2>&1 | head -5 +nix eval .#nixosConfigurations.yarn.config.system.build.toplevel --no-build 2>&1 | head -5 + +# Update flake inputs +nix flake update +nix flake update --input-name nixpkgs # update a single input +``` + +There are no tests. Validation is done by building the system configuration (`nix build -L`). +Always append `-L` to `nix build` for verbose build logs. +If nix complains a file isn't found, `git add` the file first — Nix flakes only see tracked files. + +## Repository Structure + +``` +flake.nix # Root flake: inputs, outputs, host definitions +deploy.sh # Wrapper around nixos-rebuild +system/ + common.nix # Shared system config (boot, audio, users, etc.) + system-mreow.nix # Laptop-specific system config + system-yarn.nix # Desktop-specific system config + networking.nix # NetworkManager, DNS + impermanence.nix # Ephemeral root for yarn + disk_mreow.nix / disk_yarn.nix # Disko disk layouts + vm.nix # Virtualization (libvirt, waydroid) + vr.nix / no-rgb.nix / steam.nix # Feature modules + secrets/ # git-crypt encrypted, DO NOT READ +home-manager/ + home-mreow.nix # Laptop home-manager entry point + home-yarn.nix # Desktop home-manager entry point + gui.nix # GUI packages + theming (imports no-gui.nix) + no-gui.nix # CLI tools, dev toolchains, git config + desktop.nix # Desktop environment (niri, dunst, swaylock, noctalia) + wallpaper.png # Shared wallpaper + progs/ # One file per program + fish.nix, alacritty.nix, emacs.nix, helix.nix, niri.nix, ... + zen/ # Zen Browser (multi-file: default.nix, ublock.nix, dark-reader.nix) + opencode.nix # AI coding tools config + util/ # Helper derivations (blur.nix, inverse_color.nix) + secrets/ # git-crypt encrypted, DO NOT READ +``` + +## Import Hierarchy + +``` +flake.nix + ├─ system/system-{host}.nix → common.nix → networking.nix, vm.nix, steam.nix + └─ home-manager/home-{host}.nix → gui.nix → no-gui.nix + → desktop.nix → niri.nix, dunst.nix, swaylock.nix, noctalia.nix +``` + +Adding a new program: create `home-manager/progs/myprog.nix`, import it from the appropriate layer (`gui.nix` for GUI apps, `no-gui.nix` for CLI tools, or `home-{host}.nix` for host-specific). + +## Nix Code Style + +**Formatter**: `nixfmt-tree` — run `nix fmt` before committing. All style below conforms to what nixfmt-tree produces. + +### Module Structure +```nix +# Function arguments: destructured attrset, alphabetical-ish, always end with `...` +{ pkgs, lib, inputs, config, ... }: + +# Optional let bindings for local values +let + myThing = "value"; +in +{ + imports = [ + ./other-module.nix + ]; + + # Configuration here +} +``` + +### Conventions +- **Indentation**: 2 spaces (enforced by nixfmt-tree) +- **Imports**: relative paths (`./progs/fish.nix`), one per line in a list +- **Package references**: use `lib.getExe pkgs.foo` for bin paths, not `${pkgs.foo}/bin/foo` +- **Package lists**: group thematically with comments, use `with pkgs;` or `lib.concatLists` for multiple groups +- **Unfree packages**: explicitly allowlisted per-file via `nixpkgs.config.allowUnfreePredicate` +- **Comments**: lowercase, informal, `#` style. Use `# BUG!` or `# TODO!` prefixes for known issues +- **No trailing commas**: Nix syntax does not support them +- **Attribute sets**: opening brace on same line, closing brace aligned with the key +- **Overlays**: imported inline within the module that needs them via `nixpkgs.overlays` +- **Special args**: passed through `specialArgs` (system) or `extraSpecialArgs` (home-manager) in flake.nix — includes `inputs`, `username`, `hostname`, `niri-package`, `homeDirectory`, `stateVersion` + +### Patterns Used + +```nix +# Package path references +lib.getExe pkgs.swaylock # preferred +"${pkgs.avizo}/bin/volumectl" # acceptable when lib.getExe doesn't work + +# Conditional/host-specific overrides +lib.mkForce false # override inherited values +lib.mkDefault "value" # set overridable defaults + +# Helper derivations (see home-manager/util/) +pkgs.callPackage ../util/blur.nix # for derivations that take { stdenv, ... }: + +# Combining package lists +home.packages = with pkgs; lib.concatLists [ + [ pkg1 pkg2 ] # group 1 + [ pkg3 pkg4 ] # group 2 + someList # from let binding +]; +``` + +### Naming +- **Host configs**: `system-{hostname}.nix`, `home-{hostname}.nix`, `disk_{hostname}.nix` +- **Program modules**: `progs/{program-name}.nix` (one program per file) +- **Utility derivations**: `util/{descriptive-name}.nix` +- **Variables**: `snake_case` or `camelCase` (no strict rule, follow local context) + +## Key Technical Details + +- **nixpkgs channel**: unstable (`nixos-unstable`) +- **Secure boot**: lanzaboote with keys extracted from `system/secrets/secureboot.tar` +- **Disk management**: disko +- **Privilege escalation**: doas (sudo is disabled), shim at `doas-sudo-shim` +- **Shell**: fish (bash redirects to fish via `programs.bash.interactiveShellInit`) +- **Wayland**: niri compositor, xwayland-satellite for X11 compat +- **Desktop shell**: noctalia-shell (bar, launcher, notifications) +- **Git**: GPG signing enabled (`signByDefault = true`), default branch `main` +- **Impermanence** (yarn only): root is ephemeral, `/persistent` holds state, home is bind-mounted + +## Agent-Specific Instructions + +- If instructed to commit, **disable GPG signing** (`git commit --no-gpg-sign`). +- Use `nix-shell -p ` if a tool is not available in the environment. +- For `nix build`, always append `-L` for verbose logs. +- If nix reports a missing file, run `git add ` first — flakes only see git-tracked files. +- Do not read files under `system/secrets/` or `home-manager/secrets/`. +- Run `nix fmt` after editing any `.nix` file. +- Validate changes with `nix build .#nixosConfigurations.{host}.config.system.build.toplevel -L`. diff --git a/legacy/dotfiles/README.md b/legacy/dotfiles/README.md new file mode 100644 index 0000000..97f0b80 --- /dev/null +++ b/legacy/dotfiles/README.md @@ -0,0 +1,21 @@ +# My Dotfiles ✨ +These are my dotfiles for my laptop and desktop (which I use [NixOS](https://nixos.org/) and [home-manager](https://github.com/nix-community/home-manager) on). + +## What do I use? +Browser: Firefox 🦊 (actually [Zen Browser](https://github.com/zen-browser/desktop) :p) + +Text Editor: [Doom Emacs](https://github.com/doomemacs/doomemacs) + +Terminal: [alacritty](https://github.com/alacritty/alacritty) + +Shell: [fish](https://fishshell.com/) with the [pure](https://github.com/pure-fish/pure) prompt + +WM: [niri](https://github.com/YaLTeR/niri) (KDE on my desktop) + +There is more that I'm using, but those are the main ones! Read my configs to get more into the specifics. + +### Background + - Got my background from [here](https://old.reddit.com/r/celestegame/comments/11dtgwg/all_most_of_the_backgrounds_in_celeste_edited/) and used the command `magick input.png -filter Point -resize 2880x1920! output.png` to upscale it bilinearly + +## TODO! +- [ ] Seperate out common shell utilities into a module or some sort (could be used on other machines) diff --git a/legacy/dotfiles/deploy.sh b/legacy/dotfiles/deploy.sh new file mode 100755 index 0000000..76a0e9a --- /dev/null +++ b/legacy/dotfiles/deploy.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +ARG="$*" +if [ "$ARG" = "" ]; then + ARG="boot" +fi + +nixos-rebuild "$ARG" --flake . --use-remote-sudo diff --git a/legacy/dotfiles/flake.lock b/legacy/dotfiles/flake.lock new file mode 100644 index 0000000..1a1fb5c --- /dev/null +++ b/legacy/dotfiles/flake.lock @@ -0,0 +1,918 @@ +{ + "nodes": { + "blueprint": { + "inputs": { + "nixpkgs": [ + "llm-agents", + "nixpkgs" + ], + "systems": [ + "llm-agents", + "systems" + ] + }, + "locked": { + "lastModified": 1776249299, + "narHash": "sha256-Dt9t1TGRmJFc0xVYhttNBD6QsAgHOHCArqGa0AyjrJY=", + "owner": "numtide", + "repo": "blueprint", + "rev": "56131e8628f173d24a27f6d27c0215eff57e40dd", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "blueprint", + "type": "github" + } + }, + "bun2nix": { + "inputs": { + "flake-parts": [ + "llm-agents", + "flake-parts" + ], + "import-tree": "import-tree", + "nixpkgs": [ + "llm-agents", + "nixpkgs" + ], + "systems": [ + "llm-agents", + "systems" + ], + "treefmt-nix": [ + "llm-agents", + "treefmt-nix" + ] + }, + "locked": { + "lastModified": 1776182890, + "narHash": "sha256-+/VOe8XGq5klpU+I19D+3TcaR7o+Cwbq67KNF7mcFak=", + "owner": "Mic92", + "repo": "bun2nix", + "rev": "648d293c51e981aec9cb07ba4268bc19e7a8c575", + "type": "github" + }, + "original": { + "owner": "Mic92", + "ref": "catalog-support", + "repo": "bun2nix", + "type": "github" + } + }, + "cachyos-kernel": { + "flake": false, + "locked": { + "lastModified": 1776183001, + "narHash": "sha256-lvLKB5dTqjO1S/YonS9ZyWemEjO6QXtN4D76rYEYy4s=", + "owner": "CachyOS", + "repo": "linux-cachyos", + "rev": "4224303b6d7a50dd1cc3ffa78864050cc9536eec", + "type": "github" + }, + "original": { + "owner": "CachyOS", + "repo": "linux-cachyos", + "type": "github" + } + }, + "cachyos-kernel-patches": { + "flake": false, + "locked": { + "lastModified": 1776355454, + "narHash": "sha256-b9Hc0sTxjEzDbphzS9yQqxVha/7bsPIs2cQQQvaG45E=", + "owner": "CachyOS", + "repo": "kernel-patches", + "rev": "b5e029226df5cc30c103651072d49a7af2878202", + "type": "github" + }, + "original": { + "owner": "CachyOS", + "repo": "kernel-patches", + "type": "github" + } + }, + "crane": { + "locked": { + "lastModified": 1773189535, + "narHash": "sha256-E1G/Or6MWeP+L6mpQ0iTFLpzSzlpGrITfU2220Gq47g=", + "owner": "ipetkov", + "repo": "crane", + "rev": "6fa2fb4cf4a89ba49fc9dd5a3eb6cde99d388269", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1768920986, + "narHash": "sha256-CNzzBsRhq7gg4BMBuTDObiWDH/rFYHEuDRVOwCcwXw4=", + "owner": "nix-community", + "repo": "disko", + "rev": "de5708739256238fb912c62f03988815db89ec9a", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "latest", + "repo": "disko", + "type": "github" + } + }, + "doomemacs": { + "flake": false, + "locked": { + "lastModified": 1776400245, + "narHash": "sha256-RuQB1PxazI4DOw3O+rEVU2FPT0vP0Xb+Gp/M6Yqer20=", + "owner": "doomemacs", + "repo": "doomemacs", + "rev": "860a91aaac235701f30b70fdc74259d438818968", + "type": "github" + }, + "original": { + "owner": "doomemacs", + "repo": "doomemacs", + "type": "github" + } + }, + "emacs-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1776478519, + "narHash": "sha256-4TWCOVYe0iWEKuW7OH93nRI4Z7u68wNT6k9UJn0FZ5w=", + "owner": "nix-community", + "repo": "emacs-overlay", + "rev": "513e332b074507e1b46992952e7d83f329f2c22c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "emacs-overlay", + "type": "github" + } + }, + "firefox-addons": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "dir": "pkgs/firefox-addons", + "lastModified": 1776398575, + "narHash": "sha256-WArU6WOdWxzbzGqYk4w1Mucg+bw/SCl6MoSp+/cZMio=", + "owner": "rycee", + "repo": "nur-expressions", + "rev": "05815686caf4e3678f5aeb5fd36e567886ab0d30", + "type": "gitlab" + }, + "original": { + "dir": "pkgs/firefox-addons", + "owner": "rycee", + "repo": "nur-expressions", + "type": "gitlab" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "NixOS", + "repo": "flake-compat", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "NixOS", + "repo": "flake-compat", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "llm-agents", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1775087534, + "narHash": "sha256-91qqW8lhL7TLwgQWijoGBbiD4t7/q75KTi8NxjVmSmA=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "3107b77cd68437b9a76194f0f7f9c55f2329ca5b", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1775087534, + "narHash": "sha256-91qqW8lhL7TLwgQWijoGBbiD4t7/q75KTi8NxjVmSmA=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "3107b77cd68437b9a76194f0f7f9c55f2329ca5b", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "lanzaboote", + "pre-commit", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1776454077, + "narHash": "sha256-7zSUFWsU0+jlD7WB3YAxQ84Z/iJurA5hKPm8EfEyGJk=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "565e5349208fe7d0831ef959103c9bafbeac0681", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "impermanence": { + "inputs": { + "home-manager": [ + "home-manager" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1769548169, + "narHash": "sha256-03+JxvzmfwRu+5JafM0DLbxgHttOQZkUtDWBmeUkN8Y=", + "owner": "nix-community", + "repo": "impermanence", + "rev": "7b1d382faf603b6d264f58627330f9faa5cba149", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "impermanence", + "type": "github" + } + }, + "import-tree": { + "locked": { + "lastModified": 1763762820, + "narHash": "sha256-ZvYKbFib3AEwiNMLsejb/CWs/OL/srFQ8AogkebEPF0=", + "owner": "vic", + "repo": "import-tree", + "rev": "3c23749d8013ec6daa1d7255057590e9ca726646", + "type": "github" + }, + "original": { + "owner": "vic", + "repo": "import-tree", + "type": "github" + } + }, + "jovian-nixos": { + "inputs": { + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1776428236, + "narHash": "sha256-+0SyQglnT2xUiyY07155G+O7aUWISELwqtTnfURufRU=", + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "rev": "eac78fc379ca47f7e21be8539c405e5fb489a857", + "type": "github" + }, + "original": { + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "type": "github" + } + }, + "json2steamshortcut": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1763116114, + "narHash": "sha256-0gI7PnQUDZTFjhHgg0eP1SCJOvW5gw3sQ2UAMspipnQ=", + "owner": "ChrisOboe", + "repo": "json2steamshortcut", + "rev": "b829fe2871fd1736d2406724e4abbb492527cb08", + "type": "github" + }, + "original": { + "owner": "ChrisOboe", + "repo": "json2steamshortcut", + "type": "github" + } + }, + "lanzaboote": { + "inputs": { + "crane": "crane", + "nixpkgs": [ + "nixpkgs" + ], + "pre-commit": "pre-commit", + "rust-overlay": [ + "rust-overlay" + ] + }, + "locked": { + "lastModified": 1776248416, + "narHash": "sha256-TC6yzbCAex1pDfqUZv9u8fVm8e17ft5fNrcZ0JRDOIQ=", + "owner": "nix-community", + "repo": "lanzaboote", + "rev": "18e9e64bae15b828c092658335599122a6db939b", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "lanzaboote", + "type": "github" + } + }, + "llm-agents": { + "inputs": { + "blueprint": "blueprint", + "bun2nix": "bun2nix", + "flake-parts": "flake-parts", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_2", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1776482297, + "narHash": "sha256-KmsWPwtbO8vrlH/R9stIun0LKZ4PFSCCEdqWDeLgbTE=", + "owner": "numtide", + "repo": "llm-agents.nix", + "rev": "66c76393570f8fc4730caa2dc2d2c470fe33a3c9", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "llm-agents.nix", + "type": "github" + } + }, + "niri": { + "inputs": { + "niri-stable": "niri-stable", + "niri-unstable": "niri-unstable", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixpkgs" + ], + "xwayland-satellite-stable": "xwayland-satellite-stable", + "xwayland-satellite-unstable": "xwayland-satellite-unstable" + }, + "locked": { + "lastModified": 1776435348, + "narHash": "sha256-qsZnMThxTqxCJZ7DEKu3DD3KjIPcuUBvZ0C9a2uIvaQ=", + "owner": "sodiboo", + "repo": "niri-flake", + "rev": "55b5b1fc9481ab267603a1099e5d4b4ebc7394d7", + "type": "github" + }, + "original": { + "owner": "sodiboo", + "repo": "niri-flake", + "type": "github" + } + }, + "niri-stable": { + "flake": false, + "locked": { + "lastModified": 1756556321, + "narHash": "sha256-RLD89dfjN0RVO86C/Mot0T7aduCygPGaYbog566F0Qo=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "01be0e65f4eb91a9cd624ac0b76aaeab765c7294", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "ref": "v25.08", + "repo": "niri", + "type": "github" + } + }, + "niri-unstable": { + "flake": false, + "locked": { + "lastModified": 1776432730, + "narHash": "sha256-Pq1ZVvRGq/IFiFH6vkNwMfZEpWk23NjgGdX50COdj/c=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "c814c656c53ea9d69f5afb45c88f4dc4d25338cd", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "repo": "niri", + "type": "github" + } + }, + "nix-cachyos-kernel": { + "inputs": { + "cachyos-kernel": "cachyos-kernel", + "cachyos-kernel-patches": "cachyos-kernel-patches", + "flake-compat": "flake-compat_2", + "flake-parts": "flake-parts_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1776386586, + "narHash": "sha256-eVAUaL/6n8mnmBiPpEVW1NDNVSKLWhYVfycG+P0SvWU=", + "owner": "xddxdd", + "repo": "nix-cachyos-kernel", + "rev": "c65c3faf90ae07bae101c15ef502f0bcb06c5d74", + "type": "github" + }, + "original": { + "owner": "xddxdd", + "ref": "release", + "repo": "nix-cachyos-kernel", + "type": "github" + } + }, + "nix-doom-emacs-unstraightened": { + "inputs": { + "doomemacs": "doomemacs", + "emacs-overlay": [ + "emacs-overlay" + ], + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_3" + }, + "locked": { + "lastModified": 1776419397, + "narHash": "sha256-vmWJwNYtQFexLG6r/v8Dlou/5z8FbFCLo3QqZ/stLYQ=", + "owner": "marienz", + "repo": "nix-doom-emacs-unstraightened", + "rev": "7623dd4adbdf5f8a8464ecc5fd089e5c5cb5dada", + "type": "github" + }, + "original": { + "owner": "marienz", + "repo": "nix-doom-emacs-unstraightened", + "type": "github" + } + }, + "nix-flatpak": { + "locked": { + "lastModified": 1768656715, + "narHash": "sha256-Sbh037scxKFm7xL0ahgSCw+X2/5ZKeOwI2clqrYr9j4=", + "owner": "gmodena", + "repo": "nix-flatpak", + "rev": "123fe29340a5b8671367055b75a6e7c320d6f89a", + "type": "github" + }, + "original": { + "owner": "gmodena", + "repo": "nix-flatpak", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "jovian-nixos", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729697500, + "narHash": "sha256-VFTWrbzDlZyFHHb1AlKRiD/qqCJIripXKiCSFS8fAOY=", + "owner": "zhaofengli", + "repo": "nix-github-actions", + "rev": "e418aeb728b6aa5ca8c5c71974e7159c2df1d8cf", + "type": "github" + }, + "original": { + "owner": "zhaofengli", + "ref": "matrix-name", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nixos-hardware": { + "locked": { + "lastModified": 1775490113, + "narHash": "sha256-2ZBhDNZZwYkRmefK5XLOusCJHnoeKkoN95hoSGgMxWM=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "c775c2772ba56e906cbeb4e0b2db19079ef11ff7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1776169885, + "narHash": "sha256-l/iNYDZ4bGOAFQY2q8y5OAfBBtrDAaPuRQqWaFHVRXM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4bd9165a9165d7b5e33ae57f3eecbcb28fb231c9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1774748309, + "narHash": "sha256-+U7gF3qxzwD5TZuANzZPeJTZRHS29OFQgkQ2kiTJBIQ=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "333c4e0545a6da976206c74db8773a1645b5870a", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "noctalia": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "noctalia-qs": "noctalia-qs" + }, + "locked": { + "lastModified": 1776302695, + "narHash": "sha256-xZc9o1JLQpmWn2Dqui323+Tq2Ai4sSdtdvbFZCs4qLo=", + "owner": "noctalia-dev", + "repo": "noctalia-shell", + "rev": "a7c724181fca5d1aff2d47b18fa733504cfdbda2", + "type": "github" + }, + "original": { + "owner": "noctalia-dev", + "repo": "noctalia-shell", + "type": "github" + } + }, + "noctalia-qs": { + "inputs": { + "nixpkgs": [ + "noctalia", + "nixpkgs" + ], + "systems": "systems_4", + "treefmt-nix": "treefmt-nix_2" + }, + "locked": { + "lastModified": 1775957204, + "narHash": "sha256-d4CVRtAty2GzDYXx4xYQmR+nlOjjKovyprQfZhgLckU=", + "owner": "noctalia-dev", + "repo": "noctalia-qs", + "rev": "68e82fe34c68ee839a9c37e3466820e266af0c86", + "type": "github" + }, + "original": { + "owner": "noctalia-dev", + "repo": "noctalia-qs", + "type": "github" + } + }, + "pre-commit": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "lanzaboote", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1772893680, + "narHash": "sha256-JDqZMgxUTCq85ObSaFw0HhE+lvdOre1lx9iI6vYyOEs=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "8baab586afc9c9b57645a734c820e4ac0a604af9", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "disko": "disko", + "emacs-overlay": "emacs-overlay", + "firefox-addons": "firefox-addons", + "home-manager": "home-manager", + "impermanence": "impermanence", + "jovian-nixos": "jovian-nixos", + "json2steamshortcut": "json2steamshortcut", + "lanzaboote": "lanzaboote", + "llm-agents": "llm-agents", + "niri": "niri", + "nix-cachyos-kernel": "nix-cachyos-kernel", + "nix-doom-emacs-unstraightened": "nix-doom-emacs-unstraightened", + "nix-flatpak": "nix-flatpak", + "nixos-hardware": "nixos-hardware", + "nixpkgs": "nixpkgs", + "noctalia": "noctalia", + "rust-overlay": "rust-overlay", + "zen-browser": "zen-browser" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1776481912, + "narHash": "sha256-Xq7p+Ex3YHFAd+fFFLOYw2Wv67582X7SAmrEDtIDZQ4=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "e611106c527e8ab0adbb641183cda284411d575c", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "llm-agents", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1775636079, + "narHash": "sha256-pc20NRoMdiar8oPQceQT47UUZMBTiMdUuWrYu2obUP0=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "790751ff7fd3801feeaf96d7dc416a8d581265ba", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "treefmt-nix_2": { + "inputs": { + "nixpkgs": [ + "noctalia", + "noctalia-qs", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1775636079, + "narHash": "sha256-pc20NRoMdiar8oPQceQT47UUZMBTiMdUuWrYu2obUP0=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "790751ff7fd3801feeaf96d7dc416a8d581265ba", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "xwayland-satellite-stable": { + "flake": false, + "locked": { + "lastModified": 1755491097, + "narHash": "sha256-m+9tUfsmBeF2Gn4HWa6vSITZ4Gz1eA1F5Kh62B0N4oE=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "388d291e82ffbc73be18169d39470f340707edaa", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "ref": "v0.7", + "repo": "xwayland-satellite", + "type": "github" + } + }, + "xwayland-satellite-unstable": { + "flake": false, + "locked": { + "lastModified": 1773622265, + "narHash": "sha256-wToKwH7IgWdGLMSIWksEDs4eumR6UbbsuPQ42r0oTXQ=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "a879e5e0896a326adc79c474bf457b8b99011027", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "type": "github" + } + }, + "zen-browser": { + "inputs": { + "home-manager": [ + "home-manager" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1776403742, + "narHash": "sha256-ZmGY9XiOsuMS/THsSNkgp2fnc3asXQX/xRrQpWnY9nA=", + "owner": "0xc000022070", + "repo": "zen-browser-flake", + "rev": "ca7077bea5c830470437ea878da2a1940773324c", + "type": "github" + }, + "original": { + "owner": "0xc000022070", + "repo": "zen-browser-flake", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/legacy/dotfiles/flake.nix b/legacy/dotfiles/flake.nix new file mode 100644 index 0000000..16f4aa3 --- /dev/null +++ b/legacy/dotfiles/flake.nix @@ -0,0 +1,155 @@ +{ + description = "System nixOS flake"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + lanzaboote = { + url = "github:nix-community/lanzaboote"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.rust-overlay.follows = "rust-overlay"; + }; + + nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + disko = { + url = "github:nix-community/disko/latest"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + zen-browser = { + url = "github:0xc000022070/zen-browser-flake"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.home-manager.follows = "home-manager"; + }; + + firefox-addons = { + url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + niri = { + url = "github:sodiboo/niri-flake"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.nixpkgs-stable.follows = "nixpkgs"; + }; + + emacs-overlay = { + url = "github:nix-community/emacs-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.nixpkgs-stable.follows = "nixpkgs"; + }; + + nix-flatpak.url = "github:gmodena/nix-flatpak/"; + + nix-doom-emacs-unstraightened = { + url = "github:marienz/nix-doom-emacs-unstraightened"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.emacs-overlay.follows = "emacs-overlay"; + }; + + impermanence = { + url = "github:nix-community/impermanence"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.home-manager.follows = "home-manager"; + }; + jovian-nixos = { + url = "github:Jovian-Experiments/Jovian-NixOS"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + noctalia = { + url = "github:noctalia-dev/noctalia-shell"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + nix-cachyos-kernel = { + url = "github:xddxdd/nix-cachyos-kernel/release"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + llm-agents = { + url = "github:numtide/llm-agents.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + json2steamshortcut = { + url = "github:ChrisOboe/json2steamshortcut"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + { + self, + nixpkgs, + lanzaboote, + nixos-hardware, + home-manager, + jovian-nixos, + ... + }@inputs: + let + username = "primary"; + system = "x86_64-linux"; + hostnames = [ + "mreow" + "yarn" + ]; + niri-package = inputs.niri.packages.${system}.niri-unstable; + in + { + formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-tree; + + nixosConfigurations = nixpkgs.lib.foldl' ( + config: hostname: + config + // { + "${hostname}" = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit + inputs + username + hostname + niri-package + ; + }; + modules = [ + home-manager.nixosModules.home-manager + ( + { config, ... }: + { + # home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.sharedModules = [ + inputs.zen-browser.homeModules.twilight + ]; + home-manager.extraSpecialArgs = { + inherit + inputs + hostname + username + niri-package + ; + homeDirectory = "/home/${username}"; + stateVersion = config.system.stateVersion; + }; + home-manager.users.${username} = import ./home-manager/home-${hostname}.nix; + } + ) + ./system/system-${hostname}.nix + ]; + }; + } + ) { } hostnames; + }; +} diff --git a/legacy/dotfiles/home-manager/desktop.nix b/legacy/dotfiles/home-manager/desktop.nix new file mode 100644 index 0000000..ab2b5a1 --- /dev/null +++ b/legacy/dotfiles/home-manager/desktop.nix @@ -0,0 +1,29 @@ +{ + config, + lib, + pkgs, + ... +}: +{ + imports = [ + # niri wayland compositor + ./progs/niri.nix + + # lockscreen + ./progs/swaylock.nix + + # notification daemon + ./progs/dunst.nix + + # noctalia desktop shell + ./progs/noctalia.nix + ]; + + home.packages = with pkgs; [ + wdisplays + blueman + + # used by /etc/nixos logic to launch niri + config.programs.niri.package + ]; +} diff --git a/legacy/dotfiles/home-manager/gui.nix b/legacy/dotfiles/home-manager/gui.nix new file mode 100644 index 0000000..4f067be --- /dev/null +++ b/legacy/dotfiles/home-manager/gui.nix @@ -0,0 +1,230 @@ +{ + pkgs, + lib, + inputs, + config, + ... +}: +{ + imports = [ + ./no-gui.nix + # ./progs/ghostty.nix + ./progs/alacritty.nix + ./progs/emacs.nix + # ./progs/trezor.nix # - broken + ./progs/flatpak.nix + ./progs/zen + ]; + + nixpkgs.config.allowUnfreePredicate = + pkg: + builtins.elem (lib.getName pkg) [ + "apple_cursor" + "grayjay" + ]; + + home.packages = + with pkgs; + lib.concatLists [ + # libreoffice + [ + libreoffice + hunspell # spellcheck + hunspellDicts.en_US # spellcheck dictionary + ] + + # browsers + [ + tor-browser + grayjay + ] + + # music library management + [ + picard + puddletag + lrcget + ] + + # image editing + [ + darktable + rawtherapee + hugin + + gimp3 + pinta + ] + + [ + #calculator + gnome-calculator + + # audio editing + audacity + + #fonts + noto-fonts + noto-fonts-color-emoji + liberation_ttf + + #for ebook reading + foliate + + #audio mixer (pavucontrol but for pipewire) + pwvucontrol + + # minecraft launcher + prismlauncher + + mpv + mumble + system76-keyboard-configurator + + #jellyfin + finamp # music player + delfin # jellyfin client + + signal-desktop + + # accounting + # gnucash + + # image tools + inkscape + nomacs + + # partitioning utilities + gparted + gnome-disk-utility + + # small nicities + wl-clipboard # wl-copy & wl-paste + libnotify # notifications library + xdg-utils # xdg utils + + wireshark + + nautilus + nufraw-thumbnailer + gdk-pixbuf + + enblend-enfuse + + # simple screen recording on wayland + wl-screenrec + + # wayland-compatible color picker + hyprpicker + + blender + + ghidra-bin + + # for mod organizer 2 + zenity + p7zip + + # password manager + keepassxc + + freecad-wayland + + localsend + + # openstreetmap + josm + + # in unstable ATM, gotta wait for it to hit stable + # video-trimmer + ] + # all the fonts + (builtins.filter lib.isDerivation (builtins.attrValues nerd-fonts)) + ]; + + # programs.zed-editor = { + # enable = true; + # userSettings = { + # ui_font_size = 16; + # buffer_font_size = 16; + # theme = { + # mode = "system"; + # light = "Gruvbox Dark Hard"; + # dark = "One Dark"; + # }; + # }; + # extensions = [ + # "nix" + # "sql" + # "CSV" + # "assembly" + # ]; + # }; + + # make chromium-based stuff use wayland + home.file.".config/chromium-flags.conf".text = "--ozone-platform-hint=auto"; + + # dark mode + dconf.settings = { + "org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + }; + }; + + home.sessionVariables = { + LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath [ + pkgs.stdenv.cc.cc + ]}"; + }; + + # allow extra fonts to be detected by fontconfig + fonts.fontconfig.enable = true; + + # gtk application theming + gtk = { + enable = true; + # make gtk3 applications look like libadwaita applications! + theme = { + package = pkgs.adw-gtk3; + name = "adw-gtk3-dark"; + }; + # gtk4 apps use libadwaita natively, no theme package needed + gtk4.theme = null; + iconTheme = { + package = pkgs.adwaita-icon-theme; + name = "Adwaita"; + }; + }; + + # qt application theming - BROKEN and on fire + # qt = { + # enable = true; + # platformTheme = { + # name = "adwaita"; + # package = [ + # pkgs.adwaita-qt + # pkgs.adwaita-qt6 + # ]; + # }; + + # style = { + # name = "adwaita-dark"; + # package = pkgs.adwaita-qt; + # }; + # }; + + # macOS cursor! + home.pointerCursor = { + gtk.enable = true; + package = pkgs.apple-cursor; + name = "macOS"; + size = 24; + }; + + dconf.settings = { + "org/virt-manager/virt-manager/connections" = { + autoconnect = [ "qemu:///system" ]; + uris = [ "qemu:///system" ]; + }; + }; +} diff --git a/legacy/dotfiles/home-manager/home-mreow.nix b/legacy/dotfiles/home-manager/home-mreow.nix new file mode 100644 index 0000000..27df1a1 --- /dev/null +++ b/legacy/dotfiles/home-manager/home-mreow.nix @@ -0,0 +1,33 @@ +{ + config, + pkgs, + homeDirectory, + ... +}: +{ + imports = [ + ./gui.nix + ./desktop.nix + ./progs/borg.nix + + # effects headphones too + # ./progs/framework-13-easyeffects.nix + ]; + + # media controls + systemd.user.services.mpris-proxy = { + Unit.Description = "Mpris proxy"; + Install.After = [ + "network.target" + "sound.target" + ]; + Install.WantedBy = [ "default.target" ]; + Service.ExecStart = "${pkgs.bluez}/bin/mpris-proxy"; + }; + + programs.niri.settings.outputs = { + "BOE 0x095F Unknown" = { + scale = 1.5; + }; + }; +} diff --git a/legacy/dotfiles/home-manager/home-yarn.nix b/legacy/dotfiles/home-manager/home-yarn.nix new file mode 100644 index 0000000..1d145a3 --- /dev/null +++ b/legacy/dotfiles/home-manager/home-yarn.nix @@ -0,0 +1,44 @@ +{ + pkgs, + inputs, + lib, + config, + ... +}: +{ + imports = [ + ./gui.nix + ./desktop.nix + inputs.json2steamshortcut.homeModules.default + ]; + + home.packages = with pkgs; [ + protontricks + + # https://github.com/NixOS/nixpkgs/pull/339370#issuecomment-2731336341 + bs-manager + ]; + + programs.obs-studio = { + enable = true; + plugins = with pkgs.obs-studio-plugins; [ + wlrobs + obs-backgroundremoval + obs-pipewire-audio-capture + ]; + }; + + services.steam-shortcuts = { + enable = true; + overwriteExisting = true; + steamUserId = lib.strings.toInt (lib.strings.trim (builtins.readFile ./secrets/steam-user-id)); + shortcuts = [ + { + AppName = "Prism Launcher"; + Exe = "${pkgs.prismlauncher}/bin/prismlauncher"; + Icon = "${pkgs.prismlauncher}/share/icons/hicolor/scalable/apps/org.prismlauncher.PrismLauncher.svg"; + Tags = [ "Game" ]; + } + ]; + }; +} diff --git a/legacy/dotfiles/home-manager/no-gui.nix b/legacy/dotfiles/home-manager/no-gui.nix new file mode 100644 index 0000000..5c16a98 --- /dev/null +++ b/legacy/dotfiles/home-manager/no-gui.nix @@ -0,0 +1,262 @@ +{ + pkgs, + inputs, + lib, + homeDirectory, + config, + username, + stateVersion, + ... +}: +let + rust_pkgs = with pkgs; [ + (rust-bin.nightly.latest.default.override ({ + extensions = [ + "rust-src" + "rust-analyzer" + "clippy" + "rustfmt" + "rust-std" + "cargo" + ]; + # thumbv7m-none-eabi target for stm32 + targets = [ + "thumbv7m-none-eabi" + "wasm32-unknown-unknown" + ]; + })) + cargo-expand + cargo-edit # cargo upgrade and stuff + cargo-pgo + rust-script + bolt_19 + libllvm # llvm-profdata + cargo-show-asm + cargo-flamegraph + ]; + + lsps = with pkgs; [ + # java + jdt-language-server + + # HTML/CSS/JSON/ESLint language servers + vscode-langservers-extracted + nil # nix lsp + yaml-language-server # yaml lsp + marksman # markdown lsp + typescript-language-server # typescript lsp + cmake-language-server # cmake lsp + + typescript + ]; + + java_tools = with pkgs; [ + # java development + google-java-format # formatter + jdk # java + + # java assembler # BUG! broken + # jasmin + ]; + + common_tools = with pkgs; [ + # hex viewer + hexyl + + # find typos in code + typos + + # replacements for common posix tools + eza # ls replacement + bat # pretty `cat` clone + delta # viewer for `git` and `diff` output + dust # pretty `du` version + duf # better `df` clone + gping # `ping`... but with a graph!! + tldr # `man` but more straight-forward and simpler + ripgrep # grep, but written in rust, respects .gitignore, and very very fast, command is `rg` + fd # alternative to `find` + + # status tools + htop + bottom + + # other tools + unzip + wget + killall + file + b3sum + + # "A hexadecimal, binary, and ASCII dump utility with color support" + tinyxxd + + # networking tool + lsof + + # view SMART status of drives + smartmontools + + # adds `sensors` command + lm_sensors + + # lspci + pciutils + + # convert between various units + units + + jq + + # DNS things + dig + + bun + ]; + +in +{ + imports = [ + ./progs/fish.nix + ./progs/helix.nix + ./progs/pi.nix + ( + { ... }: + { + nixpkgs.overlays = [ + inputs.rust-overlay.overlays.default + ]; + } + ) + ]; + + home.stateVersion = stateVersion; + + home.packages = + with pkgs; + lib.concatLists [ + [ + # python formatter + ruff + + # for website generation + hugo + go + + # for benchmaking stuff + hyperfine + + pfetch-rs + waypipe + + sshfs + + # nix formatter + nixfmt-tree + + # serial viewer + minicom + + # "~~matt's~~ my trace route" + mtr + + ffmpeg-full + + # microcontroller tooling + probe-rs-tools + + (python313.withPackages ( + ps: with ps; [ + mypy # type checking + types-requests # add types for requests methods + + python-lsp-server # lsp + python-lsp-ruff # ruff integration + pyserial + + numpy + matplotlib + notebook + + pandas + ] + )) + + binwalk + + # clang-format and clang-tidy + clang-tools + clang + gdb + + git-crypt + + imagemagick + + nixpkgs-review + + nmap + + # terminal image viewer + timg + + tcpdump + + borgbackup + + # used to deploy nix system to server + # (and in the future, desktop) + deploy-rs + + # power stuff + powerstat + + yt-dlp + ] + rust_pkgs + lsps + java_tools + common_tools + ]; + + # https://github.com/flamegraph-rs/flamegraph + home.file.".cargo/config.toml".text = '' + [target.${lib.strings.removeSuffix "-linux" pkgs.stdenv.hostPlatform.system}-unknown-linux-gnu] + linker = "${lib.getExe pkgs.clang}" + rustflags = ["-Clink-arg=-Wl,--no-rosegment"] + ''; + + # git (self explanatory) + programs.git = { + enable = true; + package = pkgs.git; + + lfs.enable = true; + + ignores = [ ".sisyphus" ]; + + settings = { + init = { + # master -> main + defaultBranch = "main"; + }; + push.autoSetupRemote = true; + user = { + name = "Simon Gardling"; + email = "titaniumtown@proton.me"; + }; + }; + + # gpg signing keys + signing = { + key = "9AB28AC10ECE533D"; + signByDefault = true; + }; + }; + + # better way to view diffs + programs.delta = { + enable = true; + enableGitIntegration = true; + }; +} diff --git a/legacy/dotfiles/home-manager/progs/alacritty.nix b/legacy/dotfiles/home-manager/progs/alacritty.nix new file mode 100644 index 0000000..63484a2 --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/alacritty.nix @@ -0,0 +1,131 @@ +{ pkgs, ... }: +{ + home.sessionVariables = { + TERMINAL = "alacritty"; + }; + + programs.alacritty = { + enable = true; + package = pkgs.alacritty; + settings = { + # some programs can't handle alacritty + env.TERM = "xterm-256color"; + + window = { + # using a window manager, no decorations needed + decorations = "none"; + + # semi-transparent + opacity = 0.90; + + # padding between the content of the terminal and the edge + padding = { + x = 10; + y = 10; + }; + + dimensions = { + columns = 80; + lines = 40; + }; + }; + + scrolling = { + history = 1000; + multiplier = 3; + }; + + font = + let + baseFont = { + family = "JetBrains Mono Nerd Font"; + style = "Regular"; + }; + in + { + size = 12; + + normal = baseFont; + + bold = baseFont // { + style = "Bold"; + }; + + italic = baseFont // { + style = "Italic"; + }; + + offset.y = 0; + glyph_offset.y = 0; + }; + + # color scheme + colors = + let + normal = { + black = "0x1b1e28"; + red = "0xd0679d"; + green = "0x5de4c7"; + yellow = "0xfffac2"; + blue = "#435c89"; + magenta = "0xfcc5e9"; + cyan = "0xadd7ff"; + white = "0xffffff"; + }; + + bright = { + black = "0xa6accd"; + red = normal.red; + green = normal.green; + yellow = normal.yellow; + blue = normal.cyan; + magenta = "0xfae4fc"; + cyan = "0x89ddff"; + white = normal.white; + }; + in + { + inherit normal bright; + primary = { + background = "0x131621"; + foreground = bright.black; + }; + + cursor = { + text = "CellBackground"; + cursor = "CellForeground"; + }; + + search = + let + foreground = normal.black; + background = normal.cyan; + in + { + matches = { + inherit foreground background; + }; + + focused_match = { + inherit foreground background; + }; + }; + + selection = { + text = "CellForeground"; + background = "0x303340"; + }; + + vi_mode_cursor = { + text = "CellBackground"; + cursor = "CellForeground"; + }; + }; + + cursor = { + style = "Underline"; + vi_mode_style = "Underline"; + }; + }; + }; +} diff --git a/legacy/dotfiles/home-manager/progs/borg.nix b/legacy/dotfiles/home-manager/progs/borg.nix new file mode 100644 index 0000000..ad336fa --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/borg.nix @@ -0,0 +1,38 @@ +{ pkgs, homeDirectory, ... }: +{ + programs.borgmatic = { + enable = true; + package = pkgs.borgmatic; + backups = { + home = { + location = { + sourceDirectories = ( + map (f: "${homeDirectory}/${f}") [ + ".local/share/fish" + ".ssh" + "Documents" + "projects" + "Pictures" + "school" + ] + ); + + excludeHomeManagerSymlinks = true; + repositories = [ "ssh://server-public/tank/bak/laptop" ]; + + extraConfig = { + compression = "zstd"; + }; + }; + + retention = { + keepHourly = 10; + keepDaily = 30; + keepWeekly = 8; + keepMonthly = 2; + keepYearly = 0; + }; + }; + }; + }; +} diff --git a/legacy/dotfiles/home-manager/progs/doom.d/config.el b/legacy/dotfiles/home-manager/progs/doom.d/config.el new file mode 100644 index 0000000..c19b0b3 --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/doom.d/config.el @@ -0,0 +1,97 @@ +;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- + +;; Place your private configuration here! Remember, you do not need to run 'doom +;; sync' after modifying this file! + + +;; Some functionality uses this to identify you, e.g. GPG configuration, email +;; clients, file templates and snippets. It is optional. +;; (setq user-full-name "John Doe" +;; user-mail-address "john@doe.com") + +;; Doom exposes five (optional) variables for controlling fonts in Doom: +;; +;; - `doom-font' -- the primary font to use +;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable) +;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for +;; presentations or streaming. +;; - `doom-symbol-font' -- for symbols +;; - `doom-serif-font' -- for the `fixed-pitch-serif' face +;; +;; See 'C-h v doom-font' for documentation and more examples of what they +;; accept. For example: +;; +;;(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light) +;; doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13)) +;; +;; If you or Emacs can't find your font, use 'M-x describe-font' to look them +;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to +;; refresh your font settings. If Emacs still can't find your font, it likely +;; wasn't installed correctly. Font issues are rarely Doom issues! + +;; There are two ways to load a theme. Both assume the theme is installed and +;; available. You can either set `doom-theme' or manually load a theme with the +;; `load-theme' function. This is the default: +(setq doom-theme 'doom-one) + +;; This determines the style of line numbers in effect. If set to `nil', line +;; numbers are disabled. For relative line numbers, set this to `relative'. +(setq display-line-numbers-type t) + +;; If you use `org' and don't want your org files in the default location below, +;; change `org-directory'. It must be set before org loads! +(setq org-directory "~/org/") + + +;; Whenever you reconfigure a package, make sure to wrap your config in an +;; `after!' block, otherwise Doom's defaults may override your settings. E.g. +;; +;; (after! PACKAGE +;; (setq x y)) +;; +;; The exceptions to this rule: +;; +;; - Setting file/directory variables (like `org-directory') +;; - Setting variables which explicitly tell you to set them before their +;; package is loaded (see 'C-h v VARIABLE' to look up their documentation). +;; - Setting doom variables (which start with 'doom-' or '+'). +;; +;; Here are some additional functions/macros that will help you configure Doom. +;; +;; - `load!' for loading external *.el files relative to this one +;; - `use-package!' for configuring packages +;; - `after!' for running code after a package has loaded +;; - `add-load-path!' for adding directories to the `load-path', relative to +;; this file. Emacs searches the `load-path' when you load packages with +;; `require' or `use-package'. +;; - `map!' for binding new keys +;; +;; To get information about any of these functions/macros, move the cursor over +;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k'). +;; This will open documentation for it, including demos of how they are used. +;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces, +;; etc). +;; +;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how +;; they are implemented. + + +;; Ctrl + Shift + / = redo +;; Ctrl + / = undo +(after! undo-fu + (map! :map undo-fu-mode-map "C-?" #'undo-fu-only-redo)) + + +;; Fix SPC p p slowness +(after! projectile + (setq projectile-indexing-method 'alien + projectile-enable-caching nil + projectile-project-search-path '("~/projects/")) + (projectile-discover-projects-in-search-path)) + +;; Packages are already natively compiled by Nix; JIT recompilation +;; just wastes cycles (and the eln-cache is invalidated on every rebuild anyway) +(setq native-comp-jit-compilation nil) + +;; line wrapping +(visual-line-mode t) diff --git a/legacy/dotfiles/home-manager/progs/doom.d/init.el b/legacy/dotfiles/home-manager/progs/doom.d/init.el new file mode 100644 index 0000000..523442e --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/doom.d/init.el @@ -0,0 +1,195 @@ +;;; init.el -*- lexical-binding: t; -*- + +;; This file controls what Doom modules are enabled and what order they load +;; in. Remember to run 'doom sync' after modifying it! + +;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's +;; documentation. There you'll find a link to Doom's Module Index where all +;; of our modules are listed, including what flags they support. + +;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or +;; 'C-c c k' for non-vim users) to view its documentation. This works on +;; flags as well (those symbols that start with a plus). +;; +;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its +;; directory (for easy access to its source code). + +(doom! :input + ;;bidi ; (tfel ot) thgir etirw uoy gnipleh + ;;chinese + ;;japanese + ;;layout ; auie,ctsrnm is the superior home row + + :completion + ;;company ; the ultimate code completion backend + (corfu +orderless) ; complete with cap(f), cape and a flying feather! + ;;helm ; the *other* search engine for love and life + ;;ido ; the other *other* search engine... + ;;ivy ; a search engine for love and life + vertico ; the search engine of the future + + :ui + ;;deft ; notational velocity for Emacs + doom ; what makes DOOM look the way it does + doom-dashboard ; a nifty splash screen for Emacs + ;;doom-quit ; DOOM quit-message prompts when you quit Emacs + ;;(emoji +unicode) ; 🙂 + hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW + indent-guides ; highlighted indent columns + ligatures ; ligatures and symbols to make your code pretty again + ;;minimap ; show a map of the code on the side + modeline ; snazzy, Atom-inspired modeline, plus API + ;;nav-flash ; blink cursor line after big motions + ;;neotree ; a project drawer, like NERDTree for vim + ophints ; highlight the region an operation acts on + (popup +defaults) ; tame sudden yet inevitable temporary windows + smooth-scroll ; So smooth you won't believe it's not butter + ;;tabs ; a tab bar for Emacs + ;;treemacs ; a project drawer, like neotree but cooler + unicode ; extended unicode support for various languages + (vc-gutter +pretty) ; vcs diff in the fringe + vi-tilde-fringe ; fringe tildes to mark beyond EOB + ;;window-select ; visually switch windows + workspaces ; tab emulation, persistence & separate workspaces + ;;zen ; distraction-free coding or writing + + :editor + (evil +everywhere); come to the dark side, we have cookies + file-templates ; auto-snippets for empty files + fold ; (nigh) universal code folding + (format +onsave) ; automated prettiness + ;;god ; run Emacs commands without modifier keys + ;;lispy ; vim for lisp, for people who don't like vim + ;;multiple-cursors ; editing in many places at once + ;;objed ; text object editing for the innocent + ;;parinfer ; turn lisp into python, sort of + ;;rotate-text ; cycle region at point between text candidates + snippets ; my elves. They type so I don't have to + word-wrap ; soft wrapping with language-aware indent + + :emacs + dired ; making dired pretty [functional] + electric ; smarter, keyword-based electric-indent + ;;eww ; the internet is gross + ;;ibuffer ; interactive buffer management + undo ; persistent, smarter undo for your inevitable mistakes + vc ; version-control and Emacs, sitting in a tree + + :term + ;;eshell ; the elisp shell that works everywhere + ;;shell ; simple shell REPL for Emacs + ;;term ; basic terminal emulator for Emacs + ;;vterm ; the best terminal emulation in Emacs + + :checkers + syntax ; tasing you for every semicolon you forget + (spell +flyspell) ; tasing you for misspelling mispelling + grammar ; tasing grammar mistake every you make + + :tools + ;;ansible + ;;biblio ; Writes a PhD for you (citation needed) + ;;collab ; buffers with friends + ;;debugger ; FIXME stepping through code, to help you add bugs + ;;direnv + ;;docker + ;;editorconfig ; let someone else argue about tabs vs spaces + ;;ein ; tame Jupyter notebooks with emacs + (eval +overlay) ; run code, run (also, repls) + lookup ; navigate your code and its documentation + ;;llm ; when I said you needed friends, I didn't mean... + lsp ; M-x vscode + magit ; a git porcelain for Emacs + ;;make ; run make tasks from Emacs + ;;pass ; password manager for nerds + pdf ; pdf enhancements + ;;terraform ; infrastructure as code + ;;tmux ; an API for interacting with tmux + tree-sitter ; syntax and parsing, sitting in a tree... + ;;upload ; map local to remote projects via ssh/ftp + + :os + (:if (featurep :system 'macos) macos) ; improve compatibility with macOS + ;;tty ; improve the terminal Emacs experience + + :lang + ;;agda ; types of types of types of types... + ;;beancount ; mind the GAAP + (cc +lsp) ; C > C++ == 1 + ;;clojure ; java with a lisp + ;;common-lisp ; if you've seen one lisp, you've seen them all + ;;coq ; proofs-as-programs + ;;crystal ; ruby at the speed of c + ;;csharp ; unity, .NET, and mono shenanigans + ;;data ; config/data formats + ;;(dart +flutter) ; paint ui and not much else + ;;dhall + ;;elixir ; erlang done right + ;;elm ; care for a cup of TEA? + emacs-lisp ; drown in parentheses + ;;erlang ; an elegant language for a more civilized age + ;;ess ; emacs speaks statistics + ;;factor + ;;faust ; dsp, but you get to keep your soul + ;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER) + ;;fsharp ; ML stands for Microsoft's Language + ;;fstar ; (dependent) types and (monadic) effects and Z3 + ;;gdscript ; the language you waited for + ;;(go +lsp) ; the hipster dialect + ;;(graphql +lsp) ; Give queries a REST + ;;(haskell +lsp) ; a language that's lazier than I am + ;;hy ; readability of scheme w/ speed of python + ;;idris ; a language you can depend on + json ; At least it ain't XML + ;;janet ; Fun fact: Janet is me! + (java +lsp) ; the poster child for carpal tunnel syndrome + (javascript +lsp +tree-sitter) ; all(hope(abandon(ye(who(enter(here)))))) + ;;julia ; a better, faster MATLAB + ;;kotlin ; a better, slicker Java(Script) + ;;latex ; writing papers in Emacs has never been so fun + ;;lean ; for folks with too much to prove + ;;ledger ; be audit you can be + ;;lua ; one-based indices? one-based indices + markdown ; writing docs for people to ignore + ;;nim ; python + lisp at the speed of c + nix ; I hereby declare "nix geht mehr!" + ;;ocaml ; an objective camel + org ; organize your plain life in plain text + ;;php ; perl's insecure younger brother + ;;plantuml ; diagrams for confusing people more + ;;graphviz ; diagrams for confusing yourself even more + ;;purescript ; javascript, but functional + python ; beautiful is better than ugly + ;;qt ; the 'cutest' gui framework ever + ;;racket ; a DSL for DSLs + ;;raku ; the artist formerly known as perl6 + ;;rest ; Emacs as a REST client + rst ; ReST in peace + ;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} + (rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap() + ;;scala ; java, but good + ;;(scheme +guile) ; a fully conniving family of lisps + sh ; she sells {ba,z,fi}sh shells on the C xor + ;;sml + ;;solidity ; do you need a blockchain? No. + ;;swift ; who asked for emoji variables? + ;;terra ; Earth and Moon in alignment for performance. + ;;web ; the tubes + yaml ; JSON, but readable + ;;zig ; C, but simpler + + :email + ;;(mu4e +org +gmail) + ;;notmuch + ;;(wanderlust +gmail) + + :app + ;;calendar + ;;emms + ;;everywhere ; *leave* Emacs!? You must be joking + ;;irc ; how neckbeards socialize + ;;(rss +org) ; emacs as an RSS reader + + :config + ;;literate + (default +bindings +smartparens)) diff --git a/legacy/dotfiles/home-manager/progs/doom.d/packages.el b/legacy/dotfiles/home-manager/progs/doom.d/packages.el new file mode 100644 index 0000000..9ef6fce --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/doom.d/packages.el @@ -0,0 +1,52 @@ +;; -*- no-byte-compile: t; -*- +;;; $DOOMDIR/packages.el + +;; To install a package with Doom you must declare them here and run 'doom sync' +;; on the command line, then restart Emacs for the changes to take effect -- or + + +;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror: +;; (package! some-package) + +;; To install a package directly from a remote git repo, you must specify a +;; `:recipe'. You'll find documentation on what `:recipe' accepts here: +;; https://github.com/radian-software/straight.el#the-recipe-format +;; (package! another-package +;; :recipe (:host github :repo "username/repo")) + +;; If the package you are trying to install does not contain a PACKAGENAME.el +;; file, or is located in a subdirectory of the repo, you'll need to specify +;; `:files' in the `:recipe': +;; (package! this-package +;; :recipe (:host github :repo "username/repo" +;; :files ("some-file.el" "src/lisp/*.el"))) + +;; If you'd like to disable a package included with Doom, you can do so here +;; with the `:disable' property: +;; (package! builtin-package :disable t) + +;; You can override the recipe of a built in package without having to specify +;; all the properties for `:recipe'. These will inherit the rest of its recipe +;; from Doom or MELPA/ELPA/Emacsmirror: +;; (package! builtin-package :recipe (:nonrecursive t)) +;; (package! builtin-package-2 :recipe (:repo "myfork/package")) + +;; Specify a `:branch' to install a package from a particular branch or tag. +;; This is required for some packages whose default branch isn't 'master' (which +;; our package manager can't deal with; see radian-software/straight.el#279) +;; (package! builtin-package :recipe (:branch "develop")) + +;; Use `:pin' to specify a particular commit to install. +;; (package! builtin-package :pin "1a2b3c4d5e") + + +;; Doom's packages are pinned to a specific commit and updated from release to +;; release. The `unpin!' macro allows you to unpin single packages... +;; (unpin! pinned-package) +;; ...or multiple packages +;; (unpin! pinned-package another-pinned-package) +;; ...Or *all* packages (NOT RECOMMENDED; will likely break things) +;; (unpin! t) + + +(package! yuck-mode) diff --git a/legacy/dotfiles/home-manager/progs/dunst.nix b/legacy/dotfiles/home-manager/progs/dunst.nix new file mode 100644 index 0000000..d0b7d27 --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/dunst.nix @@ -0,0 +1,35 @@ +{ pkgs, config, ... }: +{ + services.dunst = { + enable = true; + package = pkgs.dunst; + + # docs: https://dunst-project.org/documentation/ + settings = { + global = { + width = 300; + height = 300; + offset = "30x50"; + origin = "top-right"; + + # 0 is the most opaque, 100 is completely transparent + transparency = 60; + + # have consistancy between niri frame color and dunst + frame_color = config.programs.niri.settings.layout.focus-ring.active.color; + + background = "#404040"; + + font = "JetBrains Mono Nerd Font 9"; + + corner_radius = 10; + }; + + urgency_normal = { + # background = "#37474f"; + # foreground = "#eceff1"; + timeout = 10; + }; + }; + }; +} diff --git a/legacy/dotfiles/home-manager/progs/emacs.nix b/legacy/dotfiles/home-manager/progs/emacs.nix new file mode 100644 index 0000000..0725b5d --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/emacs.nix @@ -0,0 +1,43 @@ +{ + pkgs, + config, + inputs, + ... +}: +{ + imports = [ + inputs.nix-doom-emacs-unstraightened.homeModule + ( + { ... }: + { + nixpkgs.overlays = [ + inputs.nix-doom-emacs-unstraightened.overlays.default + inputs.emacs-overlay.overlays.default + ]; + } + ) + + ]; + + programs.doom-emacs = { + enable = true; + doomDir = ./doom.d; + emacs = pkgs.emacs-unstable-pgtk; + extraPackages = + epkgs: + with epkgs; + [ + dracula-theme + treesit-grammars.with-all-grammars + ] + ++ (with pkgs; [ + shellcheck + shfmt + + # for file search + fd + + pandoc + ]); + }; +} diff --git a/legacy/dotfiles/home-manager/progs/fish.nix b/legacy/dotfiles/home-manager/progs/fish.nix new file mode 100644 index 0000000..bd3ad1c --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/fish.nix @@ -0,0 +1,67 @@ +{ pkgs, lib, ... }: +let + eza = "${lib.getExe pkgs.eza} --color=always --group-directories-first"; + cargo = "${lib.getExe pkgs.cargo}"; + coreutils = "${pkgs.coreutils}/bin"; +in +{ + programs.fish = { + enable = true; + + interactiveShellInit = '' + #disable greeting + set fish_greeting + + #fixes gnupg password entry + export GPG_TTY=(${coreutils}/tty) + + #pfetch on shell start (disable pkgs because of execution time) + PF_INFO="ascii title os host kernel uptime memory editor wm" ${lib.getExe pkgs.pfetch-rs} + ''; + + shellAliases = { + c = cargo; + cr = "${cargo} run"; + cb = "${cargo} build"; + + # from DistroTube's dot files: Changing "ls" to "eza" + ls = "${eza} -al"; + la = "${eza} -a"; + ll = "${eza} -l"; + lt = "${eza} -aT"; + + # gets the largest files in a git repo's history + "git-size" = '' + ${lib.getExe pkgs.git} rev-list --objects --all | + ${lib.getExe pkgs.git} cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | + ${lib.getExe pkgs.gnused} -n 's/^blob //p' | + ${coreutils}/sort --numeric-sort --key=2 | + ${coreutils}/cut -c 1-12,41- | + ${coreutils}/numfmt --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest''; + + # aliases for (I think) macos commands + pbcopy = "${pkgs.wl-clipboard}/bin/wl-copy"; + pbpaste = "${pkgs.wl-clipboard}/bin/wl-paste"; + + gcc-native = "${lib.getExe pkgs.gcc} -Q --help=target -mtune=native -march=native | ${lib.getExe pkgs.gnugrep} -E '^\\s+\-(mtune|march)=' | ${coreutils}/tr -d '[:blank:]'"; + }; + + shellInit = '' + fish_add_path ~/.local/bin + fish_add_path ~/.cargo/bin + fish_add_path ~/.config/emacs/bin + set hydro_color_pwd 62A + set hydro_color_error red + set hydro_color_duration yellow + set hydro_color_prompt green + set hydro_color_git blue + ''; + + plugins = [ + { + name = "hydro"; + src = pkgs.fishPlugins.hydro.src; + } + ]; + }; +} diff --git a/legacy/dotfiles/home-manager/progs/flatpak.nix b/legacy/dotfiles/home-manager/progs/flatpak.nix new file mode 100644 index 0000000..d0593df --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/flatpak.nix @@ -0,0 +1,23 @@ +{ + config, + lib, + pkgs, + inputs, + ... +}: +{ + imports = [ + inputs.nix-flatpak.homeManagerModules.nix-flatpak + ]; + + home.packages = with pkgs; [ + flatpak + ]; + + services.flatpak = { + enable = true; + packages = [ + "com.tdameritrade.ThinkOrSwim" + ]; + }; +} diff --git a/legacy/dotfiles/home-manager/progs/framework-13-easyeffects.nix b/legacy/dotfiles/home-manager/progs/framework-13-easyeffects.nix new file mode 100644 index 0000000..f551340 --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/framework-13-easyeffects.nix @@ -0,0 +1,125 @@ +{ + pkgs, + config, + lib, + ... +}: +{ + + # https://community.frame.work/t/speakers-sound-quality/1078/83 + # Filter: ON HPQ Fc 100.0 Hz Gain 0.0 dB Q 1.0 + # Filter: ON PK Fc 150.0 Hz Gain 4.02 dB Q 3.0 + # Filter: ON PK Fc 600.0 Hz Gain -5.07 dB Q 4.000000000000008 + # Filter: ON PK Fc 1200.0 Hz Gain -3.49 dB Q 4.17 + # Filter: ON PK Fc 2000.0 Hz Gain 1.43 dB Q 4.0 + # Filter: ON PK Fc 5300.0 Hz Gain 3.84 dB Q 2.64 + # Filter: ON HSC Fc 6000.0 Hz Gain 4.02 dB Q 4.36 + # Filter: ON PK Fc 7500.0 Hz Gain -2.09 dB Q 3.0 + # Filter: ON PK Fc 8000.0 Hz Gain 2.01 dB Q 4.36 + # Filter: ON PK Fc 900.0 Hz Gain -4.12 dB Q 5.909999999999967 + home.file.".config/easyeffects/output/${config.services.easyeffects.preset}.json".text = + let + baseBand = { + mode = "RLC (BT)"; + mute = false; + solo = false; + slope = "1x"; + type = "Bell"; + }; + + bandList = [ + { + frequency = 100.0; + gain = 0.0; + q = 1.0; + slope = "x4"; + type = "Hi-pass"; + } + { + frequency = 150.0; + gain = 4.02; + q = 3.0; + } + { + frequency = 600.0; + gain = -5.07; + q = 4.000000000000008; + } + { + frequency = 1200.0; + gain = -3.49; + q = 4.17; + } + { + frequency = 2000.0; + gain = 1.43; + q = 4.0; + } + { + frequency = 5300.0; + gain = 3.84; + q = 2.64; + } + { + frequency = 6000.0; + gain = 4.02; + q = 4.36; + type = "Hi-shelf"; + } + { + frequency = 7500.0; + gain = -2.09; + q = 3.0; + } + { + frequency = 8000.0; + gain = 2.01; + q = 4.36; + } + { + frequency = 900.0; + gain = -4.12; + q = 5.909999999999967; + } + ]; + + bands = builtins.listToAttrs ( + map (f: { + name = "band${toString f.snd}"; + value = baseBand // f.fst; + }) (lib.lists.zipLists bandList (lib.range 0 (lib.length (bandList)))) + ); + + in + builtins.toJSON { + output = { + blocklist = [ ]; + equalizer = { + balance = 0.0; + bypass = false; + input-gain = 0.0; + left = bands; + right = bands; + mode = "IIR"; + num-bands = 10; + output-gain = -1.5; + pitch-left = 0.0; + pitch-right = 0.0; + split-channels = false; + }; + plugins_order = [ + "equalizer" + ]; + }; + }; + + services.easyeffects = { + enable = true; + package = pkgs.easyeffects; + preset = "framework"; + }; + + # easyeffects has issues stopping quickly, causing hands on logout/poweroff + # It's safe to just kill easyeffects instantly + systemd.user.services.easyeffects.Service.TimeoutStopSec = 0; +} diff --git a/legacy/dotfiles/home-manager/progs/ghostty.nix b/legacy/dotfiles/home-manager/progs/ghostty.nix new file mode 100644 index 0000000..2f9b68f --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/ghostty.nix @@ -0,0 +1,16 @@ +{ pkgs, ... }: +{ + # https://mynixos.com/home-manager/option/programs.ghostty + programs.ghostty = { + enable = true; + enableFishIntegration = true; + settings = { + theme = "Adventure"; + background-opacity = 0.7; + }; + }; + + home.sessionVariables = { + TERMINAL = "ghostty"; + }; +} diff --git a/legacy/dotfiles/home-manager/progs/helix.nix b/legacy/dotfiles/home-manager/progs/helix.nix new file mode 100644 index 0000000..ccf53e2 --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/helix.nix @@ -0,0 +1,331 @@ +{ pkgs, ... }: +{ + # set helix as default editor + home.sessionVariables.EDITOR = "hx"; + + programs.helix = { + enable = true; + package = pkgs.helix; + settings = { + theme = "my_theme"; + editor = { + cursor-shape = { + insert = "bar"; + normal = "block"; + select = "underline"; + }; + + file-picker = { + hidden = false; + }; + + # wrapping!! + soft-wrap.enable = true; + + end-of-line-diagnostics = "hint"; + inline-diagnostics = { + cursor-line = "warning"; + }; + }; + + }; + + languages = { + language = [ + { + name = "rust"; + auto-format = true; + } + ]; + }; + + themes = { + # modified fleet_dark theme + my_theme = + let + pastel-pink = "#c67C7E"; + + darkish-green = "#6B8D46"; + + white = "#ffffff"; + gray-120 = "#d1d1d1"; + gray-110 = "#c2c2c2"; + gray-100 = "#a0a0a0"; + gray-90 = "#898989"; + gray-80 = "#767676"; + gray-70 = "#5d5d5d"; + gray-60 = "#484848"; + gray-50 = "#383838"; + gray-40 = "#333333"; + gray-30 = "#2d2d2d"; + gray-20 = "#292929"; + gray-15 = "#1F1F1F"; + gray-10 = "#181818"; + black = "#000000"; + blue-110 = "#6daaf7"; + blue-100 = "#4d9bf8"; + blue-90 = "#3691f9"; + blue-80 = "#1a85f6"; + blue-70 = "#0273eb"; + blue-60 = "#0c6ddd"; + blue-50 = "#195eb5"; + blue-40 = "#194176"; + blue-30 = "#163764"; + blue-20 = "#132c4f"; + blue-10 = "#0b1b32"; + red-80 = "#ec7388"; + red-70 = "#ea4b67"; + red-60 = "#d93953"; + red-50 = "#ce364d"; + red-40 = "#c03248"; + red-30 = "#a72a3f"; + red-20 = "#761b2d"; + red-10 = "#390813"; + green-50 = "#4ca988"; + green-40 = "#3ea17f"; + green-30 = "#028764"; + green-20 = "#134939"; + green-10 = "#081f19"; + yellow-60 = "#f8ab17"; + yellow-50 = "#e1971b"; + yellow-40 = "#b5791f"; + yellow-30 = "#7c511a"; + yellow-20 = "#5a3a14"; + yellow-10 = "#281806"; + purple-20 = "#c07bf3"; + purple-10 = "#b35def"; + + blue = "#87C3FF"; + blue-light = "#ADD1DE"; + coral = "#CC7C8A"; + cyan = "#82D2CE"; + cyan-dark = "#779E9E"; + lime = "#A8CC7C"; + orange = "#E09B70"; + pink = "#E394DC"; + violet = "#AF9CFF"; + yellow = "#EBC88D"; + in + { + "attribute" = lime; + "type" = blue; + "type.return" = blue-light; + "type.parameter" = blue-light; + "constructor" = yellow; + "constant" = violet; + "constant.builtin.boolean" = cyan; + "constant.character" = yellow; + "constant.character.escape" = cyan; + "constant.numeric" = yellow; + + # string datatypes, also includes quoted attributes in nix + "string" = pastel-pink; + + "string.regexp" = cyan; + "string.special" = { + fg = yellow; + modifiers = [ "underlined" ]; + }; # .path / .url / .symbol + + "comment" = gray-90; # .line + # "comment.block" = {} # .documentation + "variable" = gray-120; # .builtin + "variable.builtin" = { + fg = coral; + }; + # "variable.other" = {} # .member + "variable.other.member" = violet; + "label" = yellow; + + # `keyword` in language, such as function declaration + "keyword" = darkish-green; + + # function name color when calling the function + "function" = yellow; + + "function.declaration" = "#EFEFEF"; + "function.macro" = lime; + "function.builtin" = lime; + "function.special" = lime; + #"function.declaration.method" = { fg = "lightest", modifiers = ["bold"] } #depends on #4892 + "tag" = blue; + "special" = lime; + "namespace" = blue; + + # used in theming + # "markup" = {} # .normal / .quote / .raw + # "markup.normal" = {} # .completion / .hover + "markup.bold" = { + modifiers = [ "bold" ]; + }; + "markup.italic" = { + modifiers = [ "italic" ]; + }; + "markup.strikethrough" = { + modifiers = [ "crossed_out" ]; + }; + "markup.heading" = { + fg = cyan; + modifiers = [ "bold" ]; + }; # .marker / .1 / .2 / .3 / .4 / .5 / .6 + "markup.list" = pink; # .unnumbered / .numbered + "markup.list.numbered" = cyan; + "markup.list.unnumbered" = cyan; + # "markup.link" = "green" + "markup.link.url" = { + fg = pink; + modifiers = [ + "italic" + "underlined" + ]; + }; + "markup.link.text" = cyan; + "markup.link.label" = purple-20; + "markup.quote" = pink; + "markup.raw" = pink; + "markup.raw.inline" = cyan; # .completion / .hover + "markup.raw.block" = "#EB83E2"; + + "diff.plus" = green-50; + "diff.minus" = red-50; + "diff.delta" = blue-80; + + # ui specific + # "ui.background" = { bg = gray-10; }; # .separator + "ui.background" = { }; + "ui.statusline" = { + fg = gray-120; + bg = gray-20; + }; + # NOR + "ui.statusline.normal" = { + fg = gray-120; + bg = gray-20; + }; + # inactive + "ui.statusline.inactive" = { + fg = gray-90; + }; + # INS + "ui.statusline.insert" = { + fg = gray-20; + bg = blue-90; + }; + # SEL + "ui.statusline.select" = { + fg = gray-20; + bg = yellow-60; + }; + + "ui.cursor" = { + modifiers = [ "reversed" ]; + }; + + # .insert / .select / .match / .primary + "ui.cursor.match" = { + bg = blue-30; + }; + # .insert / .select / .match / .primary + "ui.selection" = { + bg = gray-50; + }; + + # actual selection of text via visual mode or cursor (or search?) + "ui.selection.primary" = { + bg = blue-20; + }; + + "ui.cursorline" = { + bg = gray-15; + }; + + # line numbers + "ui.linenr" = yellow-30; + + # line number of currently selected line + "ui.linenr.selected" = yellow-50; + + # .info # .nor + "ui.popup" = { + fg = gray-120; + bg = gray-20; + }; + + "ui.window" = { + fg = gray-50; + }; + "ui.help" = { + fg = gray-120; + bg = gray-20; + }; + + "ui.menu" = { + fg = gray-120; + bg = gray-20; + }; + + #.selected + "ui.menu.selected" = { + fg = white; + bg = blue-40; + }; + + # Calculated as #ffffff with 30% opacity + "ui.menu.scroll" = { + fg = "#dfdfdf"; + }; + + "ui.text" = gray-120; + # .focus / .info + "ui.text.focus" = { + fg = white; + bg = blue-40; + }; + + "ui.virtual" = gray-90; # .whitespace + "ui.virtual.inlay-hint" = { + fg = gray-70; + }; + "ui.virtual.ruler" = { + bg = gray-20; + }; + + "hint" = gray-80; + "info" = "#A366C4"; + "warning" = "#FACb66"; + "error" = "#FF5269"; + + "diagnostic.hint" = { + underline = { + color = gray-80; + style = "line"; + }; + }; + "diagnostic.info" = { + underline = { + color = "#A366C4"; + style = "line"; + }; + }; + "diagnostic.warning" = { + underline = { + color = "#FACB66"; + style = "line"; + }; + }; + "diagnostic.error" = { + underline = { + color = "#FF5269"; + style = "line"; + }; + }; + "diagnostic.unnecessary" = { + modifiers = [ "dim" ]; + }; + "diagnostic.deprecated" = { + modifiers = [ "crossed_out" ]; + }; + }; + }; + }; +} diff --git a/legacy/dotfiles/home-manager/progs/niri.nix b/legacy/dotfiles/home-manager/progs/niri.nix new file mode 100644 index 0000000..f34f2e2 --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/niri.nix @@ -0,0 +1,229 @@ +{ + config, + pkgs, + lib, + inputs, + niri-package, + ... +}: +let + invert_image_avg = pkgs.callPackage ../util/inverse_color.nix; +in +{ + imports = [ + inputs.niri.homeModules.config + ( + { ... }: + { + nixpkgs.overlays = [ + inputs.niri.overlays.niri + ]; + } + ) + ]; + + programs.niri = { + package = niri-package; + settings = { + prefer-no-csd = true; + + input = { + touchpad = { + scroll-factor = 0.4; + }; + }; + + clipboard = { + disable-primary = true; + }; + + # skip the hotkey menu thingy + hotkey-overlay.skip-at-startup = true; + + layout = { + gaps = 16; + struts = { + # left = 16; + # right = 16; + top = -8; + # bottom = 16; + }; + focus-ring = { + enable = true; + active = { + color = builtins.readFile (invert_image_avg { + src = ../wallpaper.png; + }); + }; + }; + }; + + xwayland-satellite.path = lib.getExe pkgs.xwayland-satellite; + + window-rules = [ + { draw-border-with-background = false; } + { + geometry-corner-radius = + let + radius = 10.0; + in + { + top-left = radius; + top-right = radius; + bottom-right = radius; + bottom-left = radius; + }; + } + { clip-to-geometry = true; } + { + matches = [ + { + app-id = "^zen"; + title = "^Picture-in-Picture$"; + } + { + app-id = "Mullvad VPN"; + } + ]; + + open-floating = true; + default-column-width = { + fixed = 480; + }; + default-window-height = { + fixed = 270; + }; + } + ]; + + # XF86AudioMedia allow-when-locked=true { spawn "playerctl" "play-pause"; } + # XF86AudioPlay allow-when-locked=true { spawn "playerctl" "play-pause"; } + # XF86AudioPrev allow-when-locked=true { spawn "playerctl" "previous"; } + # XF86AudioNext allow-when-locked=true { spawn "playerctl" "next"; } + + # https://github.com/sodiboo/niri-flake/issues/591 + switch-events = with config.lib.niri.actions; { + "lid-close".action = spawn (lib.getExe pkgs.swaylock); + }; + + binds = with config.lib.niri.actions; { + # Application launcher + "Mod+Space".action = spawn (lib.getExe pkgs.fuzzel); + + # TODO! make this work + "Mod+E".action = spawn "${config.programs.doom-emacs.finalDoomPackage}/bin/doom-emacs"; + + "Mod+O".action = toggle-overview; + + # open a terminal + "Mod+T".action = spawn config.home.sessionVariables.TERMINAL; + + # lock the screen + "Mod+X".action = spawn (lib.getExe pkgs.swaylock); + + # screenshotting + "Print".action.screenshot = [ ]; + + # https://github.com/sodiboo/niri-flake/commit/a7949bd0f5551fdfffd04cb9735ad3cd3167d624#r153571513 + # "Ctrl+Print".action = screenshot-screen; + "Alt+Print".action.screenshot-window = [ ]; + + # Volume control + "XF86AudioRaiseVolume".action = spawn [ + "${pkgs.avizo}/bin/volumectl" + "-u" + "up" + ]; + + "XF86AudioLowerVolume".action = spawn [ + "${pkgs.avizo}/bin/volumectl" + "-u" + "down" + ]; + + "XF86AudioMute".action = spawn [ + "${pkgs.avizo}/bin/volumectl" + "toggle-mute" + ]; + + # Display Brightness control + "XF86MonBrightnessUp".action = spawn [ + "${pkgs.avizo}/bin/lightctl" + "up" + ]; + + "XF86MonBrightnessDown".action = spawn [ + "${pkgs.avizo}/bin/lightctl" + "down" + ]; + + # color picker and copies to clipboard + "Mod+Ctrl+Alt+C".action = spawn [ + (lib.getExe pkgs.hyprpicker) + "-za" + ]; + + # "Framework" key (F12) + # "XF86AudioMedia".action = spawn []; + + # Force close a window + "Mod+Q".action = close-window; + + "Mod+Shift+Q".action = quit; + + # bindings for window management + "Mod+H".action = focus-column-left; + "Mod+J".action = focus-window-down; + "Mod+K".action = focus-window-up; + "Mod+L".action = focus-column-right; + + "Mod+Ctrl+H".action = move-column-left; + "Mod+Ctrl+J".action = move-window-down; + "Mod+Ctrl+K".action = move-window-up; + "Mod+Ctrl+L".action = move-column-right; + + #fine adjustments to height and width of window + "Mod+Minus".action = set-column-width "-10%"; + "Mod+Equal".action = set-column-width "+10%"; + "Mod+Shift+Minus".action = set-window-height "-10%"; + "Mod+Shift+Equal".action = set-window-height "+10%"; + + "Mod+Home".action = focus-column-first; + "Mod+End".action = focus-column-last; + "Mod+Ctrl+Home".action = move-column-to-first; + "Mod+Ctrl+End".action = move-column-to-last; + + "Mod+Shift+H".action = focus-monitor-left; + "Mod+Shift+J".action = focus-monitor-down; + "Mod+Shift+K".action = focus-monitor-up; + "Mod+Shift+L".action = focus-monitor-right; + + "Mod+Shift+Ctrl+H".action = move-column-to-monitor-left; + "Mod+Shift+Ctrl+J".action = move-column-to-monitor-down; + "Mod+Shift+Ctrl+K".action = move-column-to-monitor-up; + "Mod+Shift+Ctrl+L".action = move-column-to-monitor-right; + + "Mod+Page_Down".action = focus-workspace-down; + "Mod+Page_Up".action = focus-workspace-up; + "Mod+U".action = focus-workspace-down; + "Mod+I".action = focus-workspace-up; + + # move a window up and down workspaces + "Mod+Ctrl+Page_Down".action = move-column-to-workspace-down; + "Mod+Ctrl+Page_Up".action = move-column-to-workspace-up; + + "Mod+Ctrl+U".action = move-column-to-workspace-down; + "Mod+Ctrl+I".action = move-column-to-workspace-up; + + # does little squeeze thing into the left or right position with another window + "Mod+BracketLeft".action = consume-or-expel-window-left; + "Mod+BracketRight".action = consume-or-expel-window-right; + + "Mod+R".action = switch-preset-column-width; + "Mod+F".action = maximize-column; + "Mod+Shift+F".action = fullscreen-window; + "Mod+C".action = center-column; + }; + }; + }; +} diff --git a/legacy/dotfiles/home-manager/progs/noctalia.nix b/legacy/dotfiles/home-manager/progs/noctalia.nix new file mode 100644 index 0000000..e62520c --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/noctalia.nix @@ -0,0 +1,93 @@ +{ + pkgs, + inputs, + config, + lib, + ... +}: +{ + imports = [ + inputs.noctalia.homeModules.default + ]; + + programs.noctalia-shell = { + enable = true; + package = pkgs.noctalia-shell; + settings = { + bar = { + position = "top"; + floating = true; + backgroundOpacity = 0.93; + }; + general = { + animationSpeed = 1.5; + radiusRatio = 1.2; + }; + colorSchemes = { + darkMode = true; + useWallpaperColors = true; + }; + location = { + weatherEnabled = false; + }; + wallpaper = { + enabled = true; + }; + }; + }; + + home.file.".cache/noctalia/wallpapers.json" = { + text = builtins.toJSON { + defaultWallpaper = "${../wallpaper.png}"; + wallpapers = { }; + }; + }; + + programs.niri.settings = { + spawn-at-startup = [ + { + command = [ + "noctalia-shell" + ]; + } + ]; # place noctalia overview wallpaper on the backdrop layer + layer-rules = [ + { + matches = [ + { namespace = "^noctalia-overview*"; } + ]; + place-within-backdrop = true; + } + ]; + + # allow notification actions and window activation from noctalia + debug = { + honor-xdg-activation-with-invalid-serial = [ ]; + }; + + binds = + with config.lib.niri.actions; + let + noctalia = + cmd: + [ + "noctalia-shell" + "ipc" + "call" + ] + ++ (lib.splitString " " cmd); + + in + { + + # noctalia shell keybinds + "Mod+D".action = spawn (noctalia "launcher toggle"); + "Mod+A".action = spawn (noctalia "controlCenter toggle"); + "Mod+Escape".action = spawn (noctalia "sessionMenu toggle"); + "Mod+Shift+X".action = spawn (noctalia "lockScreen lock"); + "Mod+N".action = spawn (noctalia "notifications toggleHistory"); + + }; + }; + +} diff --git a/legacy/dotfiles/home-manager/progs/pi.nix b/legacy/dotfiles/home-manager/progs/pi.nix new file mode 100644 index 0000000..da89c87 --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/pi.nix @@ -0,0 +1,179 @@ +{ + config, + lib, + pkgs, + inputs, + ... +}: +let + # sisyphus/oracle/prometheus → default/slow/plan = opus + # librarian/explore/quick → smol/commit = haiku + ompSettings = { + modelRoles = { + default = "anthropic/claude-opus-4-7:high"; + smol = "anthropic/claude-haiku-4-5:low"; + slow = "anthropic/claude-opus-4-7:xhigh"; + plan = "anthropic/claude-opus-4-7:high"; + commit = "anthropic/claude-haiku-4-5:low"; + }; + }; + + # provider config — secrets read at eval time via builtins.readFile + # (omp treats apiKey as env-var-name-or-literal, not a shell command) + ompModels = { + providers = { + openrouter = { + apiKey = lib.strings.trim (builtins.readFile ../secrets/openrouter_api_key); + }; + "llama.cpp" = { + baseUrl = "https://llm.sigkill.computer"; + apiKey = lib.strings.trim (builtins.readFile ../secrets/llama_cpp_api_key); + api = "openai-responses"; + authHeader = true; + discovery.type = "llama.cpp"; + }; + }; + }; +in +{ + home.packages = [ + (inputs.llm-agents.packages.${pkgs.stdenv.hostPlatform.system}.omp.overrideAttrs (old: { + patches = (old.patches or [ ]) ++ [ ]; + })) + ]; + + # main settings: ~/.omp/agent/config.yml (JSON is valid YAML) + home.file.".omp/agent/config.yml".text = builtins.toJSON ompSettings; + + # model/provider config: ~/.omp/agent/models.yml + home.file.".omp/agent/models.yml".text = builtins.toJSON ompModels; + + # global instructions loaded at startup + home.file.".omp/agent/AGENTS.md".text = '' + You are an intelligent and observant agent. + If instructed to commit, disable gpg signing. + You are on nixOS, if you don't have access to a tool, you can access it via the `nix-shell` command. + + ## Think deeply about everything. + When given a problem, break it down, abstract it out, understand the fundamentals, then solve it in the real world. + + ## Misc + For long-running commands, make sure you set the timeout of the Bash tool provided to a larger value. + Do NOT read secret files. Do not directly read files that are api keys or are contextually sensitive. + + ## Behavior + Do not be sycophantic in your responses. + Do not use emojis unless explicitly asked to. This includes in code. + Use Test Driven Development methodology. + + ## Nix + For using `nix build` append `-L` to get better visibility into the logs. + If you get an error that a file can't be found, always try to `git add` the file before trying other troubleshooting steps. + ''; + + home.file.".omp/agent/skills/android-ui/SKILL.md".text = '' + --- + name: android-ui + description: Android UI automation via ADB. Use for any Android device interaction, UI testing, screenshot analysis, element coordinate lookup, and gesture automation. + --- + + # Android UI + + ## 1. Taking Screenshots + ``` + adb exec-out screencap -p > /tmp/screen.png + ``` + Captures the current screen state as a PNG image. + + ## 2. Analyzing Screenshots + Read the screenshot file to understand the current screen state and identify UI elements. + + ## 3. Getting Precise Element Coordinates + UI Automator dump - extracts the full UI hierarchy as XML: + ``` + adb shell uiautomator dump /sdcard/ui.xml && adb pull /sdcard/ui.xml /tmp/ui.xml + ``` + Then grep for specific elements: + ```sh + # Find by text + grep -oP 'text="Login".*?bounds="[^"]*"' /tmp/ui.xml + # Find by class + grep -oP 'class="android.widget.EditText".*?bounds="[^"]*"' /tmp/ui.xml + ``` + Bounds format: `[left,top][right,bottom]` — tap center: `((left+right)/2, (top+bottom)/2)` + + ## 4. Tapping Elements + ``` + adb shell input tap X Y + ``` + Where X, Y are pixel coordinates from the bounds. + + ## 5. Text Input + ``` + adb shell input text "some_text" + ``` + Note: Special characters need escaping (`\!`, `\;`, etc.) + + ## 6. Other Gestures + ```sh + # Swipe/scroll + adb shell input swipe startX startY endX endY duration_ms + # Key events + adb shell input keyevent KEYCODE_BACK + adb shell input keyevent KEYCODE_ENTER + ``` + + ## 7. WebView Limitation + - UI Automator can see WebView content if accessibility is enabled + - Touch events on iframe content (like Cloudflare Turnstile) often fail due to cross-origin isolation + - Form fields in WebViews work if you get exact bounds from the UI dump + + ## Typical Flow + 1. Take screenshot → analyze it (get rough layout) + 2. Dump UI hierarchy → grep for exact element bounds + - NEVER ASSUME COORDINATES. You must ALWAYS check first. + - Do this before ANY tap action as elements on the screen may have changed. + 3. Calculate center coordinates from bounds + 4. Tap/interact + 5. Wait → screenshot → verify result + ''; + + # omp has a built-in browser tool with NixOS auto-detection, + # but this skill provides playwright MCP as a supplementary option + home.file.".omp/agent/skills/playwright/SKILL.md".text = + let + browsers = pkgs.playwright-driver.browsers; + chromiumDir = builtins.head ( + builtins.filter (n: builtins.match "chromium-[0-9]+" n != null) ( + builtins.attrNames browsers.passthru.entries + ) + ); + chromiumPath = "${browsers}/${chromiumDir}/chrome-linux64/chrome"; + in + '' + --- + name: playwright + description: Browser automation via Playwright MCP. Use as an alternative to the built-in browser tool for Playwright-specific workflows, testing, and web scraping. Chromium is provided by NixOS. + --- + + # Playwright + + ## Browser Setup + Chromium is provided by NixOS. Do NOT attempt to download browsers. + + - Chromium path: `${chromiumPath}` + - Browsers path: `${browsers}` + + ## Usage + Launch the Playwright MCP server for browser automation: + ```bash + npx @playwright/mcp@latest --executable-path "${chromiumPath}" --user-data-dir "${config.home.homeDirectory}/.cache/playwright-mcp" + ``` + + Set these environment variables if not already set: + ```bash + export PLAYWRIGHT_BROWSERS_PATH="${browsers}" + export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 + ``` + ''; +} diff --git a/legacy/dotfiles/home-manager/progs/swaylock.nix b/legacy/dotfiles/home-manager/progs/swaylock.nix new file mode 100644 index 0000000..d9d11fa --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/swaylock.nix @@ -0,0 +1,50 @@ +{ pkgs, ... }: +let + blur = pkgs.callPackage ../util/blur.nix; +in +{ + programs.swaylock = { + enable = true; + settings = { + color = "24273a"; + ring-color = "b7bdf8"; + + bs-hl-color = "f4dbd6"; + caps-lock-bs-hl-color = "f4dbd6"; + text-clear-color = "f4dbd6"; + ring-clear-color = "f4dbd6"; + + text-caps-lock-color = "f5a97f"; + ring-caps-lock-color = "f5a97f"; + + ring-ver-color = "8aadf4"; + text-ver-color = "8aadf4"; + + ring-wrong-color = "ee99a0"; + text-wrong-color = "ee99a0"; + + layout-text-color = "cad3f5"; + text-color = "cad3f5"; + + caps-lock-key-hl-color = "a6da95"; + key-hl-color = "a6da95"; + + inside-color = 0; + inside-clear-color = 0; + inside-caps-lock-color = 0; + inside-ver-color = 0; + inside-wrong-color = 0; + layout-bg-color = 0; + layout-border-color = 0; + line-color = 0; + line-clear-color = 0; + line-caps-lock-color = 0; + line-ver-color = 0; + line-wrong-color = 0; + separator-color = 0; + image = builtins.toString (blur { + src = ../wallpaper.png; + }); + }; + }; +} diff --git a/legacy/dotfiles/home-manager/progs/trezor.nix b/legacy/dotfiles/home-manager/progs/trezor.nix new file mode 100644 index 0000000..86e5f20 --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/trezor.nix @@ -0,0 +1,12 @@ +{ pkgs, lib, ... }: +{ + nixpkgs.config.allowUnfree = true; + home.packages = with pkgs; [ + trezor-udev-rules + trezord + trezor-suite + monero-gui + monero-cli + trezorctl + ]; +} diff --git a/legacy/dotfiles/home-manager/progs/zen/dark-reader.nix b/legacy/dotfiles/home-manager/progs/zen/dark-reader.nix new file mode 100644 index 0000000..2218adb --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/zen/dark-reader.nix @@ -0,0 +1,164 @@ +# Dark Reader extension settings +# Addon ID: addon@darkreader.org +{ lib }: +let + defaultTheme = { + mode = 1; + brightness = 100; + contrast = 100; + grayscale = 0; + sepia = 0; + useFont = false; + fontFamily = "Open Sans"; + textStroke = 0; + engine = "dynamicTheme"; + stylesheet = ""; + darkSchemeBackgroundColor = "#181a1b"; + darkSchemeTextColor = "#e8e6e3"; + lightSchemeBackgroundColor = "#dcdad7"; + lightSchemeTextColor = "#181a1b"; + scrollbarColor = ""; + selectionColor = "auto"; + styleSystemControls = false; + lightColorScheme = "Default"; + darkColorScheme = "Default"; + immediateModify = false; + }; + + mkCustomTheme = + { + url, + engine ? defaultTheme.engine, + builtIn ? false, + }: + { + inherit url; + theme = defaultTheme // { + inherit engine; + }; + } + // lib.optionalAttrs builtIn { inherit builtIn; }; +in +{ + force = true; + settings = { + enabled = true; + fetchNews = true; + syncSettings = false; + syncSitesFixes = false; + changeBrowserTheme = false; + enabledByDefault = false; + enableForPDF = true; + enableForProtectedPages = false; + enableContextMenus = false; + detectDarkTheme = true; + previewNewDesign = false; + previewNewestDesign = false; + + theme = defaultTheme; + + enabledFor = [ + "search.nixos.org" + "quizlet.com" + "claude.ai" + ]; + + disabledFor = [ + "cinny.envs.net" + "element.envs.net" + "mail.proton.me" + "mail.google.com" + "www.gardling.com" + "projects.fivethirtyeight.com" + "secure.bankofamerica.com" + "billpay-ui.bankofamerica.com" + "plus.pearson.com" + "immich.gardling.com" + "huggingface.co" + "session.masteringphysics.com" + "brainly.com" + "www.270towin.com" + "phet.colorado.edu" + "8042-1.portal.athenahealth.com" + "torrent.gardling.com" + "nssb-p.adm.fit.edu" + "mail.openbenchmarking.org" + "moneroocean.stream" + "app.diagrams.net" + "books.gw-project.org" + "chat.deepseek.com" + "n21.ultipro.com" + "www.egaroucid.nyanyan.dev" + "bitmagnet.gardling.com" + "frame.work" + "www.altcancer.net" + "jenkins.jpenilla.xyz" + "soulseek.gardling.com" + "discord.com" + "www.lufthansa.com" + "surveys.hyundaicx.com" + "www.apple.com" + "docs.google.com" + "marcuspork.com" + "en.akinator.com" + "www.reddit.com" + "terra.layoutit.com" + "www.ebay.com" + "www.nytimes.com" + "app.electricitymaps.com" + "www.revoy.com" + "kagi.com" + "www.bhphotovideo.com" + "survey.stackoverflow.co" + "www.google.com" + "en.wikipedia.org" + "workforcenow.adp.com" + "app.element.io" + "www.desmos.com" + "en.wiktionary.org" + "dariandean0.github.io" + ]; + + customThemes = [ + (mkCustomTheme { + url = [ "*.officeapps.live.com" ]; + engine = "cssFilter"; + builtIn = true; + }) + (mkCustomTheme { + url = [ "*.sharepoint.com" ]; + engine = "cssFilter"; + builtIn = true; + }) + (mkCustomTheme { + url = [ "docs.google.com" ]; + engine = "cssFilter"; + builtIn = true; + }) + (mkCustomTheme { + url = [ "onedrive.live.com" ]; + engine = "cssFilter"; + builtIn = true; + }) + (mkCustomTheme { + url = [ "huggingface.co" ]; + engine = "svgFilter"; + }) + (mkCustomTheme { + url = [ "www.last.fm" ]; + engine = "svgFilter"; + }) + ]; + + automation = { + enabled = false; + mode = ""; + behavior = "OnOff"; + }; + + time = { + activation = "18:00"; + deactivation = "9:00"; + }; + }; +} diff --git a/legacy/dotfiles/home-manager/progs/zen/default.nix b/legacy/dotfiles/home-manager/progs/zen/default.nix new file mode 100644 index 0000000..ba616e0 --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/zen/default.nix @@ -0,0 +1,134 @@ +{ + pkgs, + lib, + inputs, + config, + ... +}: +let + firefox-addons = inputs.firefox-addons.packages.${pkgs.stdenv.hostPlatform.system}; + buildFirefoxXpiAddon = + inputs.firefox-addons.lib.${pkgs.stdenv.hostPlatform.system}.buildFirefoxXpiAddon; + + hacker-smacker = buildFirefoxXpiAddon { + pname = "hacker-smacker"; + version = "2.2"; + addonId = "jid1-eo0mcXLTqCkaWA@jetpack"; + url = "https://addons.mozilla.org/firefox/downloads/file/4715262/hacker_smacker-2.2.xpi"; + sha256 = "d28f0597d5c4bae5db712b4875f4104120f7e55e5ea769c44d70996be31cc0d1"; + meta = with lib; { + homepage = "https://www.hackersmacker.org"; + description = "Highlight (friend) and filter (foe) individual authors on Hacker News"; + license = licenses.mit; + platforms = platforms.all; + }; + }; + + consumer-rights-wiki = buildFirefoxXpiAddon { + pname = "consumer-rights-wiki"; + version = "1.0.34"; + addonId = "@crw-extension-firefox"; + url = "https://addons.mozilla.org/firefox/downloads/file/4730448/consumer_rights_wiki-1.0.34.xpi"; + sha256 = "732969ed4d5c7965b6254a1190a82ce4ab0ff44bda2295264eb8a22c452899ea"; + meta = with lib; { + homepage = "https://github.com/FULU-Foundation/CRW-Extension"; + description = "Shows a popup when the site you're viewing has an article on the Consumer Rights Wiki"; + license = licenses.mit; + platforms = platforms.all; + }; + }; + + ublockSettings = import ./ublock.nix { inherit lib; }; + darkReaderSettings = import ./dark-reader.nix { inherit lib; }; + redirectorSettings = import ./redirector.nix { inherit lib; }; +in +{ + programs.zen-browser = { + enable = true; + profiles.default = { + isDefault = true; + + extensions = { + force = true; + + packages = + (with firefox-addons; [ + bitwarden + buster-captcha-solver + consent-o-matic + darkreader + fastforwardteam + localcdn + redirector + refined-github + return-youtube-dislikes + search-by-image # reverse image search + ruffle_rs + snowflake + steam-database + ublock-origin + ]) + ++ [ + hacker-smacker + consumer-rights-wiki + ]; + + settings = { + "uBlock0@raymondhill.net" = ublockSettings; + "addon@darkreader.org" = darkReaderSettings; + "redirector@einaregilsson.com" = redirectorSettings; + }; + }; + + search = { + force = true; + default = "kagi"; + privateDefault = "ddg"; + order = [ + "kagi" + "ddg" + "google" + ]; + engines = { + kagi = { + name = "Kagi"; + urls = [ { template = "https://kagi.com/search?q={searchTerms}"; } ]; + iconMapObj."16" = "https://kagi.com/favicon.ico"; + definedAliases = [ "@k" ]; + }; + google.metaData.alias = "@g"; + }; + }; + + settings = { + "identity.sync.tokenserver.uri" = "https://firefox-sync.sigkill.computer/1.0/sync/1.5"; + # auto-enable extensions on install + "extensions.autoDisableScopes" = 0; + # don't sync prefs/addons — we manage them declaratively via nix + # syncing fights with the declarative config and can cause data loss + # https://github.com/nix-community/home-manager/issues/6083 + "services.sync.engine.prefs" = false; + "services.sync.engine.addons" = false; + # use a separate default search engine in private windows + "browser.search.separatePrivateDefault.ui.enabled" = true; + "browser.search.separatePrivateDefault" = true; + # disable built-in password manager — using bitwarden + "signon.rememberSignons" = false; + "signon.autofillForms" = false; + "signon.management.page.breach-alerts.enabled" = false; + "signon.formlessCapture.enabled" = false; + "signon.privateBrowsingCapture.enabled" = false; + # disable the autocomplete popup on login fields + "signon.firefoxRelay.feature" = ""; + "signon.generation.enabled" = false; + # disable passkey/webauthn prompts from the built-in manager + "security.webauthn.enable_conditional_mediation" = false; + }; + }; + }; + + # Zen ignores XDG and hardcodes ~/.zen — symlink to module-managed path + home.file.".zen".source = config.lib.file.mkOutOfStoreSymlink "${config.xdg.configHome}/zen"; + + home.sessionVariables.BROWSER = "zen"; +} diff --git a/legacy/dotfiles/home-manager/progs/zen/redirector.nix b/legacy/dotfiles/home-manager/progs/zen/redirector.nix new file mode 100644 index 0000000..160bff4 --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/zen/redirector.nix @@ -0,0 +1,75 @@ +# Redirector extension settings +# Addon ID: redirector@einaregilsson.com +# +# To add a new redirect, just add another mkRedirect call to the list: +# (mkRedirect { from = "youtube.com"; to = "invidious.example.com"; description = "YouTube to Invidious"; }) +{ lib }: +let + # helper to create a redirect rule from a simple domain mapping. + # handles www. subdomains automatically. for other subdomains + # (like old.reddit.com), create a separate rule with the full domain. + mkRedirect = + { + from, + to, + description, + }: + let + escapedFrom = builtins.replaceStrings [ "." ] [ "\\." ] from; + in + { + inherit description; + exampleUrl = "https://${from}/example"; + exampleResult = "https://${to}/example"; + error = null; + includePattern = "^https?://(www\\.)?${escapedFrom}(.*)$"; + excludePattern = ""; + patternDesc = ""; + redirectUrl = "https://${to}$2"; + patternType = "R"; + processMatches = "noProcessing"; + disabled = false; + grouped = false; + appliesTo = [ "main_frame" ]; + }; +in +{ + force = true; + settings = { + redirects = [ + (mkRedirect { + from = "x.com"; + to = "xcancel.com"; + description = "X to xcancel"; + }) + (mkRedirect { + from = "twitter.com"; + to = "xcancel.com"; + description = "Twitter to xcancel"; + }) + (mkRedirect { + from = "reddit.com"; + to = "safereddit.com"; + description = "Reddit to Redlib"; + }) + (mkRedirect { + from = "old.reddit.com"; + to = "safereddit.com"; + description = "Old Reddit to Redlib"; + }) + (mkRedirect { + from = "new.reddit.com"; + to = "safereddit.com"; + description = "New Reddit to Redlib"; + }) + (mkRedirect { + from = "np.reddit.com"; + to = "safereddit.com"; + description = "NP Reddit to Redlib"; + }) + ]; + disabled = false; + logging = false; + enableNotifications = false; + }; +} diff --git a/legacy/dotfiles/home-manager/progs/zen/ublock.nix b/legacy/dotfiles/home-manager/progs/zen/ublock.nix new file mode 100644 index 0000000..6e8c217 --- /dev/null +++ b/legacy/dotfiles/home-manager/progs/zen/ublock.nix @@ -0,0 +1,143 @@ +# uBlock Origin extension settings +# Addon ID: uBlock0@raymondhill.net +{ lib }: +{ + force = true; + settings = { + userSettings = { + cloudStorageEnabled = true; + externalLists = builtins.concatStringsSep "\n" [ + "https://abp.oisd.nl/" + "https://filters.adtidy.org/extension/ublock/filters/3.txt" + "https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=bpc-paywall-filter.txt" + "https://raw.githubusercontent.com/DetachHead/ublock-filters/refs/heads/master/list.txt" + "https://raw.githubusercontent.com/laylavish/uBlockOrigin-HUGE-AI-Blocklist/main/list.txt" + ]; + importedLists = [ + "https://abp.oisd.nl/" + "https://filters.adtidy.org/extension/ublock/filters/3.txt" + "https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=bpc-paywall-filter.txt" + "https://raw.githubusercontent.com/DetachHead/ublock-filters/refs/heads/master/list.txt" + "https://raw.githubusercontent.com/laylavish/uBlockOrigin-HUGE-AI-Blocklist/main/list.txt" + ]; + popupPanelSections = 15; + prefetchingDisabled = false; + }; + + selectedFilterLists = [ + "user-filters" + "ublock-filters" + "ublock-badware" + "ublock-privacy" + "ublock-quick-fixes" + "ublock-unbreak" + "easylist" + "adguard-generic" + "adguard-mobile" + "easyprivacy" + "adguard-spyware-url" + "block-lan" + "urlhaus-1" + "curben-phishing" + "plowe-0" + "dpollock-0" + "fanboy-cookiemonster" + "ublock-cookies-easylist" + "adguard-cookies" + "ublock-cookies-adguard" + "fanboy-social" + "adguard-social" + "fanboy-thirdparty_social" + "easylist-chat" + "easylist-newsletters" + "easylist-notifications" + "easylist-annoyances" + "adguard-mobile-app-banners" + "adguard-other-annoyances" + "adguard-popup-overlays" + "adguard-widgets" + "ublock-annoyances" + "SWE-1" + "https://filters.adtidy.org/extension/ublock/filters/3.txt" + "https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=bpc-paywall-filter.txt" + "https://raw.githubusercontent.com/DetachHead/ublock-filters/refs/heads/master/list.txt" + "https://raw.githubusercontent.com/laylavish/uBlockOrigin-HUGE-AI-Blocklist/main/list.txt" + "https://abp.oisd.nl/" + ]; + + whitelist = [ + "chrome-extension-scheme" + "moz-extension-scheme" + ]; + + dynamicFilteringString = builtins.concatStringsSep "\n" [ + "behind-the-scene * * noop" + "behind-the-scene * inline-script noop" + "behind-the-scene * 1p-script noop" + "behind-the-scene * 3p-script noop" + "behind-the-scene * 3p-frame noop" + "behind-the-scene * image noop" + "behind-the-scene * 3p noop" + ]; + + hostnameSwitchesString = builtins.concatStringsSep "\n" [ + "no-large-media: behind-the-scene false" + "no-csp-reports: * true" + "no-scripting: arstechnica.com true" + "no-scripting: www.phoronix.com true" + "no-scripting: www.theatlantic.com true" + "no-scripting: wccftech.com true" + "no-remote-fonts: www.theverge.com true" + "no-scripting: www.theverge.com true" + "no-scripting: gamersnexus.net true" + ]; + + "user-filters" = builtins.concatStringsSep "\n" [ + # Annoying fonts warning because of localCDN + "docs.google.com##.jfk-butterBar-shown.jfk-butterBar-info.jfk-butterBar" + + # remove phoronix premium ad + "www.phoronix.com##aside:nth-of-type(3)" + "www.phoronix.com##aside.widget:nth-of-type(4)" + + # Remove instagram login screen + "www.instagram.com##.x1nhvcw1.x1oa3qoh.x1qjc9v5.xqjyukv.xdt5ytf.x2lah0s.x1c4vz4f.x1odjw0f.xw2csxc.x1n2onr6.xo71vjh.x5pf9jr.x13lgxp2.x168nmei.x78zum5.xjbqb8w.x9f619" + "www.instagram.com##.xl56j7k.x1iyjqo2.xdt5ytf.x78zum5.x9f619.x1qjc9v5" + "www.instagram.com##.x1jfb8zj.x1qrby5j.x1n2onr6.x7ja8zs.x1t2pt76.x1lytzrv.xedcshv.xarpa2k.x3igimt.x12ejxvf.xaigb6o.x1beo9mf.x1h91t0o.x4k7w5x.x1uvtmcs" + "www.instagram.com##.x1h0vfkc.x13vifvy.xixxii4.x17qophe.xds687c.x1ey2m1c" + "www.instagram.com##.x1n2onr6.xg6iff7.xippug5.xdt5ytf.x78zum5" + "www.instagram.com##.xzkaem6.x1n2onr6 > .xjx87ck.x1yqm8si.xfk6m8.xh8yej3.x13vifvy.x1rohswg.xixxii4.x1odjw0f.xw2csxc.x17qophe.x5yr21d.x1pq812k.x1ja2u2z.x9f619" + + # remove github dashboard copilot stuff + "github.com##copilot-dashboard-entrypoint" + "github.com##.hide-md.hide-sm.AppHeader-CopilotChat > react-partial-anchor" + "github.com##react-partial-anchor > .AppHeader-buttonLeft.AppHeader-button.Button--medium.Button--secondary.Button--iconOnly.Button" + "github.com##.Button.Button--medium.Button--secondary.AppHeader-button--dropdown.AppHeader-buttonRight.AppHeader-button" + "github.com##.tooltipped-sw.tooltipped.AppHeader-buttonRight.color-fg-muted.AppHeader-button.Button--medium.Button--secondary.Button--iconOnly.Button" + + # github sidebar stuff + ''github.com##.rounded-2.p-3.color-border-default.border.\ .mt-0.list-none.relative > .s\:rounded-2.bg-transparent.-outline-offset-1.py-2xs.cursor-pointer.hover\:no-underline.hover\:bg-neutral-background-hover.hover\:text-secondary-hover.text-secondary.gap-\[0\.5rem\].px-md.relative.justify-between.flex'' + + "www.quora.com##.qu-bg--raised.qu-mb--small.qu-boxShadow--small.qu-borderColor--raised.qu-borderAll.dom_annotate_question_answer_item_0.q-box > div > div > div > div > div.q-box" + + "discord.com##.contentCollapsedWrapper__5f897" + + "www.statista.com###pdfpremiumArrowModal > .vueModal__overlay" + + # The AI summary BS + ''www.reddit.com##.px-md.pb-\[22px\].pt-md.mt-md.rounded-4.bg-neutral-background-weak.xs\:block.hidden'' + + "www.sciencedirect.com##.gXjxP.sc-fHSyaj" + ]; + }; +} diff --git a/legacy/dotfiles/home-manager/secrets/llama_cpp_api_key b/legacy/dotfiles/home-manager/secrets/llama_cpp_api_key new file mode 100644 index 0000000..7aba54f Binary files /dev/null and b/legacy/dotfiles/home-manager/secrets/llama_cpp_api_key differ diff --git a/legacy/dotfiles/home-manager/secrets/openrouter_api_key b/legacy/dotfiles/home-manager/secrets/openrouter_api_key new file mode 100644 index 0000000..e3113ea Binary files /dev/null and b/legacy/dotfiles/home-manager/secrets/openrouter_api_key differ diff --git a/legacy/dotfiles/home-manager/secrets/steam-user-id b/legacy/dotfiles/home-manager/secrets/steam-user-id new file mode 100644 index 0000000..deeb799 Binary files /dev/null and b/legacy/dotfiles/home-manager/secrets/steam-user-id differ diff --git a/legacy/dotfiles/home-manager/util/blur.nix b/legacy/dotfiles/home-manager/util/blur.nix new file mode 100644 index 0000000..79917d6 --- /dev/null +++ b/legacy/dotfiles/home-manager/util/blur.nix @@ -0,0 +1,25 @@ +{ + stdenv, + imagemagick, + src, +}: +stdenv.mkDerivation { + pname = "blur-image"; + version = "1.0"; + + inherit src; + + buildInputs = [ imagemagick ]; + + # input is a file, not a directory, skip unpackPhase + unpackPhase = "true"; + + # command taken from: https://old.reddit.com/r/swaywm/comments/oz3t7v/setting_a_blurred_background_with_swaylock_and/ + buildPhase = '' + magick ${src} -filter Gaussian -resize 20% -blur 0x2.5 -resize 500% output.png + ''; + + installPhase = '' + mv output.png $out + ''; +} diff --git a/legacy/dotfiles/home-manager/util/inverse_color.nix b/legacy/dotfiles/home-manager/util/inverse_color.nix new file mode 100644 index 0000000..709bf9b --- /dev/null +++ b/legacy/dotfiles/home-manager/util/inverse_color.nix @@ -0,0 +1,26 @@ +{ + stdenv, + imagemagick, + gawk, + src, +}: +stdenv.mkDerivation { + pname = "invert-image-avg"; + version = "1.0"; + + inherit src; + + buildInputs = [ + imagemagick + gawk + ]; + + # input is a file, not a directory, skip unpackPhase + unpackPhase = "true"; + + # command taken from: https://old.reddit.com/r/swaywm/comments/oz3t7v/setting_a_blurred_background_with_swaylock_and/ + buildPhase = '' + rm -fr $out + magick ${src} -channel RGB -negate -resize 1x1 txt: | awk 'FNR == 2 {print $3}' > $out + ''; +} diff --git a/legacy/dotfiles/home-manager/wallpaper.png b/legacy/dotfiles/home-manager/wallpaper.png new file mode 100644 index 0000000..6806bd7 Binary files /dev/null and b/legacy/dotfiles/home-manager/wallpaper.png differ diff --git a/legacy/dotfiles/system/common.nix b/legacy/dotfiles/system/common.nix new file mode 100644 index 0000000..a056908 --- /dev/null +++ b/legacy/dotfiles/system/common.nix @@ -0,0 +1,498 @@ +{ + config, + options, + pkgs, + lib, + username, + system, + hostname, + inputs, + niri-package, + ... +}: +{ + imports = [ + ./vm.nix + ./steam.nix + ./networking.nix + + inputs.disko.nixosModules.disko + inputs.lanzaboote.nixosModules.lanzaboote + + inputs.nixos-hardware.nixosModules.common-cpu-amd-pstate + inputs.nixos-hardware.nixosModules.common-cpu-amd-zenpower + inputs.nixos-hardware.nixosModules.common-pc-ssd + ]; + + # allow overclocking (I actually underclock but lol) + hardware.amdgpu.overdrive.ppfeaturemask = "0xFFFFFFFF"; + + hardware.enableRedistributableFirmware = true; + hardware.cpu.amd.updateMicrocode = true; + + services.kmscon.enable = true; + + # Add niri to display manager session packages + services.displayManager.sessionPackages = [ niri-package ]; + + programs = { + gamescope = { + enable = true; + capSysNice = true; + }; + steam = { + enable = true; + gamescopeSession.enable = true; + }; + }; + + system.activationScripts = { + # FIX: https://github.com/NixOS/nix/issues/2982 + "profile-channel-dummy".text = '' + #!/bin/sh + mkdir -p /nix/var/nix/profiles/per-user/root/channels + ''; + + # extract all my secureboot keys + # TODO! proper secrets management + "secureboot-keys".text = '' + #!/usr/bin/env sh + rm -fr ${config.boot.lanzaboote.pkiBundle} || true + mkdir -p ${config.boot.lanzaboote.pkiBundle} + ${lib.getExe pkgs.gnutar} xf ${./secrets/secureboot.tar} -C ${config.boot.lanzaboote.pkiBundle} + chown -R root:wheel ${config.boot.lanzaboote.pkiBundle} + chmod -R 500 ${config.boot.lanzaboote.pkiBundle} + ''; + }; + + swapDevices = [ ]; + + nix = { + # optimize the store + optimise.automatic = true; + + # auto garbage collect old generations + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; + + settings = { + # enable flakes! + experimental-features = [ + "nix-command" + "flakes" + ]; + + # Use muffin server as a binary cache + substituters = [ "https://nix-cache.sigkill.computer" ]; + trusted-public-keys = [ + "nix-cache.sigkill.computer-1:ONtQC9gUjL+2yNgMWB68NudPySXhyzJ7I3ra56/NPgk=" + ]; + netrc-file = "${./secrets/nix-cache-netrc}"; + }; + }; + + # cachyos kernel overlay + nixpkgs.overlays = [ inputs.nix-cachyos-kernel.overlays.default ]; + + # kernel options + boot = { + + # cachyos kernel: bore scheduler, full lto, x86_64-v3 (common to zen 3 + zen 5) + kernelPackages = + let + helpers = pkgs.callPackage "${inputs.nix-cachyos-kernel}/helpers.nix" { }; + kernel = pkgs.cachyosKernels.linux-cachyos-bore-lto.override { + lto = "full"; + processorOpt = "x86_64-v3"; + }; + in + helpers.kernelModuleLLVMOverride (pkgs.linuxKernel.packagesFor kernel); + + # disable legacy subsystems neither host will ever use + kernelPatches = [ + { + name = "disable-legacy-subsystems"; + patch = null; + structuredExtraConfig = with lib.kernel; { + # ancient bus/card standards + PCMCIA = lib.mkForce no; + PCCARD = lib.mkForce no; + PARPORT = lib.mkForce no; + GAMEPORT = lib.mkForce module; + FIREWIRE = lib.mkForce no; + AGP = lib.mkForce no; + + # legacy networking + ATM = lib.mkForce no; + FDDI = lib.mkForce no; + ISDN = lib.mkForce no; + CAN = lib.mkForce no; + NFC = lib.mkForce no; + INFINIBAND = lib.mkForce no; + + # amateur radio (HAMRADIO is the umbrella but these are separate symbols) + HAMRADIO = lib.mkForce no; + AX25 = lib.mkForce no; + NETROM = lib.mkForce no; + ROSE = lib.mkForce no; + + # dead protocols + PHONET = lib.mkForce no; + IEEE802154 = lib.mkForce no; + "6LOWPAN" = lib.mkForce no; + NET_9P = lib.mkForce no; + BATMAN_ADV = lib.mkForce no; + + # tv tuners / digital video broadcasting + MEDIA_ANALOG_TV_SUPPORT = lib.mkForce no; + MEDIA_DIGITAL_TV_SUPPORT = lib.mkForce no; + DVB_CORE = lib.mkForce no; + + # hypervisor guest support (bare metal only) + HYPERV = lib.mkForce no; + XEN = lib.mkForce no; + VMWARE_VMCI = lib.mkForce no; + VMWARE_BALLOON = lib.mkForce no; + VMWARE_PVSCSI = lib.mkForce no; + VMWARE_VMCI_VSOCKETS = lib.mkForce no; + VMXNET3 = lib.mkForce no; + DRM_VMWGFX = lib.mkForce no; + VBOXGUEST = lib.mkForce no; + VBOXSF_FS = lib.mkForce no; + + # staging drivers (experimental/unmaintained) + STAGING = lib.mkForce no; + # SND_PCI stays — SND_HDA_INTEL (AMD HDA audio) lives under it + ACCESSIBILITY = lib.mkForce no; + MTD = lib.mkForce no; + MEDIA_RC_SUPPORT = lib.mkForce no; + + # legacy storage (AHCI for modern SATA is independent) + ATA_SFF = lib.mkForce no; + SCSI_LOWLEVEL = lib.mkForce no; + FUSION = lib.mkForce no; + + # misc legacy + MOST = lib.mkForce no; + PPDEV = lib.mkForce no; + PHANTOM = lib.mkForce no; + X86_ANDROID_TABLETS = lib.mkForce no; + # CHROME_PLATFORMS stays — Framework laptops use CrOS EC + SURFACE_PLATFORMS = lib.mkForce no; + MCTP = lib.mkForce no; + GPIB = lib.mkForce no; + SIOX = lib.mkForce no; + SLIMBUS = lib.mkForce no; + WWAN = lib.mkForce no; + + # nvidia gpu + DRM_NOUVEAU = lib.mkForce no; + + # other gpus not present + DRM_RADEON = lib.mkForce no; + DRM_GMA500 = lib.mkForce no; + DRM_AST = lib.mkForce no; + DRM_MGAG200 = lib.mkForce no; + DRM_HISI_HIBMC = lib.mkForce no; + DRM_APPLETBDRM = lib.mkForce no; + + # intel gpu + DRM_I915 = lib.mkForce no; + DRM_XE = lib.mkForce no; + + # intel cpu / platform + INTEL_IOMMU = lib.mkForce no; + INTEL_IDLE = lib.mkForce no; + INTEL_HFI_THERMAL = lib.mkForce no; + INTEL_TCC_COOLING = lib.mkForce no; + INTEL_SOC_DTS_THERMAL = lib.mkForce no; + INTEL_PCH_THERMAL = lib.mkForce no; + INTEL_POWERCLAMP = lib.mkForce no; + X86_PKG_TEMP_THERMAL = lib.mkForce no; + X86_INTEL_LPSS = lib.mkForce no; + INTEL_MEI = lib.mkForce no; + INTEL_TH = lib.mkForce no; + INTEL_VSEC = lib.mkForce no; + INTEL_IDXD = lib.mkForce no; + INTEL_IOATDMA = lib.mkForce no; + EDAC_E752X = lib.mkForce no; + EDAC_I82975X = lib.mkForce no; + EDAC_I3000 = lib.mkForce no; + EDAC_I3200 = lib.mkForce no; + EDAC_IE31200 = lib.mkForce no; + EDAC_X38 = lib.mkForce no; + EDAC_I5400 = lib.mkForce no; + EDAC_I7CORE = lib.mkForce no; + EDAC_I5100 = lib.mkForce no; + EDAC_I7300 = lib.mkForce no; + EDAC_SBRIDGE = lib.mkForce no; + EDAC_SKX = lib.mkForce no; + EDAC_I10NM = lib.mkForce no; + EDAC_IMH = lib.mkForce no; + EDAC_PND2 = lib.mkForce no; + EDAC_IGEN6 = lib.mkForce no; + + # intel audio + SND_SOC_SOF_INTEL_TOPLEVEL = lib.mkForce no; + SND_SOC_INTEL_SST_TOPLEVEL = lib.mkForce no; + + # mellanox networking + MLX4_CORE = lib.mkForce no; + MLX5_CORE = lib.mkForce no; + MLXSW_CORE = lib.mkForce no; + MLX_PLATFORM = lib.mkForce no; + + # fpga + FPGA = lib.mkForce no; + + # old x86 cpufreq / platform (both systems are modern Zen) + AMD_NUMA = lib.mkForce no; + X86_POWERNOW_K8 = lib.mkForce no; + X86_P4_CLOCKMOD = lib.mkForce no; + X86_SPEEDSTEP_LIB = lib.mkForce no; + + # cxl (datacenter memory expansion) + CXL_BUS = lib.mkForce no; + + # embedded SoC peripherals (not present on desktop/laptop) + INPUT_TOUCHSCREEN = lib.mkForce no; + INPUT_TABLET = lib.mkForce no; + INPUT_JOYSTICK = lib.mkForce no; + MEDIA_PLATFORM_DRIVERS = lib.mkForce no; + MEDIA_TEST_SUPPORT = lib.mkForce no; + + # deprecated userland compat + SGETMASK_SYSCALL = lib.mkForce no; + UID16 = lib.mkForce no; + X86_X32_ABI = lib.mkForce no; + }; + } + ]; + + # aes_generic is built-in as of linux 7.0, no longer a loadable module + initrd.luks.cryptoModules = lib.mkForce ( + lib.filter (m: m != "aes_generic") options.boot.initrd.luks.cryptoModules.default + ); + + # some default initrd modules (ata_piix etc) don't exist with ATA_SFF=n + initrd.allowMissingModules = true; + + lanzaboote = { + enable = true; + # TODO: proper secrets management so this is not stored in nix store + pkiBundle = "/var/lib/sbctl"; + }; + + # Bootloader. + loader = { + efi.canTouchEfiVariables = true; + + timeout = 1; + /* + Lanzaboote currently replaces the systemd-boot module. + This setting is usually set to true in configuration.nix + generated at installation time. So we force it to false + for now. + */ + systemd-boot.enable = lib.mkForce false; + systemd-boot.configurationLimit = 10; + }; + + initrd = { + systemd.enable = true; + compressor = "zstd"; + availableKernelModules = [ + "xhci_pci" + "thunderbolt" + "nvme" + "usbhid" + "amdgpu" + ]; + }; + + kernelModules = [ + "kvm-amd" + "ip_tables" + "iptable_nat" + "msr" + "btusb" + ]; + + kernelParams = [ + # 1gb huge pages + "hugepagesz=1G" + "hugepages=3" + + ]; + + }; + + environment.etc = { + # override default nixos /etc/issue + "issue".text = ""; + }; + + services = { + # fwupd for updating firmware + fwupd = { + enable = true; + extraRemotes = [ "lvfs-testing" ]; + }; + + # auto detect network printers + avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + + # Enable CUPS to print documents. + printing = { + enable = true; + drivers = with pkgs; [ hplip ]; + }; + + # I don't want fingerprint login + fprintd.enable = false; + + # Making sure mullvad works on boot + mullvad-vpn.enable = true; + + # power statistics + upower.enable = true; + + # power profiles for noctalia shell + power-profiles-daemon.enable = true; + + # geolocation (uses beacondb.net by default) + geoclue2 = { + enable = true; + appConfig.zen-twilight = { + isAllowed = true; + isSystem = false; + }; + }; + }; + + # EST + time.timeZone = "America/New_York"; + + security = { + # lets use doas and not sudo! + doas.enable = true; + sudo.enable = false; + # Configure doas + doas.extraRules = [ + { + users = [ username ]; + keepEnv = true; + persist = true; + } + ]; + }; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + # Enable Bluetooth + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + + # Enable experimental features for battery % of bluetooth devices + settings.General.Experimental = true; + }; + + # Apply gtk themes by enabling dconf + programs.dconf.enable = true; + + # Enable sound with pipewire. + services.pulseaudio.enable = false; # pipewire >>>>>>> pulseaudio + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # Define my user account (the rest of the configuration if found in `~/.config/home-manager/...`) + users.users.${username} = { + isNormalUser = true; + extraGroups = [ + "networkmanager" + "wheel" + "video" + "camera" + "adbusers" + ]; + # TODO! this is really bad :( I should really figure out how to do proper secrets management + hashedPasswordFile = "${./secrets/password-hash}"; + }; + + services.gvfs.enable = true; + programs.gphoto2.enable = true; + + # Enable thermal data + services.thermald.enable = true; + + services.pcscd.enable = true; + programs.gnupg.agent = { + enable = true; + pinentryPackage = pkgs.pinentry-curses; + enableSSHSupport = false; + }; + + # System packages + environment.systemPackages = with pkgs; [ + # mullvad-vpn is provided by services.mullvad-vpn.enable + + #secureboot ctl + sbctl + + dmidecode + + doas-sudo-shim + + glib + usbutils + libmtp + man-pages + man-pages-posix + + # needed for home-manager + git + + tmux + android-tools + ]; + + # wayland with electron/chromium applications + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + + # https://nixos.wiki/wiki/Fish#Setting_fish_as_your_shell + programs.fish.enable = true; + programs.bash = { + interactiveShellInit = '' + if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] + then + shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" + exec ${lib.getExe pkgs.fish} $LOGIN_OPTION + fi + ''; + }; + + # port 53317 for localsend + networking.firewall.allowedUDPPorts = [ 53317 ]; + networking.firewall.allowedTCPPorts = [ 53317 ]; + + system.stateVersion = "25.05"; + nixpkgs.hostPlatform = "x86_64-linux"; + + documentation.enable = true; + documentation.man.enable = true; + documentation.dev.enable = true; +} diff --git a/legacy/dotfiles/system/disk_mreow.nix b/legacy/dotfiles/system/disk_mreow.nix new file mode 100644 index 0000000..625a17a --- /dev/null +++ b/legacy/dotfiles/system/disk_mreow.nix @@ -0,0 +1,53 @@ +{ + config, + lib, + pkgs, + modulesPath, + ... +}: +{ + disko.devices = { + disk = { + main = { + type = "disk"; + device = "/dev/disk/by-path/pci-0000:01:00.0-nvme-1"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; + }; + luks = { + size = "100%"; + content = { + type = "luks"; + name = "crypted"; + passwordFile = "${./secrets/disk-password}"; + content = { + type = "filesystem"; + format = "f2fs"; + mountpoint = "/"; + extraArgs = [ + "-O" + "extra_attr,inode_checksum,sb_checksum,compression" + ]; + mountOptions = [ + "compress_algorithm=zstd:6,compress_chksum,atgc,gc_merge,lazytime,nodiscard" + ]; + }; + }; + }; + }; + }; + }; + }; + }; + +} diff --git a/legacy/dotfiles/system/disk_yarn.nix b/legacy/dotfiles/system/disk_yarn.nix new file mode 100644 index 0000000..4c091c1 --- /dev/null +++ b/legacy/dotfiles/system/disk_yarn.nix @@ -0,0 +1,52 @@ +{ + disko.devices = { + disk = { + main = { + type = "disk"; + content = { + type = "gpt"; + partitions = { + ESP = { + type = "EF00"; + size = "500M"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + persistent = { + size = "100%"; + content = { + type = "filesystem"; + format = "f2fs"; + mountpoint = "/persistent"; + }; + }; + nix = { + size = "200G"; + content = { + type = "filesystem"; + format = "f2fs"; + mountpoint = "/nix"; + }; + }; + }; + }; + }; + }; + nodev = { + "/" = { + fsType = "tmpfs"; + mountOptions = [ + "defaults" + "size=2G" + "mode=755" + ]; + }; + }; + }; + + fileSystems."/persistent".neededForBoot = true; + fileSystems."/nix".neededForBoot = true; +} diff --git a/legacy/dotfiles/system/impermanence.nix b/legacy/dotfiles/system/impermanence.nix new file mode 100644 index 0000000..b22eab9 --- /dev/null +++ b/legacy/dotfiles/system/impermanence.nix @@ -0,0 +1,38 @@ +{ + config, + lib, + username, + ... +}: +{ + environment.persistence."/persistent" = { + hideMounts = true; + directories = [ + "/var/log" + "/var/lib/systemd/coredump" + "/var/lib/nixos" + "/var/lib/systemd/timers" + ]; + + files = [ + "/etc/ssh/ssh_host_ed25519_key" + "/etc/ssh/ssh_host_ed25519_key.pub" + "/etc/ssh/ssh_host_rsa_key" + "/etc/ssh/ssh_host_rsa_key.pub" + "/etc/machine-id" + ]; + }; + + # Bind mount entire home directory from persistent storage + # (impermanence doesn't support "." so we do this directly) + fileSystems."/home/${username}" = { + device = "/persistent/home/${username}"; + fsType = "none"; + options = [ "bind" ]; + neededForBoot = true; + }; + + systemd.tmpfiles.rules = [ + "d /etc 755 root" + ]; +} diff --git a/legacy/dotfiles/system/networking.nix b/legacy/dotfiles/system/networking.nix new file mode 100644 index 0000000..23a6496 --- /dev/null +++ b/legacy/dotfiles/system/networking.nix @@ -0,0 +1,26 @@ +{ hostname, ... }: +{ + # speed up boot times (by about three seconds) + systemd.services.NetworkManager-wait-online.enable = false; + + networking = { + hostName = hostname; + + networkmanager = { + enable = true; + + appendNameservers = [ + "1.1.1.1" + "9.9.9.9" + ]; + + wifi = { + scanRandMacAddress = true; + # fix suspend issue + # powersave = false; + }; + + ensureProfiles.profiles = import ./secrets/wifi-passwords.nix; + }; + }; +} diff --git a/legacy/dotfiles/system/no-rgb.nix b/legacy/dotfiles/system/no-rgb.nix new file mode 100644 index 0000000..5f876ca --- /dev/null +++ b/legacy/dotfiles/system/no-rgb.nix @@ -0,0 +1,43 @@ +{ pkgs, lib, ... }: +{ + systemd.services.no-rgb = + let + no-rgb = ( + pkgs.writeShellApplication { + name = "no-rgb"; + runtimeInputs = with pkgs; [ + openrgb + coreutils + gnugrep + ]; + + text = '' + #!/bin/sh + set -e + + NUM_DEVICES=$(openrgb --noautoconnect --list-devices | grep -cE '^[0-9]+: ') + + for i in $(seq 0 $((NUM_DEVICES - 1))); do + openrgb --noautoconnect --device "$i" --mode direct --color 000000 + done + ''; + } + ); + in + { + description = "disable rgb"; + serviceConfig = { + ExecStart = "${lib.getExe no-rgb}"; + Type = "oneshot"; + }; + wantedBy = [ "multi-user.target" ]; + }; + + services.hardware.openrgb.enable = true; + services.udev.packages = [ pkgs.openrgb ]; + hardware.i2c.enable = true; + + environment.systemPackages = with pkgs; [ + openrgb-with-all-plugins + ]; +} diff --git a/legacy/dotfiles/system/secrets/disk-password b/legacy/dotfiles/system/secrets/disk-password new file mode 100644 index 0000000..3ccd08d Binary files /dev/null and b/legacy/dotfiles/system/secrets/disk-password differ diff --git a/legacy/dotfiles/system/secrets/nix-cache-netrc b/legacy/dotfiles/system/secrets/nix-cache-netrc new file mode 100644 index 0000000..cee0ea5 Binary files /dev/null and b/legacy/dotfiles/system/secrets/nix-cache-netrc differ diff --git a/legacy/dotfiles/system/secrets/password-hash b/legacy/dotfiles/system/secrets/password-hash new file mode 100644 index 0000000..ba58675 Binary files /dev/null and b/legacy/dotfiles/system/secrets/password-hash differ diff --git a/legacy/dotfiles/system/secrets/secureboot.tar b/legacy/dotfiles/system/secrets/secureboot.tar new file mode 100644 index 0000000..023a0a5 Binary files /dev/null and b/legacy/dotfiles/system/secrets/secureboot.tar differ diff --git a/legacy/dotfiles/system/secrets/wifi-passwords.nix b/legacy/dotfiles/system/secrets/wifi-passwords.nix new file mode 100644 index 0000000..98677a3 Binary files /dev/null and b/legacy/dotfiles/system/secrets/wifi-passwords.nix differ diff --git a/legacy/dotfiles/system/steam.nix b/legacy/dotfiles/system/steam.nix new file mode 100644 index 0000000..2a893c9 --- /dev/null +++ b/legacy/dotfiles/system/steam.nix @@ -0,0 +1,28 @@ +{ + pkgs, + config, + lib, + ... +}: +{ + nixpkgs.config.allowUnfreePredicate = + pkg: + builtins.elem (lib.getName pkg) [ + "steam" + "steam-original" + "steam-unwrapped" + "steam-run" + ]; + + programs.steam = { + enable = true; + extraCompatPackages = with pkgs; [ proton-ge-bin ]; + }; + + environment.systemPackages = with pkgs; [ + steamtinkerlaunch + mangohud + goverlay + yad + ]; +} diff --git a/legacy/dotfiles/system/system-mreow.nix b/legacy/dotfiles/system/system-mreow.nix new file mode 100644 index 0000000..16d7902 --- /dev/null +++ b/legacy/dotfiles/system/system-mreow.nix @@ -0,0 +1,60 @@ +{ + config, + pkgs, + lib, + username, + inputs, + ... +}: +{ + imports = [ + ./common.nix + ./disk_mreow.nix + + inputs.nixos-hardware.nixosModules.framework-amd-ai-300-series + ]; + + hardware.framework.laptop13.audioEnhancement.rawDeviceName = + lib.mkDefault "alsa_output.pci-0000_c1_00.6.analog-stereo"; + + # PST + # time.timeZone = lib.mkForce "America/Los_Angeles"; + + # weird hack to get swaylock working? idk, if you don't put this here, password entry doesnt work + # if I move to another lock screen program, i will have to replace `swaylock` + security.pam.services.swaylock = { }; + + # Kernel-level power tuning. These are boot-time / module-load-time settings + # that power-profiles-daemon (in common.nix) does not manage. ppd handles + # governor and EPP at runtime; these cover everything else. + boot.kernelParams = [ + # Disable NMI watchdog. Eliminates periodic perf-counter interrupts + # across all cores (~1 W). Kernel softlockup watchdog remains active. + "nmi_watchdog=0" + + # Route kernel work items to already-busy CPUs rather than waking idle + # ones. Reduces C-state exit frequency -- significant on battery where + # cores idle often. + "workqueue.power_efficient=1" + ]; + + boot.kernel.sysctl."kernel.nmi_watchdog" = 0; + + # Power-gate the HDA codec between audio activity. 1-second inactivity + # timeout; controller powers down fully. Wakes transparently on next + # audio event -- no audible artifacts on Framework 13 AMD. + boot.extraModprobeConfig = '' + options snd_hda_intel power_save=1 power_save_controller=Y + ''; + + # Greetd display manager + services.greetd = { + enable = true; + settings = { + default_session = { + command = "${lib.getExe pkgs.tuigreet} --time"; + user = username; + }; + }; + }; +} diff --git a/legacy/dotfiles/system/system-yarn.nix b/legacy/dotfiles/system/system-yarn.nix new file mode 100644 index 0000000..3698c01 --- /dev/null +++ b/legacy/dotfiles/system/system-yarn.nix @@ -0,0 +1,276 @@ +{ + config, + pkgs, + lib, + username, + inputs, + ... +}: +{ + imports = [ + ./disk_yarn.nix + ./common.nix + ./impermanence.nix + ./no-rgb.nix + ./vr.nix + + inputs.impermanence.nixosModules.impermanence + inputs.jovian-nixos.nixosModules.default + ]; + + fileSystems."/media/games" = { + device = "/dev/disk/by-uuid/1878136e-765d-4784-b204-3536ab4fdac8"; + fsType = "f2fs"; + options = [ "nofail" ]; + }; + + systemd.targets = { + sleep.enable = false; + suspend.enable = false; + hibernate.enable = false; + hybrid-sleep.enable = false; + }; + + networking.hostId = "abf570f9"; + + # Static IP for consistent SSH access + networking.networkmanager.ensureProfiles.profiles.enp7s0-static = { + connection = { + id = "enp7s0-static"; + type = "ethernet"; + interface-name = "enp7s0"; + autoconnect = true; + }; + ipv4 = { + method = "manual"; + address1 = "192.168.1.223/24,192.168.1.1"; + dns = "1.1.1.1;9.9.9.9;"; + }; + ipv6.method = "disabled"; + }; + + services.openssh = { + enable = true; + ports = [ 22 ]; + settings = { + PasswordAuthentication = false; + PermitRootLogin = "yes"; + }; + }; + + users.users.${username}.openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4jL6gYOunUlUtPvGdML0cpbKSsPNqQ1jit4E7U1RyH" # laptop + ]; + + users.users.root.openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4jL6gYOunUlUtPvGdML0cpbKSsPNqQ1jit4E7U1RyH" # laptop + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC5ZYN6idL/w/mUIfPOH1i+Q/SQXuzAMQUEuWpipx1Pc ci-deploy@muffin" + ]; + + programs.steam = { + remotePlay.openFirewall = true; + localNetworkGameTransfers.openFirewall = true; + }; + + # LACT (Linux AMDGPU Configuration Tool): https://github.com/ilya-zlobintsev/LACT + environment.systemPackages = with pkgs; [ + lact + jovian-stubs + ]; + systemd.packages = with pkgs; [ lact ]; + systemd.services.lactd.wantedBy = [ "multi-user.target" ]; + + systemd.services.lactd.serviceConfig.ExecStartPre = "${lib.getExe pkgs.bash} -c \"sleep 3s\""; + + # root-level service that applies a pending update. Triggered by + # steamos-update (via systemctl start) when the user accepts an update. + # Runs as root so it can write the system profile and boot entry. + systemd.services.pull-update-apply = { + description = "Apply pending NixOS update pulled from binary cache"; + serviceConfig = { + Type = "oneshot"; + ExecStart = pkgs.writeShellScript "pull-update-apply" '' + set -uo pipefail + export PATH=${ + pkgs.lib.makeBinPath [ + pkgs.curl + pkgs.coreutils + pkgs.nix + ] + } + STORE_PATH=$(curl -sf --max-time 30 "https://nix-cache.sigkill.computer/deploy/yarn" || true) + if [ -z "$STORE_PATH" ]; then + echo "server unreachable" + exit 1 + fi + echo "applying $STORE_PATH" + nix-store -r "$STORE_PATH" || { echo "fetch failed"; exit 1; } + nix-env -p /nix/var/nix/profiles/system --set "$STORE_PATH" || { echo "profile set failed"; exit 1; } + "$STORE_PATH/bin/switch-to-configuration" boot || { echo "boot entry failed"; exit 1; } + echo "update applied; reboot required" + ''; + }; + }; + + # Allow primary user to start pull-update-apply.service without a password + security.polkit.extraConfig = '' + polkit.addRule(function(action, subject) { + if (action.id == "org.freedesktop.systemd1.manage-units" && + action.lookup("unit") == "pull-update-apply.service" && + subject.user == "${username}") { + return polkit.Result.YES; + } + }); + ''; + + nixpkgs.config.allowUnfreePredicate = + pkg: + builtins.elem (lib.getName pkg) [ + "steamdeck-hw-theme" + "steam-jupiter-unwrapped" + "steam" + "steam-original" + "steam-unwrapped" + "steam-run" + ]; + + # Override jovian-stubs to disable steamos-update kernel check + # This prevents Steam from requesting reboots for "system updates" + # Steam client updates will still work normally + nixpkgs.overlays = [ + ( + final: prev: + let + deploy-url = "https://nix-cache.sigkill.computer/deploy/yarn"; + + steamos-update-script = final.writeShellScript "steamos-update" '' + export PATH=${ + final.lib.makeBinPath [ + final.curl + final.coreutils + final.systemd + ] + } + + STORE_PATH=$(curl -sf --max-time 30 "${deploy-url}" || true) + + if [ -z "$STORE_PATH" ]; then + >&2 echo "[steamos-update] server unreachable" + exit 7 + fi + + CURRENT=$(readlink -f /nix/var/nix/profiles/system) + if [ "$CURRENT" = "$STORE_PATH" ]; then + >&2 echo "[steamos-update] no update available" + exit 0 + fi + + # check-only mode: just report that an update exists + if [ "''${1:-}" = "check" ] || [ "''${1:-}" = "--check-only" ]; then + >&2 echo "[steamos-update] update available" + exit 0 + fi + + # apply: trigger the root-running systemd service to install the update + >&2 echo "[steamos-update] applying update..." + if systemctl start --wait pull-update-apply.service; then + >&2 echo "[steamos-update] update installed, reboot to apply" + exit 0 + else + >&2 echo "[steamos-update] apply failed; see 'journalctl -u pull-update-apply'" + exit 1 + fi + ''; + in + { + jovian-stubs = prev.stdenv.mkDerivation { + name = "jovian-stubs"; + dontUnpack = true; + installPhase = '' + mkdir -p $out/bin + ln -s ${steamos-update-script} $out/bin/steamos-update + ln -s ${steamos-update-script} $out/bin/steamos-mandatory-update + + # jupiter-initial-firmware-update: no-op (not a real steam deck) + cat > $out/bin/jupiter-initial-firmware-update << 'STUB' + #!/bin/sh + exit 0 + STUB + + # jupiter-biosupdate: no-op (not a real steam deck) + cat > $out/bin/jupiter-biosupdate << 'STUB' + #!/bin/sh + exit 0 + STUB + + # steamos-reboot: reboot the system + cat > $out/bin/steamos-reboot << 'STUB' + #!/bin/sh + >&2 echo "[JOVIAN] $0: stub called with: $*" + systemctl reboot + STUB + + # steamos-select-branch: no-op stub + cat > $out/bin/steamos-select-branch << 'STUB' + #!/bin/sh + >&2 echo "[JOVIAN] $0: stub called with: $*" + exit 0 + STUB + + # steamos-factory-reset-config: no-op stub + cat > $out/bin/steamos-factory-reset-config << 'STUB' + #!/bin/sh + >&2 echo "[JOVIAN] $0: stub called with: $*" + exit 0 + STUB + + # steamos-firmware-update: no-op stub + cat > $out/bin/steamos-firmware-update << 'STUB' + #!/bin/sh + >&2 echo "[JOVIAN] $0: stub called with: $*" + exit 0 + STUB + + # pkexec: pass through to real pkexec + cat > $out/bin/pkexec << 'STUB' + #!/bin/sh + exec /run/wrappers/bin/pkexec "$@" + STUB + + # sudo: strip flags and run the command directly (no escalation). + # privileged ops are delegated to root systemd services via systemctl. + cat > $out/bin/sudo << 'STUB' + #!/bin/sh + while [ $# -gt 0 ]; do + case "$1" in + -*) shift ;; + *) break ;; + esac + done + exec "$@" + STUB + + find $out/bin -type f -exec chmod 755 {} + + ''; + }; + } + ) + ]; + + jovian = { + devices.steamdeck.enable = false; + steam = { + enable = true; + autoStart = true; + desktopSession = "niri"; + user = username; + }; + }; + + # Jovian-NixOS requires sddm + # https://github.com/Jovian-Experiments/Jovian-NixOS/commit/52f140c07493f8bb6cd0773c7e1afe3e1fd1d1fa + services.displayManager.sddm.wayland.enable = true; + + # Disable gamescope from common.nix to avoid conflict with jovian-nixos + programs.gamescope.enable = lib.mkForce false; +} diff --git a/legacy/dotfiles/system/vm.nix b/legacy/dotfiles/system/vm.nix new file mode 100644 index 0000000..6d0b294 --- /dev/null +++ b/legacy/dotfiles/system/vm.nix @@ -0,0 +1,39 @@ +{ + pkgs, + username, + lib, + ... +}: +{ + # android virtualization + virtualisation.waydroid = { + enable = true; + + # https://github.com/NixOS/nixpkgs/pull/466473 + package = pkgs.waydroid-nftables; + }; + + programs.virt-manager.enable = true; + + users.groups.libvirtd.members = [ username ]; + + virtualisation.libvirtd = { + enable = true; + + package = pkgs.libvirt; + }; + + virtualisation.spiceUSBRedirection.enable = true; + + users.users."${username}".extraGroups = [ "libvirtd" ]; + + # boot.kernelPatches = [ + # { + # name = "undetected-kvm"; + # patch = pkgs.fetchurl { + # url = "https://raw.githubusercontent.com/Scrut1ny/Hypervisor-Phantom/d09d66813570704e2b05440f290d6f9bdf2d26c7/Hypervisor-Phantom/patches/Kernel/linux-6.13-svm.patch"; + # sha256 = "zz18xerutulLGzlHhnu26WCY8rVQXApyeoDtCjbejIk="; + # }; + # } + # ]; +} diff --git a/legacy/dotfiles/system/vr.nix b/legacy/dotfiles/system/vr.nix new file mode 100644 index 0000000..7bd713f --- /dev/null +++ b/legacy/dotfiles/system/vr.nix @@ -0,0 +1,45 @@ +{ + pkgs, + inputs, + lib, + ... +}: +{ + + # for FO4 VR: + # doesn't work. it's like the wivrn stuff doesn't transfer past MO2 + # `echo "PRESSURE_VESSEL_FILESYSTEMS_RW=$XDG_RUNTIME_DIR/wivrn/comp_ipc %command%" | sed -r "s/proton waitforexitandrun .*/proton waitforexitandrun \/media\/games\/fallout4vr_essentials_overhaul\/ModOrganizer.exe \"moshortcut:\/\/:Play Fallout Essentials\" /" | sh` + + services.wivrn = { + enable = true; + openFirewall = true; + + # Executing it through the systemd service executes WiVRn w/ CAP_SYS_NICE + # Resulting in no stutters! + autoStart = true; + + # Config for WiVRn + config = { + enable = true; + json = { + # 1.0x display scaling + scale = 1.0; + # 100 Mb/s + bitrate = 100000000; + encoders = [ + { + encoder = "vaapi"; + codec = "h265"; + # 1.0 x 1.0 scaling + width = 1.0; + height = 1.0; + offset_x = 0.0; + offset_y = 0.0; + } + ]; + + application = [ pkgs.wayvr ]; + }; + }; + }; +}