Compare commits

...

21 commits

Author SHA1 Message Date
Robert Helgesson c2945576b7
news: add entry for release-17.09 being unmaintained 2018-05-06 22:44:26 +02:00
Robert Helgesson bea5f92ec5
ssh: move options to end of configuration file
This is needed to support overriding these options inside match
blocks. A new option `programs.ssh.extraOptionOverrides` has been
added to allow global overrides.

(cherry picked from commit 4205c91609)
2018-03-25 20:58:11 +02:00
Robert Helgesson 963de93c55
nixpkgs: expand description of nixpkgs.config and nixpkgs.overlays
(cherry picked from commit 75c4075345)
2018-03-24 20:30:53 +01:00
Gleb Peregud eda46344a0
fzf: add enableZshIntegration option
When enabled this will extend user's `$HOME/.zshrc` with sourcing of fzf's
completion and key-bindings integration libraries.

(cherry picked from commit f8398339a3)
2018-03-14 17:44:58 +01:00
Gleb Peregud 5db56a320c
gpg-agent: add enableExtraSocket and verbose options.
This option enables a GPG Agent restricted socket (aka "extra-socket"), which
can be used to forward GPG Agent over SSH.

Additionally `verbose` option enables verbose output of an `gpg-agent.service`
unit for easier debugging.

See: https://wiki.gnupg.org/AgentForwarding
(cherry picked from commit 9bf9e7ac5c)
2018-03-14 17:44:58 +01:00
Robert Helgesson 698094b4d6
activation-init: sanity check oldGenNum and oldGenPath
Something is terribly wrong if one is set but not the other so error
out with a message if that happens.

(cherry picked from commit 567b21b1d6)
2018-03-14 17:44:58 +01:00
Robert Helgesson 7943291ac4
fzf: add module
(cherry picked from commit fa7d63d9d1)
2018-03-14 17:44:58 +01:00
Robert Helgesson 59dee6a501
texlive: add option programs.texlive.package
This read-only option will hold a reference to the customized texlive
package.

(cherry picked from commit 46a94cce56)
2018-03-14 17:44:58 +01:00
Robert Helgesson 967d0f93a2
gpg-agent: do updatestartuptty only when SSH is enabled
Inspired by #163.

(cherry picked from commit bc50202d0d)
2018-03-14 17:44:58 +01:00
Tad Fisher 337168f47e
unclutter: add module
(cherry picked from commit 8fc8e158e2)
2018-03-14 17:44:58 +01:00
Robert Helgesson 124acb089c
home-manager: colorize only when connected to terminal
Before, the output of `home-manager generations` would be colorized
even when used in a pipeline.

(cherry picked from commit 06e7d087f2)
2018-03-03 22:02:17 +01:00
Robert Helgesson b9382832ad
xscreensaver: install the xscreensaver package
This is needed to make the xscreensaver tools available.

(cherry picked from commit fbff38de33)
2018-03-03 22:01:56 +01:00
Robert Helgesson f7628e2996
home-environment: use nix-env from PATH
It is safest to use the system install of Nix since that will be
compatible with the running nix-daemon and/or databases.

Also add a printout of the used Nix version in the activation script
when running in verbose mode.

Fixes #218.

(cherry picked from commit 19b4002f25)
2018-02-27 20:34:44 +01:00
Robert Helgesson 467ba9cafd
qsyncthingtray: remove deprecated option
(cherry picked from commit b47cc4bc66)
2018-02-26 22:33:20 +01:00
Robert Helgesson 6730c32c98
systemd: replace use of who command
Curiously the `who` command sometimes does not list logged-in users,
resulting in systemd not being reloaded. Instead we use

    systemctl --user is-system-running

to more directly detect whether systemd is running.

