diff options
author | Alan Pearce | 2024-07-28 11:40:14 +0200 |
---|---|---|
committer | Alan Pearce | 2024-07-28 11:40:14 +0200 |
commit | 28d9936cec38475f6766cf07dd0b8a9d279e7632 (patch) | |
tree | 715c267c0bb75199fb98c8ca541bc514faf0aa2d | |
parent | b8ac79d7ead214f96cc8b642fa7ce085a2ee2043 (diff) | |
download | nix-packages-28d9936cec38475f6766cf07dd0b8a9d279e7632.tar.lz nix-packages-28d9936cec38475f6766cf07dd0b8a9d279e7632.tar.zst nix-packages-28d9936cec38475f6766cf07dd0b8a9d279e7632.zip |
Remove goatcounter module/package (available upstream)
-rw-r--r-- | default.nix | 1 | ||||
-rw-r--r-- | modules/nixos/default.nix | 1 | ||||
-rw-r--r-- | modules/nixos/goatcounter.nix | 147 | ||||
-rw-r--r-- | pkgs/goatcounter/default.nix | 39 |
4 files changed, 0 insertions, 188 deletions
diff --git a/default.nix b/default.nix index 920e0c8..08f0eff 100644 --- a/default.nix +++ b/default.nix @@ -20,7 +20,6 @@ inherit (pkgs.darwin.apple_sdk.frameworks) Cocoa; }; emacs-unlimited-select = pkgs.callPackage ./pkgs/emacs-unlimited-select { }; - goatcounter = pkgs.callPackage ./pkgs/goatcounter { }; porto = pkgs.callPackage ./pkgs/porto { }; vanity-imports = pkgs.callPackage ./pkgs/vanity-imports { }; } diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index fb2eb61..1901177 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -3,5 +3,4 @@ # # my-module = ./my-module; laminar = ./laminar.nix; - goatcounter = ./goatcounter.nix; } diff --git a/modules/nixos/goatcounter.nix b/modules/nixos/goatcounter.nix deleted file mode 100644 index 2ba0e31..0000000 --- a/modules/nixos/goatcounter.nix +++ /dev/null @@ -1,147 +0,0 @@ -{ config -, lib -, pkgs -, ... -}: -let - cfg = config.services.goatcounter; - - inherit (lib) - optionalAttrs - mkEnableOption - mkPackageOption - mkOption - mkIf - types; - - encodeParams = params: lib.concatStringsSep "&" (lib.mapAttrsToList (n: v: "${n}=${v}") params); - encoder = { - bool = n: v: lib.optionalString v "-${n}"; - int = n: v: "-${n} ${toString v}"; - list = n: v: "-${n} ${lib.concatStringsSep "," v}"; - string = n: v: "-${n} ${v}"; - }; - mkArgs = args: lib.concatStringsSep " " (lib.mapAttrsToList (n: v: (encoder.${builtins.typeOf v} n v)) args); -in -{ - options.services.goatcounter = { - enable = mkEnableOption "Easy web analytics. No tracking of personal data."; - - user = mkOption { - type = types.str; - default = "goatcounter"; - description = "User account under which goatcounter runs."; - }; - - group = mkOption { - type = types.str; - default = "goatcounter"; - description = "Group under which goatcounter runs."; - }; - - package = mkPackageOption pkgs "goatcounter" { }; - - homeDir = mkOption { - type = types.path; - default = "/var/lib/goatcounter"; - description = "Home directory for goatcounter user."; - }; - - database = mkOption { - default = { - type = "sqlite"; - file = "db/goatcounter.sqlite3"; - }; - - type = types.submodule { - options = { - type = mkOption { - type = types.enum [ "sqlite" "postgresql" ]; - default = "sqlite"; - description = "Database engine to use."; - }; - - file = mkOption { - type = with types; nullOr str; - default = null; - description = "(sqlite) database file to use."; - }; - - params = mkOption { - type = with types; attrsOf str; - default = { }; - description = "Database connection parameters. See `goatcounter help db`"; - }; - }; - }; - }; - - listenAddress = mkOption { - type = types.str; - default = "*"; - description = "Start the server on the specified address."; - }; - - port = mkOption { - type = types.port; - default = 8581; - description = "Port for goatcounter to listen on."; - }; - - - settings = mkOption { - type = types.submodule rec { - freeformType = types.anything; - - options = { - tls = - let - values = (types.enum [ "http" "proxy" "tls" "rdr" "acme" ]); - in - mkOption { - type = with types; either str (nonEmptyListOf values); - default = [ "acme" "rdr" ]; - description = "Whether and how to handle TLS connections. See `goatcounter help listen`"; - }; - }; - }; - }; - }; - - config = mkIf cfg.enable { - services.goatcounter.settings = { - listen = lib.mkDefault "${cfg.listenAddress}:${toString cfg.port}"; - db = lib.mkDefault "${cfg.database.type}+${cfg.database.file}?${encodeParams cfg.database.params}"; - }; - - systemd.services.goatcounter = { - description = "Goatcounter web analytics"; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - ExecStart = "${cfg.package}/bin/goatcounter serve ${mkArgs cfg.settings}"; - User = cfg.user; - Group = cfg.group; - WorkingDirectory = cfg.homeDir; - ReadWritePaths = [ cfg.homeDir ]; - } // optionalAttrs (cfg.port < 1024) { - AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" ]; - CapabilityBoundingSet = [ "CAP_NET_BIND_SERVICE" ]; - }; - }; - - users.users = optionalAttrs (cfg.user == "goatcounter") { - goatcounter = { - inherit (cfg) group; - home = cfg.homeDir; - createHome = true; - isSystemUser = true; - }; - }; - - users.groups = optionalAttrs (cfg.group == "goatcounter") { - goatcounter = { }; - }; - - environment.systemPackages = [ cfg.package ]; - }; -} diff --git a/pkgs/goatcounter/default.nix b/pkgs/goatcounter/default.nix deleted file mode 100644 index 2dcd1e3..0000000 --- a/pkgs/goatcounter/default.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ lib -, buildGoModule -, fetchFromGitHub - -, withSQLite ? true -}: - -buildGoModule rec { - pname = "goatcounter"; - version = "2.5.0"; - - src = fetchFromGitHub { - owner = "arp242"; - repo = "goatcounter"; - rev = "v${version}"; - sha256 = "sha256-lwiLk/YYxX4QwSDjpU/mAikumGXYMzleRzmPjZGruZU="; - }; - - CGO_ENABLED = if withSQLite then 1 else 0; - subPackages = [ "cmd/goatcounter" ]; - - ldflags = [ "-X=zgo.at/goatcounter/v2.Version=${version}" ]; - - doCheck = false; - - vendorHash = "sha256-YAb3uBWQc6hWzF1Z5cAg8RzJQSJV+6dkppfczKS832s="; - - meta = with lib; { - description = "Easy web analytics. No tracking of personal data."; - homepage = "https://www.goatcounter.com/"; - license = { - spdxId = "LicenseRef-Goatcounter-EUPL-Modified"; - fullName = "European Union Public License (EUPL) 1.2 (modified)"; - url = "https://github.com/arp242/goatcounter/blob/master/LICENSE"; - free = true; - }; - platforms = platforms.unix; - }; -} |