mirror of
https://github.com/nix-community/home-manager.git
synced 2025-04-09 10:34:44 +00:00
Merge 2687f74630
into 94605dcade
This commit is contained in:
commit
55d5276a53
1 changed files with 33 additions and 0 deletions
|
@ -17,6 +17,33 @@ in {
|
|||
description = "The Alacritty package to install.";
|
||||
};
|
||||
|
||||
theme = mkOption {
|
||||
type = let
|
||||
themes = with lib;
|
||||
pipe pkgs.alacritty-theme [
|
||||
builtins.readDir
|
||||
(filterAttrs
|
||||
(name: type: type == "regular" && hasSuffix ".toml" name))
|
||||
attrNames
|
||||
(map (removeSuffix ".toml"))
|
||||
];
|
||||
in with types;
|
||||
nullOr (enum themes) // {
|
||||
description = ''
|
||||
a theme present in [`alacritty-theme`], i.e. its filename without extension
|
||||
[`alacritty-theme`]: https://github.com/alacritty/alacritty-theme/tree/${pkgs.alacritty-theme.src.rev}/themes
|
||||
'';
|
||||
};
|
||||
default = null;
|
||||
example = "solarized_dark";
|
||||
description = ''
|
||||
A theme to import in the configuration, taken from the [`alacritty-theme`] repository,
|
||||
as [packaged] in `nixpkgs`.
|
||||
[`alacritty-theme`]: https://github.com/alacritty/alacritty-theme
|
||||
[packaged]: https://search.nixos.org/packages?query=alacritty-theme
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = tomlFormat.type;
|
||||
default = { };
|
||||
|
@ -50,6 +77,12 @@ in {
|
|||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
programs.alacritty.settings.general.import =
|
||||
mkIf (cfg.theme != null && lib.versionAtLeast cfg.package.version "0.14") [ "${pkgs.alacritty-theme}/${cfg.theme}.toml" ];
|
||||
|
||||
programs.alacritty.settings.import =
|
||||
mkIf (cfg.theme != null && lib.versionOlder cfg.package.version "0.14") [ "${pkgs.alacritty-theme}/${cfg.theme}.toml" ];
|
||||
|
||||
xdg.configFile."alacritty/alacritty.toml" = lib.mkIf (cfg.settings != { }) {
|
||||
source = (tomlFormat.generate "alacritty.toml" cfg.settings).overrideAttrs
|
||||
(finalAttrs: prevAttrs: {
|
||||
|
|
Loading…
Add table
Reference in a new issue