(cherry picked from commit e307ceeee7)
2018-02-26 22:33:12 +01:00
Robert Helgesson b6affe8d57
pidgin: add module
(cherry picked from commit 4745c7a00d)
2018-02-20 22:02:34 +01:00
Robert Helgesson ef5a8a5941
Add initial Travis-CI configuration
(cherry picked from commit 5c783e1a63)
2018-02-20 22:02:06 +01:00
Nikita Uvarov de2c181eae
i3: escape ${} in bars.command example
(cherry picked from commit 05ad0c9e06)
2018-02-20 22:02:06 +01:00
Matthieu Coudron 5fd31df9d3
i3: don't evaluate "command" example
else it attempts to build i3-gaps and fails on darwin see
https://github.com/rycee/home-manager/pull/214#issuecomment-366594833

(cherry picked from commit 6d7b5c9513)
2018-02-20 22:02:06 +01:00
Nikita Uvarov 61101184b4
i3: add missing bar options
New options are: id, commmand, workspaceNumbers, colors.
Fixes #210.

(cherry picked from commit de001e05da)
2018-02-20 22:02:06 +01:00
Matthieu Coudron 474478c4a3
neovim: add 'configure' flag
so that we have the same options as in nixpkgs.

(cherry picked from commit be60600a47)
2018-02-20 22:02:06 +01:00
18 changed files with 561 additions and 48 deletions

13
.travis.yml Normal file
View file

@ -0,0 +1,13 @@
language: nix
os:
- linux
- osx
before_script:
- mkdir -m 0755 -p /nix/var/nix/{profiles,gcroots}/per-user/$USER
- mkdir -p ~/.config/nixpkgs
- echo "{}" > ~/.config/nixpkgs/home.nix
script:
nix-shell . -A install

View file

@ -159,9 +159,15 @@ function doSwitch() {
} }
function doListGens() { function doListGens() {
# Whether to colorize the generations output.
local color="never"
if [[ -t 1 ]]; then
color="always"
fi
pushd "/nix/var/nix/profiles/per-user/$USER" > /dev/null pushd "/nix/var/nix/profiles/per-user/$USER" > /dev/null
# shellcheck disable=2012 # shellcheck disable=2012
ls --color=yes -gG --time-style=long-iso --sort time home-manager-*-link \ ls --color=$color -gG --time-style=long-iso --sort time home-manager-*-link \
| cut -d' ' -f 4- \ | cut -d' ' -f 4- \
| sed -E 's/home-manager-([[:digit:]]*)-link/: id \1/' | sed -E 's/home-manager-([[:digit:]]*)-link/: id \1/'
popd > /dev/null popd > /dev/null

View file

@ -313,7 +313,6 @@ in
pkgs.gnugrep pkgs.gnugrep
pkgs.gnused pkgs.gnused
pkgs.ncurses # For `tput`. pkgs.ncurses # For `tput`.
pkgs.nix
] ]
+ optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH"; + optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH";

