Compare commits
21 commits
master
...
release-17
Author | SHA1 | Date | |
---|---|---|---|
c2945576b7 | |||
bea5f92ec5 | |||
963de93c55 | |||
eda46344a0 | |||
5db56a320c | |||
698094b4d6 | |||
7943291ac4 | |||
59dee6a501 | |||
967d0f93a2 | |||
337168f47e | |||
124acb089c | |||
b9382832ad | |||
f7628e2996 | |||
467ba9cafd | |||
6730c32c98 | |||
b6affe8d57 | |||
ef5a8a5941 | |||
de2c181eae | |||
5fd31df9d3 | |||
61101184b4 | |||
474478c4a3 |
13
.travis.yml
Normal file
13
.travis.yml
Normal 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
|
|
@ -159,9 +159,15 @@ function doSwitch() {
|
|||
}
|
||||
|
||||
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
|
||||
# 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- \
|
||||
| sed -E 's/home-manager-([[:digit:]]*)-link/: id \1/'
|
||||
popd > /dev/null
|
||||
|
|
|
@ -313,7 +313,6 @@ in
|
|||
pkgs.gnugrep
|
||||
pkgs.gnused
|
||||
pkgs.ncurses # For `tput`.
|
||||
pkgs.nix
|
||||
]
|
||||
+ optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH";
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
function setupVars() {
|
||||
local profilesPath="/nix/var/nix/profiles/per-user/$USER"
|
||||
local gcPath="/nix/var/nix/gcroots/per-user/$USER"
|
||||
|
@ -9,27 +11,38 @@ function setupVars() {
|
|||
| sort -rn \
|
||||
| head -1)
|
||||
|
||||
if [[ -n "$greatestGenNum" ]] ; then
|
||||
if [[ -n $greatestGenNum ]] ; then
|
||||
oldGenNum=$greatestGenNum
|
||||
newGenNum=$((oldGenNum + 1))
|
||||
else
|
||||
newGenNum=1
|
||||
fi
|
||||
|
||||
if [[ -e "$gcPath/current-home" ]] ; then
|
||||
if [[ -e $gcPath/current-home ]] ; then
|
||||
oldGenPath="$(readlink -e "$gcPath/current-home")"
|
||||
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"
|
||||
newGenPath="@GENERATION_DIR@";
|
||||
newGenProfilePath="$profilesPath/home-manager-$newGenNum-link"
|
||||
newGenGcPath="$gcPath/current-home"
|
||||
}
|
||||
|
||||
setupVars
|
||||
|
||||
echo "Starting home manager activation"
|
||||
|
||||
if [[ -v VERBOSE ]]; then
|
||||
export VERBOSE_ECHO=echo
|
||||
export VERBOSE_ARG="--verbose"
|
||||
|
@ -38,6 +51,10 @@ else
|
|||
export VERBOSE_ARG=""
|
||||
fi
|
||||
|
||||
echo "Starting home manager activation"
|
||||
|
||||
setupVars
|
||||
|
||||
if [[ -v DRY_RUN ]] ; then
|
||||
echo "This is a dry run"
|
||||
export DRY_RUN_CMD=echo
|
||||
|
@ -46,6 +63,11 @@ else
|
|||
export DRY_RUN_CMD=""
|
||||
fi
|
||||
|
||||
if [[ -v VERBOSE ]]; then
|
||||
echo -n "Using Nix version: "
|
||||
nix-env --version
|
||||
fi
|
||||
|
||||
$VERBOSE_ECHO "Activation variables:"
|
||||
if [[ -v oldGenNum ]] ; then
|
||||
$VERBOSE_ECHO " oldGenNum=$oldGenNum"
|
||||
|
|
|
@ -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";
|
||||
message = ''
|
||||
|
@ -560,6 +549,59 @@ in
|
|||
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!
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -61,10 +61,28 @@ in
|
|||
The configuration of the Nix Packages collection. (For
|
||||
details, see the Nixpkgs documentation.) It allows you to set
|
||||
package configuration options.
|
||||
|
||||
</para><para>
|
||||
|
||||
If <literal>null</literal>, then configuration is taken from
|
||||
the fallback location, for example,
|
||||
<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
|
||||
first argument should be used for finding dependencies, and
|
||||
the second should be used for overriding recipes.
|
||||
|
||||
</para><para>
|
||||
|
||||
If <literal>null</literal>, then the overlays are taken from
|
||||
the fallback location, for example,
|
||||
<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.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ let
|
|||
./programs/emacs.nix
|
||||
./programs/feh.nix
|
||||
./programs/firefox.nix
|
||||
./programs/fzf.nix
|
||||
./programs/git.nix
|
||||
./programs/gnome-terminal.nix
|
||||
./programs/home-manager.nix
|
||||
|
@ -39,6 +40,7 @@ let
|
|||
./programs/man.nix
|
||||
./programs/mercurial.nix
|
||||
./programs/neovim.nix
|
||||
./programs/pidgin.nix
|
||||
./programs/rofi.nix
|
||||
./programs/ssh.nix
|
||||
./programs/termite.nix
|
||||
|
@ -65,6 +67,7 @@ let
|
|||
./services/taffybar.nix
|
||||
./services/tahoe-lafs.nix
|
||||
./services/udiskie.nix
|
||||
./services/unclutter.nix
|
||||
./services/window-managers/i3.nix
|
||||
./services/window-managers/xmonad.nix
|
||||
./services/xscreensaver.nix
|
||||
|
|
91
modules/programs/fzf.nix
Normal file
91
modules/programs/fzf.nix
Normal 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
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -58,6 +58,28 @@ in
|
|||
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)
|
||||
extraPython3Packages withPython3
|
||||
extraPythonPackages withPython
|
||||
withRuby;
|
||||
withRuby configure;
|
||||
})
|
||||
];
|
||||
};
|
||||
|
|
36
modules/programs/pidgin.nix
Normal file
36
modules/programs/pidgin.nix
Normal 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; }) ];
|
||||
};
|
||||
}
|
|
@ -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 {
|
||||
type = types.loaOf matchBlockModule;
|
||||
default = [];
|
||||
default = {};
|
||||
example = literalExample ''
|
||||
{
|
||||
"john.example.com" = {
|
||||
|
@ -248,20 +257,24 @@ in
|
|||
|
||||
config = mkIf cfg.enable {
|
||||
home.file.".ssh/config".text = ''
|
||||
ForwardAgent ${yn cfg.forwardAgent}
|
||||
Compression ${yn cfg.compression}
|
||||
ServerAliveInterval ${toString cfg.serverAliveInterval}
|
||||
HashKnownHosts ${yn cfg.hashKnownHosts}
|
||||
UserKnownHostsFile ${cfg.userKnownHostsFile}
|
||||
ControlMaster ${cfg.controlMaster}
|
||||
ControlPath ${cfg.controlPath}
|
||||
ControlPersist ${cfg.controlPersist}
|
||||
|
||||
${cfg.extraConfig}
|
||||
${concatStringsSep "\n" (
|
||||
mapAttrsToList (n: v: "${n} ${v}") cfg.extraOptionOverrides)}
|
||||
|
||||
${concatStringsSep "\n\n" (
|
||||
map matchBlockStr (
|
||||
builtins.attrValues cfg.matchBlocks))}
|
||||
|
||||
Host *
|
||||
ForwardAgent ${yn cfg.forwardAgent}
|
||||
Compression ${yn cfg.compression}
|
||||
ServerAliveInterval ${toString cfg.serverAliveInterval}
|
||||
HashKnownHosts ${yn cfg.hashKnownHosts}
|
||||
UserKnownHostsFile ${cfg.userKnownHostsFile}
|
||||
ControlMaster ${cfg.controlMaster}
|
||||
ControlPath ${cfg.controlPath}
|
||||
ControlPersist ${cfg.controlPersist}
|
||||
|
||||
${replaceStrings ["\n"] ["\n "] cfg.extraConfig}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -22,13 +22,18 @@ in
|
|||
'';
|
||||
description = "Extra packages available to Texlive.";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
description = "Resulting customized Texlive package.";
|
||||
readOnly = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [
|
||||
(pkgs.texlive.combine (cfg.extraPackages pkgs.texlive))
|
||||
];
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
programs.texlive.package =
|
||||
pkgs.texlive.combine (cfg.extraPackages pkgs.texlive);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,8 +9,9 @@ let
|
|||
gpgInitStr = ''
|
||||
GPG_TTY="$(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
|
||||
|
||||
|
@ -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 {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
|
@ -114,7 +132,8 @@ in
|
|||
};
|
||||
|
||||
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";
|
||||
};
|
||||
};
|
||||
|
@ -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" ];
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -3,12 +3,6 @@
|
|||
with lib;
|
||||
|
||||
{
|
||||
imports = [
|
||||
(mkRenamedOptionModule
|
||||
[ "services" "qsyncthingtray" "enable" ]
|
||||
[ "services" "syncthing" "tray" ])
|
||||
];
|
||||
|
||||
meta.maintainers = [ maintainers.rycee ];
|
||||
|
||||
options = {
|
||||
|
|
63
modules/services/unclutter.nix
Normal file
63
modules/services/unclutter.nix
Normal 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" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -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 {
|
||||
options = {
|
||||
border = mkOption {
|
||||
|
@ -69,6 +88,16 @@ let
|
|||
|
||||
barModule = types.submodule {
|
||||
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 {
|
||||
type = types.enum [ "dock" "hide" "invisible" ];
|
||||
default = "dock";
|
||||
|
@ -93,12 +122,98 @@ let
|
|||
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 {
|
||||
type = types.string;
|
||||
default = "${pkgs.i3status}/bin/i3status";
|
||||
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 ];
|
||||
barColorSetStr = c: concatStringsSep " " [ c.border c.background c.text ];
|
||||
|
||||
criteriaStr = criteria: "[${concatStringsSep " " (mapAttrsToList (k: v: ''${k}="${v}"'') criteria)}]";
|
||||
|
||||
|
@ -524,13 +640,29 @@ let
|
|||
map (c: "assign ${criteriaStr c} ${workspace}") criteria
|
||||
);
|
||||
|
||||
barStr = { mode, hiddenState, position, workspaceButtons, statusCommand, ... }: ''
|
||||
barStr = {
|
||||
id, mode, hiddenState, position, workspaceButtons,
|
||||
workspaceNumbers, command, statusCommand, colors, ...
|
||||
}: ''
|
||||
bar {
|
||||
${optionalString (id != null) "id ${id}"}
|
||||
mode ${mode}
|
||||
hidden_state ${hiddenState}
|
||||
position ${position}
|
||||
status_command ${statusCommand}
|
||||
i3bar_command ${command}
|
||||
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}
|
||||
}
|
||||
}
|
||||
'';
|
||||
|
||||
|
|
|
@ -12,6 +12,9 @@ with lib;
|
|||
};
|
||||
|
||||
config = mkIf config.services.xscreensaver.enable {
|
||||
# To make the xscreensaver-command tool available.
|
||||
home.packages = [ pkgs.xscreensaver ];
|
||||
|
||||
systemd.user.services.xscreensaver = {
|
||||
Unit = {
|
||||
Description = "XScreenSaver";
|
||||
|
|
|
@ -159,14 +159,16 @@ in
|
|||
legacyReloadCmd = ''
|
||||
bash ${./systemd-activate.sh} "''${oldGenPath=}" "$newGenPath"
|
||||
'';
|
||||
|
||||
ensureRuntimeDir = "XDG_RUNTIME_DIR=\${XDG_RUNTIME_DIR:-/run/user/$(id -u)}";
|
||||
in
|
||||
''
|
||||
if who | grep -q '^${config.home.username} '; then
|
||||
XDG_RUNTIME_DIR=''${XDG_RUNTIME_DIR:-/run/user/$(id -u)} \
|
||||
if ${ensureRuntimeDir} ${cfg.systemctlPath} --quiet --user is-system-running 2> /dev/null; then
|
||||
${ensureRuntimeDir} \
|
||||
PATH=${dirOf cfg.systemctlPath}:$PATH \
|
||||
${if cfg.startServices then autoReloadCmd else legacyReloadCmd}
|
||||
else
|
||||
echo "User ${config.home.username} not logged in. Skipping."
|
||||
echo "User systemd daemon not running. Skipping reload."
|
||||
fi
|
||||
''
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue