nixos-config/krops.nix

38 lines
904 B
Nix
Raw Normal View History

let
krops = builtins.fetchGit {
url = https://cgit.krebsco.de/krops/;
};
lib = import "${krops}/lib";
2022-03-01 22:19:03 +01:00
pkgs = import "${krops}/pkgs" {};
source = name:
2022-03-01 22:19:03 +01:00
lib.evalSource [
{
machine-config.file = toString ./.;
}
];
command = targetPath: ''
nix-shell -p git --run '
nix build -v '${targetPath}/machine-config#nixosConfigurations.$(hostname).config.system.build.toplevel' && \
nixos-rebuild switch -v --show-trace --flake ${targetPath}/machine-config
'
'';
createHost = name: target:
pkgs.krops.writeCommand "deploy-${name}" {
inherit command;
source = source name;
target = target;
};
2022-03-01 22:19:03 +01:00
in rec {
# 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";
}