View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
function setupVars() { function setupVars() {
local profilesPath="/nix/var/nix/profiles/per-user/$USER" local profilesPath="/nix/var/nix/profiles/per-user/$USER"
local gcPath="/nix/var/nix/gcroots/per-user/$USER" local gcPath="/nix/var/nix/gcroots/per-user/$USER"
@ -9,27 +11,38 @@ function setupVars() {
| sort -rn \ | sort -rn \
| head -1) | head -1)
if [[ -n "$greatestGenNum" ]] ; then if [[ -n $greatestGenNum ]] ; then
oldGenNum=$greatestGenNum oldGenNum=$greatestGenNum
newGenNum=$((oldGenNum + 1)) newGenNum=$((oldGenNum + 1))
else else
newGenNum=1 newGenNum=1
fi fi
if [[ -e "$gcPath/current-home" ]] ; then if [[ -e $gcPath/current-home ]] ; then
oldGenPath="$(readlink -e "$gcPath/current-home")" oldGenPath="$(readlink -e "$gcPath/current-home")"
fi fi
$VERBOSE_ECHO "Sanity checking oldGenNum and oldGenPath"
if [[ -v oldGenNum && ! -v oldGenPath
|| ! -v oldGenNum && -v oldGenPath ]]; then
errorEcho "Invalid profile number and GC root values! These must be"
errorEcho "either both empty or both set but are now set to"
errorEcho " '${oldGenNum:-}' and '${oldGenPath:-}'"
errorEcho "If you don't mind losing previous profile generations then"
errorEcho "the easiest solution is probably to run"
errorEcho " rm $profilesPath/home-manager*"
errorEcho " rm $gcPath/current-home"
errorEcho "and trying home-manager switch again. Good luck!"
exit 1
fi
genProfilePath="$profilesPath/home-manager" genProfilePath="$profilesPath/home-manager"
newGenPath="@GENERATION_DIR@"; newGenPath="@GENERATION_DIR@";
newGenProfilePath="$profilesPath/home-manager-$newGenNum-link" newGenProfilePath="$profilesPath/home-manager-$newGenNum-link"
newGenGcPath="$gcPath/current-home" newGenGcPath="$gcPath/current-home"
} }
setupVars
echo "Starting home manager activation"
if [[ -v VERBOSE ]]; then if [[ -v VERBOSE ]]; then
export VERBOSE_ECHO=echo export VERBOSE_ECHO=echo
export VERBOSE_ARG="--verbose" export VERBOSE_ARG="--verbose"
@ -38,6 +51,10 @@ else
export VERBOSE_ARG="" export VERBOSE_ARG=""
fi fi
echo "Starting home manager activation"
setupVars
if [[ -v DRY_RUN ]] ; then if [[ -v DRY_RUN ]] ; then
echo "This is a dry run" echo "This is a dry run"
export DRY_RUN_CMD=echo export DRY_RUN_CMD=echo
@ -46,6 +63,11 @@ else
export DRY_RUN_CMD="" export DRY_RUN_CMD=""
fi fi
if [[ -v VERBOSE ]]; then
echo -n "Using Nix version: "
nix-env --version
fi
$VERBOSE_ECHO "Activation variables:" $VERBOSE_ECHO "Activation variables:"
if [[ -v oldGenNum ]] ; then if [[ -v oldGenNum ]] ; then
$VERBOSE_ECHO " oldGenNum=$oldGenNum" $VERBOSE_ECHO " oldGenNum=$oldGenNum"

View file

@ -479,17 +479,6 @@ in
''; '';
} }
{
time = "2018-01-25T11:35:08+00:00";
condition = options.services.qsyncthingtray.enable.isDefined;
message = ''
'services.qsyncthingtray' has been merged into 'services.syncthing'.
Please, use 'services.syncthing.tray' option to activate the tray service.
The old module will be removed on February 25, 2018.
'';
}
{ {
time = "2018-02-02T11:15:00+00:00"; time = "2018-02-02T11:15:00+00:00";
message = '' message = ''
@ -560,6 +549,59 @@ in
feature is slowly forthcoming. feature is slowly forthcoming.
''; '';
} }
{
time = "2018-02-19T21:45:26+00:00";
message = ''
A new module is available: 'programs.pidgin'
'';
}
{
time = "2018-03-04T06:54:26+00:00";
message = ''
A new module is available: 'services.unclutter'
'';
}
{
time = "2018-03-07T21:38:27+00:00";
message = ''
A new module is available: 'programs.fzf'.
'';
}
{
time = "2018-03-25T06:49:57+00:00";
condition = with config.programs.ssh; enable && matchBlocks != {};
message = ''
Options set through the 'programs.ssh' module are now placed
at the end of the SSH configuration file. This was done to
make it possible to override global options such as
'ForwardAgent' or 'Compression' inside a host match block.
If you truly need to override an SSH option across all match
blocks then the new option
programs.ssh.extraOptionOverrides
can be used.
'';
}
{
time = "2018-05-06T20:36:51+00:00";
message = ''
The 17.09 branch of Home Manager is unmaintained and will
not receive any further updates.
The current stable branch of Home Manager is now
release-18.03 and matches (as the name suggest) the NixOS
and Nixpkgs 18.03 versions.
Thanks for using Home Manager!
'';
}
]; ];
}; };
} }

