diff --git a/lib/licenses/licenses.nix b/lib/licenses/licenses.nix index 8e40dacdbeb3..87b841d8bd7a 100644 --- a/lib/licenses/licenses.nix +++ b/lib/licenses/licenses.nix @@ -527,6 +527,11 @@ lib.mapAttrs mkLicense ( fullName = "DOC License"; }; + docBookDtd = { + spdxId = "DocBook-DTD"; + fullName = "DocBook DTD License"; + }; + drl10 = { spdxId = "DRL-1.0"; fullName = "Detection Rule License 1.0"; diff --git a/nixos/modules/services/networking/nbd.nix b/nixos/modules/services/networking/nbd.nix index 1fcbc1969543..054f265f1bbd 100644 --- a/nixos/modules/services/networking/nbd.nix +++ b/nixos/modules/services/networking/nbd.nix @@ -36,8 +36,6 @@ let generic = ( cfg.server.extraOptions // { - user = "root"; - group = "root"; port = cfg.server.listenPort; } // (optionalAttrs (cfg.server.listenAddress != null) { @@ -155,8 +153,8 @@ in before = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ]; serviceConfig = { - ExecStart = "${pkgs.nbd}/bin/nbd-server -C ${serverConfig}"; - Type = "forking"; + ExecStart = "${pkgs.nbd}/bin/nbd-server -n -C ${serverConfig}"; + Type = "simple"; DeviceAllow = map (path: "${path} rw") allowedDevices; BindPaths = boundPaths; diff --git a/pkgs/by-name/nb/nbd/package.nix b/pkgs/by-name/nb/nbd/package.nix index 7a813bdef3f9..5788eaf9d506 100644 --- a/pkgs/by-name/nb/nbd/package.nix +++ b/pkgs/by-name/nb/nbd/package.nix @@ -1,12 +1,18 @@ { lib, stdenv, - fetchurl, + fetchFromGitHub, fetchpatch, + autoreconfHook, + autoconf-archive, pkg-config, glib, which, bison, + flex, + docbook2x, + docbook_sgml_dtd_41, + docbook_sgml_dtd_45, nixosTests, libnl, linuxHeaders, @@ -15,26 +21,37 @@ stdenv.mkDerivation (finalAttrs: { pname = "nbd"; - version = "3.25"; + version = "3.27.1"; - src = fetchurl { - url = "https://github.com/NetworkBlockDevice/nbd/releases/download/nbd-${finalAttrs.version}/nbd-${finalAttrs.version}.tar.xz"; - hash = "sha256-9cj9D8tXsckmWU0OV/NWQy7ghni+8dQNCI8IMPDL3Qo="; + src = fetchFromGitHub { + owner = "NetworkBlockDevice"; + repo = "nbd"; + tag = "nbd-${finalAttrs.version}"; + hash = "sha256-0ahoLnwLdQdpr0AuRpNoid17hXo9BWlIOWRjRwhJ/LM="; }; patches = [ - # fix port setting from nbdtab - # https://github.com/NetworkBlockDevice/nbd/pull/154 + # Fix nbd device parsing (fetchpatch { - url = "https://github.com/NetworkBlockDevice/nbd/commit/915444bc0b8a931d32dfb755542f4bd1d37f1449.patch"; - hash = "sha256-6z+c2cXhY92WPDqRO6AJ5BBf1N38yTgOE1foduIr5Dg="; + url = "https://github.com/NetworkBlockDevice/nbd/commit/a80304e10e9709d4100c935bc4cdc9086e86d5ff.patch"; + hash = "sha256-PMgVz2a8cwv1tO8ac5Wrf8ZFvOmCq+mC5bysJJGhpGc="; }) ]; + postPatch = '' + substituteInPlace configure.ac \ + --replace-fail "support/genver.sh" "echo ${finalAttrs.version}" + substituteInPlace man/Makefile.am \ + --replace-fail "docbook2man" "docbook2man --sgml" + ''; + nativeBuildInputs = [ + autoreconfHook + autoconf-archive pkg-config - which bison + flex + docbook2x # docbook2man ]; buildInputs = [ @@ -46,15 +63,21 @@ stdenv.mkDerivation (finalAttrs: { linuxHeaders ]; + nativeCheckInputs = [ + which + ]; + configureFlags = [ "--sysconfdir=/etc" ]; - # ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] - env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=implicit-function-declaration"; - doCheck = !stdenv.hostPlatform.isDarwin; + env.SGML_CATALOG_FILES = lib.concatStringsSep ":" [ + "${docbook_sgml_dtd_41}/sgml/dtd/docbook-4.1/docbook.cat" + "${docbook_sgml_dtd_45}/sgml/dtd/docbook-4.5/docbook.cat" + ]; + passthru.tests = { test = nixosTests.nbd; }; diff --git a/pkgs/data/sgml+xml/schemas/sgml-dtd/docbook/3.1.nix b/pkgs/data/sgml+xml/schemas/sgml-dtd/docbook/3.1.nix deleted file mode 100644 index b90123017bde..000000000000 --- a/pkgs/data/sgml+xml/schemas/sgml-dtd/docbook/3.1.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ - lib, - stdenv, - fetchurl, - unzip, -}: - -let - - src = fetchurl { - url = "http://www.oasis-open.org/docbook/sgml/3.1/docbk31.zip"; - sha256 = "0f25ch7bywwhdxb1qa0hl28mgq1blqdap3rxzamm585rf4kis9i0"; - }; - - isoents = fetchurl { - url = "http://www.oasis-open.org/cover/ISOEnts.zip"; - sha256 = "1clrkaqnvc1ja4lj8blr0rdlphngkcda3snm7b9jzvcn76d3br6w"; - }; - -in - -stdenv.mkDerivation { - pname = "docbook-sgml"; - version = "3.1"; - - dontUnpack = true; - - nativeBuildInputs = [ unzip ]; - - installPhase = '' - o=$out/sgml/dtd/docbook-3.1 - mkdir -p $o - cd $o - unzip ${src} - unzip ${isoents} - sed -e "s/iso-/ISO/" -e "s/.gml//" -i docbook.cat - ''; - - meta = { - platforms = lib.platforms.unix; - }; -} diff --git a/pkgs/data/sgml+xml/schemas/sgml-dtd/docbook/default.nix b/pkgs/data/sgml+xml/schemas/sgml-dtd/docbook/default.nix new file mode 100644 index 000000000000..f2cc962adc74 --- /dev/null +++ b/pkgs/data/sgml+xml/schemas/sgml-dtd/docbook/default.nix @@ -0,0 +1,17 @@ +{ + callPackage, +}: +{ + docbook_sgml_dtd_31 = callPackage (import ./generic.nix { + version = "3.1"; + hash = "sha256-ICYdJ3G5oFKr+j2PqxqmK+BXkaAQKBxWb5Bzvw5kRTg="; + }) { }; + docbook_sgml_dtd_41 = callPackage (import ./generic.nix { + version = "4.1"; + hash = "sha256-3qr88KNndpLnrUQSwOQcHbPp2mzc2z3TKyzB+cl9YxE="; + }) { }; + docbook_sgml_dtd_45 = callPackage (import ./generic.nix { + version = "4.5"; + hash = "sha256-gEPlFOgMbBnLFGtdN5N9EwW/Or+bAJfDbff3D2Ec30M="; + }) { }; +} diff --git a/pkgs/data/sgml+xml/schemas/sgml-dtd/docbook/generic.nix b/pkgs/data/sgml+xml/schemas/sgml-dtd/docbook/generic.nix new file mode 100644 index 000000000000..9027dbc141f9 --- /dev/null +++ b/pkgs/data/sgml+xml/schemas/sgml-dtd/docbook/generic.nix @@ -0,0 +1,57 @@ +{ version, hash }: +{ + lib, + stdenv, + fetchurl, + unzip, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "docbook-sgml"; + inherit version; + + src = fetchurl { + url = "https://archive.docbook.org/sgml/${finalAttrs.version}/${ + if lib.versionAtLeast finalAttrs.version "4.2" then + "docbook-${finalAttrs.version}" + else + "docbk${lib.replaceStrings [ "." ] [ "" ] finalAttrs.version}" + }.zip"; + inherit hash; + }; + + isoents = fetchurl { + url = "https://web.archive.org/web/20250220122223/http://xml.coverpages.org/ISOEnts.zip"; + hash = "sha256-3OQ1mjmW7S/TOtXqoRqbz8JLWwaZLiQpUTKwbbGambI="; + }; + + nativeBuildInputs = [ + unzip + ]; + + installPhase = '' + runHook preInstall + + mkdir -p "$out/sgml/dtd/docbook-${finalAttrs.version}" + unzip -d "$out/sgml/dtd/docbook-${finalAttrs.version}" "$src" + unzip -d "$out/sgml/dtd/docbook-${finalAttrs.version}" "$isoents" + + substituteInPlace "$out/sgml/dtd/docbook-${finalAttrs.version}/docbook.cat" \ + --replace-fail "iso-" "ISO" \ + --replace-fail ".gml" "" + + runHook postInstall + ''; + + dontUnpack = true; + strictDeps = true; + __structuredAttrs = true; + + meta = { + description = "DocBook ${finalAttrs.version} SGML Schemas"; + homepage = "https://docbook.org/"; + license = lib.licenses.docBookDtd; + maintainers = with lib.maintainers; [ nickcao ]; + platforms = lib.platforms.all; + }; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0f095130f6e0..d9399dc345bf 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8826,10 +8826,13 @@ with pkgs; dejavu_fonts = lowPrio (callPackage ../data/fonts/dejavu-fonts { }); - docbook_sgml_dtd_31 = callPackage ../data/sgml+xml/schemas/sgml-dtd/docbook/3.1.nix { }; - docbook_sgml_dtd_41 = callPackage ../data/sgml+xml/schemas/sgml-dtd/docbook/4.1.nix { }; + inherit (callPackage ../data/sgml+xml/schemas/sgml-dtd/docbook { }) + docbook_sgml_dtd_31 + docbook_sgml_dtd_45 + ; + docbook_xml_dtd_412 = callPackage ../data/sgml+xml/schemas/xml-dtd/docbook/4.1.2.nix { }; docbook_xml_dtd_42 = callPackage ../data/sgml+xml/schemas/xml-dtd/docbook/4.2.nix { };