nixos-config/krops.nix

34 lines
955 B
Nix
Raw Normal View History

let
2024-02-05 11:46:52 +01:00
krops = builtins.fetchGit { url = "https://cgit.krebsco.de/krops/"; };
lib = import "${krops}/lib";
pkgs = import "${krops}/pkgs" { };
2024-02-05 11:46:52 +01:00
source = _name: lib.evalSource [ { machine-config.file = toString ./.; } ];
command = targetPath: ''
nix-shell -p git --run '
2022-11-11 20:39:38 +01:00
nix build '${targetPath}/machine-config#nixosConfigurations.$(hostname).config.system.build.toplevel' && \
nixos-rebuild switch --show-trace --build-host builder@loki --flake ${targetPath}/machine-config
'
'';
2024-02-05 11:46:52 +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;
};
in
2022-10-13 15:27:37 +02:00
{
# Deployments
# Run with:
# nix-build ./krops.nix -A loki && ./result
loki = createHost "loki" "root@loki";
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";
}