helm/modules/themes/default.nix

57 lines
1.7 KiB
Nix
Raw Normal View History

2020-03-28 22:48:43 -07:00
{ config, options, lib, pkgs, ... }:
2019-08-06 10:56:54 -07:00
2020-03-28 22:48:43 -07:00
with lib;
2019-08-06 10:56:54 -07:00
{
2020-03-28 22:48:43 -07:00
imports = [
# aquanaut = callPackage (import ./aquanaut {});
./fluorescence
];
2020-01-12 15:17:17 -08:00
2020-03-28 22:48:43 -07:00
options.modules.theme = {
name = mkOption { type = with types; nullOr str; default = null; };
version = mkOption { type = with types; nullOr str; default = null; };
path = mkOption {
type = with types; nullOr path;
default = null;
};
wallpaper = {
path = mkOption {
type = with types; nullOr str;
default = if config.modules.theme.path != null
then "${config.modules.theme.path}/wallpaper.png"
else null;
};
filter = {
enable = mkOption {
type = types.bool;
default = true;
};
options = mkOption {
type = types.str;
default = "-gaussian-blur 0x2 -modulate 70 -level 5%";
};
};
};
};
config = mkIf (config.modules.theme.wallpaper.path != null &&
builtins.pathExists config.modules.theme.wallpaper.path) {
my.home.home.file.".background-image".source =
config.modules.theme.wallpaper.path;
services.xserver.displayManager.lightdm.background =
mkIf config.modules.theme.wallpaper.filter.enable
(let filteredPath = "wallpaper.filtered.png";
filteredWallpaper =
with pkgs; runCommand "filterWallpaper"
{ buildInputs = [ imagemagick ]; } ''
mkdir "$out"
convert ${config.modules.theme.wallpaper.filter.options} \
${config.modules.theme.wallpaper.path} $out/${filteredPath}
'';
in "${filteredWallpaper}/${filteredPath}");
};
2019-08-06 10:56:54 -07:00
}