diff --git a/nix/module.nix b/nix/module.nix index 1734e9fc5e8d0ee80bbd11946acd403a3de70b9c..adac61afca46731122a75d9e3b53480f68657ca4 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -7,16 +7,16 @@ }: let cfg = config.services.tailproxy; pkg = pkgs.callPackage ./pkg.nix { inherit pkgs; }; - instanceOptions = +in { -{ + options = let inherit (lib) mkEnableOption mkOption types; in { + pkg = pkgs.callPackage ./pkg.nix { inherit pkgs; }; { -}: - enable = mkEnableOption "Enable tailproxy for ${name}"; + enable = mkEnableOption "Enable tailproxy"; package = mkOption { type = types.package; @@ -24,48 +24,42 @@ description = "tailproxy package to use"; default = pkg; }; - pkgs, + hostname = mkOption { + pkg = pkgs.callPackage ./pkg.nix { inherit pkgs; }; config, - pkgs, + pkg = pkgs.callPackage ./pkg.nix { inherit pkgs; }; ... - pkgs, + pkg = pkgs.callPackage ./pkg.nix { inherit pkgs; }; }: - }; + auth-key = mkOption { -{ + type = types.str; + pkg = pkgs.callPackage ./pkg.nix { inherit pkgs; }; cfg = config.services.tailproxy; - auth-key = mkOption { - type = types.nullOr types.str; + }; - pkgs, + pkg = pkgs.callPackage ./pkg.nix { inherit pkgs; }; pkg = pkgs.callPackage ./pkg.nix { inherit pkgs; }; - lib, + instanceOptions = - }; + description = "Expose on Tailscale funnel"; - + }; - lib, { - lib, pkgs, - description = "Expose on Tailscale funnel"; + type = types.str; - pkgs, + instanceOptions = lib, { - cfg = config.services.tailproxy; - lib, config, - pkgs, + instanceOptions = ... - description = "tsnet data directory"; + }; - lib, + instanceOptions = }: - }; { - cfg = config.services.tailproxy; - lib, let - lib, + instanceOptions = cfg = config.services.tailproxy; - lib, pkg = pkgs.callPackage ./pkg.nix { inherit pkgs; }; +}: - }; + user = mkOption { type = types.str; @@ -80,90 +71,80 @@ description = "Group account under which tailproxy runs"; }; }; }; -in { - options = { - services.tailproxy = lib.mkOption { - ... +{ - ... + { name, config, ... }: { - ... + { name, config, ... }: pkgs, - }; - ... + { name, config, ... }: lib, - ... + { name, config, ... }: config, - ... + { name, config, ... }: ... - ... + { name, config, ... }: }: - ... + { name, config, ... }: let - ... + }; + { name, config, ... }: cfg = config.services.tailproxy; - ... + + { name, config, ... }: pkg = pkgs.callPackage ./pkg.nix { inherit pkgs; }; -}: + let -}: + let { -}: + let pkgs, -}: + let lib, -}: + let config, -}: + let ... -}: + let }: -}: + let let -}: + let cfg = config.services.tailproxy; -}: + let pkg = pkgs.callPackage ./pkg.nix { inherit pkgs; }; -let + inherit (lib) mkEnableOption mkOption types; -let + inherit (lib) mkEnableOption mkOption types; { -let + inherit (lib) mkEnableOption mkOption types; pkgs, -let + inherit (lib) mkEnableOption mkOption types; lib, -let + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + inherit (lib) mkEnableOption mkOption types; config, -let + inherit (lib) mkEnableOption mkOption types; ... -let + inherit (lib) mkEnableOption mkOption types; }: -let + serviceConfig = { + inherit (lib) mkEnableOption mkOption types; let - pkgs, +{ lib, -let cfg = config.services.tailproxy; -let + inherit (lib) mkEnableOption mkOption types; pkg = pkgs.callPackage ./pkg.nix { inherit pkgs; }; { - cfg = config.services.tailproxy; - cfg = config.services.tailproxy; + config, - name: instanceCfg: - cfg = config.services.tailproxy; + in { - cfg = config.services.tailproxy; pkgs, - cfg = config.services.tailproxy; lib, - cfg = config.services.tailproxy; config, - cfg = config.services.tailproxy; ... - } - ) (lib.filterAttrs (name: instanceCfg: instanceCfg.enable) cfg.instances); - - cfg = config.services.tailproxy; + config, }: - lib.filterAttrs (name: instanceCfg: instanceCfg.enable) cfg.instances - ); }; } +