Skip to content

Commit 5a965cb

Browse files
Merge pull request #522 from terlar/fix/usbip-snippetIpAddress-default
usbip: fix default snippetIpAddress command
2 parents eb326ea + 5d68316 commit 5a965cb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/usbip.nix

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ in
2121

2222
snippetIpAddress = lib.mkOption {
2323
type = lib.types.str;
24-
default = "$(ip route list | sed -nE 's/(default)? via (.*) dev eth0 proto kernel/\2/p')";
24+
default = "$(ip route list | sed -nE 's/(default)? via (.*) dev eth0 .*/\\2/p' | head -n1)";
2525
example = "127.0.0.1";
2626
description = ''
2727
This snippet is used to obtain the address of the Windows host where Usbipd is running.
@@ -38,9 +38,14 @@ in
3838
services.udev.enable = true;
3939

4040
systemd = {
41+
targets.usbip = {
42+
description = "USBIP";
43+
};
44+
4145
services."usbip-auto-attach@" = {
4246
description = "Auto attach device having busid %i with usbip";
4347
after = [ "network.target" ];
48+
partOf = [ "usbip.target" ];
4449

4550
scriptArgs = "%i";
4651
path = with pkgs; [

0 commit comments

Comments
 (0)