···1# Nim {#nim}
23-## Overview {#nim-overview}
4-5-The Nim compiler, a builder function, and some packaged libraries are available
6-in Nixpkgs. Until now each compiler release has been effectively backwards
7-compatible so only the latest version is available.
8-9-## Nim program packages in Nixpkgs {#nim-program-packages-in-nixpkgs}
10-11-Nim programs can be built using `nimPackages.buildNimPackage`. In the
12-case of packages not containing exported library code the attribute
13-`nimBinOnly` should be set to `true`.
1415The following example shows a Nim program that depends only on Nim libraries:
16-17```nix
18-{ lib, nimPackages, fetchFromGitHub }:
1920-nimPackages.buildNimPackage (finalAttrs: {
21 pname = "ttop";
22- version = "1.0.1";
23- nimBinOnly = true;
2425 src = fetchFromGitHub {
26 owner = "inv2004";
27 repo = "ttop";
28 rev = "v${finalAttrs.version}";
29- hash = "sha256-x4Uczksh6p3XX/IMrOFtBxIleVHdAPX9e8n32VAUTC4=";
30 };
3132- buildInputs = with nimPackages; [ asciigraph illwill parsetoml zippy ];
33-34-})
35-```
36-37-## Nim library packages in Nixpkgs {#nim-library-packages-in-nixpkgs}
38-39-40-Nim libraries can also be built using `nimPackages.buildNimPackage`, but
41-often the product of a fetcher is sufficient to satisfy a dependency.
42-The `fetchgit`, `fetchFromGitHub`, and `fetchNimble` functions yield an
43-output that can be discovered during the `configurePhase` of `buildNimPackage`.
4445-Nim library packages are listed in
46-[pkgs/top-level/nim-packages.nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/nim-packages.nix) and implemented at
47-[pkgs/development/nim-packages](https://github.com/NixOS/nixpkgs/tree/master/pkgs/development/nim-packages).
48-49-The following example shows a Nim library that propagates a dependency on a
50-non-Nim package:
51-```nix
52-{ lib, buildNimPackage, fetchNimble, SDL2 }:
53-54-buildNimPackage (finalAttrs: {
55- pname = "sdl2";
56- version = "2.0.4";
57- src = fetchNimble {
58- inherit (finalAttrs) pname version;
59- hash = "sha256-Vtcj8goI4zZPQs2TbFoBFlcR5UqDtOldaXSH/+/xULk=";
60- };
61- propagatedBuildInputs = [ SDL2 ];
62})
63```
6465## `buildNimPackage` parameters {#buildnimpackage-parameters}
6667-All parameters from `stdenv.mkDerivation` function are still supported. The
68-following are specific to `buildNimPackage`:
06970-* `nimBinOnly ? false`: If `true` then build only the programs listed in
71- the Nimble file in the packages sources.
72* `nimbleFile`: Specify the Nimble file location of the package being built
73 rather than discover the file at build-time.
74* `nimRelease ? true`: Build the package in *release* mode.
···77 Use this to specify defines with arguments in the form of `-d:${name}=${value}`.
78* `nimDoc` ? false`: Build and install HTML documentation.
7980-* `buildInputs` ? []: The packages listed here will be searched for `*.nimble`
81- files which are used to populate the Nim library path. Otherwise the standard
82- behavior is in effect.
000000000000000000000000000000000000000000000000000000000000000000
···1# Nim {#nim}
23+The Nim compiler and a builder function is available.
4+Nim programs are built using `buildNimPackage` and a lockfile containing Nim dependencies.
00000000056The following example shows a Nim program that depends only on Nim libraries:
07```nix
8+{ lib, buildNimPackage, fetchFromGitHub }:
910+buildNimPackage { } (finalAttrs: {
11 pname = "ttop";
12+ version = "1.2.7";
01314 src = fetchFromGitHub {
15 owner = "inv2004";
16 repo = "ttop";
17 rev = "v${finalAttrs.version}";
18+ hash = "sha256-oPdaUqh6eN1X5kAYVvevOndkB/xnQng9QVLX9bu5P5E=";
19 };
2021+ lockFile = ./lock.json;
000000000002223+ nimFlags = [
24+ "-d:NimblePkgVersion=${finalAttrs.version}"
25+ ];
0000000000000026})
27```
2829## `buildNimPackage` parameters {#buildnimpackage-parameters}
3031+The `buildNimPackage` function takes an attrset of parameters that are passed on to `stdenv.mkDerivation`.
32+33+The following parameters are specific to `buildNimPackage`:
3435+* `lockFile`: JSON formatted lockfile.
036* `nimbleFile`: Specify the Nimble file location of the package being built
37 rather than discover the file at build-time.
38* `nimRelease ? true`: Build the package in *release* mode.
···41 Use this to specify defines with arguments in the form of `-d:${name}=${value}`.
42* `nimDoc` ? false`: Build and install HTML documentation.
4344+## Lockfiles {#nim-lockfiles}
45+Nim lockfiles are created with the `nim_lk` utility.
46+Run `nim_lk` with the source directory as an argument and it will print a lockfile to stdout.
47+```sh
48+$ cd nixpkgs
49+$ nix build -f . ttop.src
50+$ nix run -f . nim_lk ./result | jq --sort-keys > pkgs/by-name/tt/ttop/lock.json
51+```
52+53+## Lockfile dependency overrides {#nimoverrides}
54+55+The `buildNimPackage` function matches the libraries specified by `lockFile` to attrset of override functions that are then applied to the package derivation.
56+The default overrides are maintained as the top-level `nimOverrides` attrset at `pkgs/top-level/nim-overrides.nix`.
57+58+For example, to propagate a dependency on SDL2 for lockfiles that select the Nim `sdl2` library, an overlay is added to the set in the `nim-overrides.nix` file:
59+```nix
60+{ lib
61+/* … */
62+, SDL2
63+/* … */
64+}:
65+66+{
67+ /* … */
68+ sdl2 =
69+ lockAttrs:
70+ finalAttrs:
71+ { buildInputs ? [ ], ... }:
72+ {
73+ buildInputs = buildInputs ++ [ SDL2 ];
74+ };
75+ /* … */
76+}
77+```
78+79+The annotations in the `nim-overrides.nix` set are functions that take three arguments and return a new attrset to be overlayed on the package being built.
80+- lockAttrs: the attrset for this library from within a lockfile. This can be used to implement library version constraints, such as marking libraries as broken or insecure.
81+- finalAttrs: the final attrset passed by `buildNimPackage` to `stdenv.mkDerivation`.
82+- prevAttrs: the attrset produced by initial arguments to `buildNimPackage` and any preceding lockfile overlays.
83+84+### Overriding an Nim library override {#nimoverrides-overrides}
85+86+The `nimOverrides` attrset makes it possible to modify overrides in a few different ways.
87+88+Override a package internal to its definition:
89+```nix
90+{ lib, buildNimPackage, nimOverrides, libressl }:
91+92+let
93+ buildNimPackage' = buildNimPackage.override {
94+ nimOverrides = nimOverrides.override { openssl = libressl; };
95+ };
96+in buildNimPackage' (finalAttrs: {
97+ pname = "foo";
98+ # …
99+})
100+101+```
102+103+Override a package externally:
104+```nix
105+{ pkgs }: {
106+ foo = pkgs.foo.override {
107+ buildNimPackage = pkgs.buildNimPackage.override {
108+ nimOverrides = pkgs.nimOverrides.override { openssl = libressl; };
109+ };
110+ };
111+}
112+```
+2-1
nixos/doc/manual/release-notes/rl-2311.section.md
···665 designed to be easy and safe to use.
666667 This aims to be a replacement for `lib.sources`-based filtering.
668- To learn more about it, see [the tutorial](https://nix.dev/tutorials/file-sets).
0669670- [`lib.gvariant`](https://nixos.org/manual/nixpkgs/unstable#sec-functions-library-gvariant):
671 A partial and basic implementation of GVariant formatted strings.
···665 designed to be easy and safe to use.
666667 This aims to be a replacement for `lib.sources`-based filtering.
668+ To learn more about it, see [the blog post](https://www.tweag.io/blog/2023-11-28-file-sets/)
669+ or [the tutorial](https://nix.dev/tutorials/file-sets).
670671- [`lib.gvariant`](https://nixos.org/manual/nixpkgs/unstable#sec-functions-library-gvariant):
672 A partial and basic implementation of GVariant formatted strings.
+4-2
nixos/doc/manual/release-notes/rl-2405.section.md
···1415<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
1617-- Create the first release note entry in this section!
1819## Backward Incompatibilities {#sec-release-24.05-incompatibilities}
20···2627<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
2829-- Create the first release note entry in this section!
00
···1415<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
1617+- [maubot](https://github.com/maubot/maubot), a plugin-based Matrix bot framework. Available as [services.maubot](#opt-services.maubot.enable).
1819## Backward Incompatibilities {#sec-release-24.05-incompatibilities}
20···2627<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
2829+- Programs written in [Nim](https://nim-lang.org/) are built with libraries selected by lockfiles.
30+ The `nimPackages` and `nim2Packages` sets have been removed.
31+ See https://nixos.org/manual/nixpkgs/unstable#nim for more information.
+6-3
nixos/modules/installer/tools/tools.nix
···130 '';
131 };
132133- config = lib.mkIf (config.nix.enable && !config.system.disableInstallerTools) {
134135 system.nixos-generate-config.configuration = mkDefault ''
136 # Edit this configuration file to define what should be installed on
···257258 documentation.man.man-db.skipPackages = [ nixos-version ];
2590000260 system.build = {
261 inherit nixos-install nixos-generate-config nixos-option nixos-rebuild nixos-enter;
262 };
263-264- };
265266}
···130 '';
131 };
132133+ config = lib.mkMerge [ (lib.mkIf (config.nix.enable && !config.system.disableInstallerTools) {
134135 system.nixos-generate-config.configuration = mkDefault ''
136 # Edit this configuration file to define what should be installed on
···257258 documentation.man.man-db.skipPackages = [ nixos-version ];
259260+ })
261+262+ # These may be used in auxiliary scripts (ie not part of toplevel), so they are defined unconditionally.
263+ ({
264 system.build = {
265 inherit nixos-install nixos-generate-config nixos-option nixos-rebuild nixos-enter;
266 };
267+ })];
0268269}
···1+# Maubot {#module-services-maubot}
2+3+[Maubot](https://github.com/maubot/maubot) is a plugin-based bot
4+framework for Matrix.
5+6+## Configuration {#module-services-maubot-configuration}
7+8+1. Set [](#opt-services.maubot.enable) to `true`. The service will use
9+ SQLite by default.
10+2. If you want to use PostgreSQL instead of SQLite, do this:
11+12+ ```nix
13+ services.maubot.settings.database = "postgresql://maubot@localhost/maubot";
14+ ```
15+16+ If the PostgreSQL connection requires a password, you will have to
17+ add it later on step 8.
18+3. If you plan to expose your Maubot interface to the web, do something
19+ like this:
20+ ```nix
21+ services.nginx.virtualHosts."matrix.example.org".locations = {
22+ "/_matrix/maubot/" = {
23+ proxyPass = "http://127.0.0.1:${toString config.services.maubot.settings.server.port}";
24+ proxyWebsockets = true;
25+ };
26+ };
27+ services.maubot.settings.server.public_url = "matrix.example.org";
28+ # do the following only if you want to use something other than /_matrix/maubot...
29+ services.maubot.settings.server.ui_base_path = "/another/base/path";
30+ ```
31+4. Optionally, set `services.maubot.pythonPackages` to a list of python3
32+ packages to make available for Maubot plugins.
33+5. Optionally, set `services.maubot.plugins` to a list of Maubot
34+ plugins (full list available at https://plugins.maubot.xyz/):
35+ ```nix
36+ services.maubot.plugins = with config.services.maubot.package.plugins; [
37+ reactbot
38+ # This will only change the default config! After you create a
39+ # plugin instance, the default config will be copied into that
40+ # instance's config in Maubot's database, and further base config
41+ # changes won't affect the running plugin.
42+ (rss.override {
43+ base_config = {
44+ update_interval = 60;
45+ max_backoff = 7200;
46+ spam_sleep = 2;
47+ command_prefix = "rss";
48+ admins = [ "@chayleaf:pavluk.org" ];
49+ };
50+ })
51+ ];
52+ # ...or...
53+ services.maubot.plugins = config.services.maubot.package.plugins.allOfficialPlugins;
54+ # ...or...
55+ services.maubot.plugins = config.services.maubot.package.plugins.allPlugins;
56+ # ...or...
57+ services.maubot.plugins = with config.services.maubot.package.plugins; [
58+ (weather.override {
59+ # you can pass base_config as a string
60+ base_config = ''
61+ default_location: New York
62+ default_units: M
63+ default_language:
64+ show_link: true
65+ show_image: false
66+ '';
67+ })
68+ ];
69+ ```
70+6. Start Maubot at least once before doing the following steps (it's
71+ necessary to generate the initial config).
72+7. If your PostgreSQL connection requires a password, add
73+ `database: postgresql://user:password@localhost/maubot`
74+ to `/var/lib/maubot/config.yaml`. This overrides the Nix-provided
75+ config. Even then, don't remove the `database` line from Nix config
76+ so the module knows you use PostgreSQL!
77+8. To create a user account for logging into Maubot web UI and
78+ configuring it, generate a password using the shell command
79+ `mkpasswd -R 12 -m bcrypt`, and edit `/var/lib/maubot/config.yaml`
80+ with the following:
81+82+ ```yaml
83+ admins:
84+ admin_username: $2b$12$g.oIStUeUCvI58ebYoVMtO/vb9QZJo81PsmVOomHiNCFbh0dJpZVa
85+ ```
86+87+ Where `admin_username` is your username, and `$2b...` is the bcrypted
88+ password.
89+9. Optional: if you want to be able to register new users with the
90+ Maubot CLI (`mbc`), and your homeserver is private, add your
91+ homeserver's registration key to `/var/lib/maubot/config.yaml`:
92+93+ ```yaml
94+ homeservers:
95+ matrix.example.org:
96+ url: https://matrix.example.org
97+ secret: your-very-secret-key
98+ ```
99+10. Restart Maubot after editing `/var/lib/maubot/config.yaml`,and
100+ Maubot will be available at
101+ `https://matrix.example.org/_matrix/maubot`. If you want to use the
102+ `mbc` CLI, it's available using the `maubot` package (`nix-shell -p
103+ maubot`).
···23buildNpmPackage rec {
4 pname = "asf-ui";
5- version = "fceb2fb828cfa420c77dc5cde433fd519a6717d4";
67 src = fetchFromGitHub {
8 owner = "JustArchiNET";
···10 # updated by the update script
11 # this is always the commit that should be used with asf-ui from the latest asf version
12 rev = version;
13- hash = "sha256-gMQWly7HN5rIV9r72Qa+gHuBuQMs9sh09od4ja4sRGU=";
14 };
1516- npmDepsHash = "sha256-UDCQTRpcPDcuvPzlqTu315EkGr5G0+z7qMSsPgYQacA=";
1718 installPhase = ''
19 runHook preInstall
···23buildNpmPackage rec {
4 pname = "asf-ui";
5+ version = "c582499d60f0726b6ec7f0fd27bd533c1f67b937";
67 src = fetchFromGitHub {
8 owner = "JustArchiNET";
···10 # updated by the update script
11 # this is always the commit that should be used with asf-ui from the latest asf version
12 rev = version;
13+ hash = "sha256-dTSYlswMWWRafieWqNDIi3qCBvNAkcmZWKhQgJiv2Ts=";
14 };
1516+ npmDepsHash = "sha256-0zzP1z3VO9Y4gBWJ+T7oHhKE/H2dzMUMg71BKupVcH4=";
1718 installPhase = ''
19 runHook preInstall
···30 meta = with lib; {
31 description = "A program that reformats Kotlin source code to comply with the common community standard for Kotlin code conventions.";
32 homepage = "https://github.com/facebook/ktfmt";
33- license = licenses.apsl20;
34 mainProgram = "ktfmt";
35 maintainers = with maintainers; [ ghostbuster91 ];
36 inherit (jre_headless.meta) platforms;
···30 meta = with lib; {
31 description = "A program that reformats Kotlin source code to comply with the common community standard for Kotlin code conventions.";
32 homepage = "https://github.com/facebook/ktfmt";
33+ license = licenses.asl20;
34 mainProgram = "ktfmt";
35 maintainers = with maintainers; [ ghostbuster91 ];
36 inherit (jre_headless.meta) platforms;
···120 export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 # Dont try to expand NuGetFallbackFolder to disk
121 export DOTNET_NOLOGO=1 # Disables the welcome message
122 export DOTNET_CLI_TELEMETRY_OPTOUT=1
0123 '';
124125 passthru = {
···147 nativeBuildInputs = [ finalAttrs.finalPackage ];
148 } ''
149 HOME=$(pwd)/fake-home
150- dotnet new console
151- dotnet build
152- output="$(dotnet run)"
0153 # yes, older SDKs omit the comma
154 [[ "$output" =~ Hello,?\ World! ]] && touch "$out"
155 '';
···120 export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 # Dont try to expand NuGetFallbackFolder to disk
121 export DOTNET_NOLOGO=1 # Disables the welcome message
122 export DOTNET_CLI_TELEMETRY_OPTOUT=1
123+ export DOTNET_SKIP_WORKLOAD_INTEGRITY_CHECK=1 # Skip integrity check on first run, which fails due to read-only directory
124 '';
125126 passthru = {
···148 nativeBuildInputs = [ finalAttrs.finalPackage ];
149 } ''
150 HOME=$(pwd)/fake-home
151+ dotnet new console --no-restore
152+ dotnet restore --source "$(mktemp -d)"
153+ dotnet build --no-restore
154+ output="$(dotnet run --no-build)"
155 # yes, older SDKs omit the comma
156 [[ "$output" =~ Hello,?\ World! ]] && touch "$out"
157 '';
+1-2
pkgs/development/compilers/dotnet/update.sh
···255 "Microsoft.NETCore.App.Crossgen2.osx-arm64"
256 )
257258- # These packages are currently broken on .NET 8
259- # When .NET 8 officialy launches, these should be checked and added back if fixed
260 if version_older "$version" "8"; then
261 pkgs+=( \
262 "Microsoft.NETCore.App.Host.win-arm" \
···255 "Microsoft.NETCore.App.Crossgen2.osx-arm64"
256 )
257258+ # These packages were removed on .NET 8
0259 if version_older "$version" "8"; then
260 pkgs+=( \
261 "Microsoft.NETCore.App.Host.win-arm" \
···1-From 880fe5653a86d8091f3f577977f8af93552c48fd 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 05/11] qtbase: deal with a font face at index 0 as Regular for
5 Variable fonts
67Reference: https://bugreports.qt.io/browse/QTBUG-111994
···1+From 82e243f326aea40e7f3da935d8166979b11e8063 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 04/11] qtbase: deal with a font face at index 0 as Regular for
5 Variable fonts
67Reference: https://bugreports.qt.io/browse/QTBUG-111994
···1-From 7f573f00fb850a08017d9f1e3c73b4d7efeb84f2 Mon Sep 17 00:00:00 2001
2From: Nick Cao <nickcao@nichi.co>
3Date: Wed, 12 Apr 2023 10:13:50 +0800
4-Subject: [PATCH 06/11] qtbase: qt-cmake: always use cmake from path
56The generated qt-cmake scripts embeds the absolute path of cmake used
7during the build of qtbase, bloating the runtime closure of qtbase.
···1+From b480022b364b262d5ff63738c02318da925f5c79 Mon Sep 17 00:00:00 2001
2From: Nick Cao <nickcao@nichi.co>
3Date: Wed, 12 Apr 2023 10:13:50 +0800
4+Subject: [PATCH 05/11] qtbase: qt-cmake: always use cmake from path
56The generated qt-cmake scripts embeds the absolute path of cmake used
7during the build of qtbase, bloating the runtime closure of qtbase.
···23stdenv.mkDerivation rec {
4 pname = "tdlib";
5- version = "1.8.19";
67 src = fetchFromGitHub {
8 owner = "tdlib";
···11 # The tdlib authors do not set tags for minor versions, but
12 # external programs depending on tdlib constrain the minor
13 # version, hence we set a specific commit with a known version.
14- rev = "2589c3fd46925f5d57e4ec79233cd1bd0f5d0c09";
15- hash = "sha256-mbhxuJjrV3nC8Ja7N0WWF9ByHovJLmoLLuuzoU4khjU=";
16 };
1718 buildInputs = [ gperf openssl readline zlib ];
···23stdenv.mkDerivation rec {
4 pname = "tdlib";
5+ version = "1.8.21";
67 src = fetchFromGitHub {
8 owner = "tdlib";
···11 # The tdlib authors do not set tags for minor versions, but
12 # external programs depending on tdlib constrain the minor
13 # version, hence we set a specific commit with a known version.
14+ rev = "3870c29b158b75ca5e48e0eebd6b5c3a7994a000";
15+ hash = "sha256-MCzgovcEZa34ZkwbbwfXHm2qitHwL2Tpr8p7+PxNhYk=";
16 };
1718 buildInputs = [ gperf openssl readline zlib ];
···133 if err != 0: quit("build phase failed", err)
134135proc installPhase*() =
136- ## Install the Nim sources if ``nimBinOnly`` is not
137 ## set in the environment.
138- if not getEnvBool"nimBinOnly":
139 let
140 nf = getNimbleFilePath()
141 srcDir = nf.getNimbleValue("srcDir", ".")
···133 if err != 0: quit("build phase failed", err)
134135proc installPhase*() =
136+ ## Install the Nim sources if ``nimCopySources`` is
137 ## set in the environment.
138+ if getEnvBool"nimCopySources":
139 let
140 nf = getNimbleFilePath()
141 srcDir = nf.getNimbleValue("srcDir", ".")
···1+Do not use vendored libraries
2+3+--- a/vendor/CMakeLists.txt
4++++ b/vendor/CMakeLists.txt
5+@@ -14,10 +14,7 @@
6+ # License along with this library; if not, write to the Free Software
7+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
8+9+ add_subdirectory(onigmo)
10+-add_subdirectory(mruby)
11+-add_subdirectory(mecab)
12+-add_subdirectory(message_pack)
13+ if(GRN_WITH_MRUBY)
14+ add_subdirectory(groonga-log)
15+ endif()
···589 monero = monero-cli; # Added 2021-11-28
590 mongodb-4_0 = throw "mongodb-4_0 has been removed, it's end of life since April 2022"; # Added 2023-01-05
591 mongodb-4_2 = throw "mongodb-4_2 has been removed, it's end of life since April 2023"; # Added 2023-06-06
592-593 moz-phab = mozphab; # Added 2022-08-09
594 mozart-binary = throw "'mozart-binary' has been renamed to/replaced by 'mozart2-binary'"; # Converted to throw 2023-09-10
595 mozart = throw "'mozart' has been renamed to/replaced by 'mozart2-binary'"; # Converted to throw 2023-09-10
···589 monero = monero-cli; # Added 2021-11-28
590 mongodb-4_0 = throw "mongodb-4_0 has been removed, it's end of life since April 2022"; # Added 2023-01-05
591 mongodb-4_2 = throw "mongodb-4_2 has been removed, it's end of life since April 2023"; # Added 2023-06-06
592+ moonlander = throw "'moonlander' has been removed due to it being broken and unmaintained"; # Added 2023-11-26
593 moz-phab = mozphab; # Added 2022-08-09
594 mozart-binary = throw "'mozart-binary' has been renamed to/replaced by 'mozart2-binary'"; # Converted to throw 2023-09-10
595 mozart = throw "'mozart' has been renamed to/replaced by 'mozart2-binary'"; # Converted to throw 2023-09-10