View file

@ -61,10 +61,28 @@ in
The configuration of the Nix Packages collection. (For The configuration of the Nix Packages collection. (For
details, see the Nixpkgs documentation.) It allows you to set details, see the Nixpkgs documentation.) It allows you to set
package configuration options. package configuration options.
</para><para> </para><para>
If <literal>null</literal>, then configuration is taken from If <literal>null</literal>, then configuration is taken from
the fallback location, for example, the fallback location, for example,
<filename>~/.config/nixpkgs/config.nix</filename>. <filename>~/.config/nixpkgs/config.nix</filename>.
</para><para>
Note, this option will not apply outside your Home Manager
configuration like when installing manually through
<command>nix-env</command>. If you want to apply it both
inside and outside Home Manager you can put it in a separate
file and include something like
<programlisting>
nixpkgs.config = import ./nixpkgs-config.nix;
xdg.configFile."nixpkgs/config.nix".source =
./nixpkgs-config.nix;
</programlisting>
in your Home Manager configuration.
''; '';
}; };
@ -89,10 +107,19 @@ in
an argument the <emphasis>original</emphasis> Nixpkgs. The an argument the <emphasis>original</emphasis> Nixpkgs. The
first argument should be used for finding dependencies, and first argument should be used for finding dependencies, and
the second should be used for overriding recipes. the second should be used for overriding recipes.
</para><para> </para><para>
If <literal>null</literal>, then the overlays are taken from If <literal>null</literal>, then the overlays are taken from
the fallback location, for example, the fallback location, for example,
<filename>~/.config/nixpkgs/overlays</filename>. <filename>~/.config/nixpkgs/overlays</filename>.
</para><para>
Like <varname>nixpkgs.config</varname> this option only
applies within the Home Manager configuration. See
<varname>nixpkgs.config</varname> for a suggested setup that
works both internally and externally.
''; '';
}; };

View file

@ -30,6 +30,7 @@ let
./programs/emacs.nix ./programs/emacs.nix
./programs/feh.nix ./programs/feh.nix
./programs/firefox.nix ./programs/firefox.nix
./programs/fzf.nix
./programs/git.nix ./programs/git.nix
./programs/gnome-terminal.nix ./programs/gnome-terminal.nix
./programs/home-manager.nix ./programs/home-manager.nix
@ -39,6 +40,7 @@ let
./programs/man.nix ./programs/man.nix
./programs/mercurial.nix ./programs/mercurial.nix
./programs/neovim.nix ./programs/neovim.nix
./programs/pidgin.nix
./programs/rofi.nix ./programs/rofi.nix
./programs/ssh.nix ./programs/ssh.nix
./programs/termite.nix ./programs/termite.nix
@ -65,6 +67,7 @@ let
./services/taffybar.nix ./services/taffybar.nix
./services/tahoe-lafs.nix ./services/tahoe-lafs.nix
./services/udiskie.nix ./services/udiskie.nix
./services/unclutter.nix
./services/window-managers/i3.nix ./services/window-managers/i3.nix
./services/window-managers/xmonad.nix ./services/window-managers/xmonad.nix
./services/xscreensaver.nix ./services/xscreensaver.nix

91
modules/programs/fzf.nix Normal file
View file

