nix

configuration files that power my machines
Log | Files | Refs | README | LICENSE

commit 8a8e0cca4c4eb24ca91d11a7b573c2e2d0a561c6
parent fc28fb2da18ebefae704c686a9414ad46e00b686
Author: mtmn <miro@haravara.org>
Date:   Sun, 19 Apr 2026 18:24:22 +0200

chore: cleanup

Diffstat:
Mflake.nix | 31++++++++++++-------------------
Mhome.nix | 9+--------
Mhosts.nix | 34++++++----------------------------
Mhosts/proton/default.nix | 295+++++++++++++++++++++++++++++--------------------------------------------------
Mhosts/wsl/default.nix | 129+++++++++++++++++--------------------------------------------------------------
Alib/nix-cache.nix | 10++++++++++
Amodules/mixins/core/default.nix | 66++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mmodules/nixos/base.nix | 9+--------
8 files changed, 233 insertions(+), 350 deletions(-)

diff --git a/flake.nix b/flake.nix @@ -49,6 +49,7 @@ } @ inputs: let inherit (nixpkgs) lib; configData = import ./hosts.nix; + defaultUsername = builtins.head (builtins.attrNames configData.users); specialArgs = { inherit inputs self configData; @@ -56,25 +57,13 @@ nixosConfigurations = lib.mapAttrs (hostName: host: let hostDir = ./hosts/${hostName}; - username = host.username or "miro"; + username = host.username or defaultUsername; in lib.nixosSystem { specialArgs = specialArgs // {inherit username;}; modules = [ - { - nixpkgs.hostPlatform = host.system; - nix.settings = { - substituters = [ - "https://cache.nixos.org" - "https://nix-community.cachix.org" - ]; - trusted-public-keys = [ - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - }; - } + {nixpkgs.hostPlatform = host.system;} inputs.ragenix.nixosModules.default (hostDir + "/configuration.nix") ] @@ -87,21 +76,25 @@ (lib.filterAttrs (_: host: host.nixos or false) configData.hosts); homeConfigurations = lib.concatMapAttrs (userName: user: - lib.mapAttrs' (hostName: config: let + lib.mapAttrs' (hostName: _: let host = configData.hosts.${hostName}; username = host.username or userName; homeDirectory = if lib.hasInfix "darwin" host.system then "/Users/${username}" else "/home/${username}"; + hostDir = host.hostDir or hostName; in lib.nameValuePair "${username}@${hostName}" ( home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.${host.system}; extraSpecialArgs = specialArgs // {inherit username homeDirectory;}; - modules = - [./home.nix] - ++ (config.pkgSets or []); + modules = [ + ./home.nix + ./modules/mixins/dotfiles + ./hosts/${hostDir}/overlays + ./hosts/${hostDir} + ]; } )) user.configs) @@ -109,7 +102,7 @@ deployNodes = lib.mapAttrs (hostName: host: let - username = host.username or "miro"; + username = host.username or defaultUsername; in { hostname = host.hostname or hostName; sshUser = host.sshUser or username; diff --git a/home.nix b/home.nix @@ -41,14 +41,7 @@ auto-optimise-store = true; warn-dirty = false; experimental-features = ["nix-command" "flakes"]; - substituters = [ - "https://cache.nixos.org" - "https://nix-community.cachix.org" - ]; - trusted-public-keys = [ - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; + inherit (import ./lib/nix-cache.nix) substituters trusted-public-keys; }; gc = { automatic = true; diff --git a/hosts.nix b/hosts.nix @@ -15,11 +15,13 @@ DESKTOP-0A5N7UT = { system = "x86_64-linux"; hostname = "DESKTOP-0A5N7UT"; + hostDir = "wsl"; }; SK-M4KCG42FV9 = { system = "aarch64-darwin"; username = "miroslav.toman"; hostname = "SK-M4KCG42FV9"; + hostDir = "work"; }; }; users = { @@ -29,34 +31,10 @@ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILJH1fGikWCKXpp0RUqagYbAfpmDcVeAKUyYBTxoyLop" ]; configs = { - void = { - pkgSets = [ - ./modules/mixins/dotfiles - ./hosts/void/overlays - ./hosts/void - ]; - }; - proton = { - pkgSets = [ - ./modules/mixins/dotfiles - ./hosts/proton/overlays - ./hosts/proton - ]; - }; - DESKTOP-0A5N7UT = { - pkgSets = [ - ./modules/mixins/dotfiles - ./hosts/wsl/overlays - ./hosts/wsl - ]; - }; - SK-M4KCG42FV9 = { - pkgSets = [ - ./modules/mixins/dotfiles - ./hosts/work/overlays - ./hosts/work - ]; - }; + void = {}; + proton = {}; + DESKTOP-0A5N7UT = {}; + SK-M4KCG42FV9 = {}; }; }; }; diff --git a/hosts/proton/default.nix b/hosts/proton/default.nix @@ -1,179 +1,6 @@ -{pkgs, ...}: let - core = with pkgs; [ - bat - eza - fd - fzf - neovim - ripgrep - moor - tmux - ncurses - tree-sitter - unzip - zoxide - pass - passExtensions.pass-otp - ]; +{pkgs, ...}: { + imports = [../../modules/mixins/core]; - utils = with pkgs; [ - borgbackup - fdupes - gocryptfs - inotify-tools - ncdu - restic - ansible - ansible-lint - awscli2 - hadolint - woodpecker-cli - tealdeer - libvarlink - bandit - ruff - shellcheck - shfmt - sops - zls - ]; - - data = with pkgs; [ - duckdb - gron - jaq - jless - jq - pandoc - slop - taplo - ]; - - vcs = with pkgs; [ - difftastic - git - git-bug - git-crypt - git-absorb - git-filter-repo - gitleaks - jujutsu - jjui - prek - ]; - - nix_tools = with pkgs; [ - alejandra - comma - deadnix - deploy-rs - nh - nil - nix-du - nixd - nixfmt - nixos-anywhere - nvd - ragenix - statix - ]; - - net_tools = with pkgs; [ - bore-cli - caddy - chisel - curl - dnscontrol - dnsmasq - hurl - inetutils - knot-dns - lftp - monolith - mosh - mosquitto - net-tools - newsraft - nmap - offpunk - rclone - rsync - sshfs - thrift - trickle - w3m - websocat - wget - whois - xh - ]; - - build_tools = with pkgs; [ - libgcc - bear - bmake - boost - clang - cmake - ctags - entr - just - act - lld - lldb - llvm - meson - mold - ninja - tre - libtermkey - ]; - - perf_utils = with pkgs; [ - bpftools - bpftrace - bpfmon - bpftop - libbpf - below - hyperfine - iotop - pwru - gdb - strace - perf - valgrind - aflplusplus - ]; - - beam28 = with pkgs.beam28Packages; [ - erlang - expert - rebar3 - ]; - - all = with pkgs; [ - babashka - biome - gleam - luaPackages.fennel - luaPackages.lpeg - fnlfmt - luarocks - bun - clj-kondo - clojure - gemini-cli-bin - qwen-code - deno - dune - go - gopls - leiningen - ocaml - # purescript - ]; -in { programs.git = { enable = true; ignores = [ @@ -184,15 +11,111 @@ in { ]; }; - home.packages = - core - ++ utils - ++ data - ++ vcs - ++ nix_tools - ++ net_tools - ++ build_tools - ++ perf_utils - ++ beam28 - ++ all; + home.packages = with pkgs; + [ + # core + bat + eza + fd + fzf + neovim + ripgrep + moor + tmux + ncurses + tree-sitter + unzip + zoxide + pass + passExtensions.pass-otp + + # utils + borgbackup + fdupes + gocryptfs + inotify-tools + ncdu + restic + tealdeer + libvarlink + bandit + ruff + shellcheck + shfmt + sops + zls + + # data (extras beyond dev mixin) + slop + + # vcs (extras beyond dev mixin) + git + + # net (extras beyond dev mixin) + caddy + chisel + dnscontrol + dnsmasq + knot-dns + monolith + trickle + w3m + + # build + libgcc + bear + bmake + boost + clang + cmake + ctags + entr + just + act + lld + lldb + llvm + meson + mold + ninja + tre + libtermkey + + # perf + bpftools + bpftrace + bpfmon + bpftop + libbpf + below + hyperfine + iotop + pwru + gdb + strace + perf + valgrind + aflplusplus + ] + ++ (with pkgs.beam28Packages; [erlang expert rebar3]) + ++ (with pkgs; [ + babashka + biome + gleam + fnlfmt + luarocks + bun + clj-kondo + clojure + gemini-cli-bin + qwen-code + deno + dune + go + gopls + leiningen + ocaml + # purescript + ]) + ++ (with pkgs.luaPackages; [fennel lpeg]); } diff --git a/hosts/wsl/default.nix b/hosts/wsl/default.nix @@ -1,8 +1,9 @@ -{pkgs, ...}: let - inherit (pkgs) lib; +{pkgs, ...}: { + imports = [../../modules/mixins/core]; - parts = { - utils = with pkgs; [ + home.packages = with pkgs; + [ + # utils eza zoxide fzf @@ -23,135 +24,58 @@ buf harper duc - ]; - media = - (with pkgs; [ - ncmpcpp - sacad - ffmpeg - yt-dlp - imagemagick - exiftool - ]) - ++ (with pkgs.python314Packages; [ - yt-dlp-ejs - ]); + # media + ncmpcpp + sacad + ffmpeg + yt-dlp + imagemagick + exiftool - ops = with pkgs; [ - ansible-lint - ansible - awscli2 + # ops (extras beyond dev mixin) dnscontrol - woodpecker-cli podman skopeo tenv - ]; - lsp = with pkgs; [ + # lsp typescript-language-server ansible-language-server clang-tools gopls nixd zls - ]; - data = with pkgs; [ - duckdb - jless - jaq - jq + # data (extras beyond dev mixin) datasette tokyocabinet - ]; - haskell = - (with pkgs.haskell.compiler; [ - ghc9124 - ]) - ++ (with pkgs.haskellPackages; [ - Cabal_3_16_1_0 - stack - purescript - purenix - ]) - ++ (with pkgs; [ - cabal2nix - ]); - - vcs = with pkgs; [ - difftastic - git-bug - git-crypt - git-absorb + # vcs (extras beyond dev mixin) git-annex - gitleaks lazygit - jujutsu - jjui - prek - ]; - nix = with pkgs; [ - alejandra - comma - deadnix - nh - nix-du - nixos-anywhere - nvd - ragenix - statix + # nix (extras beyond dev mixin) nix-diff nix-output-monitor niv - ]; - net = with pkgs; [ - bore-cli - curl - inetutils - lftp - mosh - mosquitto - net-tools - nmap - rclone - rsync - sshfs - thrift + # net (extras beyond dev mixin) trickle - websocat - wget - xh - ]; - web = with pkgs; [ + # web aerc offpunk monolith newsraft vdirsyncer - ]; - llm = with pkgs; [ + # llm qwen-code gemini-cli-bin claude-code-bin - ]; - - lua = - (with pkgs.luaPackages; [ - fennel - lua - ]) - ++ (with pkgs; [ - fnlfmt - ]); - other = with pkgs; [ + # other miniserve babashka feather @@ -159,8 +83,11 @@ nodejs picard rustup - ]; - }; -in { - home.packages = lib.concatLists (lib.attrValues parts); + fnlfmt + ] + ++ (with pkgs.python314Packages; [yt-dlp-ejs]) + ++ (with pkgs.haskell.compiler; [ghc9124]) + ++ (with pkgs.haskellPackages; [Cabal_3_16_1_0 stack purescript purenix]) + ++ [pkgs.cabal2nix] + ++ (with pkgs.luaPackages; [fennel lua]); } diff --git a/lib/nix-cache.nix b/lib/nix-cache.nix @@ -0,0 +1,10 @@ +{ + substituters = [ + "https://cache.nixos.org" + "https://nix-community.cachix.org" + ]; + trusted-public-keys = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; +} diff --git a/modules/mixins/core/default.nix b/modules/mixins/core/default.nix @@ -0,0 +1,66 @@ +{pkgs, ...}: { + home.packages = with pkgs; [ + # nix + alejandra + comma + deadnix + deploy-rs + nh + nil + nix-du + nixd + nixfmt + nixos-anywhere + nvd + ragenix + statix + + # vcs + difftastic + git-bug + git-crypt + git-absorb + git-filter-repo + gitleaks + jujutsu + jjui + prek + + # data + duckdb + gron + jaq + jless + jq + pandoc + taplo + + # ops + ansible + ansible-lint + awscli2 + hadolint + woodpecker-cli + + # net + bore-cli + curl + hurl + inetutils + lftp + mosh + mosquitto + net-tools + newsraft + nmap + offpunk + rclone + rsync + sshfs + thrift + websocat + wget + whois + xh + ]; +} diff --git a/modules/nixos/base.nix b/modules/nixos/base.nix @@ -10,14 +10,7 @@ experimental-features = ["nix-command" "flakes"]; auto-optimise-store = true; trusted-users = ["root" "@wheel"]; - substituters = [ - "https://cache.nixos.org" - "https://nix-community.cachix.org" - ]; - trusted-public-keys = [ - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; + inherit (import ../../lib/nix-cache.nix) substituters trusted-public-keys; }; gc = { automatic = true;