h: move to the nixpkgs gts module / package
This commit is contained in:
parent
d66addf25a
commit
d9ae1fa91e
@ -35,9 +35,9 @@ in
|
|||||||
./bins
|
./bins
|
||||||
];
|
];
|
||||||
|
|
||||||
disabledModules = [
|
# disabledModules = [
|
||||||
"services/web-apps/gotosocial.nix"
|
# "services/web-apps/gotosocial.nix"
|
||||||
];
|
# ];
|
||||||
|
|
||||||
options.myconf = {
|
options.myconf = {
|
||||||
managementPubKeys = lib.mkOption rec {
|
managementPubKeys = lib.mkOption rec {
|
||||||
|
@ -362,8 +362,6 @@
|
|||||||
};
|
};
|
||||||
gokrazy = upkgs.callPackage ./pkgs/gokrazy.nix { inherit upkgs; };
|
gokrazy = upkgs.callPackage ./pkgs/gokrazy.nix { inherit upkgs; };
|
||||||
gosignify = spkgs.callPackage ./pkgs/gosignify.nix { inherit spkgs; };
|
gosignify = spkgs.callPackage ./pkgs/gosignify.nix { inherit spkgs; };
|
||||||
gotosocial =
|
|
||||||
spkgs.callPackage ./pkgs/gotosocial.nix { inherit spkgs; };
|
|
||||||
zutty = upkgs.callPackage ./pkgs/zutty.nix {
|
zutty = upkgs.callPackage ./pkgs/zutty.nix {
|
||||||
inherit upkgs;
|
inherit upkgs;
|
||||||
};
|
};
|
||||||
|
@ -409,7 +409,7 @@ in
|
|||||||
gotosocial = {
|
gotosocial = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# https://github.com/superseriousbusiness/gotosocial/blob/v0.5.2/example/config.yaml
|
# https://github.com/superseriousbusiness/gotosocial/blob/v0.5.2/example/config.yaml
|
||||||
configuration = {
|
settings = {
|
||||||
account-domain = "mammothcirc.us";
|
account-domain = "mammothcirc.us";
|
||||||
accounts-approval-required = false;
|
accounts-approval-required = false;
|
||||||
accounts-reason-required = false;
|
accounts-reason-required = false;
|
||||||
@ -432,8 +432,6 @@ in
|
|||||||
storage-backend = "local";
|
storage-backend = "local";
|
||||||
storage-local-base-path = "/var/lib/gotosocial";
|
storage-local-base-path = "/var/lib/gotosocial";
|
||||||
trusted-proxies = [ "127.0.0.1/32" "23.29.118.0/24" ];
|
trusted-proxies = [ "127.0.0.1/32" "23.29.118.0/24" ];
|
||||||
web-template-base-dir = "${config.services.gotosocial.package}/assets/web/template/";
|
|
||||||
web-asset-base-dir = "${config.services.gotosocial.package}/assets/web/assets/";
|
|
||||||
landing-page-user = "qbit";
|
landing-page-user = "qbit";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -800,7 +798,7 @@ in
|
|||||||
locations."/" = {
|
locations."/" = {
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
proxy_pass http://127.0.0.1:${
|
proxy_pass http://127.0.0.1:${
|
||||||
toString config.services.gotosocial.configuration.port
|
toString config.services.gotosocial.settings.port
|
||||||
};
|
};
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
imports = [
|
imports = [
|
||||||
./backup.nix
|
./backup.nix
|
||||||
./golink.nix
|
./golink.nix
|
||||||
./gotosocial.nix
|
|
||||||
./lock-action.nix
|
./lock-action.nix
|
||||||
./rtlamr2mqtt.nix
|
./rtlamr2mqtt.nix
|
||||||
./ssh-fido-agent.nix
|
./ssh-fido-agent.nix
|
||||||
|
@ -1,83 +0,0 @@
|
|||||||
{ config
|
|
||||||
, lib
|
|
||||||
, pkgs
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
with pkgs; let
|
|
||||||
cfg = config.services.gotosocial;
|
|
||||||
gotosocial = callPackage ../pkgs/gotosocial.nix { };
|
|
||||||
settingsFormat = pkgs.formats.json { };
|
|
||||||
settingsType = settingsFormat.type;
|
|
||||||
prettyJSON = conf:
|
|
||||||
pkgs.runCommandLocal "gotosocial-config.json" { } ''
|
|
||||||
echo '${
|
|
||||||
builtins.toJSON conf
|
|
||||||
}' | ${pkgs.buildPackages.jq}/bin/jq 'del(._module)' > $out
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options = with lib; {
|
|
||||||
services.gotosocial = {
|
|
||||||
enable = mkEnableOption "Enable gotosocial";
|
|
||||||
|
|
||||||
user = mkOption {
|
|
||||||
type = with types; oneOf [ str int ];
|
|
||||||
default = "gotosocial";
|
|
||||||
description = ''
|
|
||||||
The user the service will use.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
group = mkOption {
|
|
||||||
type = with types; oneOf [ str int ];
|
|
||||||
default = "gotosocial";
|
|
||||||
description = ''
|
|
||||||
The user the service will use.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
configuration = mkOption {
|
|
||||||
type = settingsType;
|
|
||||||
description = ''
|
|
||||||
Specify the configuration for GoToSocial in Nix.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
package = mkOption {
|
|
||||||
type = types.package;
|
|
||||||
default = gotosocial;
|
|
||||||
defaultText = literalExpression "pkgs.gotosocial";
|
|
||||||
description = "The package to use for gotosocial";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
users.groups.gotosocial = { };
|
|
||||||
users.users.gotosocial = {
|
|
||||||
description = "Gotosocial service user";
|
|
||||||
isSystemUser = true;
|
|
||||||
home = "/var/lib/gotosocial";
|
|
||||||
createHome = true;
|
|
||||||
group = "gotosocial";
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.services.gotosocial = {
|
|
||||||
enable = true;
|
|
||||||
description = "GoToSocial server";
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
after = [ "postgresql.service" ];
|
|
||||||
|
|
||||||
serviceConfig = {
|
|
||||||
User = cfg.user;
|
|
||||||
Group = cfg.group;
|
|
||||||
|
|
||||||
RuntimeDirectory = "/var/lib/gotosocial";
|
|
||||||
|
|
||||||
ExecStart = "${cfg.package}/bin/gotosocial --config-path ${
|
|
||||||
prettyJSON cfg.configuration
|
|
||||||
} server start";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
{ lib
|
|
||||||
, buildGoModule
|
|
||||||
, fetchFromGitHub
|
|
||||||
, go
|
|
||||||
, ffmpeg
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
gotosocialVersion = "0.17.0";
|
|
||||||
gtswaHash = "sha256:1i6ks3dlmaq9g8a1fka26fgrcy9ps0kxmyvqhzjdkabwzwhqyah1";
|
|
||||||
gtssHash = "sha256-uyqP3zhjcXKejGFAwZoTn2kY8IpX0QAAXNzb1VG6ve8=";
|
|
||||||
gotosocialWebAssets = builtins.fetchurl {
|
|
||||||
url = "https://github.com/superseriousbusiness/gotosocial/releases/download/v${gotosocialVersion}/gotosocial_${gotosocialVersion}_web-assets.tar.gz";
|
|
||||||
sha256 = gtswaHash;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
with lib;
|
|
||||||
buildGoModule rec {
|
|
||||||
pname = "gotosocial";
|
|
||||||
version = gotosocialVersion;
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "superseriousbusiness";
|
|
||||||
repo = pname;
|
|
||||||
rev = "v${version}";
|
|
||||||
hash = gtssHash;
|
|
||||||
};
|
|
||||||
|
|
||||||
ldflags = [
|
|
||||||
"-s"
|
|
||||||
"-w"
|
|
||||||
"-extldflags '-static'"
|
|
||||||
"-X 'main.Commit=${version}'"
|
|
||||||
"-X 'main.Version=${version}'"
|
|
||||||
];
|
|
||||||
|
|
||||||
propagatedBuildInputs = [ ffmpeg ];
|
|
||||||
|
|
||||||
proxyVendor = false;
|
|
||||||
vendorHash = null;
|
|
||||||
|
|
||||||
doCheck = false;
|
|
||||||
|
|
||||||
preBuild = ''
|
|
||||||
echo ${go}/bin/go
|
|
||||||
${go}/bin/go version
|
|
||||||
'';
|
|
||||||
|
|
||||||
postInstall = ''
|
|
||||||
mkdir -p $out/assets
|
|
||||||
tar -C $out/assets/ -zxvf ${gotosocialWebAssets}
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = {
|
|
||||||
description = "Fast, fun, ActivityPub server, powered by Go.";
|
|
||||||
homepage = "https://github.com/superseriousbusiness/gotosocial";
|
|
||||||
license = licenses.agpl3Only;
|
|
||||||
maintainers = with maintainers; [ qbit ];
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user