From 14efa80cab3d928edf07be3d365eeb7f4cdd8fb1 Mon Sep 17 00:00:00 2001 From: Bryan Ramos Date: Sat, 14 Mar 2026 15:26:18 -0400 Subject: [PATCH] refactor: reorganize flake structure and consolidate user config Directory structure: - Move from src/ to root level (system/, user/) - Remove unused machines (workstation, vm, laptop) User configuration: - Add user/home.nix for shared defaults (pass, essentials, default modules) - Centralize user options in user/default.nix - Move submodules to consistent paths (bash/bash, git/git, neovim/nvim, vim/vim) Module reorganization: - Flatten nested module structures (remove /modules/ subdirs) - Split CLI vs GUI tools (dev/ for CLI, gui/dev/ for GUI) - Move neovim/vim to top-level modules (not under utils/) - Remove security.enable - pass now in user/home.nix - Remove utils.enable - essentials now in user/home.nix - Add security/yubikey module with yubikey-manager, age-plugin-yubikey - Move pcb, design to gui/dev/ - Replace penpot docker wrapper with nixpkgs penpot-desktop - Remove i3 config - Remove deprecated wsl.nativeSystemd option GUI improvements: - Browser-focused mimeApps in gui/default.nix - Each WM handles its own auto-start via profileExtra Cleanup: - Update README with new structure - Update justfile paths and valid systems - Fix submodule paths in .gitmodules --- .gitmodules | 8 +- README.md | 191 ++++++++---------- flake.lock | 6 +- flake.nix | 60 ++---- justfile | 8 +- src/system/config/default.nix | 14 -- src/system/config/keys/desktop/README.md | 3 - src/system/machines/desktop/default.nix | 11 - .../desktop/modules/home-manager/home.nix | 72 ------- src/system/machines/laptop/default.nix | 1 - src/system/machines/server/default.nix | 10 - .../machines/server/modules/default.nix | 5 - .../server/modules/home-manager/default.nix | 33 --- src/system/machines/vm/default.nix | 10 - src/system/machines/vm/hardware.nix | 14 -- src/system/machines/vm/modules/default.nix | 5 - .../machines/vm/modules/disko/default.nix | 49 ----- .../vm/modules/home-manager/default.nix | 32 --- src/system/machines/vm/system.nix | 96 --------- src/system/machines/workstation/default.nix | 10 - src/system/machines/workstation/hardware.nix | 101 --------- .../workstation/modules/disko/default.nix | 58 ------ .../workstation/modules/home-manager/home.nix | 52 ----- src/system/machines/workstation/system.nix | 131 ------------ src/system/machines/wsl/default.nix | 9 - .../wsl/modules/home-manager/default.nix | 9 - .../wsl/modules/home-manager/home.nix | 38 ---- src/user/config/bash | 1 - src/user/config/git | 1 - src/user/config/nvim | 1 - src/user/config/vim | 1 - src/user/modules/bash/config/bash | 1 - src/user/modules/bash/config/shellHook.nix | 38 ---- src/user/modules/gui/wm/i3/default.nix | 144 ------------- .../gui/wm/shared/mimeapps/default.nix | 32 --- .../wm/sway/config/rofi/config/config.rasi | 7 - .../config/rofi/config/material-ocean.rasi | 95 --------- .../gui/wm/sway/config/rofi/default.nix | 183 ----------------- src/user/modules/security/default.nix | 23 --- src/user/modules/utils/default.nix | 21 -- .../utils/modules/dev/config/penpot.nix | 31 --- src/user/modules/utils/modules/vim/vim | 1 - system.configs | 1 - {src/user/config => system}/keys/default.nix | 22 +- .../keys/desktop/ssh.pub.key | 0 .../machines/desktop/README.md | 0 system/machines/desktop/default.nix | 14 ++ .../machines/desktop/hardware.nix | 0 .../desktop/modules/disko/default.nix | 0 .../desktop/modules/home-manager/default.nix | 0 .../desktop/modules/home-manager/home.nix | 54 +++++ .../machines/desktop/system.nix | 0 .../machines/server/README.md | 0 system/machines/server/default.nix | 14 ++ .../machines/server/hardware.nix | 5 +- .../server}/modules/backup/default.nix | 0 .../modules/bitcoin/config/bitcoin.conf | 0 .../server}/modules/bitcoin/default.nix | 0 .../modules/clightning/config/lightning.conf | 0 .../bitcoin/modules/clightning/default.nix | 0 .../modules/clightning/plugins/clnrest.nix | 0 .../modules/electrum/config/config.toml | 0 .../bitcoin/modules/electrum/default.nix | 0 .../machines/server}/modules/default.nix | 6 +- .../machines/server/modules/disko/default.nix | 0 .../server}/modules/forgejo/default.nix | 0 .../server}/modules/frigate/README.md | 0 .../server}/modules/frigate/default.nix | 9 +- .../server/modules/home-manager/default.nix | 23 +++ .../server}/modules/immich/default.nix | 0 .../server}/modules/nginx/default.nix | 0 .../machines/server}/modules/tor/default.nix | 0 .../server/modules/webdav/default.nix | 69 +++++++ .../machines/server/system.nix | 3 +- system/machines/wsl/default.nix | 13 ++ .../wsl}/modules/home-manager/default.nix | 0 .../wsl/modules/home-manager/home.nix | 24 +++ .../machines/wsl/modules/wsl/default.nix | 0 .../machines/wsl/modules/wsl/wsl.nix | 3 +- .../system => system}/machines/wsl/system.nix | 0 user.configs | 1 - .../config => user}/bookmarks/default.nix | 0 {src/user/config => user}/default.nix | 6 +- user/home.nix | 38 ++++ {src/user/config => user}/keys/age/README.md | 0 .../config => user}/keys/age/yubikey.pub.key | 0 {src/system/config => user}/keys/default.nix | 0 {src/user/config => user}/keys/pgp/README.md | 0 .../config => user}/keys/pgp/ccur.pub.key | 0 .../config => user}/keys/pgp/work.pub.key | 0 .../config => user}/keys/pgp/yubikey.pub.key | 0 {src/user/config => user}/keys/ssh/README.md | 0 .../config => user}/keys/ssh/graphone.pub.key | 0 .../config => user}/keys/ssh/work.pub.key | 0 .../config => user}/keys/ssh/yubikey.pub.key | 0 user/modules/bash/bash | 1 + {src/user => user}/modules/bash/default.nix | 6 +- {src/user => user/modules}/default.nix | 9 +- {src/user => user}/modules/git/default.nix | 0 {src/user => user}/modules/git/git | 0 .../user => user}/modules/git/scripts/cdg.nix | 0 .../gui}/alacritty/config/alacritty.nix | 0 .../modules/gui}/alacritty/default.nix | 0 .../gui}/browsers/chromium/default.nix | 0 .../modules/gui}/browsers/firefox/default.nix | 0 .../modules/gui}/corn/default.nix | 0 user/modules/gui/default.nix | 30 +++ user/modules/gui/dev/design/default.nix | 14 ++ .../modules/gui/dev}/pcb/default.nix | 4 +- .../gui}/fun/config/discord.config.json | 0 .../modules/gui}/fun/default.nix | 0 .../modules/gui}/utils/default.nix | 0 .../hyprland/config/rofi/config/config.rasi | 0 .../config/rofi/config/material-ocean.rasi | 0 .../gui/wm/hyprland/config/rofi/default.nix | 0 .../gui/wm/hyprland/config/waybar/config | 0 .../hyprland/config/waybar/scripts/getBlock | Bin .../hyprland/config/waybar/scripts/getPrice | 0 .../hyprland/config/waybar/scripts/weather.sh | 0 .../gui/wm/hyprland/config/waybar/style.css | 0 .../modules/gui/wm/hyprland/default.nix | 23 ++- .../wm/sway}/config/rofi/config/config.rasi | 0 .../config/rofi/config/material-ocean.rasi | 0 .../gui/wm/sway}/config/rofi/default.nix | 0 .../modules/gui/wm/sway/default.nix | 7 + .../utils => user}/modules/neovim/.luarc.json | 0 .../utils => user}/modules/neovim/default.nix | 8 +- .../config => user/modules/neovim}/nvim | 0 .../config => user/modules/neovim}/pkgs.nix | 2 +- .../modules/security}/gpg/default.nix | 2 +- user/modules/security/yubikey/default.nix | 16 ++ .../modules/tmux/config/tmux.nix | 0 {src/user => user}/modules/tmux/default.nix | 7 + .../modules/utils}/dev/default.nix | 6 + .../modules/utils}/email/config/aerc.conf | 0 .../modules/utils}/email/config/binds.conf | 0 .../modules/utils}/email/default.nix | 0 .../modules/utils}/irc/default.nix | 0 .../modules/utils}/writing/default.nix | 5 +- .../utils => user}/modules/vim/default.nix | 4 +- user/modules/vim/vim | 1 + 141 files changed, 505 insertions(+), 1561 deletions(-) delete mode 100644 src/system/config/default.nix delete mode 100644 src/system/config/keys/desktop/README.md delete mode 100644 src/system/machines/desktop/default.nix delete mode 100644 src/system/machines/desktop/modules/home-manager/home.nix delete mode 100644 src/system/machines/laptop/default.nix delete mode 100644 src/system/machines/server/default.nix delete mode 100644 src/system/machines/server/modules/default.nix delete mode 100644 src/system/machines/server/modules/home-manager/default.nix delete mode 100644 src/system/machines/vm/default.nix delete mode 100644 src/system/machines/vm/hardware.nix delete mode 100644 src/system/machines/vm/modules/default.nix delete mode 100644 src/system/machines/vm/modules/disko/default.nix delete mode 100644 src/system/machines/vm/modules/home-manager/default.nix delete mode 100644 src/system/machines/vm/system.nix delete mode 100644 src/system/machines/workstation/default.nix delete mode 100644 src/system/machines/workstation/hardware.nix delete mode 100644 src/system/machines/workstation/modules/disko/default.nix delete mode 100644 src/system/machines/workstation/modules/home-manager/home.nix delete mode 100644 src/system/machines/workstation/system.nix delete mode 100644 src/system/machines/wsl/default.nix delete mode 100644 src/system/machines/wsl/modules/home-manager/default.nix delete mode 100644 src/system/machines/wsl/modules/home-manager/home.nix delete mode 120000 src/user/config/bash delete mode 120000 src/user/config/git delete mode 120000 src/user/config/nvim delete mode 120000 src/user/config/vim delete mode 160000 src/user/modules/bash/config/bash delete mode 100644 src/user/modules/bash/config/shellHook.nix delete mode 100644 src/user/modules/gui/wm/i3/default.nix delete mode 100644 src/user/modules/gui/wm/shared/mimeapps/default.nix delete mode 100644 src/user/modules/gui/wm/sway/config/rofi/config/config.rasi delete mode 100644 src/user/modules/gui/wm/sway/config/rofi/config/material-ocean.rasi delete mode 100644 src/user/modules/gui/wm/sway/config/rofi/default.nix delete mode 100644 src/user/modules/security/default.nix delete mode 100644 src/user/modules/utils/default.nix delete mode 100644 src/user/modules/utils/modules/dev/config/penpot.nix delete mode 160000 src/user/modules/utils/modules/vim/vim delete mode 120000 system.configs rename {src/user/config => system}/keys/default.nix (70%) rename {src/system/config => system}/keys/desktop/ssh.pub.key (100%) rename {src/system => system}/machines/desktop/README.md (100%) create mode 100644 system/machines/desktop/default.nix rename {src/system => system}/machines/desktop/hardware.nix (100%) rename {src/system => system}/machines/desktop/modules/disko/default.nix (100%) rename {src/system => system}/machines/desktop/modules/home-manager/default.nix (100%) create mode 100644 system/machines/desktop/modules/home-manager/home.nix rename {src/system => system}/machines/desktop/system.nix (100%) rename {src/system => system}/machines/server/README.md (100%) create mode 100644 system/machines/server/default.nix rename {src/system => system}/machines/server/hardware.nix (87%) rename {src/system => system/machines/server}/modules/backup/default.nix (100%) rename {src/system => system/machines/server}/modules/bitcoin/config/bitcoin.conf (100%) rename {src/system => system/machines/server}/modules/bitcoin/default.nix (100%) rename {src/system => system/machines/server}/modules/bitcoin/modules/clightning/config/lightning.conf (100%) rename {src/system => system/machines/server}/modules/bitcoin/modules/clightning/default.nix (100%) rename {src/system => system/machines/server}/modules/bitcoin/modules/clightning/plugins/clnrest.nix (100%) rename {src/system => system/machines/server}/modules/bitcoin/modules/electrum/config/config.toml (100%) rename {src/system => system/machines/server}/modules/bitcoin/modules/electrum/default.nix (100%) rename {src/system => system/machines/server}/modules/default.nix (84%) rename {src/system => system}/machines/server/modules/disko/default.nix (100%) rename {src/system => system/machines/server}/modules/forgejo/default.nix (100%) rename {src/system => system/machines/server}/modules/frigate/README.md (100%) rename {src/system => system/machines/server}/modules/frigate/default.nix (93%) create mode 100644 system/machines/server/modules/home-manager/default.nix rename {src/system => system/machines/server}/modules/immich/default.nix (100%) rename {src/system => system/machines/server}/modules/nginx/default.nix (100%) rename {src/system => system/machines/server}/modules/tor/default.nix (100%) create mode 100644 system/machines/server/modules/webdav/default.nix rename {src/system => system}/machines/server/system.nix (98%) create mode 100644 system/machines/wsl/default.nix rename {src/system/machines/workstation => system/machines/wsl}/modules/home-manager/default.nix (100%) create mode 100644 system/machines/wsl/modules/home-manager/home.nix rename {src/system => system}/machines/wsl/modules/wsl/default.nix (100%) rename {src/system => system}/machines/wsl/modules/wsl/wsl.nix (83%) rename {src/system => system}/machines/wsl/system.nix (100%) delete mode 120000 user.configs rename {src/user/config => user}/bookmarks/default.nix (100%) rename {src/user/config => user}/default.nix (85%) create mode 100644 user/home.nix rename {src/user/config => user}/keys/age/README.md (100%) rename {src/user/config => user}/keys/age/yubikey.pub.key (100%) rename {src/system/config => user}/keys/default.nix (100%) rename {src/user/config => user}/keys/pgp/README.md (100%) rename {src/user/config => user}/keys/pgp/ccur.pub.key (100%) rename {src/user/config => user}/keys/pgp/work.pub.key (100%) rename {src/user/config => user}/keys/pgp/yubikey.pub.key (100%) rename {src/user/config => user}/keys/ssh/README.md (100%) rename {src/user/config => user}/keys/ssh/graphone.pub.key (100%) rename {src/user/config => user}/keys/ssh/work.pub.key (100%) rename {src/user/config => user}/keys/ssh/yubikey.pub.key (100%) create mode 160000 user/modules/bash/bash rename {src/user => user}/modules/bash/default.nix (83%) rename {src/user => user/modules}/default.nix (80%) rename {src/user => user}/modules/git/default.nix (100%) rename {src/user => user}/modules/git/git (100%) rename {src/user => user}/modules/git/scripts/cdg.nix (100%) rename {src/user/modules/gui/modules => user/modules/gui}/alacritty/config/alacritty.nix (100%) rename {src/user/modules/gui/modules => user/modules/gui}/alacritty/default.nix (100%) rename {src/user/modules/gui/modules => user/modules/gui}/browsers/chromium/default.nix (100%) rename {src/user/modules/gui/modules => user/modules/gui}/browsers/firefox/default.nix (100%) rename {src/user/modules/gui/modules => user/modules/gui}/corn/default.nix (100%) create mode 100644 user/modules/gui/default.nix create mode 100644 user/modules/gui/dev/design/default.nix rename {src/user/modules/utils/modules/dev/modules => user/modules/gui/dev}/pcb/default.nix (54%) rename {src/user/modules/gui/modules => user/modules/gui}/fun/config/discord.config.json (100%) rename {src/user/modules/gui/modules => user/modules/gui}/fun/default.nix (100%) rename {src/user/modules/gui/modules => user/modules/gui}/utils/default.nix (100%) rename {src/user => user}/modules/gui/wm/hyprland/config/rofi/config/config.rasi (100%) rename {src/user => user}/modules/gui/wm/hyprland/config/rofi/config/material-ocean.rasi (100%) rename {src/user => user}/modules/gui/wm/hyprland/config/rofi/default.nix (100%) rename {src/user => user}/modules/gui/wm/hyprland/config/waybar/config (100%) rename {src/user => user}/modules/gui/wm/hyprland/config/waybar/scripts/getBlock (100%) rename {src/user => user}/modules/gui/wm/hyprland/config/waybar/scripts/getPrice (100%) rename {src/user => user}/modules/gui/wm/hyprland/config/waybar/scripts/weather.sh (100%) rename {src/user => user}/modules/gui/wm/hyprland/config/waybar/style.css (100%) rename {src/user => user}/modules/gui/wm/hyprland/default.nix (93%) rename {src/user/modules/gui/wm/i3 => user/modules/gui/wm/sway}/config/rofi/config/config.rasi (100%) rename {src/user/modules/gui/wm/i3 => user/modules/gui/wm/sway}/config/rofi/config/material-ocean.rasi (100%) rename {src/user/modules/gui/wm/i3 => user/modules/gui/wm/sway}/config/rofi/default.nix (100%) rename {src/user => user}/modules/gui/wm/sway/default.nix (96%) rename {src/user/modules/utils => user}/modules/neovim/.luarc.json (100%) rename {src/user/modules/utils => user}/modules/neovim/default.nix (55%) rename {src/user/modules/utils/modules/neovim/config => user/modules/neovim}/nvim (100%) rename {src/user/modules/utils/modules/neovim/config => user/modules/neovim}/pkgs.nix (95%) rename {src/user/modules/security/modules => user/modules/security}/gpg/default.nix (97%) create mode 100644 user/modules/security/yubikey/default.nix rename {src/user => user}/modules/tmux/config/tmux.nix (100%) rename {src/user => user}/modules/tmux/default.nix (74%) rename {src/user/modules/utils/modules => user/modules/utils}/dev/default.nix (91%) rename {src/user/modules/utils/modules => user/modules/utils}/email/config/aerc.conf (100%) rename {src/user/modules/utils/modules => user/modules/utils}/email/config/binds.conf (100%) rename {src/user/modules/utils/modules => user/modules/utils}/email/default.nix (100%) rename {src/user/modules/utils/modules => user/modules/utils}/irc/default.nix (100%) rename {src/user/modules/gui/modules => user/modules/utils}/writing/default.nix (53%) rename {src/user/modules/utils => user}/modules/vim/default.nix (72%) create mode 160000 user/modules/vim/vim diff --git a/.gitmodules b/.gitmodules index d282180..d6d2845 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,15 +1,15 @@ [submodule "nvim"] - path = src/user/modules/utils/modules/neovim/config/nvim + path = user/modules/neovim/nvim url = https://github.com/itme-brain/nvim.git [submodule "vim"] - path = src/user/modules/utils/modules/vim/vim + path = user/modules/vim/vim url = https://github.com/itme-brain/vim.git [submodule "git"] - path = src/user/modules/git/git + path = user/modules/git/git url = https://github.com/itme-brain/git.git [submodule "bash"] - path = src/user/modules/bash/config/bash + path = user/modules/bash/bash url = https://github.com/itme-brain/bash.git diff --git a/README.md b/README.md index cc8dc2d..2bc89c4 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,27 @@ -# My Nix Configurations ๐Ÿ’ป +# NixOS Configuration -My modular Nix configs ๐Ÿ”ฅ +Modular NixOS flake configuration with home-manager integration. -## Requirements โš™๏ธ +## Requirements -- [Nix 2.0 & Flakes enabled](https://nixos.wiki/wiki/Flakes#Enable_flakes_permanently_in_NixOS) +- [Nix with Flakes](https://nixos.wiki/wiki/Flakes#Enable_flakes_permanently_in_NixOS) - [NixOS](https://www.nixos.org/) for system configurations -- [Nix Home-Manager](https://nix-community.github.io/home-manager/index.xhtml#sec-flakes-standalone) for user configurations +- [Home-Manager](https://nix-community.github.io/home-manager/) for user configurations -## Flake Endpoints โ„๏ธ +## Flake Outputs -NixOS Configurations: `desktop` ยท `workstation` ยท `server` (wip) ยท `vm` ยท `wsl` +| Configuration | Description | +|---------------|-------------| +| `desktop` | Primary workstation | +| `server` | Home server | +| `wsl` | Windows Subsystem for Linux | -## Fresh Install ๐Ÿš€ +## Fresh Install From the NixOS live installer: ```bash -# Enable flakes (not enabled by default on installer) +# Enable flakes echo "experimental-features = nix-command flakes" | sudo tee -a /etc/nix/nix.conf # Clone repo @@ -29,117 +33,90 @@ nix develop just install desktop ``` -Replace `desktop` with `workstation` or `vm` as needed. - -## Getting Started ๐Ÿ”ง +## Getting Started ```bash git clone --recurse-submodules git@github.com:itme-brain/nixos.git +cd nixos +nix develop +just ``` -Enter the dev shell with `nix develop`, then run `just` to see available project scripts. +**Note:** Replace `hardware.nix` in `system/machines/` with output from `nixos-generate-config` for your hardware. -Useful resources: -- [nixpkgs Packages](https://search.nixos.org/packages) ๐Ÿ“ฆ๏ธ -- [nixpkgs Options](https://search.nixos.org/options?) ๐Ÿ”๏ธ -- [Home-Manager Options](https://mipmip.github.io/home-manager-option-search/) โ˜•๏ธ - -โš ๏ธ Be sure to tailor any hardware settings to your own โ€” replace the `hardware.nix` in `src/system/machines/` with output from `nixos-generate-config` - -## Submodules ๐Ÿ”— - -Standalone portable configurations maintained as separate repos. Each can be cloned independently on any system โ€” NixOS or not. - -| Submodule | Purpose | Repo | Standalone Install | -|-----------|---------|------|--------------------| -| **nvim** | Full IDE (LSP, treesitter, telescope) | [itme-brain/nvim](https://github.com/itme-brain/nvim) | `git clone git@github.com:itme-brain/nvim.git ~/.config/nvim` | -| **vim** | Lightweight editor for headless servers | [itme-brain/vim](https://github.com/itme-brain/vim) | `git clone git@github.com:itme-brain/vim.git ~/.vim` | - -```bash -# Update a submodule -cd -git add . && git commit -m "your changes" && git push -cd /path/to/nixos -git add && git commit -m "Update submodule" - -# Pull submodule updates from remote -git submodule update --remote -git add && git commit -m "Update submodule" -``` - -## Directory Structure ๐Ÿ—‚๏ธ +## Directory Structure ``` . -โ”œโ”€โ”€ flake.nix # Flake entrypoint - defines all NixOS configurations +โ”œโ”€โ”€ flake.nix โ”œโ”€โ”€ flake.lock -โ”œโ”€โ”€ justfile # Project scripts (via `just`) -โ”œโ”€โ”€ system.configs -> src/system/machines/ # Symlink for quick access -โ”œโ”€โ”€ user.configs -> src/user/config/ # Symlink for quick access -โ””โ”€โ”€ src/ - โ”œโ”€โ”€ system/ # System-level (NixOS) configuration - โ”‚ โ”œโ”€โ”€ machines/ # Per-machine NixOS configurations - โ”‚ โ”‚ โ”œโ”€โ”€ desktop/ # Desktop config (flake: nixosConfigurations.desktop) - โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ default.nix # Machine entry point - โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ hardware.nix # Machine-specific hardware config - โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ system.nix # System-level settings - โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ modules/ - โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ disko/ # Disk partitioning (disko) - โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ home-manager/ # Home-manager integration + home.nix - โ”‚ โ”‚ โ”œโ”€โ”€ workstation/ # Workstation config (same structure as desktop) - โ”‚ โ”‚ โ”œโ”€โ”€ server/ # Server config (no disko) - โ”‚ โ”‚ โ”œโ”€โ”€ vm/ # VM config - โ”‚ โ”‚ โ”œโ”€โ”€ wsl/ # WSL config (includes wsl module) - โ”‚ โ”‚ โ””โ”€โ”€ laptop/ # Laptop config (stub) - โ”‚ โ””โ”€โ”€ modules/ # Shared system modules (imported by machines) - โ”‚ โ”œโ”€โ”€ default.nix - โ”‚ โ”œโ”€โ”€ bitcoin/ # Bitcoin node + electrum server - โ”‚ โ”œโ”€โ”€ forgejo/ # Self-hosted Forgejo - โ”‚ โ””โ”€โ”€ nginx/ # Nginx reverse proxy - โ”‚ - โ””โ”€โ”€ user/ # User-level (home-manager) configuration - โ”œโ”€โ”€ default.nix # User module entry point - โ”œโ”€โ”€ config/ # User identity & settings - โ”‚ โ”œโ”€โ”€ default.nix # Common user variables (username, email, etc.) - โ”‚ โ”œโ”€โ”€ bookmarks/ # Browser bookmarks - โ”‚ โ”œโ”€โ”€ keys/ # Public keys - โ”‚ โ”‚ โ”œโ”€โ”€ pgp/ # PGP public keys - โ”‚ โ”‚ โ””โ”€โ”€ ssh/ # SSH public keys - โ”‚ โ”œโ”€โ”€ nvim # Symlink to neovim submodule config - โ”‚ โ””โ”€โ”€ vim # Symlink to vim submodule config - โ””โ”€โ”€ modules/ # Home-manager modules - โ”œโ”€โ”€ bash/ # Shell config (aliases, prompt, bashrc) - โ”œโ”€โ”€ git/ # Git config + helper scripts - โ”œโ”€โ”€ tmux/ # Tmux config - โ”œโ”€โ”€ security/ # Security tools (GPG) - โ”œโ”€โ”€ utils/ # CLI utilities - โ”‚ โ””โ”€โ”€ modules/ - โ”‚ โ”œโ”€โ”€ dev/ # Dev tools (penpot, PCB design) - โ”‚ โ”œโ”€โ”€ email/ # Email client (aerc) - โ”‚ โ”œโ”€โ”€ irc/ # IRC client - โ”‚ โ”œโ”€โ”€ neovim/ # Neovim (config is a git submodule) - โ”‚ โ””โ”€โ”€ vim/ # Vim lightweight (config is a git submodule) - โ””โ”€โ”€ gui/ # GUI applications - โ”œโ”€โ”€ modules/ - โ”‚ โ”œโ”€โ”€ alacritty/ # Terminal emulator - โ”‚ โ”œโ”€โ”€ browsers/ # Firefox & Chromium - โ”‚ โ”œโ”€โ”€ corn/ # Corn app - โ”‚ โ”œโ”€โ”€ fun/ # Discord, etc. - โ”‚ โ”œโ”€โ”€ utils/ # GUI utilities - โ”‚ โ””โ”€โ”€ writing/ # Writing tools - โ””โ”€โ”€ wm/ # Window managers - โ”œโ”€โ”€ hyprland/ # Hyprland (Wayland) + waybar, rofi - โ”œโ”€โ”€ sway/ # Sway (Wayland) + rofi - โ”œโ”€โ”€ i3/ # i3 (X11) + rofi - โ””โ”€โ”€ shared/ # Shared WM config (mimeapps) +โ”œโ”€โ”€ justfile +โ”‚ +โ”œโ”€โ”€ system/ +โ”‚ โ”œโ”€โ”€ keys/ # Machine SSH keys +โ”‚ โ”‚ โ””โ”€โ”€ desktop/ +โ”‚ โ””โ”€โ”€ machines/ +โ”‚ โ”œโ”€โ”€ desktop/ +โ”‚ โ”‚ โ”œโ”€โ”€ default.nix # Machine entry point +โ”‚ โ”‚ โ”œโ”€โ”€ hardware.nix # Hardware config +โ”‚ โ”‚ โ”œโ”€โ”€ system.nix # System settings +โ”‚ โ”‚ โ””โ”€โ”€ modules/ +โ”‚ โ”‚ โ”œโ”€โ”€ disko/ # Disk partitioning +โ”‚ โ”‚ โ””โ”€โ”€ home-manager/ # Home-manager integration +โ”‚ โ”œโ”€โ”€ server/ # Server (same structure) +โ”‚ โ””โ”€โ”€ wsl/ # WSL (same structure) +โ”‚ +โ””โ”€โ”€ user/ + โ”œโ”€โ”€ default.nix # User options (name, email, keys) + โ”œโ”€โ”€ home.nix # Shared home-manager defaults + โ”œโ”€โ”€ bookmarks/ + โ”œโ”€โ”€ keys/ + โ”‚ โ”œโ”€โ”€ age/ + โ”‚ โ”œโ”€โ”€ pgp/ + โ”‚ โ””โ”€โ”€ ssh/ + โ””โ”€โ”€ modules/ + โ”œโ”€โ”€ bash/bash/ # Shell (submodule) + โ”œโ”€โ”€ git/git/ # Git (submodule) + โ”œโ”€โ”€ neovim/nvim/ # Neovim (submodule) + โ”œโ”€โ”€ vim/vim/ # Vim (submodule) + โ”œโ”€โ”€ tmux/ + โ”œโ”€โ”€ dev/ # CLI dev tools + โ”œโ”€โ”€ security/ + โ”‚ โ”œโ”€โ”€ gpg/ + โ”‚ โ””โ”€โ”€ yubikey/ + โ”œโ”€โ”€ utils/ + โ”‚ โ”œโ”€โ”€ dev/ # Dev tools (claude-code, direnv, etc.) + โ”‚ โ”œโ”€โ”€ email/ + โ”‚ โ”œโ”€โ”€ irc/ + โ”‚ โ””โ”€โ”€ writing/ + โ””โ”€โ”€ gui/ + โ”œโ”€โ”€ default.nix # Browser-focused mimeApps + โ”œโ”€โ”€ wm/ + โ”‚ โ”œโ”€โ”€ hyprland/ + โ”‚ โ””โ”€โ”€ sway/ + โ”œโ”€โ”€ browsers/ + โ”œโ”€โ”€ alacritty/ + โ”œโ”€โ”€ dev/ + โ”‚ โ”œโ”€โ”€ pcb/ # Arduino, KiCad + โ”‚ โ””โ”€โ”€ design/ # Penpot + โ”œโ”€โ”€ corn/ + โ”œโ”€โ”€ fun/ + โ””โ”€โ”€ utils/ ``` -### How it works +## Architecture -**flake.nix** defines NixOS configurations (desktop, workstation, server, wsl) that each reference a machine under `src/system/machines/`. Each machine's `default.nix` pulls in its own `hardware.nix`, `system.nix`, and per-machine modules (disko, home-manager). +**flake.nix** defines NixOS configurations that reference machines under `system/machines/`. +Each machine imports its hardware, system settings, and home-manager config. -The **system layer** (`src/system/`) handles NixOS-level concerns: hardware, bootloader, networking, and system services. Shared modules in `src/system/modules/` can be imported by any machine. +**user/home.nix** provides shared defaults for all users: +- Essential packages +- Default modules -The **user layer** (`src/user/`) handles home-manager configuration. `src/user/config/` defines user identity (name, email, keys), while `src/user/modules/` contains modular home-manager configs for individual tools. Each machine's `home-manager/home.nix` selects which user modules to enable. +**Machine home.nix** imports user defaults and enables machine-specific modules. -Root symlinks `system.configs` and `user.configs` provide quick access to machine definitions and user config from the repo root. +## Resources + +- [nixpkgs Packages](https://search.nixos.org/packages) +- [nixpkgs Options](https://search.nixos.org/options) +- [Home-Manager Options](https://home-manager-options.extranix.com) diff --git a/flake.lock b/flake.lock index 7875441..05e035a 100644 --- a/flake.lock +++ b/flake.lock @@ -102,11 +102,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1772822230, - "narHash": "sha256-yf3iYLGbGVlIthlQIk5/4/EQDZNNEmuqKZkQssMljuw=", + "lastModified": 1773375660, + "narHash": "sha256-SEzUWw2Rf5Ki3bcM26nSKgbeoqi2uYy8IHVBqOKjX3w=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "71caefce12ba78d84fe618cf61644dce01cf3a96", + "rev": "3e20095fe3c6cbb1ddcef89b26969a69a1570776", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 0fd5913..0f39bd7 100644 --- a/flake.nix +++ b/flake.nix @@ -22,66 +22,36 @@ }; }; - outputs = { nixpkgs, nur, home-manager, nixos-wsl, disko, ... }: + outputs = { nixpkgs, nur, ... }@inputs: let - system = "x86_64-linux"; - pkgs = import nixpkgs { + mkPkgs = system: import nixpkgs { inherit system; config = { allowUnfree = true; - nvidia.acceptLicense = true; + nvidia.acceptLicense = true; }; overlays = [ nur.overlays.default ]; }; + mkSystem = { path, system ? "x86_64-linux" }: + let pkgs = mkPkgs system; + in nixpkgs.lib.nixosSystem { + inherit system pkgs; + specialArgs = { inherit inputs; }; + modules = [ path ]; + }; + in - with pkgs; { nixosConfigurations = { - desktop = nixpkgs.lib.nixosSystem { - inherit system pkgs; - modules = [ - disko.nixosModules.disko - ./src/system/machines/desktop - home-manager.nixosModules.home-manager - (import ./src/system/machines/desktop/modules/home-manager) - ]; - }; - - workstation = nixpkgs.lib.nixosSystem { - inherit system pkgs; - modules = [ - ./src/system/machines/workstation - home-manager.nixosModules.home-manager - (import ./src/system/machines/workstation/modules/home-manager) - ]; - }; - - server = nixpkgs.lib.nixosSystem { - inherit system pkgs; - modules = [ - disko.nixosModules.disko - ./src/system/machines/server - home-manager.nixosModules.home-manager - (import ./src/system/machines/server/modules/home-manager) - ]; - }; - - wsl = nixpkgs.lib.nixosSystem { - inherit system pkgs; - modules = [ - ./src/system/machines/wsl - nixos-wsl.nixosModules.wsl - (import ./src/system/machines/wsl/modules/wsl) - home-manager.nixosModules.home-manager - (import ./src/system/machines/wsl/modules/home-manager) - ]; - }; + desktop = mkSystem { path = ./system/machines/desktop; }; + server = mkSystem { path = ./system/machines/server; }; + wsl = mkSystem { path = ./system/machines/wsl; }; }; - devShells.${system}.default = mkShell { + devShells.x86_64-linux.default = with mkPkgs "x86_64-linux"; mkShell { name = "devShell"; packages = [ just diff --git a/justfile b/justfile index dedac40..242d26c 100644 --- a/justfile +++ b/justfile @@ -1,5 +1,5 @@ SYSTEM := "$(echo $HOSTNAME)" -VALID_SYSTEMS := "desktop workstation server wsl vm laptop" +VALID_SYSTEMS := "desktop server wsl" # Print this list default: @@ -10,7 +10,7 @@ default: _validate SYSTEM: #!/usr/bin/env bash case "{{SYSTEM}}" in - desktop|workstation|server|wsl|vm|laptop) ;; + desktop|server|wsl) ;; *) echo "Error: Unknown system '{{SYSTEM}}'. Use one of: {{VALID_SYSTEMS}}"; exit 1 ;; esac @@ -105,7 +105,7 @@ partition SYSTEM: #!/usr/bin/env bash set -euo pipefail - DISKO_CONFIG="./src/system/machines/{{SYSTEM}}/modules/disko/default.nix" + DISKO_CONFIG="./system/machines/{{SYSTEM}}/modules/disko/default.nix" if [[ ! -f "$DISKO_CONFIG" ]]; then echo "Error: No disko config for '{{SYSTEM}}'" @@ -172,7 +172,7 @@ install SYSTEM: #!/usr/bin/env bash set -euo pipefail - DISKO_CONFIG="./src/system/machines/{{SYSTEM}}/modules/disko/default.nix" + DISKO_CONFIG="./system/machines/{{SYSTEM}}/modules/disko/default.nix" if [[ ! -f "$DISKO_CONFIG" ]]; then echo "Error: No disko config for '{{SYSTEM}}'" diff --git a/src/system/config/default.nix b/src/system/config/default.nix deleted file mode 100644 index 4bb4315..0000000 --- a/src/system/config/default.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ lib, pkgs, config, ... }: - -with lib; -{ - options = { - machines = mkOption { - description = "Machine Configurations"; - type = types.attrs; - default = { - keys = import ./keys { inherit lib; }; - }; - }; - }; -} diff --git a/src/system/config/keys/desktop/README.md b/src/system/config/keys/desktop/README.md deleted file mode 100644 index 355d803..0000000 --- a/src/system/config/keys/desktop/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Desktop Keys - -ssh.pub.key - ~/.ssh/id_rsa diff --git a/src/system/machines/desktop/default.nix b/src/system/machines/desktop/default.nix deleted file mode 100644 index 99a49af..0000000 --- a/src/system/machines/desktop/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ ... }: - -{ - imports = [ - ../../../user/config - ../../config - ./hardware.nix - ./system.nix - ./modules/disko - ]; -} diff --git a/src/system/machines/desktop/modules/home-manager/home.nix b/src/system/machines/desktop/modules/home-manager/home.nix deleted file mode 100644 index 10a5808..0000000 --- a/src/system/machines/desktop/modules/home-manager/home.nix +++ /dev/null @@ -1,72 +0,0 @@ -{ config, ... }: - -{ - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = { - monitors = config.monitors; - }; - home-manager.users.${config.user.name} = { - imports = [ ../../../../../user ]; - - programs.home-manager.enable = true; - - programs.ssh = { - enable = true; - enableDefaultConfig = false; - matchBlocks = { - "*" = { - serverAliveInterval = 60; - serverAliveCountMax = 3; - }; - "server" = { - hostname = "192.168.0.154"; - user = "bryan"; - }; - }; - }; - - home.stateVersion = "23.11"; - - home.username = "${config.user.name}"; - home.homeDirectory = "/home/${config.user.name}"; - - modules = { - user = { - bash.enable = true; - git.enable = true; - - security = { - enable = true; - gpg.enable = true; - }; - - tmux.enable = true; - - utils = { - enable = true; - dev = { - enable = true; - }; - irc.enable = true; - neovim.enable = true; - vim.enable = false; - }; - - gui = { - wm.hyprland.enable = true; - - browser = { - firefox.enable = true; - }; - - alacritty.enable = true; - corn.enable = true; - fun.enable = true; - utils.enable = true; - writing.enable = true; - }; - }; - }; - }; -} diff --git a/src/system/machines/laptop/default.nix b/src/system/machines/laptop/default.nix deleted file mode 100644 index 25dcc80..0000000 --- a/src/system/machines/laptop/default.nix +++ /dev/null @@ -1 +0,0 @@ -#TODO: nixify the shitty laptop diff --git a/src/system/machines/server/default.nix b/src/system/machines/server/default.nix deleted file mode 100644 index c71ec8a..0000000 --- a/src/system/machines/server/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ ... }: - -{ - imports = [ - ../../../user/config - ../../config - ./hardware.nix - ./system.nix - ]; -} diff --git a/src/system/machines/server/modules/default.nix b/src/system/machines/server/modules/default.nix deleted file mode 100644 index 1649694..0000000 --- a/src/system/machines/server/modules/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - imports = [ - ./home - ]; -} diff --git a/src/system/machines/server/modules/home-manager/default.nix b/src/system/machines/server/modules/home-manager/default.nix deleted file mode 100644 index d3a7e46..0000000 --- a/src/system/machines/server/modules/home-manager/default.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ config, ... }: - -{ - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.${config.user.name} = { - imports = [ ../../../../../user ]; - - programs.home-manager.enable = true; - - home.stateVersion = "25.11"; - - home.username = "${config.user.name}"; - home.homeDirectory = "/home/${config.user.name}"; - - modules = { - user = { - bash.enable = true; - git.enable = true; - tmux.enable = true; - - security = { - gpg.enable = true; - }; - - utils = { - enable = true; - vim.enable = true; - }; - }; - }; - }; -} diff --git a/src/system/machines/vm/default.nix b/src/system/machines/vm/default.nix deleted file mode 100644 index c71ec8a..0000000 --- a/src/system/machines/vm/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ ... }: - -{ - imports = [ - ../../../user/config - ../../config - ./hardware.nix - ./system.nix - ]; -} diff --git a/src/system/machines/vm/hardware.nix b/src/system/machines/vm/hardware.nix deleted file mode 100644 index 43d1680..0000000 --- a/src/system/machines/vm/hardware.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ config, lib, modulesPath, ... }: - -{ - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - - boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "sd_mod" "sr_mod" ]; - boot.initrd.kernelModules = [ "dm-snapshot" ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/src/system/machines/vm/modules/default.nix b/src/system/machines/vm/modules/default.nix deleted file mode 100644 index 1649694..0000000 --- a/src/system/machines/vm/modules/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - imports = [ - ./home - ]; -} diff --git a/src/system/machines/vm/modules/disko/default.nix b/src/system/machines/vm/modules/disko/default.nix deleted file mode 100644 index 5376126..0000000 --- a/src/system/machines/vm/modules/disko/default.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ disk ? "/dev/vda" }: -{ - disko.devices = { - disk = { - one = { - type = "disk"; - device = disk; - content = { - type = "gpt"; - partitions = { - boot = { - size = "200M"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - }; - }; - primary = { - size = "100%"; - content = { - type = "lvm_pv"; - vg = "vm"; - }; - }; - }; - }; - }; - }; - - lvm_vg = { - vm = { - type = "lvm_vg"; - lvs = { - root = { - size = "100%"; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/"; - mountOptions = [ "defaults" ]; - }; - }; - }; - }; - }; - }; -} diff --git a/src/system/machines/vm/modules/home-manager/default.nix b/src/system/machines/vm/modules/home-manager/default.nix deleted file mode 100644 index 1d99c4d..0000000 --- a/src/system/machines/vm/modules/home-manager/default.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ config, ... }: - -{ - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.${config.user.name} = { - imports = [ ../../../../../user ]; - - programs.home-manager.enable = true; - - home.stateVersion = "23.11"; - - home.username = "${config.user.name}"; - home.homeDirectory = "/home/${config.user.name}"; - - modules = { - user = { - bash.enable = true; - git.enable = true; - - security = { - gpg.enable = true; - }; - - utils = { - enable = true; - vim.enable = true; - }; - }; - }; - }; -} diff --git a/src/system/machines/vm/system.nix b/src/system/machines/vm/system.nix deleted file mode 100644 index 444b180..0000000 --- a/src/system/machines/vm/system.nix +++ /dev/null @@ -1,96 +0,0 @@ -{ pkgs, lib, config, ... }: - -{ system.stateVersion = "23.11"; - - imports = [ ../../modules ]; - - users.users = { - ${config.user.name} = { - isNormalUser = true; - extraGroups = config.user.groups; - openssh.authorizedKeys.keys = [ "${config.user.keys.ssh.yubikey}" ]; - }; - }; - - nix = { - channel.enable = false; - package = pkgs.nixVersions.stable; - extraOptions = "experimental-features = nix-command flakes"; - settings = { - auto-optimise-store = true; - trusted-users = [ "${config.user.name}" ]; - }; - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 30d"; - }; - }; - - boot.loader = { - timeout = null; - grub = { - enable = true; - useOSProber = true; - devices = [ "nodev" ]; - efiSupport = true; - configurationLimit = 3; - splashImage = null; - }; - - efi = { - canTouchEfiVariables = true; - }; - }; - - #fonts.packages = with pkgs; [ - # terminus_font - # terminus-nerdfont - #]; - - security.sudo = { - wheelNeedsPassword = false; - execWheelOnly = true; - }; - - time = { - timeZone = "America/New_York"; - hardwareClockInLocalTime = false; - }; - - services.timesyncd = lib.mkDefault { - enable = true; - servers = [ - "0.pool.ntp.org" - "1.pool.ntp.org" - "2.pool.ntp.org" - "3.pool.ntp.org" - ]; - }; - - i18n.defaultLocale = "en_US.UTF-8"; - - console = { - font = "Lat2-Terminus16"; - useXkbConfig = true; - }; - - networking = { - hostName = "vm"; - useDHCP = lib.mkDefault true; - networkmanager.enable = true; - firewall = { - enable = true; - allowedTCPPorts = [ 22 80 443 ]; - }; - }; - - services.openssh = { - enable = true; - startWhenNeeded = true; - settings = { - X11Forwarding = false; - PasswordAuthentication = true; - }; - }; -} diff --git a/src/system/machines/workstation/default.nix b/src/system/machines/workstation/default.nix deleted file mode 100644 index c71ec8a..0000000 --- a/src/system/machines/workstation/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ ... }: - -{ - imports = [ - ../../../user/config - ../../config - ./hardware.nix - ./system.nix - ]; -} diff --git a/src/system/machines/workstation/hardware.nix b/src/system/machines/workstation/hardware.nix deleted file mode 100644 index 1ee4de9..0000000 --- a/src/system/machines/workstation/hardware.nix +++ /dev/null @@ -1,101 +0,0 @@ -{ config, lib, pkgs, modulesPath, ... }: - -{ - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - - boot = { - initrd = { - availableKernelModules = [ "vmd" "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; - kernelModules = [ "dm-snapshot" ]; - }; - extraModulePackages = [ ]; - kernelParams = [ "intel_iommu=on" ]; - kernelModules = [ - "kvm-intel" - "virtio" - "vfio-pci" - "coretemp" - - "ipmi_devintf" - "ipmi_si" - ]; - }; - - environment.systemPackages = with pkgs; [ - ipmitool - ipmicfg - ipmiutil - ipmiview - - linuxHeaders - - vulkan-headers - vulkan-loader - vulkan-tools - vulkan-extension-layer - - mesa - mesa-demos - - libGL - ]; - - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/6e964c61-ea77-48cc-b495-6a8516b8e756"; - fsType = "xfs"; - }; - - "/home" = { - device = "/dev/disk/by-uuid/db504fb8-14f8-4292-b745-32d6255c4893"; - fsType = "xfs"; - }; - - "/boot" = { - device = "/dev/disk/by-uuid/61E7-6E56"; - fsType = "vfat"; - }; - - "/var/lib/libvirt/images" = { - device = "/home/VMs"; - options = [ "bind" ]; - }; - }; - - systemd.tmpfiles.rules = [ - "d /home/VMs 0755 root root" - ]; - - virtualisation.libvirtd = { - enable = true; - qemu = { - runAsRoot = true; - }; - }; - - services.xserver.videoDrivers = lib.mkDefault [ "nvidia" ]; - - hardware = { - graphics = { - enable = true; - enable32Bit = true; - }; - - nvidia = { - open = false; - powerManagement.enable = false; - powerManagement.finegrained = false; - modesetting.enable = true; - nvidiaSettings = true; - package = config.boot.kernelPackages.nvidiaPackages.mkDriver { - version = "550.120"; - sha256_64bit = "sha256-gBkoJ0dTzM52JwmOoHjMNwcN2uBN46oIRZHAX8cDVpc="; - settingsSha256 = "sha256-fPfIPwpIijoUpNlAUt9C8EeXR5In633qnlelL+btGbU="; - persistencedSha256 = lib.fakeSha256; - }; - }; - }; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/src/system/machines/workstation/modules/disko/default.nix b/src/system/machines/workstation/modules/disko/default.nix deleted file mode 100644 index d9943db..0000000 --- a/src/system/machines/workstation/modules/disko/default.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ disk }: -{ - disko.devices = { - disk = { - one = { - type = "disk"; - device = disk; - content = { - type = "gpt"; - partitions = { - boot = { - size = "1G"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ "umask=0077" ]; - }; - }; - primary = { - size = "100%"; - content = { - type = "lvm_pv"; - vg = "nix"; - }; - }; - }; - }; - }; - }; - - lvm_vg = { - nix = { - type = "lvm_vg"; - lvs = { - root = { - size = "5%"; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/"; - mountOptions = [ "defaults" ]; - }; - }; - home = { - size = "100%FREE"; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/home"; - }; - }; - }; - }; - }; - }; -} diff --git a/src/system/machines/workstation/modules/home-manager/home.nix b/src/system/machines/workstation/modules/home-manager/home.nix deleted file mode 100644 index 3720ca5..0000000 --- a/src/system/machines/workstation/modules/home-manager/home.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ config, ... }: - -{ - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.${config.user.name} = { - imports = [ ../../../../../user ]; - - programs.home-manager.enable = true; - - home.stateVersion = "23.11"; - - home.username = "${config.user.name}"; - home.homeDirectory = "/home/${config.user.name}"; - - modules = { - user = { - bash.enable = true; - git.enable = true; - - security = { - enable = true; - gpg.enable = true; - }; - - tmux.enable = true; - - utils = { - enable = true; - dev = { - enable = true; - }; - email.enable = true; - neovim.enable = true; - vim.enable = true; - }; - - gui = { - wm.i3.enable = true; - - browser = { - chromium.enable = true; - }; - - alacritty.enable = true; - utils.enable = true; - writing.enable = true; - }; - }; - }; - }; -} diff --git a/src/system/machines/workstation/system.nix b/src/system/machines/workstation/system.nix deleted file mode 100644 index e26e5ea..0000000 --- a/src/system/machines/workstation/system.nix +++ /dev/null @@ -1,131 +0,0 @@ -{ pkgs, lib, config, home-manager, ... }: - -with lib; -{ - system.stateVersion = "23.11"; - - users.users = { - ${config.user.name} = { - isNormalUser = true; - extraGroups = config.user.groups - ++ [ "video" "audio" "kvm" "libvirtd" "dialout" ]; - openssh.authorizedKeys.keys = [ - "${config.user.keys.ssh.yubikey}" - "${config.user.keys.ssh.work}" - ]; - }; - }; - - nix = { - channel.enable = false; - package = pkgs.nixVersions.stable; - extraOptions = '' - experimental-features = nix-command flakes - keep-going = true - ''; - settings = { - auto-optimise-store = true; - trusted-users = [ "${config.user.name}" ]; - substitute = true; - max-jobs = "auto"; - }; - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 7d"; - }; - }; - - boot.loader = { - systemd-boot = { - enable = true; - configurationLimit = 5; - memtest86.enable = true; - }; - timeout = null; - }; - - environment.systemPackages = with pkgs; [ - vim - git - usbutils - ]; - - fonts.packages = with pkgs; [ - terminus_font - terminus-nerdfont - ]; - - security = { - sudo = { - wheelNeedsPassword = false; - execWheelOnly = true; - }; - polkit.enable = true; - }; - - time = { - timeZone = "America/New_York"; - hardwareClockInLocalTime = true; - }; - - i18n.defaultLocale = "en_US.UTF-8"; - - console = { - font = "Lat2-Terminus16"; - useXkbConfig = true; - }; - - networking = { - hostName = "workstation"; - useDHCP = lib.mkDefault true; - networkmanager.enable = true; - firewall = { - enable = true; - allowedTCPPorts = [ 22 80 443 ]; - }; - }; - - programs.i3lock = { - enable = true; - package = pkgs.i3lock-fancy; - }; - - services = { - xserver.enable = true; - displayManager.ly.enable = true; - - teamviewer.enable = true; - - timesyncd = lib.mkDefault { - enable = true; - servers = [ - "0.pool.ntp.org" - "1.pool.ntp.org" - "2.pool.ntp.org" - "3.pool.ntp.org" - ]; - }; - - pipewire = { - enable = true; - audio.enable = true; - - wireplumber.enable = true; - - pulse.enable = true; - jack.enable = true; - alsa.enable = true; - alsa.support32Bit = true; - }; - - openssh = { - enable = true; - startWhenNeeded = false; - settings = { - X11Forwarding = false; - PasswordAuthentication = true; - }; - }; - }; -} diff --git a/src/system/machines/wsl/default.nix b/src/system/machines/wsl/default.nix deleted file mode 100644 index 9af8cf1..0000000 --- a/src/system/machines/wsl/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: - -{ - imports = [ - ../../../user/config - ../../config - ./system.nix - ]; -} diff --git a/src/system/machines/wsl/modules/home-manager/default.nix b/src/system/machines/wsl/modules/home-manager/default.nix deleted file mode 100644 index f31f0ea..0000000 --- a/src/system/machines/wsl/modules/home-manager/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ - imports = [ -<<<<<<<< HEAD:src/system/machines/wsl/modules/home-manager/default.nix - ./home.nix -======== - ./c-lightning-REST ->>>>>>>> lightning:src/system/modules/bitcoin/modules/clightning/plugins/default.nix - ]; -} diff --git a/src/system/machines/wsl/modules/home-manager/home.nix b/src/system/machines/wsl/modules/home-manager/home.nix deleted file mode 100644 index 1977ae0..0000000 --- a/src/system/machines/wsl/modules/home-manager/home.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ config, ... }: - -{ - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.${config.user.name} = { - imports = [ ../../../../../user ]; - - programs.home-manager.enable = true; - - home.stateVersion = "23.11"; - - home.username = "${config.user.name}"; - home.homeDirectory = "/home/${config.user.name}"; - - modules = { - user = { - bash.enable = true; - git.enable = true; - - security = { - enable = true; - gpg.enable = true; - }; - - tmux.enable = true; - - utils = { - enable = true; - dev.enable = true; - email.enable = true; - irc.enable = true; - neovim.enable = true; - }; - }; - }; - }; -} diff --git a/src/user/config/bash b/src/user/config/bash deleted file mode 120000 index 41f0b65..0000000 --- a/src/user/config/bash +++ /dev/null @@ -1 +0,0 @@ -../modules/bash/config/bash/ \ No newline at end of file diff --git a/src/user/config/git b/src/user/config/git deleted file mode 120000 index 753f800..0000000 --- a/src/user/config/git +++ /dev/null @@ -1 +0,0 @@ -../modules/git/git/ \ No newline at end of file diff --git a/src/user/config/nvim b/src/user/config/nvim deleted file mode 120000 index de5a93f..0000000 --- a/src/user/config/nvim +++ /dev/null @@ -1 +0,0 @@ -../modules/utils/modules/neovim/config/nvim \ No newline at end of file diff --git a/src/user/config/vim b/src/user/config/vim deleted file mode 120000 index 2ab4c21..0000000 --- a/src/user/config/vim +++ /dev/null @@ -1 +0,0 @@ -../modules/utils/modules/vim/vim/ \ No newline at end of file diff --git a/src/user/modules/bash/config/bash b/src/user/modules/bash/config/bash deleted file mode 160000 index 79eb823..0000000 --- a/src/user/modules/bash/config/bash +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 79eb823bbb9ff88f284ae055fe1de954df8bf2e0 diff --git a/src/user/modules/bash/config/shellHook.nix b/src/user/modules/bash/config/shellHook.nix deleted file mode 100644 index a252b83..0000000 --- a/src/user/modules/bash/config/shellHook.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ lib, config, ... }: - -with lib; -let - tmux = config.modules.user.tmux; - gui = config.modules.user.gui.wm; - sway = config.modules.user.gui.wm.sway; - hyprland = config.modules.user.gui.wm.hyprland; - - wm = { - enable = builtins.any (mod: mod.enable or false) (builtins.attrValues gui); - }; - -in -'' -case $- in - *i*) - ${optionalString wm.enable '' - if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then - ${optionalString sway.enable '' - exec sway - '' - } - ${optionalString hyprland.enable '' - exec Hyprland - '' - } - exit 0 - fi - ''} - ${optionalString tmux.enable '' - if [ -z "$DISPLAY" ] && [ -z "$TMUX" ] && [ -z "$SSH_TTY" ]; then - exec tmux - fi - ''} - ;; -esac -'' diff --git a/src/user/modules/gui/wm/i3/default.nix b/src/user/modules/gui/wm/i3/default.nix deleted file mode 100644 index 4617ee3..0000000 --- a/src/user/modules/gui/wm/i3/default.nix +++ /dev/null @@ -1,144 +0,0 @@ -{ pkgs, lib, config, ... }: - -with lib; -let - cfg = config.modules.user.gui.wm.sway; - modifier = config.wayland.windowManager.sway.config.modifier; - - wallpaper = builtins.fetchurl { - url = "https://images6.alphacoders.com/117/1174033.png"; - sha256 = "1ph5m9s57076jx6042iipqx2ifzadmd5z4lf5l49wgq4jb92mp16"; - }; - - barStatus = pkgs.writeShellScript "status.sh" '' - #!/usr/bin/env bash - while :; do - echo "$(ip -4 addr show eno1 | awk '/inet / {print $2}' | cut -d'/' -f1) | $(free -h | awk '/^Mem/ {print $3}') | $(date +'%I:%M:%S %p') | $(date +'%m-%d-%Y')"; sleep 1; - done - ''; - -in -{ options.modules.user.gui.wm.i3 = { enable = mkEnableOption "Enable i3 WM"; }; - config = mkIf cfg.enable { - xsession = { - enable = true; - windowManager.i3 = { - config = { - defaultWorkspace = "workspace number 1"; - - fonts = { - names = [ "Terminus" ]; - }; - - modifier = "Mod1"; - menu = "rofi -show drun -show-icons -drun-icon-theme Qogir -font 'Noto Sans 14'"; - terminal = "${pkgs.alacritty}/bin/alacritty"; - - bars = [ - { - position = "top"; - statusCommand = "${barStatus}"; - fonts = { - names = [ "Terminus" ]; - size = 12.0; - }; - colors = { - background = "#0A0E14"; - statusline = "#FFFFFF"; - }; - } - ]; - - gaps = { - smartGaps = false; - inner = 10; - }; - - floating = { - titlebar = false; - border = 0; - criteria = [ - { - title = "Android Emulator"; - } - ]; - }; - - window = { - titlebar = false; - border= 0; - }; - - keybindings = lib.mkOptionDefault { - "${modifier}+q" = "kill"; - "Print" = "exec grim ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png"; - "${modifier}+Shift+Print" = "exec grim -g \"$(slurp)\" ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png"; - "${modifier}+Print" = ''exec sh -c 'grim -g "$(swaymsg -t get_tree | jq -j '"'"'.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"'"'"')" ~/Pictures/screenshot-$(date +'%Y%m%d-%H%M%S').png' ''; - "${modifier}+Shift+f" = "exec alacritty -e sh -c 'EDITOR=nvim ranger'"; - "${modifier}+Shift+d" = "exec rofi -modi emoji -show emoji"; - }; - }; - - extraConfig = '' - exec_always ${pkgs.autotiling}/bin/autotiling -sr "1.61" - ''; - }; - }; - - programs.rofi = import ./config/rofi { inherit pkgs config lib; }; - - home.file.".config/rofi" = { - source = ./config/rofi/config; - recursive = true; - }; - - xdg = { - portal = { - enable = true; - extraPortals = with pkgs; [ - xdg-desktop-portal-gtk - ]; - config.common.default = "*"; - }; - }; - - gtk = { - enable = true; - theme.package = pkgs.juno-theme; - theme.name = "Juno-ocean"; - iconTheme.package = pkgs.qogir-icon-theme; - iconTheme.name = "Qogir"; - }; - - qt = { - enable = true; - style.package = pkgs.juno-theme; - platformTheme.name = "gtk"; - }; - - home.packages = with pkgs; [ - pavucontrol - xdg-utils - wl-clipboard - autotiling - - grim - jq - slurp - - ranger - highlight - - nerd-fonts.terminess-ttf - noto-fonts - noto-fonts-cjk-sans - noto-fonts-color-emoji - ]; - - programs = { - imv.enable = true; - }; - - fonts.fontconfig.enable = true; - }; -} diff --git a/src/user/modules/gui/wm/shared/mimeapps/default.nix b/src/user/modules/gui/wm/shared/mimeapps/default.nix deleted file mode 100644 index 7f94be9..0000000 --- a/src/user/modules/gui/wm/shared/mimeapps/default.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ pkgs, lib, config, ... }: - -let - browser = config.programs; - - fileTypes = [ - "text/html" "application/pdf" "application/xml" - "image/png" "image/svg+xml" "image/jpg" - "image/jpeg" "image/gif" "image/webp" - "image/avif" "image/bmp" "image/tiff" - ]; - - defaultBrowser = if browser.firefox.enable then - "firefox.desktop" - else if browser.brave.enable then - "brave-browser.desktop" - else if browser.chromium.enable then - "chromium.desktop" - else null; - -in -{ - xdg.mimeApps = lib.optionalAttrs (defaultBrowser != null && config.xdg.portal.enable) { - enable = true; - defaultApplications = builtins.listToAttrs ( - map (type: { - name = type; - value = [ defaultBrowser ]; - }) fileTypes - ); - }; -} diff --git a/src/user/modules/gui/wm/sway/config/rofi/config/config.rasi b/src/user/modules/gui/wm/sway/config/rofi/config/config.rasi deleted file mode 100644 index 2e38cf2..0000000 --- a/src/user/modules/gui/wm/sway/config/rofi/config/config.rasi +++ /dev/null @@ -1,7 +0,0 @@ -configuration { - font: "SF Pro Rounded 10"; - show-icons: true; - kb-cancel: "Escape,Alt+F1"; -} - -@theme "~/.config/rofi/material-ocean.rasi" diff --git a/src/user/modules/gui/wm/sway/config/rofi/config/material-ocean.rasi b/src/user/modules/gui/wm/sway/config/rofi/config/material-ocean.rasi deleted file mode 100644 index 3533a13..0000000 --- a/src/user/modules/gui/wm/sway/config/rofi/config/material-ocean.rasi +++ /dev/null @@ -1,95 +0,0 @@ -* { - background: #0f111a; - foreground: #f1f1f1; - selected: #ff4151; -} - -window { - transparency: "real"; - background-color: @background; - text-color: @foreground; -} - -prompt { - enabled: true; - padding: 4px 4px 6px 6px; - background-color: @background; - text-color: @foreground; -} - -textbox-prompt-colon { - expand: false; - background-color: @background; - padding: 4px 0px 0px 6px; -} - -inputbar { - children: [ textbox-prompt-colon, entry ]; - background-color: @background; - text-color: @foreground; - expand: false; - border: 0px 0px 0px 0px; - border-radius: 0px; - border-color: @selected; - margin: 0px 0px 0px 0px; - padding: 0px 0px 4px 0px; - position: center; -} - -entry { - background-color: @background; - text-color: @foreground; - placeholder-color: @foreground; - expand: true; - horizontal-align: 0; - blink: true; - padding: 4px 0px 0px 4px; -} - -case-indicator { - background-color: @background; - text-color: @foreground; - spacing: 0; -} - -listview { - background-color: @background; - columns: 1; - spacing: 5px; - cycle: true; - dynamic: true; - layout: vertical; -} - -mainbox { - background-color: @background; - children: [ inputbar, listview ]; - spacing: 5px; - padding: 5px 5px 5px 5px; -} - -element { - background-color: @background; - text-color: @foreground; - orientation: horizontal; - border-radius: 4px; - padding: 6px 6px 6px 6px; -} - -element-text, element-icon { - background-color: inherit; - text-color: inherit; -} - -element-icon { - size: 18px; - border: 4px; -} - -element selected { - background-color: @selected; - text-color: @background; - border: 0px; - border-radius: 0px; - border-color: @selected; -} diff --git a/src/user/modules/gui/wm/sway/config/rofi/default.nix b/src/user/modules/gui/wm/sway/config/rofi/default.nix deleted file mode 100644 index 724fd55..0000000 --- a/src/user/modules/gui/wm/sway/config/rofi/default.nix +++ /dev/null @@ -1,183 +0,0 @@ -{ pkgs, config, ... }: -let - inherit (config.lib.formats.rasi) mkLiteral; - -in -{ - enable = true; - package = pkgs.rofi; - location = "center"; - terminal = "\${pkgs.alacritty}/bin/alacritty"; - plugins = with pkgs; [ - rofi-emoji - ]; - - #theme = { - # "*" = { - # nord0 = mkLiteral "#2e3440"; - # nord1 = mkLiteral "#3b4252"; - # nord2 = mkLiteral "#434c5e"; - # nord3 = mkLiteral "#4c566a"; - # nord4 = mkLiteral "#d8dee9"; - # nord5 = mkLiteral "#e5e9f0"; - # nord6 = mkLiteral "#eceff4"; - # nord7 = mkLiteral "#8fbcbb"; - # nord8 = mkLiteral "#88c0d0"; - # nord9 = mkLiteral "#81a1c1"; - # nord10 = mkLiteral "#5e81ac"; - # nord11 = mkLiteral "#bf616a"; - # nord12 = mkLiteral "#d08770"; - # nord13 = mkLiteral "#ebcb8b"; - # nord14 = mkLiteral "#a3be8c"; - # nord15 = mkLiteral "#b48ead"; - # spacing = 2; - # background-color = mkLiteral "var(nord1)"; - # background = mkLiteral "var(nord1)"; - # foreground = mkLiteral "var(nord4)"; - # normal-background = mkLiteral "var(background)"; - # normal-foreground = mkLiteral "var(foreground)"; - # alternate-normal-background = mkLiteral "var(background)"; - # alternate-normal-foreground = mkLiteral "var(foreground)"; - # selected-normal-background = mkLiteral "var(nord8)"; - # selected-normal-foreground = mkLiteral "var(background)"; - # active-background = mkLiteral "var(background)"; - # active-foreground = mkLiteral "var(nord10)"; - # alternate-active-background = mkLiteral "var(background)"; - # alternate-active-foreground = mkLiteral "var(nord10)"; - # selected-active-background = mkLiteral "var(nord10)"; - # selected-active-foreground = mkLiteral "var(background)"; - # urgent-background = mkLiteral "var(background)"; - # urgent-foreground = mkLiteral "var(nord11)"; - # alternate-urgent-background = mkLiteral "var(background)"; - # alternate-urgent-foreground = mkLiteral "var(nord11)"; - # selected-urgent-background = mkLiteral "var(nord11)"; - # selected-urgent-foreground = mkLiteral "var(background)"; - # }; - # - # element = { - # padding = mkLiteral "0px 0px 0px 7px"; - # spacing = mkLiteral "5px"; - # border = 0; - # cursor = mkLiteral "pointer"; - # }; - - # "element normal.normal" = { - # background-color = mkLiteral "var(normal-background)"; - # text-color = mkLiteral "var(normal-foreground)"; - # }; - - # "element normal.urgent" = { - # background-color = mkLiteral "var(urgent-background)"; - # text-color = mkLiteral "var(urgent-foreground)"; - # }; - - # "element normal.active" = { - # background-color = mkLiteral "var(active-background)"; - # text-color = mkLiteral "var(active-foreground)"; - # }; - - # "element selected.normal" = { - # background-color = mkLiteral "var(selected-normal-background)"; - # text-color = mkLiteral "var(selected-normal-foreground)"; - # }; - - # "element selected.urgent" = { - # background-color = mkLiteral "var(selected-urgent-background)"; - # text-color = mkLiteral "var(selected-urgent-foreground)"; - # }; - - # "element selected.active" = { - # background-color = mkLiteral "var(selected-active-background)"; - # text-color = mkLiteral "var(selected-active-foreground)"; - # }; - - # "element alternate.normal" = { - # background-color = mkLiteral "var(alternate-normal-background)"; - # text-color = mkLiteral "var(alternate-normal-foreground)"; - # }; - - # "element alternate.urgent" = { - # background-color = mkLiteral "var(alternate-urgent-background)"; - # text-color = mkLiteral "var(alternate-urgent-foreground)"; - # }; - - # "element alternate.active" = { - # background-color = mkLiteral "var(alternate-active-background)"; - # text-color = mkLiteral "var(alternate-active-foreground)"; - # }; - - # "element-text" = { - # background-color = mkLiteral "rgba(0, 0, 0, 0%)"; - # text-color = mkLiteral "inherit"; - # highlight = mkLiteral "inherit"; - # cursor = mkLiteral "inherit"; - # }; - - # "element-icon" = { - # background-color = mkLiteral "rgba(0, 0, 0, 0%)"; - # size = mkLiteral "1.0000em"; - # text-color = mkLiteral "inherit"; - # cursor = mkLiteral "inherit"; - # }; - - # window = { - # padding = 0; - # border = 0; - # background-color = mkLiteral "var(background)"; - # }; - - # mainbox = { - # padding = 0; - # border = 0; - # }; - - # message = { - # margin = mkLiteral "0px 7px"; - # }; - - # textbox = { - # text-color = mkLiteral "var(foreground)"; - # }; - - # listview = { - # margin = mkLiteral "0px 0px 5px"; - # scrollbar = true; - # spacing = mkLiteral "2px"; - # fixed-height = 0; - # }; - - # scrollbar = { - # padding = 0; - # handle-width = mkLiteral "14px"; - # border = 0; - # handle-color = mkLiteral "var(nord3)"; - # }; - - # button = { - # spacing = 0; - # text-color = mkLiteral "var(normal-foreground)"; - # cursor = mkLiteral "pointer"; - # }; - - # "button selected" = { - # background-color = mkLiteral "var(selected-normal-background)"; - # text-color = mkLiteral "var(selected-normal-foreground)"; - # }; - - # inputbar = { - # padding = mkLiteral "7px"; - # margin = mkLiteral "7px"; - # spacing = 0; - # text-color = mkLiteral "var(normal-foreground)"; - # background-color = mkLiteral "var(nord3)"; - # children = [ "entry" ]; - # }; - - # entry = { - # spacing = 0; - # cursor = mkLiteral "text"; - # text-color = mkLiteral "var(normal-foreground)"; - # background-color = mkLiteral "var(nord3)"; - # }; - #}; -} diff --git a/src/user/modules/security/default.nix b/src/user/modules/security/default.nix deleted file mode 100644 index 4b07f68..0000000 --- a/src/user/modules/security/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ pkgs, lib, config, ... }: - -with lib; -let - cfg = config.modules.user.security; - pass = pkgs.pass.withExtensions (exts: with exts; [ - pass-audit - pass-otp - pass-update - #pass-tomb - ]); - -in -{ options.modules.user.security = { enable = mkEnableOption "Enable security module"; }; - config = mkIf cfg.enable { - home.packages = with pkgs; [ - pass - wireguard-tools - ipscan - yubikey-manager - ]; - }; -} diff --git a/src/user/modules/utils/default.nix b/src/user/modules/utils/default.nix deleted file mode 100644 index e8d4b86..0000000 --- a/src/user/modules/utils/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ pkgs, lib, config, ... }: - -with lib; -let - cfg = config.modules.user.utils; - -in -{ options.modules.user.utils = { enable = mkEnableOption "user.utils"; }; - config = mkIf cfg.enable { - home.packages = with pkgs; [ - wget curl fastfetch - unzip fping calc fd pciutils - rsync zip lshw wireshark - calcurse - ]; - - programs.bash.shellAliases = { - calendar = "${pkgs.calcurse}/bin/calcurse"; - }; - }; -} diff --git a/src/user/modules/utils/modules/dev/config/penpot.nix b/src/user/modules/utils/modules/dev/config/penpot.nix deleted file mode 100644 index 3f79e97..0000000 --- a/src/user/modules/utils/modules/dev/config/penpot.nix +++ /dev/null @@ -1,31 +0,0 @@ -#TODO: Create a penpot derivation and properly fix the script -'' -function penpot() { - case "$1" in - run) - sudo docker compose -p penpot -f ~/Documents/tools/penpot/docker-compose.yaml up -d >/dev/null 2>&1 - nohup bash -c '(sleep 10 && if [[ "$OSTYPE" == "linux-gnu"* ]]; then - xdg-open "http://localhost:9001" - elif [[ "$OSTYPE" == "darwin"* ]]; then - open "http://localhost:9001" - fi)' >/dev/null 2>&1 & - echo "Started penpot on http://localhost:9001" - ;; - stop) - echo "Stopping penpot" - sudo docker compose -p penpot -f ~/Documents/tools/penpot/docker-compose.yaml down >/dev/null 2>&1 - ;; - update) - sudo docker compose -f ~/Documents/tools/penpot/docker-compose.yaml pull - echo "Updated penpot!" - ;; - help) - xdg-open "https://help.penpot.app/" - echo "Opened penpot help page in your browser." - ;; - *) - echo "Usage: penpot {run|stop|update|help}" - ;; - esac -} -'' diff --git a/src/user/modules/utils/modules/vim/vim b/src/user/modules/utils/modules/vim/vim deleted file mode 160000 index 64b4c54..0000000 --- a/src/user/modules/utils/modules/vim/vim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 64b4c545481b593d2859bfb3e1c10cd91742213f diff --git a/system.configs b/system.configs deleted file mode 120000 index 44b8b3f..0000000 --- a/system.configs +++ /dev/null @@ -1 +0,0 @@ -src/system/machines/ \ No newline at end of file diff --git a/src/user/config/keys/default.nix b/system/keys/default.nix similarity index 70% rename from src/user/config/keys/default.nix rename to system/keys/default.nix index e3f3aaf..c946ac3 100644 --- a/src/user/config/keys/default.nix +++ b/system/keys/default.nix @@ -1,12 +1,11 @@ -{ lib }: +{ lib, ... }: +with lib; with builtins; let extractName = filename: let - # Remove .key extension - noKey = lib.removeSuffix ".key" filename; - # Remove .pub/.priv/.public/.private markers + noKey = removeSuffix ".key" filename; noMarkers = replaceStrings [ ".pub" ".priv" ".public" ".private" ] [ "" "" "" "" ] @@ -23,11 +22,22 @@ let value = readFile "${dir}/${subdir}/${file}"; }) (filter (file: (readDir "${dir}/${subdir}").${file} == "regular" && - lib.hasSuffix ".key" file + hasSuffix ".key" file ) (attrNames (readDir "${dir}/${subdir}"))) ); }) (filter (node: (readDir dir).${node} == "directory") (attrNames (readDir dir))) ) ); + in - constructKeys ./. +{ + options = { + machines = mkOption { + description = "Machine Configurations"; + type = types.attrs; + default = { + keys = constructKeys ./.; + }; + }; + }; +} diff --git a/src/system/config/keys/desktop/ssh.pub.key b/system/keys/desktop/ssh.pub.key similarity index 100% rename from src/system/config/keys/desktop/ssh.pub.key rename to system/keys/desktop/ssh.pub.key diff --git a/src/system/machines/desktop/README.md b/system/machines/desktop/README.md similarity index 100% rename from src/system/machines/desktop/README.md rename to system/machines/desktop/README.md diff --git a/system/machines/desktop/default.nix b/system/machines/desktop/default.nix new file mode 100644 index 0000000..18bc85c --- /dev/null +++ b/system/machines/desktop/default.nix @@ -0,0 +1,14 @@ +{ inputs, ... }: + +{ + imports = [ + inputs.disko.nixosModules.disko + (import ./modules/disko) + inputs.home-manager.nixosModules.home-manager + (import ./modules/home-manager) + ../../../user + ../../keys + ./hardware.nix + ./system.nix + ]; +} diff --git a/src/system/machines/desktop/hardware.nix b/system/machines/desktop/hardware.nix similarity index 100% rename from src/system/machines/desktop/hardware.nix rename to system/machines/desktop/hardware.nix diff --git a/src/system/machines/desktop/modules/disko/default.nix b/system/machines/desktop/modules/disko/default.nix similarity index 100% rename from src/system/machines/desktop/modules/disko/default.nix rename to system/machines/desktop/modules/disko/default.nix diff --git a/src/system/machines/desktop/modules/home-manager/default.nix b/system/machines/desktop/modules/home-manager/default.nix similarity index 100% rename from src/system/machines/desktop/modules/home-manager/default.nix rename to system/machines/desktop/modules/home-manager/default.nix diff --git a/system/machines/desktop/modules/home-manager/home.nix b/system/machines/desktop/modules/home-manager/home.nix new file mode 100644 index 0000000..ef360f0 --- /dev/null +++ b/system/machines/desktop/modules/home-manager/home.nix @@ -0,0 +1,54 @@ +{ config, ... }: + +{ + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { + monitors = config.monitors; + }; + home-manager.users.${config.user.name} = { + imports = [ + ../../../../../user + ../../../../../user/home.nix + ../../../../../user/modules + ]; + + home.stateVersion = "23.11"; + + programs.ssh = { + enable = true; + enableDefaultConfig = false; + matchBlocks = { + "*" = { + serverAliveInterval = 60; + serverAliveCountMax = 3; + }; + "server" = { + hostname = "192.168.0.154"; + user = "bryan"; + }; + }; + }; + + # Machine-specific modules + modules.user = { + vim.enable = false; + security.yubikey.enable = true; + + utils = { + dev.enable = true; + irc.enable = true; + writing.enable = true; + }; + + gui = { + wm.hyprland.enable = true; + browser.firefox.enable = true; + alacritty.enable = true; + corn.enable = true; + fun.enable = true; + utils.enable = true; + }; + }; + }; +} diff --git a/src/system/machines/desktop/system.nix b/system/machines/desktop/system.nix similarity index 100% rename from src/system/machines/desktop/system.nix rename to system/machines/desktop/system.nix diff --git a/src/system/machines/server/README.md b/system/machines/server/README.md similarity index 100% rename from src/system/machines/server/README.md rename to system/machines/server/README.md diff --git a/system/machines/server/default.nix b/system/machines/server/default.nix new file mode 100644 index 0000000..18bc85c --- /dev/null +++ b/system/machines/server/default.nix @@ -0,0 +1,14 @@ +{ inputs, ... }: + +{ + imports = [ + inputs.disko.nixosModules.disko + (import ./modules/disko) + inputs.home-manager.nixosModules.home-manager + (import ./modules/home-manager) + ../../../user + ../../keys + ./hardware.nix + ./system.nix + ]; +} diff --git a/src/system/machines/server/hardware.nix b/system/machines/server/hardware.nix similarity index 87% rename from src/system/machines/server/hardware.nix rename to system/machines/server/hardware.nix index fb45e7f..8e9e3c5 100644 --- a/src/system/machines/server/hardware.nix +++ b/system/machines/server/hardware.nix @@ -1,10 +1,7 @@ { config, lib, pkgs, modulesPath, ... }: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ./modules/disko - ]; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; boot = { initrd = { diff --git a/src/system/modules/backup/default.nix b/system/machines/server/modules/backup/default.nix similarity index 100% rename from src/system/modules/backup/default.nix rename to system/machines/server/modules/backup/default.nix diff --git a/src/system/modules/bitcoin/config/bitcoin.conf b/system/machines/server/modules/bitcoin/config/bitcoin.conf similarity index 100% rename from src/system/modules/bitcoin/config/bitcoin.conf rename to system/machines/server/modules/bitcoin/config/bitcoin.conf diff --git a/src/system/modules/bitcoin/default.nix b/system/machines/server/modules/bitcoin/default.nix similarity index 100% rename from src/system/modules/bitcoin/default.nix rename to system/machines/server/modules/bitcoin/default.nix diff --git a/src/system/modules/bitcoin/modules/clightning/config/lightning.conf b/system/machines/server/modules/bitcoin/modules/clightning/config/lightning.conf similarity index 100% rename from src/system/modules/bitcoin/modules/clightning/config/lightning.conf rename to system/machines/server/modules/bitcoin/modules/clightning/config/lightning.conf diff --git a/src/system/modules/bitcoin/modules/clightning/default.nix b/system/machines/server/modules/bitcoin/modules/clightning/default.nix similarity index 100% rename from src/system/modules/bitcoin/modules/clightning/default.nix rename to system/machines/server/modules/bitcoin/modules/clightning/default.nix diff --git a/src/system/modules/bitcoin/modules/clightning/plugins/clnrest.nix b/system/machines/server/modules/bitcoin/modules/clightning/plugins/clnrest.nix similarity index 100% rename from src/system/modules/bitcoin/modules/clightning/plugins/clnrest.nix rename to system/machines/server/modules/bitcoin/modules/clightning/plugins/clnrest.nix diff --git a/src/system/modules/bitcoin/modules/electrum/config/config.toml b/system/machines/server/modules/bitcoin/modules/electrum/config/config.toml similarity index 100% rename from src/system/modules/bitcoin/modules/electrum/config/config.toml rename to system/machines/server/modules/bitcoin/modules/electrum/config/config.toml diff --git a/src/system/modules/bitcoin/modules/electrum/default.nix b/system/machines/server/modules/bitcoin/modules/electrum/default.nix similarity index 100% rename from src/system/modules/bitcoin/modules/electrum/default.nix rename to system/machines/server/modules/bitcoin/modules/electrum/default.nix diff --git a/src/system/modules/default.nix b/system/machines/server/modules/default.nix similarity index 84% rename from src/system/modules/default.nix rename to system/machines/server/modules/default.nix index c8ecd1a..b34257d 100644 --- a/src/system/modules/default.nix +++ b/system/machines/server/modules/default.nix @@ -3,12 +3,14 @@ let let entries = builtins.readDir dir; names = builtins.attrNames entries; - + isModuleDir = path: builtins.pathExists path && builtins.readFileType path == "directory" && builtins.baseNameOf path != "config" && - builtins.baseNameOf path != "plugins"; + builtins.baseNameOf path != "plugins" && + builtins.baseNameOf path != "home-manager" && + builtins.baseNameOf path != "disko"; isModule = file: file == "default.nix"; isNix = file: builtins.match ".*\\.nix" file != null && file != "default.nix"; diff --git a/src/system/machines/server/modules/disko/default.nix b/system/machines/server/modules/disko/default.nix similarity index 100% rename from src/system/machines/server/modules/disko/default.nix rename to system/machines/server/modules/disko/default.nix diff --git a/src/system/modules/forgejo/default.nix b/system/machines/server/modules/forgejo/default.nix similarity index 100% rename from src/system/modules/forgejo/default.nix rename to system/machines/server/modules/forgejo/default.nix diff --git a/src/system/modules/frigate/README.md b/system/machines/server/modules/frigate/README.md similarity index 100% rename from src/system/modules/frigate/README.md rename to system/machines/server/modules/frigate/README.md diff --git a/src/system/modules/frigate/default.nix b/system/machines/server/modules/frigate/default.nix similarity index 93% rename from src/system/modules/frigate/default.nix rename to system/machines/server/modules/frigate/default.nix index 11c14d3..2dc454e 100644 --- a/src/system/modules/frigate/default.nix +++ b/system/machines/server/modules/frigate/default.nix @@ -20,7 +20,14 @@ in settings = { mqtt.enabled = false; # ffmpeg.hwaccel_args = "preset-vaapi"; # Disabled - camera uses HEVC which Haswell can't decode - record.enabled = true; + record = { + enabled = true; + # 24/7 recording - needs better hardware + # retain = { + # days = 14; + # mode = "all"; + # }; + }; cameras = { doorbell = { enabled = true; diff --git a/system/machines/server/modules/home-manager/default.nix b/system/machines/server/modules/home-manager/default.nix new file mode 100644 index 0000000..c3a558b --- /dev/null +++ b/system/machines/server/modules/home-manager/default.nix @@ -0,0 +1,23 @@ +{ config, ... }: + +{ + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.${config.user.name} = { + imports = [ + ../../../../../user + ../../../../../user/home.nix + ../../../../../user/modules + ]; + + home.stateVersion = "25.11"; + + # Machine-specific modules + modules.user = { + neovim.enable = false; + vim.enable = true; + tmux.enable = false; + utils.dev.enable = true; + }; + }; +} diff --git a/src/system/modules/immich/default.nix b/system/machines/server/modules/immich/default.nix similarity index 100% rename from src/system/modules/immich/default.nix rename to system/machines/server/modules/immich/default.nix diff --git a/src/system/modules/nginx/default.nix b/system/machines/server/modules/nginx/default.nix similarity index 100% rename from src/system/modules/nginx/default.nix rename to system/machines/server/modules/nginx/default.nix diff --git a/src/system/modules/tor/default.nix b/system/machines/server/modules/tor/default.nix similarity index 100% rename from src/system/modules/tor/default.nix rename to system/machines/server/modules/tor/default.nix diff --git a/system/machines/server/modules/webdav/default.nix b/system/machines/server/modules/webdav/default.nix new file mode 100644 index 0000000..1b90573 --- /dev/null +++ b/system/machines/server/modules/webdav/default.nix @@ -0,0 +1,69 @@ +{ pkgs, lib, config, ... }: + +with lib; +let + cfg = config.modules.system.webdav; + domain = "ramos.codes"; + +in +{ + options.modules.system.webdav = { + enable = mkEnableOption "WebDAV server for phone backups"; + + directory = mkOption { + type = types.path; + default = "/var/lib/seedvault"; + description = "Directory to store backups"; + }; + }; + + config = mkIf cfg.enable { + # Create backup directory + systemd.tmpfiles.rules = [ + "d ${cfg.directory} 0750 webdav webdav -" + ]; + + services.webdav = { + enable = true; + # Credentials in /var/lib/webdav/env: + # WEBDAV_USERNAME=seedvault + # WEBDAV_PASSWORD=your-secure-password + environmentFile = "/var/lib/webdav/env"; + settings = { + address = "127.0.0.1"; + port = 8090; + directory = cfg.directory; + behindProxy = true; + permissions = "CRUD"; # Create, Read, Update, Delete + users = [ + { + username = "{env}WEBDAV_USERNAME"; + password = "{env}WEBDAV_PASSWORD"; + } + ]; + }; + }; + + services.nginx.virtualHosts."backup.${domain}" = { + useACMEHost = domain; + forceSSL = true; + locations."/" = { + proxyPass = "http://127.0.0.1:8090"; + extraConfig = '' + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # WebDAV needs these + proxy_pass_request_headers on; + proxy_set_header Destination $http_destination; + + # Large file uploads for backups + client_max_body_size 0; + proxy_request_buffering off; + ''; + }; + }; + }; +} diff --git a/src/system/machines/server/system.nix b/system/machines/server/system.nix similarity index 98% rename from src/system/machines/server/system.nix rename to system/machines/server/system.nix index c290f9d..fe487f5 100644 --- a/src/system/machines/server/system.nix +++ b/system/machines/server/system.nix @@ -2,13 +2,14 @@ { system.stateVersion = "25.11"; - imports = [ ../../modules ]; + imports = [ ./modules ]; modules.system = { nginx.enable = true; forgejo.enable = true; frigate.enable = true; immich.enable = true; + webdav.enable = false; # bitcoin = { # enable = true; # electrum.enable = true; diff --git a/system/machines/wsl/default.nix b/system/machines/wsl/default.nix new file mode 100644 index 0000000..9c3065f --- /dev/null +++ b/system/machines/wsl/default.nix @@ -0,0 +1,13 @@ +{ inputs, ... }: + +{ + imports = [ + inputs.nixos-wsl.nixosModules.wsl + (import ./modules/wsl) + inputs.home-manager.nixosModules.home-manager + (import ./modules/home-manager) + ../../../user + ../../keys + ./system.nix + ]; +} diff --git a/src/system/machines/workstation/modules/home-manager/default.nix b/system/machines/wsl/modules/home-manager/default.nix similarity index 100% rename from src/system/machines/workstation/modules/home-manager/default.nix rename to system/machines/wsl/modules/home-manager/default.nix diff --git a/system/machines/wsl/modules/home-manager/home.nix b/system/machines/wsl/modules/home-manager/home.nix new file mode 100644 index 0000000..dc8a221 --- /dev/null +++ b/system/machines/wsl/modules/home-manager/home.nix @@ -0,0 +1,24 @@ +{ config, ... }: + +{ + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.${config.user.name} = { + imports = [ + ../../../../../user + ../../../../../user/home.nix + ../../../../../user/modules + ]; + + home.stateVersion = "23.11"; + + # Machine-specific modules + modules.user = { + utils = { + dev.enable = true; + email.enable = true; + irc.enable = true; + }; + }; + }; +} diff --git a/src/system/machines/wsl/modules/wsl/default.nix b/system/machines/wsl/modules/wsl/default.nix similarity index 100% rename from src/system/machines/wsl/modules/wsl/default.nix rename to system/machines/wsl/modules/wsl/default.nix diff --git a/src/system/machines/wsl/modules/wsl/wsl.nix b/system/machines/wsl/modules/wsl/wsl.nix similarity index 83% rename from src/system/machines/wsl/modules/wsl/wsl.nix rename to system/machines/wsl/modules/wsl/wsl.nix index e2a4ea8..8bf5fb5 100644 --- a/src/system/machines/wsl/modules/wsl/wsl.nix +++ b/system/machines/wsl/modules/wsl/wsl.nix @@ -1,12 +1,11 @@ { config, lib, ... }: { - imports = [ ../../../../../user/config ]; + imports = [ ../../../../../user ]; wsl = rec { enable = true; defaultUser = lib.mkDefault config.user.name; - nativeSystemd = true; useWindowsDriver = true; wslConf = { diff --git a/src/system/machines/wsl/system.nix b/system/machines/wsl/system.nix similarity index 100% rename from src/system/machines/wsl/system.nix rename to system/machines/wsl/system.nix diff --git a/user.configs b/user.configs deleted file mode 120000 index b1100ee..0000000 --- a/user.configs +++ /dev/null @@ -1 +0,0 @@ -src/user/config/ \ No newline at end of file diff --git a/src/user/config/bookmarks/default.nix b/user/bookmarks/default.nix similarity index 100% rename from src/user/config/bookmarks/default.nix rename to user/bookmarks/default.nix diff --git a/src/user/config/default.nix b/user/default.nix similarity index 85% rename from src/user/config/default.nix rename to user/default.nix index b539c79..bc4ddfa 100644 --- a/src/user/config/default.nix +++ b/user/default.nix @@ -1,10 +1,6 @@ -{ lib, pkgs, config, ... }: +{ lib, pkgs, ... }: with lib; -let - modules = config.modules.user; - -in { options = { user = mkOption { diff --git a/user/home.nix b/user/home.nix new file mode 100644 index 0000000..3603c8d --- /dev/null +++ b/user/home.nix @@ -0,0 +1,38 @@ +{ lib, pkgs, config, ... }: + +let + pass = pkgs.pass.withExtensions (exts: with exts; [ + pass-audit + pass-otp + pass-update + pass-tomb + ]); + +in +{ + programs.home-manager.enable = true; + + home.username = config.user.name; + home.homeDirectory = "/home/${config.user.name}"; + + # Essential packages for all users + home.packages = with pkgs; [ + pass + wget curl fastfetch fd + unzip zip rsync + calc calcurse + ]; + + programs.bash.shellAliases = { + cal = "${pkgs.calcurse}/bin/calcurse"; + calendar = "${pkgs.calcurse}/bin/calcurse"; + }; + + # Default modules for all users (machines can override with mkForce false) + modules.user = { + bash.enable = lib.mkDefault true; + git.enable = lib.mkDefault true; + neovim.enable = lib.mkDefault true; + security.gpg.enable = lib.mkDefault true; + }; +} diff --git a/src/user/config/keys/age/README.md b/user/keys/age/README.md similarity index 100% rename from src/user/config/keys/age/README.md rename to user/keys/age/README.md diff --git a/src/user/config/keys/age/yubikey.pub.key b/user/keys/age/yubikey.pub.key similarity index 100% rename from src/user/config/keys/age/yubikey.pub.key rename to user/keys/age/yubikey.pub.key diff --git a/src/system/config/keys/default.nix b/user/keys/default.nix similarity index 100% rename from src/system/config/keys/default.nix rename to user/keys/default.nix diff --git a/src/user/config/keys/pgp/README.md b/user/keys/pgp/README.md similarity index 100% rename from src/user/config/keys/pgp/README.md rename to user/keys/pgp/README.md diff --git a/src/user/config/keys/pgp/ccur.pub.key b/user/keys/pgp/ccur.pub.key similarity index 100% rename from src/user/config/keys/pgp/ccur.pub.key rename to user/keys/pgp/ccur.pub.key diff --git a/src/user/config/keys/pgp/work.pub.key b/user/keys/pgp/work.pub.key similarity index 100% rename from src/user/config/keys/pgp/work.pub.key rename to user/keys/pgp/work.pub.key diff --git a/src/user/config/keys/pgp/yubikey.pub.key b/user/keys/pgp/yubikey.pub.key similarity index 100% rename from src/user/config/keys/pgp/yubikey.pub.key rename to user/keys/pgp/yubikey.pub.key diff --git a/src/user/config/keys/ssh/README.md b/user/keys/ssh/README.md similarity index 100% rename from src/user/config/keys/ssh/README.md rename to user/keys/ssh/README.md diff --git a/src/user/config/keys/ssh/graphone.pub.key b/user/keys/ssh/graphone.pub.key similarity index 100% rename from src/user/config/keys/ssh/graphone.pub.key rename to user/keys/ssh/graphone.pub.key diff --git a/src/user/config/keys/ssh/work.pub.key b/user/keys/ssh/work.pub.key similarity index 100% rename from src/user/config/keys/ssh/work.pub.key rename to user/keys/ssh/work.pub.key diff --git a/src/user/config/keys/ssh/yubikey.pub.key b/user/keys/ssh/yubikey.pub.key similarity index 100% rename from src/user/config/keys/ssh/yubikey.pub.key rename to user/keys/ssh/yubikey.pub.key diff --git a/user/modules/bash/bash b/user/modules/bash/bash new file mode 160000 index 0000000..f670064 --- /dev/null +++ b/user/modules/bash/bash @@ -0,0 +1 @@ +Subproject commit f6700648a3186a1a1cc7d004df7ef14953272c81 diff --git a/src/user/modules/bash/default.nix b/user/modules/bash/default.nix similarity index 83% rename from src/user/modules/bash/default.nix rename to user/modules/bash/default.nix index 1dc7110..a1420a7 100644 --- a/src/user/modules/bash/default.nix +++ b/user/modules/bash/default.nix @@ -10,12 +10,10 @@ in programs.bash = { enable = true; initExtra = "source ~/.config/bash/bashrc"; - profileExtra = import ./config/shellHook.nix { inherit lib config; }; }; - - # .bashrc + home.file.".config/bash" = { - source = ./config/bash; + source = ./bash; recursive = true; }; diff --git a/src/user/default.nix b/user/modules/default.nix similarity index 80% rename from src/user/default.nix rename to user/modules/default.nix index ca18159..dc0f32a 100644 --- a/src/user/default.nix +++ b/user/modules/default.nix @@ -3,7 +3,7 @@ let let entries = builtins.readDir dir; names = builtins.attrNames entries; - + excludedDirs = [ "config" "scripts" ]; isSubmodule = path: builtins.pathExists "${path}/.git" && @@ -14,7 +14,6 @@ let !(builtins.elem (builtins.baseNameOf path) excludedDirs) && !(isSubmodule path); isModule = file: file == "default.nix"; - isNix = file: builtins.match ".*\\.nix" file != null && file != "default.nix"; in builtins.concatMap (name: @@ -25,15 +24,11 @@ let mkModules path false else if isModule name && !isRoot then [ dir ] - else if isNix name then - [ path ] else [] ) names; in { - imports = [ - ./config - ] ++ mkModules ./. true; + imports = mkModules ./. true; } diff --git a/src/user/modules/git/default.nix b/user/modules/git/default.nix similarity index 100% rename from src/user/modules/git/default.nix rename to user/modules/git/default.nix diff --git a/src/user/modules/git/git b/user/modules/git/git similarity index 100% rename from src/user/modules/git/git rename to user/modules/git/git diff --git a/src/user/modules/git/scripts/cdg.nix b/user/modules/git/scripts/cdg.nix similarity index 100% rename from src/user/modules/git/scripts/cdg.nix rename to user/modules/git/scripts/cdg.nix diff --git a/src/user/modules/gui/modules/alacritty/config/alacritty.nix b/user/modules/gui/alacritty/config/alacritty.nix similarity index 100% rename from src/user/modules/gui/modules/alacritty/config/alacritty.nix rename to user/modules/gui/alacritty/config/alacritty.nix diff --git a/src/user/modules/gui/modules/alacritty/default.nix b/user/modules/gui/alacritty/default.nix similarity index 100% rename from src/user/modules/gui/modules/alacritty/default.nix rename to user/modules/gui/alacritty/default.nix diff --git a/src/user/modules/gui/modules/browsers/chromium/default.nix b/user/modules/gui/browsers/chromium/default.nix similarity index 100% rename from src/user/modules/gui/modules/browsers/chromium/default.nix rename to user/modules/gui/browsers/chromium/default.nix diff --git a/src/user/modules/gui/modules/browsers/firefox/default.nix b/user/modules/gui/browsers/firefox/default.nix similarity index 100% rename from src/user/modules/gui/modules/browsers/firefox/default.nix rename to user/modules/gui/browsers/firefox/default.nix diff --git a/src/user/modules/gui/modules/corn/default.nix b/user/modules/gui/corn/default.nix similarity index 100% rename from src/user/modules/gui/modules/corn/default.nix rename to user/modules/gui/corn/default.nix diff --git a/user/modules/gui/default.nix b/user/modules/gui/default.nix new file mode 100644 index 0000000..6b9286c --- /dev/null +++ b/user/modules/gui/default.nix @@ -0,0 +1,30 @@ +{ lib, config, ... }: + +let + programs = config.programs; + + defaultBrowser = + if programs.firefox.enable then "firefox.desktop" + else if programs.brave.enable then "brave-browser.desktop" + else if programs.chromium.enable then "chromium.desktop" + else null; + + types = [ + "text/html" "application/xhtml+xml" + "x-scheme-handler/http" "x-scheme-handler/https" + "application/pdf" + "image/png" "image/jpeg" "image/jpg" "image/gif" + "image/webp" "image/avif" "image/bmp" "image/tiff" "image/svg+xml" + "video/mp4" "video/webm" "video/mkv" "video/avi" + "video/x-matroska" "video/quicktime" + ]; + +in +{ + xdg.mimeApps = lib.mkIf (defaultBrowser != null) { + enable = true; + defaultApplications = builtins.listToAttrs ( + map (t: { name = t; value = [ defaultBrowser ]; }) types + ); + }; +} diff --git a/user/modules/gui/dev/design/default.nix b/user/modules/gui/dev/design/default.nix new file mode 100644 index 0000000..392da8f --- /dev/null +++ b/user/modules/gui/dev/design/default.nix @@ -0,0 +1,14 @@ +{ pkgs, lib, config, ... }: + +with lib; +let + cfg = config.modules.user.gui.dev.design; + +in +{ options.modules.user.gui.dev.design = { enable = mkEnableOption "Enable design tools"; }; + config = mkIf cfg.enable { + home.packages = with pkgs; [ + penpot-desktop + ]; + }; +} diff --git a/src/user/modules/utils/modules/dev/modules/pcb/default.nix b/user/modules/gui/dev/pcb/default.nix similarity index 54% rename from src/user/modules/utils/modules/dev/modules/pcb/default.nix rename to user/modules/gui/dev/pcb/default.nix index a24fe8d..59d89d9 100644 --- a/src/user/modules/utils/modules/dev/modules/pcb/default.nix +++ b/user/modules/gui/dev/pcb/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.user.utils.dev.pcb; + cfg = config.modules.user.gui.dev.pcb; in -{ options.modules.user.utils.dev.pcb = { enable = mkEnableOption "Enable PCB development suite"; }; +{ options.modules.user.gui.dev.pcb = { enable = mkEnableOption "Enable PCB development suite"; }; config = mkIf cfg.enable { home.packages = with pkgs; [ arduino-ide diff --git a/src/user/modules/gui/modules/fun/config/discord.config.json b/user/modules/gui/fun/config/discord.config.json similarity index 100% rename from src/user/modules/gui/modules/fun/config/discord.config.json rename to user/modules/gui/fun/config/discord.config.json diff --git a/src/user/modules/gui/modules/fun/default.nix b/user/modules/gui/fun/default.nix similarity index 100% rename from src/user/modules/gui/modules/fun/default.nix rename to user/modules/gui/fun/default.nix diff --git a/src/user/modules/gui/modules/utils/default.nix b/user/modules/gui/utils/default.nix similarity index 100% rename from src/user/modules/gui/modules/utils/default.nix rename to user/modules/gui/utils/default.nix diff --git a/src/user/modules/gui/wm/hyprland/config/rofi/config/config.rasi b/user/modules/gui/wm/hyprland/config/rofi/config/config.rasi similarity index 100% rename from src/user/modules/gui/wm/hyprland/config/rofi/config/config.rasi rename to user/modules/gui/wm/hyprland/config/rofi/config/config.rasi diff --git a/src/user/modules/gui/wm/hyprland/config/rofi/config/material-ocean.rasi b/user/modules/gui/wm/hyprland/config/rofi/config/material-ocean.rasi similarity index 100% rename from src/user/modules/gui/wm/hyprland/config/rofi/config/material-ocean.rasi rename to user/modules/gui/wm/hyprland/config/rofi/config/material-ocean.rasi diff --git a/src/user/modules/gui/wm/hyprland/config/rofi/default.nix b/user/modules/gui/wm/hyprland/config/rofi/default.nix similarity index 100% rename from src/user/modules/gui/wm/hyprland/config/rofi/default.nix rename to user/modules/gui/wm/hyprland/config/rofi/default.nix diff --git a/src/user/modules/gui/wm/hyprland/config/waybar/config b/user/modules/gui/wm/hyprland/config/waybar/config similarity index 100% rename from src/user/modules/gui/wm/hyprland/config/waybar/config rename to user/modules/gui/wm/hyprland/config/waybar/config diff --git a/src/user/modules/gui/wm/hyprland/config/waybar/scripts/getBlock b/user/modules/gui/wm/hyprland/config/waybar/scripts/getBlock similarity index 100% rename from src/user/modules/gui/wm/hyprland/config/waybar/scripts/getBlock rename to user/modules/gui/wm/hyprland/config/waybar/scripts/getBlock diff --git a/src/user/modules/gui/wm/hyprland/config/waybar/scripts/getPrice b/user/modules/gui/wm/hyprland/config/waybar/scripts/getPrice similarity index 100% rename from src/user/modules/gui/wm/hyprland/config/waybar/scripts/getPrice rename to user/modules/gui/wm/hyprland/config/waybar/scripts/getPrice diff --git a/src/user/modules/gui/wm/hyprland/config/waybar/scripts/weather.sh b/user/modules/gui/wm/hyprland/config/waybar/scripts/weather.sh similarity index 100% rename from src/user/modules/gui/wm/hyprland/config/waybar/scripts/weather.sh rename to user/modules/gui/wm/hyprland/config/waybar/scripts/weather.sh diff --git a/src/user/modules/gui/wm/hyprland/config/waybar/style.css b/user/modules/gui/wm/hyprland/config/waybar/style.css similarity index 100% rename from src/user/modules/gui/wm/hyprland/config/waybar/style.css rename to user/modules/gui/wm/hyprland/config/waybar/style.css diff --git a/src/user/modules/gui/wm/hyprland/default.nix b/user/modules/gui/wm/hyprland/default.nix similarity index 93% rename from src/user/modules/gui/wm/hyprland/default.nix rename to user/modules/gui/wm/hyprland/default.nix index e57625a..d8c7aba 100644 --- a/src/user/modules/gui/wm/hyprland/default.nix +++ b/user/modules/gui/wm/hyprland/default.nix @@ -220,20 +220,27 @@ in platformTheme.name = "gtk"; }; - xdg = { - portal = { - enable = true; - extraPortals = with pkgs; [ - xdg-desktop-portal-hyprland - ]; - config.common.default = "*"; - }; + xdg.portal = { + enable = true; + extraPortals = with pkgs; [ + xdg-desktop-portal-hyprland + ]; + config.common.default = "*"; }; programs = { imv.enable = true; + mpv.enable = true; + zathura.enable = true; }; fonts.fontconfig.enable = true; + + # Auto-start Hyprland on tty1 + programs.bash.profileExtra = '' + if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then + exec Hyprland + fi + ''; }; } diff --git a/src/user/modules/gui/wm/i3/config/rofi/config/config.rasi b/user/modules/gui/wm/sway/config/rofi/config/config.rasi similarity index 100% rename from src/user/modules/gui/wm/i3/config/rofi/config/config.rasi rename to user/modules/gui/wm/sway/config/rofi/config/config.rasi diff --git a/src/user/modules/gui/wm/i3/config/rofi/config/material-ocean.rasi b/user/modules/gui/wm/sway/config/rofi/config/material-ocean.rasi similarity index 100% rename from src/user/modules/gui/wm/i3/config/rofi/config/material-ocean.rasi rename to user/modules/gui/wm/sway/config/rofi/config/material-ocean.rasi diff --git a/src/user/modules/gui/wm/i3/config/rofi/default.nix b/user/modules/gui/wm/sway/config/rofi/default.nix similarity index 100% rename from src/user/modules/gui/wm/i3/config/rofi/default.nix rename to user/modules/gui/wm/sway/config/rofi/default.nix diff --git a/src/user/modules/gui/wm/sway/default.nix b/user/modules/gui/wm/sway/default.nix similarity index 96% rename from src/user/modules/gui/wm/sway/default.nix rename to user/modules/gui/wm/sway/default.nix index d06dc2c..f0d297b 100644 --- a/src/user/modules/gui/wm/sway/default.nix +++ b/user/modules/gui/wm/sway/default.nix @@ -173,5 +173,12 @@ in }; fonts.fontconfig.enable = true; + + # Auto-start sway on tty1 + programs.bash.profileExtra = '' + if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then + exec sway + fi + ''; }; } diff --git a/src/user/modules/utils/modules/neovim/.luarc.json b/user/modules/neovim/.luarc.json similarity index 100% rename from src/user/modules/utils/modules/neovim/.luarc.json rename to user/modules/neovim/.luarc.json diff --git a/src/user/modules/utils/modules/neovim/default.nix b/user/modules/neovim/default.nix similarity index 55% rename from src/user/modules/utils/modules/neovim/default.nix rename to user/modules/neovim/default.nix index 9b0c478..9a90d08 100644 --- a/src/user/modules/utils/modules/neovim/default.nix +++ b/user/modules/neovim/default.nix @@ -2,21 +2,21 @@ with lib; let - cfg = config.modules.user.utils.neovim; + cfg = config.modules.user.neovim; in -{ options.modules.user.utils.neovim = { enable = mkEnableOption "user.utils.neovim"; }; +{ options.modules.user.neovim = { enable = mkEnableOption "user.neovim"; }; config = mkIf cfg.enable { programs.neovim = { enable = true; defaultEditor = true; vimAlias = true; vimdiffAlias = true; - extraPackages = import ./config/pkgs.nix { inherit pkgs; }; + extraPackages = import ./pkgs.nix { inherit pkgs; }; }; home.file.".config/nvim" = { - source = ./config/nvim; + source = ./nvim; recursive = true; }; }; diff --git a/src/user/modules/utils/modules/neovim/config/nvim b/user/modules/neovim/nvim similarity index 100% rename from src/user/modules/utils/modules/neovim/config/nvim rename to user/modules/neovim/nvim diff --git a/src/user/modules/utils/modules/neovim/config/pkgs.nix b/user/modules/neovim/pkgs.nix similarity index 95% rename from src/user/modules/utils/modules/neovim/config/pkgs.nix rename to user/modules/neovim/pkgs.nix index 35b1e0d..04dcd86 100644 --- a/src/user/modules/utils/modules/neovim/config/pkgs.nix +++ b/user/modules/neovim/pkgs.nix @@ -6,7 +6,7 @@ let nixd lua-language-server marksman - taplo # TOML + taplo ]; lsp' = with pkgs.nodePackages; [ diff --git a/src/user/modules/security/modules/gpg/default.nix b/user/modules/security/gpg/default.nix similarity index 97% rename from src/user/modules/security/modules/gpg/default.nix rename to user/modules/security/gpg/default.nix index 1751008..4863337 100644 --- a/src/user/modules/security/modules/gpg/default.nix +++ b/user/modules/security/gpg/default.nix @@ -43,7 +43,7 @@ in if gui.enable then pkgs.pinentry-gnome3 else - pkgs.pinentry-curses; + pkgs.pinentry-tty; }; }; } diff --git a/user/modules/security/yubikey/default.nix b/user/modules/security/yubikey/default.nix new file mode 100644 index 0000000..62f3ead --- /dev/null +++ b/user/modules/security/yubikey/default.nix @@ -0,0 +1,16 @@ +{ pkgs, lib, config, ... }: + +with lib; +let + cfg = config.modules.user.security.yubikey; + +in +{ options.modules.user.security.yubikey = { enable = mkEnableOption "Enable Yubikey support"; }; + config = mkIf cfg.enable { + home.packages = with pkgs; [ + yubikey-manager + age-plugin-yubikey + yubico-piv-tool + ]; + }; +} diff --git a/src/user/modules/tmux/config/tmux.nix b/user/modules/tmux/config/tmux.nix similarity index 100% rename from src/user/modules/tmux/config/tmux.nix rename to user/modules/tmux/config/tmux.nix diff --git a/src/user/modules/tmux/default.nix b/user/modules/tmux/default.nix similarity index 74% rename from src/user/modules/tmux/default.nix rename to user/modules/tmux/default.nix index a376258..f3eff8d 100644 --- a/src/user/modules/tmux/default.nix +++ b/user/modules/tmux/default.nix @@ -33,5 +33,12 @@ in extraConfig = import ./config/tmux.nix; }; + + # Auto-start tmux only on local TTY (not SSH, not in tmux already) + programs.bash.profileExtra = mkIf (!wm.enable) '' + if [[ $- == *i* ]] && [ -z "$DISPLAY" ] && [ -z "$TMUX" ] && [ -z "$SSH_TTY" ] && [ -z "$SSH_CONNECTION" ]; then + exec tmux + fi + ''; }; } diff --git a/src/user/modules/utils/modules/dev/default.nix b/user/modules/utils/dev/default.nix similarity index 91% rename from src/user/modules/utils/modules/dev/default.nix rename to user/modules/utils/dev/default.nix index 1fdb8bd..102807c 100644 --- a/src/user/modules/utils/modules/dev/default.nix +++ b/user/modules/utils/dev/default.nix @@ -18,6 +18,12 @@ in qrencode docker + + # Network/system tools + fping + wireguard-tools + pciutils + lshw ] ++ optionals (osConfig.virtualisation.libvirtd.enable) [ virt-manager ]; diff --git a/src/user/modules/utils/modules/email/config/aerc.conf b/user/modules/utils/email/config/aerc.conf similarity index 100% rename from src/user/modules/utils/modules/email/config/aerc.conf rename to user/modules/utils/email/config/aerc.conf diff --git a/src/user/modules/utils/modules/email/config/binds.conf b/user/modules/utils/email/config/binds.conf similarity index 100% rename from src/user/modules/utils/modules/email/config/binds.conf rename to user/modules/utils/email/config/binds.conf diff --git a/src/user/modules/utils/modules/email/default.nix b/user/modules/utils/email/default.nix similarity index 100% rename from src/user/modules/utils/modules/email/default.nix rename to user/modules/utils/email/default.nix diff --git a/src/user/modules/utils/modules/irc/default.nix b/user/modules/utils/irc/default.nix similarity index 100% rename from src/user/modules/utils/modules/irc/default.nix rename to user/modules/utils/irc/default.nix diff --git a/src/user/modules/gui/modules/writing/default.nix b/user/modules/utils/writing/default.nix similarity index 53% rename from src/user/modules/gui/modules/writing/default.nix rename to user/modules/utils/writing/default.nix index 664d5fe..5d83096 100644 --- a/src/user/modules/gui/modules/writing/default.nix +++ b/user/modules/utils/writing/default.nix @@ -2,16 +2,15 @@ with lib; let - cfg = config.modules.user.gui.writing; + cfg = config.modules.user.utils.writing; in -{ options.modules.user.gui.writing = { enable = mkEnableOption "Enable writing tools"; }; +{ options.modules.user.utils.writing = { enable = mkEnableOption "Enable writing tools"; }; config = mkIf cfg.enable { home.packages = with pkgs; [ mdbook pandoc asciidoctor - evince ]; }; } diff --git a/src/user/modules/utils/modules/vim/default.nix b/user/modules/vim/default.nix similarity index 72% rename from src/user/modules/utils/modules/vim/default.nix rename to user/modules/vim/default.nix index 61cafa1..68aed8a 100644 --- a/src/user/modules/utils/modules/vim/default.nix +++ b/user/modules/vim/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.modules.user.utils.vim; + cfg = config.modules.user.vim; in -{ options.modules.user.utils.vim = { enable = mkEnableOption "user.utils.vim"; }; +{ options.modules.user.vim = { enable = mkEnableOption "user.vim"; }; config = mkIf cfg.enable { programs.bash.shellAliases = { vi = "${pkgs.vim}/bin/vim"; diff --git a/user/modules/vim/vim b/user/modules/vim/vim new file mode 160000 index 0000000..e5ff26b --- /dev/null +++ b/user/modules/vim/vim @@ -0,0 +1 @@ +Subproject commit e5ff26b6f6ec9b8e9f8737dc5418d6a64a68ec4b