self-hosting/flake.nix

95 lines
2.5 KiB
Nix
Raw Normal View History

{
2021-09-02 16:11:58 +02:00
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.deploy-rs.url = "github:serokell/deploy-rs";
outputs = { self, nixpkgs, deploy-rs }:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
2021-07-15 17:33:31 +02:00
in
{
devShell.x86_64-linux = pkgs.mkShell {
buildInputs = with pkgs; [
nixpkgs-fmt
terraform
terraform-ls
sops
deploy-rs.packages."x86_64-linux".deploy-rs
];
};
nixosConfigurations = {
db1 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
2021-11-25 00:59:46 +01:00
modules = [
./profiles/db.nix
(
{
networking.hostName = "db1";
networking.domain = "banditlair.com";
2021-11-25 00:59:46 +01:00
system.stateVersion = "21.05";
}
)
];
};
backend1 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
2021-11-25 00:59:46 +01:00
modules = [
./profiles/backend.nix
(
{
networking.hostName = "backend1";
networking.domain = "banditlair.com";
2021-11-25 00:59:46 +01:00
2021-11-26 00:14:44 +01:00
system.stateVersion = "21.05";
}
)
];
};
storage1 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./profiles/storage.nix
(
{
networking.hostName = "storage1";
networking.domain = "banditlair.com";
system.stateVersion = "21.05";
}
)
2021-07-15 17:09:32 +02:00
];
};
};
2021-09-02 16:11:58 +02:00
deploy.nodes = {
db1 = {
hostname = "db1.banditlair.com";
profiles.system = {
user = "root";
sshUser = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.db1;
2021-09-02 16:11:58 +02:00
};
};
backend1 = {
hostname = "backend1.banditlair.com";
profiles.system = {
user = "root";
sshUser = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.backend1;
2021-09-02 16:11:58 +02:00
};
2021-07-15 17:09:32 +02:00
};
2021-11-26 00:14:44 +01:00
storage1 = {
hostname = "78.46.96.243";
profiles.system = {
user = "root";
sshUser = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.storage1;
};
};
2021-09-02 16:11:58 +02:00
};
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
};
}