nixos-configuration/phobos/flake.nix

59 lines
1.5 KiB
Nix
Raw Normal View History

2023-12-08 15:52:59 +00:00
{
2023-12-08 19:07:54 +00:00
description = "Remote machine - phobos";
2023-12-08 15:52:59 +00:00
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
boardwise = {
url = "github:boardwise-gg/website/v0.1.0";
};
2023-12-08 16:39:14 +00:00
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-12-08 15:52:59 +00:00
};
2023-12-08 16:39:14 +00:00
outputs = { boardwise, sops-nix, ... }: {
2023-12-08 15:52:59 +00:00
nixosModules.default = { modulesPath, pkgs, lib, system, ... }: {
imports = lib.optional (builtins.pathExists ./do-userdata.nix) ./do-userdata.nix ++ [
(modulesPath + "/virtualisation/digital-ocean-config.nix")
2023-12-08 16:39:14 +00:00
sops-nix.nixosModules.sops
2023-12-08 15:52:59 +00:00
];
2023-12-08 19:07:54 +00:00
deployment.targetHost = "146.190.127.180";
2023-12-08 15:52:59 +00:00
networking = {
hostName = "phobos";
firewall = {
enable = true;
allowedTCPPorts = [ 80 443 ];
};
};
services.postgresql = {
enable = true;
package = pkgs.postgresql_15;
ensureDatabases = [ "boardwise" ];
authentication = lib.mkOverride 10 ''
# TYPE DATABASE USER ADDRESS METHOD
local all all trust
'';
};
environment = {
systemPackages = [
boardwise.packages.${system}.app
];
variables = {
DATABASE_URL="ecto://postgres:postgres@localhost/boardwise";
};
};
2023-12-08 19:07:54 +00:00
sops.defaultSopsFile = ./secrets.yaml;
sops.secrets.example-key = {};
sops.secrets."myservice/my_subdir/my_secret" = {};
2023-12-08 15:52:59 +00:00
system.stateVersion = "23.11";
};
};
}