Use krops for deployments
This commit is contained in:
parent
7e7bc4b14c
commit
f53b777a7e
31
lib/krops.nix
Normal file
31
lib/krops.nix
Normal 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"
|
||||
];
|
||||
};
|
||||
}
|
3
machines/nunotaba/krops.nix
Normal file
3
machines/nunotaba/krops.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
import ../../lib/krops.nix {
|
||||
hostname = "nunotaba";
|
||||
}
|
3
machines/sayuri/krops.nix
Normal file
3
machines/sayuri/krops.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
import ../../lib/krops.nix {
|
||||
hostname = "sayuri";
|
||||
}
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue