krops.nix: init with new containers/{ledstrips,scrape}

This commit is contained in:
Astro 2020-04-03 22:49:45 +02:00
parent 35d7ff5e9f
commit dcc281d2e0
4 changed files with 96 additions and 0 deletions

View File

@ -5,6 +5,8 @@ rec {
adc = { };
grafana.publicKey =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPFB9fo01jzr2upEBEXiR7sSmeQoq9ll5Cf5/hjq5e4Y";
scrape = {};
ledstripes = {};
glotzbert.publicKey =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHPrkD07abpTU/66fEjmiMYsUfJCSF62MVFe8BED7wu4";

View File

@ -0,0 +1,30 @@
{ config, pkgs, lib, ... }:
{
imports = [
<nixpkgs/nixos/modules/profiles/minimal.nix>
<lib>
<lib/lxc-container.nix>
<lib/shared.nix>
];
c3d2 = {
isInHq = true;
hq.interface = "eth0";
enableHail = false;
};
networking.hostName = "ledstripes";
networking.useNetworkd = true;
# Required for krops
services.openssh.enable = true;
environment.systemPackages = [ pkgs.git ];
# This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you
# should.
system.stateVersion = "20.03"; # Did you read the comment?
}

View File

@ -0,0 +1,31 @@
{ config, pkgs, lib, ... }:
{
imports = [
<nixpkgs/nixos/modules/profiles/minimal.nix>
<lib>
<lib/lxc-container.nix>
<lib/shared.nix>
];
c3d2 = {
isInHq = false;
hq.interface = "eth0";
enableHail = false;
};
networking.hostName = "scrape";
networking.useNetworkd = true;
# Required for krops
services.openssh.enable = true;
environment.systemPackages = [ pkgs.git ];
# This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you
# should.
system.stateVersion = "20.03"; # Did you read the comment?
}

33
krops.nix Normal file
View File

@ -0,0 +1,33 @@
let
krops = builtins.fetchGit {
url = "https://cgit.krebsco.de/krops/";
};
lib = import "${krops}/lib";
pkgs = import "${krops}/pkgs" {};
hostSource = path:
lib.evalSource [ {
nixpkgs.git = {
ref = "origin/nixos-20.03";
url = "https://github.com/NixOS/nixpkgs-channels.git";
};
nixpkgs-unstable.git = {
ref = "origin/master";
url = "https://github.com/NixOS/nixpkgs.git";
};
nixos-config.file = toString (./hosts + "/${path}/configuration.nix");
lib.file = toString ./lib;
secrets.file = toString ./secrets;
"host-registry.nix".file = toString ./host-registry.nix;
} ];
deployContainer = containerName: host:
pkgs.krops.writeDeploy containerName {
source = hostSource "containers/${containerName}";
target = "root@${host}";
};
in {
x = hostSource "scrape";
scrape = deployContainer "scrape" "172.20.73.28";
ledstripes = deployContainer "ledstripes" "172.22.99.168";
}