about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/by-name/na/nanopb/generator-out.nix59
-rw-r--r--pkgs/by-name/na/nanopb/generator.nix27
-rw-r--r--pkgs/by-name/na/nanopb/package.nix122
-rw-r--r--pkgs/by-name/na/nanopb/python-module.nix16
-rw-r--r--pkgs/by-name/na/nanopb/runtime.nix69
-rw-r--r--pkgs/by-name/na/nanopb/test-message-with-annotations/default.nix (renamed from pkgs/development/libraries/nanopb/test-message-with-annotations/default.nix)6
-rw-r--r--pkgs/by-name/na/nanopb/test-message-with-annotations/withannotations.proto (renamed from pkgs/development/libraries/nanopb/test-message-with-annotations/withannotations.proto)0
-rw-r--r--pkgs/by-name/na/nanopb/test-message-with-options/default.nix (renamed from pkgs/development/libraries/nanopb/test-message-with-options/default.nix)6
-rw-r--r--pkgs/by-name/na/nanopb/test-message-with-options/withoptions.options (renamed from pkgs/development/libraries/nanopb/test-message-with-options/withoptions.options)0
-rw-r--r--pkgs/by-name/na/nanopb/test-message-with-options/withoptions.proto (renamed from pkgs/development/libraries/nanopb/test-message-with-options/withoptions.proto)0
-rw-r--r--pkgs/by-name/na/nanopb/test-simple-proto2/default.nix (renamed from pkgs/development/libraries/nanopb/test-simple-proto2/default.nix)6
-rw-r--r--pkgs/by-name/na/nanopb/test-simple-proto2/simple.proto (renamed from pkgs/development/libraries/nanopb/test-simple-proto2/simple.proto)0
-rw-r--r--pkgs/by-name/na/nanopb/test-simple-proto3/default.nix (renamed from pkgs/development/libraries/nanopb/test-simple-proto3/default.nix)7
-rw-r--r--pkgs/by-name/na/nanopb/test-simple-proto3/simple.proto (renamed from pkgs/development/libraries/nanopb/test-simple-proto3/simple.proto)0
-rw-r--r--pkgs/development/libraries/nanopb/default.nix76
-rw-r--r--pkgs/top-level/all-packages.nix3
16 files changed, 311 insertions, 86 deletions
diff --git a/pkgs/by-name/na/nanopb/generator-out.nix b/pkgs/by-name/na/nanopb/generator-out.nix
new file mode 100644
index 0000000000000..a9e179d902988
--- /dev/null
+++ b/pkgs/by-name/na/nanopb/generator-out.nix
@@ -0,0 +1,59 @@
+{ stdenv
+, cmake
+, python3
+, writeTextFile
+, protobuf
+, src
+, version
+}:
+let
+  pyproject_toml = writeTextFile {
+    name = "pyproject.toml";
+    text = ''
+      [build-system]
+      requires = ["setuptools"]
+      build-backend = "setuptools.build_meta"
+
+      [tool.setuptools]
+      include-package-data = true
+
+      [tool.setuptools.packages.find]
+      where = ["src"]
+
+      [tool.setuptools.package-data]
+      "*" = ["nanopb.proto"]
+
+      [project]
+      name = "nanopb"
+      version = "${version}"
+      dependencies = [
+        "setuptools",
+        "protobuf",
+        "six"
+      ]
+    '';
+  };
+in
+stdenv.mkDerivation {
+  pname = "nanopb-generator-out";
+  inherit src version;
+
+  nativeBuildInputs = [ cmake protobuf python3 ];
+
+  cmakeFlags = [
+    "-Dnanopb_BUILD_RUNTIME=OFF"
+    "-Dnanopb_BUILD_GENERATOR=ON"
+    "-Dnanopb_PYTHON_INSTDIR_OVERRIDE=$out/lib/python/site-packages"
+  ];
+
+  preConfigure = ''
+    cmakeFlags+=" -Dnanopb_PYTHON_INSTDIR_OVERRIDE=$out/lib/python/site-packages"
+  '';
+
+  postInstall = ''
+    rm -rf $out/include
+    rm -rf $out/lib/cmake
+    ln -s $out/lib/python/site-packages $out/src
+    ln -s ${pyproject_toml} $out/pyproject.toml
+  '';
+}
diff --git a/pkgs/by-name/na/nanopb/generator.nix b/pkgs/by-name/na/nanopb/generator.nix
new file mode 100644
index 0000000000000..15d4e0605b80e
--- /dev/null
+++ b/pkgs/by-name/na/nanopb/generator.nix
@@ -0,0 +1,27 @@
+{ python3
+, stdenvNoCC
+, protobuf
+, version
+, generator-out
+}:
+stdenvNoCC.mkDerivation {
+  pname = "nanopb-generator";
+  inherit version;
+
+  dontUnpack = true;
+
+  nativeBuildInputs = [ python3.pkgs.wrapPython ];
+
+  propagatedBuildInputs = [
+    protobuf
+    python3.pkgs.nanopb-proto
+  ];
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp ${generator-out}/bin/protoc-gen-nanopb $out/bin/
+    cp ${generator-out}/bin/nanopb_generator $out/bin/
+    wrapPythonPrograms
+    cp ${generator-out}/bin/nanopb_generator.py $out/bin/
+  '';
+}
diff --git a/pkgs/by-name/na/nanopb/package.nix b/pkgs/by-name/na/nanopb/package.nix
new file mode 100644
index 0000000000000..bd14e9d8c75bb
--- /dev/null
+++ b/pkgs/by-name/na/nanopb/package.nix
@@ -0,0 +1,122 @@
+{ stdenvNoCC
+, callPackage
+, fetchFromGitHub
+, buildPackages
+, lib
+, enableMalloc ? false
+, noPackedStructs ? false
+, maxRequiredFields ? null
+, field32bit ? false
+, noErrmsg ? false
+, bufferOnly ? false
+, systemHeader ? null
+, without64bit ? false
+, encodeArraysUnpacked ? false
+, convertDoubleFloat ? false
+, validateUtf8 ? false
+, littleEndian8bit ? false
+, c99StaticAssert ? false
+, noStaticAssert ? false
+}:
+stdenvNoCC.mkDerivation (self:
+let
+  generator-out = buildPackages.callPackage ./generator-out.nix { inherit (self) src version; };
+  python-module = buildPackages.callPackage ./python-module.nix {
+    inherit (self) version;
+    inherit (self.passthru) generator-out;
+  };
+  python3 = buildPackages.python3.override {
+    packageOverrides = _: _: {
+      nanopb-proto = self.passthru.python-module;
+    };
+  };
+  generator = buildPackages.callPackage ./generator.nix {
+    inherit python3;
+    inherit (self) version;
+    inherit (self.passthru) generator-out;
+  };
+  runtime = callPackage ./runtime.nix {
+    inherit python3;
+    inherit (self) src version;
+    inherit
+      enableMalloc
+      noPackedStructs
+      maxRequiredFields
+      field32bit
+      noErrmsg
+      bufferOnly
+      systemHeader
+      without64bit
+      encodeArraysUnpacked
+      convertDoubleFloat
+      validateUtf8
+      littleEndian8bit
+      c99StaticAssert
+      noStaticAssert;
+  };
+in
+{
+  pname = "nanopb";
+  version = "0.4.8";
+
+  src = fetchFromGitHub {
+    owner = "nanopb";
+    repo = "nanopb";
+    rev = self.version;
+    hash = "sha256-LfARVItT+7dczg2u08RlXZLrLR7ScvC44tgmcy/Zv48=";
+  };
+
+  dontPatch = true;
+  dontUnpack = true;
+
+  propagatedNativeBuildInputs = [ generator ];
+
+  propagatedBuildInputs = [ runtime ];
+
+  postInstall = ''
+    mkdir $out
+    ln -s ${generator}/bin $out/bin
+    ln -s ${runtime}/include $out/include
+    ln -s ${runtime}/lib $out/lib
+    mkdir -p $out/share/nanopb/generator/proto
+    ln -s ${self.src}/generator/proto/nanopb.proto $out/share/nanopb/generator/proto/nanopb.proto
+  '';
+
+  passthru = {
+    inherit runtime generator-out python-module generator;
+    tests = {
+      simple-proto2 = callPackage ./test-simple-proto2 { };
+      simple-proto3 = callPackage ./test-simple-proto3 { };
+      message-with-annotations = callPackage ./test-message-with-annotations { };
+      message-with-options = callPackage ./test-message-with-options { };
+    };
+  };
+
+  meta = with lib; {
+    platforms = platforms.all;
+
+    description = "Protocol Buffers with small code size";
+    homepage = "https://jpa.kapsi.fi/nanopb/";
+    license = licenses.zlib;
+    maintainers = with maintainers; [ kalbasit liarokapisv ];
+
+    longDescription = ''
+      Nanopb is a small code-size Protocol Buffers implementation in ansi C. It
+      is especially suitable for use in microcontrollers, but fits any memory
+      restricted system.
+
+      - Homepage: jpa.kapsi.fi/nanopb
+      - Documentation: jpa.kapsi.fi/nanopb/docs
+      - Downloads: jpa.kapsi.fi/nanopb/download
+      - Forum: groups.google.com/forum/#!forum/nanopb
+
+      In order to use the nanopb options in your proto files, you'll need to
+      tell protoc where to find the nanopb.proto file.
+      You can do so with the --proto_path (-I) option to add the directory
+      ''${nanopb}/share/nanopb/generator/proto like so:
+
+      protoc --proto_path=. --proto_path=''${nanopb}/share/nanopb/generator/proto --plugin=protoc-gen-nanopb=''${nanopb}/bin/protoc-gen-nanopb --nanopb_out=out file.proto
+    '';
+  };
+})
+
diff --git a/pkgs/by-name/na/nanopb/python-module.nix b/pkgs/by-name/na/nanopb/python-module.nix
new file mode 100644
index 0000000000000..f58c955307d84
--- /dev/null
+++ b/pkgs/by-name/na/nanopb/python-module.nix
@@ -0,0 +1,16 @@
+{ python3
+, version
+, generator-out
+}:
+python3.pkgs.buildPythonPackage {
+  pname = "nanopb-python-module";
+  inherit version;
+  src = generator-out;
+  pyproject = true;
+  pythonImportsCheck = [ "nanopb" ];
+  propagatedBuildInputs = with python3.pkgs; [
+    setuptools
+    protobuf
+    six
+  ];
+}
diff --git a/pkgs/by-name/na/nanopb/runtime.nix b/pkgs/by-name/na/nanopb/runtime.nix
new file mode 100644
index 0000000000000..2af7d2cedd5d7
--- /dev/null
+++ b/pkgs/by-name/na/nanopb/runtime.nix
@@ -0,0 +1,69 @@
+{ cmake
+, lib
+, stdenv
+, protobuf
+, python3
+, src
+, version
+, enableMalloc
+, noPackedStructs
+, maxRequiredFields
+, field32bit
+, noErrmsg
+, bufferOnly
+, systemHeader
+, without64bit
+, encodeArraysUnpacked
+, convertDoubleFloat
+, validateUtf8
+, littleEndian8bit
+, c99StaticAssert
+, noStaticAssert
+}:
+
+stdenv.mkDerivation
+  ({
+    pname = "nanopb-runtime";
+    inherit src version;
+
+    nativeBuildInputs = [ cmake protobuf python3 ];
+
+    patchPhase =
+      let
+        compile_definitions = target: ''
+          target_compile_definitions(${target}
+            PUBLIC
+            ${lib.concatStringsSep "\n\t" (map (x: "PB_${x.flag}")
+          (builtins.filter (x: x.cond) [
+            { cond = enableMalloc; flag = "ENABLE_MALLOC=1"; }
+            { cond = noPackedStructs; flag = "NO_PACKED_STRUCTS=1"; }
+            { cond = maxRequiredFields != null; flag = "MAX_REQUIRED_FIELDS=${maxRequiredFields}"; }
+            { cond = field32bit; flag = "FIELD_32BIT=1"; }
+            { cond = noErrmsg; flag = "NO_ERRMSG=1"; }
+            { cond = bufferOnly; flag = "BUFFER_ONLY=1"; }
+            { cond = systemHeader != null; flag = "SYSTEM_HEADER=${systemHeader}"; }
+            { cond = without64bit; flag = "WITHOUT_64BIT=1"; }
+            { cond = encodeArraysUnpacked; flag = "ENCODE_ARRAYS_UNPACKED=1"; }
+            { cond = convertDoubleFloat; flag = "CONVERT_DOUBLE_FLOAT=1"; }
+            { cond = validateUtf8; flag = "VALIDATE_UTF8=1"; }
+            { cond = littleEndian8bit; flag = "LITTLE_ENDIAN_8BIT=1"; }
+            { cond = c99StaticAssert; flag = "C99_STATIC_ASSERT=1"; }
+            { cond = noStaticAssert; flag = "NO_STATIC_ASSERT=1"; }
+          ]))}
+          )
+        '';
+      in
+      ''
+        cat << EOF >> CMakeLists.txt
+          ${compile_definitions "protobuf-nanopb"}
+          ${compile_definitions "protobuf-nanopb-static"}
+        EOF
+      '';
+
+    cmakeFlags = [
+      "-DBUILD_SHARED_LIBS=ON"
+      "-DBUILD_STATIC_LIBS=ON"
+      "-Dnanopb_BUILD_GENERATOR=OFF"
+      "-Dnanopb_BUILD_RUNTIME=ON"
+    ];
+  })
diff --git a/pkgs/development/libraries/nanopb/test-message-with-annotations/default.nix b/pkgs/by-name/na/nanopb/test-message-with-annotations/default.nix
index c2ffe6135fbb5..5e53e72c62e63 100644
--- a/pkgs/development/libraries/nanopb/test-message-with-annotations/default.nix
+++ b/pkgs/by-name/na/nanopb/test-message-with-annotations/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, protobuf, nanopb }:
+{ lib, stdenv, nanopb }:
 
 stdenv.mkDerivation {
   name = "nanopb-test-message-with-annotations";
@@ -8,6 +8,8 @@ stdenv.mkDerivation {
     fileset = lib.fileset.unions [ ./withannotations.proto ];
   };
 
+  buildInputs = [ nanopb ];
+
   # protoc requires any .proto file to be compiled to reside within it's
   # proto_path. By default the current directory is automatically added to the
   # proto_path. I tried using --proto_path ${./.} ${./simple.proto} and it did
@@ -16,7 +18,7 @@ stdenv.mkDerivation {
   buildPhase = ''
     mkdir $out
 
-    ${protobuf}/bin/protoc --proto_path=. --proto_path=${nanopb}/share/nanopb/generator/proto --plugin=protoc-gen-nanopb=${nanopb}/bin/protoc-gen-nanopb --nanopb_out=$out withannotations.proto
+    protoc --proto_path=. --proto_path=${nanopb}/share/nanopb/generator/proto --plugin=protoc-gen-nanopb=${nanopb}/bin/protoc-gen-nanopb --nanopb_out=$out withannotations.proto
   '';
 
   doCheck = true;
diff --git a/pkgs/development/libraries/nanopb/test-message-with-annotations/withannotations.proto b/pkgs/by-name/na/nanopb/test-message-with-annotations/withannotations.proto
index d8109e877d68b..d8109e877d68b 100644
--- a/pkgs/development/libraries/nanopb/test-message-with-annotations/withannotations.proto
+++ b/pkgs/by-name/na/nanopb/test-message-with-annotations/withannotations.proto
diff --git a/pkgs/development/libraries/nanopb/test-message-with-options/default.nix b/pkgs/by-name/na/nanopb/test-message-with-options/default.nix
index f6bf28f3b6457..78be532d569d7 100644
--- a/pkgs/development/libraries/nanopb/test-message-with-options/default.nix
+++ b/pkgs/by-name/na/nanopb/test-message-with-options/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, protobuf, nanopb }:
+{ lib, stdenv, nanopb }:
 
 stdenv.mkDerivation {
   name = "nanopb-test-message-with-options";
@@ -11,6 +11,8 @@ stdenv.mkDerivation {
     ];
   };
 
+  buildInputs = [ nanopb ];
+
   # protoc requires any .proto file to be compiled to reside within it's
   # proto_path. By default the current directory is automatically added to the
   # proto_path. I tried using --proto_path ${./.} ${./simple.proto} and it did
@@ -19,7 +21,7 @@ stdenv.mkDerivation {
   buildPhase = ''
     mkdir $out
 
-    ${protobuf}/bin/protoc --plugin=protoc-gen-nanopb=${nanopb}/bin/protoc-gen-nanopb --nanopb_out=$out withoptions.proto
+    protoc --plugin=protoc-gen-nanopb=${nanopb}/bin/protoc-gen-nanopb --nanopb_out=$out withoptions.proto
   '';
 
   doCheck = true;
diff --git a/pkgs/development/libraries/nanopb/test-message-with-options/withoptions.options b/pkgs/by-name/na/nanopb/test-message-with-options/withoptions.options
index ecf98a2173678..ecf98a2173678 100644
--- a/pkgs/development/libraries/nanopb/test-message-with-options/withoptions.options
+++ b/pkgs/by-name/na/nanopb/test-message-with-options/withoptions.options
diff --git a/pkgs/development/libraries/nanopb/test-message-with-options/withoptions.proto b/pkgs/by-name/na/nanopb/test-message-with-options/withoptions.proto
index 5a5da3a1c9732..5a5da3a1c9732 100644
--- a/pkgs/development/libraries/nanopb/test-message-with-options/withoptions.proto
+++ b/pkgs/by-name/na/nanopb/test-message-with-options/withoptions.proto
diff --git a/pkgs/development/libraries/nanopb/test-simple-proto2/default.nix b/pkgs/by-name/na/nanopb/test-simple-proto2/default.nix
index f8cd35cbf3979..5896679567486 100644
--- a/pkgs/development/libraries/nanopb/test-simple-proto2/default.nix
+++ b/pkgs/by-name/na/nanopb/test-simple-proto2/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, protobuf, nanopb }:
+{ lib, stdenv, nanopb }:
 
 stdenv.mkDerivation {
   name = "nanopb-test-simple-proto2";
@@ -8,6 +8,8 @@ stdenv.mkDerivation {
     fileset = lib.fileset.unions [ ./simple.proto ];
   };
 
+  buildInputs = [ nanopb ];
+
   # protoc requires any .proto file to be compiled to reside within it's
   # proto_path. By default the current directory is automatically added to the
   # proto_path. I tried using --proto_path ${./.} ${./simple.proto} and it did
@@ -16,7 +18,7 @@ stdenv.mkDerivation {
   buildPhase = ''
     mkdir $out
 
-    ${protobuf}/bin/protoc --plugin=protoc-gen-nanopb=${nanopb}/bin/protoc-gen-nanopb --nanopb_out=$out simple.proto
+    protoc --plugin=protoc-gen-nanopb=${nanopb}/bin/protoc-gen-nanopb --nanopb_out=$out simple.proto
   '';
 
   doCheck = true;
diff --git a/pkgs/development/libraries/nanopb/test-simple-proto2/simple.proto b/pkgs/by-name/na/nanopb/test-simple-proto2/simple.proto
index b02936b1ae267..b02936b1ae267 100644
--- a/pkgs/development/libraries/nanopb/test-simple-proto2/simple.proto
+++ b/pkgs/by-name/na/nanopb/test-simple-proto2/simple.proto
diff --git a/pkgs/development/libraries/nanopb/test-simple-proto3/default.nix b/pkgs/by-name/na/nanopb/test-simple-proto3/default.nix
index d92698d21ece5..6276126131c86 100644
--- a/pkgs/development/libraries/nanopb/test-simple-proto3/default.nix
+++ b/pkgs/by-name/na/nanopb/test-simple-proto3/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, protobuf, nanopb }:
+{ lib, stdenv, nanopb }:
 
 stdenv.mkDerivation {
   name = "nanopb-test-simple-proto3";
@@ -7,6 +7,9 @@ stdenv.mkDerivation {
     root = ./.;
     fileset = lib.fileset.unions [ ./simple.proto ];
   };
+
+  buildInputs = [ nanopb ];
+
   # protoc requires any .proto file to be compiled to reside within it's
   # proto_path. By default the current directory is automatically added to the
   # proto_path. I tried using --proto_path ${./.} ${./simple.proto} and it did
@@ -15,7 +18,7 @@ stdenv.mkDerivation {
   buildPhase = ''
     mkdir $out
 
-    ${protobuf}/bin/protoc --plugin=protoc-gen-nanopb=${nanopb}/bin/protoc-gen-nanopb --nanopb_out=$out simple.proto
+    protoc --plugin=protoc-gen-nanopb=${nanopb}/bin/protoc-gen-nanopb --nanopb_out=$out simple.proto
   '';
 
   doCheck = true;
diff --git a/pkgs/development/libraries/nanopb/test-simple-proto3/simple.proto b/pkgs/by-name/na/nanopb/test-simple-proto3/simple.proto
index 6b99cdb5daa7c..6b99cdb5daa7c 100644
--- a/pkgs/development/libraries/nanopb/test-simple-proto3/simple.proto
+++ b/pkgs/by-name/na/nanopb/test-simple-proto3/simple.proto
diff --git a/pkgs/development/libraries/nanopb/default.nix b/pkgs/development/libraries/nanopb/default.nix
deleted file mode 100644
index 5353bac3e1a30..0000000000000
--- a/pkgs/development/libraries/nanopb/default.nix
+++ /dev/null
@@ -1,76 +0,0 @@
-{ callPackage
-, cmake
-, fetchFromGitHub
-, lib
-, protobuf
-, python3
-, stdenv
-, buildPackages
-, mallocBuild ? false
-}:
-
-stdenv.mkDerivation rec {
-  pname = "nanopb";
-  version = "0.4.6";
-
-  src = fetchFromGitHub {
-    owner = pname;
-    repo = pname;
-    rev = version;
-    sha256 = "sha256-B9J+GkgOBR4iZaP6/2ykcjbkifoyhkuukkjK/CLBZj0=";
-  };
-
-  nativeBuildInputs = [ cmake python3 python3.pkgs.wrapPython ];
-
-  pythonPath = with python3.pkgs; [ python3.pkgs.protobuf six ];
-
-  cmakeFlags = [
-    "-DBUILD_SHARED_LIBS=ON" # generate $out/lib/libprotobuf-nanopb.so{.0,}
-    "-DBUILD_STATIC_LIBS=ON" # generate $out/lib/libprotobuf-nanopb.a
-    "-Dnanopb_PROTOC_PATH=${buildPackages.protobuf}/bin/protoc"
-  ] ++ lib.optional mallocBuild "-DCMAKE_C_FLAGS=-DPB_ENABLE_MALLOC 1";
-
-  postInstall = ''
-    mkdir -p $out/share/nanopb/generator/proto
-    cp ../generator/proto/nanopb.proto $out/share/nanopb/generator/proto/nanopb.proto
-    cp ../pb_common.c ../pb_decode.c ../pb_encode.c $out/include/
-  '';
-
-  postFixup = ''
-    wrapPythonPrograms
-  '';
-
-  passthru.tests = {
-    simple-proto2 = callPackage ./test-simple-proto2 {};
-    simple-proto3 = callPackage ./test-simple-proto3 {};
-    message-with-annotations = callPackage ./test-message-with-annotations {};
-    message-with-options = callPackage ./test-message-with-options {};
-  };
-
-  meta = with lib; {
-    inherit (protobuf.meta) platforms;
-
-    description = "Protocol Buffers with small code size";
-    homepage = "https://jpa.kapsi.fi/nanopb/";
-    license = licenses.zlib;
-    maintainers = with maintainers; [ kalbasit ];
-
-    longDescription = ''
-      Nanopb is a small code-size Protocol Buffers implementation in ansi C. It
-      is especially suitable for use in microcontrollers, but fits any memory
-      restricted system.
-
-      - Homepage: jpa.kapsi.fi/nanopb
-      - Documentation: jpa.kapsi.fi/nanopb/docs
-      - Downloads: jpa.kapsi.fi/nanopb/download
-      - Forum: groups.google.com/forum/#!forum/nanopb
-
-      In order to use the nanopb options in your proto files, you'll need to
-      tell protoc where to find the nanopb.proto file.
-      You can do so with the --proto_path (-I) option to add the directory
-      ''${nanopb}/share/nanopb/generator/proto like so:
-
-      protoc --proto_path=. --proto_path=''${nanopb}/share/nanopb/generator/proto --plugin=protoc-gen-nanopb=''${nanopb}/bin/protoc-gen-nanopb --nanopb_out=out file.proto
-    '';
-  };
-}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index f0098e9632348..28be9e2052e76 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -23754,8 +23754,7 @@ with pkgs;
 
   flatbuffers = callPackage ../development/libraries/flatbuffers { };
 
-  nanopb = callPackage ../development/libraries/nanopb { };
-  nanopbMalloc = callPackage ../development/libraries/nanopb { mallocBuild = true; };
+  nanopbMalloc = callPackage ../by-name/na/nanopb/package.nix { enableMalloc = true; };
 
   gnupth = callPackage ../development/libraries/pth { };
   pth = if stdenv.hostPlatform.isMusl then npth else gnupth;