self-host-playbook/flake.nix

59 lines
1.4 KiB
Nix
Raw Normal View History

2025-02-18 08:50:17 +01:00
{
2025-04-03 11:10:07 +02:00
description = "Self-hosted server setup with Portainer, n8n, and Baserow";
2025-02-18 08:50:17 +01:00
inputs = {
2025-04-03 11:10:07 +02:00
base-config = {
# url = "path:/home/m3tam3re/p/nix/self-host-playbook-base";
url = "git+https://code.m3tam3re.com/m3tam3re/self-host-playbook-base?ref=stable";
};
nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-24.11";
follows = "base-config/nixpkgs";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
2025-04-09 16:08:16 +02:00
deploy-rs = {
url = "github:serokell/deploy-rs";
follows = "nixpkgs";
};
2025-02-18 08:50:17 +01:00
};
2025-04-03 11:10:07 +02:00
outputs = {
self,
base-config,
2025-04-09 16:08:16 +02:00
deploy-rs,
2025-04-03 11:10:07 +02:00
nixpkgs,
...
2025-04-09 16:08:16 +02:00
} @ inputs: let
jsonConfig = builtins.fromJSON (builtins.readFile ./config.json);
in {
2025-04-10 12:32:08 +02:00
nixosConfigurations.server = nixpkgs.lib.nixosSystem {
2025-04-03 11:10:07 +02:00
system = "x86_64-linux";
modules = [
(base-config.nixosModules.default {
tier = "starter";
2025-04-09 16:08:16 +02:00
inherit jsonConfig;
2025-04-03 11:10:07 +02:00
}) # Pass tier here
inputs.disko.nixosModules.disko
./configuration.nix
];
specialArgs = {
inherit self;
2025-02-18 08:50:17 +01:00
};
};
2025-04-10 12:32:08 +02:00
deploy.nodes.server = {
2025-04-09 16:08:16 +02:00
hostname = "self-host-playbook";
profiles.system = {
sshUser = jsonConfig.username;
user = "root";
interactiveSudo = true;
path =
deploy-rs.lib.x86_64-linux.activate.nixos
2025-04-10 12:32:08 +02:00
self.nixosConfigurations.server;
2025-04-09 16:08:16 +02:00
};
};
2025-02-18 08:50:17 +01:00
};
}