~aasg/nixexprs

ef110d1cd4cb6308092c7ebb332d2793fd026c5b — Aluísio Augusto Silva Gonçalves 5 months ago 7e3655c
bird-lg: Move local patches to patches/, per policy
6 files changed, 19 insertions(+), 12 deletions(-)

R pkgs/servers/monitoring/bird-lg/config-loader.py => modules/services/networking/monitoring/bird-lg-config.py
M modules/services/networking/monitoring/bird-lg.nix
A patches/bird-lg/default.nix
M patches/manifest.nix
M patches/overlay.nix
M pkgs/servers/monitoring/bird-lg/default.nix
R pkgs/servers/monitoring/bird-lg/config-loader.py => modules/services/networking/monitoring/bird-lg-config.py +0 -0
M modules/services/networking/monitoring/bird-lg.nix => modules/services/networking/monitoring/bird-lg.nix +4 -2
@@ 75,6 75,7 @@ in
      after = [ "bird.service" "bird6.service" "bird2.service" "network-online.target" ];
      wantedBy = [ "multi-user.target" ];
      environment = {
        BIRD_LG_CONFIG = ./bird-lg-config.py;
        BIRD_LG_CONFIG_FILES = concatStringsSep ":" ([
          (settingsFormat.generate "bird-lg-gunicorn.json" cfg.server.gunicornSettings)
          (settingsFormat.generate "bird-lg.json" cfg.server.appSettings)


@@ 82,7 83,7 @@ in
      };
      serviceConfig = {
        Type = "simple";
        ExecStart = "${pkgs.bird-lg}/bin/bird-lg-webservice --config=${pkgs.bird-lg}/config-loader.py";
        ExecStart = "${pkgs.bird-lg}/bin/bird-lg-webservice --config=\${BIRD_LG_CONFIG}";
        Restart = "on-failure";

        DynamicUser = true;


@@ 117,6 118,7 @@ in
      after = [ "bird.service" "bird6.service" "bird2.service" "network-online.target" ];
      wantedBy = [ "multi-user.target" ];
      environment = {
        BIRD_LG_CONFIG = ./bird-lg-config.py;
        BIRD_LG_CONFIG_FILES = concatStringsSep ":" ([
          (settingsFormat.generate "bird-lgproxy-gunicorn.json" cfg.client.gunicornSettings)
          (settingsFormat.generate "bird-lgproxy.json" cfg.client.appSettings)


@@ 124,7 126,7 @@ in
      };
      serviceConfig = {
        Type = "simple";
        ExecStart = "${pkgs.bird-lg}/bin/bird-lg-proxy --config=${pkgs.bird-lg}/config-loader.py";
        ExecStart = "${pkgs.bird-lg}/bin/bird-lg-proxy --config=\${BIRD_LG_CONFIG}";
        Restart = "on-failure";

        DynamicUser = true;

A patches/bird-lg/default.nix => patches/bird-lg/default.nix +12 -0
@@ 0,0 1,12 @@
{ bird-lg }:

bird-lg.overrideAttrs (oldAttrs: {
  postPatch = ''
    # Don't configure a log file; let systemd handle it.
    sed -i '/file_handler/d' lg.py lgproxy.py

    # Replace the builtin config file with one given through an
    # environment variable.
    sed -i '/app\.config\.from_pyfile/c app.config.from_envvar("BIRD_LG_CONFIG")' lg.py lgproxy.py
  '';
})

M patches/manifest.nix => patches/manifest.nix +1 -0
@@ 1,4 1,5 @@
[
  [ "bird-lg" ]
  [ "haunt" ]
  [ "ipfs-cluster" ]
]

M patches/overlay.nix => patches/overlay.nix +2 -0
@@ 2,6 2,8 @@ final: prev:

{

  bird-lg = final.callPackage ./bird-lg { inherit (prev) bird-lg; };

  haunt = final.callPackage ./haunt { inherit (prev) haunt; };

  ipfs-cluster = final.callPackage ./ipfs-cluster { inherit (prev) ipfs-cluster; };

M pkgs/servers/monitoring/bird-lg/default.nix => pkgs/servers/monitoring/bird-lg/default.nix +0 -10
@@ 32,15 32,6 @@ stdenv.mkDerivation rec {
    })
  ];

  postPatch = ''
    # Don't configure a log file; let systemd handle it.
    sed -i '/file_handler/d' lg.py lgproxy.py

    # Replace the builtin config file with one that reads JSON files
    # given through an environment variable.
    sed -i '/app\.config\.from_pyfile/c app.config.from_pyfile("config-loader.py")' lg.py lgproxy.py
  '';

  WRAPPER_PATH = stdenv.lib.makeBinPath runtimeDeps;
  WRAPPER_PYTHONPATH = placeholder "out";



@@ 58,7 49,6 @@ stdenv.mkDerivation rec {
    runHook preInstall
    mkdir -p $out $out/bin
    cp -r * $out
    cp ${./config-loader.py} $out/config-loader.py
    touch $out/__init__.py
    wrapWSGI lg:app $out/bin/bird-lg-webservice
    wrapWSGI lgproxy:app $out/bin/bird-lg-proxy