tor: fix nginx hidden service
[sourcephile-nix.git] / nixos / defaults / predictable-interface-names.nix
index 23e58af76702ce4d06b31371ae08bdcdd8d4f7ce..4db44c3a7c7b8ae5eab9c76bf6197a7c806208eb 100644 (file)
@@ -4,9 +4,9 @@
 # Tip: names that can be given using ID_NET_NAME_* envvars
 # can be checked before hand with:
 # udevadm test-builtin net_id /sys/class/net/*
-
 { pkgs, lib, config, ... }:
-let udevNetSetupLinkRules = pkgs.writeTextDir "etc/udev/rules.d/79-net-setup-link.rules" ''
+let
+  udevNetSetupLinkRules = pkgs.writeTextDir "etc/udev/rules.d/79-net-setup-link.rules" ''
     SUBSYSTEM!="net", GOTO="net_setup_link_end"
 
     IMPORT{builtin}="path_id"
@@ -29,44 +29,44 @@ let udevNetSetupLinkRules = pkgs.writeTextDir "etc/udev/rules.d/79-net-setup-lin
   '';
 in
 {
-  networking = {
-    # Currently no-op.
-    # false would set boot.kernelParams = [ "net.ifnames=0" ];
-    # to disable NamePolicy= in *.link.
-    usePredictableInterfaceNames = true;
-  };
+networking = {
+  # Currently no-op.
+  # false would set boot.kernelParams = [ "net.ifnames=0" ];
+  # to disable NamePolicy= in *.link.
+  usePredictableInterfaceNames = true;
+};
 
-  boot.initrd = {
-    extraUdevRulesCommands = ''
-      # The name set here in stage-1 by 79-net-setup-link.rules
-      # will stay in stage-2 (at least until the device is removed/added).
-      cp -v ${udevNetSetupLinkRules}/etc/udev/rules.d/79-net-setup-link.rules $out/
-    '';
-  };
+boot.initrd = {
+  extraUdevRulesCommands = ''
+    # The name set here in stage-1 by 79-net-setup-link.rules
+    # will stay in stage-2 (at least until the device is removed/added).
+    cp -v ${udevNetSetupLinkRules}/etc/udev/rules.d/79-net-setup-link.rules $out/
+  '';
+};
 
-  services.udev.packages = [
-    # Only useful here in stage-2 if the device is removed and re-added
-    # (eg. the network module is rmmod-ed then modprobe-d).
-    # The stage-1 (or initrd) is only a pivot_root after all,
-    # it does not reload the kernel, hence passing to stage-2
-    # does not trigger ACTION=="add" for the net devices.
-    udevNetSetupLinkRules
-  ];
+services.udev.packages = [
+  # Only useful here in stage-2 if the device is removed and re-added
+  # (eg. the network module is rmmod-ed then modprobe-d).
+  # The stage-1 (or initrd) is only a pivot_root after all,
+  # it does not reload the kernel, hence passing to stage-2
+  # does not trigger ACTION=="add" for the net devices.
+  udevNetSetupLinkRules
+];
 
-  /* Useless block, only here for explanations.
+/* Useless block, only here for explanations.
 
-  # NixOS put this .link only in the root filesystem, not in the initrd
-  # hence it's only active in stage-2, not stage-1.
-  # And even in stage-2, the 80-net-setup-link.rules has priority.
-  # DOC: https://www.freedesktop.org/software/systemd/man/systemd.link.html
-  environment.etc."systemd/network/79-net-setup.link".text = ''
-    [Match]
-    OriginalName=*
+# NixOS put this .link only in the root filesystem, not in the initrd
+# hence it's only active in stage-2, not stage-1.
+# And even in stage-2, the 80-net-setup-link.rules has priority.
+# DOC: https://www.freedesktop.org/software/systemd/man/systemd.link.html
+environment.etc."systemd/network/79-net-setup.link".text = ''
+  [Match]
+  OriginalName=*
 
-    [Link]
-    #NamePolicy=keep kernel database onboard slot path
-    NamePolicy=mac
-    MACAddressPolicy=persistent
-  '';
-  */
+  [Link]
+  #NamePolicy=keep kernel database onboard slot path
+  NamePolicy=mac
+  MACAddressPolicy=persistent
+'';
+*/
 }