From c86ee98def71719867b8dc47e9a6b556df19cd28 Mon Sep 17 00:00:00 2001 From: 4DBug Date: Wed, 21 Oct 2026 04:52:51 -0500 Subject: [PATCH] push --- README.md | 90 +------- flake.lock | 201 +++++++++++++++++- flake.nix | 4 + modules/hosts/default.nix | 5 - modules/roles.nix | 3 + modules/services/attic.nix | 26 +++ modules/services/gitea-runner.nix | 19 ++ modules/services/mailserver.nix | 4 +- modules/services/redlib.nix | 74 +++++++ .../software/browsers/librewolf/default.nix | 11 +- modules/software/cad/magica.nix | 60 ++++++ modules/software/gaming/warcraft/_addons.nix | 42 ++++ modules/software/gaming/warcraft/default.nix | 41 ++++ modules/system/base/kernel.nix | 3 +- 14 files changed, 472 insertions(+), 111 deletions(-) create mode 100644 modules/services/attic.nix create mode 100644 modules/services/gitea-runner.nix create mode 100644 modules/services/redlib.nix create mode 100644 modules/software/cad/magica.nix create mode 100644 modules/software/gaming/warcraft/_addons.nix create mode 100644 modules/software/gaming/warcraft/default.nix diff --git a/README.md b/README.md index e6147b5..e608d83 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,9 @@ modules are automatically discovered via [import-tree](https://github.com/vic/im ``` modules/ -├── system/ # OS fundamentals (base, desktop, audio, graphics, network, theme, janitor, ...) -├── services/ # self-hosted services (searxng, gitea, copyparty, cloudflared, ...) -├── software// # user software; each folder is one aspect: every file (one per software) adds to den.aspects.software. -├── software/.nix # single-file categories are flattened to one file +├── system/ # os fundamentals +├── services/ # self-hosted services +├── software/ # user software ├── roles.nix # den.aspects.desktop / den.aspects.server bundles ├── hosts/ │ ├── default.nix # den.default (every host) @@ -24,47 +23,6 @@ modules/ └── users/ # user accounts ``` -aspects are nested by path, e.g. `den.aspects.software.browsers`, `den.aspects.system.network.dns`. - -- **den.default** (`hosts/default.nix`) is applied to every host automatically — no need to include it. It also reaches standalone `den.homes`, so host-only aspects (catppuccin, janitor) are wrapped in a `({ host, ... }: ...)` include. -- **host attrs** (`hosts/common.nix` shared, `hosts/.nix` per host): `domain`, `users`, optional `cloudflared = { uuid; protocol; }`. Read them in aspects via `{ host, ... }`. -- **unfree** is allowed per aspect: `includes = [ (den.batteries.unfree [ "steam" ]) ];`. - -### adding an app - -drop a file in `modules/software//` (or edit `modules/software/.nix`; turn it into a folder once it holds 2+ files) contributing to `den.aspects.software.` (new category: also add it to `roles.nix`). - -### adding a flake input - -`flake.nix` is generated by [flake-file](https://github.com/vic/flake-file) — don't edit it. declare the input in the module that uses it: - -```nix -{ inputs, ... }: { - flake-file.inputs.foo = { - url = "github:owner/foo"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - den.aspects.software.cli.nixos.imports = [ inputs.foo.nixosModules.default ]; -} -``` - -then run `nix run .#write-flake` (and `nix flake lock`). core inputs (den, flake-parts, nixpkgs, home-manager, ...) live in `modules/den.nix`. - -### adding a hosted service - -declare a `tunnel` quirk on the aspect; `services.cloudflared` collects them into ingress rules for `.`: - -```nix -den.aspects.services.foo = let port = 8080; in { - tunnel = { subdomain = "foo"; inherit port; }; # or a list of them - nixos.services.foo = { enable = true; inherit port; }; -}; -``` - -then include `services.foo` (and `services.cloudflared`) in the host, which needs `cloudflared.uuid` set in `modules/hosts/.nix`. - ---- - ## hosts | Host | Role | GPU | Switch Command | @@ -72,45 +30,3 @@ then include `services.foo` (and `services.cloudflared`) in the host, which need | `nix` | desktop | nvidia | `nh os switch ~/nix --impure -H nix` | | `styx` | laptop | amd | `nh os switch ~/nix --impure -H styx` | | `box` | homeserver | — | `nh os switch ~/nix --impure -H box` | - ---- - -## self-hosted services - -all services on `box` are proxied through cloudflared tunnels to `*.bug.tools`. - -| Service | URL | Description | -|---------|-----|-------------| -| [searxng](https://github.com/searxng/searxng) | [search.bug.tools](https://search.bug.tools) | Privacy-respecting metasearch engine | -| [copyparty](https://github.com/9001/copyparty) | [files.bug.tools](https://files.bug.tools) | File server / uploader | -| [gitea](https://gitea.io/) | [git.bug.tools](https://git.bug.tools) | Self-hosted Git with org mirrors | -| [glances](https://github.com/nicolargo/glances) | [monitor.bug.tools](https://monitor.bug.tools) | System monitoring | -| [nixos-mailserver](https://gitlab.com/simple-nixos-mailserver/nixos-mailserver) | [mail.bug.tools](https://mail.bug.tools) | Email server | -| [invidious](https://github.com/iv-org/invidious) | [tube.bug.tools](https://tube.bug.tools) | YouTube frontend *(disabled)* | -| [matrix](https://matrix.org/) | [matrix.bug.tools](https://matrix.bug.tools) | Matrix homeserver *(disabled)* | -| [sish](https://docs.ssi.sh/) | [tuns.bug.tools](https://tuns.bug.tools) | SSH tunnels *(disabled)* | -| vscode-server | — | Remote VS Code access | - ---- - -## flake inputs - -| Input | Purpose | -|-------|---------| -| [nixpkgs](https://github.com/nixos/nixpkgs) (unstable) | Package set | -| [home-manager](https://github.com/nix-community/home-manager) | User environment management | -| [flake-parts](https://github.com/hercules-ci/flake-parts) | Flake structure | -| [den](https://github.com/vic/den) | Dendritic aspect system | -| [import-tree](https://github.com/vic/import-tree) | Auto module discovery | -| [stylix](https://github.com/nix-community/stylix) | System-wide theming | -| [catppuccin/nix](https://github.com/catppuccin/nix) | Catppuccin theme modules | -| [nixcord](https://github.com/FlameFlag/nixcord) | Declarative Vesktop/Discord | -| [nix-flatpak](https://github.com/gmodena/nix-flatpak) | Declarative Flatpak | -| [copyparty](https://github.com/9001/copyparty) | File server | - ---- - -## TODO -fix matrix server -fix invidious instance -configure cosmic with home diff --git a/flake.lock b/flake.lock index e589d9b..cd89383 100644 --- a/flake.lock +++ b/flake.lock @@ -145,11 +145,11 @@ ] }, "locked": { - "lastModified": 1792316519, - "narHash": "sha256-NAygGouWJZoUmSCFJk9vSZZeXdl7PYxp/p5BmJZKpng=", + "lastModified": 1792468893, + "narHash": "sha256-9XQ/VDzsmSaPWSdLm4svLHlgIKKctKkZq5eJ0Mp/H8g=", "ref": "refs/heads/main", - "rev": "b72ffd51550dabe8277357954dd1791884e73a8d", - "revCount": 2180, + "rev": "a460b022208f13663c225eb282da1707cfe987e4", + "revCount": 2315, "type": "git", "url": "https://git.bug.tools/bug/userstyles" }, @@ -318,6 +318,22 @@ "type": "github" } }, + "flake-compat_6": { + "flake": false, + "locked": { + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "NixOS", + "repo": "flake-compat", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "flake-compat", + "type": "github" + } + }, "flake-file": { "locked": { "lastModified": 1791955343, @@ -390,6 +406,42 @@ } }, "flake-parts_4": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_3" + }, + "locked": { + "lastModified": 1787559586, + "narHash": "sha256-onL0VLf9vPllmT0H/OlURIU5r5t5WIEl7t4tVNKT0Nw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9d0d87172c374f89da73c1cfe6d81ae62feac1f1", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_5": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_4" + }, + "locked": { + "lastModified": 1787559586, + "narHash": "sha256-onL0VLf9vPllmT0H/OlURIU5r5t5WIEl7t4tVNKT0Nw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9d0d87172c374f89da73c1cfe6d81ae62feac1f1", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_6": { "inputs": { "nixpkgs-lib": [ "stylix", @@ -410,9 +462,9 @@ "type": "github" } }, - "flake-parts_5": { + "flake-parts_7": { "inputs": { - "nixpkgs-lib": "nixpkgs-lib_3" + "nixpkgs-lib": "nixpkgs-lib_5" }, "locked": { "lastModified": 1772408722, @@ -521,6 +573,29 @@ } }, "git-hooks_2": { + "inputs": { + "flake-compat": "flake-compat_5", + "nixpkgs": [ + "nix-warcraft", + "proton-ge-nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1787424939, + "narHash": "sha256-O2tBn84NNuHrnqNVxx/XqsXwfYvS1YwBh+7CBnbCYsk=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "809414f0cdadf82cf11b06c2b29ba9b3168b3297", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "git-hooks_3": { "inputs": { "flake-compat": [ "nixos-mailserver", @@ -921,6 +996,28 @@ "type": "github" } }, + "nix-warcraft": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "proton-ge-nix": "proton-ge-nix" + }, + "locked": { + "lastModified": 1792398868, + "narHash": "sha256-jWMeCYb3zRIaFTq8Up39exGIBQeLbT/vKGKmY9V5aH8=", + "owner": "raccube", + "repo": "nix-warcraft", + "rev": "be646d2446fbe918715b74c02ccda3846b0cd9d5", + "type": "github" + }, + "original": { + "owner": "raccube", + "ref": "amirdrassil", + "repo": "nix-warcraft", + "type": "github" + } + }, "nixcord": { "inputs": { "home-manager": "home-manager_2", @@ -947,8 +1044,8 @@ "nixos-mailserver": { "inputs": { "blobs": "blobs", - "flake-compat": "flake-compat_5", - "git-hooks": "git-hooks_2", + "flake-compat": "flake-compat_6", + "git-hooks": "git-hooks_3", "nixpkgs": "nixpkgs_13" }, "locked": { @@ -1038,6 +1135,36 @@ } }, "nixpkgs-lib_3": { + "locked": { + "lastModified": 1785031560, + "narHash": "sha256-OmshNvn2vupOFpYinLUu+1Dnpu4n7Q5N3ggGVNHpkUI=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "0e79af5e3d4dcfcd676ab5ba3f95d2e3352e078c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-lib_4": { + "locked": { + "lastModified": 1785031560, + "narHash": "sha256-OmshNvn2vupOFpYinLUu+1Dnpu4n7Q5N3ggGVNHpkUI=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "0e79af5e3d4dcfcd676ab5ba3f95d2e3352e078c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-lib_5": { "locked": { "lastModified": 1772328832, "narHash": "sha256-e+/T/pmEkLP6BHhYjx6GmwP5ivonQQn0bJdH9YrRB+Q=", @@ -1325,6 +1452,30 @@ "type": "github" } }, + "proton-ge-nix": { + "inputs": { + "flake-parts": "flake-parts_4", + "git-hooks": "git-hooks_2", + "nixpkgs": [ + "nix-warcraft", + "nixpkgs" + ], + "std": "std" + }, + "locked": { + "lastModified": 1788361672, + "narHash": "sha256-zx7XHvYgXz8p7T1Zc1/zMiM5d1yIRD64fzc1eerP3dU=", + "owner": "Daaboulex", + "repo": "proton-ge-nix", + "rev": "bbb5eff50faedf99a04207f8a45d42327a4fb1db", + "type": "github" + }, + "original": { + "owner": "Daaboulex", + "repo": "proton-ge-nix", + "type": "github" + } + }, "root": { "inputs": { "auto-cpufreq": "auto-cpufreq", @@ -1348,6 +1499,7 @@ "nix-citizen": "nix-citizen", "nix-flatpak": "nix-flatpak", "nix-gaming": "nix-gaming", + "nix-warcraft": "nix-warcraft", "nixcord": "nixcord", "nixos-mailserver": "nixos-mailserver", "nixpkgs": "nixpkgs_14", @@ -1404,6 +1556,35 @@ "type": "github" } }, + "std": { + "inputs": { + "flake-parts": "flake-parts_5", + "git-hooks": [ + "nix-warcraft", + "proton-ge-nix", + "git-hooks" + ], + "nixpkgs": [ + "nix-warcraft", + "proton-ge-nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1788353184, + "narHash": "sha256-MLDGba7GKpJUBOYJicJi5Kp5ExBJdDf5iga/L/UeZuc=", + "owner": "Daaboulex", + "repo": "nix-packaging-standard", + "rev": "c00d5e9c2e5d52badb0e22421879bfb2218daca2", + "type": "github" + }, + "original": { + "owner": "Daaboulex", + "ref": "v2.33.1", + "repo": "nix-packaging-standard", + "type": "github" + } + }, "steam-config-nix": { "inputs": { "flake-parts": [ @@ -1435,7 +1616,7 @@ "base16-helix": "base16-helix", "base16-vim": "base16-vim", "firefox-gnome-theme": "firefox-gnome-theme", - "flake-parts": "flake-parts_4", + "flake-parts": "flake-parts_6", "gnome-shell": "gnome-shell", "nixpkgs": [ "nixpkgs" @@ -1651,7 +1832,7 @@ }, "vscode-server": { "inputs": { - "flake-parts": "flake-parts_5" + "flake-parts": "flake-parts_7" }, "locked": { "lastModified": 1784312229, diff --git a/flake.nix b/flake.nix index 3a884f7..3367ca7 100644 --- a/flake.nix +++ b/flake.nix @@ -49,6 +49,10 @@ }; nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=latest"; nix-gaming.url = "github:fufexan/nix-gaming"; + nix-warcraft = { + url = "github:raccube/nix-warcraft/amirdrassil"; + inputs.nixpkgs.follows = "nixpkgs"; + }; nixcord.url = "github:FlameFlag/nixcord"; nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; diff --git a/modules/hosts/default.nix b/modules/hosts/default.nix index 0a7946c..4b85690 100644 --- a/modules/hosts/default.nix +++ b/modules/hosts/default.nix @@ -29,11 +29,6 @@ system = { stateVersion = "26.05"; - - autoUpgrade = { - enable = true; - allowReboot = false; - }; }; nix = { diff --git a/modules/roles.nix b/modules/roles.nix index 2b25321..2327515 100644 --- a/modules/roles.nix +++ b/modules/roles.nix @@ -44,9 +44,12 @@ services.invidious services.mailserver # services.matrix + services.redlib services.bugtv services.vscode-server services.gitea + services.gitea-runner + services.attic # services.omnisearch services.slskd services.mpd diff --git a/modules/services/attic.nix b/modules/services/attic.nix new file mode 100644 index 0000000..f7ecaa9 --- /dev/null +++ b/modules/services/attic.nix @@ -0,0 +1,26 @@ +{ + # Private Nix binary cache. Caches are created private; pulling needs a token (netrc). + den.aspects.services.attic = let port = 8090; in { + tunnel = { subdomain = "cache"; inherit port; }; + + nixos = { config, host, ... }: { + services.atticd = { + enable = true; + # ATTIC_SERVER_TOKEN_RS256_SECRET_BASE64=... + environmentFile = "${config.users.users.${host.owner}.home}/.config/attic/env"; + settings = { + listen = "127.0.0.1:${toString port}"; + # No api-endpoint: CI uploads stay on localhost (Cloudflare caps bodies at 100MB). + substituter-endpoint = "https://cache.${host.domain}/"; + # Big NARs (darling rootfs) dedupe better in chunks. + chunking = { + nar-size-threshold = 64 * 1024; + min-size = 16 * 1024; + avg-size = 64 * 1024; + max-size = 256 * 1024; + }; + }; + }; + }; + }; +} diff --git a/modules/services/gitea-runner.nix b/modules/services/gitea-runner.nix new file mode 100644 index 0000000..b1058bd --- /dev/null +++ b/modules/services/gitea-runner.nix @@ -0,0 +1,19 @@ +{ + # Gitea Actions runner on box itself; jobs run directly on the host (label "native"). + den.aspects.services.gitea-runner.nixos = { config, host, pkgs, ... }: let + home = config.users.users.${host.owner}.home; + in { + # Owner's GitHub SSH key, readable by jobs at $CREDENTIALS_DIRECTORY/github; never in Gitea. + systemd.services."gitea-runner-${config.networking.hostName}".serviceConfig.LoadCredential = [ "github:${home}/.ssh/id_rsa" ]; + + services.gitea-actions-runner.instances.${config.networking.hostName} = { + enable = true; + name = config.networking.hostName; + url = "http://127.0.0.1:${toString config.services.gitea.settings.server.HTTP_PORT}"; + # TOKEN= + tokenFile = "${config.users.users.${host.owner}.home}/.config/gitea-runner/token"; + labels = [ "native:host" ]; + hostPackages = with pkgs; [ bash coreutils gnused gnugrep findutils git openssh curl jq nix nodejs attic-client ]; + }; + }; +} diff --git a/modules/services/mailserver.nix b/modules/services/mailserver.nix index 7a9536c..3434702 100644 --- a/modules/services/mailserver.nix +++ b/modules/services/mailserver.nix @@ -16,10 +16,12 @@ defaults.email = "security@${domain}"; certs."mx.${domain}" = { - listenHTTP = ":1360"; + listenHTTP = ":80"; }; }; + networking.firewall.allowedTCPPorts = [ 80 ]; + mailserver = { enable = true; diff --git a/modules/services/redlib.nix b/modules/services/redlib.nix new file mode 100644 index 0000000..11671cc --- /dev/null +++ b/modules/services/redlib.nix @@ -0,0 +1,74 @@ +{ + den.aspects.services.redlib = let port = 8975; in { + tunnel = { subdomain = "reddit"; inherit port; }; + + nixos = { pkgs, lib, ... }: { + services.redlib = { + enable = true; + + # upstream main with the wreq TLS-fingerprint fix for Reddit OAuth 401s + package = pkgs.redlib.overrideAttrs (old: rec { + version = "0.36.0-unstable-2026-04-24"; + + src = pkgs.fetchFromGitHub { + owner = "redlib-org"; + repo = "redlib"; + rev = "a4d36e954cf1bd64f209cd8868c5a29edc81b374"; + hash = "sha256-siyD6A12UALQIV7BMd7zu1TaojleTEYtpxPszuhx1/Y="; + }; + + cargoDeps = pkgs.rustPlatform.fetchCargoVendor { + inherit src; + hash = "sha256-eO3c7rlFna3DuO31etJ6S4c7NmcvgvIWZ1KVkNIuUqQ="; + }; + + # BoringSSL via boring-sys2 + nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ (with pkgs; [ + cmake go perl git rustPlatform.bindgenHook + ]); + + checkFlags = (old.checkFlags or [ ]) ++ [ + "--skip=oauth::tests::test_generic_web_backend" + "--skip=oauth::tests::test_mobile_spoof_backend" + ]; + }); + + address = "127.0.0.1"; + port = port; + + settings = { + SFW_ONLY = "off"; + ROBOTS_DISABLE_INDEXING = "on"; + ENABLE_RSS = "on"; + THEME = "system"; + FRONT_PAGE = "default"; + LAYOUT = "card"; + WIDE = "on"; + POST_SORT = "hot"; + COMMENT_SORT = "confidence"; + BLUR_SPOILER = "off"; + SHOW_NSFW = "on"; + BLUR_NSFW = "off"; + USE_HLS = "on"; + HIDE_HLS_NOTIFICATION = "off"; + AUTOPLAY_VIDEOS = "off"; + HIDE_AWARDS = "off"; + DISABLE_VISIT_REDDIT_CONFIRMATION = "off"; + HIDE_SCORE = "off"; + HIDE_SIDEBAR_AND_SUMMARY = "off"; + FIXED_NAVBAR = "on"; + REMOVE_DEFAULT_FEEDS = "off"; + }; + }; + + systemd.services.redlib = { + after = [ "network-online.target" ]; + wants = [ "network-online.target" ]; + serviceConfig = { + Restart = lib.mkForce "always"; + RestartSec = "30s"; + }; + }; + }; + }; +} diff --git a/modules/software/browsers/librewolf/default.nix b/modules/software/browsers/librewolf/default.nix index d9619f8..9fc2795 100644 --- a/modules/software/browsers/librewolf/default.nix +++ b/modules/software/browsers/librewolf/default.nix @@ -234,20 +234,19 @@ in { "*".installation_mode = "blocked"; } // (mkExtensions [ - "{cb31ec5d-c49a-4e5a-b240-16c767444f62}" # indie-wiki-buddy + # "{cb31ec5d-c49a-4e5a-b240-16c767444f62}" # indie-wiki-buddy "{1b66b5ad-408f-4300-aac6-55a68b2b24ff}" # catppuccin-mocha-no-borders - "{7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}" # styl-us "{3c078156-979c-498b-8990-85f7987dd929}" # sidebery "{60f82f00-9ad5-4de5-b31c-b16a47c51558}" # cookie-quick-manager - "{88ebde3a-4581-4c6b-8019-2a05a9e3e938}" # hide-youtube-shorts + # "{88ebde3a-4581-4c6b-8019-2a05a9e3e938}" # hide-youtube-shorts - "firefox@tampermonkey.net" # tampermonkey + # "firefox@tampermonkey.net" # tampermonkey "deArrow@ajay.app" # dearrow @@ -255,9 +254,9 @@ "uBlock0@raymondhill.net" # ublock-origin - "{a6c4a591-f1b2-4f03-b3ff-767e5bedf4e7}" # user-agent-string-switcher + # "{a6c4a591-f1b2-4f03-b3ff-767e5bedf4e7}" # user-agent-string-switcher - "{762f9885-5a13-4abd-9c77-433dcd38b8fd}" # return-youtube-dislikes + # "{762f9885-5a13-4abd-9c77-433dcd38b8fd}" # return-youtube-dislikes ]) // lib.listToAttrs (map (e: lib.nameValuePair e.id { install_url = "file://${e.xpi}"; installation_mode = "force_installed"; diff --git a/modules/software/cad/magica.nix b/modules/software/cad/magica.nix new file mode 100644 index 0000000..3f55d72 --- /dev/null +++ b/modules/software/cad/magica.nix @@ -0,0 +1,60 @@ +# MagicaVoxel / MagicaCSG via umu + Proton-GE. +# Binaries live in ./_magica (git-excluded), so this needs --impure eval. +{ + den.aspects.software.cad.homeManager = { config, lib, pkgs, ... }: + let + apps = { + voxel = { name = "MagicaVoxel"; exe = "MagicaVoxel.exe"; bin = "magicavoxel"; mime = "model/x-vox"; ext = "vox"; }; + csg = { name = "MagicaCSG"; exe = "MagicaCSG.exe"; bin = "magicacsg"; mime = "model/x-mcsg"; ext = "mcsg"; }; + }; + srcOf = app: "${config.home.homeDirectory}/nix/modules/software/cad/_magica/${app}"; + present = lib.filterAttrs (app: _: builtins.pathExists (srcOf app)) apps; + storeOf = app: builtins.path { path = srcOf app; name = "magica-${app}"; }; + + launcher = app: a: let store = storeOf app; in pkgs.writeShellApplication { + name = a.bin; + runtimeInputs = [ pkgs.umu-launcher pkgs.coreutils pkgs.rsync ]; + text = '' + base="''${XDG_DATA_HOME:-$HOME/.local/share}/magica/${app}" + export GAMEID=umu-0 + export PROTONPATH=${pkgs.proton-ge-bin.steamcompattool} + export WINEPREFIX="$base/prefix" + mkdir -p "$base/app" "$WINEPREFIX" + if [ "$(cat "$base/stamp" 2>/dev/null)" != "${store}" ]; then + excl=() + [ -d "$base/app/config" ] && excl=(--exclude=/config) + rsync -r --chmod=u+w "''${excl[@]}" "${store}/" "$base/app/" + chmod -R u+w "$base/app" + echo "${store}" > "$base/stamp" + fi + mkdir -p "$base/app/cache" "$base/app/export" + args=() + for f in "$@"; do args+=("$(realpath -- "$f")"); done + cd "$base/app" + exec umu-run ${a.exe} "''${args[@]}" + ''; + }; + in + { + home.packages = lib.mapAttrsToList launcher present; + # Register .vox/.mcsg; our desktop entries are the only handlers, so they become the default. + xdg.dataFile."mime/packages/magica.xml".text = '' + + + ${lib.concatMapStrings (a: '' + + ${a.name} model + + + '') (lib.attrValues apps)} + ''; + xdg.desktopEntries = lib.mapAttrs' (app: a: lib.nameValuePair a.bin ({ + inherit (a) name; + exec = "${a.bin} %f"; + categories = [ "Graphics" ]; + mimeType = [ a.mime ]; + } // lib.optionalAttrs (builtins.pathExists "${srcOf app}/config/font/icon.png") { + icon = "${storeOf app}/config/font/icon.png"; + })) present; + }; +} diff --git a/modules/software/gaming/warcraft/_addons.nix b/modules/software/gaming/warcraft/_addons.nix new file mode 100644 index 0000000..9a2f9a9 --- /dev/null +++ b/modules/software/gaming/warcraft/_addons.nix @@ -0,0 +1,42 @@ +# WoW Classic beta ("Forever") addons. Each output is $out//... +{ pkgs, lib }: +let + release = repo: tag: file: hash: pkgs.fetchzip { + url = "https://github.com/${repo}/releases/download/${tag}/${file}"; + stripRoot = false; + inherit hash; + }; +in +{ + # Questie 12.0.3 + QuestieDB 1.0.4 + questie = release "Questie/Questie" "bundle/v12.0.3+v1.0.4" "Questie-v12.0.3+v1.0.4.zip" "sha256-jt0zI8LjM9PCgbwF1EJ/yFo2GdclRlHNtFyyh3AcfGk="; + rxpguides = release "RestedXP/RXPGuides" "v4.11.5" "RXPGuides-v4.11.5.zip" "sha256-bPwCBpZYI1NyrzNU5O1AAwAl857Xw01VJzEtGX425dE="; + whatstraining = release "fusionpit/WhatsTraining" "11.0.0-beta9" "WhatsTraining-11.0.0-beta9.zip" "sha256-qZg7qlFkszv5uPLxd+OnzAYbIRj+yfQS4ybZ+oIQ57Y="; + olympus = release "dnl-gentile/olympus-addon" "v0.9.8" "Olympus-0.9.8.zip" "sha256-JBa+d77ZRwPfJez6ejrGrVv3IysCpoYvDeL2X8BRx4Q="; + overlord = release "leliondoc/overlord-forever-addon" "1.2.3" "Overlord-1.2.3.zip" "sha256-5p8qNJNycgQr4W9TzFSgPHifrUaO6h1ca1Y63WBw9H8="; + # Carbonite + .Gathermate2_Data/.Info/.Notes/.Quests/.Warehouse + carbonite = release "IrcDirk/Carbonite-All-in-One-Retail-Classic" "v12.1.0-00018" "CarboniteAllinOneRetailClassic-v12.1.0-00018.zip" "sha256-VwgNBRExknG4kNM8h+S6tCSEfRjfdajvRn/cv00vzuM="; + + # Scrap 12.1.5 has no release zip; build the packager layout from the tagged commit. + scrap = pkgs.runCommand "wow-addon-scrap-12.1.5" { + src = pkgs.fetchFromGitHub { + owner = "Jaliborc"; + repo = "Scrap"; + rev = "9a792eaa0d8297cfcc1eecfaf06b16f3fa60918c"; # "12.1.5" + fetchSubmodules = true; + hash = "sha256-nulN1n0r+LQolddd0f7GbYWl01GlD97xKvISkhlRxsA="; + }; + } '' + mkdir -p $out/Scrap_Config $out/Scrap_Merchant + cp -r $src $out/Scrap + for m in Config:config Merchant:merchant; do + printf '%s\n' \ + "## Title: Scrap |cffffffff''${m%%:*}|r" \ + "## Interface: 120100, 50504, 40402, 30404, 20506, 16001, 11509" \ + "## Version: 12.1.5" \ + "## Dependencies: Scrap" \ + "## LoadOnDemand: 1" \ + "..\\Scrap\\addons\\''${m#*:}\\''${m#*:}.xml" > $out/Scrap_''${m%%:*}/Scrap_''${m%%:*}.toc + done + ''; +} diff --git a/modules/software/gaming/warcraft/default.nix b/modules/software/gaming/warcraft/default.nix new file mode 100644 index 0000000..995c77c --- /dev/null +++ b/modules/software/gaming/warcraft/default.nix @@ -0,0 +1,41 @@ +# World of Warcraft Classic beta ("Forever"), run outside Steam via Proton in the existing Steam prefix. +{ inputs, ... }: { + flake-file.inputs.nix-warcraft = { + url = "github:raccube/nix-warcraft/amirdrassil"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + den.aspects.software.gaming.homeManager = { config, lib, pkgs, osConfig ? { }, ... }: + let + prefix = ".local/share/Steam/steamapps/compatdata/2981697491"; + game = "${config.home.homeDirectory}/${prefix}/pfx/drive_c/Program Files (x86)/World of Warcraft/_classic_beta_"; + addons = import ./_addons.nix { inherit pkgs lib; }; + # Not fetchable from a public source (CurseForge-only): copy them here by hand. + local = [ + "Auctionator" "Baganator" "Syndicator" "BetterFishing" "SpeedyAutoLoot" + "ForeverStatSearch" "Leatrix_Maps" "Leatrix_Plus" "RareScanner" "TomTom" + ]; + in + { + imports = [ inputs.nix-warcraft.homeManagerModules.default ]; + + programs.wow = { + enable = true; + protonPackage = inputs.nix-warcraft.inputs.proton-ge-nix.packages.${pkgs.stdenv.hostPlatform.system}.v11.steamcompattool; + wayland = false; # same as under Steam (Xwayland) + prefixDir = prefix; + # Same as the Steam shortcut: Battle.net (installed in the 3358134755 prefix) run in this prefix; it handles login. + battleNetExe = "../3358134755/pfx/drive_c/Program Files (x86)/Battle.net/Battle.net.exe"; + uiLayoutName = osConfig.networking.hostName or "16:9"; + hideDesktopEntries = true; # its entry needs a flavourExeMap key classic-beta lacks + versions.classic-beta = { + displayName = "World of Warcraft Classic Beta"; + executable = "pfx/drive_c/Program Files (x86)/World of Warcraft/_classic_beta_/WowB.exe"; + addonDir = "${game}/Interface/AddOns"; + wtfDir = "${game}/WTF"; + addonPackages = lib.attrValues addons; + developmentAddons = lib.genAttrs local (d: "${config.home.homeDirectory}/.local/share/wow-addons/${d}"); + }; + }; + }; +} diff --git a/modules/system/base/kernel.nix b/modules/system/base/kernel.nix index fd96aa9..62a719d 100644 --- a/modules/system/base/kernel.nix +++ b/modules/system/base/kernel.nix @@ -7,9 +7,8 @@ boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; - nix.settings.substituters = [ "https://attic.xuyh0120.win/lantian" "https://cache.xinux.uz" ]; + nix.settings.substituters = [ "https://cache.xinux.uz" ]; nix.settings.trusted-public-keys = [ - "lantian:EeAUQ+W+6r7EtwnmYjeVwx5kOGEBpjlBfPlzGlTNvHc=" "cache.xinux.uz:BXCrtqejFjWzWEB9YuGB7X2MV4ttBur1N8BkwQRdH+0=" ]; };