Use krops for deployments

This commit is contained in:
Simon Bruder 2020-12-12 16:12:38 +01:00
parent 7e7bc4b14c
commit f53b777a7e
No known key found for this signature in database
GPG key ID: 6F03E0000CC5B62F
4 changed files with 49 additions and 0 deletions

31
lib/krops.nix Normal file
View file

@ -0,0 +1,31 @@
{ hostname
, target ? null
, extraSources ? { }
}:
let
sources = import ../nix/sources.nix;
krops = sources.krops;
lib = import "${krops}/lib";
pkgs = import "${krops}/pkgs" { };
source = lib.evalSource [
({
nixpkgs.git = {
ref = sources.nixpkgs.rev;
url = https://github.com/NixOS/nixpkgs;
shallow = true;
};
config.file = toString ../.;
nixos-config.symlink = "config/machines/${hostname}/configuration.nix";
} // extraSources)
];
in
pkgs.krops.writeDeploy "deploy-${hostname}" {
source = source;
target = lib.mkTarget (if target == null then "root@${hostname}" else target) // {
extraOptions = [
# force allocation of tty to allow aborting with ^C and to show build progress
"-t"
];
};
}

View file

@ -0,0 +1,3 @@
import ../../lib/krops.nix {
hostname = "nunotaba";
}

View file

@ -0,0 +1,3 @@
import ../../lib/krops.nix {
hostname = "sayuri";
}

View file

@ -1,4 +1,16 @@
{
"krops": {
"branch": "master",
"description": "Mirror of https://cgit.krebsco.de/krops/about/ (PRs / issues accepted, as can be seen by not having them disabled)",
"homepage": "",
"owner": "krebs",
"repo": "krops",
"rev": "c207e1f71b85d7ed20f6bc8d91704ceec09ea5ef",
"sha256": "11rk7i7vy788sxhhngj9951z36y5y6l83szidjglw7czhff9rrbc",
"type": "tarball",
"url": "https://github.com/krebs/krops/archive/c207e1f71b85d7ed20f6bc8d91704ceec09ea5ef.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "nixos-20.09",
"description": "Nix Packages collection",