diff --git a/host-registry.nix b/host-registry.nix index 5f15e4f3..387091e9 100644 --- a/host-registry.nix +++ b/host-registry.nix @@ -5,6 +5,8 @@ rec { adc = { }; grafana.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPFB9fo01jzr2upEBEXiR7sSmeQoq9ll5Cf5/hjq5e4Y"; + scrape = {}; + ledstripes = {}; glotzbert.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHPrkD07abpTU/66fEjmiMYsUfJCSF62MVFe8BED7wu4"; diff --git a/hosts/containers/ledstripes/configuration.nix b/hosts/containers/ledstripes/configuration.nix new file mode 100644 index 00000000..e1aa4e58 --- /dev/null +++ b/hosts/containers/ledstripes/configuration.nix @@ -0,0 +1,30 @@ +{ config, pkgs, lib, ... }: + +{ + imports = [ + + + + + ]; + + 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? +} diff --git a/hosts/containers/scrape/configuration.nix b/hosts/containers/scrape/configuration.nix new file mode 100644 index 00000000..1dff75d8 --- /dev/null +++ b/hosts/containers/scrape/configuration.nix @@ -0,0 +1,31 @@ +{ config, pkgs, lib, ... }: + +{ + imports = [ + + + + + ]; + + 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? +} diff --git a/krops.nix b/krops.nix new file mode 100644 index 00000000..f7bea0ee --- /dev/null +++ b/krops.nix @@ -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"; +}