|
1 |
| -{ config, pkgs, lib, ... }: |
| 1 | +{ config, pkgs, lib, bootstrapPkgs ? null, ... }: |
2 | 2 | let
|
3 | 3 | types = lib.types;
|
4 | 4 | # Returns a list of all the entries in a folder
|
|
60 | 60 | default = "";
|
61 | 61 | };
|
62 | 62 |
|
| 63 | + overlays = lib.mkOption { |
| 64 | + type = types.listOf (types.functionTo (types.functionTo types.attrs)); |
| 65 | + description = "List of overlays to apply to pkgs. Each overlay is a function that takes two arguments: final and prev. Supported by devenv 1.4.2 or newer."; |
| 66 | + default = [ ]; |
| 67 | + example = lib.literalExpression '' |
| 68 | + [ |
| 69 | + (final: prev: { |
| 70 | + hello = prev.hello.overrideAttrs (oldAttrs: { |
| 71 | + patches = (oldAttrs.patches or []) ++ [ ./hello-fix.patch ]; |
| 72 | + }); |
| 73 | + }) |
| 74 | + ] |
| 75 | + ''; |
| 76 | + }; |
| 77 | + |
63 | 78 | packages = lib.mkOption {
|
64 | 79 | type = types.listOf types.package;
|
65 | 80 | description = "A list of packages to expose inside the developer environment. Search available packages using ``devenv search NAME``.";
|
|
243 | 258 | See https://devenv.sh/guides/using-with-flakes/ how to use it with flakes.
|
244 | 259 | '';
|
245 | 260 | }
|
| 261 | + { |
| 262 | + assertion = !config.devenv.flakesIntegration && config.overlays != [ ] && lib.versionAtLeast config.devenv.cliVersion "1.4.2"; |
| 263 | + message = '' |
| 264 | + Using overlays requires devenv 1.4.2 or higher, while your current version is ${config.devenv.cliVersion}. |
| 265 | + ''; |
| 266 | + } |
246 | 267 | ];
|
247 | 268 | # use builtins.toPath to normalize path if root is "/" (container)
|
248 | 269 | devenv.state = builtins.toPath (config.devenv.dotfile + "/state");
|
|
312 | 333 | infoSections."env" = lib.mapAttrsToList (name: value: "${name}: ${toString value}") config.env;
|
313 | 334 | infoSections."packages" = builtins.map (package: package.name) (builtins.filter (package: !(builtins.elem package.name (builtins.attrNames config.scripts))) config.packages);
|
314 | 335 |
|
| 336 | + _module.args.pkgs = import bootstrapPkgs.path { |
| 337 | + system = bootstrapPkgs.stdenv.hostPlatform.system; |
| 338 | + config = bootstrapPkgs.config; |
| 339 | + overlays = bootstrapPkgs.overlays ++ config.overlays; |
| 340 | + }; |
| 341 | + |
315 | 342 | ci = [ config.shell ];
|
316 | 343 | ciDerivation = pkgs.runCommand "ci" { } "echo ${toString config.ci} > $out";
|
317 | 344 | };
|
|
0 commit comments