diff --git a/configs/workhorse/configuration.nix b/configs/workhorse/configuration.nix index 89e6e1f..189dde8 100644 --- a/configs/workhorse/configuration.nix +++ b/configs/workhorse/configuration.nix @@ -11,8 +11,8 @@ ./graylog.nix ./jenkins.nix ./kibana.nix - ./lektor-gaykraft.nix - ./lektor-terranix.nix + #./lektor-gaykraft.nix + #./lektor-terranix.nix ./mail-fetcher.nix ./packages.nix ./prometheus.nix diff --git a/configs/workhorse/seafile.nix b/configs/workhorse/seafile.nix index dfde9ec..01a48aa 100644 --- a/configs/workhorse/seafile.nix +++ b/configs/workhorse/seafile.nix @@ -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 = { enable = true; @@ -7,19 +15,34 @@ "seafile.${config.networking.hostName}.private" = { serverAliases = [ ]; locations."/" = { - proxyPass = "http://${config.networking.hostName}.private:${ - toString config.custom.services.seafile.port - }"; + proxyPass = + "http://${config.networking.hostName}.private:${toString port}"; }; }; }; }; - custom.services.seafile = { + systemd.services."${serviceName}" = { enable = true; - hostname = "seafile.gaykraft.com"; - port = 3030; - home = "/home/seafile"; + description = "seafile service running as docker"; + after = [ "network.target" "docker.service" ]; + 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 + }" \ + --volume ${home}:/shared \ + --publish ${toString port}:80 \ + seafileltd/seafile:latest + ''; }; virtualisation.docker.enable = lib.mkDefault true; diff --git a/modules/default.nix b/modules/default.nix index f61bb8d..d1a8c03 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -8,7 +8,6 @@ ./services/home-assistant.nix ./services/lektor.nix ./services/samba-share.nix - ./services/seafile.nix ./services/sshd.nix ./services/transmission.nix ./services/videoencoder.nix diff --git a/modules/services/seafile.nix b/modules/services/seafile.nix deleted file mode 100644 index 832e5d0..0000000 --- a/modules/services/seafile.nix +++ /dev/null @@ -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 - }" \ - --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 ; -# -# 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'' ]; -# }; -# }; -