@ -0,0 +1,91 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.fzf;
in
{
options.programs.fzf = {
enable = mkEnableOption "fzf - a command-line fuzzy finder";
defaultOptions = mkOption {
type = types.listOf types.str;
default = [];
example = [ "--height 40%" "--border" ];
description = ''
Extra command line options given to fzf by default.
'';
};
fileWidgetOptions = mkOption {
type = types.listOf types.str;
default = [];
example = [ "--preview 'head {}'" ];
description = ''
Command line options for the CTRL-T keybinding.
'';
};
changeDirWidgetOptions = mkOption {
type = types.listOf types.str;
default = [];
example = [ "--preview 'tree -C {} | head -200'" ];
description = ''
Command line options for the ALT-C keybinding.
'';
};
historyWidgetOptions = mkOption {
type = types.listOf types.str;
default = [];
example = [ "--sort" "--exact" ];
description = ''
Command line options for the CTRL-R keybinding.
'';
};
enableBashIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Bash integration.
'';
};
enableZshIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Zsh integration.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.fzf ];
home.sessionVariables =
mapAttrs (n: v: toString v) (
filterAttrs (n: v: v != []) {
FZF_ALT_C_OPTS = cfg.changeDirWidgetOptions;
FZF_CTRL_R_OPTS = cfg.historyWidgetOptions;
FZF_CTRL_T_OPTS = cfg.fileWidgetOptions;
FZF_DEFAULT_OPTS = cfg.defaultOptions;
}
);
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
. ${pkgs.fzf}/share/fzf/completion.bash
. ${pkgs.fzf}/share/fzf/key-bindings.bash
'';
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
. ${pkgs.fzf}/share/fzf/completion.zsh
. ${pkgs.fzf}/share/fzf/key-bindings.zsh
'';
};
}

View file

@ -58,6 +58,28 @@ in
List here Python 3 packages required for your plugins to work. List here Python 3 packages required for your plugins to work.
''; '';
}; };
configure = mkOption {
type = types.nullOr types.attrs;
default = null;
example = literalExample ''
configure = {
customRC = $''''
" here your custom configuration goes!
$'''';
packages.myVimPackage = with pkgs.vimPlugins; {
# loaded on launch
start = [ fugitive ];
# manually loadable by calling `:packadd $plugin-name`
opt = [ ];
};
};
'';
description = ''
Generate your init file from your list of plugins and custom commands,
and loads it from the store via <command>nvim -u /nix/store/hash-vimrc</command>
'';
};
}; };
}; };
@ -67,7 +89,7 @@ in
inherit (cfg) inherit (cfg)
extraPython3Packages withPython3 extraPython3Packages withPython3
extraPythonPackages withPython extraPythonPackages withPython
withRuby; withRuby configure;
}) })
]; ];
}; };

View file

@ -0,0 +1,36 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.pidgin;
in
{
meta.maintainers = [ maintainers.rycee ];
options = {
programs.pidgin = {
enable = mkEnableOption "Pidgin messaging client";
package = mkOption {
type = types.package;
default = pkgs.pidgin;
defaultText = "pkgs.pidgin";
description = "The Pidgin package to use.";
};
plugins = mkOption {
default = [];
example = literalExample "[ pkgs.pidgin-otr pkgs.pidgin-osd ]";
description = "Plugins that should be available to Pidgin.";
};
};
};
config = mkIf cfg.enable {
home.packages = [ (cfg.package.override { inherit (cfg) plugins; }) ];
};
}

View file

@ -220,9 +220,18 @@ in
''; '';
}; };
extraOptionOverrides = mkOption {
type = types.attrsOf types.str;
default = {};
description = ''
Extra SSH configuration options that take precedence over any
host specific configuration.
'';
};
matchBlocks = mkOption { matchBlocks = mkOption {
type = types.loaOf matchBlockModule; type = types.loaOf matchBlockModule;
default = []; default = {};
example = literalExample '' example = literalExample ''
{ {
"john.example.com" = { "john.example.com" = {
@ -248,6 +257,14 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.file.".ssh/config".text = '' home.file.".ssh/config".text = ''
${concatStringsSep "\n" (
mapAttrsToList (n: v: "${n} ${v}") cfg.extraOptionOverrides)}
${concatStringsSep "\n\n" (
map matchBlockStr (
builtins.attrValues cfg.matchBlocks))}
Host *
ForwardAgent ${yn cfg.forwardAgent} ForwardAgent ${yn cfg.forwardAgent}
Compression ${yn cfg.compression} Compression ${yn cfg.compression}
ServerAliveInterval ${toString cfg.serverAliveInterval} ServerAliveInterval ${toString cfg.serverAliveInterval}
@ -257,11 +274,7 @@ in
ControlPath ${cfg.controlPath} ControlPath ${cfg.controlPath}
ControlPersist ${cfg.controlPersist} ControlPersist ${cfg.controlPersist}
${cfg.extraConfig} ${replaceStrings ["\n"] ["\n "] cfg.extraConfig}
${concatStringsSep "\n\n" (
map matchBlockStr (
builtins.attrValues cfg.matchBlocks))}
''; '';
}; };
} }

View file

@ -22,13 +22,18 @@ in
''; '';
description = "Extra packages available to Texlive."; description = "Extra packages available to Texlive.";
}; };
package = mkOption {
type = types.package;
description = "Resulting customized Texlive package.";
readOnly = true;
};
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ home.packages = [ cfg.package ];
(pkgs.texlive.combine (cfg.extraPackages pkgs.texlive)) programs.texlive.package =
]; pkgs.texlive.combine (cfg.extraPackages pkgs.texlive);
}; };
} }

