mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
Import-from-derivation (IFD) has problematic performance, and is disabled in Nixpkgs by policy. It is arguably good practice for libraries to avoid it whenever possible, as it has poor ergonomics in some cases, especially with dry builds, as it requires multiple eval+build phases. As such, prevent its use in Home Manager by default by putting existing tests that use IFD behind a config. In CI, run a first pass with IFD disabled, skipping tests without the config. Then run a second pass with IFD enabled and including tests with the config. This second pass will also run tests without the config, but they should be cached from the previous run, so the cost is not double (only eval time should be paid twice). It’s necessary to change from using NMT’s `run` to `build` as `run` itself uses IFD. Of the tests that have the config: - kitty/theme-to-themeFile: this is a test for deprecated config, and so should be removed eventually anyway - podman: the implementation relies on IFD to create individual systemd units from the derivation output, and so it is not straightforward to remove the IFD; doing so would require rethinking how the module works to instead have the systemd unit files included as-is rather than as individually configured units in the Nix config.
30 lines
827 B
Nix
30 lines
827 B
Nix
{
|
|
config,
|
|
lib,
|
|
options,
|
|
realPkgs,
|
|
...
|
|
}:
|
|
|
|
lib.mkIf config.test.enableLegacyIfd {
|
|
programs.kitty = {
|
|
enable = true;
|
|
theme = "Space Gray Eighties";
|
|
};
|
|
|
|
test.asserts.warnings.enable = true;
|
|
test.asserts.warnings.expected = [
|
|
(
|
|
"The option `programs.kitty.theme' defined in ${lib.showFiles options.programs.kitty.theme.files} has been changed to `programs.kitty.themeFile' that has a different"
|
|
+ " type. Please read `programs.kitty.themeFile' documentation and"
|
|
+ " update your configuration accordingly."
|
|
)
|
|
];
|
|
|
|
nixpkgs.overlays = [ (self: super: { inherit (realPkgs) kitty-themes; }) ];
|
|
|
|
nmt.script = ''
|
|
assertFileExists home-files/.config/kitty/kitty.conf
|
|
assertFileRegex home-files/.config/kitty/kitty.conf "^include .*themes/SpaceGray_Eighties\.conf$"
|
|
'';
|
|
}
|