From 95c33dc2430b7bbdfac879930a3250936ef4fdbd Mon Sep 17 00:00:00 2001 From: Astro Date: Sat, 4 Apr 2020 00:56:53 +0200 Subject: [PATCH] containers/ledstripes: deploy ledball --- hosts/containers/ledstripes/configuration.nix | 13 ++++++++++- krops.nix | 1 - lib/pkgs/pile.nix | 23 +++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 lib/pkgs/pile.nix diff --git a/hosts/containers/ledstripes/configuration.nix b/hosts/containers/ledstripes/configuration.nix index e1aa4e58..55d9a129 100644 --- a/hosts/containers/ledstripes/configuration.nix +++ b/hosts/containers/ledstripes/configuration.nix @@ -20,7 +20,18 @@ # Required for krops services.openssh.enable = true; environment.systemPackages = [ pkgs.git ]; - + + systemd.services.ledball = + let + pile = import (toString ) { inherit pkgs; }; + in { + after = [ "network-online.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + ExecStart = "${pile.ledball}/bin/rows"; + Restart = "always"; + }; + }; # This value determines the NixOS release with which your system is to be # compatible, in order to avoid breaking some software such as database diff --git a/krops.nix b/krops.nix index f7bea0ee..3550db39 100644 --- a/krops.nix +++ b/krops.nix @@ -27,7 +27,6 @@ let target = "root@${host}"; }; in { - x = hostSource "scrape"; scrape = deployContainer "scrape" "172.20.73.28"; ledstripes = deployContainer "ledstripes" "172.22.99.168"; } diff --git a/lib/pkgs/pile.nix b/lib/pkgs/pile.nix new file mode 100644 index 00000000..7da6079e --- /dev/null +++ b/lib/pkgs/pile.nix @@ -0,0 +1,23 @@ +{ pkgs ? import {} }: + +with pkgs; +let + pile = builtins.fetchGit "https://github.com/astro/pile.git"; +in { + ledball = rustPlatform.buildRustPackage { + name = "ledball"; + version = "0.0.0"; + src = "${pile}/ledball"; + cargoSha256 = "0zyfbf3gph8gqab07fmm5a7x5slapsqn8ck6isp53fsa7ljnagjy"; + cargoBuildFlags = [ "--examples" ]; + postInstall = '' + mkdir -p $out/bin + + for f in target/*/release/examples/*; do + if [ -f $f ] && [ -x $f ]; then + cp $f $out/bin/ + fi + done + ''; + }; +}