View file

@ -9,8 +9,9 @@ let
gpgInitStr = '' gpgInitStr = ''
GPG_TTY="$(tty)" GPG_TTY="$(tty)"
export GPG_TTY export GPG_TTY
${pkgs.gnupg}/bin/gpg-connect-agent updatestartuptty /bye > /dev/null ''
''; + optionalString cfg.enableSshSupport
"${pkgs.gnupg}/bin/gpg-connect-agent updatestartuptty /bye > /dev/null";
in in
@ -47,6 +48,23 @@ in
''; '';
}; };
enableExtraSocket = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable extra socket of the GnuPG key agent (useful for GPG
Agent forwarding).
'';
};
verbose = mkOption {
type = types.bool;
default = false;
description = ''
Whether to produce verbose output.
'';
};
grabKeyboardAndMouse = mkOption { grabKeyboardAndMouse = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
@ -114,7 +132,8 @@ in
}; };
Service = { Service = {
ExecStart = "${pkgs.gnupg}/bin/gpg-agent --supervised"; ExecStart = "${pkgs.gnupg}/bin/gpg-agent --supervised"
+ optionalString cfg.verbose " --verbose";
ExecReload = "${pkgs.gnupg}/bin/gpgconf --reload gpg-agent"; ExecReload = "${pkgs.gnupg}/bin/gpgconf --reload gpg-agent";
}; };
}; };
@ -158,5 +177,26 @@ in
}; };
}; };
}) })
(mkIf cfg.enableExtraSocket {
systemd.user.sockets.gpg-agent-extra = {
Unit = {
Description = "GnuPG cryptographic agent and passphrase cache (restricted)";
Documentation = "man:gpg-agent(1) man:ssh(1)";
};
Socket = {
ListenStream = "%t/gnupg/S.gpg-agent.extra";
FileDescriptorName = "extra";
Service = "gpg-agent.service";
SocketMode = "0600";
DirectoryMode = "0700";
};
Install = {
WantedBy = [ "sockets.target" ];
};
};
})
]); ]);
} }

View file

