self-hosting/flake.nix

56 lines
1.4 KiB
Nix
Raw Normal View History

{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.05";
outputs = { self, nixpkgs }:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
2021-07-15 17:09:32 +02:00
common = {
modules = [
./hardware/hcloud.nix
./modules/openssh.nix
];
};
2021-07-15 17:33:31 +02:00
in
{
devShell.x86_64-linux = pkgs.mkShell {
2021-07-15 17:09:32 +02:00
buildInputs = with pkgs; [
2021-07-15 17:33:31 +02:00
nixpkgs-fmt
2021-07-15 17:09:32 +02:00
terraform_0_14
sops
];
};
2021-07-15 17:09:32 +02:00
nixosConfigurations = {
db1 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
2021-07-15 17:33:31 +02:00
modules = common.modules ++ [
2021-07-15 17:09:32 +02:00
./modules/postgresql.nix
({
environment.systemPackages = with pkgs; [
htop
];
networking.hostName = "db1";
networking.domain = "banditlair.com";
networking.firewall.interfaces."enp7s0".allowedTCPPorts = [ 5432 ];
})
];
};
backend1 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
2021-07-15 17:33:31 +02:00
modules = common.modules ++ [
2021-07-15 17:09:32 +02:00
./modules/murmur.nix
./modules/synapse.nix
({
networking.hostName = "backend1";
networking.domain = "banditlair.com";
networking.firewall.allowedTCPPorts = [ 80 443 64738 ];
networking.firewall.allowedUDPPorts = [ 64738 ];
})
];
};
};
};
}