Update from update-inputs-2024-09-28-04-20
This commit is contained in:
commit
ed9d318b06
6 changed files with 78 additions and 23 deletions
|
@ -1,6 +1,7 @@
|
||||||
{ ... }: {
|
{ pkgs, ... }: {
|
||||||
services.librespeed = {
|
services.librespeed = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
package = pkgs.librespeed-go;
|
||||||
domain = "speed.kyouma.net";
|
domain = "speed.kyouma.net";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,5 +34,11 @@
|
||||||
add_header Referrer-Policy "same-origin" always;
|
add_header Referrer-Policy "same-origin" always;
|
||||||
#add_header Content-Security-Policy "script-src 'self'; object-src 'none'; base-uri 'none';" always;
|
#add_header Content-Security-Policy "script-src 'self'; object-src 'none'; base-uri 'none';" always;
|
||||||
'';
|
'';
|
||||||
|
eventsConfig = ''
|
||||||
|
multi_accept on;
|
||||||
|
'';
|
||||||
|
appendConfig = ''
|
||||||
|
worker_processes auto;
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
24
flake.lock
24
flake.lock
|
@ -743,11 +743,11 @@
|
||||||
},
|
},
|
||||||
"nixos-hardware": {
|
"nixos-hardware": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1727040444,
|
"lastModified": 1727437159,
|
||||||
"narHash": "sha256-19FNN5QT9Z11ZUMfftRplyNN+2PgcHKb3oq8KMW/hDA=",
|
"narHash": "sha256-v4qLwEw5OmprgQZTT7KZMNU7JjXJzRypw8+Cw6++fWk=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixos-hardware",
|
"repo": "nixos-hardware",
|
||||||
"rev": "d0cb432a9d28218df11cbd77d984a2a46caeb5ac",
|
"rev": "d830ad47cc992b4a46b342bbc79694cbd0e980b2",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -874,11 +874,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_4": {
|
"nixpkgs_4": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1727122398,
|
"lastModified": 1727348695,
|
||||||
"narHash": "sha256-o8VBeCWHBxGd4kVMceIayf5GApqTavJbTa44Xcg5Rrk=",
|
"narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "30439d93eb8b19861ccbe3e581abf97bdc91b093",
|
"rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -905,11 +905,11 @@
|
||||||
"treefmt-nix": "treefmt-nix_2"
|
"treefmt-nix": "treefmt-nix_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1727402188,
|
"lastModified": 1727471696,
|
||||||
"narHash": "sha256-AxZVGgsWBDbhO1JVrYoHWG2IW5Se8JjJhC93Yfst4AM=",
|
"narHash": "sha256-3r/VNQp5aJK9Gj8hKdfSYqeXcc0kqpfFYhEg8ioWttE=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixvim",
|
"repo": "nixvim",
|
||||||
"rev": "cb2b76c1a9ec067ed0c449080f4973fecf8532ef",
|
"rev": "b5c19b6abb0fb0156b1cb76793b363e430e2cb47",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -985,11 +985,11 @@
|
||||||
"nixpkgs-stable": "nixpkgs-stable_2"
|
"nixpkgs-stable": "nixpkgs-stable_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1726524647,
|
"lastModified": 1727423009,
|
||||||
"narHash": "sha256-qis6BtOOBBEAfUl7FMHqqTwRLB61OL5OFzIsOmRz2J4=",
|
"narHash": "sha256-+4B/dQm2EnORIk0k2wV3aHGaE0WXTBjColXjj7qWh10=",
|
||||||
"owner": "Mic92",
|
"owner": "Mic92",
|
||||||
"repo": "sops-nix",
|
"repo": "sops-nix",
|
||||||
"rev": "e2d404a7ea599a013189aa42947f66cede0645c8",
|
"rev": "127a96f49ddc377be6ba76964411bab11ae27803",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -130,11 +130,19 @@ in {
|
||||||
services.nginx.virtualHosts = lib.mkIf cfg.configureNginx {
|
services.nginx.virtualHosts = lib.mkIf cfg.configureNginx {
|
||||||
${cfg.domain} = {
|
${cfg.domain} = {
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
proxyPass = "http://${cfg.settings.bind_address}:${toString cfg.settings.listen_port}";
|
proxyPass = "http://[::1]:${toString cfg.settings.listen_port}";
|
||||||
recommendedProxySettings = true;
|
recommendedProxySettings = true;
|
||||||
|
extraConfig = ''
|
||||||
|
proxy_cache off;
|
||||||
|
proxy_buffering off;
|
||||||
|
proxy_request_buffering off;
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
|
extraConfig = ''
|
||||||
|
gzip off;
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
security.acme.certs = lib.mkIf cfg.configureNginx {
|
security.acme.certs = lib.mkIf cfg.configureNginx {
|
||||||
|
@ -144,7 +152,7 @@ in {
|
||||||
services.librespeed.servers = lib.mkIf (cfg.domain != null) [
|
services.librespeed.servers = lib.mkIf (cfg.domain != null) [
|
||||||
{
|
{
|
||||||
name = cfg.domain;
|
name = cfg.domain;
|
||||||
server = "https://${cfg.domain}";
|
server = "//${cfg.domain}${lib.optionalString (!cfg.configureNginx) ":${toString cfg.settings.listen_port}"}";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
services.librespeed.settings = let
|
services.librespeed.settings = let
|
||||||
|
@ -168,23 +176,28 @@ in {
|
||||||
--replace-fail "TO BE FILLED BY DEVELOPER" ${lib.escapeShellArg (lib.escapeXML cfg.contactEmail)}
|
--replace-fail "TO BE FILLED BY DEVELOPER" ${lib.escapeShellArg (lib.escapeXML cfg.contactEmail)}
|
||||||
'';
|
'';
|
||||||
in {
|
in {
|
||||||
speed_test_dir = assets;
|
#speed_test_dir = assets;
|
||||||
bind_address = mkDefault (if cfg.configureNginx then "127.0.0.1" else "0.0.0.0");
|
assets_path = assets;
|
||||||
|
bind_address = mkDefault (if cfg.configureNginx then "::1" else "::");
|
||||||
listen_port = mkDefault 8989;
|
listen_port = mkDefault 8989;
|
||||||
base_url = mkDefault "backend";
|
#base_url = mkDefault "backend";
|
||||||
worker_threads = mkDefault "auto";
|
#worker_threads = mkDefault "auto";
|
||||||
|
|
||||||
|
server_lat = 0;
|
||||||
|
server_lng = 0;
|
||||||
|
proxyprotocol_port = 0;
|
||||||
|
redact_ip_addresses = false;
|
||||||
|
|
||||||
#librespeed-rust will fail to start if the following config parameters are omitted.
|
#librespeed-rust will fail to start if the following config parameters are omitted.
|
||||||
ipinfo_api_key = mkIf (!cfg.secrets ? "ipinfo_api_key") "";
|
ipinfo_api_key = mkIf (!cfg.secrets ? "ipinfo_api_key") "";
|
||||||
stats_password = mkIf (!cfg.secrets ? "stats_password") "";
|
stats_password = mkIf (!cfg.secrets ? "stats_password") "";
|
||||||
tls_key_file = mkDefault "";
|
#tls_key_file = mkDefault "";
|
||||||
tls_cet_file = mkDefault "";
|
#tls_cet_file = mkDefault "";
|
||||||
|
|
||||||
enable_tls = mkDefault false;
|
enable_tls = mkDefault false;
|
||||||
} // rec {
|
} // rec {
|
||||||
database_type = mkDefault "none";
|
database_type = mkDefault "none";
|
||||||
database_file = mkIf (database_type == "sqlite") "/var/lib/librespeed/speedtest.sqlite";
|
database_file = mkIf (database_type == "sqlite") (mkDefault "/var/lib/librespeed/speedtest.sqlite");
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services = let
|
systemd.services = let
|
||||||
|
@ -242,7 +255,7 @@ in {
|
||||||
|
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
|
|
||||||
ExecStartPre = lib.mkIf (!cfg.secrets ? "ipinfo_api_key") "${lib.getExe cfg.package} --update-ipdb";
|
#ExecStartPre = lib.mkIf (!cfg.secrets ? "ipinfo_api_key") "${lib.getExe cfg.package} --update-ipdb";
|
||||||
ExecStart = "${lib.getExe cfg.package} -c ${if (cfg.secrets == {}) then configFile else "\${RUNTIME_DIRECTORY%%:*}/config.toml"}";
|
ExecStart = "${lib.getExe cfg.package} -c ${if (cfg.secrets == {}) then configFile else "\${RUNTIME_DIRECTORY%%:*}/config.toml"}";
|
||||||
WorkingDirectory = "/var/cache/librespeed";
|
WorkingDirectory = "/var/cache/librespeed";
|
||||||
RuntimeDirectory = "librespeed";
|
RuntimeDirectory = "librespeed";
|
||||||
|
|
34
pkgs/librespeed-go/default.nix
Normal file
34
pkgs/librespeed-go/default.nix
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
fetchFromGitHub,
|
||||||
|
buildGoModule,
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
version = "1.1.5";
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "librespeed";
|
||||||
|
repo = "speedtest-go";
|
||||||
|
rev = "refs/tags/v${version}";
|
||||||
|
hash = "sha256-ywGrodl/mj/WB25F0TKVvaV0PV4lgc+KEj0x/ix9HT8=";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
buildGoModule {
|
||||||
|
pname = "librespeed-go";
|
||||||
|
inherit version src;
|
||||||
|
|
||||||
|
vendorHash = "sha256-ev5TEv8u+tx7xIvNaK8b5iq2XXF6I37Fnrr8mb+N2WM=";
|
||||||
|
|
||||||
|
ldflags = [ "-w" "-s" ];
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
cp -r web/assets $out/
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "A very lightweight speed test implementation in Go.";
|
||||||
|
homepage = "https://github.com/librespeed/speedtest-go";
|
||||||
|
license = lib.licenses.lgpl3Plus;
|
||||||
|
maintainers = with lib.maintainers; [ snaki ];
|
||||||
|
mainProgram = "speedtest";
|
||||||
|
};
|
||||||
|
}
|
|
@ -4,4 +4,5 @@ final: prev: {
|
||||||
update-nixfiles = final.callPackage ./update-nixfiles/default.nix {};
|
update-nixfiles = final.callPackage ./update-nixfiles/default.nix {};
|
||||||
build-worker-oci = final.callPackage ./build-worker-oci/default.nix {};
|
build-worker-oci = final.callPackage ./build-worker-oci/default.nix {};
|
||||||
librespeed-rust = final.callPackage ./librespeed-rust/default.nix {};
|
librespeed-rust = final.callPackage ./librespeed-rust/default.nix {};
|
||||||
|
librespeed-go = final.callPackage ./librespeed-go/default.nix {};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue