Unverified Commit 2d0fdeb0 authored by Minijackson's avatar Minijackson
Browse files

netbox_3_7: remove

as a transition path,
we already have netbox_4_1 which is EOL
parent f99dcc2d
Loading
Loading
Loading
Loading
+0 −50
Original line number Diff line number Diff line
diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py
index 2de06dd10..00406af48 100644
--- a/netbox/netbox/settings.py
+++ b/netbox/netbox/settings.py
@@ -236,6 +236,7 @@ TASKS_REDIS_DATABASE = TASKS_REDIS.get('DATABASE', 0)
 TASKS_REDIS_SSL = TASKS_REDIS.get('SSL', False)
 TASKS_REDIS_SKIP_TLS_VERIFY = TASKS_REDIS.get('INSECURE_SKIP_TLS_VERIFY', False)
 TASKS_REDIS_CA_CERT_PATH = TASKS_REDIS.get('CA_CERT_PATH', False)
+TASKS_REDIS_URL = TASKS_REDIS.get('URL')
 
 # Caching
 if 'caching' not in REDIS:
@@ -253,11 +254,12 @@ CACHING_REDIS_SENTINEL_SERVICE = REDIS['caching'].get('SENTINEL_SERVICE', 'defau
 CACHING_REDIS_PROTO = 'rediss' if REDIS['caching'].get('SSL', False) else 'redis'
 CACHING_REDIS_SKIP_TLS_VERIFY = REDIS['caching'].get('INSECURE_SKIP_TLS_VERIFY', False)
 CACHING_REDIS_CA_CERT_PATH = REDIS['caching'].get('CA_CERT_PATH', False)
+CACHING_REDIS_URL = REDIS['caching'].get('URL', f'{CACHING_REDIS_PROTO}://{CACHING_REDIS_HOST}:{CACHING_REDIS_PORT}/{CACHING_REDIS_DATABASE}')
 
 CACHES = {
     'default': {
         'BACKEND': 'django_redis.cache.RedisCache',
-        'LOCATION': f'{CACHING_REDIS_PROTO}://{CACHING_REDIS_USERNAME_HOST}:{CACHING_REDIS_PORT}/{CACHING_REDIS_DATABASE}',
+        'LOCATION': CACHING_REDIS_URL,
         'OPTIONS': {
             'CLIENT_CLASS': 'django_redis.client.DefaultClient',
             'PASSWORD': CACHING_REDIS_PASSWORD,
@@ -410,7 +412,7 @@ USE_X_FORWARDED_HOST = True
 X_FRAME_OPTIONS = 'SAMEORIGIN'
 
 # Static files (CSS, JavaScript, Images)
-STATIC_ROOT = BASE_DIR + '/static'
+STATIC_ROOT = getattr(configuration, 'STATIC_ROOT', os.path.join(BASE_DIR, 'static')).rstrip('/')
 STATIC_URL = f'/{BASE_PATH}static/'
 STATICFILES_DIRS = (
     os.path.join(BASE_DIR, 'project-static', 'dist'),
@@ -640,6 +642,14 @@ if TASKS_REDIS_USING_SENTINEL:
             'socket_connect_timeout': TASKS_REDIS_SENTINEL_TIMEOUT
         },
     }
+elif TASKS_REDIS_URL:
+    RQ_PARAMS = {
+        'URL': TASKS_REDIS_URL,
+        'PASSWORD': TASKS_REDIS_PASSWORD,
+        'SSL': TASKS_REDIS_SSL,
+        'SSL_CERT_REQS': None if TASKS_REDIS_SKIP_TLS_VERIFY else 'required',
+        'DEFAULT_TIMEOUT': RQ_DEFAULT_TIMEOUT,
+    }
 else:
     RQ_PARAMS = {
         'HOST': TASKS_REDIS_HOST,
+0 −25
Original line number Diff line number Diff line
{
  lib,
  nixosTests,
  callPackage,
}:
let
  generic = import ./generic.nix;
in
{
  netbox_3_7 = callPackage generic {
    version = "3.7.8";
    hash = "sha256-61pJbMWXNFnvWI0z9yWvsutdCAP4VydeceANNw0nKsk=";
    extraPatches = [
      # Allow setting the STATIC_ROOT from within the configuration and setting a custom redis URL
      ./config.patch
    ];
    tests.netbox = nixosTests.netbox_3_7;

    maintainers = with lib.maintainers; [
      minijackson
      raitobezarius
    ];
    eol = true;
  };
}
+0 −119
Original line number Diff line number Diff line
{
  lib,
  fetchFromGitHub,
  python3,
  version,
  hash,
  plugins ? ps: [ ],
  extraPatches ? [ ],
  tests ? { },
  maintainers ? [ ],
  eol ? false,
}:
let
  extraBuildInputs = plugins python3.pkgs;
in
python3.pkgs.buildPythonApplication rec {
  pname = "netbox";
  inherit version;

  format = "other";

  src = fetchFromGitHub {
    owner = "netbox-community";
    repo = pname;
    rev = "refs/tags/v${version}";
    inherit hash;
  };

  patches = extraPatches;

  propagatedBuildInputs =
    with python3.pkgs;
    [
      bleach
      boto3
      django_4
      django-cors-headers
      django-debug-toolbar
      django-filter
      django-graphiql-debug-toolbar
      django-mptt
      django-pglocks
      django-prometheus
      django-redis
      django-rq
      django-tables2
      django-taggit
      django-timezone-field
      djangorestframework
      drf-spectacular
      drf-spectacular-sidecar
      drf-yasg
      dulwich
      swagger-spec-validator # from drf-yasg[validation]
      feedparser
      graphene-django
      jinja2
      markdown
      markdown-include
      netaddr
      pillow
      psycopg2
      pyyaml
      requests
      sentry-sdk
      social-auth-core
      social-auth-app-django
      svgwrite
      tablib
      jsonschema
    ]
    ++ extraBuildInputs;

  buildInputs = with python3.pkgs; [
    mkdocs-material
    mkdocs-material-extensions
    mkdocstrings
    mkdocstrings-python
  ];

  nativeBuildInputs = [
    python3.pkgs.mkdocs
  ];

  postBuild = ''
    PYTHONPATH=$PYTHONPATH:netbox/
    python -m mkdocs build
  '';

  installPhase = ''
    mkdir -p $out/opt/netbox
    cp -r . $out/opt/netbox
    chmod +x $out/opt/netbox/netbox/manage.py
    makeWrapper $out/opt/netbox/netbox/manage.py $out/bin/netbox \
      --prefix PYTHONPATH : "$PYTHONPATH"
  '';

  passthru = {
    python = python3;
    # PYTHONPATH of all dependencies used by the package
    pythonPath = python3.pkgs.makePythonPath propagatedBuildInputs;
    gunicorn = python3.pkgs.gunicorn;
    inherit tests;
  };

  meta = {
    homepage = "https://github.com/netbox-community/netbox";
    description = "IP address management (IPAM) and data center infrastructure management (DCIM) tool";
    mainProgram = "netbox";
    license = lib.licenses.asl20;
    knownVulnerabilities = (
      lib.optional eol "Netbox version ${version} is EOL; please upgrade by following the current release notes instructions."
    );
    # Warning:
    # Notice the missing `lib` in the inherit: it is using this function argument rather than a `with lib;` argument.
    # If you replace this by `with lib;`, pay attention it does not inherit all maintainers in nixpkgs.
    inherit maintainers;
  };
}
+1 −0
Original line number Diff line number Diff line
@@ -1246,6 +1246,7 @@ mapAliases {
  neocomp = throw "neocomp has been remove because it fails to build and was unmaintained upstream"; # Added 2025-04-28
  netbox_3_3 = throw "netbox 3.3 series has been removed as it was EOL"; # Added 2023-09-02
  netbox_3_5 = throw "netbox 3.5 series has been removed as it was EOL"; # Added 2024-01-22
  netbox_3_7 = throw "netbox 3.7 series has been removed as it was EOL"; # Added 2025-04-23
  nextcloud29 = throw ''
    Nextcloud v29 has been removed from `nixpkgs` as the support for is dropped
    by upstream in 2025-04. Please upgrade to at least Nextcloud v30 by declaring
+0 −2
Original line number Diff line number Diff line
@@ -3867,8 +3867,6 @@ with pkgs;
    hdf5 = hdf5-mpi.override { usev110Api = true; };
  };
  inherit (callPackage ../servers/web-apps/netbox { }) netbox_3_7;
  # Not in aliases because it wouldn't get picked up by callPackage
  netbox = netbox_4_2;