mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-17 09:34:36 +00:00
meguca: git-2018-05-17 -> git-2018-05-20
This commit is contained in:
parent
14a26f0153
commit
e2f1a05756
@ -11,7 +11,7 @@ in
|
|||||||
|
|
||||||
baseDir = mkOption {
|
baseDir = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
default = "/var/lib/meguca";
|
default = "/run/meguca";
|
||||||
description = "Location where meguca stores it's database and links.";
|
description = "Location where meguca stores it's database and links.";
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -21,6 +21,12 @@ in
|
|||||||
description = "Password for the meguca database.";
|
description = "Password for the meguca database.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
passwordFile = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
default = "/run/keys/meguca-password-file";
|
||||||
|
description = "Password file for the meguca database.";
|
||||||
|
};
|
||||||
|
|
||||||
reverseProxy = mkOption {
|
reverseProxy = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = null;
|
default = null;
|
||||||
@ -40,17 +46,23 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
cacheSize = mkOption {
|
cacheSize = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.int;
|
||||||
default = null;
|
default = null;
|
||||||
description = "Cache size in MB.";
|
description = "Cache size in MB.";
|
||||||
};
|
};
|
||||||
|
|
||||||
postgresArgs = mkOption {
|
postgresArgs = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.str;
|
||||||
default = null;
|
default = "user=meguca password=" + cfg.password + " dbname=meguca sslmode=disable";
|
||||||
description = "Postgresql connection arguments.";
|
description = "Postgresql connection arguments.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
postgresArgsFile = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
default = "/run/keys/meguca-postgres-args";
|
||||||
|
description = "Postgresql connection arguments file.";
|
||||||
|
};
|
||||||
|
|
||||||
compressTraffic = mkOption {
|
compressTraffic = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
@ -74,6 +86,16 @@ in
|
|||||||
security.sudo.enable = cfg.enable == true;
|
security.sudo.enable = cfg.enable == true;
|
||||||
services.postgresql.enable = cfg.enable == true;
|
services.postgresql.enable = cfg.enable == true;
|
||||||
|
|
||||||
|
services.meguca.passwordFile = mkDefault (toString (pkgs.writeTextFile {
|
||||||
|
name = "meguca-password-file";
|
||||||
|
text = cfg.password;
|
||||||
|
}));
|
||||||
|
|
||||||
|
services.meguca.postgresArgsFile = mkDefault (toString (pkgs.writeTextFile {
|
||||||
|
name = "meguca-postgres-args";
|
||||||
|
text = cfg.postgresArgs;
|
||||||
|
}));
|
||||||
|
|
||||||
systemd.services.meguca = {
|
systemd.services.meguca = {
|
||||||
description = "meguca";
|
description = "meguca";
|
||||||
after = [ "network.target" "postgresql.service" ];
|
after = [ "network.target" "postgresql.service" ];
|
||||||
@ -83,30 +105,43 @@ in
|
|||||||
# Ensure folder exists and links are correct or create them
|
# Ensure folder exists and links are correct or create them
|
||||||
mkdir -p ${cfg.baseDir}
|
mkdir -p ${cfg.baseDir}
|
||||||
ln -sf ${pkgs.meguca}/share/meguca/www ${cfg.baseDir}
|
ln -sf ${pkgs.meguca}/share/meguca/www ${cfg.baseDir}
|
||||||
chown -R meguca:meguca ${cfg.baseDir}
|
|
||||||
|
|
||||||
# Ensure the database is correct or create it
|
# Ensure the database is correct or create it
|
||||||
${pkgs.sudo}/bin/sudo -u ${postgres.superUser} ${postgres.package}/bin/createuser -SDR meguca || true
|
${pkgs.sudo}/bin/sudo -u ${postgres.superUser} ${postgres.package}/bin/createuser \
|
||||||
${pkgs.sudo}/bin/sudo -u ${postgres.superUser} ${postgres.package}/bin/psql -c "ALTER ROLE meguca WITH PASSWORD '${cfg.password}';" || true
|
-SDR meguca || true
|
||||||
${pkgs.sudo}/bin/sudo -u ${postgres.superUser} ${postgres.package}/bin/createdb -T template0 -E UTF8 -O meguca meguca || true
|
${pkgs.sudo}/bin/sudo -u ${postgres.superUser} ${postgres.package}/bin/psql \
|
||||||
|
-c "ALTER ROLE meguca WITH PASSWORD '$(cat ${cfg.passwordFile})';" || true
|
||||||
|
${pkgs.sudo}/bin/sudo -u ${postgres.superUser} ${postgres.package}/bin/createdb \
|
||||||
|
-T template0 -E UTF8 -O meguca meguca || true
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
script = ''
|
||||||
|
cd ${cfg.baseDir}
|
||||||
|
|
||||||
|
${pkgs.meguca}/bin/meguca -d "$(cat ${cfg.postgresArgsFile})"\
|
||||||
|
${optionalString (cfg.reverseProxy != null) " -R ${cfg.reverseProxy}"}\
|
||||||
|
${optionalString (cfg.sslCertificate != null) " -S ${cfg.sslCertificate}"}\
|
||||||
|
${optionalString (cfg.listenAddress != null) " -a ${cfg.listenAddress}"}\
|
||||||
|
${optionalString (cfg.cacheSize != null) " -c ${toString cfg.cacheSize}"}\
|
||||||
|
${optionalString (cfg.compressTraffic) " -g"}\
|
||||||
|
${optionalString (cfg.assumeReverseProxy) " -r"}\
|
||||||
|
${optionalString (cfg.httpsOnly) " -s"} start
|
||||||
|
'';
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
PermissionsStartOnly = true;
|
PermissionsStartOnly = true;
|
||||||
Type = "forking";
|
Type = "forking";
|
||||||
User = "meguca";
|
User = "meguca";
|
||||||
Group = "meguca";
|
Group = "meguca";
|
||||||
WorkingDirectory = "${cfg.baseDir}";
|
RuntimeDirectory = "meguca";
|
||||||
ExecStart = ''${pkgs.meguca}/bin/meguca${if cfg.reverseProxy != null then " -R ${cfg.reverseProxy}" else ""}${if cfg.sslCertificate != null then " -S ${cfg.sslCertificate}" else ""}${if cfg.listenAddress != null then " -a ${cfg.listenAddress}" else ""}${if cfg.cacheSize != null then " -c ${cfg.cacheSize}" else ""}${if cfg.postgresArgs != null then " -d ${cfg.postgresArgs}" else ""}${if cfg.compressTraffic then " -g" else ""}${if cfg.assumeReverseProxy then " -r" else ""}${if cfg.httpsOnly then " -s" else ""} start'';
|
|
||||||
ExecStop = "${pkgs.meguca}/bin/meguca stop";
|
ExecStop = "${pkgs.meguca}/bin/meguca stop";
|
||||||
ExecRestart = "${pkgs.meguca}/bin/meguca restart";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
users = {
|
users = {
|
||||||
extraUsers.meguca = {
|
extraUsers.meguca = {
|
||||||
description = "meguca server service user";
|
description = "meguca server service user";
|
||||||
home = "${cfg.baseDir}";
|
home = cfg.baseDir;
|
||||||
createHome = true;
|
createHome = true;
|
||||||
group = "meguca";
|
group = "meguca";
|
||||||
uid = config.ids.uids.meguca;
|
uid = config.ids.uids.meguca;
|
||||||
@ -119,5 +154,5 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
meta.maintainers = [ maintainers.chiiruno ];
|
meta.maintainers = with maintainers; [ chiiruno ];
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
{ stdenv, buildGoPackage, fetchgit, pkgconfig, ffmpeg-full, graphicsmagick, ghostscript, quicktemplate, go-bindata, easyjson, nodePackages, cmake, emscripten }:
|
{ stdenv, buildGoPackage, fetchgit, pkgconfig, ffmpeg-full, graphicsmagick, ghostscript, quicktemplate,
|
||||||
|
go-bindata, easyjson, nodePackages, cmake, emscripten }:
|
||||||
|
|
||||||
buildGoPackage rec {
|
buildGoPackage rec {
|
||||||
name = "meguca-unstable-${version}";
|
name = "meguca-unstable-${version}";
|
||||||
version = "2018-05-17";
|
version = "2018-05-20";
|
||||||
rev = "3107c78d95de3b64556f761d3b6dcfd5c590e0ec";
|
rev = "0432df41f30795cad5dc9d135ab620d5da7c7b04";
|
||||||
goPackagePath = "github.com/bakape/meguca";
|
goPackagePath = "github.com/bakape/meguca";
|
||||||
goDeps = ./server_deps.nix;
|
goDeps = ./server_deps.nix;
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
@ -13,7 +14,7 @@ buildGoPackage rec {
|
|||||||
src = fetchgit {
|
src = fetchgit {
|
||||||
inherit rev;
|
inherit rev;
|
||||||
url = "https://github.com/bakape/meguca";
|
url = "https://github.com/bakape/meguca";
|
||||||
sha256 = "1rvkr5af5d4rlyxylynnpn76hvxq9xd7j8q6mffn6qj6j5p4qg4p";
|
sha256 = "0fahk5ykpah14pwgmgiajps2y3pn96wa4z34rcphkwy549ycxxd0";
|
||||||
fetchSubmodules = true;
|
fetchSubmodules = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -194,8 +194,8 @@
|
|||||||
fetch = {
|
fetch = {
|
||||||
type = "git";
|
type = "git";
|
||||||
url = "https://go.googlesource.com/crypto";
|
url = "https://go.googlesource.com/crypto";
|
||||||
rev = "21052ae46654ecf18dfdba0f7c12701a1e2b3164";
|
rev = "1a580b3eff7814fc9b40602fd35256c63b50f491";
|
||||||
sha256 = "0wzi1knv181h6y8k3k7wlr7sw492pgxir4gyg2riavrk8c23y2s2";
|
sha256 = "11adgxc6fzcb3dxr5v2g4nk6ggrz04qnx633hzgmzfh2wv3blgv7";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -203,8 +203,8 @@
|
|||||||
fetch = {
|
fetch = {
|
||||||
type = "git";
|
type = "git";
|
||||||
url = "https://go.googlesource.com/sys";
|
url = "https://go.googlesource.com/sys";
|
||||||
rev = "7db1c3b1a98089d0071c84f646ff5c96aad43682";
|
rev = "7c87d13f8e835d2fb3a70a2912c811ed0c1d241b";
|
||||||
sha256 = "0z20mhdy3wiy53xch0fp49gv574qrs77fps5wxi12n57840s2jfr";
|
sha256 = "03fhkng37rczqwfgah5hd7d373jps3hcfx79dmky2fh62yvpcyn3";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -212,8 +212,8 @@
|
|||||||
fetch = {
|
fetch = {
|
||||||
type = "git";
|
type = "git";
|
||||||
url = "https://go.googlesource.com/text";
|
url = "https://go.googlesource.com/text";
|
||||||
rev = "7922cc490dd5a7dbaa7fd5d6196b49db59ac042f";
|
rev = "5c1cf69b5978e5a34c5f9ba09a83e56acc4b7877";
|
||||||
sha256 = "06sicjc24hv7v9p1l6psaq87w4lycx3mjixd6gsd1wnd4jhqvlnr";
|
sha256 = "03br8p1sb1ffr02l8hyrgcyib7ms0z06wy3v4r1dj2l6q4ghwzfs";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user