stylix: improve stylix.image type (#1414)

Previously:

- Out-of-store paths were not necessarily copied to store.

- Derivations were needlessly coerced to strings.

- `package` and `path` were both used, despite `path` being a superset
  of `package`.

Link: https://github.com/nix-community/stylix/pull/1414

Reviewed-by: awwpotato <awwpotato@voidq.com>
Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
Matt Sturgeon 2025-05-30 01:13:13 +01:00 committed by GitHub
parent 4a121321d3
commit 838df8b8ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -29,7 +29,10 @@ in
};
image = lib.mkOption {
type = with lib.types; nullOr (coercedTo package toString path);
type = lib.types.nullOr lib.types.path;
# Ensure the path is copied to the store
apply =
value: if value == null || lib.isDerivation value then value else "${value}";
description = ''
Wallpaper image.