NixOS configuration 🪄

✨🚧 glance added and started configuration

Signed-off-by: Xaiya Schumin <d.schumin@proton.me>

+193 -13
+2 -1
modules/nixos/services/default.nix
··· 3 3 imports = [ 4 4 ./postgres.nix 5 5 ./nginx.nix 6 - ./minecraft.nix 7 6 7 + ./minecraft.nix 8 8 ./vaultwarden.nix 9 9 ./gitlab.nix 10 + ./glance.nix 10 11 ]; 11 12 12 13 }
+190
modules/nixos/services/glance.nix
··· 1 + { config, lib, self, pkgs, ... }: 2 + let 3 + inherit (lib) mkIf; 4 + inherit (self.lib.modules) mkPackageOpt; 5 + 6 + cfg = config.sylveon.services.glance; 7 + in 8 + { 9 + 10 + options.sylveon.services.glance = 11 + mkPackageOpt pkgs.glance "Glance configuration (Dashboard)"; 12 + 13 + config = mkIf cfg.enable { 14 + services.glance = { 15 + enable = true; 16 + openFirewall = false; /* Managed through nginx server */ 17 + 18 + settings = { 19 + server = { 20 + host = ""; /* Needs to be an empty string, otherwise interfaces cant be found correctly */ 21 + port = 8002; 22 + proxied = true; 23 + }; 24 + 25 + pages = 26 + [ 27 + { 28 + name = "Overview"; 29 + 30 + head-widgets = [ 31 + { 32 + type = "group"; 33 + widgets = [ 34 + { 35 + type = "monitor"; 36 + cache = "30s"; 37 + title = "Services"; 38 + sites = [ 39 + { 40 + title = "Vaultwarden"; 41 + url = "https://vault.xaiya.dev"; 42 + } 43 + { 44 + title = "GitLab"; 45 + url = "https://git.xaiya.dev"; 46 + } 47 + { 48 + title = "Firefly"; 49 + url = "https://cash.xaiya.dev"; 50 + } 51 + ]; 52 + } 53 + 54 + { 55 + type = "custom-api"; 56 + title = "Minecraft Servers"; 57 + url = "https://api.mcsrvstat.us/3/xaiya.dev"; 58 + cache = "30s"; 59 + template = '' 60 + <div style="display:flex; align-items:center; gap:12px;"> 61 + <div style="width:40px; height:40px; flex-shrink:0; border-radius:4px; display:flex; justify-content:center; align-items:center; overflow:hidden;"> 62 + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width:32px; height:32px; opacity:0.5;"> 63 + <path fill-rule="evenodd" d="M1 5.25A2.25 2.25 0 0 1 3.25 3h13.5A2.25 2.25 0 0 1 19 5.25v9.5A2.25 2.25 0 0 1 16.75 17H3.25A2.25 2.25 0 0 1 1 14.75v-9.5Zm1.5 5.81v3.69c0 .414.336.75.75.75h13.5a.75.75 0 0 0 .75-.75v-2.69l-2.22-2.219a.75.75 0 0 0-1.06 0l-1.91 1.909.47.47a.75.75 0 1 1-1.06 1.06L6.53 8.091a.75.75 0 0 0-1.06 0l-2.97 2.97ZM12 7a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z" clip-rule="evenodd" /> 64 + </svg> 65 + </div> 66 + 67 + <div style="flex-grow:1; min-width:0;"> 68 + <a class="size-h4 block text-truncate color-highlight"> 69 + {{ .JSON.String "motd.raw.0" }} 70 + {{ if .JSON.Bool "online" }} 71 + <span 72 + style="width: 8px; height: 8px; border-radius: 50%; background-color: var(--color-positive); display: inline-block; vertical-align: middle;" 73 + data-popover-type="text" 74 + data-popover-text="Online" 75 + ></span> 76 + {{ else }} 77 + <span 78 + style="width: 8px; height: 8px; border-radius: 50%; background-color: var(--color-negative); display: inline-block; vertical-align: middle;" 79 + data-popover-type="text" 80 + data-popover-text="Offline" 81 + ></span> 82 + {{ end }} 83 + </a> 84 + 85 + <ul class="list-horizontal-text"> 86 + <li> 87 + {{ if .JSON.Bool "online" }} 88 + <span>{{ .JSON.String "version" }}</span> 89 + {{ else }} 90 + <span>Offline</span> 91 + {{ end }} 92 + </li> 93 + {{ if .JSON.Bool "online" }} 94 + <li data-popover-type="html"> 95 + <div data-popover-html> 96 + {{ range .JSON.Array "players.list" }}<br>{{ end }} 97 + </div> 98 + <p style="display:inline-flex;align-items:center;"> 99 + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-6" style="height:1em;vertical-align:middle;margin-right:0.5em;"> 100 + <path fill-rule="evenodd" d="M7.5 6a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0ZM3.751 20.105a8.25 8.25 0 0 1 16.498 0 .75.75 0 0 1-.437.695A18.683 18.683 0 0 1 12 22.5c-2.786 0-5.433-.608-7.812-1.7a.75.75 0 0 1-.437-.695Z" clip-rule="evenodd" /> 101 + </svg> 102 + {{ .JSON.Int "players.online" | formatNumber }}/{{ .JSON.Int "players.max" | formatNumber }} players 103 + </p> 104 + </li> 105 + {{ else }} 106 + <li> 107 + <p style="display:inline-flex;align-items:center;"> 108 + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-6" style="height:1em;vertical-align:middle;margin-right:0.5em;opacity:0.5;"> 109 + <path fill-rule="evenodd" d="M7.5 6a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0ZM3.751 20.105a8.25 8.25 0 0 1 16.498 0 .75.75 0 0 1-.437.695A18.683 18.683 0 0 1 12 22.5c-2.786 0-5.433-.608-7.812-1.7a.75.75 0 0 1-.437-.695Z" clip-rule="evenodd" /> 110 + </svg> 111 + 0 players 112 + </p> 113 + </li> 114 + {{ end }} 115 + </ul> 116 + </div> 117 + </div> 118 + ''; 119 + } 120 + ]; 121 + } 122 + ]; 123 + 124 + columns = [ 125 + { 126 + size = "full"; 127 + widgets = [ 128 + { 129 + type = "calendar"; 130 + } 131 + { 132 + type = "weather"; 133 + location = "Berlin, Germany"; 134 + hour-format = "24h"; 135 + } 136 + { 137 + type = "releases"; 138 + show-source-icon = true; 139 + repositories = [ 140 + "WillPower3309/swayfx" 141 + "Inrixia/TidaLuna" 142 + ]; 143 + } 144 + { 145 + type = "server-stats"; 146 + servers = [ 147 + { 148 + type = "local"; 149 + name = "Apricot"; 150 + 151 + mountpoints = { "/mnt/raid" = { name = "/mnt/raid"; }; }; 152 + } 153 + ]; 154 + } 155 + 156 + { 157 + type = "clock"; 158 + hour-format = "24h"; 159 + } 160 + ]; 161 + } 162 + ]; 163 + } 164 + ]; 165 + 166 + /* rose-pine theme */ 167 + theme = { 168 + constrat-multiplier = 1.3; 169 + background-color = "249 22 12"; 170 + pirmary-color = "245 50 91"; 171 + positive-color = "247 23 15"; 172 + negative-color = "248 15 61"; 173 + }; 174 + 175 + }; 176 + }; 177 + 178 + 179 + /* All the configurations neede */ 180 + 181 + services.nginx.virtualHosts."xaiya.dev" = { 182 + forceSSL = true; 183 + useACMEHost = "xaiya.dev"; 184 + locations."/".proxyPass = "http://[::1]:8002"; 185 + 186 + extraConfig = "proxy_ssl_server_name on;"; 187 + }; 188 + }; 189 + 190 + }
-12
modules/nixos/services/nginx.nix
··· 39 39 environmentFile = config.age.secrets.cloudflare-acme.path; 40 40 }; 41 41 }; 42 - 43 - services.nginx.virtualHosts."xaiya.dev" = { 44 - forceSSL = true; 45 - useACMEHost = "xaiya.dev"; 46 - locations."/".return = ''301 https://onesquareminesweeper.com/''; # Return to a cool catpedia page 47 - 48 - /* Return to social media platforms */ 49 - locations."/bsky".return = "301 https://bsky.app/profile/xaiya.dev"; 50 - locations."/git".return = "301 https://github.com/xaiyadev"; 51 - 52 - extraConfig = "proxy_ssl_server_name on;"; 53 - }; 54 42 }; 55 43 }
+1
systems/apricot/default.nix
··· 34 34 35 35 vaultwarden.enable = true; 36 36 gitlab.enable = true; 37 + glance.enable = true; 37 38 38 39 minecraft.enable = true; 39 40 };