···755755756756Used with Git. Expects `url` to a Git repo, `rev`, and `hash`. `rev` in this case can be full the git commit id (SHA1 hash) or a tag name like `refs/tags/v1.0`.
757757758758+If you want to fetch a tag you should pass the `tag` parameter instead of `rev` which has the same effect as setting `rev = "refs/tags"/${version}"`.
759759+This is safer than just setting `rev = version` w.r.t. possible branch and tag name conflicts.
760760+758761Additionally, the following optional arguments can be given:
759762760763*`fetchSubmodules`* (Boolean)
···833836834837## `fetchFromGitHub` {#fetchfromgithub}
835838836836-`fetchFromGitHub` expects four arguments. `owner` is a string corresponding to the GitHub user or organization that controls this repository. `repo` corresponds to the name of the software repository. These are located at the top of every GitHub HTML page as `owner`/`repo`. `rev` corresponds to the Git commit hash or tag (e.g `v1.0`) that will be downloaded from Git. Finally, `hash` corresponds to the hash of the extracted directory. Again, other hash algorithms are also available, but `hash` is currently preferred.
839839+`fetchFromGitHub` expects four arguments. `owner` is a string corresponding to the GitHub user or organization that controls this repository. `repo` corresponds to the name of the software repository. These are located at the top of every GitHub HTML page as `owner`/`repo`. `rev` corresponds to the Git commit hash or tag (e.g `v1.0`) that will be downloaded from Git. If you need to fetch a tag however, you should prefer to use the `tag` parameter which achieves this in a safer way with less boilerplate. Finally, `hash` corresponds to the hash of the extracted directory. Again, other hash algorithms are also available, but `hash` is currently preferred.
837840838841To use a different GitHub instance, use `githubBase` (defaults to `"github.com"`).
839842
+23-17
doc/languages-frameworks/dotnet.section.md
···2727 name = "dotnet-env";
2828 packages = [
2929 (with dotnetCorePackages; combinePackages [
3030- sdk_6_0
3131- sdk_7_0
3030+ sdk_8_0
3131+ sdk_9_0
3232 ])
3333 ];
3434}
3535```
36363737-This will produce a dotnet installation that has the dotnet 6.0 7.0 sdk. The first sdk listed will have it's cli utility present in the resulting environment. Example info output:
3737+This will produce a dotnet installation that has the dotnet 8.0 9.0 sdk. The first sdk listed will have it's cli utility present in the resulting environment. Example info output:
38383939```ShellSession
4040$ dotnet --info
4141.NET SDK:
4242- Version: 7.0.202
4343- Commit: 6c74320bc3
4242+ Version: 9.0.100
4343+ Commit: 59db016f11
4444+ Workload version: 9.0.100-manifests.3068a692
4545+ MSBuild version: 17.12.7+5b8665660
44464547Runtime Environment:
4648 OS Name: nixos
4747- OS Version: 23.05
4949+ OS Version: 25.05
4850 OS Platform: Linux
4951 RID: linux-x64
5050- Base Path: /nix/store/n2pm44xq20hz7ybsasgmd7p3yh31gnh4-dotnet-sdk-7.0.202/sdk/7.0.202/
5252+ Base Path: /nix/store/a03c70i7x6rjdr6vikczsp5ck3v6rixh-dotnet-sdk-9.0.100/share/dotnet/sdk/9.0.100/
5353+5454+.NET workloads installed:
5555+There are no installed workloads to display.
5656+Configured to use loose manifests when installing new manifests.
51575258Host:
5353- Version: 7.0.4
5959+ Version: 9.0.0
5460 Architecture: x64
5555- Commit: 0a396acafe
6161+ Commit: 9d5a6a9aa4
56625763.NET SDKs installed:
5858- 6.0.407 [/nix/store/3b19303vwrhv0xxz1hg355c7f2hgxxgd-dotnet-core-combined/sdk]
5959- 7.0.202 [/nix/store/3b19303vwrhv0xxz1hg355c7f2hgxxgd-dotnet-core-combined/sdk]
6464+ 8.0.404 [/nix/store/6wlrjiy10wg766490dcmp6x64zb1vc8j-dotnet-core-combined/share/dotnet/sdk]
6565+ 9.0.100 [/nix/store/6wlrjiy10wg766490dcmp6x64zb1vc8j-dotnet-core-combined/share/dotnet/sdk]
60666167.NET runtimes installed:
6262- Microsoft.AspNetCore.App 6.0.15 [/nix/store/3b19303vwrhv0xxz1hg355c7f2hgxxgd-dotnet-core-combined/shared/Microsoft.AspNetCore.App]
6363- Microsoft.AspNetCore.App 7.0.4 [/nix/store/3b19303vwrhv0xxz1hg355c7f2hgxxgd-dotnet-core-combined/shared/Microsoft.AspNetCore.App]
6464- Microsoft.NETCore.App 6.0.15 [/nix/store/3b19303vwrhv0xxz1hg355c7f2hgxxgd-dotnet-core-combined/shared/Microsoft.NETCore.App]
6565- Microsoft.NETCore.App 7.0.4 [/nix/store/3b19303vwrhv0xxz1hg355c7f2hgxxgd-dotnet-core-combined/shared/Microsoft.NETCore.App]
6868+ Microsoft.AspNetCore.App 8.0.11 [/nix/store/6wlrjiy10wg766490dcmp6x64zb1vc8j-dotnet-core-combined/share/dotnet/shared/Microsoft.AspNetCore.App]
6969+ Microsoft.AspNetCore.App 9.0.0 [/nix/store/6wlrjiy10wg766490dcmp6x64zb1vc8j-dotnet-core-combined/share/dotnet/shared/Microsoft.AspNetCore.App]
7070+ Microsoft.NETCore.App 8.0.11 [/nix/store/6wlrjiy10wg766490dcmp6x64zb1vc8j-dotnet-core-combined/share/dotnet/shared/Microsoft.NETCore.App]
7171+ Microsoft.NETCore.App 9.0.0 [/nix/store/6wlrjiy10wg766490dcmp6x64zb1vc8j-dotnet-core-combined/share/dotnet/shared/Microsoft.NETCore.App]
66726773Other architectures found:
6874 None
···146152147153 buildInputs = [ referencedProject ]; # `referencedProject` must contain `nupkg` in the folder structure.
148154149149- dotnet-sdk = dotnetCorePackages.sdk_6_0;
150150- dotnet-runtime = dotnetCorePackages.runtime_6_0;
155155+ dotnet-sdk = dotnetCorePackages.sdk_8_0;
156156+ dotnet-runtime = dotnetCorePackages.runtime_8_0;
151157152158 executables = [ "foo" ]; # This wraps "$out/lib/$pname/foo" to `$out/bin/foo`.
153159 executables = []; # Don't install any executables.
···11-{ config, options, lib, pkgs, ... }:
11+{
22+ config,
33+ options,
44+ lib,
55+ pkgs,
66+ ...
77+}:
2839with lib;
410let
···814 defaultBackend = options.virtualisation.oci-containers.backend.default;
9151016 containerOptions =
1111- { ... }: {
1717+ { ... }:
1818+ {
12191320 options = {
1421···7784 };
78857986 cmd = mkOption {
8080- type = with types; listOf str;
8181- default = [];
8787+ type = with types; listOf str;
8888+ default = [ ];
8289 description = "Commandline arguments to pass to the image's entrypoint.";
8390 example = literalExpression ''
8491 ["--port=9000"]
···87948895 labels = mkOption {
8996 type = with types; attrsOf str;
9090- default = {};
9797+ default = { };
9198 description = "Labels to attach to the container at runtime.";
9299 example = literalExpression ''
93100 {
···105112106113 environment = mkOption {
107114 type = with types; attrsOf str;
108108- default = {};
115115+ default = { };
109116 description = "Environment variables to set for this container.";
110117 example = literalExpression ''
111118 {
112119 DATABASE_HOST = "db.example.com";
113120 DATABASE_PORT = "3306";
114121 }
115115- '';
122122+ '';
116123 };
117124118125 environmentFiles = mkOption {
119126 type = with types; listOf path;
120120- default = [];
127127+ default = [ ];
121128 description = "Environment files for this container.";
122129 example = literalExpression ''
123130 [
124131 /path/to/.env
125132 /path/to/.env.secret
126133 ]
127127- '';
134134+ '';
128135 };
129136130137 log-driver = mkOption {
···147154148155 ports = mkOption {
149156 type = with types; listOf str;
150150- default = [];
157157+ default = [ ];
151158 description = ''
152159 Network ports to publish from the container to the outer host.
153160···194201195202 volumes = mkOption {
196203 type = with types; listOf str;
197197- default = [];
204204+ default = [ ];
198205 description = ''
199206 List of volumes to attach to this container.
200207···222229223230 dependsOn = mkOption {
224231 type = with types; listOf str;
225225- default = [];
232232+ default = [ ];
226233 description = ''
227234 Define which other containers this one depends on. They will be added to both After and Requires for the unit.
228235···247254248255 preRunExtraOptions = mkOption {
249256 type = with types; listOf str;
250250- default = [];
257257+ default = [ ];
251258 description = "Extra options for {command}`${defaultBackend}` that go before the `run` argument.";
252252- example = [ "--runtime" "runsc" ];
259259+ example = [
260260+ "--runtime"
261261+ "runsc"
262262+ ];
253263 };
254264255265 extraOptions = mkOption {
256266 type = with types; listOf str;
257257- default = [];
267267+ default = [ ];
258268 description = "Extra options for {command}`${defaultBackend} run`.";
259269 example = literalExpression ''
260270 ["--network=host"]
···262272 };
263273264274 autoStart = mkOption {
265265- type = types.bool;
275275+ type = with types; bool;
266276 default = true;
267277 description = ''
268278 When enabled, the container is automatically started on boot.
269279 If this option is set to false, the container has to be started on-demand via its service.
270280 '';
271281 };
282282+283283+ pull = mkOption {
284284+ type =
285285+ with types;
286286+ enum [
287287+ "always"
288288+ "missing"
289289+ "never"
290290+ "newer"
291291+ ];
292292+ default = "missing";
293293+ description = ''
294294+ Image pull policy for the container. Must be one of: always, missing, never, newer
295295+ '';
296296+ };
297297+298298+ capAdd = mkOption {
299299+ type = with types; lazyAttrsOf (nullOr bool);
300300+ default = { };
301301+ description = ''
302302+ Capabilities to add to container
303303+ '';
304304+ example = literalExpression ''
305305+ {
306306+ SYS_ADMIN = true;
307307+ {
308308+ '';
309309+ };
310310+311311+ capDrop = mkOption {
312312+ type = with types; lazyAttrsOf (nullOr bool);
313313+ default = { };
314314+ description = ''
315315+ Capabilities to drop from container
316316+ '';
317317+ example = literalExpression ''
318318+ {
319319+ SYS_ADMIN = true;
320320+ {
321321+ '';
322322+ };
323323+324324+ devices = mkOption {
325325+ type = with types; listOf str;
326326+ default = [ ];
327327+ description = ''
328328+ List of devices to attach to this container.
329329+ '';
330330+ example = literalExpression ''
331331+ [
332332+ "/dev/dri:/dev/dri"
333333+ ]
334334+ '';
335335+ };
336336+337337+ privileged = mkOption {
338338+ type = with types; bool;
339339+ default = false;
340340+ description = ''
341341+ Give extended privileges to the container
342342+ '';
343343+ };
344344+345345+ networks = mkOption {
346346+ type = with types; listOf str;
347347+ default = [ ];
348348+ description = ''
349349+ Networks to attach the container to
350350+ '';
351351+ };
272352 };
273353 };
274354275275- isValidLogin = login: login.username != null && login.passwordFile != null && login.registry != null;
355355+ isValidLogin =
356356+ login: login.username != null && login.passwordFile != null && login.registry != null;
276357277277- mkService = name: container: let
278278- dependsOn = map (x: "${cfg.backend}-${x}.service") container.dependsOn;
279279- escapedName = escapeShellArg name;
280280- preStartScript = pkgs.writeShellApplication {
281281- name = "pre-start";
282282- runtimeInputs = [ ];
283283- text = ''
284284- ${cfg.backend} rm -f ${name} || true
285285- ${optionalString (isValidLogin container.login) ''
286286- # try logging in, if it fails, check if image exists locally
287287- ${cfg.backend} login \
288288- ${container.login.registry} \
289289- --username ${container.login.username} \
290290- --password-stdin < ${container.login.passwordFile} \
291291- || ${cfg.backend} image inspect ${container.image} >/dev/null \
292292- || { echo "image doesn't exist locally and login failed" >&2 ; exit 1; }
293293- ''}
294294- ${optionalString (container.imageFile != null) ''
295295- ${cfg.backend} load -i ${container.imageFile}
296296- ''}
297297- ${optionalString (container.imageStream != null) ''
298298- ${container.imageStream} | ${cfg.backend} load
299299- ''}
300300- ${optionalString (cfg.backend == "podman") ''
301301- rm -f /run/podman-${escapedName}.ctr-id
302302- ''}
303303- '';
304304- };
305305- in {
306306- wantedBy = [] ++ optional (container.autoStart) "multi-user.target";
307307- wants = lib.optional (container.imageFile == null && container.imageStream == null) "network-online.target";
308308- after = lib.optionals (cfg.backend == "docker") [ "docker.service" "docker.socket" ]
309309- # if imageFile or imageStream is not set, the service needs the network to download the image from the registry
310310- ++ lib.optionals (container.imageFile == null && container.imageStream == null) [ "network-online.target" ]
311311- ++ dependsOn;
312312- requires = dependsOn;
313313- environment = proxy_env;
358358+ mkService =
359359+ name: container:
360360+ let
361361+ dependsOn = map (x: "${cfg.backend}-${x}.service") container.dependsOn;
362362+ escapedName = escapeShellArg name;
363363+ preStartScript = pkgs.writeShellApplication {
364364+ name = "pre-start";
365365+ runtimeInputs = [ ];
366366+ text = ''
367367+ ${cfg.backend} rm -f ${name} || true
368368+ ${optionalString (isValidLogin container.login) ''
369369+ # try logging in, if it fails, check if image exists locally
370370+ ${cfg.backend} login \
371371+ ${container.login.registry} \
372372+ --username ${container.login.username} \
373373+ --password-stdin < ${container.login.passwordFile} \
374374+ || ${cfg.backend} image inspect ${container.image} >/dev/null \
375375+ || { echo "image doesn't exist locally and login failed" >&2 ; exit 1; }
376376+ ''}
377377+ ${optionalString (container.imageFile != null) ''
378378+ ${cfg.backend} load -i ${container.imageFile}
379379+ ''}
380380+ ${optionalString (container.imageStream != null) ''
381381+ ${container.imageStream} | ${cfg.backend} load
382382+ ''}
383383+ ${optionalString (cfg.backend == "podman") ''
384384+ rm -f /run/podman-${escapedName}.ctr-id
385385+ ''}
386386+ '';
387387+ };
388388+ in
389389+ {
390390+ wantedBy = [ ] ++ optional (container.autoStart) "multi-user.target";
391391+ wants = lib.optional (
392392+ container.imageFile == null && container.imageStream == null
393393+ ) "network-online.target";
394394+ after =
395395+ lib.optionals (cfg.backend == "docker") [
396396+ "docker.service"
397397+ "docker.socket"
398398+ ]
399399+ # if imageFile or imageStream is not set, the service needs the network to download the image from the registry
400400+ ++ lib.optionals (container.imageFile == null && container.imageStream == null) [
401401+ "network-online.target"
402402+ ]
403403+ ++ dependsOn;
404404+ requires = dependsOn;
405405+ environment = proxy_env;
314406315315- path =
316316- if cfg.backend == "docker" then [ config.virtualisation.docker.package ]
317317- else if cfg.backend == "podman" then [ config.virtualisation.podman.package ]
318318- else throw "Unhandled backend: ${cfg.backend}";
407407+ path =
408408+ if cfg.backend == "docker" then
409409+ [ config.virtualisation.docker.package ]
410410+ else if cfg.backend == "podman" then
411411+ [ config.virtualisation.podman.package ]
412412+ else
413413+ throw "Unhandled backend: ${cfg.backend}";
319414320320- script = concatStringsSep " \\\n " ([
321321- "exec ${cfg.backend} "
322322- ] ++ map escapeShellArg container.preRunExtraOptions ++ [
323323- "run"
324324- "--rm"
325325- "--name=${escapedName}"
326326- "--log-driver=${container.log-driver}"
327327- ] ++ optional (container.entrypoint != null)
328328- "--entrypoint=${escapeShellArg container.entrypoint}"
329329- ++ optional (container.hostname != null)
330330- "--hostname=${escapeShellArg container.hostname}"
331331- ++ lib.optionals (cfg.backend == "podman") [
332332- "--cidfile=/run/podman-${escapedName}.ctr-id"
333333- "--cgroups=no-conmon"
334334- "--sdnotify=conmon"
335335- "-d"
336336- "--replace"
337337- ] ++ (mapAttrsToList (k: v: "-e ${escapeShellArg k}=${escapeShellArg v}") container.environment)
338338- ++ map (f: "--env-file ${escapeShellArg f}") container.environmentFiles
339339- ++ map (p: "-p ${escapeShellArg p}") container.ports
340340- ++ optional (container.user != null) "-u ${escapeShellArg container.user}"
341341- ++ map (v: "-v ${escapeShellArg v}") container.volumes
342342- ++ (mapAttrsToList (k: v: "-l ${escapeShellArg k}=${escapeShellArg v}") container.labels)
343343- ++ optional (container.workdir != null) "-w ${escapeShellArg container.workdir}"
344344- ++ map escapeShellArg container.extraOptions
345345- ++ [container.image]
346346- ++ map escapeShellArg container.cmd
347347- );
415415+ script = concatStringsSep " \\\n " (
416416+ [
417417+ "exec ${cfg.backend} "
418418+ ]
419419+ ++ map escapeShellArg container.preRunExtraOptions
420420+ ++ [
421421+ "run"
422422+ "--rm"
423423+ "--name=${escapedName}"
424424+ "--log-driver=${container.log-driver}"
425425+ ]
426426+ ++ optional (container.entrypoint != null) "--entrypoint=${escapeShellArg container.entrypoint}"
427427+ ++ optional (container.hostname != null) "--hostname=${escapeShellArg container.hostname}"
428428+ ++ lib.optionals (cfg.backend == "podman") [
429429+ "--cidfile=/run/podman-${escapedName}.ctr-id"
430430+ "--cgroups=no-conmon"
431431+ "--sdnotify=conmon"
432432+ "-d"
433433+ "--replace"
434434+ ]
435435+ ++ (mapAttrsToList (k: v: "-e ${escapeShellArg k}=${escapeShellArg v}") container.environment)
436436+ ++ map (f: "--env-file ${escapeShellArg f}") container.environmentFiles
437437+ ++ map (p: "-p ${escapeShellArg p}") container.ports
438438+ ++ optional (container.user != null) "-u ${escapeShellArg container.user}"
439439+ ++ map (v: "-v ${escapeShellArg v}") container.volumes
440440+ ++ (mapAttrsToList (k: v: "-l ${escapeShellArg k}=${escapeShellArg v}") container.labels)
441441+ ++ optional (container.workdir != null) "-w ${escapeShellArg container.workdir}"
442442+ ++ optional (container.privileged) "--privileged"
443443+ ++ mapAttrsToList (k: _: "--cap-add=${escapeShellArg k}") (
444444+ filterAttrs (_: v: v == true) container.capAdd
445445+ )
446446+ ++ mapAttrsToList (k: _: "--cap-drop=${escapeShellArg k}") (
447447+ filterAttrs (_: v: v == true) container.capDrop
448448+ )
449449+ ++ map (d: "--device=${escapeShellArg d}") container.devices
450450+ ++ map (n: "--network=${escapeShellArg n}") container.networks
451451+ ++ [ "--pull ${escapeShellArg container.pull}" ]
452452+ ++ map escapeShellArg container.extraOptions
453453+ ++ [ container.image ]
454454+ ++ map escapeShellArg container.cmd
455455+ );
348456349349- preStop = if cfg.backend == "podman"
350350- then "podman stop --ignore --cidfile=/run/podman-${escapedName}.ctr-id"
351351- else "${cfg.backend} stop ${name} || true";
457457+ preStop =
458458+ if cfg.backend == "podman" then
459459+ "podman stop --ignore --cidfile=/run/podman-${escapedName}.ctr-id"
460460+ else
461461+ "${cfg.backend} stop ${name} || true";
352462353353- postStop = if cfg.backend == "podman"
354354- then "podman rm -f --ignore --cidfile=/run/podman-${escapedName}.ctr-id"
355355- else "${cfg.backend} rm -f ${name} || true";
463463+ postStop =
464464+ if cfg.backend == "podman" then
465465+ "podman rm -f --ignore --cidfile=/run/podman-${escapedName}.ctr-id"
466466+ else
467467+ "${cfg.backend} rm -f ${name} || true";
356468357357- serviceConfig = {
358358- ### There is no generalized way of supporting `reload` for docker
359359- ### containers. Some containers may respond well to SIGHUP sent to their
360360- ### init process, but it is not guaranteed; some apps have other reload
361361- ### mechanisms, some don't have a reload signal at all, and some docker
362362- ### images just have broken signal handling. The best compromise in this
363363- ### case is probably to leave ExecReload undefined, so `systemctl reload`
364364- ### will at least result in an error instead of potentially undefined
365365- ### behaviour.
366366- ###
367367- ### Advanced users can still override this part of the unit to implement
368368- ### a custom reload handler, since the result of all this is a normal
369369- ### systemd service from the perspective of the NixOS module system.
370370- ###
371371- # ExecReload = ...;
372372- ###
373373- ExecStartPre = [ "${preStartScript}/bin/pre-start" ];
374374- TimeoutStartSec = 0;
375375- TimeoutStopSec = 120;
376376- Restart = "always";
377377- } // optionalAttrs (cfg.backend == "podman") {
378378- Environment="PODMAN_SYSTEMD_UNIT=podman-${name}.service";
379379- Type="notify";
380380- NotifyAccess="all";
469469+ serviceConfig =
470470+ {
471471+ ### There is no generalized way of supporting `reload` for docker
472472+ ### containers. Some containers may respond well to SIGHUP sent to their
473473+ ### init process, but it is not guaranteed; some apps have other reload
474474+ ### mechanisms, some don't have a reload signal at all, and some docker
475475+ ### images just have broken signal handling. The best compromise in this
476476+ ### case is probably to leave ExecReload undefined, so `systemctl reload`
477477+ ### will at least result in an error instead of potentially undefined
478478+ ### behaviour.
479479+ ###
480480+ ### Advanced users can still override this part of the unit to implement
481481+ ### a custom reload handler, since the result of all this is a normal
482482+ ### systemd service from the perspective of the NixOS module system.
483483+ ###
484484+ # ExecReload = ...;
485485+ ###
486486+ ExecStartPre = [ "${preStartScript}/bin/pre-start" ];
487487+ TimeoutStartSec = 0;
488488+ TimeoutStopSec = 120;
489489+ Restart = "always";
490490+ }
491491+ // optionalAttrs (cfg.backend == "podman") {
492492+ Environment = "PODMAN_SYSTEMD_UNIT=podman-${name}.service";
493493+ Type = "notify";
494494+ NotifyAccess = "all";
495495+ };
381496 };
382382- };
383497384384-in {
498498+in
499499+{
385500 imports = [
386386- (
387387- lib.mkChangedOptionModule
388388- [ "docker-containers" ]
389389- [ "virtualisation" "oci-containers" ]
390390- (oldcfg: {
391391- backend = "docker";
392392- containers = lib.mapAttrs (n: v: builtins.removeAttrs (v // {
393393- extraOptions = v.extraDockerOptions or [];
394394- }) [ "extraDockerOptions" ]) oldcfg.docker-containers;
395395- })
396396- )
501501+ (lib.mkChangedOptionModule [ "docker-containers" ] [ "virtualisation" "oci-containers" ] (oldcfg: {
502502+ backend = "docker";
503503+ containers = lib.mapAttrs (
504504+ n: v:
505505+ builtins.removeAttrs (
506506+ v
507507+ // {
508508+ extraOptions = v.extraDockerOptions or [ ];
509509+ }
510510+ ) [ "extraDockerOptions" ]
511511+ ) oldcfg.docker-containers;
512512+ }))
397513 ];
398514399515 options.virtualisation.oci-containers = {
400516401517 backend = mkOption {
402402- type = types.enum [ "podman" "docker" ];
518518+ type = types.enum [
519519+ "podman"
520520+ "docker"
521521+ ];
403522 default = if versionAtLeast config.system.stateVersion "22.05" then "podman" else "docker";
404523 description = "The underlying Docker implementation to use.";
405524 };
406525407526 containers = mkOption {
408408- default = {};
527527+ default = { };
409528 type = types.attrsOf (types.submodule containerOptions);
410529 description = "OCI (Docker) containers to run as systemd services.";
411530 };
412531413532 };
414533415415- config = lib.mkIf (cfg.containers != {}) (lib.mkMerge [
416416- {
417417- systemd.services = mapAttrs' (n: v: nameValuePair "${cfg.backend}-${n}" (mkService n v)) cfg.containers;
534534+ config = lib.mkIf (cfg.containers != { }) (
535535+ lib.mkMerge [
536536+ {
537537+ systemd.services = mapAttrs' (
538538+ n: v: nameValuePair "${cfg.backend}-${n}" (mkService n v)
539539+ ) cfg.containers;
418540419419- assertions =
420420- let
421421- toAssertion = _: { imageFile, imageStream, ... }:
422422- { assertion = imageFile == null || imageStream == null;
541541+ assertions =
542542+ let
543543+ toAssertion =
544544+ _:
545545+ { imageFile, imageStream, ... }:
546546+ {
547547+ assertion = imageFile == null || imageStream == null;
423548424424- message = "You can only define one of imageFile and imageStream";
425425- };
549549+ message = "You can only define one of imageFile and imageStream";
550550+ };
426551427427- in
552552+ in
428553 lib.mapAttrsToList toAssertion cfg.containers;
429429- }
430430- (lib.mkIf (cfg.backend == "podman") {
431431- virtualisation.podman.enable = true;
432432- })
433433- (lib.mkIf (cfg.backend == "docker") {
434434- virtualisation.docker.enable = true;
435435- })
436436- ]);
554554+ }
555555+ (lib.mkIf (cfg.backend == "podman") {
556556+ virtualisation.podman.enable = true;
557557+ })
558558+ (lib.mkIf (cfg.backend == "docker") {
559559+ virtualisation.docker.enable = true;
560560+ })
561561+ ]
562562+ );
437563438564}
+4-3
nixos/tests/networking/networkd-and-scripted.nix
···120120 };
121121 };
122122 testScript = ''
123123- start_all()
123123+ router.start()
124124+ router.systemctl("start network-online.target")
125125+ router.wait_for_unit("network-online.target")
124126127127+ client.start()
125128 client.wait_for_unit("network.target")
126126- router.systemctl("start network-online.target")
127127- router.wait_for_unit("network-online.target")
128129129130 with subtest("Wait until we have an ip address on each interface"):
130131 client.wait_until_succeeds("ip addr show dev enp1s0 | grep -q '192.168.1'")
···1313lib.makeOverridable (lib.fetchers.withNormalizedHash { } (
1414# NOTE Please document parameter additions or changes in
1515# doc/build-helpers/fetchers.chapter.md
1616-{ url, rev ? "HEAD", leaveDotGit ? deepClone
1616+{ url
1717+, tag ? null
1818+, rev ? null
1919+, leaveDotGit ? deepClone
1720, outputHash ? lib.fakeHash, outputHashAlgo ? null
1821, fetchSubmodules ? true, deepClone ? false
1922, branchName ? null
2023, sparseCheckout ? []
2124, nonConeMode ? false
2222-, name ? urlToName url rev
2525+, name ? null
2326, # Shell code executed after the file has been fetched
2427 # successfully. This can do things like check or transform the file.
2528 postFetch ? ""
···5962assert deepClone -> leaveDotGit;
6063assert nonConeMode -> (sparseCheckout != []);
61646565+let
6666+ revWithTag =
6767+ let
6868+ warningMsg = "fetchgit requires one of either `rev` or `tag` to be provided (not both).";
6969+ otherIsNull = other: lib.assertMsg (other == null) warningMsg;
7070+ in
7171+ if tag != null then
7272+ assert (otherIsNull rev);
7373+ "refs/tags/${tag}"
7474+ else if rev != null then
7575+ assert (otherIsNull tag);
7676+ rev
7777+ else
7878+ # FIXME fetching HEAD if no rev or tag is provided is problematic at best
7979+ "HEAD";
8080+in
8181+6282if builtins.isString sparseCheckout then
6383 # Changed to throw on 2023-06-04
6484 throw "Please provide directories/patterns for sparse checkout as a list of strings. Passing a (multi-line) string is not supported any more."
6585else
6686stdenvNoCC.mkDerivation {
6767- inherit name;
8787+ name = if name != null then name else urlToName url revWithTag;
8888+6889 builder = ./builder.sh;
6990 fetcher = ./nix-prefetch-git;
7091···79100 # > from standard in as a newline-delimited list instead of from the arguments.
80101 sparseCheckout = builtins.concatStringsSep "\n" sparseCheckout;
811028282- inherit url rev leaveDotGit fetchLFS fetchSubmodules deepClone branchName nonConeMode postFetch;
103103+ inherit url leaveDotGit fetchLFS fetchSubmodules deepClone branchName nonConeMode postFetch;
104104+ rev = revWithTag;
8310584106 postHook = if netrcPhase == null then null else ''
85107 ${netrcPhase}
+13-5
pkgs/build-support/fetchgithub/default.nix
···11{ lib, fetchgit, fetchzip }:
2233lib.makeOverridable (
44-{ owner, repo, rev, name ? "source"
44+{ owner, repo
55+, tag ? null
66+, rev ? null
77+, name ? "source"
58, fetchSubmodules ? false, leaveDotGit ? null
69, deepClone ? false, private ? false, forceFetchGit ? false
710, fetchLFS ? false
···1114, ... # For hash agility
1215}@args:
13161717+assert (lib.assertMsg (lib.xor (tag == null) (rev == null)) "fetchFromGitHub requires one of either `rev` or `tag` to be provided (not both).");
1818+1419let
15201621 position = (if args.meta.description or null != null
1722 then builtins.unsafeGetAttrPos "description" args.meta
1818- else builtins.unsafeGetAttrPos "rev" args
2323+ else if tag != null then
2424+ builtins.unsafeGetAttrPos "tag" args
2525+ else
2626+ builtins.unsafeGetAttrPos "rev" args
1927 );
2028 baseUrl = "https://${githubBase}/${owner}/${repo}";
2129 newMeta = meta // {
···2432 # to indicate where derivation originates, similar to make-derivation.nix's mkDerivation
2533 position = "${position.file}:${toString position.line}";
2634 };
2727- passthruAttrs = removeAttrs args [ "owner" "repo" "rev" "fetchSubmodules" "forceFetchGit" "private" "githubBase" "varPrefix" ];
3535+ passthruAttrs = removeAttrs args [ "owner" "repo" "tag" "rev" "fetchSubmodules" "forceFetchGit" "private" "githubBase" "varPrefix" ];
2836 varBase = "NIX${lib.optionalString (varPrefix != null) "_${varPrefix}"}_GITHUB_PRIVATE_";
2937 useFetchGit = fetchSubmodules || (leaveDotGit == true) || deepClone || forceFetchGit || fetchLFS || (sparseCheckout != []);
3038 # We prefer fetchzip in cases we don't need submodules as the hash
···53615462 fetcherArgs = (if useFetchGit
5563 then {
5656- inherit rev deepClone fetchSubmodules sparseCheckout fetchLFS; url = gitRepoUrl;
6464+ inherit tag rev deepClone fetchSubmodules sparseCheckout fetchLFS; url = gitRepoUrl;
5765 } // lib.optionalAttrs (leaveDotGit != null) { inherit leaveDotGit; }
5866 else {
5959- url = "${baseUrl}/archive/${rev}.tar.gz";
6767+ url = "${baseUrl}/archive/${if tag != null then "refs/tags/${tag}" else rev}.tar.gz";
60686169 passthru = {
6270 inherit gitRepoUrl;
···7788rustPlatform.buildRustPackage rec {
99 pname = "nickel";
1010- version = "1.8.1";
1010+ version = "1.9.0";
11111212 src = fetchFromGitHub {
1313 owner = "tweag";
1414 repo = "nickel";
1515 rev = "refs/tags/${version}";
1616- hash = "sha256-hlcF04m3SI66d1C9U1onog2QoEMfqtHb7V++47ZmeW4=";
1616+ hash = "sha256-chIpZqs1tyXk4YQBlF4K/Ofrn1CrijbYant9+SSppGU=";
1717 };
18181919- cargoHash = "sha256-VFjZb7lsqOSt5Rc94dhS4Br/5i/HXPHZMqC1c0/LzHU=";
1919+ cargoHash = "sha256-MaMzwvvWP+vmdBVCefXI6dehuTyPcPW2b6KdarxjBjA=";
20202121 cargoBuildFlags = [ "-p nickel-lang-cli" "-p nickel-lang-lsp" ];
2222···2525 ];
26262727 outputs = [ "out" "nls" ];
2828+2929+ # This fixes the way comrak is defined as a dependency, without the sed the build fails:
3030+ #
3131+ # cargo metadata failure: error: Package `nickel-lang-core v0.10.0
3232+ # (/build/source/core)` does not have feature `comrak`. It has an optional
3333+ # dependency with that name, but that dependency uses the "dep:" syntax in
3434+ # the features table, so it does not have an implicit feature with that name.
3535+ preBuild = ''
3636+ sed -i 's/dep:comrak/comrak/' core/Cargo.toml
3737+ '';
28382939 postInstall = ''
3040 mkdir -p $nls/bin