diff --git a/flake.nix b/flake.nix
index c3a0f3c8..1d662a86 100644
--- a/flake.nix
+++ b/flake.nix
@@ -519,7 +519,6 @@
nncp = nixosSystem' {
modules = [
self.nixosModules.microvm
- self.nixosModules.nncp
./hosts/nncp
];
};
@@ -725,7 +724,6 @@
./modules/baremetal.nix
./modules/c3d2.nix
./modules/disko.nix
- ./modules/nncp.nix
./modules/pi-sensors.nix
./modules/plume.nix
./modules/stats.nix
@@ -747,7 +745,6 @@
microvm.nixosModules.host
./modules/microvm-host.nix
];
- nncp = ./modules/nncp.nix;
rpi-netboot = ./modules/rpi-netboot.nix;
};
diff --git a/modules/nncp.nix b/modules/nncp.nix
deleted file mode 100644
index d0af1d2e..00000000
--- a/modules/nncp.nix
+++ /dev/null
@@ -1,133 +0,0 @@
-{ config, lib, ... }:
-
-let
- nncpCfgFile = "/run/nncp.hjson";
- programCfg = lib.optionalAttrs (config.programs ? nncp) config.programs.nncp;
- callerCfg = config.services.nncp.caller;
- daemonCfg = config.services.nncp.daemon;
- pkg = programCfg.package;
-in
-{
- options = {
-
- services.nncp = {
- caller = {
- enable = lib.mkEnableOption ''
- croned NNCP TCP daemon caller.
- The daemon will take configuration from
-
- '';
- extraArgs = lib.mkOption {
- type = with lib.types; listOf str;
- description = "Extra command-line arguments to pass to caller.";
- default = [ ];
- example = [ "-autotoss" ];
- };
- };
-
- daemon = {
- enable = lib.mkEnableOption ''
- NNCP TCP synronization daemon.
- The daemon will take configuration from
-
- '';
-
- socketActivation = {
- enable = lib.mkEnableOption ''
- Whether to run nncp-daemon persistently or socket-activated.
- '';
- listenStreams = lib.mkOption {
- type = with lib.types; listOf str;
- description = ''
- TCP sockets to bind to.
- See .
- '';
- default = [ "5400" ];
- };
- };
-
- extraArgs = lib.mkOption {
- type = with lib.types; listOf str;
- description = "Extra command-line arguments to pass to daemon.";
- default = [ ];
- example = [ "-autotoss" ];
- };
- };
-
- };
- };
-
- config = lib.mkIf (programCfg.enable or callerCfg.enable or daemonCfg.enable) {
- assertions = [{
- assertion =
- let
- callerCongfigured =
- let neigh = config.programs.nncp.settings.neigh or { };
- in lib.lists.any (x: lib.hasAttr "calls" x && x.calls != [ ])
- (lib.attrValues neigh);
- in
- !callerCfg.enable || callerCongfigured;
- message = "NNCP caller enabled but call configuration is missing";
- }];
-
- systemd.services = {
- "nncp-caller" = {
- inherit (callerCfg) enable;
- description = "Croned NNCP TCP daemon caller.";
- documentation = [ "http://www.nncpgo.org/nncp_002dcaller.html" ];
- after = [ "network.target" ];
- wantedBy = [ "multi-user.target" ];
- serviceConfig = {
- ExecStart = ''
- ${pkg}/bin/nncp-caller -noprogress -cfg "${nncpCfgFile}" ${
- lib.strings.escapeShellArgs callerCfg.extraArgs
- }'';
- Group = "uucp";
- UMask = "0002";
- };
- };
-
- "nncp-daemon" = lib.mkIf daemonCfg.enable {
- enable = !daemonCfg.socketActivation.enable;
- description = "NNCP TCP syncronization daemon.";
- documentation = [ "http://www.nncpgo.org/nncp_002ddaemon.html" ];
- after = [ "network.target" ];
- wantedBy = [ "multi-user.target" ];
- serviceConfig = {
- ExecStart = ''
- ${pkg}/bin/nncp-daemon -noprogress -cfg "${nncpCfgFile}" ${
- lib.strings.escapeShellArgs daemonCfg.extraArgs
- }'';
- Restart = "on-failure";
- Group = "uucp";
- UMask = "0002";
- };
- };
-
- "nncp-daemon@" = lib.mkIf daemonCfg.socketActivation.enable {
- description = "NNCP TCP syncronization daemon.";
- documentation = [ "http://www.nncpgo.org/nncp_002ddaemon.html" ];
- after = [ "network.target" ];
- serviceConfig = {
- ExecStart = ''
- ${pkg}/bin/nncp-daemon -noprogress -ucspi -cfg "${nncpCfgFile}" ${
- lib.strings.escapeShellArgs daemonCfg.extraArgs
- }'';
- Group = "uucp";
- UMask = "0002";
- StandardInput = "socket";
- StandardOutput = "inherit";
- StandardError = "journal";
- };
- };
- };
-
- systemd.sockets.nncp-daemon = lib.mkIf daemonCfg.socketActivation.enable {
- inherit (daemonCfg.socketActivation) listenStreams;
- description = "socket for NNCP TCP syncronization.";
- conflicts = [ "nncp-daemon.service" ];
- wantedBy = [ "sockets.target" ];
- socketConfig.Accept = true;
- };
- };
-}