summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2019-02-23 19:46:09 -0800
committerBen Sima <ben@bsima.me>2019-02-23 19:54:41 -0800
commitf75eaf7fff963b88e412d315d0fdef8151943c20 (patch)
tree4e10e624ab6b93b640f2a93f648207a41cc90a25 /modules
parent81313e15c70bf1c2fe2cd4720f19ae7a2e952fc7 (diff)
Reorganize directory
Diffstat (limited to 'modules')
-rw-r--r--modules/fathom.nix93
-rw-r--r--modules/ibb.nix42
2 files changed, 0 insertions, 135 deletions
diff --git a/modules/fathom.nix b/modules/fathom.nix
deleted file mode 100644
index dee34b9..0000000
--- a/modules/fathom.nix
+++ /dev/null
@@ -1,93 +0,0 @@
-{ options
-, lib
-, config
-, pkgs
-, modulesPath
-}:
-
-with lib;
-
-let
- cfg = config.services.fathom;
-in
-{
- options.services.fathom = {
- enable = lib.mkEnableOption "Enable the Fathom Analytics service";
-
- port = mkOption {
- type = types.string;
- default = "3000";
- description = ''
- The port on which Fathom will listen for
- incoming HTTP traffic.
- '';
- };
-
- gzip = mkOption {
- type = types.bool;
- default = true;
- description = "Whether or not to enable gzip compression.";
- };
-
- debug = mkOption {
- type = types.bool;
- default = false;
- description = "Whether or not to enable debug mode.";
- };
-
- dataDir = mkOption {
- type = types.path;
- default = "/var/lib/fathom";
- description = "Fathom data directory";
- };
- };
-
- config = mkIf cfg.enable {
- systemd.services.fathom = {
- wantedBy = [ "multi-user.target" ];
- after = [ "network.target" ];
-
- environment = {
- FATHOM_SERVER_ADDR = cfg.port;
- FATHOM_GZIP = builtins.toString cfg.gzip;
- FATHOM_DEBUG = builtins.toString cfg.debug;
- FATHOM_DATABASE_DRIVER = "sqlite3";
- FATHOM_DATABASE_NAME = "${cfg.dataDir}/fathom.db";
- FATHOM_SECRET = "random-secret-string";
- };
- preStart = ''
- echo "[fathom] creating ${cfg.dataDir}"
- mkdir -p ${cfg.dataDir}
- chown -R fathom:fathom ${cfg.dataDir}
- echo "[fathom]" creating ${cfg.dataDir}/.env
- env | grep "^FATHOM" > ${cfg.dataDir}/.env
- '';
- description = ''
- Fathom Analytics
- '';
-
- serviceConfig = {
- Type = "simple";
- User = "fathom";
- Group = "fathom";
- ExecStart = "${pkgs.fathom}/bin/fathom server";
- KillSignal = "INT";
- WorkingDirectory = cfg.dataDir;
- Restart = "on-failure";
- RestartSec = "10";
- PermissionsStartOnly = "true";
- };
- };
-
- environment.systemPackages = [ pkgs.fathom ];
-
- users = {
- groups = { fathom = {}; };
- users.fathom = {
- description = "Fathom daemon user";
- home = cfg.dataDir;
- group = "fathom";
- };
- };
- };
-}
diff --git a/modules/ibb.nix b/modules/ibb.nix
deleted file mode 100644
index e2d4dd0..0000000
--- a/modules/ibb.nix
+++ /dev/null
@@ -1,42 +0,0 @@
-{ options
-, lib
-, config
-, pkgs
-, modulesPath
-}:
-
-let
- cfg = config.services.ibb;
-in
-{
- options.services.ibb = {
- enable = lib.mkEnableOption "Enable the IBB service";
- port = lib.mkOption {
- type = lib.types.string;
- default = "3000";
- description = ''
- The port on which IBB will listen for
- incoming HTTP traffic.
- '';
- };
- };
- config = lib.mkIf cfg.enable {
- systemd.services.ibb = {
- path = with pkgs; [ ibb bash ];
- wantedBy = [ "multi-user.target" ];
- script = ''
- PORT=${cfg.port} ./bin/ibb
- '';
- description = ''
- Influenced By Books website
- '';
- serviceConfig = {
- WorkingDirectory=pkgs.ibb;
- KillSignal="INT";
- Type = "simple";
- Restart = "on-abort";
- RestartSec = "10";
- };
- };
- };
-}