mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
ptyxis: init module (#7075)
This commit is contained in:
parent
d2263ce5f4
commit
74d31e1165
5 changed files with 115 additions and 0 deletions
|
|
@ -234,6 +234,7 @@ let
|
|||
./programs/poetry.nix
|
||||
./programs/powerline-go.nix
|
||||
./programs/pqiv.nix
|
||||
./programs/ptyxis.nix
|
||||
./programs/pubs.nix
|
||||
./programs/pyenv.nix
|
||||
./programs/pylint.nix
|
||||
|
|
|
|||
74
modules/programs/ptyxis.nix
Normal file
74
modules/programs/ptyxis.nix
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) types mkIf;
|
||||
|
||||
iniFormat = pkgs.formats.ini { };
|
||||
cfg = config.programs.ptyxis;
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ lib.maintainers.awwpotato ];
|
||||
|
||||
options.programs.ptyxis = {
|
||||
enable = lib.mkEnableOption "ptyxis";
|
||||
|
||||
package = lib.mkPackageOption pkgs "ptyxis" { nullable = true; };
|
||||
|
||||
palettes = lib.mkOption {
|
||||
type =
|
||||
with types;
|
||||
attrsOf (oneOf [
|
||||
iniFormat.type
|
||||
path
|
||||
str
|
||||
]);
|
||||
default = { };
|
||||
description = ''
|
||||
Written to {file}`$XDG_CONFIG_HOME/org.gnome.Prompt/palettes/NAME.palette`.
|
||||
See <https://gitlab.gnome.org/chergert/ptyxis/-/tree/main/data/palettes>
|
||||
for more information.
|
||||
'';
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
myPalette = {
|
||||
Palette.Name = "My awesome theme";
|
||||
Light = {
|
||||
Foreground="#E2E2E3";
|
||||
Background="#2C2E34";
|
||||
Color0="#2C2E34";
|
||||
Color1="#FC5D7C";
|
||||
Color2="#9ED072";
|
||||
Color3="#E7C664";
|
||||
Color4="#F39660";
|
||||
};
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
(lib.hm.assertions.assertPlatform "programs.ptyxis" pkgs lib.platforms.linux)
|
||||
];
|
||||
|
||||
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
||||
|
||||
xdg.configFile = lib.mapAttrs' (
|
||||
name: value:
|
||||
lib.nameValuePair "org.gnome.Prompt/palettes/${name}.palette" {
|
||||
source =
|
||||
if lib.isString value then
|
||||
pkgs.writeText "ptyxis-theme-${name}" value
|
||||
else if builtins.isPath value || lib.isStorePath value then
|
||||
value
|
||||
else
|
||||
iniFormat.generate "ptyxis-theme-${name}" value;
|
||||
}
|
||||
) cfg.palettes;
|
||||
};
|
||||
}
|
||||
|
|
@ -392,6 +392,7 @@ import nmtSrc {
|
|||
./modules/programs/onagre
|
||||
./modules/programs/onedrive
|
||||
./modules/programs/pqiv
|
||||
./modules/programs/ptyxis
|
||||
./modules/programs/rbw
|
||||
./modules/programs/rofi
|
||||
./modules/programs/rofi-pass
|
||||
|
|
|
|||
3
tests/modules/programs/ptyxis/default.nix
Normal file
3
tests/modules/programs/ptyxis/default.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
ptyxis-basic-palette = ./palette.nix;
|
||||
}
|
||||
36
tests/modules/programs/ptyxis/palette.nix
Normal file
36
tests/modules/programs/ptyxis/palette.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.ptyxis = {
|
||||
enable = true;
|
||||
palettes.myTheme = {
|
||||
Palette.Name = "My awesome theme";
|
||||
Light = {
|
||||
Foreground = "#E2E2E3";
|
||||
Background = "#2C2E34";
|
||||
Color0 = "#2C2E34";
|
||||
Color1 = "#FC5D7C";
|
||||
Color2 = "#9ED072";
|
||||
Color3 = "#E7C664";
|
||||
Color4 = "#F39660";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/org.gnome.Prompt/palettes/myTheme.palette
|
||||
assertFileContent home-files/.config/org.gnome.Prompt/palettes/myTheme.palette \
|
||||
${pkgs.writeText "expected-ptyxis-theme" ''
|
||||
[Light]
|
||||
Background=#2C2E34
|
||||
Color0=#2C2E34
|
||||
Color1=#FC5D7C
|
||||
Color2=#9ED072
|
||||
Color3=#E7C664
|
||||
Color4=#F39660
|
||||
Foreground=#E2E2E3
|
||||
|
||||
[Palette]
|
||||
Name=My awesome theme
|
||||
''}
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue