Fix news conflict.
This commit is contained in:
Christopher League 2018-02-04 18:09:53 -05:00
commit 9c7fb710c9
7 changed files with 306 additions and 48 deletions

View file

@ -544,6 +544,20 @@ in
'';
}
{
time = "2018-02-02T11:15:00+00:00";
message = ''
A new program configuration is available: 'programs.mercurial'
'';
}
{
time = "2018-02-03T10:00:00+00:00";
message = ''
A new module is available: 'services.stalonetray'
'';
}
{
time = "2018-02-04T22:58:49+00:00";
condition = config.xsession.enable;
@ -552,7 +566,6 @@ in
allows specifying the pointer cursor theme and size. The
settings will be applied in the xsession, Xresources, and
GTK configuration.
'';
}
];
};

View file

@ -34,6 +34,7 @@ let
./programs/info.nix
./programs/lesspipe.nix
./programs/man.nix
./programs/mercurial.nix
./programs/neovim.nix
./programs/rofi.nix
./programs/ssh.nix
@ -56,6 +57,7 @@ let
./services/random-background.nix
./services/redshift.nix
./services/screen-locker.nix
./services/stalonetray.nix
./services/syncthing.nix
./services/taffybar.nix
./services/tahoe-lafs.nix

View file

@ -0,0 +1,102 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.mercurial;
in
{
options = {
programs.mercurial = {
enable = mkEnableOption "Mercurial";
package = mkOption {
type = types.package;
default = pkgs.mercurial;
defaultText = "pkgs.mercurial";
description = "Mercurial package to install.";
};
userName = mkOption {
type = types.str;
description = "Default user name to use.";
};
userEmail = mkOption {
type = types.str;
description = "Default user email to use.";
};
aliases = mkOption {
type = types.attrs;
default = {};
description = "Mercurial aliases to define.";
};
extraConfig = mkOption {
type = types.either types.attrs types.lines;
default = {};
description = "Additional configuration to add.";
};
iniContent = mkOption {
type = types.attrsOf types.attrs;
internal = true;
};
ignores = mkOption {
type = types.listOf types.str;
default = [];
example = [ "*~" "*.swp" ];
description = "List of globs for files to be globally ignored.";
};
ignoresRegexp = mkOption {
type = types.listOf types.str;
default = [];
example = [ "^.*~$" "^.*\\.swp$" ];
description =
"List of regular expressions for files to be globally ignored.";
};
};
};
config = mkIf cfg.enable (
mkMerge [
{
home.packages = [ cfg.package ];
programs.mercurial.iniContent.ui = {
username = cfg.userName + " <" + cfg.userEmail + ">";
};
xdg.configFile."hg/hgrc".text = generators.toINI {} cfg.iniContent;
}
(mkIf (cfg.ignores != [] || cfg.ignoresRegexp != []) {
programs.mercurial.iniContent.ui.ignore =
"${config.xdg.configHome}/hg/hgignore_global";
xdg.configFile."hg/hgignore_global".text =
"syntax: glob\n" + concatStringsSep "\n" cfg.ignores + "\n" +
"syntax: regexp\n" + concatStringsSep "\n" cfg.ignoresRegexp + "\n";
})
(mkIf (cfg.aliases != {}) {
programs.mercurial.iniContent.alias = cfg.aliases;
})
(mkIf (lib.isAttrs cfg.extraConfig) {
programs.mercurial.iniContent = cfg.extraConfig;
})
(mkIf (lib.isString cfg.extraConfig) {
xdg.configFile."hg/hgrc".text = cfg.extraConfig;
})
]
);
}

View file

