Skip to content

Commit f3583fa

Browse files
committed
Merge branch 'master' into haskell-updates
2 parents 0d8a0ce + dfd48ce commit f3583fa

File tree

202 files changed

+5813
-6107
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+5813
-6107
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ For new packages please briefly describe the package or provide a link to its ho
2121
- [NixOS test(s)](https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests) (look inside [nixos/tests](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests))
2222
- and/or [package tests](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#package-tests)
2323
- or, for functions and "core" functionality, tests in [lib/tests](https://github.com/NixOS/nixpkgs/blob/master/lib/tests) or [pkgs/test](https://github.com/NixOS/nixpkgs/blob/master/pkgs/test)
24-
- made sure NixOS tests are [linked](https://nixos.org/manual/nixpkgs/unstable/#ssec-nixos-tests-linking) to the relevant packages
24+
- made sure NixOS tests are [linked](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#linking-nixos-module-tests-to-a-package) to the relevant packages
2525
- [ ] Tested compilation of all packages that depend on this change using `nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"`. Note: all changes have to be committed, also see [nixpkgs-review usage](https://github.com/Mic92/nixpkgs-review#usage)
2626
- [ ] Tested basic functionality of all binary files (usually in `./result/bin/`)
2727
- [24.11 Release Notes](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2411.section.md) (or backporting [23.11](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2311.section.md) and [24.05](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2405.section.md) Release notes)

doc/build-helpers/trivial-build-helpers.chapter.md

Lines changed: 115 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,122 @@
33
Nixpkgs provides a variety of wrapper functions that help build commonly useful derivations.
44
Like [`stdenv.mkDerivation`](#sec-using-stdenv), each of these build helpers creates a derivation, but the arguments passed are different (usually simpler) from those required by `stdenv.mkDerivation`.
55

6-
## `runCommand` {#trivial-builder-runCommand}
76

8-
`runCommand :: String -> AttrSet -> String -> Derivation`
7+
## `runCommandWith` {#trivial-builder-runCommandWith}
98

10-
The result of `runCommand name drvAttrs buildCommand` is a derivation that is built by running the specified shell commands.
9+
The function `runCommandWith` returns a derivation built using the specified command(s), in a specified environment.
1110

12-
By default `runCommand` runs in a stdenv with no compiler environment, whereas [`runCommandCC`](#trivial-builder-runCommandCC) uses the default stdenv, `pkgs.stdenv`.
11+
It is the underlying base function of all [`runCommand*` variants].
12+
The general behavior is controlled via a single attribute set passed
13+
as the first argument, and allows specifying `stdenv` freely.
1314

14-
`name :: String`
15-
: The name that Nix will append to the store path in the same way that `stdenv.mkDerivation` uses its `name` attribute.
15+
The following [`runCommand*` variants] exist: `runCommand`, `runCommandCC`, and `runCommandLocal`.
1616

17-
`drvAttr :: AttrSet`
18-
: Attributes to pass to the underlying call to [`stdenv.mkDerivation`](#chap-stdenv).
17+
[`runCommand*` variants]: #trivial-builder-runCommand
1918

20-
`buildCommand :: String`
19+
### Type {#trivial-builder-runCommandWith-Type}
20+
21+
```
22+
runCommandWith :: {
23+
name :: name;
24+
stdenv? :: Derivation;
25+
runLocal? :: Bool;
26+
derivationArgs? :: { ... };
27+
} -> String -> Derivation
28+
```
29+
30+
### Inputs {#trivial-builder-runCommandWith-Inputs}
31+
32+
`name` (String)
33+
: The derivation's name, which Nix will append to the store path; see [`mkDerivation`](#sec-using-stdenv).
34+
35+
`runLocal` (Boolean)
36+
: If set to `true` this forces the derivation to be built locally, not using [substitutes] nor remote builds.
37+
This is intended for very cheap commands (<1s execution time) which can be sped up by avoiding the network round-trip(s).
38+
Its effect is to set [`preferLocalBuild = true`][preferLocalBuild] and [`allowSubstitutes = false`][allowSubstitutes].
39+
40+
::: {.note}
41+
This prevents the use of [substituters][substituter], so only set `runLocal` (or use `runCommandLocal`) when certain the user will
42+
always have a builder for the `system` of the derivation. This should be true for most trivial use cases
43+
(e.g., just copying some files to a different location or adding symlinks) because there the `system`
44+
is usually the same as `builtins.currentSystem`.
45+
:::
46+
47+
`stdenv` (Derivation)
48+
: The [standard environment](#chap-stdenv) to use, defaulting to `pkgs.stdenv`
49+
50+
`derivationArgs` (Attribute set)
51+
: Additional arguments for [`mkDerivation`](#sec-using-stdenv).
52+
53+
`buildCommand` (String)
2154
: Shell commands to run in the derivation builder.
2255

2356
::: {.note}
2457
You have to create a file or directory `$out` for Nix to be able to run the builder successfully.
2558
:::
2659

60+
[allowSubstitutes]: https://nixos.org/nix/manual/#adv-attr-allowSubstitutes
61+
[preferLocalBuild]: https://nixos.org/nix/manual/#adv-attr-preferLocalBuild
62+
[substituter]: https://nix.dev/manual/nix/latest/glossary#gloss-substituter
63+
[substitutes]: https://nix.dev/manual/nix/2.23/glossary#gloss-substitute
64+
65+
::: {.example #ex-runcommandwith}
66+
# Invocation of `runCommandWith`
67+
68+
```nix
69+
runCommandWith {
70+
name = "example";
71+
derivationArgs.nativeBuildInputs = [ cowsay ];
72+
} ''
73+
cowsay > $out <<EOMOO
74+
'runCommandWith' is a bit cumbersome,
75+
so we have more ergonomic wrappers.
76+
EOMOO
77+
''
78+
```
79+
80+
:::
81+
82+
83+
## `runCommand` and `runCommandCC` {#trivial-builder-runCommand}
84+
85+
The function `runCommand` returns a derivation built using the specified command(s), in the `stdenvNoCC` environment.
86+
87+
`runCommandCC` is similar but uses the default compiler environment. To minimize dependencies, `runCommandCC`
88+
should only be used when the build command needs a C compiler.
89+
90+
`runCommandLocal` is also similar to `runCommand`, but forces the derivation to be built locally.
91+
See the note on [`runCommandWith`] about `runLocal`.
92+
93+
[`runCommandWith`]: #trivial-builder-runCommandWith
94+
95+
### Type {#trivial-builder-runCommand-Type}
96+
97+
```
98+
runCommand :: String -> AttrSet -> String -> Derivation
99+
runCommandCC :: String -> AttrSet -> String -> Derivation
100+
runCommandLocal :: String -> AttrSet -> String -> Derivation
101+
```
102+
103+
### Input {#trivial-builder-runCommand-Input}
104+
105+
While the type signature(s) differ from [`runCommandWith`], individual arguments with the same name will have the same type and meaning:
106+
107+
`name` (String)
108+
: The derivation's name
109+
110+
`derivationArgs` (Attribute set)
111+
: Additional parameters passed to [`mkDerivation`]
112+
113+
`buildCommand` (String)
114+
: The command(s) run to build the derivation.
115+
116+
27117
::: {.example #ex-runcommand-simple}
28118
# Invocation of `runCommand`
29119

30120
```nix
31-
(import <nixpkgs> {}).runCommand "my-example" {} ''
121+
runCommand "my-example" {} ''
32122
echo My example command is running
33123
34124
mkdir $out
@@ -49,18 +139,24 @@ By default `runCommand` runs in a stdenv with no compiler environment, whereas [
49139
```
50140
:::
51141

52-
## `runCommandCC` {#trivial-builder-runCommandCC}
53-
54-
This works just like `runCommand`. The only difference is that it also provides a C compiler in `buildCommand`'s environment. To minimize your dependencies, you should only use this if you are sure you will need a C compiler as part of running your command.
55-
56-
## `runCommandLocal` {#trivial-builder-runCommandLocal}
57-
58-
Variant of `runCommand` that forces the derivation to be built locally, it is not substituted. This is intended for very cheap commands (<1s execution time). It saves on the network round-trip and can speed up a build.
59-
60142
::: {.note}
61-
This sets [`allowSubstitutes` to `false`](https://nixos.org/nix/manual/#adv-attr-allowSubstitutes), so only use `runCommandLocal` if you are certain the user will always have a builder for the `system` of the derivation. This should be true for most trivial use cases (e.g., just copying some files to a different location or adding symlinks) because there the `system` is usually the same as `builtins.currentSystem`.
143+
`runCommand name derivationArgs buildCommand` is equivalent to
144+
```nix
145+
runCommandWith {
146+
inherit name derivationArgs;
147+
stdenv = stdenvNoCC;
148+
} buildCommand
149+
```
150+
151+
Likewise, `runCommandCC name derivationArgs buildCommand` is equivalent to
152+
```nix
153+
runCommandWith {
154+
inherit name derivationArgs;
155+
} buildCommand
156+
```
62157
:::
63158

159+
64160
## Writing text files {#trivial-builder-text-writing}
65161

66162
Nixpkgs provides the following functions for producing derivations which write text files or executable scripts into the Nix store.

doc/languages-frameworks/vim.section.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,14 @@ To add a new plugin, run `nix-shell -p vimPluginsUpdater --run 'vim-plugins-upda
232232

233233
Finally, 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 `vimPluginsUpdater` 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.
234234

235+
### Plugin optional configuration {#vim-plugin-required-snippet}
236+
237+
Some plugins require specific configuration to work. We choose not to
238+
patch those plugins but expose the necessary configuration under
239+
`PLUGIN.passthru.initLua` for neovim plugins. For instance, the `unicode-vim` plugin
240+
needs the path towards a unicode database so we expose the following snippet `vim.g.Unicode_data_directory="${self.unicode-vim}/autoload/unicode"` under `vimPlugins.unicode-vim.passthru.initLua`.
241+
242+
235243
## Updating plugins in nixpkgs {#updating-plugins-in-nixpkgs}
236244

237245
Run the update script with a GitHub API token that has at least `public_repo` access. Running the script without the token is likely to result in rate-limiting (429 errors). For steps on creating an API token, please refer to [GitHub's token documentation](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token).

lib/types.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ rec {
219219
else "(${t.description})";
220220

221221
# When adding new types don't forget to document them in
222-
# nixos/doc/manual/development/option-types.xml!
222+
# nixos/doc/manual/development/option-types.section.md!
223223
types = rec {
224224

225225
raw = mkOptionType {

maintainers/maintainer-list.nix

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,12 @@
963963
matrix = "@alexshpilkin:matrix.org";
964964
name = "Alexander Shpilkin";
965965
};
966+
AlexSKaye = {
967+
email = "AlexSKaye@proton.me";
968+
github = "AlexSKaye";
969+
githubId = 3017212;
970+
name = "Alex S. Kaye";
971+
};
966972
alexvorobiev = {
967973
email = "alexander.vorobiev@gmail.com";
968974
github = "alexvorobiev";
@@ -10097,6 +10103,12 @@
1009710103
githubId = 15893072;
1009810104
name = "Josh van Leeuwen";
1009910105
};
10106+
jovandeginste = {
10107+
email = "jo.vandeginste@gmail.com";
10108+
github = "jovandeginste";
10109+
githubId = 3170771;
10110+
name = "Jo Vandeginste";
10111+
};
1010010112
jpagex = {
1010110113
name = "Jérémy Pagé";
1010210114
email = "contact@jeremypage.me";
@@ -14429,6 +14441,12 @@
1442914441
githubId = 2287221;
1443014442
name = "Andreas Zweili";
1443114443
};
14444+
nebunebu = {
14445+
email = "neb.nebuchadnezzar@gmail.com";
14446+
github = "nebunebu";
14447+
githubId = 87451010;
14448+
name = "nebu";
14449+
};
1443214450
Necior = {
1443314451
email = "adrian@sadlocha.eu";
1443414452
github = "Necior";
@@ -15210,6 +15228,12 @@
1521015228
githubId = 7397786;
1521115229
name = "Odysseas Georgoudis";
1521215230
};
15231+
ofalvai = {
15232+
email = "ofalvai@gmail.com";
15233+
github = "ofalvai";
15234+
githubId = 1694986;
15235+
name = "Olivér Falvai";
15236+
};
1521315237
ofek = {
1521415238
email = "oss@ofek.dev";
1521515239
github = "ofek";
@@ -15463,6 +15487,12 @@
1546315487
github = "OlivierNicole";
1546415488
githubId = 14031333;
1546515489
};
15490+
ottoblep = {
15491+
name = "Severin Lochschmidt";
15492+
email = "seviron53@gmail.com";
15493+
github = "ottoblep";
15494+
githubId = 57066925;
15495+
};
1546615496
otwieracz = {
1546715497
email = "slawek@otwiera.cz";
1546815498
github = "otwieracz";

nixos/doc/manual/release-notes/rl-2411.section.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@
8787

8888
- [Proton Mail bridge](https://proton.me/mail/bridge), a desktop application that runs in the background, encrypting and decrypting messages as they enter and leave your computer. It lets you add your Proton Mail account to your favorite email client via IMAP/SMTP by creating a local email server on your computer.
8989

90+
- [chromadb](https://www.trychroma.com/), an open-source AI application
91+
database. Batteries included. Available as [services.chromadb](options.html#opt-services.chromadb.enable).
92+
9093
## Backward Incompatibilities {#sec-release-24.11-incompatibilities}
9194

9295
- `transmission` package has been aliased with a `trace` warning to `transmission_3`. Since [Transmission 4 has been released last year](https://github.com/transmission/transmission/releases/tag/4.0.0), and Transmission 3 will eventually go away, it was decided perform this warning alias to make people aware of the new version. The `services.transmission.package` defaults to `transmission_3` as well because the upgrade can cause data loss in certain specific usage patterns (examples: [#5153](https://github.com/transmission/transmission/issues/5153), [#6796](https://github.com/transmission/transmission/issues/6796)). Please make sure to back up to your data directory per your usage:

nixos/modules/module-list.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@
458458
./services/continuous-integration/woodpecker/server.nix
459459
./services/databases/aerospike.nix
460460
./services/databases/cassandra.nix
461+
./services/databases/chromadb.nix
461462
./services/databases/clickhouse.nix
462463
./services/databases/cockroachdb.nix
463464
./services/databases/couchdb.nix
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{
2+
config,
3+
pkgs,
4+
lib,
5+
...
6+
}:
7+
8+
let
9+
cfg = config.services.chromadb;
10+
inherit (lib)
11+
mkEnableOption
12+
mkOption
13+
mkIf
14+
types
15+
literalExpression
16+
;
17+
in
18+
{
19+
20+
meta.maintainers = with lib.maintainers; [ drupol ];
21+
22+
options = {
23+
services.chromadb = {
24+
enable = mkEnableOption "ChromaDB, an open-source AI application database.";
25+
26+
package = mkOption {
27+
type = types.package;
28+
example = literalExpression "pkgs.python3Packages.chromadb";
29+
default = pkgs.python3Packages.chromadb;
30+
defaultText = "pkgs.python3Packages.chromadb";
31+
description = "ChromaDB package to use.";
32+
};
33+
34+
host = mkOption {
35+
type = types.str;
36+
default = "127.0.0.1";
37+
description = ''
38+
Defines the IP address by which ChromaDB will be accessible.
39+
'';
40+
};
41+
42+
port = mkOption {
43+
type = types.port;
44+
default = 8000;
45+
description = ''
46+
Defined the port number to listen.
47+
'';
48+
};
49+
50+
logFile = mkOption {
51+
type = types.path;
52+
default = "/var/log/chromadb/chromadb.log";
53+
description = ''
54+
Specifies the location of file for logging output.
55+
'';
56+
};
57+
58+
dbpath = mkOption {
59+
type = types.str;
60+
default = "/var/lib/chromadb";
61+
description = "Location where ChromaDB stores its files";
62+
};
63+
64+
openFirewall = mkOption {
65+
type = types.bool;
66+
default = false;
67+
description = ''
68+
Whether to automatically open the specified TCP port in the firewall.
69+
'';
70+
};
71+
};
72+
};
73+
74+
config = mkIf cfg.enable {
75+
systemd.services.chromadb = {
76+
description = "ChromaDB";
77+
after = [ "network.target" ];
78+
wantedBy = [ "multi-user.target" ];
79+
serviceConfig = {
80+
Type = "simple";
81+
StateDirectory = "chromadb";
82+
WorkingDirectory = "/var/lib/chromadb";
83+
LogsDirectory = "chromadb";
84+
ExecStart = "${lib.getExe cfg.package} run --path ${cfg.dbpath} --host ${cfg.host} --port ${toString cfg.port} --log-path ${cfg.logFile}";
85+
Restart = "on-failure";
86+
ProtectHome = true;
87+
ProtectSystem = "strict";
88+
PrivateTmp = true;
89+
PrivateDevices = true;
90+
ProtectHostname = true;
91+
ProtectClock = true;
92+
ProtectKernelTunables = true;
93+
ProtectKernelModules = true;
94+
ProtectKernelLogs = true;
95+
ProtectControlGroups = true;
96+
NoNewPrivileges = true;
97+
RestrictRealtime = true;
98+
RestrictSUIDSGID = true;
99+
RemoveIPC = true;
100+
PrivateMounts = true;
101+
DynamicUser = true;
102+
};
103+
};
104+
105+
networking.firewall.allowedTCPPorts = lib.optionals cfg.openFirewall [ cfg.port ];
106+
};
107+
}

0 commit comments

Comments
 (0)