sanoid: keep monthly snapshots (and hopefully bookmarks)
[sourcephile-nix.git] / nixos / modules / services / networking / upnpc.nix
index 9e5c92b822bf9368b5fda7a60ed675af63326907..e6d4919450e19a044b9a3fdb59044194d309d6b3 100644 (file)
@@ -1,7 +1,7 @@
 { pkgs, lib, config, ... }:
 with lib;
 let
-  inherit (config.users) users;
+  inherit (config.users) users groups;
   cfg = config.services.upnpc;
   getInfo = ''
     while IFS=: read -r k v; do
@@ -86,7 +86,8 @@ config = {
                   (*ConflictInMappingEntry*) result=conflict ;;
                 esac
               done <<EOF
-            $(upnpc -u "$desc" -e "${r.description}" -a "$localIP" ${toString r.internalPort} ${toString r.externalPort} ${r.protocol} ${toString r.duration} 2>&1)
+            $(upnpc -u "$desc" ${optionalString (r.description != "") "-e \"${r.description}\""} \
+              -a "$localIP" ${toString r.internalPort} ${toString r.externalPort} ${r.protocol} ${toString r.duration} 2>&1)
             EOF
             }
             while true; do
@@ -116,7 +117,11 @@ config = {
     ) cfg.redirections);
 
   # This enables to match on the uid in the firewall.
-  users.users."upnpc".isSystemUser = true;
+  users.users."upnpc" = {
+    isSystemUser = true;
+    group = groups."upnpc".name;
+  };
+  users.groups."upnpc" = {};
 };
 meta.maintainers = with maintainers; [ julm ];
 }