seafile: removed useless module

This commit is contained in:
Ingolf Wagner 2020-02-24 11:45:36 +08:00
parent 5cf17fa66f
commit fa39f83193
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
4 changed files with 33 additions and 97 deletions

View file

@ -11,8 +11,8 @@
./graylog.nix ./graylog.nix
./jenkins.nix ./jenkins.nix
./kibana.nix ./kibana.nix
./lektor-gaykraft.nix #./lektor-gaykraft.nix
./lektor-terranix.nix #./lektor-terranix.nix
./mail-fetcher.nix ./mail-fetcher.nix
./packages.nix ./packages.nix
./prometheus.nix ./prometheus.nix

View file

@ -1,4 +1,12 @@
{ config, lib, pkgs, ... }: { { config, lib, pkgs, ... }:
let
hostname = "seafile.gaykraft.com";
port = 3030;
home = "/home/seafile";
serviceName = "seafile-docker";
in {
services.nginx = { services.nginx = {
enable = true; enable = true;
@ -7,19 +15,34 @@
"seafile.${config.networking.hostName}.private" = { "seafile.${config.networking.hostName}.private" = {
serverAliases = [ ]; serverAliases = [ ];
locations."/" = { locations."/" = {
proxyPass = "http://${config.networking.hostName}.private:${ proxyPass =
toString config.custom.services.seafile.port "http://${config.networking.hostName}.private:${toString port}";
}";
}; };
}; };
}; };
}; };
custom.services.seafile = { systemd.services."${serviceName}" = {
enable = true; enable = true;
hostname = "seafile.gaykraft.com"; description = "seafile service running as docker";
port = 3030; after = [ "network.target" "docker.service" ];
home = "/home/seafile"; requires = [ "docker.service" ];
wantedBy = [ "multi-user.target" ];
script = ''
# delete old instance to ensure update
${pkgs.docker}/bin/docker stop seafile || true && ${pkgs.docker}/bin/docker rm -f seafile || true
# start instance
${pkgs.docker}/bin/docker run \
--name seafile \
--env SEAFILE_SERVER_HOSTNAME=${hostname} \
--env SEAFILE_ADMIN_EMAIL="root@${hostname}" \
--env SEAFILE_ADMIN_PASSWORD="${
lib.fileContents <secrets/seafile/root>
}" \
--volume ${home}:/shared \
--publish ${toString port}:80 \
seafileltd/seafile:latest
'';
}; };
virtualisation.docker.enable = lib.mkDefault true; virtualisation.docker.enable = lib.mkDefault true;

View file

@ -8,7 +8,6 @@
./services/home-assistant.nix ./services/home-assistant.nix
./services/lektor.nix ./services/lektor.nix
./services/samba-share.nix ./services/samba-share.nix
./services/seafile.nix
./services/sshd.nix ./services/sshd.nix
./services/transmission.nix ./services/transmission.nix
./services/videoencoder.nix ./services/videoencoder.nix

View file

@ -1,86 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.custom.services.seafile;
in {
options.custom.services.seafile = {
enable = mkEnableOption "enable custom.services.seafile";
hostname = mkOption {
type = with types; string;
description = ''
hostname of the seafile server
'';
};
port = mkOption {
type = with types; int;
description = ''
port on where ther server runs on
'';
};
home = mkOption {
type = with types; path;
description = ''
folder in where the seafile stuff gets stored
'';
};
serviceName = mkOption {
type = with types; string;
default = "seafile-docker";
description = ''
name of the systemd service
'';
};
};
config = mkIf cfg.enable {
virtualisation.docker.enable = true;
systemd.services."${cfg.serviceName}" = {
enable = true;
description = "seafile service running as docker";
after = [ "network.target" "docker.service" ];
requires = [ "docker.service" ];
wantedBy = [ "multi-user.target" ];
script = # sh
''
# delete old instance to ensure update
${pkgs.docker}/bin/docker stop seafile || true && ${pkgs.docker}/bin/docker rm -f seafile || true
# start instance
${pkgs.docker}/bin/docker run \
--name seafile \
--env SEAFILE_SERVER_HOSTNAME=${cfg.hostname} \
--env SEAFILE_ADMIN_EMAIL="root@${cfg.hostname}" \
--env SEAFILE_ADMIN_PASSWORD="${
lib.fileContents <secrets/seafile/root>
}" \
--volume ${cfg.home}:/shared \
--publish ${toString cfg.port}:80 \
seafileltd/seafile:latest
'';
};
};
}
# ! todo
# requires = [ "${config.module.backup.services.encfs."seafile".serviceName}.service" ];
# krops.keys."seafile".path = toString <keys/seafile/encfs>;
#
# module.backup.services.encfs = {
# "seafile" = {
# enable = true;
# encryptedFolder = "/home/seafile.ct";
# decryptedFolder = "/home/seafile";
# keyFile = config.krops.keys."seafile".path;
# requires = [ ''${config.krops.keys."seafile".serviceName}.service'' ];
# };
# };