Skip to content

Commit

Permalink
Merge branch 'master' into kakoune
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Zivota committed Apr 4, 2019
2 parents df7e72f + 995fa3a commit 9fbc188
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 16 deletions.
2 changes: 1 addition & 1 deletion modules/home-environment.nix
Expand Up @@ -146,7 +146,7 @@ in

home.sessionVariables = mkOption {
default = {};
type = types.attrs;
type = with types; attrsOf (either int str);
example = { EDITOR = "emacs"; GS_OPTIONS = "-sPAPERSIZE=a4"; };
description = ''
Environment variables to always set at login.
Expand Down
2 changes: 1 addition & 1 deletion modules/misc/gtk.nix
Expand Up @@ -120,7 +120,7 @@ in

gtk3 = {
extraConfig = mkOption {
type = types.attrs;
type = with types; attrsOf (either bool (either int str));
default = {};
example = { gtk-cursor-blink = false; gtk-recent-files-limit = 20; };
description = ''
Expand Down
2 changes: 1 addition & 1 deletion modules/misc/pam.nix
Expand Up @@ -14,7 +14,7 @@ in
options = {
pam.sessionVariables = mkOption {
default = {};
type = types.attrs;
type = with types; attrsOf (either int str);
example = { EDITOR = "vim"; };
description = ''
Environment variables that will be set for the PAM session.
Expand Down
53 changes: 45 additions & 8 deletions modules/misc/qt.nix
Expand Up @@ -12,27 +12,64 @@ in
{
meta.maintainers = [ maintainers.rycee ];

imports = [
(mkChangedOptionModule
[ "qt" "useGtkTheme" ]
[ "qt" "platformTheme" ]
(config:
if getAttrFromPath [ "qt" "useGtkTheme" ] config
then "gtk"
else null))
];

options = {
qt = {
enable = mkEnableOption "Qt 4 and 5 configuration";

useGtkTheme = mkOption {
type = types.bool;
default = false;
platformTheme = mkOption {
type = types.nullOr (types.enum [ "gtk" "gnome" ]);
default = null;
example = "gnome";
relatedPackages = [
"qgnomeplatform"
["libsForQt5" "qtstyleplugins"]
];
description = ''
Whether Qt 4 and 5 should be set up to use the GTK theme
settings.
Selects the platform theme to use for Qt applications.</para>
<para>The options are
<variablelist>
<varlistentry>
<term><literal>gtk</literal></term>
<listitem><para>Use GTK theme with
<link xlink:href="https://github.com/qt/qtstyleplugins">qtstyleplugins</link>
</para></listitem>
</varlistentry>
<varlistentry>
<term><literal>gnome</literal></term>
<listitem><para>Use GNOME theme with
<link xlink:href="https://github.com/FedoraQt/QGnomePlatform">qgnomeplatform</link>
</para></listitem>
</varlistentry>
</variablelist>
'';
};
};
};

config = mkIf (cfg.enable && cfg.useGtkTheme) {
home.sessionVariables.QT_QPA_PLATFORMTHEME = "gtk2";
home.packages = [ pkgs.libsForQt5.qtstyleplugins ];
config = mkIf (cfg.enable && cfg.platformTheme != null) {
home.sessionVariables.QT_QPA_PLATFORMTHEME =
if cfg.platformTheme == "gnome" then "gnome" else "gtk2";

home.packages =
if cfg.platformTheme == "gnome"
then [ pkgs.qgnomeplatform ]
else [ pkgs.libsForQt5.qtstyleplugins ];

xsession.profileExtra =
"systemctl --user import-environment QT_QPA_PLATFORMTHEME";

# Enable GTK+ style for Qt4 in either case.
# It doesn’t support the platform theme packages.
home.activation.useGtkThemeInQt4 = dag.entryAfter ["writeBoundary"] ''
$DRY_RUN_CMD ${pkgs.crudini}/bin/crudini $VERBOSE_ARG \
--set "${config.xdg.configHome}/Trolltech.conf" Qt style GTK+
Expand Down
4 changes: 2 additions & 2 deletions modules/programs/bash.nix
Expand Up @@ -72,7 +72,7 @@ in

sessionVariables = mkOption {
default = {};
type = types.attrs;
type = with types; attrsOf (either int str);
example = { MAILCHECK = 30; };
description = ''
Environment variables that will be set for the Bash session.
Expand All @@ -81,12 +81,12 @@ in

shellAliases = mkOption {
default = {};
type = types.attrsOf types.str;
example = { ll = "ls -l"; ".." = "cd .."; };
description = ''
An attribute set that maps aliases (the top level attribute names in
this option) to command strings or directly to build outputs.
'';
type = types.attrs;
};

enableAutojump = mkOption {
Expand Down
2 changes: 1 addition & 1 deletion modules/programs/feh.nix
Expand Up @@ -17,7 +17,7 @@ in

keybindings = mkOption {
default = {};
type = types.attrs;
type = types.attrsOf types.str;
example = { zoom_in = "plus"; zoom_out = "minus"; };
description = ''
Set keybindings.
Expand Down
58 changes: 58 additions & 0 deletions modules/programs/gnome-terminal.nix
Expand Up @@ -11,6 +11,22 @@ let
. ${pkgs.gnome3.vte}/etc/profile.d/vte.sh
'';

backForeSubModule = types.submodule (
{ ... }: {
options = {
foreground = mkOption {
type = types.str;
description = "The foreground color.";
};

background = mkOption {
type = types.str;
description = "The background color.";
};
};
}
);

profileColorsSubModule = types.submodule (
{ ... }: {
options = {
Expand All @@ -34,6 +50,18 @@ let
type = types.listOf types.str;
description = "The terminal palette.";
};

cursor = mkOption {
default = null;
type = types.nullOr backForeSubModule;
description = "The color for the terminal cursor.";
};

highlight = mkOption {
default = null;
type = types.nullOr backForeSubModule;
description = "The colors for the terminal’s highlighted area.";
};
};
}
);
Expand Down Expand Up @@ -70,6 +98,15 @@ let
description = "The font name, null to use system default.";
};

allowBold = mkOption {
default = null;
type = types.nullOr types.bool;
description = ''
If <literal>true</literal>, allow applications in the
terminal to make text boldface.
'';
};

scrollOnOutput = mkOption {
default = true;
type = types.bool;
Expand Down Expand Up @@ -115,6 +152,9 @@ let
background-color = pcfg.colors.backgroundColor;
palette = pcfg.colors.palette;
}
// optionalAttrs (pcfg.allowBold != null) {
allow-bold = pcfg.allowBold;
}
// (
if (pcfg.colors.boldColor == null)
then { bold-color-same-as-fg = true; }
Expand All @@ -123,6 +163,24 @@ let
bold-color = pcfg.colors.boldColor;
}
)
// (
if (pcfg.colors.cursor != null)
then {
cursor-colors-set = true;
cursor-foreground-color = pcfg.colors.cursor.foreground;
cursor-background-color = pcfg.colors.cursor.background;
}
else { cursor-colors-set = false; }
)
// (
if (pcfg.colors.highlight != null)
then {
highlight-colors-set = true;
highlight-foreground-color = pcfg.colors.highlight.foreground;
highlight-background-color = pcfg.colors.highlight.background;
}
else { highlight-colors-set = false; }
)
)
);

Expand Down
4 changes: 2 additions & 2 deletions modules/programs/zsh.nix
Expand Up @@ -167,7 +167,7 @@ in
An attribute set that maps aliases (the top level attribute names in
this option) to command strings or directly to build outputs.
'';
type = types.attrs;
type = types.attrsOf types.str;
};

enableCompletion = mkOption {
Expand Down Expand Up @@ -202,7 +202,7 @@ in

sessionVariables = mkOption {
default = {};
type = types.attrs;
type = with types; attrsOf (either int str);
example = { MAILCHECK = 30; };
description = "Environment variables that will be set for zsh session.";
};
Expand Down

0 comments on commit 9fbc188

Please sign in to comment.