···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.
131131132132+- The option `services.postgresql.ensureUsers._.ensurePermissions` has been removed as it's
133133+ not declarative and is broken with newer postgresql versions. Consider using
134134+ [](#opt-services.postgresql.ensureUsers._.ensureDBOwnership)
135135+ instead or a tool that's more suited for managing the data inside a postgresql database.
136136+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.
133138134139- `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/)
···134134 localSourceAllow = mkOption {
135135 type = types.listOf types.str;
136136 # Permissions snapshot and destroy are in case --no-sync-snap is not used
137137- default = [ "bookmark" "hold" "send" "snapshot" "destroy" ];
137137+ 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
-43
nixos/modules/services/databases/postgresql.nix
···161161 '';
162162 };
163163164164- ensurePermissions = mkOption {
165165- type = types.attrsOf types.str;
166166- default = {};
167167- visible = false; # This option has been deprecated.
168168- description = lib.mdDoc ''
169169- This option is DEPRECATED and should not be used in nixpkgs anymore,
170170- use `ensureDBOwnership` instead. It can also break with newer
171171- versions of PostgreSQL (≥ 15).
172172-173173- Permissions to ensure for the user, specified as an attribute set.
174174- The attribute names specify the database and tables to grant the permissions for.
175175- The attribute values specify the permissions to grant. You may specify one or
176176- multiple comma-separated SQL privileges here.
177177-178178- For more information on how to specify the target
179179- and on which privileges exist, see the
180180- [GRANT syntax](https://www.postgresql.org/docs/current/sql-grant.html).
181181- The attributes are used as `GRANT ''${attrValue} ON ''${attrName}`.
182182- '';
183183- example = literalExpression ''
184184- {
185185- "DATABASE \"nextcloud\"" = "ALL PRIVILEGES";
186186- "ALL TABLES IN SCHEMA public" = "ALL PRIVILEGES";
187187- }
188188- '';
189189- };
190190-191164 ensureDBOwnership = mkOption {
192165 type = types.bool;
193166 default = false;
···460433 Offender: ${name} has not been found among databases.
461434 '';
462435 }) cfg.ensureUsers;
463463- # `ensurePermissions` is now deprecated, let's avoid it.
464464- warnings = lib.optional (any ({ ensurePermissions, ... }: ensurePermissions != {}) cfg.ensureUsers) "
465465- `services.postgresql.ensureUsers.*.ensurePermissions` is used in your expressions,
466466- this option is known to be broken with newer PostgreSQL versions,
467467- consider migrating to `services.postgresql.ensureUsers.*.ensureDBOwnership` or
468468- consult the release notes or manual for more migration guidelines.
469469-470470- This option will be removed in NixOS 24.05 unless it sees significant
471471- maintenance improvements.
472472- ";
473436474437 services.postgresql.settings =
475438 {
···583546 concatMapStrings
584547 (user:
585548 let
586586- userPermissions = concatStringsSep "\n"
587587- (mapAttrsToList
588588- (database: permission: ''$PSQL -tAc 'GRANT ${permission} ON ${database} TO "${user.name}"' '')
589589- user.ensurePermissions
590590- );
591549 dbOwnershipStmt = optionalString
592550 user.ensureDBOwnership
593551 ''$PSQL -tAc 'ALTER DATABASE "${user.name}" OWNER TO "${user.name}";' '';
···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}"'
602602- ${userPermissions}
603560 ${userClauses}
604561605562 ${dbOwnershipStmt}
+203
nixos/modules/services/misc/tabby.nix
···11+{ config, lib, pkgs, ... }:
22+let
33+ inherit (lib) types;
44+55+ cfg = config.services.tabby;
66+ format = pkgs.formats.toml { };
77+ tabbyPackage = cfg.package.override {
88+ inherit (cfg) acceleration;
99+ };
1010+in
1111+{
1212+ options = {
1313+ services.tabby = {
1414+ enable = lib.mkEnableOption (
1515+ lib.mdDoc "Self-hosted AI coding assistant using large language models"
1616+ );
1717+1818+ package = lib.mkPackageOption pkgs "tabby" { };
1919+2020+ port = lib.mkOption {
2121+ type = types.port;
2222+ default = 11029;
2323+ description = lib.mdDoc ''
2424+ Specifies the bind port on which the tabby server HTTP interface listens.
2525+ '';
2626+ };
2727+2828+ model = lib.mkOption {
2929+ type = types.str;
3030+ default = "TabbyML/StarCoder-1B";
3131+ description = lib.mdDoc ''
3232+ Specify the model that tabby will use to generate completions.
3333+3434+ This model will be downloaded automatically if it is not already present.
3535+3636+ If you want to utilize an existing model that you've already
3737+ downloaded you'll need to move it into tabby's state directory which
3838+ lives in `/var/lib/tabby`. Because the tabby.service is configured to
3939+ use a DyanmicUser the service will need to have been started at least
4040+ once before you can move the locally existing model into
4141+ `/var/lib/tabby`. You can set the model to 'none' and tabby will
4242+ startup and fail to download a model, but will have created the
4343+ `/var/lib/tabby` directory. You can then copy over the model manually
4444+ into `/var/lib/tabby`, update the model option to the name you just
4545+ downloaded and copied over then `nixos-rebuild switch` to start using
4646+ it.
4747+4848+ $ tabby download --model TabbyML/DeepseekCoder-6.7B
4949+ $ find ~/.tabby/ | tail -n1
5050+ /home/ghthor/.tabby/models/TabbyML/DeepseekCoder-6.7B/ggml/q8_0.v2.gguf
5151+ $ sudo rsync -r ~/.tabby/models/ /var/lib/tabby/models/
5252+ $ sudo chown -R tabby:tabby /var/lib/tabby/models/
5353+5454+ See for Model Options:
5555+ > https://github.com/TabbyML/registry-tabby
5656+ '';
5757+ };
5858+5959+ acceleration = lib.mkOption {
6060+ type = types.nullOr (types.enum [ "cpu" "rocm" "cuda" "metal" ]);
6161+ default = null;
6262+ example = "rocm";
6363+ description = lib.mdDoc ''
6464+ Specifies the device to use for hardware acceleration.
6565+6666+ - `cpu`: no acceleration just use the CPU
6767+ - `rocm`: supported by modern AMD GPUs
6868+ - `cuda`: supported by modern NVIDIA GPUs
6969+ - `metal`: supported on darwin aarch64 machines
7070+7171+ Tabby will try and determine what type of acceleration that is
7272+ already enabled in your configuration when `acceleration = null`.
7373+7474+ - nixpkgs.config.cudaSupport
7575+ - nixpkgs.config.rocmSupport
7676+ - if stdenv.isDarwin && stdenv.isAarch64
7777+7878+ IFF multiple acceleration methods are found to be enabled or if you
7979+ haven't set either `cudaSupport or rocmSupport` you will have to
8080+ specify the device type manually here otherwise it will default to
8181+ the first from the list above or to cpu.
8282+ '';
8383+ };
8484+8585+ settings = lib.mkOption {
8686+ inherit (format) type;
8787+ default = { };
8888+ description = lib.mdDoc ''
8989+ Tabby scheduler configuration
9090+9191+ See for more details:
9292+ > https://tabby.tabbyml.com/docs/configuration/#repository-context-for-code-completion
9393+ '';
9494+ example = lib.literalExpression ''
9595+ settings = {
9696+ repositories = [
9797+ { name = "tabby"; git_url = "https://github.com/TabbyML/tabby.git"; }
9898+ { name = "CTranslate2"; git_url = "git@github.com:OpenNMT/CTranslate2.git"; }
9999+100100+ # local directory is also supported, but limited by systemd DynamicUser=1
101101+ # adding local repositories will need to be done manually
102102+ { name = "repository_a"; git_url = "file:///var/lib/tabby/repository_a"; }
103103+ ];
104104+ };
105105+ '';
106106+ };
107107+108108+ usageCollection = lib.mkOption {
109109+ type = types.bool;
110110+ default = false;
111111+ description = lib.mdDoc ''
112112+ Enable sending anonymous usage data.
113113+114114+ See for more details:
115115+ > https://tabby.tabbyml.com/docs/configuration#usage-collection
116116+ '';
117117+ };
118118+119119+ indexInterval = lib.mkOption {
120120+ type = types.str;
121121+ default = "5hours";
122122+ example = "5hours";
123123+ description = lib.mdDoc ''
124124+ Run tabby scheduler to generate the index database at this interval.
125125+ Updates by default every 5 hours. This value applies to
126126+ `OnUnitInactiveSec`
127127+128128+ The format is described in
129129+ {manpage}`systemd.time(7)`.
130130+131131+ To disable running `tabby scheduler --now` updates, set to `"never"`
132132+ '';
133133+ };
134134+ };
135135+ };
136136+137137+ # TODO(ghthor): firewall config
138138+139139+ config = lib.mkIf cfg.enable {
140140+ environment = {
141141+ etc."tabby/config.toml".source = format.generate "config.toml" cfg.settings;
142142+ systemPackages = [ tabbyPackage ];
143143+ };
144144+145145+146146+ systemd = let
147147+ serviceUser = {
148148+ WorkingDirectory = "/var/lib/tabby";
149149+ StateDirectory = [ "tabby" ];
150150+ ConfigurationDirectory = [ "tabby" ];
151151+ DynamicUser = true;
152152+ User = "tabby";
153153+ Group = "tabby";
154154+ };
155155+156156+ serviceEnv = lib.mkMerge [
157157+ {
158158+ TABBY_ROOT = "%S/tabby";
159159+ }
160160+ (lib.mkIf (!cfg.usageCollection) {
161161+ TABBY_DISABLE_USAGE_COLLECTION = "1";
162162+ })
163163+ ];
164164+ in {
165165+ services.tabby = {
166166+ wantedBy = [ "multi-user.target" ];
167167+ description = "Self-hosted AI coding assistant using large language models";
168168+ after = [ "network.target" ];
169169+ environment = serviceEnv;
170170+ serviceConfig = lib.mkMerge [
171171+ serviceUser
172172+ {
173173+ ExecStart =
174174+ "${lib.getExe tabbyPackage} serve --model ${cfg.model} --port ${toString cfg.port} --device ${tabbyPackage.featureDevice}";
175175+ }
176176+ ];
177177+ };
178178+179179+ services.tabby-scheduler = lib.mkIf (cfg.indexInterval != "never") {
180180+ wantedBy = [ "multi-user.target" ];
181181+ description = "Tabby repository indexing service";
182182+ after = [ "network.target" ];
183183+ environment = serviceEnv;
184184+ preStart = "cp -f /etc/tabby/config.toml \${TABBY_ROOT}/config.toml";
185185+ serviceConfig = lib.mkMerge [
186186+ serviceUser
187187+ {
188188+ # Type = "oneshot";
189189+ ExecStart = "${lib.getExe tabbyPackage} scheduler --now";
190190+ }
191191+ ];
192192+ };
193193+ timers.tabby-scheduler = lib.mkIf (cfg.indexInterval != "never") {
194194+ description = "Update timer for tabby-scheduler";
195195+ partOf = [ "tabby-scheduler.service" ];
196196+ wantedBy = [ "timers.target" ];
197197+ timerConfig.OnUnitInactiveSec = cfg.indexInterval;
198198+ };
199199+ };
200200+ };
201201+202202+ meta.maintainers = with lib.maintainers; [ ghthor ];
203203+}
+1-1
nixos/modules/virtualisation/oci-containers.nix
···312312313313 preStop = if cfg.backend == "podman"
314314 then "podman stop --ignore --cidfile=/run/podman-${escapedName}.ctr-id"
315315- else "${cfg.backend} stop ${name}";
315315+ else "${cfg.backend} stop ${name} || true";
316316317317 postStop = if cfg.backend == "podman"
318318 then "podman rm -f --ignore --cidfile=/run/podman-${escapedName}.ctr-id"
···80808181 # a newer libxml2 version has changed some interfaces
8282 ./fix-xml2.patch
8383+8484+ # Don't try to override the ANTLR_JAR_PATH specified in cmakeFlags
8585+ ./dont-search-for-antlr-jar.patch
8386 ];
84878585- # 1. have it look for 4.12.0 instead of 4.11.1
8686- # 2. for some reason CMakeCache.txt is part of source code
8787- preConfigure = ''
8888- substituteInPlace CMakeLists.txt \
8989- --replace "antlr-4.11.1-complete.jar" "antlr-4.12.0-complete.jar"
8888+ postPatch = ''
8989+ # For some reason CMakeCache.txt is part of source code, remove it
9090 rm -f build/CMakeCache.txt
9191+9292+ patchShebangs tools/get_wb_version.sh
9193 '';
92949395 nativeBuildInputs = [
···139141 zstd
140142 ];
141143142142- postPatch = ''
143143- patchShebangs tools/get_wb_version.sh
144144- '';
145145-146144 # GCC 13: error: 'int64_t' in namespace 'std' does not name a type
147145 # when updating the version make sure this is still needed
148146 env.CXXFLAGS = "-include cstdint";
···164162 # mysql-workbench 8.0.21 depends on libmysqlconnectorcpp 1.1.8.
165163 # Newer versions of connector still provide the legacy library when enabled
166164 # but the headers are in a different location.
167167- "-DWITH_ANTLR_JAR=${antlr4_12.jarLocation}"
165165+ "-DANTLR_JAR_PATH=${antlr4_12.jarLocation}"
168166 "-DMySQLCppConn_INCLUDE_DIR=${libmysqlconnectorcpp}/include/jdbc"
169167 ];
170168
···11+diff --git a/CMakeLists.txt b/CMakeLists.txt
22+index b7320bb..d7169da 100644
33+--- a/CMakeLists.txt
44++++ b/CMakeLists.txt
55+@@ -143,25 +143,6 @@ check_function_exists (strtoull HAVE_STRTOULL)
66+ check_function_exists (strtoimax HAVE_STRTOIMAX)
77+ check_function_exists (strtoumax HAVE_STRTOUMAX)
88+99+-set(ANTLR_JAR_FILENAME "antlr-4.11.1-complete.jar")
1010+-get_filename_component(SOURCE_PARENT_DIR ${CMAKE_SOURCE_DIR} DIRECTORY)
1111+-set(LINUX_RES_BIN_DIR ${SOURCE_PARENT_DIR}/linux-res/bin)
1212+-message("WITH_ANTLR_JAR: ${WITH_ANTLR_JAR}")
1313+-if(WITH_ANTLR_JAR)
1414+- get_filename_component(ANTLR_JAR_USER_DIR ${WITH_ANTLR_JAR} DIRECTORY)
1515+- find_path(ANTLR_JAR_PATH ${ANTLR_JAR_FILENAME} ${LINUX_RES_BIN_DIR} ${ANTLR_JAR_USER_DIR})
1616+-else(WITH_ANTLR_JAR)
1717+- find_path(ANTLR_JAR_PATH ${ANTLR_JAR_FILENAME} ${LINUX_RES_BIN_DIR})
1818+-endif(WITH_ANTLR_JAR)
1919+-
2020+-if(ANTLR_JAR_PATH AND Java_JAVA_EXECUTABLE)
2121+- set(ANTLR_JAR_PATH ${ANTLR_JAR_PATH}/${ANTLR_JAR_FILENAME})
2222+- message(STATUS "ANTLR jar: " ${ANTLR_JAR_PATH})
2323+-else()
2424+- message(WARNING ${ANTLR_JAR_FILENAME} " or java runtime wasn't found which is required if you'd like to rebuild Lexer and Parser files")
2525+-endif()
2626+-
2727+-
2828+ if (UNIX)
2929+ if (NOT LIB_INSTALL_DIR)
3030+ set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib")
+7-2
pkgs/applications/misc/syncthingtray/default.nix
···7676 export QT_QPA_PLATFORM=offscreen
7777 export QT_PLUGIN_PATH="${lib.getBin qtbase}/${qtbase.qtPluginPrefix}"
7878 '';
7979- # don't test --help on Darwin because output is .app
8080- doInstallCheck = !stdenv.isDarwin;
7979+ postInstall = lib.optionalString stdenv.isDarwin ''
8080+ # put the app bundle into the proper place /Applications instead of /bin
8181+ mkdir -p $out/Applications
8282+ mv $out/bin/syncthingtray.app $out/Applications
8383+ # Make binary available in PATH like on other platforms
8484+ ln -s $out/Applications/syncthingtray.app/Contents/MacOS/syncthingtray $out/bin/syncthingtray
8585+ '';
8186 installCheckPhase = ''
8287 $out/bin/syncthingtray --help | grep ${finalAttrs.version}
8388 '';