52 lines
1.4 KiB
Nix
52 lines
1.4 KiB
Nix
{ config, pkgs, ... }:
|
|
|
|
{
|
|
boot.blacklistedKernelModules = [
|
|
# no watching TV intended
|
|
"dvb_usb_rtl28xxu"
|
|
];
|
|
users.users.dump1090 = {
|
|
isSystemUser = true;
|
|
group = "dump10190";
|
|
};
|
|
users.groups.dump1090 = {};
|
|
systemd.tmpfiles.rules = [
|
|
"d /tmp/dump1090 0755 dump1090 dump1090 -"
|
|
];
|
|
systemd.services.dump1090 = {
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig = {
|
|
ExecStart = "${pkgs.dump1090_sdrplus}/bin/dump1090 --aggressive --net";
|
|
User = "dump1090";
|
|
Group = "dump1090";
|
|
ProtectSystem = "full";
|
|
ProtectHome = true;
|
|
WorkingDirectory = "/tmp/dump1090";
|
|
WritablePaths = "/tmp/dump1090";
|
|
};
|
|
};
|
|
|
|
|
|
# TODO: `services.collectd.plugins.exec` is already defined by pi-sensors
|
|
# (https://github.com/NixOS/nixpkgs/pull/141551)
|
|
services.collectd.extraConfig =
|
|
let
|
|
distanceRb = pkgs.fetchurl {
|
|
url = "https://github.com/djberg96/gis-distance/raw/main/lib/gis/distance.rb";
|
|
sha256 = "1m9zzikcl5pzad66r8vnlj2p2hbbcqb8vdcf34nrhyd4mg1wkgkh";
|
|
};
|
|
libDir = pkgs.runCommandNoCC "libdir" {} ''
|
|
mkdir $out
|
|
cp ${distanceRb} $out/distance.rb
|
|
'';
|
|
in ''
|
|
<Plugin exec>
|
|
Exec "${config.services.collectd.user}" "${pkgs.ruby}/bin/ruby" "-I${libDir}" "${./collectd-adsb.rb}"
|
|
</Plugin>
|
|
'';
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
dump1090_sdrplus
|
|
];
|
|
}
|