From c9793c8ae09afdf61f733d0aadc3404487632fc6 Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Sat, 9 Dec 2023 06:56:45 +0000 Subject: [PATCH 01/17] ipp-usb: 0.9.23 -> 0.9.24 --- pkgs/os-specific/linux/ipp-usb/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/linux/ipp-usb/default.nix b/pkgs/os-specific/linux/ipp-usb/default.nix index 6dc63a7295b1..38d9afddaca6 100644 --- a/pkgs/os-specific/linux/ipp-usb/default.nix +++ b/pkgs/os-specific/linux/ipp-usb/default.nix @@ -1,13 +1,13 @@ { buildGoModule, avahi, libusb1, pkg-config, lib, fetchFromGitHub, ronn }: buildGoModule rec { pname = "ipp-usb"; - version = "0.9.23"; + version = "0.9.24"; src = fetchFromGitHub { owner = "openprinting"; repo = "ipp-usb"; rev = version; - sha256 = "sha256-sbPQWKqkTaD3kLNs0noVIzAN9cwDEaULsqO7SMQH2Jo="; + sha256 = "sha256-06Kb4s9oN53llz/Yya45ig5rd86VvlcK+vRh3bL/MAw="; }; postPatch = '' @@ -24,7 +24,7 @@ buildGoModule rec { nativeBuildInputs = [ pkg-config ronn ]; buildInputs = [ libusb1 avahi ]; - vendorHash = "sha256-KwW6KgopjF4tVo8eB4OtpXF5R8jfrJ9nibNmaN8U4l8="; + vendorHash = "sha256-61vCER1yR70Pn+CrfTai1sgiQQLU6msb9jxushus5W4="; postInstall = '' # to accomodate the makefile From 084df790dec9e31740a7747b9b9f39ac539bfa63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Sun, 10 Dec 2023 18:21:55 -0800 Subject: [PATCH 02/17] appdaemon: 4.2.1 -> 4.4.2 Diff: https://github.com/AppDaemon/appdaemon/compare/refs/tags/4.2.1...4.4.2 Changelog: https://github.com/AppDaemon/appdaemon/blob/4.4.2/docs/HISTORY.md --- pkgs/servers/home-assistant/appdaemon.nix | 30 +++++++++-------------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/pkgs/servers/home-assistant/appdaemon.nix b/pkgs/servers/home-assistant/appdaemon.nix index b104bb15997d..89515fa265d3 100644 --- a/pkgs/servers/home-assistant/appdaemon.nix +++ b/pkgs/servers/home-assistant/appdaemon.nix @@ -5,53 +5,47 @@ python3.pkgs.buildPythonApplication rec { pname = "appdaemon"; - version = "4.2.1"; - format = "setuptools"; + version = "4.4.2"; + pyproject = true; - disabled = python3.pythonOlder "3.7"; + disabled = python3.pythonOlder "3.8"; src = fetchFromGitHub { owner = "AppDaemon"; repo = "appdaemon"; rev = "refs/tags/${version}"; - hash = "sha256-4sN0optkMmyWb5Cd3F7AhcXYHh7aidJE/bieYMEKgSY="; + hash = "sha256-T3InE4J4qYeFJTq6nrW8y5BOA7Z0n3t9eVpl641r/xk="; }; postPatch = '' # relax dependencies - sed -i 's/==/>=/' requirements.txt + sed -i 's/~=/>=/' pyproject.toml ''; + nativeBuildInputs = with python3.pkgs; [ + setuptools + ]; + propagatedBuildInputs = with python3.pkgs; [ - aiodns aiohttp aiohttp-jinja2 astral - azure-keyvault-secrets - azure-mgmt-compute - azure-mgmt-resource - azure-mgmt-storage - azure-storage-blob bcrypt - faust-cchardet deepdiff feedparser iso8601 - jinja2 paho-mqtt pid - pygments python-dateutil - python-engineio python-socketio pytz pyyaml requests sockjs uvloop - voluptuous websocket-client - yarl + tomli + tomli-w ]; # no tests implemented @@ -62,7 +56,7 @@ python3.pkgs.buildPythonApplication rec { meta = with lib; { description = "Sandboxed Python execution environment for writing automation apps for Home Assistant"; homepage = "https://github.com/AppDaemon/appdaemon"; - changelog = "https://github.com/AppDaemon/appdaemon/blob/${version}/docs/HISTORY.rst"; + changelog = "https://github.com/AppDaemon/appdaemon/blob/${version}/docs/HISTORY.md"; license = licenses.mit; maintainers = teams.home-assistant.members; }; From 57358cd35aa9ac9c94040ad09c4f04a246a24e70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Tue, 19 Dec 2023 09:36:30 -0800 Subject: [PATCH 03/17] gitmoji-cli: install package.json Otherwise it fails to run with (node:36784) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension. (Use `node --trace-warnings ...` to show where the warning was created) /nix/store/g06q0h9a9hb5zgm1vnpddi062hpy3hpa-gitmoji-cli-9.0.0/lib/node_modules/gitmoji-cli/lib/cli.js:2 import meow from 'meow'; ^^^^^^ SyntaxError: Cannot use import statement outside a module at internalCompileFunction (node:internal/vm:73:18) at wrapSafe (node:internal/modules/cjs/loader:1178:20) at Module._compile (node:internal/modules/cjs/loader:1220:27) at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) at Module.load (node:internal/modules/cjs/loader:1119:32) at Module._load (node:internal/modules/cjs/loader:960:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12) at node:internal/main/run_main_module:23:47 Node.js v18.18.2 --- pkgs/by-name/gi/gitmoji-cli/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/gi/gitmoji-cli/package.nix b/pkgs/by-name/gi/gitmoji-cli/package.nix index 7787bd4ccf81..754427e64061 100644 --- a/pkgs/by-name/gi/gitmoji-cli/package.nix +++ b/pkgs/by-name/gi/gitmoji-cli/package.nix @@ -57,7 +57,7 @@ stdenv.mkDerivation (finalAttrs: { yarn --offline --production install mkdir -p "$out/lib/node_modules/gitmoji-cli" - cp -r lib node_modules "$out/lib/node_modules/gitmoji-cli" + cp -r lib node_modules package.json "$out/lib/node_modules/gitmoji-cli" makeWrapper "${nodejs}/bin/node" "$out/bin/gitmoji" \ --add-flags "$out/lib/node_modules/gitmoji-cli/lib/cli.js" From 0b087331d123e315548a0d0dd83c0c5784e62040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Tue, 19 Dec 2023 09:43:05 -0800 Subject: [PATCH 04/17] gitmoji-cli: add version test --- pkgs/by-name/gi/gitmoji-cli/package.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/by-name/gi/gitmoji-cli/package.nix b/pkgs/by-name/gi/gitmoji-cli/package.nix index 754427e64061..79a801000ad1 100644 --- a/pkgs/by-name/gi/gitmoji-cli/package.nix +++ b/pkgs/by-name/gi/gitmoji-cli/package.nix @@ -6,6 +6,7 @@ , nodejs , prefetch-yarn-deps , yarn +, testers }: stdenv.mkDerivation (finalAttrs: { @@ -65,6 +66,12 @@ stdenv.mkDerivation (finalAttrs: { runHook postInstall ''; + passthru.tests = { + version = testers.testVersion { + package = finalAttrs.finalPackage; + }; + }; + meta = { description = "Gitmoji client for using emojis on commit messages"; homepage = "https://github.com/carloscuesta/gitmoji-cli"; From d62b99afbb23934cff814bca1f38c50a2b1f8929 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Tue, 19 Dec 2023 10:45:39 -0800 Subject: [PATCH 05/17] Revert "python3Packages.dynalite-devices: 0.1.48 -> 0.47" This reverts commit e361bc26241cde96ead8a195e2502269543c2339. Version 0.47 is older than 0.1.48. --- pkgs/development/python-modules/dynalite-devices/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/dynalite-devices/default.nix b/pkgs/development/python-modules/dynalite-devices/default.nix index 7066271182ef..cb899bb04c07 100644 --- a/pkgs/development/python-modules/dynalite-devices/default.nix +++ b/pkgs/development/python-modules/dynalite-devices/default.nix @@ -8,7 +8,7 @@ buildPythonPackage rec { pname = "dynalite-devices"; - version = "0.47"; + version = "0.1.48"; format = "setuptools"; disabled = pythonOlder "3.7"; @@ -17,7 +17,7 @@ buildPythonPackage rec { owner = "ziv1234"; repo = "python-dynalite-devices"; rev = "refs/tags/v${version}"; - hash = "sha256-kJo4e5vhgWzijLUhQd9VBVk1URpg9SXhOA60dJYashM="; + hash = "sha256-i88aIsRNsToSceQdwfspJg+Y5MO5zC4O6EkyhrYR27g="; }; postPatch = '' From 782978b7fe13c7d66e0980d2d192de2527c55557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Tue, 19 Dec 2023 10:53:09 -0800 Subject: [PATCH 06/17] python311Packages.dynalite-panel: init at 0.0.4 --- .../python-modules/dynalite-panel/default.nix | 40 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 42 insertions(+) create mode 100644 pkgs/development/python-modules/dynalite-panel/default.nix diff --git a/pkgs/development/python-modules/dynalite-panel/default.nix b/pkgs/development/python-modules/dynalite-panel/default.nix new file mode 100644 index 000000000000..33be58906c75 --- /dev/null +++ b/pkgs/development/python-modules/dynalite-panel/default.nix @@ -0,0 +1,40 @@ +{ lib +, buildPythonPackage +, pythonOlder +, fetchPypi +, setuptools +}: + +buildPythonPackage rec { + pname = "dynalite-panel"; + version = "0.0.4"; + pyproject = true; + + disabled = pythonOlder "3.4"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-m7nQzbxRe2qXUWAMeQlDZtc9F01DsbTzF/kI0ci3TFE="; + }; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace "~=" ">=" + ''; + + nativeBuildInputs = [ + setuptools + ]; + + pythonImportsCheck = [ "dynalite_panel" ]; + + # upstream has no tests + doCheck = false; + + meta = { + description = "Dynalite panel for Home Assistant"; + homepage = "https://github.com/ziv1234/dynalitepanel"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ dotlambda ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 61f359558431..d0acbf731e5e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3461,6 +3461,8 @@ self: super: with self; { dynalite-devices = callPackage ../development/python-modules/dynalite-devices { }; + dynalite-panel = callPackage ../development/python-modules/dynalite-panel { }; + dynd = callPackage ../development/python-modules/dynd { }; e3-core = callPackage ../development/python-modules/e3-core { }; From 5517efe88531b804af960887b71de1c044484109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Tue, 19 Dec 2023 10:55:44 -0800 Subject: [PATCH 07/17] home-assistant: support dynalite component --- pkgs/servers/home-assistant/component-packages.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/servers/home-assistant/component-packages.nix b/pkgs/servers/home-assistant/component-packages.nix index 31a389b98200..eca4e725783f 100644 --- a/pkgs/servers/home-assistant/component-packages.nix +++ b/pkgs/servers/home-assistant/component-packages.nix @@ -1040,13 +1040,14 @@ aiohttp-fast-url-dispatcher aiohttp-zlib-ng dynalite-devices + dynalite-panel fnv-hash-fast home-assistant-frontend janus pillow psutil-home-assistant sqlalchemy - ]; # missing inputs: dynalite-panel + ]; "eafm" = ps: with ps; [ aioeafm ]; @@ -5713,6 +5714,7 @@ "dunehd" "duotecno" "dwd_weather_warnings" + "dynalite" "eafm" "easyenergy" "ecobee" From 6fc76141ae6d4f7b34d6af315263b3d03a9ed133 Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Sun, 24 Dec 2023 21:52:56 +0000 Subject: [PATCH 08/17] leptonica: 1.83.1 -> 1.84.0 --- pkgs/development/libraries/leptonica/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/leptonica/default.nix b/pkgs/development/libraries/leptonica/default.nix index ceb42cd49154..08921c2ca3c0 100644 --- a/pkgs/development/libraries/leptonica/default.nix +++ b/pkgs/development/libraries/leptonica/default.nix @@ -4,11 +4,11 @@ stdenv.mkDerivation rec { pname = "leptonica"; - version = "1.83.1"; + version = "1.84.0"; src = fetchurl { url = "https://github.com/DanBloomberg/${pname}/releases/download/${version}/${pname}-${version}.tar.gz"; - hash = "sha256-jxhhXgdDr3339QmFxzDfzwyTVIBz0fVmIeQVaotU090="; + hash = "sha256-QqApMSod8M1WQBlal5voG/ZiMOFTFkysRWR4RU5yBtU="; }; nativeBuildInputs = [ autoreconfHook pkg-config ]; From 4bb39bbc6554c1f2d37115d88ce8f49cc51b4fc8 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Tue, 26 Dec 2023 22:41:24 +0000 Subject: [PATCH 09/17] dockerTools.tests.docker-tools: user `runCommand` instead of `runCommandNoCC` alias Noticed when evaluated tests without aliases enabled. --- nixos/tests/docker-tools.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/tests/docker-tools.nix b/nixos/tests/docker-tools.nix index fcdfa586fd55..90af817e75ed 100644 --- a/nixos/tests/docker-tools.nix +++ b/nixos/tests/docker-tools.nix @@ -11,7 +11,7 @@ let # Rootfs diffs for layers 1 and 2 are identical (and empty) layer1 = pkgs.dockerTools.buildImage { name = "empty"; }; layer2 = layer1.overrideAttrs (_: { fromImage = layer1; }); - repeatedRootfsDiffs = pkgs.runCommandNoCC "image-with-links.tar" { + repeatedRootfsDiffs = pkgs.runCommand "image-with-links.tar" { nativeBuildInputs = [pkgs.jq]; } '' mkdir contents From bf8d092986acf025462cff7029671a73bbca1a79 Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Wed, 27 Dec 2023 09:21:06 +0000 Subject: [PATCH 10/17] open-policy-agent: 0.58.0 -> 0.60.0 --- pkgs/development/tools/open-policy-agent/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/tools/open-policy-agent/default.nix b/pkgs/development/tools/open-policy-agent/default.nix index aa8b4ae20f71..2d5fae331142 100644 --- a/pkgs/development/tools/open-policy-agent/default.nix +++ b/pkgs/development/tools/open-policy-agent/default.nix @@ -11,13 +11,13 @@ assert enableWasmEval && stdenv.isDarwin -> builtins.throw "building with wasm o buildGoModule rec { pname = "open-policy-agent"; - version = "0.58.0"; + version = "0.60.0"; src = fetchFromGitHub { owner = "open-policy-agent"; repo = "opa"; rev = "v${version}"; - hash = "sha256-zDTL/kP0ldPiZhLqLQmpIoDaq979KNDVJyXp93sPZAk="; + hash = "sha256-E+94J83IDLuEayrlwIp8TL+GZeUCkQmSyNL8N7mvK6o="; }; vendorHash = null; From d4c1c32dc51cecccc7a90b266e6d760e35d7728e Mon Sep 17 00:00:00 2001 From: Guillaume Girol Date: Sat, 23 Dec 2023 12:00:00 +0000 Subject: [PATCH 11/17] cnijfilter_2_80: disable fortify3 hardening the cups filter crashes with hardening Fixes https://github.com/NixOS/nixpkgs/issues/276125 --- pkgs/misc/cups/drivers/cnijfilter_2_80/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/misc/cups/drivers/cnijfilter_2_80/default.nix b/pkgs/misc/cups/drivers/cnijfilter_2_80/default.nix index 2b7e416eafef..1a573c032e7f 100644 --- a/pkgs/misc/cups/drivers/cnijfilter_2_80/default.nix +++ b/pkgs/misc/cups/drivers/cnijfilter_2_80/default.nix @@ -100,6 +100,10 @@ stdenv.mkDerivation { them, it undoes the --set-rpath. this prevents that. */ dontPatchELF = true; + # fortify hardening makes the filter crash + # https://github.com/NixOS/nixpkgs/issues/276125 + hardeningDisable = [ "fortify3" ]; + meta = with lib; { description = "Canon InkJet printer drivers for the iP5400, MP520, MP210, MP140, iP3500, and MP610 series. (MP520 drivers also work for MX700.)"; homepage = "http://support-asia.canon-asia.com/content/EN/0100084101.html"; From b0a6ea2442cc3a79f75f31f7b735bc79774b2bb9 Mon Sep 17 00:00:00 2001 From: gaykitty <126119280+gaykitty@users.noreply.github.com> Date: Wed, 6 Dec 2023 05:42:41 -0500 Subject: [PATCH 12/17] sc-im: make libxls optional libxls has several security issues that haven't been addresses in months. Since it is an optional dependency of sc-im, this makes it optional in Nix as well and disabling it by default. --- pkgs/applications/misc/sc-im/default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/misc/sc-im/default.nix b/pkgs/applications/misc/sc-im/default.nix index 69a71c6563cb..506ff5f10c8a 100644 --- a/pkgs/applications/misc/sc-im/default.nix +++ b/pkgs/applications/misc/sc-im/default.nix @@ -11,6 +11,7 @@ , libxml2 , libzip , ncurses +, xlsSupport ? false }: stdenv.mkDerivation rec { @@ -35,11 +36,12 @@ stdenv.mkDerivation rec { buildInputs = [ gnuplot - libxls - libxlsxwriter libxml2 libzip ncurses + ] ++ lib.optionals xlsSupport [ + libxls + libxlsxwriter ]; makeFlags = [ "prefix=${placeholder "out"}" ]; From 06d11b26394d7de3e92b274d2bf8d2701ebb67e6 Mon Sep 17 00:00:00 2001 From: lucasew Date: Wed, 27 Dec 2023 14:07:03 -0300 Subject: [PATCH 13/17] python3Packages.facenet-pytorch: init at 2.5.3 Signed-off-by: lucasew --- .../facenet-pytorch/default.nix | 29 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 ++ 2 files changed, 31 insertions(+) create mode 100644 pkgs/development/python-modules/facenet-pytorch/default.nix diff --git a/pkgs/development/python-modules/facenet-pytorch/default.nix b/pkgs/development/python-modules/facenet-pytorch/default.nix new file mode 100644 index 000000000000..153408761c0a --- /dev/null +++ b/pkgs/development/python-modules/facenet-pytorch/default.nix @@ -0,0 +1,29 @@ +{ buildPythonPackage +, fetchPypi +, pillow +, torchvision +, lib +}: + +buildPythonPackage rec { + pname = "facenet-pytorch"; + version = "2.5.3"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-mMxbQqSPg3wCPrkvKlcc1KxqRmh8XnG56ZtJEIcnPis="; + }; + + doCheck = false; # pypi version doesn't ship with tests + + pythonImportsCheck = ["facenet_pytorch"]; + + propagatedBuildInputs = [ pillow torchvision ]; + + meta = { + description = "Pretrained Pytorch face detection (MTCNN) and facial recognition (InceptionResnet) models"; + homepage = "https://github.com/timesler/facenet-pytorch"; + license = lib.licenses.mit; + maintainers = [ lib.maintainers.lucasew ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 34a8f1c78313..7107025092b6 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3833,6 +3833,8 @@ self: super: with self; { face-recognition = callPackage ../development/python-modules/face-recognition { }; + facenet-pytorch = callPackage ../development/python-modules/facenet-pytorch { }; + face-recognition-models = callPackage ../development/python-modules/face-recognition/models.nix { }; factory-boy = callPackage ../development/python-modules/factory-boy { }; From 5f3d7262929b10306229f02cf4eea53012e24083 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Wed, 27 Dec 2023 10:27:07 -0800 Subject: [PATCH 14/17] python311Packages.dynalite-devices: exclude from bulk updates It would update to the upstream tag v0.47 which should have been v0.1.47. --- pkgs/development/python-modules/dynalite-devices/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/development/python-modules/dynalite-devices/default.nix b/pkgs/development/python-modules/dynalite-devices/default.nix index cb899bb04c07..111e7f69e13c 100644 --- a/pkgs/development/python-modules/dynalite-devices/default.nix +++ b/pkgs/development/python-modules/dynalite-devices/default.nix @@ -37,6 +37,9 @@ buildPythonPackage rec { "dynalite_devices_lib" ]; + # it would use the erroneous tag v0.47 + passthru.skipBulkUpdate = false; + meta = with lib; { description = "An unofficial Dynalite DyNET interface creating devices"; homepage = "https://github.com/ziv1234/python-dynalite-devices"; From 1ada32da4ba24d7310653c9ac54888bee463f455 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Wed, 27 Dec 2023 20:38:59 +0100 Subject: [PATCH 15/17] neovim: generate init.lua by default (#222907) * wrapNeovimUnstable: generate lua rc files by default backwards compatible. The viml source is source from init.lua --------- Co-authored-by: Matthieu Coudron <886074+teto@users.noreply.github.com> --- .../applications/editors/neovim/tests/default.nix | 6 ++++++ pkgs/applications/editors/neovim/wrapper.nix | 15 +++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/editors/neovim/tests/default.nix b/pkgs/applications/editors/neovim/tests/default.nix index a7e0e4c77057..cbe811c33b68 100644 --- a/pkgs/applications/editors/neovim/tests/default.nix +++ b/pkgs/applications/editors/neovim/tests/default.nix @@ -74,9 +74,12 @@ let }) ('' source ${nmt}/bash-lib/assertions.sh vimrc="${writeText "init.vim" neovim-drv.initRc}" + luarc="${writeText "init.lua" neovim-drv.luaRcContent}" + luarcGeneric="$out/patched.lua" vimrcGeneric="$out/patched.vim" mkdir $out ${pkgs.perl}/bin/perl -pe "s|\Q$NIX_STORE\E/[a-z0-9]{32}-|$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" < "$vimrc" > "$vimrcGeneric" + ${pkgs.perl}/bin/perl -pe "s|\Q$NIX_STORE\E/[a-z0-9]{32}-|$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" < "$luarc" > "$luarcGeneric" '' + buildCommand); in @@ -89,6 +92,9 @@ rec { nvim_with_plugins = wrapNeovim2 "-with-plugins" nvimConfNix; singlelinesconfig = runTest (wrapNeovim2 "-single-lines" nvimConfSingleLines) '' + assertFileContains \ + "$luarcGeneric" \ + "vim.cmd.source \"/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-init.vim" assertFileContent \ "$vimrcGeneric" \ "${./init-single-lines.vim}" diff --git a/pkgs/applications/editors/neovim/wrapper.nix b/pkgs/applications/editors/neovim/wrapper.nix index d61a2fe5e5a8..48c9c94e8e07 100644 --- a/pkgs/applications/editors/neovim/wrapper.nix +++ b/pkgs/applications/editors/neovim/wrapper.nix @@ -32,13 +32,23 @@ let # set to false if you want to control where to save the generated config # (e.g., in ~/.config/init.vim or project/.nvimrc) , wrapRc ? true - , neovimRcContent ? "" + # vimL code that should be sourced as part of the generated init.lua file + , neovimRcContent ? null + # lua code to put into the generated init.lua file + , luaRcContent ? "" # entry to load in packpath , packpathDirs , ... }: + let + rcContent = '' + ${luaRcContent} + '' + lib.optionalString (!isNull neovimRcContent) '' + vim.cmd.source "${writeText "init.vim" neovimRcContent}" + ''; + wrapperArgsStr = if lib.isString wrapperArgs then wrapperArgs else lib.escapeShellArgs wrapperArgs; commonWrapperArgs = @@ -66,7 +76,7 @@ let finalMakeWrapperArgs = [ "${neovim-unwrapped}/bin/nvim" "${placeholder "out"}/bin/nvim" ] ++ [ "--set" "NVIM_SYSTEM_RPLUGIN_MANIFEST" "${placeholder "out"}/rplugin.vim" ] - ++ lib.optionals wrapRc [ "--add-flags" "-u ${writeText "init.vim" neovimRcContent}" ] + ++ lib.optionals wrapRc [ "--add-flags" "-u ${writeText "init.lua" rcContent}" ] ++ commonWrapperArgs ; @@ -84,6 +94,7 @@ let inherit python3Env rubyEnv; withRuby = rubyEnv != null; inherit wrapperArgs; + luaRcContent = rcContent; # Remove the symlinks created by symlinkJoin which we need to perform # extra actions upon From 032d45b46c6e39a864570628d9f110454dbf4c66 Mon Sep 17 00:00:00 2001 From: Paul-Nicolas Madelaine Date: Wed, 27 Dec 2023 22:20:31 +0100 Subject: [PATCH 16/17] fstar: build with dune (#275924) --- pkgs/development/compilers/fstar/default.nix | 88 ++++++++++---------- pkgs/development/compilers/fstar/dune.nix | 51 ++++++++++++ pkgs/development/compilers/fstar/ulib.nix | 26 ++++++ 3 files changed, 120 insertions(+), 45 deletions(-) create mode 100644 pkgs/development/compilers/fstar/dune.nix create mode 100644 pkgs/development/compilers/fstar/ulib.nix diff --git a/pkgs/development/compilers/fstar/default.nix b/pkgs/development/compilers/fstar/default.nix index 8bb3366655c7..773a0dde281f 100644 --- a/pkgs/development/compilers/fstar/default.nix +++ b/pkgs/development/compilers/fstar/default.nix @@ -1,7 +1,17 @@ -{ lib, stdenv, writeScript, fetchFromGitHub, z3, ocamlPackages, makeWrapper, installShellFiles, removeReferencesTo }: +{ callPackage +, fetchFromGitHub +, installShellFiles +, lib +, makeWrapper +, ocamlPackages +, removeReferencesTo +, stdenv +, writeScript +, z3 +}: + +let -stdenv.mkDerivation rec { - pname = "fstar"; version = "2023.09.03"; src = fetchFromGitHub { @@ -11,66 +21,54 @@ stdenv.mkDerivation rec { hash = "sha256-ymoP5DvaLdrdwJcnhZnLEvwNxUFzhkICajPyK4lvacc="; }; - strictDeps = true; + fstar-dune = ocamlPackages.callPackage ./dune.nix { inherit version src; }; + + fstar-ulib = callPackage ./ulib.nix { inherit version src fstar-dune z3; }; + +in + +stdenv.mkDerivation { + pname = "fstar"; + inherit version src; nativeBuildInputs = [ - z3 - makeWrapper installShellFiles + makeWrapper removeReferencesTo - ] ++ (with ocamlPackages; [ - ocaml - dune_3 - findlib - ocamlbuild - menhir - ]); - - buildInputs = with ocamlPackages; [ - batteries - zarith - stdint - yojson - fileutils - memtrace - menhirLib - pprint - sedlex - ppxlib - ppx_deriving - ppx_deriving_yojson - process ]; - makeFlags = [ "PREFIX=$(out)" ]; + inherit (fstar-dune) propagatedBuildInputs; - enableParallelBuilding = true; + dontBuild = true; - postPatch = '' - patchShebangs ulib/install-ulib.sh - ''; + installPhase = '' + mkdir $out - preInstall = '' - mkdir -p $out/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib/fstarlib - ''; - postInstall = '' - # Remove build artifacts - find $out -name _build -type d | xargs -I{} rm -rf "{}" + CP="cp -r --no-preserve=mode" + $CP ${fstar-dune}/* $out + $CP ${fstar-ulib}/* $out + + PREFIX=$out make -C src/ocaml-output install-sides + + chmod +x $out/bin/fstar.exe + wrapProgram $out/bin/fstar.exe --prefix PATH ":" ${z3}/bin remove-references-to -t '${ocamlPackages.ocaml}' $out/bin/fstar.exe - wrapProgram $out/bin/fstar.exe --prefix PATH ":" "${z3}/bin" + substituteInPlace $out/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib/fstar/dune-package \ + --replace ${fstar-dune} $out + installShellCompletion --bash .completion/bash/fstar.exe.bash installShellCompletion --fish .completion/fish/fstar.exe.fish installShellCompletion --zsh --name _fstar.exe .completion/zsh/__fstar.exe ''; passthru.updateScript = writeScript "update-fstar" '' - #!/usr/bin/env nix-shell - #!nix-shell -i bash -p git gnugrep common-updater-scripts - set -eu -o pipefail + #!/usr/bin/env nix-shell + #!nix-shell -i bash -p git gnugrep common-updater-scripts + set -eu -o pipefail - version="$(git ls-remote --tags git@github.com:FStarLang/FStar.git | grep -Po 'v\K\d{4}\.\d{2}\.\d{2}' | sort | tail -n1)" - update-source-version fstar "$version" + version="$(git ls-remote --tags git@github.com:FStarLang/FStar.git | grep -Po 'v\K\d{4}\.\d{2}\.\d{2}' | sort | tail -n1)" + update-source-version fstar "$version" ''; meta = with lib; { diff --git a/pkgs/development/compilers/fstar/dune.nix b/pkgs/development/compilers/fstar/dune.nix new file mode 100644 index 000000000000..1ca476838c8b --- /dev/null +++ b/pkgs/development/compilers/fstar/dune.nix @@ -0,0 +1,51 @@ +{ batteries +, buildDunePackage +, memtrace +, menhir +, menhirLib +, pprint +, ppx_deriving +, ppx_deriving_yojson +, ppxlib +, process +, sedlex +, src +, stdint +, version +, yojson +, zarith +}: + +buildDunePackage { + pname = "fstar"; + inherit version src; + + postPatch = '' + patchShebangs ocaml/fstar-lib/make_fstar_version.sh + cd ocaml + ''; + + nativeBuildInputs = [ + menhir + ]; + + buildInputs = [ + memtrace + ]; + + propagatedBuildInputs = [ + batteries + menhirLib + pprint + ppx_deriving + ppx_deriving_yojson + ppxlib + process + sedlex + stdint + yojson + zarith + ]; + + enableParallelBuilding = true; +} diff --git a/pkgs/development/compilers/fstar/ulib.nix b/pkgs/development/compilers/fstar/ulib.nix new file mode 100644 index 000000000000..4390a7bdb55e --- /dev/null +++ b/pkgs/development/compilers/fstar/ulib.nix @@ -0,0 +1,26 @@ +{ fstar-dune +, src +, stdenv +, version +, z3 +}: + +stdenv.mkDerivation { + pname = "fstar-ulib"; + inherit version src; + + nativeBuildInputs = [ + z3 + ]; + + postPatch = '' + mkdir -p bin + cp ${fstar-dune}/bin/fstar.exe bin + patchShebangs ulib/install-ulib.sh + cd ulib + ''; + + makeFlags = [ "PREFIX=$(out)" ]; + + enableParallelBuilding = true; +} From 022cbac13d34b6f839b2e2c30837923d8cdab336 Mon Sep 17 00:00:00 2001 From: Matthieu Coudron <886074+teto@users.noreply.github.com> Date: Wed, 22 Nov 2023 00:42:43 +0100 Subject: [PATCH 17/17] neovim: make generated wrapper args overridable especially useful in home-manager to remove the generated options --- pkgs/applications/editors/neovim/wrapper.nix | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/pkgs/applications/editors/neovim/wrapper.nix b/pkgs/applications/editors/neovim/wrapper.nix index 48c9c94e8e07..29146a769843 100644 --- a/pkgs/applications/editors/neovim/wrapper.nix +++ b/pkgs/applications/editors/neovim/wrapper.nix @@ -40,7 +40,9 @@ let , packpathDirs , ... }: + assert withPython2 -> throw "Python2 support has been removed from the neovim wrapper, please remove withPython2 and python2Env."; + stdenv.mkDerivation (finalAttrs: let rcContent = '' @@ -51,7 +53,7 @@ let wrapperArgsStr = if lib.isString wrapperArgs then wrapperArgs else lib.escapeShellArgs wrapperArgs; - commonWrapperArgs = + generatedWrapperArgs = # vim accepts a limited number of commands so we join them all [ "--add-flags" ''--cmd "lua ${providerLuaRc}"'' @@ -76,15 +78,12 @@ let finalMakeWrapperArgs = [ "${neovim-unwrapped}/bin/nvim" "${placeholder "out"}/bin/nvim" ] ++ [ "--set" "NVIM_SYSTEM_RPLUGIN_MANIFEST" "${placeholder "out"}/rplugin.vim" ] - ++ lib.optionals wrapRc [ "--add-flags" "-u ${writeText "init.lua" rcContent}" ] - ++ commonWrapperArgs + ++ lib.optionals finalAttrs.wrapRc [ "--add-flags" "-u ${writeText "init.lua" rcContent}" ] + ++ finalAttrs.generatedWrapperArgs ; perlEnv = perl.withPackages (p: [ p.NeovimExt p.Appcpanminus ]); - in - assert withPython2 -> throw "Python2 support has been removed from the neovim wrapper, please remove withPython2 and python2Env."; - - stdenv.mkDerivation (finalAttrs: { + in { name = "neovim-${lib.getVersion neovim-unwrapped}${extraName}"; __structuredAttrs = true; @@ -93,9 +92,8 @@ let inherit wrapRc providerLuaRc packpathDirs; inherit python3Env rubyEnv; withRuby = rubyEnv != null; - inherit wrapperArgs; + inherit wrapperArgs generatedWrapperArgs; luaRcContent = rcContent; - # Remove the symlinks created by symlinkJoin which we need to perform # extra actions upon postBuild = lib.optionalString stdenv.isLinux '' @@ -123,7 +121,7 @@ let '' + lib.optionalString (manifestRc != null) (let manifestWrapperArgs = - [ "${neovim-unwrapped}/bin/nvim" "${placeholder "out"}/bin/nvim-wrapper" ] ++ commonWrapperArgs; + [ "${neovim-unwrapped}/bin/nvim" "${placeholder "out"}/bin/nvim-wrapper" ] ++ finalAttrs.generatedWrapperArgs; in '' echo "Generating remote plugin manifest" export NVIM_RPLUGIN_MANIFEST=$out/rplugin.vim