Skip to content

Commit a8149b5

Browse files
Merge staging-next into staging
2 parents 4ef260b + bca9908 commit a8149b5

112 files changed

Lines changed: 7562 additions & 1269 deletions

File tree

Some content is hidden

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

maintainers/maintainer-list.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17121,6 +17121,15 @@
1712117121
githubId = 178904;
1712217122
name = "Daniel Ehlers";
1712317123
};
17124+
sascha8a = {
17125+
email = "sascha@localhost.systems";
17126+
github = "sascha8a";
17127+
githubId = 6937965;
17128+
name = "Alexander Lampalzer";
17129+
keys = [{
17130+
fingerprint = "0350 3136 E22C C561 30E3 A4AE 2087 9CCA CD5C D670";
17131+
}];
17132+
};
1712417133
saschagrunert = {
1712517134
email = "mail@saschagrunert.de";
1712617135
github = "saschagrunert";

nixos/doc/manual/configuration/x-windows.chapter.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ Or if you have an older card, you may have to use one of the legacy
150150
drivers:
151151

152152
```nix
153+
services.xserver.videoDrivers = [ "nvidiaLegacy470" ];
153154
services.xserver.videoDrivers = [ "nvidiaLegacy390" ];
154155
services.xserver.videoDrivers = [ "nvidiaLegacy340" ];
155156
services.xserver.videoDrivers = [ "nvidiaLegacy304" ];

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m
129129
[v0.31](https://github.com/derailed/k9s/releases/tag/v0.31.0) for details. It is recommended
130130
to back up your current configuration and let k9s recreate the new base configuration.
131131

132+
- The option `services.postgresql.ensureUsers._.ensurePermissions` has been removed as it's
133+
not declarative and is broken with newer postgresql versions. Consider using
134+
[](#opt-services.postgresql.ensureUsers._.ensureDBOwnership)
135+
instead or a tool that's more suited for managing the data inside a postgresql database.
136+
132137
- `idris2` was updated to v0.7.0. This version introduces breaking changes. Check out the [changelog](https://github.com/idris-lang/Idris2/blob/v0.7.0/CHANGELOG.md#v070) for details.
133138

134139
- `neo4j` has been updated to 5, you may want to read the [release notes for Neo4j 5](https://neo4j.com/release-notes/database/neo4j-5/)

nixos/modules/module-list.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,7 @@
783783
./services/misc/svnserve.nix
784784
./services/misc/synergy.nix
785785
./services/misc/sysprof.nix
786+
./services/misc/tabby.nix
786787
./services/misc/tandoor-recipes.nix
787788
./services/misc/taskserver
788789
./services/misc/tautulli.nix

nixos/modules/services/backup/syncoid.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ in
134134
localSourceAllow = mkOption {
135135
type = types.listOf types.str;
136136
# Permissions snapshot and destroy are in case --no-sync-snap is not used
137-
default = [ "bookmark" "hold" "send" "snapshot" "destroy" ];
137+
default = [ "bookmark" "hold" "send" "snapshot" "destroy" "mount" ];
138138
description = lib.mdDoc ''
139139
Permissions granted for the {option}`services.syncoid.user` user
140140
for local source datasets. See

nixos/modules/services/databases/postgresql.nix

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -161,33 +161,6 @@ in
161161
'';
162162
};
163163

164-
ensurePermissions = mkOption {
165-
type = types.attrsOf types.str;
166-
default = {};
167-
visible = false; # This option has been deprecated.
168-
description = lib.mdDoc ''
169-
This option is DEPRECATED and should not be used in nixpkgs anymore,
170-
use `ensureDBOwnership` instead. It can also break with newer
171-
versions of PostgreSQL (≥ 15).
172-
173-
Permissions to ensure for the user, specified as an attribute set.
174-
The attribute names specify the database and tables to grant the permissions for.
175-
The attribute values specify the permissions to grant. You may specify one or
176-
multiple comma-separated SQL privileges here.
177-
178-
For more information on how to specify the target
179-
and on which privileges exist, see the
180-
[GRANT syntax](https://www.postgresql.org/docs/current/sql-grant.html).
181-
The attributes are used as `GRANT ''${attrValue} ON ''${attrName}`.
182-
'';
183-
example = literalExpression ''
184-
{
185-
"DATABASE \"nextcloud\"" = "ALL PRIVILEGES";
186-
"ALL TABLES IN SCHEMA public" = "ALL PRIVILEGES";
187-
}
188-
'';
189-
};
190-
191164
ensureDBOwnership = mkOption {
192165
type = types.bool;
193166
default = false;
@@ -460,16 +433,6 @@ in
460433
Offender: ${name} has not been found among databases.
461434
'';
462435
}) cfg.ensureUsers;
463-
# `ensurePermissions` is now deprecated, let's avoid it.
464-
warnings = lib.optional (any ({ ensurePermissions, ... }: ensurePermissions != {}) cfg.ensureUsers) "
465-
`services.postgresql.ensureUsers.*.ensurePermissions` is used in your expressions,
466-
this option is known to be broken with newer PostgreSQL versions,
467-
consider migrating to `services.postgresql.ensureUsers.*.ensureDBOwnership` or
468-
consult the release notes or manual for more migration guidelines.
469-
470-
This option will be removed in NixOS 24.05 unless it sees significant
471-
maintenance improvements.
472-
";
473436

474437
services.postgresql.settings =
475438
{
@@ -583,11 +546,6 @@ in
583546
concatMapStrings
584547
(user:
585548
let
586-
userPermissions = concatStringsSep "\n"
587-
(mapAttrsToList
588-
(database: permission: ''$PSQL -tAc 'GRANT ${permission} ON ${database} TO "${user.name}"' '')
589-
user.ensurePermissions
590-
);
591549
dbOwnershipStmt = optionalString
592550
user.ensureDBOwnership
593551
''$PSQL -tAc 'ALTER DATABASE "${user.name}" OWNER TO "${user.name}";' '';
@@ -599,7 +557,6 @@ in
599557
userClauses = ''$PSQL -tAc 'ALTER ROLE "${user.name}" ${concatStringsSep " " clauseSqlStatements}' '';
600558
in ''
601559
$PSQL -tAc "SELECT 1 FROM pg_roles WHERE rolname='${user.name}'" | grep -q 1 || $PSQL -tAc 'CREATE USER "${user.name}"'
602-
${userPermissions}
603560
${userClauses}
604561
605562
${dbOwnershipStmt}
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
{ config, lib, pkgs, ... }:
2+
let
3+
inherit (lib) types;
4+
5+
cfg = config.services.tabby;
6+
format = pkgs.formats.toml { };
7+
tabbyPackage = cfg.package.override {
8+
inherit (cfg) acceleration;
9+
};
10+
in
11+
{
12+
options = {
13+
services.tabby = {
14+
enable = lib.mkEnableOption (
15+
lib.mdDoc "Self-hosted AI coding assistant using large language models"
16+
);
17+
18+
package = lib.mkPackageOption pkgs "tabby" { };
19+
20+
port = lib.mkOption {
21+
type = types.port;
22+
default = 11029;
23+
description = lib.mdDoc ''
24+
Specifies the bind port on which the tabby server HTTP interface listens.
25+
'';
26+
};
27+
28+
model = lib.mkOption {
29+
type = types.str;
30+
default = "TabbyML/StarCoder-1B";
31+
description = lib.mdDoc ''
32+
Specify the model that tabby will use to generate completions.
33+
34+
This model will be downloaded automatically if it is not already present.
35+
36+
If you want to utilize an existing model that you've already
37+
downloaded you'll need to move it into tabby's state directory which
38+
lives in `/var/lib/tabby`. Because the tabby.service is configured to
39+
use a DyanmicUser the service will need to have been started at least
40+
once before you can move the locally existing model into
41+
`/var/lib/tabby`. You can set the model to 'none' and tabby will
42+
startup and fail to download a model, but will have created the
43+
`/var/lib/tabby` directory. You can then copy over the model manually
44+
into `/var/lib/tabby`, update the model option to the name you just
45+
downloaded and copied over then `nixos-rebuild switch` to start using
46+
it.
47+
48+
$ tabby download --model TabbyML/DeepseekCoder-6.7B
49+
$ find ~/.tabby/ | tail -n1
50+
/home/ghthor/.tabby/models/TabbyML/DeepseekCoder-6.7B/ggml/q8_0.v2.gguf
51+
$ sudo rsync -r ~/.tabby/models/ /var/lib/tabby/models/
52+
$ sudo chown -R tabby:tabby /var/lib/tabby/models/
53+
54+
See for Model Options:
55+
> https://github.com/TabbyML/registry-tabby
56+
'';
57+
};
58+
59+
acceleration = lib.mkOption {
60+
type = types.nullOr (types.enum [ "cpu" "rocm" "cuda" "metal" ]);
61+
default = null;
62+
example = "rocm";
63+
description = lib.mdDoc ''
64+
Specifies the device to use for hardware acceleration.
65+
66+
- `cpu`: no acceleration just use the CPU
67+
- `rocm`: supported by modern AMD GPUs
68+
- `cuda`: supported by modern NVIDIA GPUs
69+
- `metal`: supported on darwin aarch64 machines
70+
71+
Tabby will try and determine what type of acceleration that is
72+
already enabled in your configuration when `acceleration = null`.
73+
74+
- nixpkgs.config.cudaSupport
75+
- nixpkgs.config.rocmSupport
76+
- if stdenv.isDarwin && stdenv.isAarch64
77+
78+
IFF multiple acceleration methods are found to be enabled or if you
79+
haven't set either `cudaSupport or rocmSupport` you will have to
80+
specify the device type manually here otherwise it will default to
81+
the first from the list above or to cpu.
82+
'';
83+
};
84+
85+
settings = lib.mkOption {
86+
inherit (format) type;
87+
default = { };
88+
description = lib.mdDoc ''
89+
Tabby scheduler configuration
90+
91+
See for more details:
92+
> https://tabby.tabbyml.com/docs/configuration/#repository-context-for-code-completion
93+
'';
94+
example = lib.literalExpression ''
95+
settings = {
96+
repositories = [
97+
{ name = "tabby"; git_url = "https://github.com/TabbyML/tabby.git"; }
98+
{ name = "CTranslate2"; git_url = "git@github.com:OpenNMT/CTranslate2.git"; }
99+
100+
# local directory is also supported, but limited by systemd DynamicUser=1
101+
# adding local repositories will need to be done manually
102+
{ name = "repository_a"; git_url = "file:///var/lib/tabby/repository_a"; }
103+
];
104+
};
105+
'';
106+
};
107+
108+
usageCollection = lib.mkOption {
109+
type = types.bool;
110+
default = false;
111+
description = lib.mdDoc ''
112+
Enable sending anonymous usage data.
113+
114+
See for more details:
115+
> https://tabby.tabbyml.com/docs/configuration#usage-collection
116+
'';
117+
};
118+
119+
indexInterval = lib.mkOption {
120+
type = types.str;
121+
default = "5hours";
122+
example = "5hours";
123+
description = lib.mdDoc ''
124+
Run tabby scheduler to generate the index database at this interval.
125+
Updates by default every 5 hours. This value applies to
126+
`OnUnitInactiveSec`
127+
128+
The format is described in
129+
{manpage}`systemd.time(7)`.
130+
131+
To disable running `tabby scheduler --now` updates, set to `"never"`
132+
'';
133+
};
134+
};
135+
};
136+
137+
# TODO(ghthor): firewall config
138+
139+
config = lib.mkIf cfg.enable {
140+
environment = {
141+
etc."tabby/config.toml".source = format.generate "config.toml" cfg.settings;
142+
systemPackages = [ tabbyPackage ];
143+
};
144+
145+
146+
systemd = let
147+
serviceUser = {
148+
WorkingDirectory = "/var/lib/tabby";
149+
StateDirectory = [ "tabby" ];
150+
ConfigurationDirectory = [ "tabby" ];
151+
DynamicUser = true;
152+
User = "tabby";
153+
Group = "tabby";
154+
};
155+
156+
serviceEnv = lib.mkMerge [
157+
{
158+
TABBY_ROOT = "%S/tabby";
159+
}
160+
(lib.mkIf (!cfg.usageCollection) {
161+
TABBY_DISABLE_USAGE_COLLECTION = "1";
162+
})
163+
];
164+
in {
165+
services.tabby = {
166+
wantedBy = [ "multi-user.target" ];
167+
description = "Self-hosted AI coding assistant using large language models";
168+
after = [ "network.target" ];
169+
environment = serviceEnv;
170+
serviceConfig = lib.mkMerge [
171+
serviceUser
172+
{
173+
ExecStart =
174+
"${lib.getExe tabbyPackage} serve --model ${cfg.model} --port ${toString cfg.port} --device ${tabbyPackage.featureDevice}";
175+
}
176+
];
177+
};
178+
179+
services.tabby-scheduler = lib.mkIf (cfg.indexInterval != "never") {
180+
wantedBy = [ "multi-user.target" ];
181+
description = "Tabby repository indexing service";
182+
after = [ "network.target" ];
183+
environment = serviceEnv;
184+
preStart = "cp -f /etc/tabby/config.toml \${TABBY_ROOT}/config.toml";
185+
serviceConfig = lib.mkMerge [
186+
serviceUser
187+
{
188+
# Type = "oneshot";
189+
ExecStart = "${lib.getExe tabbyPackage} scheduler --now";
190+
}
191+
];
192+
};
193+
timers.tabby-scheduler = lib.mkIf (cfg.indexInterval != "never") {
194+
description = "Update timer for tabby-scheduler";
195+
partOf = [ "tabby-scheduler.service" ];
196+
wantedBy = [ "timers.target" ];
197+
timerConfig.OnUnitInactiveSec = cfg.indexInterval;
198+
};
199+
};
200+
};
201+
202+
meta.maintainers = with lib.maintainers; [ ghthor ];
203+
}

nixos/modules/virtualisation/oci-containers.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ let
312312

313313
preStop = if cfg.backend == "podman"
314314
then "podman stop --ignore --cidfile=/run/podman-${escapedName}.ctr-id"
315-
else "${cfg.backend} stop ${name}";
315+
else "${cfg.backend} stop ${name} || true";
316316

317317
postStop = if cfg.backend == "podman"
318318
then "podman rm -f --ignore --cidfile=/run/podman-${escapedName}.ctr-id"

nixos/tests/sanoid.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,11 @@ in {
115115
source.systemctl("start --wait syncoid-pool-sanoid.service")
116116
target.succeed("cat /mnt/pool/sanoid/test.txt")
117117
source.systemctl("start --wait syncoid-pool-syncoid.service")
118+
source.systemctl("start --wait syncoid-pool-syncoid.service")
118119
target.succeed("cat /mnt/pool/syncoid/test.txt")
119120
121+
assert(len(source.succeed("zfs list -H -t snapshot pool/syncoid").splitlines()) == 1), "Syncoid should only retain one sync snapshot"
122+
120123
source.systemctl("start --wait syncoid-pool.service")
121124
target.succeed("[[ -d /mnt/pool/full-pool/syncoid ]]")
122125

pkgs/applications/editors/vscode/extensions/default.nix

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3340,6 +3340,23 @@ let
33403340
};
33413341
};
33423342

3343+
samuelcolvin.jinjahtml = buildVscodeMarketplaceExtension {
3344+
mktplcRef = {
3345+
name = "jinjahtml";
3346+
publisher = "samuelcolvin";
3347+
version = "0.20.0";
3348+
sha256 = "c000cbdc090b7d3d8df62a3c87a5d881c78aca5b490b3e591d9841d788a9aa93";
3349+
};
3350+
meta = with lib; {
3351+
description = "Syntax highlighting for jinja(2) including HTML, Markdown, YAML, Ruby and LaTeX templates";
3352+
downloadPage = "https://marketplace.visualstudio.com/items?itemName=samuelcolvin.jinjahtml";
3353+
homepage = "https://github.com/samuelcolvin/jinjahtml-vscode";
3354+
changelog = "https://marketplace.visualstudio.com/items/samuelcolvin.jinjahtml/changelog";
3355+
license = licenses.mit;
3356+
maintainers = [ maintainers.DataHearth ];
3357+
};
3358+
};
3359+
33433360
sanaajani.taskrunnercode = buildVscodeMarketplaceExtension {
33443361
mktplcRef = {
33453362
name = "taskrunnercode";

0 commit comments

Comments
 (0)