librespeed,graphical: minor fixes
This commit is contained in:
parent
1c8bfba590
commit
b0c775eb6a
3 changed files with 14 additions and 10 deletions
|
@ -119,7 +119,7 @@
|
|||
#"eDP-1, 2560x1600@60, 0x0, 1, bitdepth, 10"
|
||||
#"eDP-1, 1920x1200@60, 0x0, 1, bitdepth, 10"
|
||||
"desc:Dell Inc. AW3225QF FXK2YZ3, 3840x2160@240,5280x0,1, bitdepth,10, vrr,2"
|
||||
"desc:GIGA-BYTE TECHNOLOGY CO. LTD. AORUS AD27QD 19320B000455, 2560x1440@144,3840x-350,1, bitdepth,10, transform,1"
|
||||
"desc:GIGA-BYTE TECHNOLOGY CO. LTD. AORUS AD27QD 19320B000455, 2560x1440@144,3840x-280,1, bitdepth,10, transform,1"
|
||||
",preferred,auto,1"
|
||||
];
|
||||
workspace = [
|
||||
|
|
|
@ -107,10 +107,10 @@ in {
|
|||
'';
|
||||
default = {};
|
||||
type = with types; nullOr (attrsOf (oneOf [
|
||||
bool
|
||||
(nullOr bool)
|
||||
int
|
||||
str
|
||||
null
|
||||
package
|
||||
]));
|
||||
};
|
||||
};
|
||||
|
@ -153,14 +153,15 @@ in {
|
|||
assets = pkgs.runCommand "librespeed-assets" {
|
||||
preferLocal = true;
|
||||
|
||||
serverList = ''
|
||||
serversList = ''
|
||||
function get_servers() {
|
||||
return ${builtins.toJSON cfg.servers}
|
||||
}
|
||||
'';
|
||||
} ''
|
||||
cp -r ${pkgs.librespeed-rust}/assets $out
|
||||
cat >$out/server_list.js <<<"$serverList"
|
||||
chmod 666 $out/servers_list.js
|
||||
cat >$out/servers_list.js <<<"$serversList"
|
||||
substitute ${pkgs.librespeed-rust}/assets/index.html $out/index.html \
|
||||
--replace-fail "LibreSpeed Example" ${lib.escapeShellArg (lib.escapeXML cfg.pageTitle)} \
|
||||
--replace-fail "PUT@YOUR_EMAIL.HERE" ${lib.escapeShellArg (lib.escapeXML cfg.contactEmail)} \
|
||||
|
@ -173,8 +174,6 @@ in {
|
|||
base_url = mkDefault "backend";
|
||||
worker_threads = mkDefault "auto";
|
||||
|
||||
database_type = mkDefault "none";
|
||||
database_file = mkIf (cfg.settings.database_type == "sqlite") mkDefault "/var/lib/librespeed/speedtest.sqlite";
|
||||
|
||||
#librespeed-rust will fail to start if the following config parameters are omitted.
|
||||
ipinfo_api_key = mkIf (!cfg.secrets ? "ipinfo_api_key") "";
|
||||
|
@ -183,11 +182,14 @@ in {
|
|||
tls_cet_file = mkDefault "";
|
||||
|
||||
enable_tls = mkDefault false;
|
||||
} // rec {
|
||||
database_type = mkDefault "none";
|
||||
database_file = mkIf (database_type == "sqlite") "/var/lib/librespeed/speedtest.sqlite";
|
||||
};
|
||||
|
||||
systemd.services = let
|
||||
configFile = let
|
||||
anyToString = arg: if (lib.isBool arg) then
|
||||
mapValue = arg: if (lib.isBool arg) then
|
||||
lib.boolToString arg
|
||||
else if (lib.isInt arg) then
|
||||
toString arg
|
||||
|
@ -195,8 +197,9 @@ in {
|
|||
in
|
||||
with lib; pipe cfg.settings [
|
||||
(filterAttrs (_: val: val != null))
|
||||
(mapAttrs (name: val: "${path}=${anyToString val}"))
|
||||
(concatLines attrValues)
|
||||
(mapAttrs (name: val: "${name}=${mapValue val}"))
|
||||
(attrValues)
|
||||
(concatLines)
|
||||
(pkgs.writeText "${cfg.package.name}-config.toml")
|
||||
];
|
||||
in {
|
||||
|
|
|
@ -32,5 +32,6 @@ rustPlatform.buildRustPackage {
|
|||
homepage = "https://github.com/librespeed/speedtest-rust";
|
||||
license = lib.licenses.lgpl3Plus;
|
||||
maintainers = with lib.maintainers; [ snaki ];
|
||||
mainProgram = "librespeed-rs";
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue