From 1611394719fccb25163f1934d3ba93fb6cbcece7 Mon Sep 17 00:00:00 2001 From: Yureka Date: Wed, 12 Jul 2023 18:30:55 +0200 Subject: [PATCH 1/4] peering-manager: add meta section --- pkgs/servers/web-apps/peering-manager/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/servers/web-apps/peering-manager/default.nix b/pkgs/servers/web-apps/peering-manager/default.nix index 8b6e77ec0f1f..eb07edabf4de 100644 --- a/pkgs/servers/web-apps/peering-manager/default.nix +++ b/pkgs/servers/web-apps/peering-manager/default.nix @@ -2,6 +2,7 @@ , fetchFromGitHub , fetchpatch , nixosTests +, lib , plugins ? ps: [] }: @@ -93,4 +94,12 @@ in py.pkgs.buildPythonApplication rec { inherit (nixosTests) peering-manager; }; }; + + meta = with lib; { + homepage = "https://peering-manager.net/"; + license = licenses.asl20; + description = "BGP sessions management tool"; + maintainers = with maintainers; [ yuka ]; + platforms = platforms.linux; + }; } From 041e9a8e7a0087da7f357967f39eaff230a17c61 Mon Sep 17 00:00:00 2001 From: Yureka Date: Wed, 12 Jul 2023 18:35:48 +0200 Subject: [PATCH 2/4] nixos/peering-manager: add meta section --- nixos/modules/services/web-apps/peering-manager.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos/modules/services/web-apps/peering-manager.nix b/nixos/modules/services/web-apps/peering-manager.nix index 666b82621268..c5c080cb1ed0 100644 --- a/nixos/modules/services/web-apps/peering-manager.nix +++ b/nixos/modules/services/web-apps/peering-manager.nix @@ -262,4 +262,6 @@ in { users.groups.peering-manager = {}; users.groups."${config.services.redis.servers.peering-manager.user}".members = [ "peering-manager" ]; }; + + meta.maintainers = with lib.maintainers; [ yuka ]; } From 593423154249c41cf725b3ebfea3e21abdcc4620 Mon Sep 17 00:00:00 2001 From: Yureka Date: Wed, 12 Jul 2023 18:37:49 +0200 Subject: [PATCH 3/4] nixos/peering-manager: remove global 'with lib;' --- .../services/web-apps/peering-manager.nix | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/nixos/modules/services/web-apps/peering-manager.nix b/nixos/modules/services/web-apps/peering-manager.nix index c5c080cb1ed0..641a3644614f 100644 --- a/nixos/modules/services/web-apps/peering-manager.nix +++ b/nixos/modules/services/web-apps/peering-manager.nix @@ -1,7 +1,5 @@ { config, lib, pkgs, buildEnv, ... }: -with lib; - let cfg = config.services.peering-manager; configFile = pkgs.writeTextFile { @@ -41,24 +39,24 @@ let pkg = (pkgs.peering-manager.overrideAttrs (old: { postInstall = '' ln -s ${configFile} $out/opt/peering-manager/peering_manager/configuration.py - '' + optionalString cfg.enableLdap '' + '' + lib.optionalString cfg.enableLdap '' ln -s ${cfg.ldapConfigPath} $out/opt/peering-manager/peering_manager/ldap_config.py ''; })).override { inherit (cfg) plugins; }; - peeringManagerManageScript = with pkgs; (writeScriptBin "peering-manager-manage" '' - #!${stdenv.shell} + peeringManagerManageScript = pkgs.writeScriptBin "peering-manager-manage" '' + #!${pkgs.stdenv.shell} export PYTHONPATH=${pkg.pythonPath} sudo -u peering-manager ${pkg}/bin/peering-manager "$@" - ''); + ''; in { - options.services.peering-manager = { + options.services.peering-manager = with lib; { enable = mkOption { - type = lib.types.bool; + type = types.bool; default = false; - description = lib.mdDoc '' + description = mdDoc '' Enable Peering Manager. This module requires a reverse proxy that serves `/static` separately. @@ -69,7 +67,7 @@ in { listenAddress = mkOption { type = types.str; default = "[::1]"; - description = lib.mdDoc '' + description = mdDoc '' Address the server will listen on. ''; }; @@ -77,7 +75,7 @@ in { port = mkOption { type = types.port; default = 8001; - description = lib.mdDoc '' + description = mdDoc '' Port the server will listen on. ''; }; @@ -88,14 +86,14 @@ in { defaultText = literalExpression '' python3Packages: with python3Packages; []; ''; - description = lib.mdDoc '' + description = mdDoc '' List of plugin packages to install. ''; }; secretKeyFile = mkOption { type = types.path; - description = lib.mdDoc '' + description = mdDoc '' Path to a file containing the secret key. ''; }; @@ -103,7 +101,7 @@ in { peeringdbApiKeyFile = mkOption { type = with types; nullOr path; default = null; - description = lib.mdDoc '' + description = mdDoc '' Path to a file containing the PeeringDB API key. ''; }; @@ -111,7 +109,7 @@ in { extraConfig = mkOption { type = types.lines; default = ""; - description = lib.mdDoc '' + description = mdDoc '' Additional lines of configuration appended to the `configuration.py`. See the [documentation](https://peering-manager.readthedocs.io/en/stable/configuration/optional-settings/) for more possible options. ''; @@ -120,7 +118,7 @@ in { enableLdap = mkOption { type = types.bool; default = false; - description = lib.mdDoc '' + description = mdDoc '' Enable LDAP-Authentication for Peering Manager. This requires a configuration file being pass through `ldapConfigPath`. @@ -129,15 +127,15 @@ in { ldapConfigPath = mkOption { type = types.path; - description = lib.mdDoc '' + description = mdDoc '' Path to the Configuration-File for LDAP-Authentication, will be loaded as `ldap_config.py`. See the [documentation](https://peering-manager.readthedocs.io/en/stable/setup/6-ldap/#configuration) for possible options. ''; }; }; - config = mkIf cfg.enable { - services.peering-manager.plugins = mkIf cfg.enableLdap (ps: [ ps.django-auth-ldap ]); + config = lib.mkIf cfg.enable { + services.peering-manager.plugins = lib.mkIf cfg.enableLdap (ps: [ ps.django-auth-ldap ]); system.build.peeringManagerPkg = pkg; From cc59ede27254be108512895b601777c376cba791 Mon Sep 17 00:00:00 2001 From: Yureka Date: Wed, 12 Jul 2023 19:05:41 +0200 Subject: [PATCH 4/4] nixos/tests/peering-manager: fix 'nodes.machine.config' eval warning --- nixos/tests/web-apps/peering-manager.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/tests/web-apps/peering-manager.nix b/nixos/tests/web-apps/peering-manager.nix index 56b7eebfadff..3f0acd560d13 100644 --- a/nixos/tests/web-apps/peering-manager.nix +++ b/nixos/tests/web-apps/peering-manager.nix @@ -34,7 +34,7 @@ import ../make-test-python.nix ({ lib, pkgs, ... }: { "sudo -u postgres psql -c 'ALTER USER \"peering-manager\" WITH SUPERUSER;'" ) machine.succeed( - "cd ${nodes.machine.config.system.build.peeringManagerPkg}/opt/peering-manager ; peering-manager-manage test --no-input" + "cd ${nodes.machine.system.build.peeringManagerPkg}/opt/peering-manager ; peering-manager-manage test --no-input" ) ''; })