@ -113,6 +113,17 @@ let
(rowsColorsToString colors.rows)}
'';
locationsMap = {
center = 0;
top-left = 1;
top = 2;
top-right = 3;
right = 4;
bottom-right = 5;
bottom = 6;
bottom-left = 7;
left = 8;
};
in
{
@ -195,6 +206,28 @@ in
description = "Whether to run rofi fullscreen.";
};
location = mkOption {
default = "center";
type = types.enum (builtins.attrNames locationsMap);
description = "The location rofi appears on the screen.";
};
xoffset = mkOption {
default = 0;
type = types.int;
description = ''
Offset in the x-axis in pixels relative to the chosen location.
'';
};
yoffset = mkOption {
default = 0;
type = types.int;
description = ''
Offset in the y-axis in pixels relative to the chosen location.
'';
};
colors = mkOption {
default = null;
type = types.nullOr colorsSubmodule;
@ -258,6 +291,9 @@ in
${setOption "terminal" cfg.terminal}
${setOption "cycle" cfg.cycle}
${setOption "fullscreen" cfg.fullscreen}
${setOption "location" (builtins.getAttr cfg.location locationsMap)}
${setOption "xoffset" cfg.xoffset}
${setOption "yoffset" cfg.yoffset}
${setColorScheme cfg.colors}

View file

@ -153,7 +153,13 @@ in
enableCompletion = mkOption {
default = true;
description = "Enable zsh completion.";
description = ''
Enable zsh completion. Don't forget to add
<programlisting>
environment.pathsToLink = [ "/share/zsh" ];
</programlisting>
to your system configuration to get completion for system packages (e.g. systemd).
'';
type = types.bool;
};
@ -171,10 +177,8 @@ in
sessionVariables = mkOption {
default = {};
type = types.attrs;
example = { ZSH_CACHE_DIR = "$HOME/.cache/zsh"; };
description = ''
Environment variables that will be set for zsh session.
'';
example = { MAILCHECK = 30; };
description = "Environment variables that will be set for zsh session.";
};
initExtra = mkOption {
@ -240,22 +244,50 @@ in
};
config = mkIf cfg.enable (mkMerge [
(mkIf (cfg.profileExtra != "") {
home.file."${relToDotDir ".zprofile"}".text = cfg.profileExtra;
})
(mkIf (cfg.loginExtra != "") {
home.file."${relToDotDir ".zlogin"}".text = cfg.loginExtra;
})
(mkIf (cfg.logoutExtra != "") {
home.file."${relToDotDir ".zlogout"}".text = cfg.logoutExtra;
})
(mkIf cfg.oh-my-zsh.enable {
home.file."${relToDotDir ".zshenv"}".text = ''
ZSH="${pkgs.oh-my-zsh}/share/oh-my-zsh";
ZSH_CACHE_DIR="''${XDG_CACHE_HOME:-''$HOME/.cache}/oh-my-zsh";
'';
})
(mkIf (cfg.dotDir != null) {
home.file."${relToDotDir ".zshenv"}".text = ''
ZDOTDIR=${zdotdir}
'';
# When dotDir is set, only use ~/.zshenv to source ZDOTDIR/.zshenv,
# This is so that if ZDOTDIR happens to be
# already set correctly (by e.g. spawning a zsh inside a zsh), all env
# vars still get exported
home.file.".zshenv".text = ''
source ${zdotdir}/.zshenv
'';
})
{
home.packages = with pkgs; [ zsh ]
++ optional cfg.enableCompletion nix-zsh-completions
++ optional cfg.oh-my-zsh.enable oh-my-zsh;
home.file."${relToDotDir ".zshenv"}".text = ''
typeset -U fpath
${optionalString (config.home.sessionVariableSetter != "pam") ''
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
''}
${envVarsStr}
'';
home.file."${relToDotDir ".zshrc"}".text = ''
fpath+="$HOME/.nix-profile/share/zsh/site-functions"
fpath+="$HOME/.nix-profile/share/zsh/$ZSH_VERSION/functions"
typeset -U path cdpath fpath manpath
for profile in ''${(z)NIX_PROFILES}; do
fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions)
done
HELPDIR="${pkgs.zsh}/share/zsh/$ZSH_VERSION/help"
@ -299,41 +331,17 @@ in
${cfg.initExtra}
# Environment variables
${optionalString (config.home.sessionVariableSetter != "pam") ''
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
''}
${envVarsStr}
# Aliases
${aliasesStr}
'';
}
(mkIf cfg.oh-my-zsh.enable {
programs.zsh.sessionVariables = {
ZSH = "${pkgs.oh-my-zsh}/share/oh-my-zsh";
ZSH_CACHE_DIR = "\${XDG_CACHE_HOME:-$HOME/.cache}/oh-my-zsh";
};
})
(mkIf (cfg.profileExtra != "") {
home.file."${relToDotDir ".zprofile"}".text = cfg.profileExtra;
})
(mkIf (cfg.loginExtra != "") {
home.file."${relToDotDir ".zlogin"}".text = cfg.loginExtra;
})
(mkIf (cfg.logoutExtra != "") {
home.file."${relToDotDir ".zlogout"}".text = cfg.logoutExtra;
})
(mkIf (cfg.dotDir != null) {
programs.zsh.sessionVariables.ZDOTDIR = zdotdir;
# When dotDir is set, only use ~/.zshenv to source ZDOTDIR/.zshenv,
# This is so that if ZDOTDIR happens to be
# already set correctly (by e.g. spawning a zsh inside a zsh), all env
# vars still get exported
home.file.".zshenv".text = ''
source ${zdotdir}/.zshenv
'';
})
(mkIf cfg.oh-my-zsh.enable {
# Oh-My-Zsh calls compinit during initialization,
# calling it twice causes sight start up slowdown

View file

@ -0,0 +1,94 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.stalonetray;
in
{
options = {
services.stalonetray = {
enable = mkEnableOption "Stalonetray system tray";
package = mkOption {
default = pkgs.stalonetray;
defaultText = "pkgs.stalonetray";
type = types.package;
example = literalExample "pkgs.stalonetray";
description = "The package to use for the Stalonetray binary.";
};
config = mkOption {
type = with types;
attrsOf (nullOr (either str (either bool int)));
description = ''
Stalonetray configuration as a set of attributes.
'';
default = {};
example = {
geometry = "3x1-600+0";
decorations = null;
icon_size = 30;
sticky = true;
background = "#cccccc";
};
};
extraConfig = mkOption {
type = types.lines;
description = "Additional configuration lines for stalonetrayrc.";
default = "";
example = ''
geometry 3x1-600+0
decorations none
icon_size 30
sticky true
background "#cccccc"
'';
};
};
};
config = mkIf cfg.enable (mkMerge [
{
home.packages = [ cfg.package ];
systemd.user.services.stalonetray = {
Unit = {
Description = "Stalonetray system tray";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${cfg.package}/bin/stalonetray";
Restart = "on-failure";
};
};
}
(mkIf (cfg.config != {}) {
home.file.".stalonetrayrc".text =
let
valueToString = v:
if isBool v then (if v then "true" else "false")
else if (v==null) then "none"
else ''"${toString v}"'';
in
concatStrings (
mapAttrsToList (k: v: "${k} ${valueToString v}\n") cfg.config
);
})
(mkIf (cfg.extraConfig != "") {
home.file.".stalonetrayrc".text = cfg.extraConfig;
})
]);
}

View file

@ -52,7 +52,10 @@ with lib;
qsyncthingtray = {
Unit = {
Description = "QSyncthingTray";
After = [ "graphical-session-pre.target" "polybar.service" "taffybar.service" ];
After = [ "graphical-session-pre.target"
"polybar.service"
"taffybar.service"
"stalonetray.service" ];
PartOf = [ "graphical-session.target" ];
};