hswaw/machines/customs: check in code.hackerspace.pl/vuko/customs

Change-Id: Ic698cce2ef0060a54b195cf90574696b8be1eb0f
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1162
Reviewed-by: informatic <informatic@hackerspace.pl>
diff --git a/hswaw/machines/customs.hackerspace.pl/ulogd2/service.nix b/hswaw/machines/customs.hackerspace.pl/ulogd2/service.nix
new file mode 100644
index 0000000..e50d92b
--- /dev/null
+++ b/hswaw/machines/customs.hackerspace.pl/ulogd2/service.nix
@@ -0,0 +1,32 @@
+{ pkgs, ... }:
+
+let
+  ulogd2 = import ./default.nix { pkgs = pkgs; };
+  name = "ulogd2";
+  config = pkgs.writeText "ulogd.conf" ''
+    [global]
+    logfile="/var/log/ulogd.log"
+    
+    stack=log1:NFLOG,base1:BASE,pcap1:PCAP
+    
+    [log1]
+    group=2
+    
+    [pcap1]
+    file="/var/log/ulogd.pcap"
+    sync=1
+  '';
+in {
+
+  systemd.services."${name}" = {
+    description = "Logging packet log from nftables";
+    wantedBy    = [ "multi-user.target" ];
+
+    serviceConfig.User = "root";
+    serviceConfig.Type = "simple";
+      
+    path = [ ulogd2 ];
+
+    serviceConfig.ExecStart = "${ulogd2}/bin/ulogd -c ${config}";
+  };
+}