diff options
Diffstat (limited to 'odin.nix')
-rw-r--r-- | odin.nix | 48 |
1 files changed, 47 insertions, 1 deletions
@@ -15,6 +15,7 @@ | |||
15 | ./custom/motion.nix | 15 | ./custom/motion.nix |
16 | ./custom/unit-status-mail.nix | 16 | ./custom/unit-status-mail.nix |
17 | ./custom/zsh.nix | 17 | ./custom/zsh.nix |
18 | ./custom/bar-service.nix | ||
18 | ./utils/nix/module.nix | 19 | ./utils/nix/module.nix |
19 | ]; | 20 | ]; |
20 | 21 | ||
@@ -423,6 +424,51 @@ | |||
423 | ''; | 424 | ''; |
424 | }; | 425 | }; |
425 | 426 | ||
427 | services.postgresql = { | ||
428 | enable = true; | ||
429 | package = with pkgs; postgresql100; | ||
430 | enableTCPIP = true; | ||
431 | authentication = lib.mkForce '' | ||
432 | local all all peer | ||
433 | host all all 127.0.0.1/32 scram-sha-256 | ||
434 | host all all ::1/128 scram-sha-256 | ||
435 | host all all 10.141.0.0/16 scram-sha-256 | ||
436 | ''; | ||
437 | initialScript = pkgs.writeText "schema.sql" '' | ||
438 | CREATE USER bar; | ||
439 | CREATE DATABASE bar WITH OWNER = bar; | ||
440 | GRANT ALL ON DATABASE bar TO bar; | ||
441 | ''; | ||
442 | }; | ||
443 | |||
444 | services.bar = { | ||
445 | enable = true; | ||
446 | port = 8082; | ||
447 | approot = "/bar"; | ||
448 | }; | ||
449 | |||
450 | services.nginx = { | ||
451 | enable = true; | ||
452 | |||
453 | recommendedOptimisation = true; | ||
454 | recommendedGzipSettings = true; | ||
455 | recommendedProxySettings = true; | ||
456 | |||
457 | virtualHosts."odin.asgard.yggdrasil" = { | ||
458 | serverAliases = [ "odin" "10.141.1.2" ]; | ||
459 | |||
460 | locations = { | ||
461 | "/bar/".proxyPass = "http://bar"; | ||
462 | }; | ||
463 | }; | ||
464 | |||
465 | upstreams = { | ||
466 | "bar" = { | ||
467 | servers."localhost:${services.bar.port}"= {}; | ||
468 | }; | ||
469 | }; | ||
470 | }; | ||
471 | |||
426 | systemd.status-mail = { | 472 | systemd.status-mail = { |
427 | recipient = "root@odin.asgard.yggdrasil"; | 473 | recipient = "root@odin.asgard.yggdrasil"; |
428 | onFailure = [ "nixos-upgrade" | 474 | onFailure = [ "nixos-upgrade" |
@@ -432,7 +478,7 @@ | |||
432 | }; | 478 | }; |
433 | 479 | ||
434 | system.autoUpgrade.enable = true; | 480 | system.autoUpgrade.enable = true; |
435 | system.nixos.stateVersion = "18.09"; | 481 | system.stateVersion = "18.09"; |
436 | 482 | ||
437 | systemd.services."nixos-upgrade" = { | 483 | systemd.services."nixos-upgrade" = { |
438 | path = with pkgs; [ git ]; | 484 | path = with pkgs; [ git ]; |