gtksourceview: init module (#958)
Link: https://github.com/nix-community/stylix/pull/958 Reviewed-by: Daniel Thwaites <danth@danth.me> Reviewed-by: awwpotato <awwpotato@voidq.com> Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com> Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
parent
0da583a359
commit
05752c77ac
8 changed files with 81 additions and 30 deletions
|
|
@ -8,7 +8,7 @@ mkTarget {
|
|||
{
|
||||
xdg.dataFile = {
|
||||
"gedit/styles/stylix.xml".source = colors {
|
||||
template = ./template.xml.mustache;
|
||||
template = ../gtksourceview/template.xml.mustache;
|
||||
extension = ".xml";
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
name = "GNOME Text Editor";
|
||||
homepage = "https://gitlab.gnome.org/GNOME/gnome-text-editor";
|
||||
maintainers = [ ];
|
||||
maintainers = [ lib.maintainers.bricked ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
style = config.lib.stylix.colors {
|
||||
template = ../gedit/template.xml.mustache;
|
||||
extension = ".xml";
|
||||
};
|
||||
in
|
||||
{
|
||||
overlay =
|
||||
_: prev:
|
||||
lib.optionalAttrs
|
||||
(
|
||||
config.stylix.enable && config.stylix.targets.gnome-text-editor.enable or false
|
||||
)
|
||||
{
|
||||
gnome-text-editor = prev.gnome-text-editor.overrideAttrs (oldAttrs: {
|
||||
postFixup = ''
|
||||
${oldAttrs.postFixup or ""}
|
||||
mkdir -p $out/share/gtksourceview-5/styles
|
||||
cp ${style} $out/share/gtksourceview-5/styles/stylix.xml
|
||||
'';
|
||||
});
|
||||
};
|
||||
}
|
||||
28
modules/gtksourceview/hm.nix
Normal file
28
modules/gtksourceview/hm.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{ mkTarget, lib, ... }:
|
||||
mkTarget {
|
||||
name = "gtksourceview";
|
||||
humanName = "GTKSourceView";
|
||||
|
||||
configElements =
|
||||
{ colors, ... }:
|
||||
{
|
||||
xdg.dataFile = builtins.listToAttrs (
|
||||
map
|
||||
(
|
||||
version:
|
||||
lib.nameValuePair "gtksourceview-${version}/styles/stylix.xml" {
|
||||
source = colors {
|
||||
template = ./template.xml.mustache;
|
||||
extension = ".xml";
|
||||
};
|
||||
}
|
||||
)
|
||||
[
|
||||
"2.0"
|
||||
"3.0"
|
||||
"4"
|
||||
"5"
|
||||
]
|
||||
);
|
||||
};
|
||||
}
|
||||
5
modules/gtksourceview/meta.nix
Normal file
5
modules/gtksourceview/meta.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
maintainers = [ lib.maintainers.bricked ];
|
||||
name = "GTKSourceView";
|
||||
}
|
||||
8
modules/gtksourceview/nixos.nix
Normal file
8
modules/gtksourceview/nixos.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{ mkTarget, ... }:
|
||||
|
||||
mkTarget {
|
||||
name = "gtksourceview";
|
||||
humanName = "GTKSourceView";
|
||||
|
||||
# Used to enable overlay.
|
||||
}
|
||||
37
modules/gtksourceview/overlay.nix
Normal file
37
modules/gtksourceview/overlay.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
inherit (lib) optionalAttrs;
|
||||
inherit (config.lib.stylix) colors;
|
||||
|
||||
style = colors {
|
||||
template = ./template.xml.mustache;
|
||||
extension = ".xml";
|
||||
};
|
||||
|
||||
attrsOverride = version: oldAttrs: {
|
||||
postFixup = ''
|
||||
${oldAttrs.postFixup or ""}
|
||||
styles_dir="$out/share/gtksourceview-${version}/styles"
|
||||
mkdir --parents "$styles_dir"
|
||||
cp ${style} "$styles_dir/stylix.xml"
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
overlay =
|
||||
_final: prev:
|
||||
optionalAttrs
|
||||
(
|
||||
config.stylix.enable
|
||||
&& config.stylix.targets ? gtksourceview
|
||||
&& config.stylix.targets.gtksourceview.enable
|
||||
)
|
||||
{
|
||||
gnome2.gtksourceview = prev.gnome2.gtksourceview.overrideAttrs (
|
||||
attrsOverride "2.0"
|
||||
);
|
||||
gtksourceview = prev.gtksourceview.overrideAttrs (attrsOverride "3.0");
|
||||
gtksourceview4 = prev.gtksourceview4.overrideAttrs (attrsOverride "4");
|
||||
gtksourceview5 = prev.gtksourceview5.overrideAttrs (attrsOverride "5");
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue