Skip to content

Commit 85b1c04

Browse files
committed
update nixpkgs, remove www alias
1 parent 5682614 commit 85b1c04

2 files changed

Lines changed: 47 additions & 34 deletions

File tree

‎flake.lock‎

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎flake.nix‎

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@
22
description = "A very marrano bot.";
33

44
inputs = {
5-
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
66
flakelight.url = "github:nix-community/flakelight";
77
flakelight.inputs.nixpkgs.follows = "nixpkgs";
88
};
99

10-
outputs = { self, flakelight, ... }@inputs:
10+
outputs =
11+
{ self, flakelight, ... }@inputs:
1112
flakelight ./. {
1213
inherit inputs;
13-
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
14+
systems = [
15+
"x86_64-linux"
16+
"aarch64-linux"
17+
"aarch64-darwin"
18+
];
1419

1520
devShell.packages = pkgs: [
1621
pkgs.go
@@ -24,29 +29,45 @@
2429
pkgs.litecli
2530
];
2631

27-
package = { pkgs, lib, buildGoModule, ... }:
32+
package =
33+
{
34+
pkgs,
35+
lib,
36+
buildGoModule,
37+
...
38+
}:
2839
buildGoModule {
2940
name = "marrano-bot";
3041
src = ./.;
3142
nativeBuildInputs = [ pkgs.go ];
3243
# vendorHash = "sha256-M1g9Iex93Pr0a/2QeyGnL5803O6VQJQItIfZdUXccCw=";
3344
vendorHash = "sha256-kQkNBvsDmDKPxSLkB/ckhgi+Eby+n+VOAo3OIcmVtts=";
34-
tags= [
45+
tags = [
3546
"fts5"
3647
];
37-
meta = { platforms = lib.platforms.all; };
48+
meta = {
49+
platforms = lib.platforms.all;
50+
};
3851
};
3952

40-
formatters = { "*.go" = "go fmt"; };
41-
42-
nixosModule = { config, pkgs, lib, system, ... }:
53+
formatters = {
54+
"*.go" = "go fmt";
55+
};
56+
57+
nixosModule =
58+
{
59+
config,
60+
pkgs,
61+
lib,
62+
...
63+
}:
4364
with lib;
4465
let
4566
cfg = config.services.marrano-bot;
4667
pkg = self.packages.${pkgs.system}.default;
47-
hardeningOptions =
48-
{ }; # TODO systemd hardened settings `systemd analyze security marrano-bot`
49-
in {
68+
hardeningOptions = { }; # TODO systemd hardened settings `systemd analyze security marrano-bot`
69+
in
70+
{
5071
options.services.marrano-bot = {
5172
enable = mkEnableOption (lib.mdDoc "Enable MarranoBot Service") // {
5273
description = lib.mdDoc ''
@@ -63,8 +84,7 @@
6384
hostName = mkOption {
6485
type = types.str;
6586
default = "bot.marrani.lol";
66-
description = lib.mdDoc
67-
"marrano-bot public hostname. Used to receive webhook updates.";
87+
description = lib.mdDoc "marrano-bot public hostname. Used to receive webhook updates.";
6888
};
6989

7090
openPort = mkOption {
@@ -82,8 +102,7 @@
82102
dataDir = mkOption {
83103
type = types.path;
84104
default = "/var/lib/marrano-bot";
85-
description = lib.mdDoc
86-
"The directory that will host the database file and config.edn";
105+
description = lib.mdDoc "The directory that will host the database file and config.edn";
87106
};
88107

89108
databaseFile = mkOption {
@@ -136,8 +155,7 @@
136155
message = "Age secret 'marrano-bot' is required!";
137156
}
138157
];
139-
users.groups =
140-
mkIf (cfg.group == "marrano-bot") { marrano-bot = { }; };
158+
users.groups = mkIf (cfg.group == "marrano-bot") { marrano-bot = { }; };
141159

142160
users.users = mkIf (cfg.user == "marrano-bot") {
143161
marrano-bot = {
@@ -168,27 +186,23 @@
168186

169187
serviceConfig = {
170188
# NOTE: needed (r)agenix secret!
171-
LoadCredential =
172-
"marrano-bot.toml:${config.age.secrets.marrano-bot.path}";
189+
LoadCredential = "marrano-bot.toml:${config.age.secrets.marrano-bot.path}";
173190

174191
User = cfg.user;
175192
Group = cfg.group;
176193
Type = "simple";
177194
Restart = "on-failure";
178195
WorkingDirectory = cfg.dataDir;
179-
ExecStart =
180-
"${pkgs.marrano-bot}/bin/marrano-bot -c \${CREDENTIALS_DIRECTORY}/marrano-bot.toml";
196+
ExecStart = "${pkgs.marrano-bot}/bin/marrano-bot -c \${CREDENTIALS_DIRECTORY}/marrano-bot.toml";
181197
};
182198
};
183199

184-
networking.firewall =
185-
mkIf cfg.openPort { allowedTCPPorts = [ cfg.port ]; };
200+
networking.firewall = mkIf cfg.openPort { allowedTCPPorts = [ cfg.port ]; };
186201

187202
#
188203
# Reverse proxies
189204
#
190205
services.caddy.virtualHosts."${cfg.hostName}" = {
191-
serverAliases = mkDefault [ "www.${cfg.hostName}" ];
192206
extraConfig = ''
193207
encode gzip
194208
reverse_proxy :${toString cfg.port}
@@ -197,8 +211,7 @@
197211

198212
services.nginx.virtualHosts."${cfg.hostName}" = {
199213
serverName = mkDefault cfg.hostName;
200-
locations."/".proxyPass =
201-
"https://127.0.0.1:${toString cfg.port}";
214+
locations."/".proxyPass = "https://127.0.0.1:${toString cfg.port}";
202215
enableACME = mkDefault true;
203216
forceSSL = mkDefault true;
204217
};

0 commit comments

Comments
 (0)