about summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/activation/activation-script.nix33
-rw-r--r--nixos/modules/system/boot/networkd.nix28
2 files changed, 28 insertions, 33 deletions
diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix
index 495d77dfd497..ddfd1af4a319 100644
--- a/nixos/modules/system/activation/activation-script.nix
+++ b/nixos/modules/system/activation/activation-script.nix
@@ -162,16 +162,6 @@ in
         <literal>/usr/bin/env</literal>.
       '';
     };
-
-    environment.ld-linux = mkOption {
-      default = false;
-      type = types.bool;
-      visible = false;
-      description = ''
-        Install symlink to ld-linux(8) system-wide to allow running unmodified ELF binaries.
-        It might be useful to run games or executables distributed inside jar files.
-      '';
-    };
   };
 
 
@@ -205,30 +195,9 @@ in
       ''
       else ''
         rm -f /usr/bin/env
-        rmdir -p /usr/bin || true
+        rmdir --ignore-fail-on-non-empty /usr/bin /usr
       '';
 
-    system.activationScripts.ld-linux =
-      concatStrings (
-        mapAttrsToList
-          (target: source:
-            if config.environment.ld-linux then ''
-              mkdir -m 0755 -p $(dirname ${target})
-              ln -sfn ${escapeShellArg source} ${target}.tmp
-              mv -f ${target}.tmp ${target} # atomically replace
-            '' else ''
-              rm -f ${target}
-              rmdir $(dirname ${target}) || true
-            '')
-          {
-            "i686-linux"   ."/lib/ld-linux.so.2"          = "${pkgs.glibc.out}/lib/ld-linux.so.2";
-            "x86_64-linux" ."/lib/ld-linux.so.2"          = "${pkgs.pkgsi686Linux.glibc.out}/lib/ld-linux.so.2";
-            "x86_64-linux" ."/lib64/ld-linux-x86-64.so.2" = "${pkgs.glibc.out}/lib64/ld-linux-x86-64.so.2";
-            "aarch64-linux"."/lib/ld-linux-aarch64.so.1"  = "${pkgs.glibc.out}/lib/ld-linux-aarch64.so.1";
-            "armv7l-linux" ."/lib/ld-linux-armhf.so.3"    = "${pkgs.glibc.out}/lib/ld-linux-armhf.so.3";
-          }.${pkgs.stdenv.system} or {}
-      );
-
     system.activationScripts.specialfs =
       ''
         specialMount() {
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix
index 56a9d6b11380..a77dbc609f46 100644
--- a/nixos/modules/system/boot/networkd.nix
+++ b/nixos/modules/system/boot/networkd.nix
@@ -55,6 +55,11 @@ let
     (assertMacAddress "MACAddress")
   ];
 
+  checkVRF = checkUnitConfig "VRF" [
+    (assertOnlyFields [ "Table" ])
+    (assertMinimum "Table" 0)
+  ];
+
   # NOTE The PrivateKey directive is missing on purpose here, please
   # do not add it to this list. The nix store is world-readable let's
   # refrain ourselves from providing a footgun.
@@ -349,6 +354,21 @@ let
       '';
     };
 
+    vrfConfig = mkOption {
+      default = {};
+      example = { Table = 2342; };
+      type = types.addCheck (types.attrsOf unitOption) checkVRF;
+      description = ''
+        Each attribute in this set specifies an option in the
+        <literal>[VRF]</literal> section of the unit. See
+        <citerefentry><refentrytitle>systemd.netdev</refentrytitle>
+        <manvolnum>5</manvolnum></citerefentry> for details.
+        A detailed explanation about how VRFs work can be found in the
+        <link xlink:href="https://www.kernel.org/doc/Documentation/networking/vrf.txt">kernel
+        docs</link>.
+      '';
+    };
+
     wireguardConfig = mkOption {
       default = {};
       example = {
@@ -845,6 +865,11 @@ let
             ${attrsToSection def.xfrmConfig}
 
           ''}
+          ${optionalString (def.vrfConfig != { }) ''
+            [VRF]
+            ${attrsToSection def.vrfConfig}
+
+          ''}
           ${optionalString (def.wireguardConfig != { }) ''
             [WireGuard]
             ${attrsToSection def.wireguardConfig}
@@ -947,9 +972,10 @@ in
     systemd.network.units = mkOption {
       description = "Definition of networkd units.";
       default = {};
+      internal = true;
       type = with types; attrsOf (submodule (
         { name, config, ... }:
-        { options = concreteUnitOptions;
+        { options = mapAttrs (_: x: x // { internal = true; }) concreteUnitOptions;
           config = {
             unit = mkDefault (makeUnit name config);
           };