nix

configuration files that power my machines
Log | Files | Refs | README | LICENSE

haravara.nix (523B)


      1 {lib, ...}: {
      2   _module.args.haravara = {
      3     authLabelOption = lib.mkOption {
      4       type = lib.types.nullOr lib.types.str;
      5       default = null;
      6       description = "Caddy auth snippet label to import (null = no auth)";
      7     };
      8 
      9     mkAuthImport = authLabel:
     10       lib.optionalString (authLabel != null) "import ${
     11         if authLabel == "default"
     12         then "auth"
     13         else "auth_${authLabel}"
     14       }";
     15 
     16     stripSubdomain = domain:
     17       lib.concatStringsSep "." (lib.drop 1 (lib.splitString "." domain));
     18   };
     19 }