diff --git a/flake.lock b/flake.lock index c6dc63b..b48e156 100644 --- a/flake.lock +++ b/flake.lock @@ -165,9 +165,30 @@ "home-manager": "home-manager_2", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", + "todos": "todos", "website": "website" } }, + "todos": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1699811932, + "narHash": "sha256-HfzWtq2qBcjCnhWzDXdmaK5yNk49HapzJ0c+ER8RirA=", + "owner": "thiloho", + "repo": "todos", + "rev": "3e411cb41681d4dc69df85178c6d6550c7f63da3", + "type": "github" + }, + "original": { + "owner": "thiloho", + "repo": "todos", + "type": "github" + } + }, "website": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index fdf8383..124d06a 100644 --- a/flake.nix +++ b/flake.nix @@ -20,6 +20,10 @@ url = "github:thiloho/discord-bot"; inputs.nixpkgs.follows = "nixpkgs"; }; + todos = { + url = "github:thiloho/todos"; + inputs.nixpkgs.follows = "nixpkgs"; + }; agenix = { url = "github:ryantm/agenix"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/nixos-configurations/server/default.nix b/nixos-configurations/server/default.nix index 798eb5e..317c16d 100644 --- a/nixos-configurations/server/default.nix +++ b/nixos-configurations/server/default.nix @@ -11,6 +11,7 @@ age.secrets.hedgedoc-environment-file.file = ../../secrets/hedgedoc-environment-file.age; age.secrets.discord-bot-token.file = ../../secrets/discord-bot-token.age; + age.secrets.todos-environment-file.file = ../../secrets/todos-environment-file.age; environment.systemPackages = with pkgs; [ nodejs_20 @@ -79,6 +80,11 @@ extraConfig = "proxy_ssl_server_name on;"; }; }; + "todos.thilohohlt.com" = { + enableACME = true; + forceSSL = true; + locations."/".proxyPass = "http://localhost:5173"; + }; }; }; hedgedoc = { @@ -101,7 +107,7 @@ postgresql = { enable = true; package = pkgs.postgresql_15; - ensureDatabases = [ "dcbot" "hedgedoc" ]; + ensureDatabases = [ "dcbot" "hedgedoc" "todos" ]; ensureUsers = [ { name = "hedgedoc"; @@ -125,19 +131,33 @@ ''; }; - systemd.services.denbot = { - description = "Thilo's Den discord bot"; - wantedBy = ["multi-user.target"]; - after = ["network-online.target"]; - serviceConfig = { - Type = "simple"; - ExecStartPre = [ - "${pkgs.nodejs_20}/bin/node dbInit.js" - "${pkgs.nodejs_20}/bin/node deploy-commands.js --token=${config.age.secrets.discord-bot-token.path} --clientId=1142441791459704912" - ]; - ExecStart = "${pkgs.nodejs_20}/bin/node index.js --token=${config.age.secrets.discord-bot-token.path}"; - WorkingDirectory = inputs.denbot.packages.${pkgs.system}.default; - Restart = "always"; + systemd.services = { + todoapp = { + description = "Todo application to plan your daily tasks effectively"; + wantedBy = ["multi-user.target"]; + wants = ["network-online.target"]; + serviceConfig = { + Type = "simple"; + Environment = "PORT=5173 DOTENV_CONFIG_PATH=${config.age.secrets.todos-environment-file.path}"; + ExecStart = "${pkgs.nodejs_20}/bin/node -r dotenv/config ."; + WorkingDirectory = inputs.todos.packages.${pkgs.system}.default; + Restart = "always"; + }; + }; + denbot = { + description = "Thilo's Den discord bot"; + wantedBy = ["multi-user.target"]; + wants = ["network-online.target"]; + serviceConfig = { + Type = "simple"; + ExecStartPre = [ + "${pkgs.nodejs_20}/bin/node dbInit.js" + "${pkgs.nodejs_20}/bin/node deploy-commands.js --token=${config.age.secrets.discord-bot-token.path} --clientId=1142441791459704912" + ]; + ExecStart = "${pkgs.nodejs_20}/bin/node index.js --token=${config.age.secrets.discord-bot-token.path}"; + WorkingDirectory = inputs.denbot.packages.${pkgs.system}.default; + Restart = "always"; + }; }; }; diff --git a/secrets/hedgedoc-environment-file.age b/secrets/hedgedoc-environment-file.age index d00cb53..b56f3ce 100644 Binary files a/secrets/hedgedoc-environment-file.age and b/secrets/hedgedoc-environment-file.age differ diff --git a/secrets/secrets.nix b/secrets/secrets.nix index a4aeddf..77c6b97 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -5,4 +5,5 @@ in { "hedgedoc-environment-file.age".publicKeys = [ server pc ]; "discord-bot-token.age".publicKeys = [ server pc ]; -} \ No newline at end of file + "todos-environment-file.age".publicKeys = [ server pc ]; +} diff --git a/secrets/todos-environment-file.age b/secrets/todos-environment-file.age new file mode 100644 index 0000000..be0b1b0 Binary files /dev/null and b/secrets/todos-environment-file.age differ