The conversion from `concatMapStrings` to `concatStringsSep` introduced in https://github.com/nix-community/home-manager/pull/2481
creates an unintended behavior change where the formatted config does not end in a newline.[1]
This is problematic for manipulation at the Nix level. In particular, this cause a regression in
the generation of gtk2 settings due to concatenated of the formatted config and `gtk2.extraConfig`
without a newline in between.
This commit restores `concatMapStrings` to match the previous behavior and adds a newline to
the final string for the generated gtk2 config. The test case for gtk2-basic-config
was also updated to check behavior at concatenation boundaries.
[1] - https://github.com/nix-community/home-manager/pull/2481#discussion_r830648706
If set to true, desktops configured in `monitors` will be reset every time
the config is run.
If set to false, desktops will only be configured the first time the config is run.
This is useful if you want to dynamically add desktops and you don't want them
to be destroyed if you re-run `bspwmrc`.
Nix permits user level configurations through ~/.config/nix/nix.conf that allow
customization of system-wide settings and behavior. This is beneficial in chroot
environments and for per-user configurations. System level Nix configurations in the
form of /etc/nix/nix.conf can be specified declaratively via the NixOS nix module but as
of currently no counter part exists in home-manager.
This PR is a port of the RFC42 implementation for the NixOS nix module[1]
to home-manager. Non-applicable options have been excluded and the config generation
backends have been tweaked to the backends offered by home-manager. A notable change
from the NixOS module is a mandatory option to specify the Nix binary corresponding
to the version "nix.conf" should be generated against. This is necessary because
the validation phase is dependent on the `nix show-config` subcommand on the host platform.
While it is possible to avoid validation entirely, the lack of type checking was deemed too significant.
In NixOs, the version information can be retrieved from the `package` option itself which
declares the Nix binary system-wide. However in home-manager, there is no pure way to
detect the system Nix version and what state version the "nix.conf" should be generated
against. Thus an option is used to overcome this limitation by forcing the user to
specify the Nix package. Note this interaction can still be automated by forwarding
the system-wide Nix package to the home-manager module if needed.
Three unit tests were added to test the module behavior for the empty settings, the example
settings and the example registry configurations respectively.
[1] - NixOS/nixpkgs#139075
* gtk: add cursor theme configuration
- Added the `cursorTheme` under the gtk module.
- Added tests for the gtk3 settings file generation, and renamed
the gtk2 unit test expected file for clarity.
- Added guard against generating a blank `gtk.css` when `cfg.extraCss`
is empty.
- Replaced `concatMapStrings` calls with `concatStringsSep`. The library function
`concatMapStrings` generates an intemediate list which is then passed to
`concatStringsSep`, As we are not performing other transformation except
the addition of newlines, a direct call to `concatStringsSep` is sufficient.
- Updated description of examples to be more general "~/.config" -> "$XDG_CONFIG_HOME".
- Update helper functions `toGtk3Ini` and `formatGtk2Option` to use the library
function `boolToString` and escape the separator in the key name.
* xcursor: delegate GTK cursor settings to gtk.cursorTheme
- Added deprecation warning for GTK settings in the `xsession.cursorTheme` module.
- Modified config section to use `gtk.cursorTheme` for GTK cursor settings.
This has no effect if the user does not have any aliases defined for
any accounts.
This will also only add `--my-address=` to only accounts that are
enabled to be tracked by mu.
Note, the pubs configuration file uses ConfigObj syntax, which is
similar to the INI files syntax but with extra functionalities like
nested sections. This prevents it from using Nix's INI format
generator. Here is an example of pubs configuration that cannot be
generated using Nix's INI format generator:
[plugins]
[[git]]
manual=False
For this reason, we opted for a stringly-typed configuration since the
use of a structured `settings` option would require a custom parser.
Previously, if a process inside a foot client triggered the OOM killer,
systemd would also kill the parent unit, namely the foot server.
This is not ideal if a user has a lot of clients attached, and it's
usually not the terminal emulator's fault that a process inside it has
ended up using all the available memory.
There seems to be some changes on how wrapped binaries are implemented
on nixpkgs. This broke the nnn tests since the tests were coupled with
the old implementation.
This commit fix the tests, and also make it less coupled by just testing
if the bookmarks/plugins/environment variables are available.
This patch moves both home.sessionVariables and
programs.zsh.sessionVariables from .zshrc to .zshenv. Additionally,
these two kinds of session variables will not be sourced more than
once to allow user-customized ones to take effect.
Before, session variables are in .zshrc, which causes non-interactive
shells to not be able to get those variables. For example, running a
command through SSH is in a non-interactive and non-login shell, which
suffers from this. With this patch, all kinds of shells can get
session variables.
The reason why these session variables are not moved to .zprofile is
that programs started by systemd user instances are not able to get
variables defined in that file. For example, GNOME
Terminal (gnome-terminal-server.service) is one of these programs and
doesn't get variables defined in .zprofile. As a result, the shells it
starts, which are interactive and non-login, do not get those
variables.
Fixes#2445
Related NixOS/nixpkgs#33219
Related NixOS/nixpkgs#45784
This file is not formatted before and is excluded by ./format, so I don't format it.
When an hook is defined, a side effect was the creation of the
${notmuchIni.database.path}/.notmuch/ directory by home-manager. If
the Xapian database does not exist yet but this .notmuch directory
exists, Notmuch is confused and throws an error when `notmuch new` is
run (while this should create the database the first time).
This commit changes the hooks paths to $XDG_CONFIG_HOME where Notmuch
expects them (see notmuch-config(1)) instead of inside the maildir
database directory.
It also moves the configuration where Notmuch expects it, but the
$NOTMUCH_CONFIG environment variable is kept for backward
compatibility.
Watson is a CLI for tracking your time.
Two unit tests were added to validate the module behavior for an empty
configuration and the example configuration.
Based on nixpkgs commit c4b3aa62608d592d8a983be685f7e82000f4de30
stringBool is not needed because makeDesktopItem handles converting boolean parameters to string,
and noDisplay and prefersNonDefaultGPU parameters have been added.
Swayidle is an idle management daemon for Wayland. This modules adds support for
running swayidle as a SystemD user unit and makes it configurable through
home-manager.
The empty configuration test for the bottom module introduced as of https://github.com/nix-community/home-manager/pull/2323
is not cross platform. Specifically, it silently fails under a darwin environment due to
the configuration file not being generated at $XDG_CONFIG_HOME. This PR add cross platform support
by specifying the platform-dependent configuration directories to check. The expected unit test data
was also extracted to a separate file to differentiate between test data changes and
changes to the test itself.
Write YubiKey token IDs in the format yubico_pam expects. See
https://developers.yubico.com/yubico-pam/ for details. Also refer to
the NixOS option security.pam.services.<name>.yubicoAuth.
Closes#2502
The `style` option now also accepts a path instead of a text
configuration.
Keeping up with new Waybar options is annoying, so make the module a
freeform module.
The `modules` option will be removed in release 22.05.
The logic to generate warnings for modules and everything was
removed. I don't want to maintain the code that generates these
warnings anymore.
Since Rofi 1.7.1 (specifically davatorium/rofi@0e70d8a), the deprecated
`theme` option in the `configuration` section no longer works. For 1.7.0
and up, `@theme "name"` is supposed to be used *after* the
`configuration` block.
Swaynag is a replacement of i3-nag for sway. Swaynag is embedded in
Sway's build process albeit it is not an integral part of Sway,
therefore it has been added under `wayland.windowManager.sway` instead
of `programs`. It can be moved at a later time if necessary.
Two unit tests were added validate the module behavior for an empty
configuration and the example configuration.
Add an option to set custom `$ZPLUG_HOME`. Changing it with
`home.sessionVariables` doesnt work, since it has to be exported
before Zplug is initialised
Rationale:
As of release 1.1.2[1], the configuration ini file supports
declaration of the `[main]` header as an alternative to global
properties by enumerating all sections and mapping each to the
respective parsing function. Global properties will still be parsed
correctly by fnott however generation adds unnecessary complexity to
the module. This commit removes the need for global properties
generation.
Changes:
- Fixed the FIXME at L118.
- Cleaned up unneeded let bindings.
- Changed the generation method to use the `pkgs.formats.ini` from
pkgs-lib instead of the raw `generators` library. This was done for
consistency and clarity as the `pkgs.formats.ini` is still required
for type declaration and uses `generators` internally.
- Removed `global-properties` testcase.
- Updated `example-settings` testcase.
[1] - https://codeberg.org/dnkl/fnott/releases/tag/1.1.2
nnn is a terminal file manager.
It is configured mostly using environment variables, so the way I
found it to avoid needing to write either shell specific code or
using `home.sessionVariables` (that would need to make the user
relogin at every configuration change) is to wrap the program using
`wrapProgram`.
This commit adds a module for configuring atuin, a replacement shell
history program.
The module adds options for generating atuin's `config.toml` from Nix,
and options to enable atuin's integration for bash and zsh
(which will rebind history keys to open the atuin history).
* screen-locker: Make xautolock optional, reorganize options
xautolock isn't really needed to trigger xss-lock on the basis of time
since the built-in screensaver functionality of X serves as one of the
event sources for xss-lock. Keeping it around and defaulting to
"enabled" to avoid unexpected breakage.
Also shuffled around the options to submodules for xss-lock and
xautolock to get rid of prefixes in option names and to make
enableDetectSleep a bit clearer.
* screen-locker: update maintainership
* tests/screen-locker: Stub i3lock and xss-lock
* screen-locker: add package options for xss-lock and xautolock
kanshi configurations can have more than one exec statement in a
profile. This change allows services.kanshi.profiles.<name>.exec to be
a list of strings rather than a single string.
This option provides a more convenient way to overlay dummy packages.
It also adds a function `config.lib.test.mkStubPackage` that can,
e.g., be used for `package` options.
Currently, when a custom path is set for any of the XDG base
directories (i.e XDG_DATA_HOME, XDG_CONFIG_HOME, ...), the path will
be coerced into a string when consumed by other options such as
xdg.configFile et al. This causes the the given path to be copied to
the nix store which in the case of xdg.configFile et al, translate to
the file being written there as it is a absolute path.
Interestingly, the default base directories all work as intended as
they are encoded as a string.
This commit converts the option to a string regardless of whether it
is a primitive path or a string encoded path. This allows downstream
consumers to use the base directories in arbitrary way without
accidentally copying the content of the directory to the store. It is
implemented in a similar manner as how home.homeDirectory undergoes
string conversion.
The existing file-attr-name test was modified to test also custom xdg
base directories, and the home.file generation test was removed as
there is a dedicated test for this case in the files module. The test
case was renamed to file-gen to better reflect the new scope.
Bottom is a cross-platform graphical process/system monitor with a
customizable interface and a multitude of features.
Two unit tests were added validate the module behavior for an empty
configuration and the example configuration.
- Change generation behavior to always generate a configuration file
and pass it explicitly to fnott, it enforces the module to be
hermetic instead of offloading the configuration selection to
heuristics.
- Various style changes.
- Fix issue where fnott would abort due to an invalid config file when
both the configFile and settings options are unset.
- Remove the empty-settings test as a configuration file is now
already generated.
Suggested-by: Robert Helgesson <robert@rycee.net>
Fnott is a keyboard driven and lightweight Wayland notification daemon
for wlroots-based compositors.
There are four unit test to validate behavior for an empty
configuration, the default configuration, global properties and
systemd service file generation.
At the moment, only the inbox of each mail account is added to neomutt.
This inbox is always called "Inbox", so if you configure multiple
accounts, it is hard to know which one is which.
This change allows the user to specify a display name per account that
uses `named-mailboxes` under the hood.
Additionally this change now allows to add other folders than the inbox,
for example the Trash, Spam or Drafts folders to be added on a per-account
basis. Using extraOptions is not possible here, as those are lazily
loaded on mailbox open and thus would appear at the bottom and not sorted
by account.
This commit also changes the default sidebar format string to use %D
instead of %B because %B will ignore named mailboxes and show the folder
name instead.
Fluidsynth's systemd unit currently has a hard dependency on the
pulseaudio systemd service. Since fluidsynth can use other sound
services (e.g., pipewire-pulse), this should be configurable. This
commit adds the relevant option.
PR #2238
When the 'fields' setting is not set in htoprc, the htop program won't read any
of the settings. Provide a default value for fields in case it's not explicitly
set by the user.
This adds two new options: 'programs.neovim.coc.{enable,settings}`.
These settings offer a simple interface over `xdg.configFile."nvim/coc-settings.json`,
using the standard Nix' syntax instead of a multiline string.
* bspwm: various improvements
- fixes shell escaping issues and general style issues
- allow reloading the config on-the-fly by exposing bspwmrc to the user
* bspwm: add configuration test
- Add support for showing bold as bright colors
- Add support to configure the background transparency
- Fix the scrollOnOutput, it was not being dumped to the config
- Add tests!
- Add myself as maintainer
NixOS/nixpkgs@03310df843 disabled flake
support by default, so we now need to build a custom package and use it
if the user wants to `use flake` successfully. This should fix#2087.
* irssi: add ssl_cert option for servers
I was following these instructions
https://www.oftc.net/NickServ/CertFP/
and found that the `/server add -ssl_cert` option was needed.
This patch therefore adds an optional
`programs.irssi.networks.<name>.server.ssl.certificateFile` path.
Perhaps this could also be done with a `settings` attribute, but that
would probably require most of this module to be reworked.
* irsii: Add example-settings test case
`rbw` is a stand-alone Bitwarden client, which makes use of a daemon to
cache your password and manage state.
Its configuration can be managed by `home-manager` or not, leaving the
user free to configure it through `rbw config`.
When running a socket-activated emacs service, we don't want emacs to
remove the socket file after exiting, because then subsequent
invocations of `emacsclient` won't be able to use the socket to start
emacs.service again.
Emacs 27 added Type=notify support and updated the service definition to
remove the use of `emacsclient' to kill the service. Emacs 28 changes
the `StartupWMClass' in emacsclient.desktop to `Emacsd'. Update our
emacs.service and emacsclient.desktop definitions to match upstream
changes.
When killing emacs.service, the socket is removed, and subsequently
starting the service manually results in a service without a socket.
Prevent this by adding `RefuseManualStart=true' to the service's Unit
definition.
Drop Emacs 26 support as it is no longer shipped in nixpkgs. Update the
tests to verify the following configuration scenarios:
- Emacs version: 27, 28
- Socket activation: disabled, enabled
* xdg-desktop-entries: add module
rebase
* xdg-desktop-entries: adapt to changes in makeDesktopItem
This package depends on the makeDesktopItem function in nixpkgs, which recently changed its syntax:
https://github.com/NixOS/nixpkgs/pull/91790
This commit makes the module compatible with the new syntax.
It also exposes the fileValidation option in makeDesktopItem.
Co-authored-by: cwyc <cwyc@users.noreply.github.com>
Co-authored-by: --get <--show>
Pass meters for formatting in a list of attrsets so that ordering can be
preserved. In addition provide some mode-specific functions to create these
attrsets, to make for a bit nicer config.
This fixes#2060.
* isync/mbsync: replace master/slave with far/near
isync/mbsync: update tests to match new changes
* isync/mbsync: use mkRenamedOptionModule to alert user to near/far change
* isync/mbsync: use warnings to alert about master/slave far/near change
Fix capitalization
isync/mbsync: fix nitpicks
* isync/mbsync: run format script
* isync/mbsync: include new test for expected master/slave warnings
* isync/mbsync: add news about changes
* htop: add some missing meters
* htop: replace individual options with 'settings'
Deprecate all options and introduce `settings` for setting htop configuration
values in Nix configuration.
Use `lib.htop` to provide `fields` and `modes` for easy access to htop's integer
configuration. And `leftMeters` and `rightMeters` functions for building the
separate `*_meters` and `*_meter_modes` attributes.
* htop: add release-notes 21.05 entry
* htop: improve deprecation warnings
Move default configuration into `settings` and make deprecated options default
to `null`. Print deprecation warnings for any option that is non-null --
i.e. only show warnings for explicitly specified deprecated options.
* htop: make self code owner of module
* release notes: fix invalid programs.htop xref
Foot is a fast terminal emulator for Wayland. It can optionally be run
in a client-server configuration.
There are three unit tests to handle an empty configuration, the
default configuration, and systemd service file generation.
There is a need to manage XDG Base Directory system directory
environment variables in Home Manager modules. There is an existing
mechanism in `targets.genericLinux.extraXdgDataDirs', but this does not
apply to NixOS systems.
Furthermore, it is important that `XDG_CONFIG_DIRS' and `XDG_DATA_DIRS'
are set in both login shells (to support getty and SSH sessions) as well
as the systemd user manager (to propagate them to user services and
desktop environments).
The first need is addressed by adding the `xdg.systemDirs' module, which
configures lists of directory names for both `config' and `data'
directories. These are then set in
`$XDG_CONFIG_DIR/environment.d/10-home-manager.conf' and picked up by
the systemd user manager.
To make these, and other variables set in
`systemd.user.sessionVariables', available in login shells, an
additional step is added to `etc/profile.d/hm-session-vars.sh' which
exports the result of
`user-environment-generators/30-systemd-environment-d-generator' which
is shipped with systemd. The effect of this generator is to print
variables set on the systemd user manager such that shells can import
these into their environment.
`nix-index` is a tool to quickly locate the package providing a certain
file in `nixpkgs`. It indexes built derivations found in binary caches.
This module adds the shell integration for its `command-not-found`
script for interactive shells.
This change makes the services created via the lieer module aware of the notmuch config created by the home-mangager notmuch module (which is stored in a non-standard location).
Without this change all the lieer services created by the lieer module failed for me, as they were unable to find the notmuch config.
* i3, sway: extract border functionality to common function
Converted the i3 module to use default_border and
default_floating_border and extracted that functionality out to be
shared between the i3 and sway modules.
* i3: add sumnerevans as maintainer
* Git: Make signing key id be optional
Thus by default the signing key is selected by commit’s author.
* Git: Add tests for config with and without signing key id
* Git: Format tests for signing key
* Git: Remove default value (null) for signing key
* Git: Update description for signing key
* neomutt: support list in binds.map
Closes#1245
Adds support for specifying programs.neomutt.binds[].map as a list. If
specified as a list, then the binds will be concatenated with a ",".
* neomutt: add deprecation warning for (binds|macros).map as string
Added note that specifying 'programs.neomutt.(binds|macros).map' as a string is deprecated. Instead, use the list form.
* neomutt: note deprecation warning in release notes
Added note that specifying 'programs.neomutt.(binds|macros).map' as a
single string is deprecated in favor of specifying it as a list
* neomutt: add assertion that map is not empty
Added an assertion that each 'programs.neomutt.(binds|macros).map' list contains at least one element.
* neomutt: Fix eval error when primary account not enabled
If neomutt is enabled for an account, but not the primary account, the
configuration will fail with "list index 0 is out of bounds".
This adds the first neomutt-enabled account as a fallback.
* neomutt: add regression test/update tests
Set the systemd user service to use "mixed" killmode, which lets waybar
stop its module scripts. This fixes issues where waybar blocks shutdown
until systemd sends a SIGKILL to waybar child processes.
This allows you to set a theme for Qt applications. For example, if you
want to use `adwaita-qt` theme to have uniform look between Gtk and Qt
applications, you can use it like this:
```nix
{
qt = {
enable = true;
platformTheme = "gnome";
style = {
name = "adwaita";
package = pkgs.adwaita-qt;
};
};
}
```
The mailboxes must be a tuple of string or the string "ALL".
The generated value was broken if the mailboxes configuration was a list
of only one string (but not "ALL"): the generated expression ( "str" )
was not a tuple but a string.
Now, we always generate a tuple (by adding a comma, even with a list of
size one). Getmail works with the special value "ALL" whether it is a
in tuple or not, so this case is not specifically handled.
If a user using msmtp to send all their email, it would be preferred if
git used it as well.
The only settings necessary are to set the smtp server to the msmtp
binary and set envelop sender to true, which makes git call msmtp with
the -f flag to set the from address from the email.
Polybar's config format is a bit strange, and lists in particular are
annoying to handle. This enables using normal nix lists and nested
attrsets instead.
This change is not backwards-compatible, because the INI converter
converts lists of strings to space-separated values, and this does
something else. I expect that this is only relevant for the
`modules-left` etc bar setting, but that's enough to break things :(.
* zsh: update prezto path structure
The path structure was changed in Nixpkgs and this commit updates
the module to match.
Fixes#1773
* zsh-prezto: fix tests, small tidyup
Co-authored-by: Nick Hu <me@nickhu.co.uk>
Not every option is exposed by redshift/gammastep parameters, for
example gamma options are only exposed in configuration file. So this
PR refactors this module to generate a configuration file and pass it
to the redshift/gammastep using -c parameter.
This is a breaking change since there is no support for some of the
older options like `extraOptions`, but unless you use `extraOptions`
it should work without changes.
Not every option is exposed by redshift/gammastep parameters, for
example gamma options are only exposed in configuration file. So this
PR refactors this module to generate a configuration file and pass it
to the redshift/gammastep using -c parameter.
This is a breaking change since there is no support for some of the
older options like `extraOptions`, but unless you use `extraOptions`
it should work without changes.
If this commit now it is possible to define a custom theme directly
using Nix, like this:
```nix
{
programs.rofi.theme = {
"*" = {
background-color = "#000000";
border-color = "FFFFFF";
width = 512;
};
listview = {
cycle = true;
};
};
}
```
And this will be converted to the proper rasi format to be used in
rofi.
* rofi: migrate to rasi configuration format
The Xresources configuration format is deprecated in Rofi. For example,
using Rofi from unstable (1.6.1 as of now) you get the following
warnings when starting the application:
```
(process:9272): Rofi-WARNING **: 01:38:48.596: The old Xresources based configuration format is deprecated.
(process:9272): Rofi-WARNING **: 01:38:48.596: Please upgrade: rofi -upgrade-config.
``````
So this commit migrates it for its new configuration format, called rasi
instead.
This new implementation uses attrsets manipulation instead of using
strings, making the code clearer and also fixing some bugs found during
the way. To make sure everything is right, I also created some tests.
If someone wants to validate if the generated config is correct, just
run in terminal:
```
$ rofi -dump-config
```
And rofi will dump the current configuration file, including all
unsetted options.
* docs: document programs.rofi.extraConfig changes
* rofi: add thiagokokada as maintainer
* rofi: add toRasi function
Closes issue #1725.
This allows mpv module to be customized with support for more advanced
features than the `programs.mpv.scripts` current support. For example,
with this change now this is possible:
```nix
{
programs.mpv.package = (pkgs.wrapMpv (pkgs.mpv-unwrapped.override {
vapoursynthSupport = true;
}) {
extraMakeWrapperArgs = [
"--prefix" "LD_LIBRARY_PATH" ":" "${pkgs.vapoursynth-mvtools}/lib/vapoursynth"
];
});
}
```
Since `programs.mpv.package` doesn't necessary reflect the final
derivation anymore (see #1524), we introduce `programs.mpv.finalPackage`
that has the resulting derivation.
This includes 2 tests:
- One to check if everything is alright with mpv
- Other to validate our assertion that package and scripts can't be
passed both at the same time
* docs: document recent mpv module changes
* mpv: add thiagokokada as maintainer
When setting `...sway.package = null`, the default bar configuration
would throw an error trying to use the bar from the null package.
Logic is added to use the bar from `pkgs.sway` instead of `cfg.package`
if it is null.
Fixes#1714
This adds a "test.asserts" module that currently just provides a
convenient way to assert on the content of warnings. By default all
tests will assert that no warnings are given.
* neovim: write config in $XDG_CONFIG_HOME/init.vim
instead of wrapping the configuration, which has sideeffects
https://github.com/NixOS/nixpkgs/issues/55376
* fix: update test accordingly
Previously, it was not possible to set an arbitrary tmux prefix since
CTRL was hardcoded in the module.
To avoid breaking existing configs, a new option was implemented that
conveniently uses the tmux terminology but defaults to null and does
not affect previous behavior when set to null.
The behavior for the shortcut option was not completely replicated,
i.e., it does not bind "b" to send-prefix but stick to the default of
the prefix binding sending prefix (C-b C-b instead of C-b b) and it
does not bind repetition of the prefix (C-b C-b) to `last-window`,
both of these bring the option closer to the default tmux
configuration.
Fixes#1237
The current definition makes waybar wait for dbus.service, but that
never happens because dbus.service is started on demand by
dbus.socket.
Per systemd docs:
https://www.freedesktop.org/software/systemd/man/systemd.service.html#Implicit%20Dependencies
- Services with Type=dbus set automatically acquire dependencies of
type Requires= and After= on dbus.socket.
- Socket activated services are automatically ordered after their
activating .socket units via an automatic After= dependency.
Services also pull in all .socket units listed in Sockets= via
automatic Wants= and After= dependencies.
Removing Requisite/After makes the service properly start for me,
simply specifying Type=dbus is enough.
See #1370