2021-11-23 12:09:24 +01:00
|
|
|
let
|
|
|
|
krops = builtins.fetchGit {
|
2022-05-03 18:17:38 +02:00
|
|
|
url = "https://cgit.krebsco.de/krops/";
|
2021-11-23 12:09:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
lib = import "${krops}/lib";
|
2022-04-27 00:21:19 +02:00
|
|
|
pkgs = import "${krops}/pkgs" { };
|
2021-11-23 12:09:24 +01:00
|
|
|
source = name:
|
2022-03-01 22:19:03 +01:00
|
|
|
lib.evalSource [
|
|
|
|
{
|
|
|
|
machine-config.file = toString ./.;
|
|
|
|
}
|
|
|
|
];
|
2021-11-23 12:09:24 +01:00
|
|
|
|
|
|
|
command = targetPath: ''
|
|
|
|
nix-shell -p git --run '
|
|
|
|
nix build -v '${targetPath}/machine-config#nixosConfigurations.$(hostname).config.system.build.toplevel' && \
|
2022-10-17 22:20:49 +02:00
|
|
|
nixos-rebuild switch -vvv --show-trace --build-host builder@loki --flake ${targetPath}/machine-config
|
2021-11-23 12:09:24 +01:00
|
|
|
'
|
|
|
|
'';
|
|
|
|
|
|
|
|
createHost = name: target:
|
|
|
|
pkgs.krops.writeCommand "deploy-${name}" {
|
|
|
|
inherit command;
|
|
|
|
source = source name;
|
2022-03-18 21:14:51 +01:00
|
|
|
target = lib.mkTarget target;
|
2021-11-23 12:09:24 +01:00
|
|
|
};
|
2022-04-27 00:21:19 +02:00
|
|
|
in
|
2022-10-13 15:27:37 +02:00
|
|
|
{
|
2021-11-23 12:09:24 +01:00
|
|
|
# Deployments
|
|
|
|
|
|
|
|
# Run with:
|
|
|
|
# nix-build ./krops.nix -A loki && ./result
|
|
|
|
|
|
|
|
loki = createHost "loki" "root@loki";
|
2021-12-10 20:11:36 +01:00
|
|
|
drone = createHost "drone" "root@10.0.0.202";
|
2022-01-25 08:33:18 +01:00
|
|
|
proxy = createHost "proxy" "root@10.0.0.251";
|
2022-06-16 21:05:55 +02:00
|
|
|
gitea = createHost "gitea" "root@10.0.0.201";
|
2021-11-23 12:09:24 +01:00
|
|
|
}
|