Merge commit '9452e546c6f1d65f7bf74c7903ed40dfce075f3d'

This commit is contained in:
Tad Fisher 2017-11-24 23:21:37 -08:00
commit cc1f9e3e4d
7 changed files with 277 additions and 131 deletions

View file

@ -3,7 +3,7 @@
rec {
home-manager = import ./home-manager {
inherit pkgs;
path = ./.;
path = toString ./.;
};
install =

View file

@ -10,66 +10,6 @@ with lib;
let
modules = [
./files.nix
./home-environment.nix
./manual.nix
./misc/fontconfig.nix
./misc/gtk.nix
./misc/news.nix
./misc/nixpkgs.nix
./misc/pam.nix
./misc/xdg.nix
./programs/bash.nix
./programs/beets.nix
./programs/browserpass.nix
./programs/command-not-found/command-not-found.nix
./programs/eclipse.nix
./programs/emacs.nix
./programs/feh.nix
./programs/firefox.nix
./programs/git.nix
./programs/gnome-terminal.nix
./programs/home-manager.nix
./programs/htop.nix
./programs/info.nix
./programs/lesspipe.nix
./programs/man.nix
./programs/neovim.nix
./programs/rofi.nix
./programs/ssh.nix
./programs/termite.nix
./programs/texlive.nix
./programs/vim.nix
./programs/zsh.nix
./services/blueman-applet.nix
./services/compton.nix
./services/dunst.nix
./services/gnome-keyring.nix
./services/gpg-agent.nix
./services/kbfs.nix
./services/keepassx.nix
./services/keybase.nix
./services/network-manager-applet.nix
./services/owncloud-client.nix
./services/polybar.nix
./services/random-background.nix
./services/redshift.nix
./services/screen-locker.nix
./services/syncthing.nix
./services/taffybar.nix
./services/tahoe-lafs.nix
./services/udiskie.nix
./services/window-managers/i3.nix
./services/window-managers/xmonad.nix
./services/xscreensaver.nix
./systemd.nix
./xresources.nix
./xsession.nix
<nixpkgs/nixos/modules/misc/assertions.nix>
<nixpkgs/nixos/modules/misc/meta.nix>
];
collectFailed = cfg:
map (x: x.message) (filter (x: !x.assertion) cfg.assertions);
@ -79,15 +19,10 @@ let
in
fold f res res.config.warnings;
pkgsModule = {
config._module.args.baseModules = modules;
config._module.args.pkgs = lib.mkDefault pkgs;
config._module.check = check;
config.nixpkgs.system = mkDefault pkgs.system;
};
rawModule = lib.evalModules {
modules = [ configuration ] ++ modules ++ [ pkgsModule ];
modules =
[ configuration ]
++ (import ./modules.nix { inherit check lib pkgs; });
};
module = showWarnings (

View file

@ -27,6 +27,50 @@ let
in
"${n} = ${v'}";
fontType = types.submodule {
options = {
package = mkOption {
type = types.nullOr types.package;
default = null;
example = literalExample "pkgs.dejavu_fonts";
description = ''
Package providing the font. This package will be installed
to your profile. If <literal>null</literal> then the font
is assumed to already be available in your profile.
'';
};
name = mkOption {
type = types.str;
example = "DejaVu Sans 8";
description = ''
The family name and size of the font within the package.
'';
};
};
};
themeType = types.submodule {
options = {
package = mkOption {
type = types.nullOr types.package;
default = null;
example = literalExample "pkgs.gnome3.gnome_themes_standard";
description = ''
Package providing the theme. This package will be installed
to your profile. If <literal>null</literal> then the theme
is assumed to already be available in your profile.
'';
};
name = mkOption {
type = types.str;
example = "Adwaita";
description = "The name of the theme within the package.";
};
};
};
in
{
@ -36,27 +80,24 @@ in
gtk = {
enable = mkEnableOption "GTK 2/3 configuration";
fontName = mkOption {
type = types.nullOr types.str;
font = mkOption {
type = types.nullOr fontType;
default = null;
example = "DejaVu Sans 8";
description = ''
The font to use in GTK+ 2/3 applications.
'';
};
themeName = mkOption {
type = types.nullOr types.str;
iconTheme = mkOption {
type = types.nullOr themeType;
default = null;
example = "Vertex-Dark";
description = "The name of the GTK+2/3 theme to use.";
description = "The icon theme to use.";
};
iconThemeName = mkOption {
type = types.nullOr types.str;
theme = mkOption {
type = types.nullOr themeType;
default = null;
example = "Tango";
description = "The name of the icon theme to use.";
description = "The GTK+2/3 theme to use.";
};
gtk2 = mkOption {
@ -109,16 +150,25 @@ in
config = mkIf cfg.enable (
let
ini =
optionalAttrs (cfg.fontName != null)
{ gtk-font-name = cfg.fontName; }
optionalAttrs (cfg.font != null)
{ gtk-font-name = cfg.font.name; }
//
optionalAttrs (cfg.themeName != null)
{ gtk-theme-name = cfg.themeName; }
optionalAttrs (cfg.theme != null)
{ gtk-theme-name = cfg.theme.name; }
//
optionalAttrs (cfg.iconThemeName != null)
{ gtk-icon-theme-name = cfg.iconThemeName; };
optionalAttrs (cfg.iconTheme != null)
{ gtk-icon-theme-name = cfg.iconTheme.name; };
optionalPackage = opt:
optional (opt != null && opt.package != null) opt.package;
in
{
home.packages =
optionalPackage cfg.font
++ optionalPackage cfg.theme
++ optionalPackage cfg.iconTheme;
home.file.".gtkrc-2.0".text =
concatStringsSep "\n" (
mapAttrsToList formatGtk2Option ini
@ -130,4 +180,21 @@ in
xdg.configFile."gtk-3.0/gtk.css".text = cfg3.extraCss;
}
);
imports =
let
name = n: [ "gtk" n ];
in [
(mkChangedOptionModule (name "fontName") (name "font") (
config: { name = getAttrFromPath (name "fontName") config; }
))
(mkChangedOptionModule (name "themeName") (name "theme") (
config: { name = getAttrFromPath (name "themeName") config; }
))
(mkChangedOptionModule (name "iconThemeName") (name "iconTheme") (
config: { name = getAttrFromPath (name "iconThemeName") config; }
))
];
}

View file

@ -342,16 +342,6 @@ in
'';
}
{
time = "2017-10-23T22:54:33+00:00";
condition = config.programs.home-manager.modulesPath != null;
message = ''
The 'programs.home-manager.modulesPath' option is now
deprecated and will be removed on November 24, 2017. Please
use the option 'programs.home-manager.path' instead.
'';
}
{
time = "2017-10-23T23:10:29+00:00";
condition = !config.programs.home-manager.enable;
@ -442,12 +432,14 @@ in
December 6, 2017.
'';
}
{
time = "2017-11-12T00:18:59+00:00";
message = ''
A new program module is available: 'programs.neovim'.
'';
}
{
time = "2017-11-14T19:56:49+00:00";
condition = with config.xsession.windowManager; (
@ -462,13 +454,53 @@ in
where --no-startup-id option is necessary.
'';
}
{
time = "2017-11-21T23:27:22+00:00";
time = "2017-11-17T10:36:10+00:00";
condition = config.xsession.windowManager.i3.enable;
message = ''
The i3 window manager module has been extended with the following options:
i3.config.keycodebindings
i3.config.window.commands
i3.config.window.hideEdgeBorders
i3.config.focus.mouseWarping
'';
}
{
time = "2017-11-23T00:31:12+00:00";
condition =
config.gtk.fontName != "_mkMergedOptionModule"
|| config.gtk.themeName != "_mkMergedOptionModule"
|| config.gtk.iconThemeName != "_mkMergedOptionModule";
message = ''
The options
gtk.fontName, gtk.themeName, and gtk.iconThemeName
are deprecated and will be removed on December 23, 2017.
Please use
gtk.font.name, gtk.theme.name, and gtk.iconTheme.name
instead. You can find information about these in the manual
page.
This change was made to introduce the options
'gtk.font.package', 'gtk.theme.package', and
'gtk.iconTheme.package', which allow you to specify the
package that provides the font or theme.
'';
}
{
time = "2017-11-25T07:19:51+00:00";
message = ''
A new module is available: 'services.kbfs'.
A new module is available: 'services.keybase'.
'';
}
];
};

81
modules/modules.nix Normal file
View file

@ -0,0 +1,81 @@
{ pkgs
, lib
# Whether to enable module type checking.
, check ? true
}:
with lib;
let
modules = [
./files.nix
./home-environment.nix
./manual.nix
./misc/fontconfig.nix
./misc/gtk.nix
./misc/news.nix
./misc/nixpkgs.nix
./misc/pam.nix
./misc/xdg.nix
./programs/bash.nix
./programs/beets.nix
./programs/browserpass.nix
./programs/command-not-found/command-not-found.nix
./programs/eclipse.nix
./programs/emacs.nix
./programs/feh.nix
./programs/firefox.nix
./programs/git.nix
./programs/gnome-terminal.nix
./programs/home-manager.nix
./programs/htop.nix
./programs/info.nix
./programs/lesspipe.nix
./programs/man.nix
./programs/neovim.nix
./programs/rofi.nix
./programs/ssh.nix
./programs/termite.nix
./programs/texlive.nix
./programs/vim.nix
./programs/zsh.nix
./services/blueman-applet.nix
./services/compton.nix
./services/dunst.nix
./services/gnome-keyring.nix
./services/gpg-agent.nix
./services/kbfs.nix
./services/keepassx.nix
./services/keybase.nix
./services/network-manager-applet.nix
./services/owncloud-client.nix
./services/polybar.nix
./services/random-background.nix
./services/redshift.nix
./services/screen-locker.nix
./services/syncthing.nix
./services/taffybar.nix
./services/tahoe-lafs.nix
./services/udiskie.nix
./services/window-managers/i3.nix
./services/window-managers/xmonad.nix
./services/xscreensaver.nix
./systemd.nix
./xresources.nix
./xsession.nix
<nixpkgs/nixos/modules/misc/assertions.nix>
<nixpkgs/nixos/modules/misc/meta.nix>
];
pkgsModule = {
config._module.args.baseModules = modules;
config._module.args.pkgs = lib.mkDefault pkgs;
config._module.check = check;
config.nixpkgs.system = mkDefault pkgs.system;
};
in
map import modules ++ [ pkgsModule ]

View file

@ -28,43 +28,14 @@ in
attempted.
'';
};
modulesPath = mkOption {
type = types.nullOr types.str;
default = null;
example = "$HOME/devel/home-manager/modules";
description = ''
The default path to use for Home Manager modules. If this
path does not exist then
<filename>$HOME/.config/nixpkgs/home-manager/modules</filename>
and <filename>$HOME/.nixpkgs/home-manager/modules</filename>
will be attempted. DEPRECATED: Use
<varname>programs.home-manager.path</varname> instead.
'';
};
};
};
config = mkIf cfg.enable {
warnings = mkIf (cfg.modulesPath != null) [
("'programs.home-manager.modulesPath' is deprecated, "
+ "please use 'programs.home-manager.path")
];
assertions = [{
assertion = cfg.path == null || cfg.modulesPath == null;
message = "Cannot simultaneously use "
+ "'programs.home-manager.path' and "
+ "'programs.home-manager.modulesPath'.";
}];
home.packages = [
(import ../../home-manager {
inherit pkgs;
path =
if cfg.modulesPath != null
then "$(dirname ${cfg.modulesPath})"
else cfg.path;
inherit (cfg) path;
})
];

View file

@ -101,6 +101,22 @@ let
};
};
windowCommandModule = types.submodule {
options = {
command = mkOption {
type = types.string;
description = "i3wm command to execute.";
example = "border pixel 1";
};
criteria = mkOption {
type = criteriaModule;
description = "Criteria of the windows on which command should be executed.";
example = { title = "x200: ~/work"; };
};
};
};
criteriaModule = types.attrs;
configModule = types.submodule {
@ -130,6 +146,22 @@ let
default = 2;
description = "Window border width.";
};
hideEdgeBorders = mkOption {
type = types.enum [ "none" "vertical" "horizontal" "both" "smart" ];
default = "none";
description = "Hide window borders adjacent to the screen edges.";
};
commands = mkOption {
type = types.listOf windowCommandModule;
default = [];
description = ''
List of commands that should be executed on specific windows.
See <option>for_window</option> i3wm option documentation.
'';
example = [ { command = "border pixel 1"; criteria = { class = "XTerm"; }; } ];
};
};
};
default = {};
@ -200,6 +232,15 @@ let
See <link xlink:href="https://i3wm.org/docs/userguide.html#_focus_wrapping"/>
'';
};
mouseWarping = mkOption {
type = types.bool;
default = true;
description = ''
Whether mouse cursor should be warped to the center of the window when switching focus
to a window on a different output.
'';
};
};
};
default = {};
@ -271,9 +312,8 @@ let
};
defaultText = "Default i3 keybindings.";
description = ''
An attribute set that assignes keypress to an action.
Only basic keybinding is supported (bindsym keycomb action),
for more advanced setup use 'i3.extraConfig'.
An attribute set that assignes key press to an action using key symbol.
See <link xlink:href="https://i3wm.org/docs/userguide.html#keybindings"/>.
'';
example = literalExample ''
{
@ -284,6 +324,16 @@ let
'';
};
keycodebindings = mkOption {
type = types.attrs;
default = {};
description = ''
An attribute set that assignes keypress to an action using key code.
See <link xlink:href="https://i3wm.org/docs/userguide.html#keybindings"/>.
'';
example = { "214" = "exec --no-startup-id /bin/script.sh"; };
};
colors = mkOption {
type = types.submodule {
options = {
@ -368,6 +418,7 @@ let
"Up" = "resize shrink height 10 px or 10 ppt";
"Right" = "resize grow width 10 px or 10 ppt";
"Escape" = "mode default";
"Return" = "mode default";
};
};
description = ''
@ -454,6 +505,10 @@ let
mapAttrsToList (keycomb: action: "bindsym ${keycomb} ${action}") keybindings
);
keycodebindingsStr = keycodebindings: concatStringsSep "\n" (
mapAttrsToList (keycomb: action: "bindcode ${keycomb} ${action}") keycodebindings
);
colorSetStr = c: concatStringsSep " " [ c.border c.background c.text c.indicator c.childBorder ];
criteriaStr = criteria: "[${concatStringsSep " " (mapAttrsToList (k: v: ''${k}="${v}"'') criteria)}]";
@ -486,6 +541,7 @@ let
'';
floatingCriteriaStr = criteria: "for_window ${criteriaStr criteria} floating enable";
windowCommandsStr = { command, criteria, ... }: "for_window ${criteriaStr criteria} ${command}";
startupEntryStr = { command, always, notification, workspace, ... }: ''
${if always then "exec_always" else "exec"} ${
@ -503,9 +559,11 @@ let
floating_modifier ${floating.modifier}
new_window ${if window.titlebar then "normal" else "pixel"} ${toString window.border}
new_float ${if floating.titlebar then "normal" else "pixel"} ${toString floating.border}
hide_edge_borders ${window.hideEdgeBorders}
force_focus_wrapping ${if focus.forceWrapping then "yes" else "no"}
focus_follows_mouse ${if focus.followMouse then "yes" else "no"}
focus_on_window_activation ${focus.newWindow}
mouse_warping ${if focus.mouseWarping then "output" else "none"}
client.focused ${colorSetStr colors.focused}
client.focused_inactive ${colorSetStr colors.focusedInactive}
@ -515,11 +573,13 @@ let
client.background ${colors.background}
${keybindingsStr keybindings}
${keycodebindingsStr keycodebindings}
${concatStringsSep "\n" (mapAttrsToList modeStr modes)}
${concatStringsSep "\n" (mapAttrsToList assignStr assigns)}
${concatStringsSep "\n" (map barStr bars)}
${optionalString (gaps != null) gapsStr}
${concatStringsSep "\n" (map floatingCriteriaStr floating.criteria)}
${concatStringsSep "\n" (map windowCommandsStr window.commands)}
${concatStringsSep "\n" (map startupEntryStr startup)}
'' else "") + "\n" + cfg.extraConfig);