diff --git a/README.md b/README.md index 26afb8e..e6147b5 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,57 @@ modules are automatically discovered via [import-tree](https://github.com/vic/im ``` modules/ -├── core/ # System fundamentals (desktop, audio, graphics, network, theme) -├── hosts/ # Per-machine includes (nix, styx, box) -├── infra/ # Infrastructure (syncthing, cloudflared tunnels) -├── services/ # Self-hosted services (searxng, gitea, copyparty, ...) -├── software/ # User software (firefox, nixcord, beets, ...) -└── users/ # User accounts +├── 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 +├── roles.nix # den.aspects.desktop / den.aspects.server bundles +├── hosts/ +│ ├── default.nix # den.default (every host) +│ ├── common.nix # shared host attrs (domain, bug user), den.homes, schema +│ └── .nix # den.hosts entity + den.aspects. +└── 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 @@ -39,7 +82,6 @@ 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 | -| [redlib](https://github.com/redlib-org/redlib) | [reddit.bug.tools](https://reddit.bug.tools) | Private Reddit frontend *(disabled)* | | [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 | @@ -71,5 +113,4 @@ all services on `box` are proxied through cloudflared tunnels to `*.bug.tools`. ## TODO fix matrix server fix invidious instance -fix redlib instance configure cosmic with home diff --git a/flake.lock b/flake.lock index c553a24..966e14a 100644 --- a/flake.lock +++ b/flake.lock @@ -1,26 +1,5 @@ { "nodes": { - "aerothemeplasma": { - "inputs": { - "flake-parts": "flake-parts", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1791652808, - "narHash": "sha256-FIbdJwfkcbB1ZzzzRxI8kFQTNwiFTCCCfFhg6Fn2rLc=", - "owner": "nyakase", - "repo": "aerothemeplasma-nix", - "rev": "69be07ede5ff166d4b2bedc39af0e9fa0b786401", - "type": "github" - }, - "original": { - "owner": "nyakase", - "repo": "aerothemeplasma-nix", - "type": "github" - } - }, "auto-cpufreq": { "inputs": { "nixpkgs": [ @@ -250,23 +229,22 @@ "type": "github" } }, - "flake-aspects": { + "flake-compat": { "locked": { - "lastModified": 1771320365, - "narHash": "sha256-t1FKnPRvg/l376pM+hMS0hPMTmxu7S4eVS2s+A25SbU=", - "owner": "vic", - "repo": "flake-aspects", - "rev": "f338a5062628c9b9fda0796a141ca1a6eb4dcf75", + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", "type": "github" }, "original": { - "owner": "vic", - "ref": "v0.5.0", - "repo": "flake-aspects", + "owner": "edolstra", + "repo": "flake-compat", "type": "github" } }, - "flake-compat": { + "flake-compat_2": { "flake": false, "locked": { "lastModified": 1767039857, @@ -282,7 +260,7 @@ "type": "github" } }, - "flake-compat_2": { + "flake-compat_3": { "flake": false, "locked": { "lastModified": 1777699697, @@ -296,7 +274,7 @@ "url": "https://git.lix.systems/lix-project/flake-compat/archive/main.tar.gz" } }, - "flake-compat_3": { + "flake-compat_4": { "flake": false, "locked": { "lastModified": 1767039857, @@ -312,7 +290,7 @@ "type": "github" } }, - "flake-compat_4": { + "flake-compat_5": { "flake": false, "locked": { "lastModified": 1767039857, @@ -344,24 +322,6 @@ } }, "flake-parts": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib" - }, - "locked": { - "lastModified": 1778716662, - "narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_2": { "inputs": { "nixpkgs-lib": [ "nixpkgs-lib" @@ -381,9 +341,9 @@ "type": "github" } }, - "flake-parts_3": { + "flake-parts_2": { "inputs": { - "nixpkgs-lib": "nixpkgs-lib_2" + "nixpkgs-lib": "nixpkgs-lib" }, "locked": { "lastModified": 1788450739, @@ -399,9 +359,9 @@ "type": "github" } }, - "flake-parts_4": { + "flake-parts_3": { "inputs": { - "nixpkgs-lib": "nixpkgs-lib_3" + "nixpkgs-lib": "nixpkgs-lib_2" }, "locked": { "lastModified": 1790898470, @@ -417,7 +377,7 @@ "type": "github" } }, - "flake-parts_5": { + "flake-parts_4": { "inputs": { "nixpkgs-lib": [ "stylix", @@ -438,6 +398,24 @@ "type": "github" } }, + "flake-parts_5": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_3" + }, + "locked": { + "lastModified": 1772408722, + "narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f20dc5d9b8027381c474144ecabc9034d6a839a3", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": [ @@ -826,10 +804,32 @@ "type": "github" } }, - "nix-cachyos-kernel": { + "nix-alien": { "inputs": { "flake-compat": "flake-compat", - "flake-parts": "flake-parts_3", + "nix-index-database": "nix-index-database", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1792056812, + "narHash": "sha256-3FHVsncGsfcxozcQgHULGkQ6TqXOlguxX6YlBQhQrT8=", + "owner": "thiagokokada", + "repo": "nix-alien", + "rev": "07c41bfdc3b986b7e65e19380b28916e10112c0f", + "type": "github" + }, + "original": { + "owner": "thiagokokada", + "repo": "nix-alien", + "type": "github" + } + }, + "nix-cachyos-kernel": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-parts": "flake-parts_2", "nixpkgs": "nixpkgs_9" }, "locked": { @@ -849,7 +849,7 @@ }, "nix-citizen": { "inputs": { - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat_3", "nix-gaming": [ "nix-gaming" ], @@ -910,8 +910,8 @@ }, "nix-gaming": { "inputs": { - "flake-compat": "flake-compat_3", - "flake-parts": "flake-parts_4", + "flake-compat": "flake-compat_4", + "flake-parts": "flake-parts_3", "git-hooks": "git-hooks", "nixpkgs": "nixpkgs_11" }, @@ -929,6 +929,27 @@ "type": "github" } }, + "nix-index-database": { + "inputs": { + "nixpkgs": [ + "nix-alien", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1791711434, + "narHash": "sha256-LpIhxnuO0tYeZ4k7BbNMxsPs2zJpB4hWXO1jdhUuE7Q=", + "owner": "nix-community", + "repo": "nix-index-database", + "rev": "9a2dd40780eeab8543aa97c59c26f11267025616", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-index-database", + "type": "github" + } + }, "nixcord": { "inputs": { "home-manager": "home-manager_2", @@ -955,7 +976,7 @@ "nixos-mailserver": { "inputs": { "blobs": "blobs", - "flake-compat": "flake-compat_4", + "flake-compat": "flake-compat_5", "git-hooks": "git-hooks_2", "nixpkgs": "nixpkgs_13" }, @@ -1016,21 +1037,6 @@ } }, "nixpkgs-lib": { - "locked": { - "lastModified": 1777168982, - "narHash": "sha256-GOkGPcboWE9BmGCRMLX3worL4EMnsnG8MyKmXNeYuhQ=", - "owner": "nix-community", - "repo": "nixpkgs.lib", - "rev": "f5901329dade4a6ea039af1433fb087bd9c1fe14", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixpkgs.lib", - "type": "github" - } - }, - "nixpkgs-lib_2": { "locked": { "lastModified": 1788057806, "narHash": "sha256-DTQSMxzDWmT0zhguthvegnVkn7CFqGCv4IHCzk5ZUpM=", @@ -1045,7 +1051,7 @@ "type": "github" } }, - "nixpkgs-lib_3": { + "nixpkgs-lib_2": { "locked": { "lastModified": 1790477367, "narHash": "sha256-oujbxmVKDhci2E4EM3KyAbRUgp5/IsCoiA/LfEF7OOk=", @@ -1060,6 +1066,21 @@ "type": "github" } }, + "nixpkgs-lib_3": { + "locked": { + "lastModified": 1772328832, + "narHash": "sha256-e+/T/pmEkLP6BHhYjx6GmwP5ivonQQn0bJdH9YrRB+Q=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "c185c7a5e5dd8f9add5b2f8ebeff00888b070742", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "nixpkgs-packages": { "locked": { "lastModified": 1791130267, @@ -1335,16 +1356,14 @@ }, "root": { "inputs": { - "aerothemeplasma": "aerothemeplasma", "auto-cpufreq": "auto-cpufreq", "catppuccin": "catppuccin", "catppuccin-userstyles-nix": "catppuccin-userstyles-nix", "copyparty": "copyparty", "den": "den", "fetch": "fetch", - "flake-aspects": "flake-aspects", "flake-file": "flake-file", - "flake-parts": "flake-parts_2", + "flake-parts": "flake-parts", "home-manager": "home-manager", "hytale-launcher": "hytale-launcher", "import-tree": "import-tree", @@ -1353,6 +1372,7 @@ "minecraft-metadata": "minecraft-metadata", "neu-nix": "neu-nix", "niri": "niri", + "nix-alien": "nix-alien", "nix-cachyos-kernel": "nix-cachyos-kernel", "nix-citizen": "nix-citizen", "nix-flatpak": "nix-flatpak", @@ -1365,8 +1385,8 @@ ], "noctalia": "noctalia", "stylix": "stylix", - "systems": "systems_5", - "umbriel": "umbriel" + "umbriel": "umbriel", + "vscode-server": "vscode-server" } }, "stylix": { @@ -1376,7 +1396,7 @@ "base16-helix": "base16-helix", "base16-vim": "base16-vim", "firefox-gnome-theme": "firefox-gnome-theme", - "flake-parts": "flake-parts_5", + "flake-parts": "flake-parts_4", "gnome-shell": "gnome-shell", "nixpkgs": [ "nixpkgs" @@ -1463,21 +1483,6 @@ "type": "github" } }, - "systems_5": { - "locked": { - "lastModified": 1791244623, - "narHash": "sha256-uuanbkFk8a313Zfrxdcz8Us/yQtaxNnKJtX8v0ZPpd8=", - "owner": "nix-systems", - "repo": "default", - "rev": "d36eeed142f88b5a636f2e3856a53c61654cf29b", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "tinted-kitty": { "flake": false, "locked": { @@ -1605,6 +1610,24 @@ "url": "https://github.com/noctalia-dev/umbriel" } }, + "vscode-server": { + "inputs": { + "flake-parts": "flake-parts_5" + }, + "locked": { + "lastModified": 1784312229, + "narHash": "sha256-2uHCSUw341o3my1R0U0YCfbnMEazylxb58evWsjGL50=", + "owner": "nix-community", + "repo": "nixos-vscode-server", + "rev": "2f984dfbe7e5271b5c413d3e734374cc1306c921", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-vscode-server", + "type": "github" + } + }, "xdg-desktop-portal-umbriel": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index 17a5567..1c977f6 100644 --- a/flake.nix +++ b/flake.nix @@ -1,112 +1,70 @@ +# DO-NOT-EDIT. This file was auto-generated using github:denful/flake-file. +# Use `nix run .#write-flake` to regenerate it. { outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules); inputs = { - den = { - url = "github:denful/den/"; - }; - - flake-aspects.url = "github:vic/flake-aspects/v0.5.0"; - - flake-file.url = "github:vic/flake-file"; - - flake-parts = { - inputs.nixpkgs-lib.follows = "nixpkgs-lib"; - url = "github:hercules-ci/flake-parts"; - }; - - home-manager = { - inputs.nixpkgs.follows = "nixpkgs"; - url = "github:nix-community/home-manager"; - }; - - import-tree.url = "github:vic/import-tree"; - - nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; - - nixpkgs-lib.follows = "nixpkgs"; - - systems.url = "github:nix-systems/default"; - - stylix = { - url = "github:nix-community/stylix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=latest"; - - copyparty.url = "github:9001/copyparty"; - - catppuccin.url = "github:catppuccin/nix"; - - nixcord.url = "github:FlameFlag/nixcord"; - - catppuccin-userstyles-nix = { - url = "github:4DBug/catppuccin-userstyles-nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - nix-citizen.url = "github:LovingMelody/nix-citizen"; - - nix-gaming.url = "github:fufexan/nix-gaming"; - nix-citizen.inputs.nix-gaming.follows = "nix-gaming"; - - hytale-launcher.url = "github:JPyke3/hytale-launcher-nix"; - - nix-cachyos-kernel.url = "github:xddxdd/nix-cachyos-kernel/release"; - - /* - omnisearch = { - url = "git+https://git.bwaaa.monster/omnisearch"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - */ - - minecraft = { - url = "github:4DBug/minecraft.nix"; - inputs.metadata.follows = "minecraft-metadata"; - }; - - minecraft-metadata.url = "github:Ninlives/minecraft.json"; - - neu-nix = { - url = "github:ricardomaps/neu-nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - aerothemeplasma = { - url = "github:nyakase/aerothemeplasma-nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - niri = { - url = "github:sodiboo/niri-flake"; - }; - - noctalia = { - url = "github:noctalia-dev/noctalia"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - umbriel = { - url = "git+https://github.com/noctalia-dev/umbriel"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver"; - - millennium.url = "github:SteamClientHomebrew/Millennium?dir=packages/nix"; - - fetch.url = "github:areofyl/fetch"; - auto-cpufreq = { url = "github:AdnanHodzic/auto-cpufreq"; inputs.nixpkgs.follows = "nixpkgs"; }; - - #bug-tv = { - # url = "git+https://git.bug.tools/bug/tv.git"; - # inputs.nixpkgs.follows = "nixpkgs"; - #}; + catppuccin.url = "github:catppuccin/nix"; + catppuccin-userstyles-nix = { + url = "github:4DBug/catppuccin-userstyles-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + copyparty.url = "github:9001/copyparty"; + den.url = "github:denful/den/"; + fetch.url = "github:areofyl/fetch"; + flake-file.url = "github:vic/flake-file"; + flake-parts = { + url = "github:hercules-ci/flake-parts"; + inputs.nixpkgs-lib.follows = "nixpkgs-lib"; + }; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + hytale-launcher.url = "github:JPyke3/hytale-launcher-nix"; + import-tree.url = "github:vic/import-tree"; + millennium.url = "github:SteamClientHomebrew/Millennium?dir=packages/nix"; + minecraft = { + url = "github:4DBug/minecraft.nix"; + inputs.metadata.follows = "minecraft-metadata"; + }; + minecraft-metadata.url = "github:Ninlives/minecraft.json"; + neu-nix = { + url = "github:ricardomaps/neu-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + niri.url = "github:sodiboo/niri-flake"; + nix-alien = { + url = "github:thiagokokada/nix-alien"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nix-cachyos-kernel.url = "github:xddxdd/nix-cachyos-kernel/release"; + nix-citizen = { + url = "github:LovingMelody/nix-citizen"; + inputs.nix-gaming.follows = "nix-gaming"; + }; + nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=latest"; + nix-gaming.url = "github:fufexan/nix-gaming"; + nixcord.url = "github:FlameFlag/nixcord"; + nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver"; + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + nixpkgs-lib.follows = "nixpkgs"; + noctalia = { + url = "github:noctalia-dev/noctalia"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + stylix = { + url = "github:nix-community/stylix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + umbriel = { + url = "git+https://github.com/noctalia-dev/umbriel"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + vscode-server.url = "github:nix-community/nixos-vscode-server"; }; } diff --git a/modules/core/desktop/nix7.nix b/modules/core/desktop/nix7.nix deleted file mode 100644 index 39aa547..0000000 --- a/modules/core/desktop/nix7.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ inputs, ...}: { - den.aspects.nix7 = { - nixos = { - imports = [ inputs.aerothemeplasma.nixosModules.aerothemeplasma-nix ]; - - services.desktopManager.plasma6.enable = true; - - programs.aeroshell = { - enable = true; - fonts.segoe.enable = true; - polkit.enable = true; - aerothemeplasma = { - enable = true; - sddm.enable = true; - plymouth.enable = true; - }; - }; - }; - }; -} diff --git a/modules/core/infra/cloudflared.nix b/modules/core/infra/cloudflared.nix deleted file mode 100644 index a9e7467..0000000 --- a/modules/core/infra/cloudflared.nix +++ /dev/null @@ -1,34 +0,0 @@ -let - uuid = "d4c4a385-05c7-4dff-b6f1-9bd02693a80a"; - domain = "bug.tools"; - creds = "/home/bug/.cloudflared/${uuid}.json"; -in { - den.aspects.cloudflared = { - nixos = { config, pkgs, lib, ... }: { - options.den.tunnels = lib.mkOption { - default = []; - description = "cloudflared tunnels"; - type = lib.types.listOf lib.types.str; - }; - - config = { - environment.systemPackages = [ pkgs.cloudflared ]; - environment.etc."cloudflared/${uuid}.json".source = creds; - - services.cloudflared = { - enable = true; - - tunnels.${uuid} = { - credentialsFile = "/etc/cloudflared/${uuid}.json"; - default = "http_status:404"; - - ingress = lib.listToAttrs (map (subdomain: { - name = "${subdomain}.${domain}"; - value = "http://127.0.0.1:${toString config.den.portmap.${subdomain}}"; - }) config.den.tunnels); - }; - }; - }; - }; - }; -} diff --git a/modules/core/network/crab-hole.nix b/modules/core/network/crab-hole.nix deleted file mode 100644 index 400a7c0..0000000 --- a/modules/core/network/crab-hole.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ - den.aspects.crab-hole = { - nixos = { ... }: { - services.crab-hole = { - enable = true; - - settings = { - blocklist = { - include_subdomains = true; - lists = [ - "https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn/hosts" - "https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt" - ]; - }; - - downstream = [ - { protocol = "udp"; listen = "127.0.0.1"; port = 53; } - { protocol = "udp"; listen = "::1"; port = 53; } - ]; - - upstream = { - name_servers = [ - { - socket_addr = "1.1.1.1:853"; - protocol = "tls"; - tls_dns_name = "1dot1dot1dot1.cloudflare-dns.com"; - trust_nx_responses = false; - } - { - socket_addr = "[2606:4700:4700::1111]:853"; - protocol = "tls"; - tls_dns_name = "1dot1dot1dot1.cloudflare-dns.com"; - trust_nx_responses = false; - } - ]; - }; - }; - }; - }; - }; -} diff --git a/modules/den.nix b/modules/den.nix index 67fbe26..e01b286 100644 --- a/modules/den.nix +++ b/modules/den.nix @@ -5,8 +5,15 @@ ]; flake-file.inputs = { - den.url = "github:vic/den"; + den.url = "github:denful/den/"; flake-file.url = "github:vic/flake-file"; + flake-parts = { + url = "github:hercules-ci/flake-parts"; + inputs.nixpkgs-lib.follows = "nixpkgs-lib"; + }; + import-tree.url = "github:vic/import-tree"; + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + nixpkgs-lib.follows = "nixpkgs"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/modules/hosts.nix b/modules/hosts.nix deleted file mode 100644 index 40515e9..0000000 --- a/modules/hosts.nix +++ /dev/null @@ -1,18 +0,0 @@ -let - bug = { - isNormalUser = true; - description = "bug"; - extraGroups = [ "networkmanager" "wheel" "audio" "video" "libvirtd" "ydotool" "dialout" ]; - classes = [ "homeManager" ]; - }; -in { lib, ... }: { - den.hosts.x86_64-linux = { - nix.users.bug = bug; - styx.users.bug = bug; - box.users.bug = bug; - }; - - den.homes.x86_64-linux.bug = { }; - - den.schema.user.classes = lib.mkDefault [ "homeManager" ]; -} diff --git a/modules/hosts/box.nix b/modules/hosts/box.nix index 23ffb59..0805ca0 100644 --- a/modules/hosts/box.nix +++ b/modules/hosts/box.nix @@ -1,36 +1,17 @@ { den, ... }: { + den.hosts.x86_64-linux.box = { + cloudflared.uuid = "d4c4a385-05c7-4dff-b6f1-9bd02693a80a"; + }; + den.aspects.box = { includes = with den.aspects; [ den.default - cloudflared - - portmap - searxng - copyparty - glances - invidious - mailserver - # matrix - redlib - # bugtv - # sish - vscode-server - gitea - # omnisearch - slskd - - catppuccin - - janitor - - mpd + server ]; - nixos = { pkgs, ...}: { - networking.hostName = "box"; - - den.tunnels = [ "mpd" ]; + nixos = { pkgs, ... }: { + imports = [ ./_hw/box.nix ]; environment.systemPackages = [ pkgs.python3 ]; diff --git a/modules/hosts/common.nix b/modules/hosts/common.nix index f060a5b..dca96c2 100644 --- a/modules/hosts/common.nix +++ b/modules/hosts/common.nix @@ -1,29 +1,15 @@ -{ den, ... }: { - den.aspects.common = { - includes = with den.aspects; [ - cosmic - audio - - swap - virtualisation - - stylix - - flatpak - development - compatibility - utilities - - firefox - librewolf - - music - social - gaming - - #crab-hole - - kernel - ]; +{ lib, ... }: { + den.schema.host = { + domain = "bug.tools"; + owner = "bug"; + users.bug = { + isNormalUser = true; + description = "bug"; + classes = [ "homeManager" ]; + }; }; + + den.homes.x86_64-linux.bug = { domain = "bug.tools"; }; + + den.schema.user.classes = lib.mkDefault [ "homeManager" ]; } diff --git a/modules/hosts/default.nix b/modules/hosts/default.nix index adbcb9b..bc4da9b 100644 --- a/modules/hosts/default.nix +++ b/modules/hosts/default.nix @@ -1,33 +1,29 @@ { den, ... }: { den.default = { includes = with den.aspects; [ - boot - security - locale - essentials + den.batteries.hostname - dns - openssh - syncthing - tailscale - openvpn + system.boot + system.security + system.locale + software.cli - #beszel + system.network.dns + system.network.openssh + system.network.syncthing + system.network.tailscale + system.network.openvpn - fish + software.shell - fetch - - opencode + # host-only: den.default also reaches standalone homes + ({ host, ... }: { includes = [ system.theme.catppuccin ]; }) ]; - nixos = { ... }: { - imports = [ - /etc/nixos/hardware-configuration.nix - ]; - + nixos = { home-manager = { #useGlobalPkgs = true; + useUserPackages = true; backupFileExtension = "hm-backup"; }; @@ -40,10 +36,15 @@ }; }; - nixpkgs.config.allowUnfree = true; - nix = { optimise.automatic = true; + + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 14d"; + }; + settings.experimental-features = [ "nix-command" "flakes" ]; }; }; diff --git a/modules/hosts/nix.nix b/modules/hosts/nix.nix index 740b7bf..123e4f9 100644 --- a/modules/hosts/nix.nix +++ b/modules/hosts/nix.nix @@ -1,25 +1,23 @@ { den, ... }: { + den.hosts.x86_64-linux.nix = { + cloudflared = { uuid = "608ba37a-1be8-49e8-be2d-abeb8b77081d"; protocol = "http2"; }; + }; + den.aspects.nix = { + # TODO: copy nix's /etc/nixos/hardware-configuration.nix to ./_hw/nix.nix (impure until then) + nixos.imports = [ /etc/nixos/hardware-configuration.nix ]; + includes = with den.aspects; [ den.default - common + desktop - nvidia + system.graphics.nvidia - catppuccin + system.audio.alc897 - janitor - - alc897 - - #cad - - llama + services.llama + services.cloudflared ]; - - nixos = { - networking.hostName = "nix"; - }; }; } diff --git a/modules/hosts/styx.nix b/modules/hosts/styx.nix index 0cbccaa..3ffa3cb 100644 --- a/modules/hosts/styx.nix +++ b/modules/hosts/styx.nix @@ -1,31 +1,26 @@ { den, ... }: { + den.hosts.x86_64-linux.styx = { }; + den.aspects.styx = { includes = with den.aspects; [ den.default - common + desktop - amdgpu - cloudflare-warp - cad + system.graphics.amdgpu + system.network.cloudflare-warp - catppuccin + system.desktop.neu - janitor + system.desktop.niri + system.desktop.noctalia + system.desktop.umbriel - neu - - #nix7 - - niri - noctalia - umbriel - - autocpufreq + system.hardware.autocpufreq ]; nixos = { - networking.hostName = "styx"; + imports = [ ./_hw/styx.nix ]; services.logind.settings.Login = { HandleLidSwitch = "ignore"; diff --git a/modules/services/beszel.nix b/modules/services/beszel.nix deleted file mode 100644 index 1873f0c..0000000 --- a/modules/services/beszel.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ ... }: { - den.aspects.beszel = { host, ... }: { - den.tunnels = - if host.name == "box" - then [ "fleet" ] - else []; - - nixos = { lib, ... }: { - services.beszel.agent = { - enable = true; - - environment = { - KEY = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMlX8zdofzg+vV0H6H5U54YIbTY/z0iPfD9LXupBY2jX"; - TOKEN = "30949ab5-3ed3-46c1-b606-4e4e66b847f9"; - HUB_URL = "https://fleet.bug.tools"; - SYSTEM_NAME = host.name; - }; - - environmentFile = "/var/lib/beszel-agent/environment"; - }; - - services.beszel.hub = lib.mkIf (host.name == "box") { - enable = true; - host = "0.0.0.0"; - port = 8090; - }; - }; - }; -} diff --git a/modules/services/bugtv.nix b/modules/services/bugtv.nix index 8be5589..4b406ce 100644 --- a/modules/services/bugtv.nix +++ b/modules/services/bugtv.nix @@ -1,10 +1,14 @@ { inputs, ... }: { - den.aspects.bugtv = { + #flake-file.inputs.bug-tv = { + # url = "git+https://git.bug.tools/bug/tv.git"; + # inputs.nixpkgs.follows = "nixpkgs"; + #}; + den.aspects.services.bugtv = let port = port; in { + tunnel = { subdomain = "api-tv"; inherit port; }; + nixos = { pkgs, ... }: { imports = [ inputs.bug-tv.nixosModules.default ]; - den.tunnels = [ "api-tv" ]; - services."bug-tv" = { enable = true; diff --git a/modules/services/copyparty.nix b/modules/services/copyparty.nix index f96040b..7f94d62 100644 --- a/modules/services/copyparty.nix +++ b/modules/services/copyparty.nix @@ -1,42 +1,43 @@ { inputs, ... }: { - den.aspects.copyparty = { - nixos = { config, ... }: { + flake-file.inputs.copyparty.url = "github:9001/copyparty"; + den.aspects.services.copyparty = let port = 3210; in { + tunnel = { subdomain = "files"; inherit port; }; + + nixos = { host, config, ... }: let user = host.owner; home = config.users.users.${user}.home; in { imports = [ inputs.copyparty.nixosModules.default ]; nixpkgs.overlays = [ inputs.copyparty.overlays.default ]; - den.tunnels = [ "files" ]; - services.copyparty = { enable = true; - user = "bug"; + inherit user; group = "copyparty"; settings = { i = "0.0.0.0"; - p = [ config.den.portmap.files (config.den.portmap.files + 1) ]; + p = [ port (port + 1) ]; no-reload = true; ignored-flag = false; }; accounts = { - bug = { - passwordFile = "/home/bug/copyparty/bug.passwd"; + ${user} = { + passwordFile = "${home}/copyparty/${user}.passwd"; }; }; groups = { - g1 = [ "bug" ]; + g1 = [ user ]; }; volumes = { "/" = { - path = "/home/bug/copyparty/public/"; + path = "${home}/copyparty/public/"; access = { r = "*"; - rwdma = [ "bug" ]; + rwdma = [ user ]; }; flags = { @@ -46,11 +47,11 @@ }; "/slsk" = { - path = "/home/bug/slskd/complete/"; + path = "${home}/slskd/complete/"; access = { r = "*"; - rwdma = [ "bug" ]; + rwdma = [ user ]; }; flags = { @@ -60,7 +61,7 @@ }; "/nix" = { - path = "/home/bug/nix/"; + path = "${home}/nix/"; access = { r = "*"; @@ -73,11 +74,11 @@ }; "/Music" = { - path = "/home/bug/Music/"; + path = "${home}/Music/"; access = { r = "*"; - rwdma = [ "bug" ]; + rwdma = [ user ]; }; flags = { diff --git a/modules/services/gitea.nix b/modules/services/gitea.nix index 2469cbf..4defbf6 100644 --- a/modules/services/gitea.nix +++ b/modules/services/gitea.nix @@ -1,9 +1,8 @@ { - den.aspects.gitea = { - # includes = [ den.aspects.gitea-mirrors ]; + den.aspects.services.gitea = let port = 3002; in { + tunnel = { subdomain = "git"; inherit port; }; - nixos = { config, ... }: { - den.tunnels = [ "git" ]; + nixos = { host, ... }: { services.gitea = { enable = true; @@ -14,7 +13,8 @@ DISABLE_REGISTRATION = false; }; - settings.server.HTTP_PORT = config.den.portmap.git; + settings.server.HTTP_PORT = port; + settings.server.ROOT_URL = "https://git.${host.domain}/"; /* mirrors = { diff --git a/modules/services/gitea/gitea-mirrors.nix b/modules/services/gitea/gitea-mirrors.nix deleted file mode 100644 index c105dc1..0000000 --- a/modules/services/gitea/gitea-mirrors.nix +++ /dev/null @@ -1,218 +0,0 @@ -{ - den.aspects.gitea-mirrors = { - nixos = { pkgs, lib, config, ... }: - let - cfg = config.services.gitea; - mcfg = cfg.mirrors; - - uniqueOwners = lib.unique ( - (map (m: m.owner) mcfg.repos) ++ - (map (m: m.owner) mcfg.users) - ); - - giteaUrl = "http://localhost:${toString cfg.settings.server.HTTP_PORT}"; - tokenFile = "${cfg.stateDir}/mirror-setup-token"; - - repoSource = m: - if m ? source then m.source - else if (m.service or "git") == "github" then "https://github.com/${m.owner}/${m.repo}.git" - else if (m.service or "git") == "gitlab" then "https://gitlab.com/${m.owner}/${m.repo}.git" - else throw "mirrors.repos: '${m.owner}/${m.repo}' has no source and service '${m.service or "git"}' needs an explicit source"; - - setupScript = pkgs.writeShellScript "gitea-mirror-setup" '' - set -euo pipefail - - GITEA_URL="${giteaUrl}" - TOKEN_FILE="${tokenFile}" - GITEA_CMD="${lib.getExe cfg.package}" - - for i in $(seq 1 60); do - if ${pkgs.curl}/bin/curl -sf "$GITEA_URL/api/v1/version" >/dev/null 2>&1; then - break - fi - sleep 2 - done - - $GITEA_CMD admin user create \ - --username "${mcfg.admin.user}" \ - --email "${mcfg.admin.email}" \ - --random-password \ - --admin \ - --must-change-password=false 2>/dev/null || true - - if [ ! -f "$TOKEN_FILE" ]; then - TOKEN=$($GITEA_CMD admin user generate-access-token \ - --username "${mcfg.admin.user}" \ - --token-name "mirror-setup" \ - --scopes "all" \ - --raw) - echo "$TOKEN" > "$TOKEN_FILE" - chmod 600 "$TOKEN_FILE" - fi - - TOKEN=$(cat "$TOKEN_FILE") - AUTH="Authorization: token $TOKEN" - - ${lib.concatMapStringsSep "\n" (owner: '' - RAND_PASS=$(${pkgs.openssl}/bin/openssl rand -base64 32) - ${pkgs.curl}/bin/curl -sf -X POST "$GITEA_URL/api/v1/admin/users" \ - -H "$AUTH" \ - -H "Content-Type: application/json" \ - -d "{ - \"username\": \"${owner}\", - \"email\": \"${owner}@git.bug.tools\", - \"password\": \"$RAND_PASS\", - \"must_change_password\": false, - \"visibility\": \"public\" - }" >/dev/null 2>&1 || true - '') uniqueOwners} - - ${lib.concatMapStringsSep "\n" (m: '' - ${pkgs.curl}/bin/curl -sf -X POST "$GITEA_URL/api/v1/repos/migrate" \ - -H "$AUTH" \ - -H "Content-Type: application/json" \ - -d '{ - "clone_addr": "${repoSource m}", - "repo_name": "${m.repo}", - "repo_owner": "${m.owner}", - "mirror": true, - "private": false, - "service": "${m.service or "git"}" - }' >/dev/null 2>&1 || true - '') mcfg.repos} - - ${lib.concatMapStringsSep "\n" (u: - let - platform = u.platform; - owner = u.owner; - baseUrl = u.baseUrl or (if platform == "github" then "https://api.github.com" - else if platform == "gitlab" then "https://gitlab.com" - else if platform == "gitea" then u.baseUrl - else throw "mirrors.users: unsupported platform '${platform}', provide baseUrl"); - cloneBase = if platform == "github" then "https://github.com/${owner}" - else if platform == "gitlab" then "${u.baseUrl or "https://gitlab.com"}/${owner}" - else if platform == "gitea" then "${u.baseUrl}/${owner}" - else throw "mirrors.users: unsupported platform '${platform}'"; - service = if platform == "github" then "github" - else if platform == "gitlab" then "gitlab" - else if platform == "gitea" then "gitea" - else "git"; - jqExpr = if platform == "gitlab" then ".[].path" else ".[].name"; - pageSize = if platform == "gitea" then 50 else 100; - pageSizeStr = toString pageSize; - listUrl = if platform == "github" then "${baseUrl}/users/${owner}/repos?per_page=${pageSizeStr}&type=owner" - else if platform == "gitlab" then "${baseUrl}/api/v4/users/${owner}/projects?per_page=${pageSizeStr}" - else "${baseUrl}/api/v1/users/${owner}/repos?limit=${pageSizeStr}"; - in '' - echo "Fetching repos for ${owner} from ${platform}..." - PAGE=1 - while true; do - REPOS=$(${pkgs.curl}/bin/curl -sf "${listUrl}&page=$PAGE" || echo "[]") - - NAMES=$(echo "$REPOS" | ${pkgs.jq}/bin/jq -r '${jqExpr}') - if [ -z "$NAMES" ] || [ "$NAMES" = "null" ]; then - break - fi - - for REPO_NAME in $NAMES; do - ${pkgs.curl}/bin/curl -sf -X POST "$GITEA_URL/api/v1/repos/migrate" \ - -H "$AUTH" \ - -H "Content-Type: application/json" \ - -d "{ - \"clone_addr\": \"${cloneBase}/$REPO_NAME.git\", - \"repo_name\": \"$REPO_NAME\", - \"repo_owner\": \"${owner}\", - \"mirror\": true, - \"private\": false, - \"service\": \"${service}\" - }" >/dev/null 2>&1 || true - done - - COUNT=$(echo "$REPOS" | ${pkgs.jq}/bin/jq 'length') - if [ "$COUNT" -lt ${pageSizeStr} ]; then break; fi - PAGE=$((PAGE + 1)) - done - '') mcfg.users} - - echo "Mirror setup complete." - ''; - in - { - options.services.gitea.mirrors = { - admin = { - user = lib.mkOption { - type = lib.types.str; - default = "admin"; - description = "Gitea admin username for mirror management."; - }; - - email = lib.mkOption { - type = lib.types.str; - default = "admin@localhost"; - description = "Gitea admin email."; - }; - }; - - repos = lib.mkOption { - type = lib.types.listOf (lib.types.attrsOf lib.types.str); - default = []; - description = "Individual repositories to mirror. Each entry: { owner, repo, service?, source? }. Source is auto-derived for github/gitlab."; - example = [ - { owner = "nixos"; repo = "nixpkgs"; service = "github"; } - { owner = "someone"; repo = "thing"; source = "https://custom.instance/someone/thing.git"; } - ]; - }; - - users = lib.mkOption { - type = lib.types.listOf (lib.types.attrsOf lib.types.str); - default = []; - description = "Mirror all public repos of a user/org. Each entry: { owner, platform, baseUrl? }."; - example = [ - { owner = "catppuccin"; platform = "github"; } - ]; - }; - }; - - config = lib.mkIf (mcfg.repos != [] || mcfg.users != []) { - services.gitea.settings.mirror = { - DEFAULT_INTERVAL = "6h"; - MIN_INTERVAL = "10m"; - }; - - services.gitea.settings."cron.update_mirrors" = { - SCHEDULE = "@every 10m"; - RUN_AT_START = true; - }; - - systemd.services.gitea-mirror-setup = { - description = "Setup Gitea mirror repositories"; - after = [ "gitea.service" ]; - requires = [ "gitea.service" ]; - - serviceConfig = { - Type = "oneshot"; - User = cfg.user; - Group = cfg.group; - ExecStart = setupScript; - WorkingDirectory = cfg.stateDir; - Environment = [ - "GITEA_WORK_DIR=${cfg.stateDir}" - "GITEA_CUSTOM=${cfg.customDir}" - ]; - }; - }; - - systemd.timers.gitea-mirror-setup = { - description = "Run Gitea mirror setup on boot and periodically"; - wantedBy = [ "timers.target" ]; - - timerConfig = { - OnBootSec = "2min"; - OnUnitActiveSec = "6h"; - Unit = "gitea-mirror-setup.service"; - }; - }; - }; - }; - }; -} diff --git a/modules/services/glances.nix b/modules/services/glances.nix index 5f74001..9115ba2 100644 --- a/modules/services/glances.nix +++ b/modules/services/glances.nix @@ -1,7 +1,8 @@ { - den.aspects.glances = { - nixos = { pkgs, config, ... }: { - den.tunnels = [ "monitor" ]; + den.aspects.services.glances = let port = 61208; in { + tunnel = { subdomain = "monitor"; inherit port; }; + + nixos = { pkgs, ... }: { environment.systemPackages = [ pkgs.glances ]; @@ -26,7 +27,7 @@ ExecStart = '' ${pkgs.glances}/bin/glances \ -w \ - -p ${toString config.den.portmap.monitor} \ + -p ${toString port} \ -B 0.0.0.0 ''; diff --git a/modules/services/invidious.nix b/modules/services/invidious.nix index 8b8fe8c..aee8329 100644 --- a/modules/services/invidious.nix +++ b/modules/services/invidious.nix @@ -1,13 +1,12 @@ { lib, ... }: { - den.aspects.invidious = { - nixos = { pkgs, config, ... }: let + den.aspects.services.invidious = let port = 3030; in { + tunnel = { subdomain = "tube"; inherit port; }; + + nixos = { pkgs, host, ... }: let companionPort = 8282; companionPath = "/companion"; companionKey = "kKg3RKeZjE7frmvr"; - port = config.den.portmap.tube; in { - den.tunnels = [ "tube" ]; - virtualisation.oci-containers = { backend = "podman"; containers = { @@ -66,9 +65,9 @@ http3-ytproxy.enable = true; settings = { - domain = "tube.bug.tools"; + domain = "tube.${host.domain}"; #https_only = false; - external_port = port; + external_port = 443; # public URLs go through cloudflared on https, not :3030 invidious_companion = [ { @@ -79,11 +78,11 @@ invidious_companion_key = companionKey; continue = true; - local = false; + local = true; # googlevideo URLs are bound to box's IP; proxy playback via companion check_tables = true; https_only = true; use_quic = false; - admins = [ "bug" ]; + admins = [ host.owner ]; use_pubsub_feeds = false; captcha_enabled = false; login_enabled = true; diff --git a/modules/services/llama.nix b/modules/services/llama.nix index b87982a..1d927a6 100644 --- a/modules/services/llama.nix +++ b/modules/services/llama.nix @@ -1,29 +1,10 @@ -{ ... }: { - den.aspects.llama = { +{ den, ... }: { + den.aspects.services.llama = let port = 8080; in { + includes = [ (den.batteries.unfree [ "cccl" "cuda_compat" "cuda_crt" "cuda_cudart" "cuda_nvcc" "cuda_nvrtc" "libcublas" "libnvvm" ]) ]; + + tunnel = { subdomain = "llama"; inherit port; }; + nixos = { pkgs, lib, ... }: { - environment.systemPackages = [ pkgs.cloudflared ]; - environment.etc."cloudflared/608ba37a-1be8-49e8-be2d-abeb8b77081d.json".source = "/home/bug/.cloudflared/608ba37a-1be8-49e8-be2d-abeb8b77081d.json"; - - services.cloudflared = { - enable = true; - tunnels = { - "608ba37a-1be8-49e8-be2d-abeb8b77081d" = { - credentialsFile = "/etc/cloudflared/608ba37a-1be8-49e8-be2d-abeb8b77081d.json"; - - ingress = { - "llama.bug.tools" = "http://127.0.0.1:8080"; - }; - - default = "http_status:404"; - }; - }; - }; - - systemd.services."cloudflared-tunnel-608ba37a-1be8-49e8-be2d-abeb8b77081d".environment = { - TUNNEL_TRANSPORT_PROTOCOL = pkgs.lib.mkForce "http2"; - }; - - services.llama-cpp = let # https://github.com/ggml-org/llama.cpp/blob/master/tools/server/README.md modelsPreset = { @@ -75,7 +56,7 @@ settings = { host = "0.0.0.0"; - port = 8080; + port = port; ctx-size = 65536; models-max = 1; diff --git a/modules/services/mailserver.nix b/modules/services/mailserver.nix index 9d830f1..6fa5478 100644 --- a/modules/services/mailserver.nix +++ b/modules/services/mailserver.nix @@ -1,15 +1,21 @@ { inputs, ... }: { - den.aspects.mailserver = { - nixos = { + flake-file.inputs.nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver"; + den.aspects.services.mailserver = let port = 8088; in { + tunnel = [ + { subdomain = "mail"; inherit port; } + { subdomain = "email"; inherit port; } + ]; + + nixos = { host, config, ... }: let user = host.owner; home = config.users.users.${user}.home; inherit (host) domain; in { imports = [ inputs.nixos-mailserver.nixosModules.default ]; security.acme = { acceptTerms = true; - defaults.email = "security@bug.tools"; + defaults.email = "security@${domain}"; - certs."mx.bug.tools" = { - listenHTTP = "1360"; + certs."mx.${domain}" = { + listenHTTP = ":1360"; }; }; @@ -18,10 +24,10 @@ stateVersion = 4; - fqdn = "mx.bug.tools"; - domains = [ "bug.tools" ]; + fqdn = "mx.${domain}"; + domains = [ "${domain}" ]; - x509.useACMEHost = "mx.bug.tools"; + x509.useACMEHost = "mx.${domain}"; fullTextSearch = { enable = true; @@ -30,51 +36,46 @@ }; accounts = { - "bug@bug.tools" = { - hashedPasswordFile = "/home/bug/mailserver/bug.passwd"; + "${user}@${domain}" = { + hashedPasswordFile = "${home}/mailserver/bug.passwd"; aliases = [ - "admin@bug.tools" - "security@bug.tools" - "google@bug.tools" - "apple@bug.tools" - "roblox@bug.tools" - "twitch@bug.tools" - "discord@bug.tools" - "github@bug.tools" - "matrix@bug.tools" - "git@bug.tools" - "contact@bug.tools" - "claude@bug.tools" - "rumble@bug.tools" - "bambu@bug.tools" - "soulframe@bug.tools" - "vortex@bug.tools" - "codex@bug.tools" - "tailscale@bug.tools" - "firefox@bug.tools" - "keldurn@bug.tools" - "brax@bug.tools" + "admin@${domain}" + "security@${domain}" + "google@${domain}" + "apple@${domain}" + "roblox@${domain}" + "twitch@${domain}" + "discord@${domain}" + "github@${domain}" + "matrix@${domain}" + "git@${domain}" + "contact@${domain}" + "claude@${domain}" + "rumble@${domain}" + "bambu@${domain}" + "soulframe@${domain}" + "vortex@${domain}" + "codex@${domain}" + "tailscale@${domain}" + "firefox@${domain}" + "keldurn@${domain}" + "brax@${domain}" ]; }; - "pare@bug.tools" = { - hashedPasswordFile = "/home/bug/mailserver/pare.passwd"; + "pare@${domain}" = { + hashedPasswordFile = "${home}/mailserver/pare.passwd"; }; - "poop@bug.tools" = { - hashedPasswordFile = "/home/bug/mailserver/pare.passwd"; + "poop@${domain}" = { + hashedPasswordFile = "${home}/mailserver/pare.passwd"; }; }; }; - den.tunnels = [ - "mail" - "email" - ]; - services.roundcube = { enable = true; - hostName = "mail.bug.tools"; + hostName = "mail.${domain}"; extraConfig = '' $config['imap_host'] = 'ssl://localhost:993'; $config['imap_conn_options'] = [ @@ -86,20 +87,20 @@ ]; $config['smtp_user'] = "%u"; $config['smtp_pass'] = "%p"; - $config['username_domain'] = 'bug.tools'; + $config['username_domain'] = '${domain}'; ''; }; services.nginx.enable = true; - services.nginx.virtualHosts."mail.bug.tools" = { + services.nginx.virtualHosts."mail.${domain}" = { forceSSL = false; enableACME = false; listen = [ { addr = "0.0.0.0"; - port = 8088; + port = port; } ]; }; diff --git a/modules/services/matrix.nix b/modules/services/matrix.nix index 06e0bf5..bf9f6f0 100644 --- a/modules/services/matrix.nix +++ b/modules/services/matrix.nix @@ -1,13 +1,14 @@ { - den.aspects.matrix = { + den.aspects.services.matrix = { nixos = { config, pkgs, lib, + host, ... }: let - port = config.den.portmap.matrix; - domain = "bug.tools"; + port = 8008; + inherit (host) domain; matrixDomain = "matrix.${domain}"; clientConfig = { "m.homeserver".base_url = "https://${matrixDomain}"; diff --git a/modules/services/minecraft-server.nix b/modules/services/minecraft-server.nix deleted file mode 100644 index 0967ef4..0000000 --- a/modules/services/minecraft-server.nix +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/modules/services/mpd.nix b/modules/services/mpd.nix index a413afe..7cd7359 100644 --- a/modules/services/mpd.nix +++ b/modules/services/mpd.nix @@ -1,16 +1,16 @@ { - den.aspects.mpd = { + den.aspects.services.mpd = { homeManager = { services.mpd-mpris.enable = true; }; - nixos = { + nixos = { host, config, ... }: let user = host.owner; home = config.users.users.${user}.home; in { services = { mpd = { enable = true; settings = { - music_directory = "/home/bug/Music"; + music_directory = "${home}/Music"; decoder = [ { @@ -29,7 +29,7 @@ }]; }; - user = "bug"; + inherit user; }; }; diff --git a/modules/services/omnisearch.nix b/modules/services/omnisearch.nix index a502807..a3cbc87 100644 --- a/modules/services/omnisearch.nix +++ b/modules/services/omnisearch.nix @@ -1,10 +1,16 @@ { inputs, ... }: { - den.aspects.omnisearch = { + /* + flake-file.inputs.omnisearch = { + url = "git+https://git.bwaaa.monster/omnisearch"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + */ + den.aspects.services.omnisearch = { + tunnel = { subdomain = "omnisearch"; port = 8087; }; # module default port + nixos = { imports = [ inputs.omnisearch.nixosModules.default ]; - den.tunnels = [ "omnisearch" ]; - services.omnisearch.enable = true; }; }; diff --git a/modules/services/ports.nix b/modules/services/ports.nix deleted file mode 100644 index 86793b4..0000000 --- a/modules/services/ports.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - den.aspects.portmap.nixos = { lib, ... }: { - options.den.portmap = lib.mkOption { - type = lib.types.attrsOf lib.types.port; - default = {}; - description = "ports"; - }; - - config.den.portmap = { - tvtun = 3001; - search = 8888; - files = 3210; - tube = 3030; - reddit = 8975; - git = 3002; - monitor = 61208; - matrix = 8008; - omnisearch = 8087; - mail = 8088; - email = 8088; - llama = 8080; - api-tv = 8789; - seek = 8089; - fleet = 8090; - mpd = 6600; - }; - }; -} diff --git a/modules/services/pstream.nix b/modules/services/pstream.nix deleted file mode 100644 index 0db3279..0000000 --- a/modules/services/pstream.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - -} diff --git a/modules/services/redlib.nix b/modules/services/redlib.nix deleted file mode 100644 index 624be18..0000000 --- a/modules/services/redlib.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ - den.aspects.redlib = { - nixos = { config, ... }: { - den.tunnels = [ "reddit" ]; - - services.redlib = { - enable = true; - - address = "127.0.0.1"; - port = config.den.portmap.reddit; - openFirewall = true; - - 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"; - }; - }; - }; - }; -} diff --git a/modules/services/searxng/searxng.nix b/modules/services/searxng/searxng.nix index 97f70e2..af075ad 100644 --- a/modules/services/searxng/searxng.nix +++ b/modules/services/searxng/searxng.nix @@ -1,23 +1,23 @@ { - den.aspects.searxng = { - nixos = { config, ... }: { - den.tunnels = [ "search" ]; + den.aspects.services.searxng = let port = 8888; in { + tunnel = { subdomain = "search"; inherit port; }; + nixos = { host, config, ... }: let user = host.owner; home = config.users.users.${user}.home; in { systemd.services.searx-init.serviceConfig.EnvironmentFile = [ - "/home/bug/.searxng.env" + "${home}/.searxng.env" ]; services.searx = { enable = true; redisCreateLocally = false; configureUwsgi = false; - settingsFile = ./searxng.yml; - environmentFile = "/home/bug/.searxng.env"; + settingsFile = builtins.path { path = ./searxng.yml; name = "searxng.yml"; }; + environmentFile = "${home}/.searxng.env"; settings = { - general.instance_name = "search.bug.tools"; + general.instance_name = "search.${host.domain}"; - server.port = config.den.portmap.search; + server.port = port; server.bind_address = "0.0.0.0"; server.secret_key = "$SEARX_SECRET_KEY"; }; diff --git a/modules/services/sish.nix b/modules/services/sish.nix deleted file mode 100644 index e7a79c9..0000000 --- a/modules/services/sish.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - den.aspects.sish = { - nixos = { - - }; - }; -} diff --git a/modules/services/slskd.nix b/modules/services/slskd.nix index 461bbb7..7cc0a28 100644 --- a/modules/services/slskd.nix +++ b/modules/services/slskd.nix @@ -1,32 +1,33 @@ { lib, inputs, ... }: { - den.aspects.slskd = { - nixos = { pkgs, config, ... }: { - den.tunnels = [ "seek" ]; + den.aspects.services.slskd = let port = 8089; in { + tunnel = { subdomain = "seek"; inherit port; }; + + nixos = { pkgs, host, config, ... }: let user = host.owner; home = config.users.users.${user}.home; in { environment.systemPackages = with pkgs; [ slskd ]; systemd.services.slskd.serviceConfig = { - ReadWritePaths = [ "/home/bug/slskd" ]; + ReadWritePaths = [ "${home}/slskd" ]; ProtectHome = lib.mkForce false; }; services.slskd = { enable = true; - user = "bug"; + inherit user; - settings.web.port = 8089; + settings.web.port = port; - environmentFile = "/home/bug/slskd/env"; + environmentFile = "${home}/slskd/env"; settings = { directories = { - downloads = "/home/bug/slskd/complete"; - incomplete = "/home/bug/slskd/incomplete"; + downloads = "${home}/slskd/complete"; + incomplete = "${home}/slskd/incomplete"; }; - shares.directories = [ "/home/bug/slskd/share" ]; + shares.directories = [ "${home}/slskd/share" ]; shares.filters = [ "\\.ini$" diff --git a/modules/services/vscode-server.nix b/modules/services/vscode-server.nix index dae3891..98767bb 100644 --- a/modules/services/vscode-server.nix +++ b/modules/services/vscode-server.nix @@ -1,8 +1,9 @@ -{ - den.aspects.vscode-server = { +{ inputs, ... }: { + flake-file.inputs.vscode-server.url = "github:nix-community/nixos-vscode-server"; + den.aspects.services.vscode-server = { nixos = { imports = [ - (fetchTarball "https://github.com/nix-community/nixos-vscode-server/tarball/master") + inputs.vscode-server.nixosModules.default ]; services.vscode-server.enable = true; diff --git a/modules/software/browsers/firefox.nix b/modules/software/browsers/firefox.nix index 4b8d226..a5feab6 100644 --- a/modules/software/browsers/firefox.nix +++ b/modules/software/browsers/firefox.nix @@ -1,5 +1,7 @@ -{ - den.aspects.firefox = { +{ den, ... }: { + den.aspects.software.browsers = { + includes = [ (den.batteries.unfree [ "firefox-bin" "firefox-bin-unwrapped" ]) ]; + nixos = { pkgs, ... }: { programs.firefox = { enable = true; diff --git a/modules/software/browsers/librewolf.nix b/modules/software/browsers/librewolf.nix index 9394e24..cdd99ab 100644 --- a/modules/software/browsers/librewolf.nix +++ b/modules/software/browsers/librewolf.nix @@ -1,11 +1,15 @@ -{ inputs, lib, ... }: { - den.aspects.librewolf = { - homeManager = { pkgs, ... }: { +{ lib, ... }: { + flake-file.inputs.catppuccin-userstyles-nix = { + url = "github:4DBug/catppuccin-userstyles-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + den.aspects.software.browsers = { + homeManager = { host, ... }: { programs.librewolf = { enable = true; settings = { - "browser.startup.homepage" = "https://search.bug.tools"; + "browser.startup.homepage" = "https://search.${host.domain}"; "browser.startup.page" = 3; "datareporting.healthreport.uploadEnabled" = false; @@ -68,20 +72,20 @@ search = { force = true; - default = "search.bug.tools"; + default = "search.${host.domain}"; engines = { - "search.bug.tools" = { + "search.${host.domain}" = { urls = [ { - template = "https://search.bug.tools/search"; + template = "https://search.${host.domain}/search"; params = [ { name = "q"; value = "{searchTerms}"; } ]; } ]; - icon = "https://search.bug.tools/favicon.ico"; + icon = "https://search.${host.domain}/favicon.ico"; definedAliases = [ "@s" "@sq" ]; }; @@ -184,7 +188,6 @@ "{1b66b5ad-408f-4300-aac6-55a68b2b24ff}" # catppuccin-mocha-no-borders - "{1b66b5ad-408f-4300-aac6-55a68b2b24ff}" # catppuccin-mocha-no-borders "{7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}" # styl-us diff --git a/modules/software/cad/blender.nix b/modules/software/cad/blender.nix index 7e22800..7cf089b 100644 --- a/modules/software/cad/blender.nix +++ b/modules/software/cad/blender.nix @@ -1,14 +1,6 @@ { - den.aspects.cad = { - nixos = { pkgs, ... }: { - users.users.bug.packages = with pkgs; [ - #blender - plasticity - #orca-slicer - ]; - }; - - homeManager = { pkgs , ... }: { + den.aspects.software.cad = { + homeManager = { pkgs, ... }: { home.packages = let blenderScripts = pkgs.runCommand "blender-user-scripts" { } '' mkdir -p $out/addons @@ -32,7 +24,9 @@ --set QUADREMESHER_LAUNCHER ${quadRemesherLauncher} ''; }; - in [ blender-quadremesher ]; + in [ + blender-quadremesher + ]; }; }; } diff --git a/modules/software/cli/opencode.nix b/modules/software/cli/opencode.nix index 891abbf..6748b27 100644 --- a/modules/software/cli/opencode.nix +++ b/modules/software/cli/opencode.nix @@ -1,5 +1,10 @@ { - den.aspects.opencode = { + den.aspects.software.cli = let + # llama endpoint lives on the entity's domain (host, or standalone home) + llama = e: { homeManager.programs.opencode.settings.provider."llama.cpp".options.baseURL = "https://llama.${e.domain}/v1"; }; + in { + includes = [ ({ host, ... }: llama host) ({ home, ... }: llama home) ]; + homeManager = { programs.opencode = { enable = true; @@ -26,9 +31,6 @@ "llama.cpp" = { npm = "@ai-sdk/openai-compatible"; name = "llama.cpp"; - options = { - baseURL = "https://llama.bug.tools/v1"; - }; models = { "qwen3.6-35b-a3b" = { name = "qwen3.6-35b-a3b"; diff --git a/modules/software/compatibility/appimage.nix b/modules/software/compatibility/appimage.nix deleted file mode 100644 index 0ee76f1..0000000 --- a/modules/software/compatibility/appimage.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ ... }: { - den.aspects.appimage = { - nixos = { pkgs, ... }: { - environment.systemPackages = with pkgs; [ - appimage-run - ]; - - programs.appimage = { - enable = true; - binfmt = true; - }; - }; - }; -} \ No newline at end of file diff --git a/modules/software/compatibility/compatibility.nix b/modules/software/compatibility/compatibility.nix deleted file mode 100644 index e454694..0000000 --- a/modules/software/compatibility/compatibility.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ den, ... }: { - den.aspects.compatibility = { - includes = with den.aspects; [ wine appimage nix-ld nix-alien ]; - }; -} diff --git a/modules/software/compatibility/nix-alien.nix b/modules/software/compatibility/nix-alien.nix deleted file mode 100644 index 24d5216..0000000 --- a/modules/software/compatibility/nix-alien.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ - den.aspects.nix-alien = { - nixos = { - environment.systemPackages = let - nix-alien = import ( - fetchTarball "https://github.com/thiagokokada/nix-alien/tarball/master" - ){}; - in [ - nix-alien.nix-alien - ]; - }; - }; -} diff --git a/modules/software/compatibility/wine.nix b/modules/software/compatibility/wine.nix deleted file mode 100644 index a556dcf..0000000 --- a/modules/software/compatibility/wine.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ ... }: { - den.aspects.wine = { - nixos = { pkgs, ... }: { - environment.systemPackages = with pkgs; [ - wine64 - wineWow64Packages.full - ]; - }; - }; -} \ No newline at end of file diff --git a/modules/software/development/development.nix b/modules/software/development/development.nix deleted file mode 100644 index 72bf5d1..0000000 --- a/modules/software/development/development.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ den, ... }: { - den.aspects.development = { - includes = with den.aspects; [ editors java ]; - }; -} diff --git a/modules/software/development/editors.nix b/modules/software/development/editors.nix deleted file mode 100644 index 0b2a35b..0000000 --- a/modules/software/development/editors.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ ... }: { - den.aspects.editors = { - nixos = { pkgs, ... }: { - users.users.bug.packages = with pkgs; [ - zed-editor - #arduino-ide - - # add to languages later - python314Packages.pyside6 - ]; - }; - }; -} diff --git a/modules/software/development/java.nix b/modules/software/development/java.nix deleted file mode 100644 index 06b7999..0000000 --- a/modules/software/development/java.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: { - den.aspects.java = { - nixos = { pkgs, ... }: { - users.users.bug.packages = with pkgs; [ - jdk25 - ]; - }; - }; -} diff --git a/modules/software/essentials.nix b/modules/software/essentials.nix deleted file mode 100644 index 5562f8b..0000000 --- a/modules/software/essentials.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - den.aspects.essentials = { - nixos = { pkgs, ... }: { - environment.systemPackages = with pkgs; [ - comma - git - home-manager - inetutils - micro - nh - nil - nixd - nixfmt - nix-index - nix-output-monitor - nix-prefetch - nvd - psmisc - tree - unzip - wget - ]; - }; - }; -} diff --git a/modules/software/fish.nix b/modules/software/fish.nix deleted file mode 100644 index 338f5ff..0000000 --- a/modules/software/fish.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - den.aspects.fish = { - nixos = { pkgs, ...}: { - programs.fish = { - shellAliases = { - box = "ssh box.bug.tools"; - unbox = "sh -c 'ssh -N -L \"$1\":0.0.0.0:\"$1\" box.bug.tools &' --"; - rebox = "sh -c 'fuser -k \"$1\"/tcp' --"; - dock = "sh -c 'ssh -N -D \"$1\" box.bug.tools &' --"; - - vpn = "sshuttle --dns --python python3 -r box.bug.tools 0/0"; - - pico = "ssh pico.sh"; - - ns = "nh os switch ~/nix --impure -H (hostname)"; - rebuild = "ns"; - }; - - shellInit = '' - function tssh - ssh (tailscale status | awk -v host=$argv[1] '$2 == host {print $1}') - end - ''; - }; - - environment.systemPackages = with pkgs.fishPlugins; [ - sponge - ]; - }; - }; -} diff --git a/modules/software/gaming/emulators.nix b/modules/software/gaming/emulators.nix index 78da08d..c535a96 100644 --- a/modules/software/gaming/emulators.nix +++ b/modules/software/gaming/emulators.nix @@ -1,9 +1,5 @@ -{ ... }: { - den.aspects.emulators = { - nixos = { pkgs, ... }: { - users.users.bug.packages = with pkgs; [ - ppsspp - ]; - }; +{ + den.aspects.software.gaming.homeManager = { pkgs, ... }: { + home.packages = [ pkgs.ppsspp ]; }; } diff --git a/modules/software/gaming/game-tools.nix b/modules/software/gaming/game-tools.nix index da39c3d..3232398 100644 --- a/modules/software/gaming/game-tools.nix +++ b/modules/software/gaming/game-tools.nix @@ -1,18 +1,12 @@ -{ ... }: { - den.aspects.game-tools = { - nixos = { pkgs, ... }: { - users.users.bug.packages = with pkgs; [ - steamtinkerlaunch - scanmem - samrewritten - lug-helper - gamemode - steam-run - ]; - - services.flatpak.packages = [ - "community.pathofbuilding.PathOfBuilding" - ]; - }; +{ + den.aspects.software.gaming.homeManager = { pkgs, ... }: { + home.packages = with pkgs; [ + steamtinkerlaunch + scanmem + samrewritten + lug-helper + gamemode + steam-run + ]; }; } diff --git a/modules/software/gaming/gaming.nix b/modules/software/gaming/gaming.nix deleted file mode 100644 index 6527614..0000000 --- a/modules/software/gaming/gaming.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ den, ... }: -{ - den.aspects.gaming = { - includes = with den.aspects; [ - steam - roblox - polytoria - game-tools - emulators - star-citizen - minecraft - ]; - }; -} diff --git a/modules/software/gaming/hytale.nix b/modules/software/gaming/hytale.nix index 7cfa9bb..af76edf 100644 --- a/modules/software/gaming/hytale.nix +++ b/modules/software/gaming/hytale.nix @@ -1,7 +1,8 @@ { inputs, ... }: { - den.aspects.hytale = { - nixos = { pkgs, ... }: { - users.users.bug.packages = [ + flake-file.inputs.hytale-launcher.url = "github:JPyke3/hytale-launcher-nix"; + den.aspects.software.gaming.hytale = { + homeManager = { pkgs, ... }: { + home.packages = [ inputs.hytale-launcher.packages.${pkgs.system}.default ]; }; diff --git a/modules/software/gaming/minecraft.nix b/modules/software/gaming/minecraft.nix index 607ad82..1e9a83f 100644 --- a/modules/software/gaming/minecraft.nix +++ b/modules/software/gaming/minecraft.nix @@ -1,139 +1,61 @@ { inputs, ... }: { - den.aspects.minecraft = { - nixos = - { pkgs, ... }: + flake-file.inputs = { + minecraft = { + url = "github:4DBug/minecraft.nix"; + inputs.metadata.follows = "minecraft-metadata"; + }; + minecraft-metadata.url = "github:Ninlives/minecraft.json"; + }; + den.aspects.software.gaming = { + homeManager = + { pkgs, config, ... }: let - inherit (pkgs) fetchurl symlinkJoin makeWrapper; + home = config.home.homeDirectory; + inherit (pkgs) lib symlinkJoin makeWrapper; + + # ponytail: no hashes, needs --impure; files re-download after tarball-ttl (1h) and may change upstream + fetch = map (url: rec { + name = lib.strings.sanitizeDerivationName (lib.replaceStrings [ "%20" "%2B" ] [ "-" "+" ] (baseNameOf url)); + outPath = builtins.fetchurl { inherit url name; }; + }); base = (inputs.minecraft.legacyPackages.${pkgs.stdenv.hostPlatform.system}.v1_21_11.fabric.client.withConfig [{ jvmArgs = [ "-Dorg.lwjgl.opengl.Window.undecorated=true" ]; - mods = [ - (fetchurl { - name = "fabric-api.jar"; - url = "https://cdn.modrinth.com/data/P7dR8mSH/versions/i5tSkVBH/fabric-api-0.141.3+1.21.11.jar"; - sha256 = "sha256:1xgfpy6zj1nwwfrhr346firm8zw6lw63pl4parvjwrirc6l57i46"; - }) + mods = fetch [ + "https://cdn.modrinth.com/data/P7dR8mSH/versions/i5tSkVBH/fabric-api-0.141.3+1.21.11.jar" + # "https://meteorclient.com/api/download" + # "https://www.meteorclient.com/api/downloadBaritone" - /* - (fetchurl { - name = "meteor-client.jar"; - url = "https://meteorclient.com/api/download"; - sha256 = "sha256:190vghnfg3invfy7qpizppxf29qyf5zz1iv5c8bfcq2q5r9mljqq"; - }) - - (fetchurl { - name = "baritone.jar"; - url = "https://www.meteorclient.com/api/downloadBaritone"; - sha256 = "sha256:0izys47kvqzhnds63kbxiifn8fsd8i9slzkhv91whwxp0183pf80"; - }) - */ - - (fetchurl { - name = "modmenu.jar"; - url = "https://cdn.modrinth.com/data/mOgUt4GM/versions/Tyk71iSw/modmenu-17.0.0.jar"; - sha256 = "sha256:0a2i5hl77bcw33m1h51y1dxrk7bbkj8fv0rp8w6y78d43ibwkwlm"; - }) - - /* - (fetchurl { - name = "distant-horizons.jar"; - url = "https://cdn.modrinth.com/data/uCdwusMi/versions/GT3Bm3GN/DistantHorizons-2.4.5-b-1.21.11-fabric-neoforge.jar"; - sha256 = "sha256:0gxwhvji4k0xnzidwrvlndh81r64n6i24v253grbxxamgshwg53n"; - }) - */ - - (fetchurl { - name = "voxy.jar"; - url = "https://cdn.modrinth.com/data/fxxUqruK/versions/H3w2nVdU/voxy-0.2.16-beta%2B1.21.11.jar"; - sha256 = "sha256:02z1cr7ccdss2ckgha7v89gsq65p2ibrcx8h9q3drxd4ck7jd0kz"; - }) - - /* - (fetchurl { - name = "nvidium.jar"; - url = "https://cdn.modrinth.com/data/SfMw2IZN/versions/4x9ci9sF/nvidium-0.4.3-beta13-1.21.11.jar"; - sha256 = "sha256:0kdhz92lms2ghmcpzn1gj9rblh958bhic641jpvpkgn0rs70w54r"; - }) - */ - - (fetchurl { - name = "iris.jar"; - url = "https://cdn.modrinth.com/data/YL57xq9U/versions/fDpuVzVr/iris-fabric-1.10.7+mc1.21.11.jar"; - sha256 = "sha256:06fb6r22gnsxnv2w0sgvfnsj6fk3a7jcxls7z14imjc9h6hmviaq"; - }) - - (fetchurl { - name = "sodium.jar"; - url = "https://cdn.modrinth.com/data/AANobbMI/versions/UddlN6L4/sodium-fabric-0.8.7+mc1.21.11.jar"; - sha256 = "sha256:10rrqnyn8mb14b1k3ks84g6033zkkn94fwvyyflaiajhnf3ax3y0"; - }) - - (fetchurl { - name = "lithium.jar"; - url = "https://cdn.modrinth.com/data/gvQqBUqZ/versions/Ow7wA0kG/lithium-fabric-0.21.4+mc1.21.11.jar"; - sha256 = "sha256:12y704i98rf0xb438f72hi0aqhsi35jxwjs2575vsg5lllfw8dai"; - }) - - (fetchurl { - name = "immediatelyfast.jar"; - url = "https://cdn.modrinth.com/data/5ZwdcRci/versions/QwkfUKSj/ImmediatelyFast-Fabric-1.14.2+1.21.11.jar"; - sha256 = "sha256:1248yg69f5d232qn138xlcsdmbs2yj3gdjx9zl53v19c1j326pgb"; - }) - - (fetchurl { - name = "entity-culling.jar"; - url = "https://cdn.modrinth.com/data/NNAgCjsB/versions/SK12FGQf/entityculling-fabric-1.10.0-mc1.21.11.jar"; - sha256 = "sha256:0iws5ql4k542lr4psrcw9hj5z4zz81218ywnpsl77zj8wnwm4l1d"; - }) - - (fetchurl { - name = "ferrite-core.jar"; - url = "https://cdn.modrinth.com/data/uXXizFIs/versions/Ii0gP3D8/ferritecore-8.2.0-fabric.jar"; - sha256 = "sha256:05f7q9jac16syfnahd6r4kx3aqm4i580y623gk6810plrdhdfszp"; - }) - - (fetchurl { - name = "dynamic-fps.jar"; - url = "https://cdn.modrinth.com/data/LQ3K71Q1/versions/PUe5Asxs/dynamic-fps-3.11.4+minecraft-1.21.11-fabric.jar"; - sha256 = "sha256:13dh0226f6j70ak752fj8s00hmrx175v9607plf4rhia9plqy3kx"; - }) - - # (fetchurl { - # name = "removing-loading-screens.jar"; - # url = "https://cdn.modrinth.com/data/ZP7xHXtw/versions/TCSbq6jC/rrlsFabric-5.1.15+mc.1.21.11.jar"; - # sha256 = "sha256:16dkj8baa6xn47n9alzy4104wz6z4zp719dxwv5wm96g2wkp1z57"; - # }) + "https://cdn.modrinth.com/data/mOgUt4GM/versions/Tyk71iSw/modmenu-17.0.0.jar" + # "https://cdn.modrinth.com/data/uCdwusMi/versions/GT3Bm3GN/DistantHorizons-2.4.5-b-1.21.11-fabric-neoforge.jar" + "https://cdn.modrinth.com/data/fxxUqruK/versions/H3w2nVdU/voxy-0.2.16-beta%2B1.21.11.jar" + # "https://cdn.modrinth.com/data/SfMw2IZN/versions/4x9ci9sF/nvidium-0.4.3-beta13-1.21.11.jar" + "https://cdn.modrinth.com/data/YL57xq9U/versions/fDpuVzVr/iris-fabric-1.10.7+mc1.21.11.jar" + "https://cdn.modrinth.com/data/AANobbMI/versions/UddlN6L4/sodium-fabric-0.8.7+mc1.21.11.jar" + "https://cdn.modrinth.com/data/gvQqBUqZ/versions/Ow7wA0kG/lithium-fabric-0.21.4+mc1.21.11.jar" + "https://cdn.modrinth.com/data/5ZwdcRci/versions/QwkfUKSj/ImmediatelyFast-Fabric-1.14.2+1.21.11.jar" + "https://cdn.modrinth.com/data/NNAgCjsB/versions/SK12FGQf/entityculling-fabric-1.10.0-mc1.21.11.jar" + "https://cdn.modrinth.com/data/uXXizFIs/versions/Ii0gP3D8/ferritecore-8.2.0-fabric.jar" + "https://cdn.modrinth.com/data/LQ3K71Q1/versions/PUe5Asxs/dynamic-fps-3.11.4+minecraft-1.21.11-fabric.jar" + # "https://cdn.modrinth.com/data/ZP7xHXtw/versions/TCSbq6jC/rrlsFabric-5.1.15+mc.1.21.11.jar" ]; - resourcePacks = [ - (fetchurl { - name = "unique-dark.zip"; - url = "https://cdn.modrinth.com/data/BaY1UdGV/versions/UjQJb5zE/Unique%20Dark%20-%20Lite%20-%201.20.2-26.x.zip"; - sha256 = "sha256:19cv5q8pnvxkf96lazg8angbfqwkxag8qsxk31cv487jq99kl621"; - }) - - (fetchurl { - name = "catppuccin.zip"; - url = "https://cdn.modrinth.com/data/S3nUv9ws/versions/znzS3kCV/Catppuccin%20Mocha%20Blue.zip"; - sha256 = "sha256:0w56gkyavz0gpffxs1gbp9676bwgvl845h56wc1x3qjba1nm8a5n"; - }) + resourcePacks = fetch [ + "https://cdn.modrinth.com/data/BaY1UdGV/versions/UjQJb5zE/Unique%20Dark%20-%20Lite%20-%201.20.2-26.x.zip" + "https://cdn.modrinth.com/data/S3nUv9ws/versions/znzS3kCV/Catppuccin%20Mocha%20Blue.zip" ]; - shaderPacks = [ - (fetchurl { - name = "complementary-shaders.zip"; - url = "https://cdn.modrinth.com/data/HVnmMxH1/versions/836bPNGo/ComplementaryReimagined_r5.7.1.zip"; - sha256 = "sha256:1w33kyknwc0qsi6l0saww906iwi9d3hkn0nm7hnl4bc3lws0d8i4"; - }) + shaderPacks = fetch [ + "https://cdn.modrinth.com/data/HVnmMxH1/versions/836bPNGo/ComplementaryReimagined_r5.7.1.zip" ]; appArgs = [ "--gameDir" - "/home/bug/.local/share/minecraft" + "${home}/.local/share/minecraft" ]; }]); @@ -143,12 +65,12 @@ nativeBuildInputs = [ makeWrapper ]; postBuild = '' wrapProgram $out/bin/minecraft \ - --set XDG_DATA_HOME "/home/bug/.local/share/minecraft" + --set XDG_DATA_HOME "${home}/.local/share/minecraft" ''; }; in { - users.users.bug.packages = [ minecraft ]; + home.packages = [ minecraft ]; }; }; } diff --git a/modules/software/gaming/polytoria.nix b/modules/software/gaming/polytoria.nix index b291bdc..a8dcd0c 100644 --- a/modules/software/gaming/polytoria.nix +++ b/modules/software/gaming/polytoria.nix @@ -1,16 +1,14 @@ -{ ... }: { - den.aspects.polytoria = { - nixos = { pkgs, ... }: { - services.flatpak.packages = [ - { - appId = "com.polytoria.launcher"; +{ + den.aspects.software.gaming.nixos = { pkgs, ... }: { + services.flatpak.packages = [ + { + appId = "com.polytoria.launcher"; + sha256 = "sha256-VjhNiJfSdCtlH2SuP3Mn8jjOrx5xcOqhtDKaWYIwxYg="; + bundle = "${pkgs.fetchurl { + url = "https://github.com/4DBug/poly/releases/download/poly/poly.flatpak"; sha256 = "sha256-VjhNiJfSdCtlH2SuP3Mn8jjOrx5xcOqhtDKaWYIwxYg="; - bundle = "${pkgs.fetchurl { - url = "https://github.com/4DBug/poly/releases/download/poly/poly.flatpak"; - sha256 = "sha256-VjhNiJfSdCtlH2SuP3Mn8jjOrx5xcOqhtDKaWYIwxYg="; - }}"; - } - ]; - }; + }}"; + } + ]; }; } diff --git a/modules/software/gaming/roblox.nix b/modules/software/gaming/roblox.nix deleted file mode 100644 index cb9cd12..0000000 --- a/modules/software/gaming/roblox.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ ... }: { - den.aspects.roblox = { - nixos = { - services.flatpak.packages = [ - "org.vinegarhq.Sober" - # "org.vinegarhq.Vinegar" - ]; - }; - }; -} diff --git a/modules/software/gaming/star-citizen.nix b/modules/software/gaming/star-citizen.nix index 79f0dc5..3837906 100644 --- a/modules/software/gaming/star-citizen.nix +++ b/modules/software/gaming/star-citizen.nix @@ -1,5 +1,12 @@ { inputs, ... }: { - den.aspects.star-citizen = { + flake-file.inputs = { + nix-gaming.url = "github:fufexan/nix-gaming"; + nix-citizen = { + url = "github:LovingMelody/nix-citizen"; + inputs.nix-gaming.follows = "nix-gaming"; + }; + }; + den.aspects.software.gaming = { nixos = { pkgs, ... }: { imports = [ inputs.nix-citizen.nixosModules.default ]; diff --git a/modules/software/gaming/steam.nix b/modules/software/gaming/steam.nix index 0835330..daf836e 100644 --- a/modules/software/gaming/steam.nix +++ b/modules/software/gaming/steam.nix @@ -1,5 +1,8 @@ -{ inputs, ... }: { - den.aspects.steam = { +{ den, inputs, ... }: { + flake-file.inputs.millennium.url = "github:SteamClientHomebrew/Millennium?dir=packages/nix"; + den.aspects.software.gaming = { + includes = [ (den.batteries.unfree [ "steam" "steam-unwrapped" ]) ]; + nixos = { pkgs, ... }: { nixpkgs.overlays = [ inputs.millennium.overlays.default ]; diff --git a/modules/software/music/beets.nix b/modules/software/music/beets.nix index cc338fc..07210f0 100644 --- a/modules/software/music/beets.nix +++ b/modules/software/music/beets.nix @@ -1,6 +1,6 @@ { - den.aspects.beets = { - homeManager = { pkgs, ... }: { + den.aspects.software.music = { + homeManager = { pkgs, config, ... }: { home = { packages = with pkgs; [ beets @@ -32,7 +32,7 @@ format: opus formats: opus: ffmpeg -i $source -y -vn -c:a libopus -b:a 160k $dest - dest: /home/bug/Music + dest: ${config.home.homeDirectory}/Music fetchart: auto: yes diff --git a/modules/software/music/default.nix b/modules/software/music/default.nix index 44e5273..2faf180 100644 --- a/modules/software/music/default.nix +++ b/modules/software/music/default.nix @@ -1,12 +1,17 @@ -{ ... }: { - den.aspects.player = { - nixos = { pkgs, ... }: { - users.users.bug.packages = with pkgs; [ +{ den, ... }: { + den.aspects.software.music = { + includes = [ den.aspects.services.mpd ]; + + homeManager = { pkgs, ... }: { + home.packages = with pkgs; [ euphonica rhythmbox kew + nicotine-plus ]; + }; + nixos = { services.flatpak.packages = [ "org.pipewire.Helvum" ]; diff --git a/modules/software/music/music.nix b/modules/software/music/music.nix deleted file mode 100644 index 609f835..0000000 --- a/modules/software/music/music.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ den, ... }: { - den.aspects.music = { - includes = with den.aspects; [ beets player nicotine mpd ]; - }; -} diff --git a/modules/software/music/nicotine.nix b/modules/software/music/nicotine.nix deleted file mode 100644 index 38437c7..0000000 --- a/modules/software/music/nicotine.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ - den.aspects.nicotine = { - nixos = { pkgs, ... }: { - users.users.bug.packages = with pkgs; [ - nicotine-plus - ]; - }; - }; -} diff --git a/modules/software/net.nix b/modules/software/net.nix index 1ecbfb6..9b29582 100644 --- a/modules/software/net.nix +++ b/modules/software/net.nix @@ -1,10 +1,14 @@ -{ ... }: { - den.aspects.sshuttle = { +{ + den.aspects.software.net = { nixos = { pkgs, ... }: { environment.systemPackages = with pkgs; [ python3 sshuttle ]; }; + + homeManager = { pkgs, ... }: { + home.packages = [ pkgs.fragments ]; + }; }; } diff --git a/modules/software/shell/fetch.nix b/modules/software/shell/fetch.nix index 7dd4de7..6cb7435 100644 --- a/modules/software/shell/fetch.nix +++ b/modules/software/shell/fetch.nix @@ -1,6 +1,7 @@ { inputs, ... }: { - den.aspects.fetch = { - homeManager = { ... }: { + flake-file.inputs.fetch.url = "github:areofyl/fetch"; + den.aspects.software.shell = { + homeManager = { imports = [ inputs.fetch.homeManagerModules.default ]; programs.fetch = { diff --git a/modules/software/social/mail.nix b/modules/software/social/mail.nix deleted file mode 100644 index 507d468..0000000 --- a/modules/software/social/mail.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: { - den.aspects.mail = { - nixos = { pkgs, ... }: { - users.users.bug.packages = with pkgs; [ - geary - ]; - }; - }; -} diff --git a/modules/software/social/matrix.nix b/modules/software/social/matrix.nix deleted file mode 100644 index 7983ade..0000000 --- a/modules/software/social/matrix.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: { - den.aspects.matrix-client = { - nixos = { pkgs, ... }: { - users.users.bug.packages = with pkgs; [ - fractal - ]; - }; - }; -} diff --git a/modules/software/social/nixcord.nix b/modules/software/social/nixcord.nix index 1fc69bd..06a9a0f 100644 --- a/modules/software/social/nixcord.nix +++ b/modules/software/social/nixcord.nix @@ -1,11 +1,12 @@ { inputs, ... }: { - den.aspects.nixcord = { - nixos = { + flake-file.inputs.nixcord.url = "github:FlameFlag/nixcord"; + den.aspects.software.social = { + nixos = { user, ... }: { imports = [ inputs.nixcord.nixosModules.nixcord ]; programs.nixcord = { enable = true; - user = "bug"; + user = user.userName; discord.enable = false; vesktop.enable = true; diff --git a/modules/software/social/social.nix b/modules/software/social/social.nix deleted file mode 100644 index 21cadbc..0000000 --- a/modules/software/social/social.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ den, ... }: { - den.aspects.social = { - includes = with den.aspects; [ nixcord matrix-client mail ]; - }; -} diff --git a/modules/software/utilities/desktop.nix b/modules/software/utilities/desktop.nix deleted file mode 100644 index 667d633..0000000 --- a/modules/software/utilities/desktop.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ ... }: { - den.aspects.desktop-utils = { - nixos = { pkgs, ... }: { - environment.systemPackages = with pkgs; [ - file-roller - wl-screenrec - ]; - - users.users.bug.packages = with pkgs; [ - obsidian - impression - kooha - loupe - authenticator - ]; - }; - }; -} diff --git a/modules/software/utilities/ghostty.nix b/modules/software/utilities/ghostty.nix deleted file mode 100644 index 9b04322..0000000 --- a/modules/software/utilities/ghostty.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ inputs, ... }: { - den.aspects.ghostty = { - homeManager = { ... }: { - programs.ghostty = { - enable = true; - - settings = { - window-decoration = "none"; - }; - }; - }; - }; -} diff --git a/modules/software/utilities/system.nix b/modules/software/utilities/system.nix deleted file mode 100644 index f89bd86..0000000 --- a/modules/software/utilities/system.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ ... }: { - den.aspects.system-utils = { - nixos = { pkgs, ... }: { - environment.systemPackages = with pkgs; [ - gnome-boxes - pulseaudioFull - firmware-updater - ]; - - users.users.bug.packages = with pkgs; [ - mission-center - baobab - ]; - - programs = { - ydotool.enable = true; - - virt-manager.enable = true; - }; - }; - }; -} diff --git a/modules/software/utilities/torrent.nix b/modules/software/utilities/torrent.nix deleted file mode 100644 index aa22901..0000000 --- a/modules/software/utilities/torrent.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ - den.aspects.torrent = { - nixos = { pkgs, ... }: { - users.users.bug.packages = with pkgs; [ - fragments - ]; - }; - }; -} diff --git a/modules/software/utilities/utilities.nix b/modules/software/utilities/utilities.nix deleted file mode 100644 index 3543d12..0000000 --- a/modules/software/utilities/utilities.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ den, ... }: { - den.aspects.utilities = { - includes = with den.aspects; [ system-utils desktop-utils fonts sshuttle torrent cad ghostty ]; - }; -} diff --git a/modules/system/audio/alc897.nix b/modules/system/audio/alc897.nix index 15c3a97..174a789 100644 --- a/modules/system/audio/alc897.nix +++ b/modules/system/audio/alc897.nix @@ -1,5 +1,5 @@ { - den.aspects.alc897 = { + den.aspects.system.audio.alc897 = { nixos = { boot.extraModprobeConfig = '' options snd-hda-intel model=alc897-fixup diff --git a/modules/system/audio/audio.nix b/modules/system/audio/audio.nix index 95bce00..572165e 100644 --- a/modules/system/audio/audio.nix +++ b/modules/system/audio/audio.nix @@ -1,6 +1,8 @@ { - den.aspects.audio = { - nixos = { + den.aspects.system.audio = { + nixos = { pkgs, ... }: { + environment.systemPackages = [ pkgs.pulseaudioFull ]; + security.rtkit.enable = true; services = { diff --git a/modules/system/base/boot.nix b/modules/system/base/boot.nix index fddb830..36148b7 100644 --- a/modules/system/base/boot.nix +++ b/modules/system/base/boot.nix @@ -1,5 +1,5 @@ { - den.aspects.boot = { + den.aspects.system.boot = { nixos = { boot = { # kernelPackages = lib.mkForce pkgs.linuxPackages_zen; diff --git a/modules/system/base/kernel.nix b/modules/system/base/kernel.nix index aa0fccf..f65dd92 100644 --- a/modules/system/base/kernel.nix +++ b/modules/system/base/kernel.nix @@ -1,5 +1,6 @@ { inputs, ... }: { - den.aspects.kernel = { + flake-file.inputs.nix-cachyos-kernel.url = "github:xddxdd/nix-cachyos-kernel/release"; + den.aspects.system.kernel = { nixos = { pkgs, ... }: { nixpkgs.overlays = [ inputs.nix-cachyos-kernel.overlays.pinned ]; diff --git a/modules/system/base/locale.nix b/modules/system/base/locale.nix index 4303a65..dd933a5 100644 --- a/modules/system/base/locale.nix +++ b/modules/system/base/locale.nix @@ -1,5 +1,5 @@ { - den.aspects.locale = { + den.aspects.system.locale = { nixos = { time.timeZone = "America/Chicago"; diff --git a/modules/system/base/security.nix b/modules/system/base/security.nix index 0b92164..04c244f 100644 --- a/modules/system/base/security.nix +++ b/modules/system/base/security.nix @@ -1,5 +1,5 @@ { - den.aspects.security = { + den.aspects.system.security = { nixos = { security.sudo = { enable = true; diff --git a/modules/system/base/swap.nix b/modules/system/base/swap.nix index a8d06c0..82325f1 100644 --- a/modules/system/base/swap.nix +++ b/modules/system/base/swap.nix @@ -1,5 +1,5 @@ { - den.aspects.swap = { + den.aspects.system.swap = { nixos = { boot.kernel.sysctl = { "fs.file-max" = 524288; diff --git a/modules/system/base/virtualisation.nix b/modules/system/base/virtualisation.nix index 636f494..fad6d4e 100644 --- a/modules/system/base/virtualisation.nix +++ b/modules/system/base/virtualisation.nix @@ -1,11 +1,15 @@ { - den.aspects.virtualisation = { - nixos = { + den.aspects.system.virtualisation = { + nixos = { pkgs, ... }: { virtualisation = { libvirtd.enable = true; spiceUSBRedirection.enable = true; }; + + programs.virt-manager.enable = true; + + environment.systemPackages = [ pkgs.gnome-boxes ]; }; }; } diff --git a/modules/system/compat/nix-ld.nix b/modules/system/compat/nix-ld.nix index 7459844..20ccbac 100644 --- a/modules/system/compat/nix-ld.nix +++ b/modules/system/compat/nix-ld.nix @@ -1,6 +1,5 @@ -{ ... }: { - den.aspects.nix-ld = { + den.aspects.system.compat = { nixos = { pkgs, options, ... }: { diff --git a/modules/system/desktop/cosmic.nix b/modules/system/desktop/cosmic.nix index 665fa1e..d860c46 100644 --- a/modules/system/desktop/cosmic.nix +++ b/modules/system/desktop/cosmic.nix @@ -1,19 +1,12 @@ { - den.aspects.cosmic = { host, ... }: { - nixos = { lib, pkgs, ... }: { + den.aspects.system.desktop.cosmic = { + nixos = { pkgs, ... }: { services = { greetd.enable = true; system76-scheduler.enable = true; - displayManager = { - cosmic-greeter.enable = true; - - autoLogin = { - enable = host.name == "box"; - user = "bug"; - }; - }; + displayManager.cosmic-greeter.enable = true; desktopManager.cosmic.enable = true; }; @@ -23,9 +16,6 @@ cosmic-ext-calculator cosmic-ext-tweaks cosmic-screenshot - - xdg-desktop-portal-gtk - xdg-desktop-portal-cosmic ]; environment.sessionVariables = { diff --git a/modules/system/desktop/neu.nix b/modules/system/desktop/neu.nix index 08f1914..4328d4f 100644 --- a/modules/system/desktop/neu.nix +++ b/modules/system/desktop/neu.nix @@ -1,5 +1,9 @@ { inputs, ... }: { - den.aspects.neu = { + flake-file.inputs.neu-nix = { + url = "github:ricardomaps/neu-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + den.aspects.system.desktop.neu = { nixos = { pkgs, ... }: { nixpkgs.overlays = [ inputs.neu-nix.overlays.default ]; diff --git a/modules/system/desktop/niri.nix b/modules/system/desktop/niri.nix index 69570af..21bc862 100644 --- a/modules/system/desktop/niri.nix +++ b/modules/system/desktop/niri.nix @@ -1,5 +1,6 @@ { inputs, ... }: { - den.aspects.niri = { + flake-file.inputs.niri.url = "github:sodiboo/niri-flake"; + den.aspects.system.desktop.niri = { nixos = { pkgs, ... }: { nixpkgs.overlays = [ (final: prev: { diff --git a/modules/system/desktop/noctalia.nix b/modules/system/desktop/noctalia.nix index 9e541a7..5a42cdb 100644 --- a/modules/system/desktop/noctalia.nix +++ b/modules/system/desktop/noctalia.nix @@ -1,5 +1,9 @@ { inputs, ...}: { - den.aspects.noctalia = { + flake-file.inputs.noctalia = { + url = "github:noctalia-dev/noctalia"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + den.aspects.system.desktop.noctalia = { nixos = { pkgs, ... }: { imports = [ inputs.noctalia.nixosModules.default ]; diff --git a/modules/system/desktop/umbriel.nix b/modules/system/desktop/umbriel.nix index 5b23a87..b31fe0c 100644 --- a/modules/system/desktop/umbriel.nix +++ b/modules/system/desktop/umbriel.nix @@ -1,5 +1,9 @@ { inputs, ...}: { - den.aspects.umbriel = { + flake-file.inputs.umbriel = { + url = "git+https://github.com/noctalia-dev/umbriel"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + den.aspects.system.desktop.umbriel = { /*nixos = { pkgs, ... }: { imports = [ inputs.umbriel.nixosModules.default ]; diff --git a/modules/system/flatpak.nix b/modules/system/flatpak.nix index 0b6a227..f60a84b 100644 --- a/modules/system/flatpak.nix +++ b/modules/system/flatpak.nix @@ -1,6 +1,7 @@ { inputs, lib, ... }: { - den.aspects.flatpak = { - nixos = { ... }: { + flake-file.inputs.nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=latest"; + den.aspects.system.flatpak = { + nixos = { imports = [ inputs.nix-flatpak.nixosModules.nix-flatpak ]; services.flatpak = { diff --git a/modules/system/fonts.nix b/modules/system/fonts.nix index b404b2c..c5e94fd 100644 --- a/modules/system/fonts.nix +++ b/modules/system/fonts.nix @@ -1,5 +1,5 @@ -{ ... }: { - den.aspects.fonts = { +{ + den.aspects.system.fonts = { nixos = { pkgs, ... }: { fonts = { fontDir.enable = true; diff --git a/modules/system/graphics/amdgpu.nix b/modules/system/graphics/amdgpu.nix index f88988b..eb7f2d6 100644 --- a/modules/system/graphics/amdgpu.nix +++ b/modules/system/graphics/amdgpu.nix @@ -1,5 +1,5 @@ { - den.aspects.amdgpu = { + den.aspects.system.graphics.amdgpu = { nixos = { services.xserver = { enable = true; diff --git a/modules/system/graphics/nvidia.nix b/modules/system/graphics/nvidia.nix index 991bda9..77f7499 100644 --- a/modules/system/graphics/nvidia.nix +++ b/modules/system/graphics/nvidia.nix @@ -1,5 +1,7 @@ -{ - den.aspects.nvidia = { +{ den, ... }: { + den.aspects.system.graphics.nvidia = { + includes = [ (den.batteries.unfree [ "nvidia-x11" "nvidia-settings" "nvidia-kernel-modules" ]) ]; + nixos = { pkgs, config, ... }: { hardware.graphics = { enable = true; diff --git a/modules/system/hardware.nix b/modules/system/hardware.nix index b07165e..adc2f4e 100644 --- a/modules/system/hardware.nix +++ b/modules/system/hardware.nix @@ -1,5 +1,9 @@ { inputs, ...}: { - den.aspects.autocpufreq = { + flake-file.inputs.auto-cpufreq = { + url = "github:AdnanHodzic/auto-cpufreq"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + den.aspects.system.hardware.autocpufreq = { nixos = { imports = [ inputs.auto-cpufreq.nixosModules.default ]; diff --git a/modules/system/janitor/backend.nix b/modules/system/janitor/backend.nix index 900c01f..739b41b 100644 --- a/modules/system/janitor/backend.nix +++ b/modules/system/janitor/backend.nix @@ -1,5 +1,5 @@ { - den.aspects.janitor-backend = { + den.aspects.system.janitor = { nixos = { pkgs, lib, config, ... }: let cfg = config.services.janitor; @@ -157,7 +157,6 @@ user = lib.mkOption { type = lib.types.str; - default = "bug"; description = "User account the janitor service runs as."; }; }; diff --git a/modules/system/janitor/default.nix b/modules/system/janitor/default.nix index 82188d3..1af747a 100644 --- a/modules/system/janitor/default.nix +++ b/modules/system/janitor/default.nix @@ -1,10 +1,9 @@ -{ den, ... }: { - den.aspects.janitor = { - includes = with den.aspects; [ janitor-backend ]; - - nixos = { +{ + den.aspects.system.janitor = { + nixos = { host, ... }: { services.janitor = { enable = true; + user = host.owner; interval = "1min"; gracePeriod = 60; watchedDirs = [ "~/Downloads" ]; diff --git a/modules/system/network/cloudflare-warp.nix b/modules/system/network/cloudflare-warp.nix index 3bcb98c..c28ceeb 100644 --- a/modules/system/network/cloudflare-warp.nix +++ b/modules/system/network/cloudflare-warp.nix @@ -1,5 +1,7 @@ -{ - den.aspects.cloudflare-warp = { +{ den, ... }: { + den.aspects.system.network.cloudflare-warp = { + includes = [ (den.batteries.unfree [ "cloudflare-warp" ]) ]; + nixos = { services.cloudflare-warp = { enable = true; diff --git a/modules/system/network/dns.nix b/modules/system/network/dns.nix index 0451fad..c3d1678 100644 --- a/modules/system/network/dns.nix +++ b/modules/system/network/dns.nix @@ -1,5 +1,5 @@ { - den.aspects.dns = { + den.aspects.system.network.dns = { nixos = { config, lib, ... }: { networking = { networkmanager = { diff --git a/modules/system/network/openssh.nix b/modules/system/network/openssh.nix index 8f2d07b..3b96483 100644 --- a/modules/system/network/openssh.nix +++ b/modules/system/network/openssh.nix @@ -1,5 +1,5 @@ { - den.aspects.openssh = { + den.aspects.system.network.openssh = { nixos = { services.openssh = { enable = true; diff --git a/modules/system/network/openvpn.nix b/modules/system/network/openvpn.nix index 60c7d8b..5786faa 100644 --- a/modules/system/network/openvpn.nix +++ b/modules/system/network/openvpn.nix @@ -1,5 +1,5 @@ { - den.aspects.openvpn = { + den.aspects.system.network.openvpn = { nixos = { pkgs, ... }: { networking.networkmanager = { plugins = with pkgs; [ diff --git a/modules/system/network/syncthing.nix b/modules/system/network/syncthing.nix index 05abcf8..802441e 100644 --- a/modules/system/network/syncthing.nix +++ b/modules/system/network/syncthing.nix @@ -1,6 +1,6 @@ { - den.aspects.syncthing = { - homeManager = let + den.aspects.system.network.syncthing = { + homeManager = { config, ... }: let devices = ["desktop" "laptop" "server"]; mkFolder = path: { @@ -14,8 +14,8 @@ overrideDevices = true; overrideFolders = true; - key = "/home/bug/.syncthing/key.pem"; - cert = "/home/bug/.syncthing/cert.pem"; + key = "${config.home.homeDirectory}/.syncthing/key.pem"; + cert = "${config.home.homeDirectory}/.syncthing/cert.pem"; settings = { devices = { @@ -25,20 +25,20 @@ }; folders = { - "Archives" = mkFolder "/home/bug/Archives"; - "Software" = mkFolder "/home/bug/Software"; - "Scripts" = mkFolder "/home/bug/Scripts"; - "Projects" = mkFolder "/home/bug/Projects"; - "Documents" = mkFolder "/home/bug/Documents"; - "Downloads" = mkFolder "/home/bug/Downloads"; - "Pictures" = mkFolder "/home/bug/Pictures"; - "Videos" = mkFolder "/home/bug/Videos"; - # "Music" = mkFolder "/home/bug/Music"; - "nix" = mkFolder "/home/bug/nix"; - "hytale" = mkFolder "/home/bug/.local/share/Hytale/UserData/Saves"; - "ssh" = mkFolder "/home/bug/.ssh"; - #"cloudflared" = mkFolder "/home/bug/.cloudflared"; - "copyparty" = mkFolder "/home/bug/copyparty"; + "Archives" = mkFolder "${config.home.homeDirectory}/Archives"; + "Software" = mkFolder "${config.home.homeDirectory}/Software"; + "Scripts" = mkFolder "${config.home.homeDirectory}/Scripts"; + "Projects" = mkFolder "${config.home.homeDirectory}/Projects"; + "Documents" = mkFolder "${config.home.homeDirectory}/Documents"; + "Downloads" = mkFolder "${config.home.homeDirectory}/Downloads"; + "Pictures" = mkFolder "${config.home.homeDirectory}/Pictures"; + "Videos" = mkFolder "${config.home.homeDirectory}/Videos"; + # "Music" = mkFolder "${config.home.homeDirectory}/Music"; + "nix" = mkFolder "${config.home.homeDirectory}/nix"; + "hytale" = mkFolder "${config.home.homeDirectory}/.local/share/Hytale/UserData/Saves"; + "ssh" = mkFolder "${config.home.homeDirectory}/.ssh"; + #"cloudflared" = mkFolder "${config.home.homeDirectory}/.cloudflared"; + "copyparty" = mkFolder "${config.home.homeDirectory}/copyparty"; }; }; }; diff --git a/modules/system/network/tailscale.nix b/modules/system/network/tailscale.nix index 4ff2fcd..ddbe58e 100644 --- a/modules/system/network/tailscale.nix +++ b/modules/system/network/tailscale.nix @@ -1,5 +1,5 @@ { - den.aspects.tailscale = { + den.aspects.system.network.tailscale = { nixos = { services.tailscale = { enable = true; diff --git a/modules/system/theme/catppuccin.nix b/modules/system/theme/catppuccin.nix index 46c6bac..8e2af19 100644 --- a/modules/system/theme/catppuccin.nix +++ b/modules/system/theme/catppuccin.nix @@ -2,7 +2,8 @@ flavor = "mocha"; accent = "mauve"; in { - den.aspects.catppuccin = { + flake-file.inputs.catppuccin.url = "github:catppuccin/nix"; + den.aspects.system.theme.catppuccin = { nixos = { imports = [ inputs.catppuccin.nixosModules.catppuccin ]; diff --git a/modules/system/theme/stylix.nix b/modules/system/theme/stylix.nix index 9ad8f07..bcd6e90 100644 --- a/modules/system/theme/stylix.nix +++ b/modules/system/theme/stylix.nix @@ -1,5 +1,9 @@ { inputs, ... }: { - den.aspects.stylix = let + flake-file.inputs.stylix = { + url = "github:nix-community/stylix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + den.aspects.system.theme.stylix = let catppuccin = { base00 = "1E1E2E"; base01 = "181825"; diff --git a/modules/users/bug.nix b/modules/users/bug.nix index 6ab61d5..e0b0931 100644 --- a/modules/users/bug.nix +++ b/modules/users/bug.nix @@ -1,4 +1,4 @@ -{ den, ... }: { +{ den, lib, ... }: { den.aspects.bug = { includes = [ den.batteries.host-aspects @@ -8,6 +8,8 @@ homeManager = { programs.home-manager.enable = true; + home.homeDirectory = lib.mkDefault "/home/bug"; + home.username = lib.mkDefault "bug"; }; user.extraGroups = [ "networkmanager" "wheel" "input" "audio" "video" "libvirtd" "ydotool" "dialout" ];