···129### Packaging a library on luarocks {#packaging-a-library-on-luarocks}
130131[Luarocks.org](https://luarocks.org/) is the main repository of lua packages.
132-The site proposes two types of packages, the rockspec and the src.rock
133(equivalent of a [rockspec](https://github.com/luarocks/luarocks/wiki/Rockspec-format) but with the source).
134-These packages can have different build types such as `cmake`, `builtin` etc .
0000135136-Luarocks-based packages are generated in pkgs/development/lua-modules/generated-packages.nix from
137-the whitelist maintainers/scripts/luarocks-packages.csv and updated by running maintainers/scripts/update-luarocks-packages.
0138139[luarocks2nix](https://github.com/nix-community/luarocks) is a tool capable of generating nix derivations from both rockspec and src.rock (and favors the src.rock).
140The automation only goes so far though and some packages need to be customized.
141-These customizations go in `pkgs/development/lua-modules/overrides.nix`.
142For instance if the rockspec defines `external_dependencies`, these need to be manually added to the overrides.nix.
143144You can try converting luarocks packages to nix packages with the command `nix-shell -p luarocks-nix` and then `luarocks nix PKG_NAME`.
···129### Packaging a library on luarocks {#packaging-a-library-on-luarocks}
130131[Luarocks.org](https://luarocks.org/) is the main repository of lua packages.
132+The site proposes two types of packages, the `rockspec` and the `src.rock`
133(equivalent of a [rockspec](https://github.com/luarocks/luarocks/wiki/Rockspec-format) but with the source).
134+135+Luarocks-based packages are generated in [pkgs/development/lua-modules/generated-packages.nix](https://github.com/NixOS/nixpkgs/tree/master/pkgs/development/lua-modules/generated-packages.nix) from
136+the whitelist maintainers/scripts/luarocks-packages.csv and updated by running
137+the script
138+[maintainers/scripts/update-luarocks-packages](https://github.com/NixOS/nixpkgs/tree/master/maintainers/scripts/update-luarocks-packages):
139140+```sh
141+./maintainers/scripts/update-luarocks-packages update
142+```
143144[luarocks2nix](https://github.com/nix-community/luarocks) is a tool capable of generating nix derivations from both rockspec and src.rock (and favors the src.rock).
145The automation only goes so far though and some packages need to be customized.
146+These customizations go in [pkgs/development/lua-modules/overrides.nix](https://github.com/NixOS/nixpkgs/tree/master/pkgs/development/lua-modules/overrides.nix).
147For instance if the rockspec defines `external_dependencies`, these need to be manually added to the overrides.nix.
148149You can try converting luarocks packages to nix packages with the command `nix-shell -p luarocks-nix` and then `luarocks nix PKG_NAME`.
+2-2
doc/languages-frameworks/vim.section.md
···212213## Adding new plugins to nixpkgs {#adding-new-plugins-to-nixpkgs}
214215-Nix expressions for Vim plugins are stored in [pkgs/applications/editors/vim/plugins](https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/editors/vim/plugins). For the vast majority of plugins, Nix expressions are automatically generated by running [`./update.py`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/update.py). This creates a [generated.nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/generated.nix) file based on the plugins listed in [vim-plugin-names](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/vim-plugin-names). Plugins are listed in alphabetical order in `vim-plugin-names` using the format `[github username]/[repository]@[gitref]`. For example https://github.com/scrooloose/nerdtree becomes `scrooloose/nerdtree`.
216217After running `./update.py`, if nvim-treesitter received an update, also run [`nvim-treesitter/update.py`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/update.py) to update the tree sitter grammars for `nvim-treesitter`.
218···226227Sometimes plugins require an override that must be changed when the plugin is updated. This can cause issues when Vim plugins are auto-updated but the associated override isn't updated. For these plugins, the override should be written so that it specifies all information required to install the plugin, and running `./update.py` doesn't change the derivation for the plugin. Manually updating the override is required to update these types of plugins. An example of such a plugin is `LanguageClient-neovim`.
228229-To add a new plugin, run `./update.py --add "[owner]/[name]"`. **NOTE**: This script automatically commits to your git repository. Be sure to check out a fresh branch before running.
230231Finally, there are some plugins that are also packaged in nodePackages because they have Javascript-related build steps, such as running webpack. Those plugins are not listed in `vim-plugin-names` or managed by `update.py` at all, and are included separately in `overrides.nix`. Currently, all these plugins are related to the `coc.nvim` ecosystem of the Language Server Protocol integration with Vim/Neovim.
232
···212213## Adding new plugins to nixpkgs {#adding-new-plugins-to-nixpkgs}
214215+Nix expressions for Vim plugins are stored in [pkgs/applications/editors/vim/plugins](https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/editors/vim/plugins). For the vast majority of plugins, Nix expressions are automatically generated by running [`./update.py`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/update.py). This creates a [generated.nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/generated.nix) file based on the plugins listed in [vim-plugin-names](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/vim-plugin-names).
216217After running `./update.py`, if nvim-treesitter received an update, also run [`nvim-treesitter/update.py`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/editors/vim/plugins/update.py) to update the tree sitter grammars for `nvim-treesitter`.
218···226227Sometimes plugins require an override that must be changed when the plugin is updated. This can cause issues when Vim plugins are auto-updated but the associated override isn't updated. For these plugins, the override should be written so that it specifies all information required to install the plugin, and running `./update.py` doesn't change the derivation for the plugin. Manually updating the override is required to update these types of plugins. An example of such a plugin is `LanguageClient-neovim`.
228229+To add a new plugin, run `./update.py add "[owner]/[name]"`. **NOTE**: This script automatically commits to your git repository. Be sure to check out a fresh branch before running.
230231Finally, there are some plugins that are also packaged in nodePackages because they have Javascript-related build steps, such as running webpack. Those plugins are not listed in `vim-plugin-names` or managed by `update.py` at all, and are included separately in `overrides.nix`. Currently, all these plugins are related to the `coc.nvim` ecosystem of the Language Server Protocol integration with Vim/Neovim.
232
···1011 {
12 imports = [ ./common/user-account.nix ];
00013 services.cage = {
14 enable = true;
15 user = "alice";
16- # Disable color and bold and use a larger font to make OCR easier:
17- program = "${pkgs.xterm}/bin/xterm -cm -pc -fa Monospace -fs 24";
18 };
1920 # Need to switch to a different GPU driver than the default one (-vga std) so that Cage can launch:
···1011 {
12 imports = [ ./common/user-account.nix ];
13+14+ fonts.fonts = with pkgs; [ dejavu_fonts ];
15+16 services.cage = {
17 enable = true;
18 user = "alice";
19+ program = "${pkgs.xterm}/bin/xterm";
020 };
2122 # Need to switch to a different GPU driver than the default one (-vga std) so that Cage can launch:
···6#
7fixQtModulePaths() {
8 local dir="$1"
9- local bin="${!outputBin}"
10- local dev="${!outputDev}"
11 local lib="${!outputLib}"
1213 if [ -d "$dir" ]; then
···17 sed -i "${pr:?}" \
18 -e "s|\\\$\\\$QT_MODULE_LIB_BASE|$lib/lib|g" \
19 -e "s|\\\$\\\$QT_MODULE_HOST_LIB_BASE|$lib/lib|g" \
20- -e "s|\\\$\\\$QT_MODULE_INCLUDE_BASE|$dev/include|g" \
21- -e "s|\\\$\\\$QT_MODULE_BIN_BASE|$dev/bin|g"
22 fi
23 done
24 elif [ -e "$dir" ]; then
25 echo "fixQtModulePaths: Warning: \`$dir' is not a directory"
26 else
27 echo "fixQtModulePaths: Warning: \`$dir' does not exist"
28- fi
29-30- if [ "z$bin" != "z$dev" ]; then
31- if [ -d "$bin/bin" ]; then
32- mkdir -p "$dev/bin"
33- lndir -silent "$bin/bin" "$dev/bin"
34- fi
35 fi
36}
···6#
7fixQtModulePaths() {
8 local dir="$1"
009 local lib="${!outputLib}"
1011 if [ -d "$dir" ]; then
···15 sed -i "${pr:?}" \
16 -e "s|\\\$\\\$QT_MODULE_LIB_BASE|$lib/lib|g" \
17 -e "s|\\\$\\\$QT_MODULE_HOST_LIB_BASE|$lib/lib|g" \
18+ -e "s|\\\$\\\$QT_MODULE_INCLUDE_BASE|$lib/include|g" \
19+ -e "s|\\\$\\\$QT_MODULE_BIN_BASE|$lib/bin|g"
20 fi
21 done
22 elif [ -e "$dir" ]; then
23 echo "fixQtModulePaths: Warning: \`$dir' is not a directory"
24 else
25 echo "fixQtModulePaths: Warning: \`$dir' does not exist"
000000026 fi
27}
···1-updateToolPath() {
2- local tool="$1"
3- local target="$2"
4- local original="${!outputBin}/$tool"
5- local actual="${!outputDev}/$tool"
6- if grep -q "$original" "$target"; then
7- echo "updateToolPath: Updating \`$original' in \`$target\'..."
8- sed -i "$target" -e "s|$original|$actual|"
9- fi
10-}
11-12-moveQtDevTools() {
13- if [ -n "$devTools" ]; then
14- for tool in $devTools; do
15- moveToOutput "$tool" "${!outputDev}"
16- done
17-18- if [ -d "${!outputDev}/mkspecs" ]; then
19- find "${!outputDev}/mkspecs" -name '*.pr?' | while read pr_; do
20- for tool in $devTools; do
21- updateToolPath "$tool" "$pr_"
22- done
23- done
24- fi
25-26- if [ -d "${!outputDev}/lib/cmake" ]; then
27- find "${!outputDev}/lib/cmake" -name '*.cmake' | while read cmake; do
28- for tool in $devTools; do
29- updateToolPath "$tool" "$cmake"
30- done
31- done
32- fi
33- fi
34-}
···1if [[ -n "${__nix_qtbase-}" ]]; then
2 # Throw an error if a different version of Qt was already set up.
3- if [[ "$__nix_qtbase" != "@dev@" ]]; then
4 echo >&2 "Error: detected mismatched Qt dependencies:"
5- echo >&2 " @dev@"
6 echo >&2 " $__nix_qtbase"
7 exit 1
8 fi
9else # Only set up Qt once.
10- __nix_qtbase="@dev@"
1112 qtPluginPrefix=@qtPluginPrefix@
13 qtQmlPrefix=@qtQmlPrefix@
···30 fi
3132 # Build tools are often confused if QMAKE is unset.
33- export QMAKE=@dev@/bin/qmake
3435 export QMAKEPATH=
36···53 # Prevent this hook from running multiple times
54 dontPatchMkspecs=1
5556- local bin="${!outputBin}"
57- local dev="${!outputDev}"
58- local doc="${!outputDoc}"
59 local lib="${!outputLib}"
6061- moveToOutput "mkspecs" "$dev"
62- moveToOutput "modules" "$dev"
63- moveToOutput "lib/*.prl" "$dev"
64-65- if [ -d "$dev/mkspecs/modules" ]; then
66- fixQtModulePaths "$dev/mkspecs/modules"
67 fi
6869- if [ -d "$dev/mkspecs" ]; then
70- fixQtBuiltinPaths "$dev/mkspecs" '*.pr?'
71 fi
7273- if [ -d "$dev/lib" ]; then
74- fixQtBuiltinPaths "$dev/lib" '*.pr?'
75 fi
76 }
77 if [ -z "${dontPatchMkspecs-}" ]; then
···1if [[ -n "${__nix_qtbase-}" ]]; then
2 # Throw an error if a different version of Qt was already set up.
3+ if [[ "$__nix_qtbase" != "@out@" ]]; then
4 echo >&2 "Error: detected mismatched Qt dependencies:"
5+ echo >&2 " @out@"
6 echo >&2 " $__nix_qtbase"
7 exit 1
8 fi
9else # Only set up Qt once.
10+ __nix_qtbase="@out@"
1112 qtPluginPrefix=@qtPluginPrefix@
13 qtQmlPrefix=@qtQmlPrefix@
···30 fi
3132 # Build tools are often confused if QMAKE is unset.
33+ export QMAKE=@out@/bin/qmake
3435 export QMAKEPATH=
36···53 # Prevent this hook from running multiple times
54 dontPatchMkspecs=1
5500056 local lib="${!outputLib}"
5758+ if [ -d "$lib/mkspecs/modules" ]; then
59+ fixQtModulePaths "$lib/mkspecs/modules"
000060 fi
6162+ if [ -d "$lib/mkspecs" ]; then
63+ fixQtBuiltinPaths "$lib/mkspecs" '*.pr?'
64 fi
6566+ if [ -d "$lib/lib" ]; then
67+ fixQtBuiltinPaths "$lib/lib" '*.pr?'
68 fi
69 }
70 if [ -z "${dontPatchMkspecs-}" ]; then
···1-From 9ba9c690fb16188ff524b53def104e68e45cf5c3 Mon Sep 17 00:00:00 2001
2From: Nick Cao <nickcao@nichi.co>
3Date: Tue, 21 Mar 2023 15:48:49 +0800
4-Subject: [PATCH] Deal with a font face at index 0 as Regular for Variable
5- fonts
67Reference: https://bugreports.qt.io/browse/QTBUG-111994
8---
···1+From 5bd3672c7870b2e46e2a734dc9a9cb1837375a1c Mon Sep 17 00:00:00 2001
2From: Nick Cao <nickcao@nichi.co>
3Date: Tue, 21 Mar 2023 15:48:49 +0800
4+Subject: [PATCH 5/6] qtbase: deal with a font face at index 0 as Regular for
5+ Variable fonts
67Reference: https://bugreports.qt.io/browse/QTBUG-111994
8---
···34 '';
3536 meta = with lib; {
37- inherit (src.homepage);
38 description = "A FUSE-based filesystem that uses the p7zip library";
39 longDescription = ''
40 fuse-7z-ng is a FUSE file system that uses the p7zip
···34 '';
3536 meta = with lib; {
37+ inherit (src.meta) homepage;
38 description = "A FUSE-based filesystem that uses the p7zip library";
39 longDescription = ''
40 fuse-7z-ng is a FUSE file system that uses the p7zip
+1-1
pkgs/tools/inputmethods/fcitx5/fcitx5-qt.nix
···3132 cmakeFlags = [
33 # adding qt6 to buildInputs would result in error: detected mismatched Qt dependencies
34- "-DCMAKE_PREFIX_PATH=${qt6.qtbase.dev}"
35 "-DENABLE_QT4=0"
36 "-DENABLE_QT6=1"
37 ];
···3132 cmakeFlags = [
33 # adding qt6 to buildInputs would result in error: detected mismatched Qt dependencies
34+ "-DCMAKE_PREFIX_PATH=${qt6.qtbase}"
35 "-DENABLE_QT4=0"
36 "-DENABLE_QT6=1"
37 ];