liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

default.nix (731B)


      1 {
      2   config,
      3   lib,
      4   pkgs,
      5   ...
      6 }:
      7 let
      8   inherit (lib) mkOption types;
      9   inherit (pkgs.pseudofile) dir symlink;
     10 in
     11 {
     12   options = {
     13     early = with types; {
     14       sysctl = mkOption {
     15         type = attrsOf anything;
     16         description = "sysctl definitions to set at early boot";
     17         example = {
     18           vm.overcommit_memory = 0;
     19           user.max_cgroup_namespaces = 62933;
     20           net.ipv6.route.gc_timeout = 60;
     21         };
     22       };
     23     };
     24   };
     25   config.filesystem = dir {
     26     etc =
     27       let
     28         sysctls = pkgs.writeAshScript "sysctls" { } ''
     29           cd /proc/sys
     30           ${pkgs.liminix.writeSysctls config.early.sysctl}
     31         '';
     32       in
     33       dir {
     34         "sysctl.sh" = symlink sysctls;
     35       };
     36   };
     37 }