@ -3,12 +3,6 @@
with lib; with lib;
{ {
imports = [
(mkRenamedOptionModule
[ "services" "qsyncthingtray" "enable" ]
[ "services" "syncthing" "tray" ])
];
meta.maintainers = [ maintainers.rycee ]; meta.maintainers = [ maintainers.rycee ];
options = { options = {

View file

@ -0,0 +1,63 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.unclutter;
in {
options.services.unclutter = {
enable = mkEnableOption "unclutter";
package = mkOption {
description = "unclutter derivation to use.";
type = types.package;
default = pkgs.unclutter-xfixes;
defaultText = "pkgs.unclutter-xfixes";
};
timeout = mkOption {
description = "Number of seconds before the cursor is marked inactive.";
type = types.int;
default = 1;
};
threshold = mkOption {
description = "Minimum number of pixels considered cursor movement.";
type = types.int;
default = 1;
};
extraOptions = mkOption {
description = "More arguments to pass to the unclutter command.";
type = types.listOf types.str;
default = [ ];
example = [ "exclude-root" "ignore-scrolling" ];
};
};
config = mkIf cfg.enable {
systemd.user.services.unclutter = {
Unit = {
Description = "unclutter";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
ExecStart = ''
${cfg.package}/bin/unclutter \
--timeout ${toString cfg.timeout} \
--jitter ${toString (cfg.threshold - 1)} \
${concatMapStrings (x: " --${x}") cfg.extraOptions}
'';
RestartSec = 3;
Restart = "always";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
};
}

View file

@ -38,6 +38,25 @@ let
}; };
}; };
barColorSetModule = types.submodule {
options = {
border = mkOption {
type = types.string;
visible = false;
};
background = mkOption {
type = types.string;
visible = false;
};
text = mkOption {
type = types.string;
visible = false;
};
};
};
colorSetModule = types.submodule { colorSetModule = types.submodule {
options = { options = {
border = mkOption { border = mkOption {
@ -69,6 +88,16 @@ let
barModule = types.submodule { barModule = types.submodule {
options = { options = {
id = mkOption {
type = types.nullOr types.string;
default = null;
description = ''
Specifies the bar ID for the configured bar instance.
If this option is missing, the ID is set to bar-x, where x corresponds
to the position of the embedding bar block in the config file.
'';
};
mode = mkOption { mode = mkOption {
type = types.enum [ "dock" "hide" "invisible" ]; type = types.enum [ "dock" "hide" "invisible" ];
default = "dock"; default = "dock";
@ -93,12 +122,98 @@ let
description = "Whether workspace buttons should be shown or not."; description = "Whether workspace buttons should be shown or not.";
}; };
workspaceNumbers = mkOption {
type = types.bool;
default = true;
description = "Whether workspace numbers should be displayed within the workspace buttons.";
};
command = mkOption {
type = types.string;
default = "${cfg.package}/bin/i3bar";
defaultText = "i3bar";
description = "Command that will be used to start a bar.";
example = "\${pkgs.i3-gaps}/bin/i3bar -t";
};
statusCommand = mkOption { statusCommand = mkOption {
type = types.string; type = types.string;
default = "${pkgs.i3status}/bin/i3status"; default = "${pkgs.i3status}/bin/i3status";
description = "Command that will be used to get status lines."; description = "Command that will be used to get status lines.";
}; };
colors = mkOption {
type = types.submodule {
options = {
background = mkOption {
type = types.string;
default = "#000000";
description = "Background color of the bar.";
};
statusline = mkOption {
type = types.string;
default = "#ffffff";
description = "Text color to be used for the statusline.";
};
separator = mkOption {
type = types.string;
default = "#666666";
description = "Text color to be used for the separator.";
};
focusedWorkspace = mkOption {
type = barColorSetModule;
default = { border = "#4c7899"; background = "#285577"; text = "#ffffff"; };
description = ''
Border, background and text color for a workspace button when the workspace has focus.
'';
};
activeWorkspace = mkOption {
type = barColorSetModule;
default = { border = "#333333"; background = "#5f676a"; text = "#ffffff"; };
description = ''
Border, background and text color for a workspace button when the workspace is active.
'';
};
inactiveWorkspace = mkOption {
type = barColorSetModule;
default = { border = "#333333"; background = "#222222"; text = "#888888"; };
description = ''
Border, background and text color for a workspace button when the workspace does not
have focus and is not active.
'';
};
urgentWorkspace = mkOption {
type = barColorSetModule;
default = { border = "#2f343a"; background = "#900000"; text = "#ffffff"; };
description = ''
Border, background and text color for a workspace button when the workspace contains
a window with the urgency hint set.
'';
};
bindingMode = mkOption {
type = barColorSetModule;
default = { border = "#2f343a"; background = "#900000"; text = "#ffffff"; };
description = "Border, background and text color for the binding mode indicator";
};
};
};
default = {};
description = ''
Bar color settings. All color classes can be specified using submodules
with 'border', 'background', 'text', fields and RGB color hex-codes as values.
See default values for the reference.
Note that 'background', 'status', and 'separator' parameters take a single RGB value.
See <link xlink:href="https://i3wm.org/docs/userguide.html#_colors"/>.
'';
};
}; };
}; };
@ -511,6 +626,7 @@ let
); );
colorSetStr = c: concatStringsSep " " [ c.border c.background c.text c.indicator c.childBorder ]; colorSetStr = c: concatStringsSep " " [ c.border c.background c.text c.indicator c.childBorder ];
barColorSetStr = c: concatStringsSep " " [ c.border c.background c.text ];
criteriaStr = criteria: "[${concatStringsSep " " (mapAttrsToList (k: v: ''${k}="${v}"'') criteria)}]"; criteriaStr = criteria: "[${concatStringsSep " " (mapAttrsToList (k: v: ''${k}="${v}"'') criteria)}]";
@ -524,13 +640,29 @@ let
map (c: "assign ${criteriaStr c} ${workspace}") criteria map (c: "assign ${criteriaStr c} ${workspace}") criteria
); );
barStr = { mode, hiddenState, position, workspaceButtons, statusCommand, ... }: '' barStr = {
id, mode, hiddenState, position, workspaceButtons,
workspaceNumbers, command, statusCommand, colors, ...
}: ''
bar { bar {
${optionalString (id != null) "id ${id}"}
mode ${mode} mode ${mode}
hidden_state ${hiddenState} hidden_state ${hiddenState}
position ${position} position ${position}
status_command ${statusCommand} status_command ${statusCommand}
i3bar_command ${command}
workspace_buttons ${if workspaceButtons then "yes" else "no"} workspace_buttons ${if workspaceButtons then "yes" else "no"}
strip_workspace_numbers ${if !workspaceNumbers then "yes" else "no"}
colors {
background ${colors.background}
statusline ${colors.statusline}
separator ${colors.separator}
focused_workspace ${barColorSetStr colors.focusedWorkspace}
active_workspace ${barColorSetStr colors.activeWorkspace}
inactive_workspace ${barColorSetStr colors.inactiveWorkspace}
urgent_workspace ${barColorSetStr colors.urgentWorkspace}
binding_mode ${barColorSetStr colors.bindingMode}
}
} }
''; '';

View file

@ -12,6 +12,9 @@ with lib;
}; };
config = mkIf config.services.xscreensaver.enable { config = mkIf config.services.xscreensaver.enable {
# To make the xscreensaver-command tool available.
home.packages = [ pkgs.xscreensaver ];
systemd.user.services.xscreensaver = { systemd.user.services.xscreensaver = {
Unit = { Unit = {
Description = "XScreenSaver"; Description = "XScreenSaver";

View file

@ -159,14 +159,16 @@ in
legacyReloadCmd = '' legacyReloadCmd = ''
bash ${./systemd-activate.sh} "''${oldGenPath=}" "$newGenPath" bash ${./systemd-activate.sh} "''${oldGenPath=}" "$newGenPath"
''; '';
ensureRuntimeDir = "XDG_RUNTIME_DIR=\${XDG_RUNTIME_DIR:-/run/user/$(id -u)}";
in in
'' ''
if who | grep -q '^${config.home.username} '; then if ${ensureRuntimeDir} ${cfg.systemctlPath} --quiet --user is-system-running 2> /dev/null; then
XDG_RUNTIME_DIR=''${XDG_RUNTIME_DIR:-/run/user/$(id -u)} \ ${ensureRuntimeDir} \
PATH=${dirOf cfg.systemctlPath}:$PATH \ PATH=${dirOf cfg.systemctlPath}:$PATH \
${if cfg.startServices then autoReloadCmd else legacyReloadCmd} ${if cfg.startServices then autoReloadCmd else legacyReloadCmd}
else else
echo "User ${config.home.username} not logged in. Skipping." echo "User systemd daemon not running. Skipping reload."
fi fi
'' ''
); );