Compare commits

...

122 Commits

Author SHA1 Message Date
dependabot[bot]
454abeb5a8 ci: bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-07 01:25:15 +00:00
Bart Bakker
7329ffc6e9 htop: fix order or header_columns setting (backport) (#2443)
Backport of !2435 to fix #2426 on release branch.
2021-11-30 09:15:21 -05:00
Robert Helgesson
7efd99ef87 firefox: fix test case
(cherry picked from commit a19f40d39d)
2021-11-26 10:11:34 +01:00
Robert Helgesson
5721e19975 firefox: fix tests
(cherry picked from commit 18461b5dda)
2021-11-26 10:11:22 +01:00
dependabot[bot]
2a8974098b ci: bump cachix/install-nix-action from 15 to 16
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 15 to 16.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/v15...v16)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
(cherry picked from commit a28cf79a78)
2021-11-26 10:10:13 +01:00
dependabot[bot]
bcf03fa16a ci: bump cachix/install-nix-action from 14 to 15
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 14 to 15.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/v14...v15)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-15 23:33:21 +00:00
Robert Helgesson
4f1f57deca ci: explicitly set Nix version 2021-11-16 00:22:44 +01:00
Robert Helgesson
ff2bed9dac ci: update install-nix-action to v14.1
(cherry picked from commit b5d738b5a3)
2021-10-18 10:01:08 +02:00
Lava
49695f33aa xresources: Add path configuration option (#2141)
* xresources: Add path configuration option

This allows the user to move .Xresources somewhere else, which can help
with decluttering the home directory.

* xresources: Update xresources.path docs

* xresources: Fix formatting

(cherry picked from commit dc4337d9fe)
2021-10-07 10:54:10 +02:00
Naïm Favier
68ec2dd609 xresources: load .Xresources in xsession.initExtra
(cherry picked from commit 1e8d0beae4)
2021-10-07 10:54:02 +02:00
Shamrock Lee
382505714d java: add module
(cherry picked from commit a4a8307897)
2021-10-03 22:03:30 +02:00
Faye Duxovni
0e58ffec58 kanshi: allow multiple exec statements per profile
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.

(cherry picked from commit 095f3e32ae)
2021-10-03 18:25:35 +02:00
dependabot[bot]
7d9ba15214 ci: bump cachix/install-nix-action from 13 to 14
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 13 to 14.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/v13...v14)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
(cherry picked from commit 5199bc841a)
2021-09-14 00:53:31 +02:00
crazymanjinn
f5adb9be82 zsh: add completionInit option (#2046) (#2296)
Factored out from original .zshrc construction.

(cherry picked from commit 42847469b3)

Co-authored-by: bb010g <me@bb010g.com>
2021-08-27 10:57:07 -04:00
Connor Prussin
9f2b766d0f [nixos] Fix race condition with user units (#2286) (#2287)
One of the things managed by the `home-manager-<username>` unit is the systemd
user directory `.config/systemd/user`.  However, this directory needs to be in
place completely before systemd user sessions start up or the user sessions will
come up with an incomplete listing of enabled units, etc.

There was a race condition where nothing prevented
`systemd-user-sessions.service` from starting ahead of the systemd user
directory's initialization completing.  This commit makes
`home-manager-<username>` finishes _before_ we start
`systemd-user-sessions.service` to avoid such race condition.

This issue was probably not all that noticeable in most cases, but when using a
non-persistent root config (i.e. tmp on / or
https://grahamc.com/blog/erase-your-darlings) the race condition triggering
causes all kinds of issues on each reboot.
2021-08-21 23:51:31 -04:00
Colin Summers
b39647e52e brave: fix config dir path (#2173)
Changes install path for extensions from `~/.config/brave` to
`~/.config/BraveSoftware/Brave-Browser` on Linux.

(cherry picked from commit 9e3c402972)
2021-07-30 14:55:12 +02:00
Bjørn Forsman
9c0abed522 taskwarrior: don't create dataLocation with home.file
With

  programs.taskwarrior.dataLocation = /absolute/path

(outside of $HOME) the current implementation wrongly creates
$HOME/absolute/path (due to how home.file is implemented).

Since taskwarrior creates the dataLocation automatically on first run,
there is actually no need for HM to create that directory.

Additional benefit, the .keep symlink that HM creates as a side-effect
no longer appears in the taskwarrior data directory.

Fixes #2207.

(cherry picked from commit 6c984bd675)
2021-07-24 22:27:24 +02:00
Naïm Favier
03db229cc2 setxkbmap: reset options before setting new ones (#2160)
(cherry picked from commit 4971b9cad0)
2021-07-24 22:26:43 +02:00
Kid
88de11327c README: fix outdated description (#2131)
* README: fix outdated description

(cherry picked from commit 04955ca970)
2021-07-24 22:25:29 +02:00
Josh Holland
35a24648d1 direnv: add enableFlakes option for enableNixDirenvIntegration (#2089)
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.

(cherry picked from commit e0f2949c98)
2021-06-21 00:35:57 +02:00
Naïm Favier
d370447e28 nixos: set stopIfChanged to false (#2105)
There is no ExecStop so we can just restart the service.

(cherry picked from commit 4ed6705b0f)
2021-06-21 00:35:14 +02:00
puzzlewolf
2bfad60b73 etesync-dav: fix typo (#2067)
Upstream (https://github.com/etesync/etesync-dav/blob/master/README.md#configuration-and-running) uses 37358 as default port.

(cherry picked from commit e9ed9c2e11)
2021-06-21 00:32:23 +02:00
bb010g
8d64c164fc home-manager: pass on --debug option (#2049)
* man-home-manager: remove trailing whitespace

* home-manager: pass on `--debug` option

(cherry picked from commit 5eb199e937)
2021-06-21 00:32:22 +02:00
Naïm Favier
ffd6c84c25 dunst: add the whole package to home.packages (#2079)
The `dunst` package provides the `dunstctl` and `dunstify` command-line utilities which are useful to have.

(cherry picked from commit dba802c1d9)
2021-06-21 00:32:21 +02:00
Robert Helgesson
d40f84a340 ci: run tests against nixos-21.05 2021-06-21 00:21:09 +02:00
Robert Helgesson
148d85ee83 docs: mark 21.05 as stable version
(cherry picked from commit 5c1415d67f)
2021-06-05 20:31:59 +02:00
Dusk Banks
fd5fbb0a24 texlive: add packageSet option
(cherry picked from commit 45f9cb06a9)
2021-06-04 08:48:46 +02:00
Dusk Banks
0ff5951285 texlive: "Texlive" -> "TeX Live"
(cherry picked from commit c12d53dd7c)
2021-06-04 08:48:45 +02:00
Robert Helgesson
b8edffb918 Replace references to pkgs.gnome3 by pkgs.gnome
(cherry picked from commit d3cdabb5c9)
2021-06-04 08:48:44 +02:00
Robert Helgesson
cd33531e59 docs: minor additional issue template update
(cherry picked from commit 9e253a8c30)
2021-06-04 08:48:18 +02:00
Robert Helgesson
8c72c4f981 docs: update issue template
Most importantly change chat contact information.

(cherry picked from commit 5573c10ea4)
2021-06-04 08:48:17 +02:00
bb010g
bfb65f2d8d jq: add package option
(cherry picked from commit 0e329cee4c)
2021-06-04 08:48:16 +02:00
Robert Helgesson
913f722560 files: remove assertion on recursive onChange
See discussion in

  https://github.com/nix-community/home-manager/pull/2031

(cherry picked from commit d2aaeac42c)
2021-06-04 08:48:15 +02:00
Robert Helgesson
2f997178fa files: fix use of onChange with directory source
Previously, the comparison would not handle directory comparison
correctly, always finding that the source and target differed. This
would trigger the `onChange` script on each activation.

Fixes #2004

(cherry picked from commit 07ad6a4f76)
2021-06-04 08:48:14 +02:00
Bart Bakker
ffd4d9955b htop: fix preserving the order of meters (#2068) (backport)
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 on 21.05.
2021-06-03 22:29:06 -04:00
Robert Helgesson
ab64dc3249 docs: make OFTC upper case 2021-05-29 20:22:40 +02:00
Robert Helgesson
3591cd2b3b docs: switch IRC to OFTC 2021-05-29 19:29:15 +02:00
Joe Hermaszewski
0e6c61a440 programs.neovim: Set customRC for new nixpkgs (#2039)
Previously with newer nixpkgs revisions extraConfig would not make it into init.nvim
2021-05-27 22:05:20 +02:00
Ilan Joselevich
ddf35436b7 nextcloud-client: add startInBackground option (#2038)
* nextcloud-client: add runInBackground option

* nextcloud-client: Change runInBackground description

Co-authored-by: Sumner Evans <me@sumnerevans.com>

* nextcloud-client: Use optionalString for the runInBackground option

Co-authored-by: Sumner Evans <me@sumnerevans.com>

* nextcloud-client: Remove "defaultText" in the runInBackground option

* nextcloud-client: Fixed formatting

* nextcloud-client: Rename runInBackground to startInBackground

Co-authored-by: Sumner Evans <me@sumnerevans.com>
2021-05-27 10:54:20 -06:00
Rosario Pulella
b840707a87 firefox: Always create profile directories
Write ".keep" file in profile dir for each profile regardless of any
other settings to creare profile dir.
2021-05-26 09:41:43 +02:00
Robert Helgesson
90493027e3 mbsync: fix news entry 2021-05-23 20:32:01 +02:00
Karl H
64607f58b7 isync/mbsync: replace master/slave with far/near (#1776)
* 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
2021-05-22 15:31:06 -06:00
Nick Hu
4f70f49cec Add systemd target tray.target (#2027)
This target is for systemd units that require a system tray to be
running.

This also fixes taffybar.service: previously, systemd would consider it
to be active (running) before it was actually ready to accept tray
icons.
2021-05-22 03:15:12 +01:00
Scott Olson
82ab1ad467 syncthing: fix news link (#2032) 2021-05-20 20:23:55 -06:00
Bart Bakker
3d18912f5a htop: fix deprecation warnings (#2026)
Previous patch on deprecation warnings broke use of old options due to function
call with too many arguments. This fixes the arguments so deprecation warnings
are properly traced while preserving old configuration options.
2021-05-19 11:38:14 +02:00
Bruno BELANYI
b449cb77b1 firefox: deprecate 'enableGnomeExtensions'
Fixes #1990.
2021-05-19 08:51:52 +02:00
Nicolas Berbiche
cced902dda gpg: document lists are converted to duplicate keys (#2025) 2021-05-18 22:58:38 -06:00
Bart Bakker
91450f23ce htop: replace individual option with 'settings' (#1844)
* 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
2021-05-19 01:36:08 +02:00
Pierre Labadens
ff616b2734 foot: add module
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.
2021-05-18 22:29:41 +02:00
Nick Hu
73ecbd3722 Revert "status-notifier-watcher: introduce unit start delay"
This reverts commit 02c1f8d416.
2021-05-18 22:12:59 +02:00
Nick Hu
3612ca58e8 syncthing: make syncthing tray package configurable (#1257)
Also sets the default syncthing tray package to
https://github.com/Martchus/syncthingtray instead of
https://github.com/sieren/QSyncthingTray, which indirectly fixes #603
2021-05-18 15:43:17 +01:00
Robert Helgesson
f9e45390de scmpuff: use pkgs.scmpuff 2021-05-18 00:47:40 +02:00
Robert Helgesson
adbabcd0a0 gtk: fix gtk2-basic-config test 2021-05-18 00:47:15 +02:00
Robert Helgesson
e9b7d12e06 bash: generate files using writeShellScript
This ensures that the generated file is syntactically valid.

Issue #2015
2021-05-18 00:46:04 +02:00
Robert Helgesson
794d08a1d8 home-environment: generate checked activation script
By using `writeShellScript` when writing the activation script we
automatically get the right shebang and also get syntax validation.

Issue #2015
2021-05-18 00:18:57 +02:00
Ivan Kovnatsky
b0688a631b i3status-rust: fix bars.block example (#2016) 2021-05-17 11:25:03 -06:00
Sebastian Sellmeier
6a471f1b11 i3,sway: add option for default workspace (#2002)
Related to #695
2021-05-16 22:54:53 -06:00
Tad Fisher
01ec2aaefe systemd: revert systemd-environment-generator usage for environment variables (#2001) 2021-05-16 17:43:50 -04:00
asymmetric
77188bcd6e services/kanshi: add module example (#2008) 2021-05-15 23:17:48 -04:00
Tad Fisher
23769994e8 xdg.systemDirs: init module (#1797)
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.
2021-05-10 20:14:42 -04:00
Bruno BELANYI
3b799f6ea4 nix-index: add module (#1984)
`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.
2021-05-09 18:13:10 -04:00
Bruno BELANYI
7d765d8f46 firefox: do not override other attributes in 'cfg' (#1988)
Closes #1962.
2021-05-09 18:06:04 -04:00
Robert Helgesson
15a2953c81 powerline-go: avoid dependency in tests 2021-05-09 12:23:44 +02:00
Robert Helgesson
e42e147b58 Remove some usage of config.lib.dag
The `lib.hm.dag` attribute set should always be preferred.
2021-05-09 12:13:31 +02:00
Robert Helgesson
4896c50074 msmtp: add note about account commands in extraConfig
Fixes #1975
2021-05-08 11:39:12 +02:00
Michal Sojka
b2dec35b86 Fix eval errors when i3 or sway null configs are null (#1989) 2021-05-07 15:39:10 -06:00
0qq
ff959fd49a sxhkd: fix environment (#1892)
* sxhkd: move to xsession.initExtra

When sxhkd is launched as systemd service it
doesn't have $PATH a user expects to see.

* sxhkd: add news entry
2021-05-07 15:28:52 -04:00
Robert Helgesson
86944b0fb1 docs: remove requirement about capitalization
Seems a bit too pedantic.
2021-05-06 23:44:16 +02:00
Vincent Breitmoser
30355f8ee6 etesync-dav: add module 2021-05-06 22:48:57 +02:00
Robert Helgesson
f298705ae4 i3,sway: break documentation dependency on configuration
Before the documentation for a number of options had a dependency on
the configuration.
2021-05-06 00:16:37 +02:00
Robert Helgesson
90dd375eba zsh: break configuration dependency in documentation
Before the documentation for the `programs.zsh.history.path` had a
dependency on the configuration.
2021-05-06 00:00:45 +02:00
Antoine Martin
64c5228c08 i3, sway: description and example for font options (#1980)
Adds an example to the root fonts submodule because the documentation doesn't know how to handle `type = with types; either (listOf str) fontOptions;`
2021-05-04 08:31:37 -06:00
Sumner Evans
9ffb206050 i3, sway: replace fonts with submodule (#1950)
This applies to both the root-level and the bar configs.

Closes #1937.
2021-05-03 21:54:35 -06:00
Robert Schütz
e0ee5068dd neovim: drop python2 support (#1978)
Nixpkgs did the same in https://github.com/NixOS/nixpkgs/pull/121339.
2021-05-03 21:47:08 -06:00
Sumner Evans
225bf275ba neomutt: make folder change when sourcing account optional
This adds an option for disabling setting the folder when sourcing
accounts in neomutt.
2021-05-03 09:04:58 +02:00
David Terry
cdc774f337 lieer-service: add path to notmuch config (#1704)
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.
2021-05-03 00:19:41 +02:00
Hans
ca7868dc29 fzf: option for tmux usage in shell integration (#1926)
Added options for setting:
FZF_TMUX
FZF_TMUX_OPTS
environment variables, which changes behaviour of fzf shell integration.
2021-05-01 18:10:41 -04:00
Mario Rodas
2f857761d0 ncspot: add module (#1939)
* ncspot: add module

ncspot is a ncurses Spotify client written in Rust using librespot.

* news: fix bad github ui merge

Co-authored-by: Nicolas Berbiche <nicolas@normie.dev>
2021-05-01 17:38:12 -04:00
oxalica
5709b5f953 zsh: add history.ignorePatterns option (#1933)
The corresponding variable is `HISTORY_IGNORE` described in zshparam(1).
2021-05-01 16:33:45 -04:00
Blaž Hrastnik
19fc0917c0 waybar: fix systemd service
Fix xdg-portal issue where it'd take 25s for a GTK app to start
2021-05-01 16:26:10 -04:00
Christian Kalhauge
614a5b55bf lazygit: add module (#1930)
Co-authored-by: Nicolas Berbiche <nic.berbiche@gmail.com>
Co-authored-by: Sumner Evans <me@sumnerevans.com>
2021-05-01 09:56:19 -06:00
Kritnich
2eed138026 barrier: add module
Co-authored-by: Sumner Evans <me@sumnerevans.com>
2021-05-01 00:11:17 +02:00
Sumner Evans
5e6f09795c gtk2: allow configuration of gtkrc file
Closes #519
2021-04-30 22:56:56 +02:00
Robert Helgesson
d57c59e7cb home-environment: extra message on nix-env error
When profile installation fails during activation we'll print an extra
message that explain that, if the error is due to conflicting
packages, then it may be that the user has a manually installed copy
of the package.

Fixes #1244
2021-04-29 17:58:15 +02:00
Harsh Shandilya
137a584e22 topgrade: add module (#1924) 2021-04-28 19:56:58 -04:00
Sumner Evans
55ef8d3a10 format: remove exception for keybase and kbfs modules 2021-04-29 00:49:01 +02:00
Robert Helgesson
5ae7817dc5 kitty: use dummy package in test
Also remove assignment to non-existent option
`programs.kitty.package`.
2021-04-29 00:40:32 +02:00
Ivar Scholten
4727b0543d pbgopy: add missing options 2021-04-29 00:26:17 +02:00
Sumner Evans
4edc2091e0 github: configure probot/stale 2021-04-29 00:03:28 +02:00
Sumner Evans
2d421b30ad format: removed exceptions already formatted files (#1954)
Removed format exclusion exceptions for modules that are already
formatted correctly (that is, when running nixfmt, no changes happen) or
have been moved (in the case of i3.nix).
2021-04-28 21:59:51 +02:00
Sumner Evans
b706d101eb format: remove exception for afew module (#1955) 2021-04-28 21:58:49 +02:00
Sumner Evans
19ebab97e8 i3, sway: extract border functionality to common function (#1947)
* 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
2021-04-28 15:52:31 -04:00
Thibaut Marty
a759143ae1 mpris-proxy: add module (#1832) 2021-04-28 15:05:56 -04:00
fortune
a513fbc395 qutebrowser: fix config location on darwin (#1925) 2021-04-28 14:41:30 -04:00
Cole Mickens
c0ba8c526d gpg: can configure scdaemon.conf (#1960) 2021-04-28 14:39:58 -04:00
Tad Fisher
18ad12d52b programs.ssh: Use nullable types for optional forward attrs (#1946)
Attempting to build a flake configuration using `ssh.remoteForwards' results in
evaluation errors when `port' is undefined, as `!(entry ? port)' evaluates to
false. This was verified in the nix repl, and also occurs for `nix flake
check'.

Set optional attrs in `bindOptions' and `forwardModule' to `null' by default
and adjust the assertion to check for `null' instead of attr definitions.
2021-04-27 17:16:33 -04:00
Cole Mickens
d437baa41c gnupg/gpg-agent: gnupg package is configurable (#1949) 2021-04-27 16:40:05 -04:00
Thibaut Marty
865e404826 poweralertd: add module (#1951) 2021-04-27 16:38:41 -04:00
Nicolas Berbiche
d4278212b5 pass-secret-service: fix systemd unit install option (#1959) 2021-04-27 16:17:36 -04:00
Vladimir Serov
b4e3f069f1 pass-secret-service: add module (#1898)
pass-secret-service is a proxy between
secret service (libsecret) and pass.
2021-04-27 15:36:29 -04:00
Sumner Evans
827636c619 dunst: add service package option (#1944)
* add service package option

* add waylandDisplay option dunst now supports wayland, and looks for WAYLAND_DISPLAY var to use it

Co-authored-by: @li:maisiliym.uniks <@li:maisiliym.uniks>
2021-04-25 01:56:48 -04:00
Robert Helgesson
c2c26120d7 scmpuff: fix formatting 2021-04-24 19:06:40 +02:00
Sumner Evans
839645caf3 programs.neovim: fix failing test (#1943)
Updated the expected plugin-config.vim to match what is actually
returned by the neovim utils from upstream.
2021-04-23 20:19:26 +02:00
Mario Rodas
e00dd0d7d2 programs.tmux: use xdg config path (#1928)
Tmux 3.2 includes support to use `$XDG_CONFIG_HOME/tmux/tmux.conf` as
well as `~/.config/tmux/tmux.conf` for configuration file.
2021-04-23 09:25:13 +02:00
Phillip Cloud
26fa84ebce scmpuff: init (#1921)
scmpuff is a command line tool that allows you to work quicker with Git by substituting numeric shortcuts for files
2021-04-22 22:27:29 -04:00
Bruno BELANYI
db00b39a9a termite: add option to enable VTE integration (#1917)
This also migrates to using the VTE module directly, centralising bug
fixes.

Fixes #1909.
2021-04-20 19:45:39 -04:00
Terje Larsen
0c236e13bc flake: add extraModules option, inherit nixpkgs config and overlays in homeManagerConfiguration (#1767)
* flake: ensure passed pkgs with overlays and config is used

In the pkgsModule inside modules/modules.nix it will try to use the
<nixpkgs> from NIX_PATH if home.stateVersion is not set. This is not
available when using flakes so we need to require at least 20.09 and we
might as well default to that.

Also if you have added overlays and config to your pkgs it will be lost
so we need to transfer those as well.

This is an alternative to passing pkgs to extraSpecialArgs which will
break the usage of things like nixpkgs.config.packageOverrides.

* flake: add extraModules

If you want to add some extra home-manager modules, you have to mix them
with the configuration as such:

configuration = {
  imports = [
    emacs-config.homeManagerModules.emacsConfig
    ./home.nix
  ];
};

Instead of:
configuration = ./home.nix;
extraModules = [ emacs-config.homeManagerModules.emacsConfig ];

Which separates these two concerns.
2021-04-20 16:19:24 -04:00
Tamás Hetesi
1e7e8ac75d pet: Add support for tags in snippets (#1883)
Add missing `tag` option for elements of `programs.pet.snippets`.
2021-04-20 16:16:27 -04:00
fricklerhandwerk
6aa6556bca gpg-agent: add GNUPG_HOMEDIR to environment (#1932)
otherwise, if `programs.gpg.homedir` is not set to default, calls to
`gpg` will fail to pick up anything related to secrets
2021-04-19 01:52:31 +02:00
Robert Helgesson
ebbbd4f2b5 gpg: fix homedir option documentation
Previously the documentation had a dependency on the configuration.
2021-04-15 08:53:13 +02:00
fricklerhandwerk
348b5a5a69 gpg: make homedir configurable 2021-04-14 23:44:34 +02:00
Imran Hossain
0a6227d667 flake.nix: Add packages and defaultPackages outputs (#1913) 2021-04-11 17:46:27 -04:00
Christian Gram Kalhauge
7cf69a3b8d exa: add module
Exa is a 'ls' alternative with more sane colorscheme than lsd on white
backgrounds.
2021-04-11 22:47:06 +02:00
Sumner Evans
073710d7f2 newsboat: add sumnerevans as maintainer 2021-04-11 22:20:03 +02:00
Sumner Evans
f7159a0f76 newsboat: use $XDG_CONFIG_HOME/newsboat
As of Newsboat 2.19, configuration using XDG_CONFIG_HOME/newsboat is
supported:
https://newsboat.org/releases/2.19/docs/newsboat.html#_xdg_base_directory_support

This is a continuation of #1331 and includes gating logic so that the
change doesn't happen until state version 21.05.

Supersedes and Closes #1331
2021-04-11 22:20:02 +02:00
Sumner Evans
18930aaf75 sway: add sumnerevans as maintainer 2021-04-11 22:11:23 +02:00
Sumner Evans
5c5d562266 sway: add config.seat
Added seat configuration to sway config. Also improved the way that the
configuration is generated to reduce superfluous whitespace.

Supersedes #1663
2021-04-11 22:11:22 +02:00
malte-v
91418d3e57 programs.neomutt: Make manual configuration take precedence over generated settings (#1896) 2021-04-11 19:52:31 +02:00
Vonfry
f567ea8228 msmtp: add extraAccounts option
It is appended to the end of msmtprc instead of top like extraConfig.
2021-04-10 10:03:47 +02:00
brwith
17a10287d2 gtk: use font.size option in dconf (#1920)
Allow usage of font.size for the GTK interface font in dconf.
2021-04-09 21:45:14 -04:00
jgart
56f5f41ed4 README: typo fix (#1912) 2021-04-08 11:11:39 -04:00
Sumner Evans
be56b6f2c5 neomutt: Add encryptByDefault support (#1882)
Adds support for encryptByDefault to the neomutt module using the
crypt_opportunistic_encrypt option.
2021-04-07 15:45:50 -04:00
217 changed files with 4313 additions and 960 deletions

47
.github/CODEOWNERS vendored
View File

@@ -34,6 +34,9 @@
/modules/misc/xdg-user-dirs.nix @pacien
/modules/misc/xdg-system-dirs.nix @tadfisher
/tests/modules/misc/xdg/system-dirs.nix @tadfisher
/modules/programs/aria2.nix @JustinLovinger
/modules/programs/autojump.nix @evanjs
@@ -57,8 +60,13 @@
/modules/programs/emacs.nix @rycee
/modules/programs/exa.nix @kalhauge
/modules/programs/firefox.nix @rycee
/modules/programs/foot.nix @plabadens
/tests/modules/programs/foot @plabadens
/modules/programs/gh.nix @Gerschtli
/tests/modules/programs/gh @Gerschtli
@@ -70,12 +78,18 @@
/modules/programs/home-manager.nix @rycee
/modules/programs/htop.nix @bjpbakker
/modules/programs/i3status.nix @JustinLovinger
/modules/programs/i3status-rust.nix @workflow
/modules/programs/java.nix @ShamrockLee
/modules/programs/keychain.nix @marsam
/modules/programs/lazygit.nix @kalhauge
/modules/programs/lesspipe.nix @rycee
/modules/programs/lf.nix @owm111
@@ -101,9 +115,17 @@
/tests/modules/programs/ncmpcpp @olmokramer
/tests/modules/programs/ncmpcpp-linux @olmokramer
/modules/programs/ncspot.nix @marsam
/modules/programs/ne.nix @cwyc
/tests/modules/programs/ne @cwyc
/modules/programs/newsboat.nix @sumnerevans
/tests/modules/programs/newsboat @sumnerevans
/modules/programs/nix-index.nix @ambroisie
/tests/modules/programs/nix-index @ambroisie
/modules/programs/noti.nix @marsam
/modules/programs/nushell.nix @Philipp-M
@@ -136,12 +158,18 @@
/modules/programs/sbt.nix @kubukoz
/tests/modules/programs/sbt @kubukoz
/modules/programs/scmpuff.nix @cpcloud
/tests/modules/programs/scmpuff @cpcloud
/modules/programs/ssh.nix @rycee
/modules/programs/starship.nix @marsam
/modules/programs/texlive.nix @rycee
/modules/programs/topgrade.nix @msfjarvis
/tests/modules/programs/topgrade @msfjarvis
/modules/programs/waybar.nix @berbiche
/tests/modules/programs/waybar @berbiche
@@ -153,6 +181,9 @@
/modules/programs/zsh/prezto.nix @NickHu
/modules/services/barrier.nix @Kritnich
/tests/modules/services/barrier @Kritnich
/modules/services/caffeine.nix @uvNikita
/modules/services/cbatticon.nix @pmiddend
@@ -166,6 +197,8 @@
/modules/services/emacs.nix @tadfisher
/modules/services/etesync-dav.nix @Valodim
/modules/services/flameshot.nix @moredhel
/modules/services/fluidsynth.nix @Valodim
@@ -197,12 +230,16 @@
/modules/services/mpdris2.nix @pjones
/modules/services/mpris-proxy.nix @ThibautMarty
/modules/services/muchsync.nix @pacien
/modules/services/network-manager-applet.nix @rycee
/modules/services/parcellite.nix @gleber
/modules/services/pass-secret-service.nix @cab404
/modules/services/password-store-sync.nix @pacien
/modules/services/pasystray.nix @pltanton
@@ -215,6 +252,8 @@
/modules/services/playerctld.nix @fendse
/tests/modules/playerctld @fendse
/modules/services/poweralertd.nix @ThibautMarty
/modules/services/pulseeffects.nix @jonringer
/modules/services/random-background.nix @rycee
@@ -236,7 +275,13 @@
/modules/services/unison.nix @pacien
/modules/services/window-managers/i3-sway/sway.nix @alexarice
/modules/services/window-managers/i3-sway/i3.nix @sumnerevans
/tests/modules/services/window-managers/i3 @sumnerevans
/modules/services/window-managers/i3-sway/lib @sumnerevans
/modules/services/window-managers/i3-sway/sway.nix @alexarice @sumnerevans
/tests/modules/services/window-managers/sway @sumnerevans
/modules/services/wlsunset.nix @matrss
/tests/modules/services/wlsunset @matrss

View File

@@ -1,15 +1,7 @@
<!--
If you are encountering the error
element xref: validity error : IDREF attribute linkend references an unknown ID "opt-home.file._name__.source"
then it means that you are using an old version of Home Manager, such
as the release-20.03 branch, with a recent version of Nixpkgs, such as
version 20.09 or master. See https://git.io/JTb6K for more.
In general, please check if there already exists a relevant issue
before creating a new one.
Don't forget to check if there already exists a relevant issue before
creating a new one.
-->
@@ -17,7 +9,8 @@ before creating a new one.
<!--
Please describe the issue. For support and help please use the IRC
channel #home-manager @ freenode.net instead.
channel #home-manager at irc.oftc.net or Matrix room
https://matrix.to/#/#hm:rycee.net instead.
-->
### Meta

75
.github/stale.yml vendored Normal file
View File

@@ -0,0 +1,75 @@
# Configuration for probot-stale - https://github.com/probot/stale
daysUntilStale: 90
daysUntilClose: 7
staleLabel: "status: stale"
closeComment: false
issues:
markComment: |
<p>
Thank you for your contribution!
I marked this issue as stale due to inactivity.
If this remains inactive for another 7 days, I will close this issue.
<b>Please read the relevant sections below before commenting.</b>
</p>
<details>
<summary><b>If you are the original author of the issue</b></summary>
<p>
* If this is resolved, please consider closing it so that the maintainers know not to focus on this.
* If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
* If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
</p>
</details>
<details>
<summary><b>If you are <i>not</i> the original author of the issue</b></summary>
<p>
* If you are also experiencing this issue, please add details of your situation to help with the debugging process.
* If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
</p>
</details>
<details>
<summary><b>Memorandum on closing issues</b></summary>
<p>
If you have nothing of substance to add, please refrain from commenting and allow the bot close the issue.
Also, don't be afraid to manually close an issue, even if it holds valuable information.
</p>
<p>
Closed issues stay in the system for people to search, read, cross-reference, or even reopen--nothing is lost!
Closing obsolete issues is an important way to help maintainers focus their time and effort.
</p>
</details>
pulls:
markComment: |
<p>
Thank you for your contribution!
I marked this pull request as stale due to inactivity.
If this remains inactive for another 7 days, I will close this PR.
<b>Please read the relevant sections below before commenting.</b>
</p>
<details>
<summary><b>If you are the original author of the PR</b></summary>
<p>
* GitHub sometimes doesn't notify people who commented / reviewed a PR previously, when you (force) push commits. *If you have addressed the reviews* you can [officially ask for a review](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/requesting-a-pull-request-review) from those who commented to you or anyone else.
* If it is unfinished but you plan to finish it, please mark it as a draft.
* If you don't expect to work on it any time soon, please consider closing it with a short comment encouraging someone else to pick up your work.
* To get things rolling again, rebase the PR against the target branch and address valid comments.
</p>
</details>
<details>
<summary><b>If you are <i>not</i> the original author of the issue</b></summary>
<p>
* If you want to pick up the work on this PR, please create a new PR and indicate that it supercedes and closes this PR.
</p>
</details>

View File

@@ -10,8 +10,8 @@ jobs:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v13
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v16
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v10

View File

@@ -10,10 +10,11 @@ jobs:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v13
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v16
with:
nix_path: nixpkgs=channel:nixos-unstable
install_url: https://releases.nixos.org/nix/nix-2.3.16/install
nix_path: nixpkgs=channel:nixos-21.05
- uses: cachix/cachix-action@v10
with:
name: nix-community

View File

@@ -29,10 +29,10 @@ learn.
In some cases Home Manager cannot detect whether it will overwrite a
previous manual configuration. For example, the Gnome Terminal module
will write to your dconf store and cannot tell whether a configuration
that it is about to be overwrite was from a previous Home Manager
that it is about to be overwritten was from a previous Home Manager
generation or from manual configuration.
Home Manager targets [NixOS][] unstable and NixOS version 20.09 (the
Home Manager targets [NixOS][] unstable and NixOS version 21.05 (the
current stable version), it may or may not work on other Linux
distributions and NixOS versions.
@@ -48,8 +48,7 @@ Contact
-------
You can chat with us on IRC in the channel [#home-manager][] on
[freenode][]. The [channel logs][] are hosted courtesy of
[samueldr][].
[OFTC][].
Installation
------------
@@ -76,10 +75,10 @@ Currently the easiest way to install Home Manager is as follows:
$ nix-channel --update
```
and if you follow a Nixpkgs version 20.09 channel you can run
and if you follow a Nixpkgs version 21.05 channel you can run
```console
$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-20.09.tar.gz home-manager
$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.05.tar.gz home-manager
$ nix-channel --update
```
@@ -143,7 +142,7 @@ configuration generations.
As an example, let us expand the initial configuration file from the
installation above to install the htop and fortune packages, install
Emacs with a few extra packages enabled, install Firefox with
smooth scrolling enabled, and enable the user gpg-agent service.
smooth scrolling disabled, and enable the user gpg-agent service.
To satisfy the above setup we should elaborate the
`~/.config/nixpkgs/home.nix` file as follows:
@@ -280,7 +279,7 @@ then result in
$ home-manager switch
Activating checkLinkTargets
Existing file '/home/jdoe/.gitconfig' is in the way
Existing file '/home/jdoe/.config/git/config' is in the way
Please move the above files and try again
```
@@ -367,7 +366,7 @@ Home Manager is developed against `nixpkgs-unstable` branch, which
often causes it to contain tweaks for changes/packages not yet
released in stable NixOS. To avoid breaking users' configurations,
Home Manager is released in branches corresponding to NixOS releases
(e.g. `release-20.09`). These branches get fixes, but usually not new
(e.g. `release-21.05`). These branches get fixes, but usually not new
modules. If you need a module to be backported, then feel free to open
an issue.
@@ -380,9 +379,8 @@ an issue.
[Z shell]: http://zsh.sourceforge.net/
[manual]: https://nix-community.github.io/home-manager/
[configuration options]: https://nix-community.github.io/home-manager/options.html
[#home-manager]: https://webchat.freenode.net/?url=irc%3A%2F%2Firc.freenode.net%2Fhome-manager
[freenode]: https://freenode.net/
[channel logs]: https://logs.nix.samueldr.com/home-manager/
[#home-manager]: https://webchat.oftc.net/?channels=home-manager
[OFTC]: https://oftc.net/
[samueldr]: https://github.com/samueldr/
[Nix Pills]: https://nixos.org/nixos/nix-pills/
[Nix Flakes]: https://nixos.wiki/wiki/Flakes

View File

@@ -44,7 +44,7 @@ The first option is good if you only temporarily want to use your clone.
[[sec-guidelines]]
=== Guidelines
:irc-home-manager: https://webchat.freenode.net/?url=irc%3A%2F%2Firc.freenode.net%2Fhome-manager
:irc-home-manager: https://webchat.oftc.net/?channels=home-manager
:valuable-options: https://github.com/Infinisil/rfcs/blob/config-option/rfcs/0042-config-option.md#valuable-options
:rfc-42: https://github.com/Infinisil/rfcs/blob/config-option/rfcs/0042-config-option.md
:assertions: https://nixos.org/manual/nixos/stable/index.html#sec-assertions
@@ -163,7 +163,7 @@ The commit messages should follow the {seven-rules}[seven rules]. We also ask yo
{long description}
----
where `{component}` refers to the code component (or module) your change affects, `{description}` is a very brief description of your change, and `{long description}` is an optional clarifying description. Note, `{description}` should start with a lower case letter. As a rare exception, if there is no clear component, or your change affects many components, then the `{component}` part is optional. See <<ex-commit-message>> for a commit message that fulfills these requirements.
where `{component}` refers to the code component (or module) your change affects, `{description}` is a very brief description of your change, and `{long description}` is an optional clarifying description. As a rare exception, if there is no clear component, or your change affects many components, then the `{component}` part is optional. See <<ex-commit-message>> for a commit message that fulfills these requirements.
[[ex-commit-message]]
.Compliant commit message

View File

@@ -92,7 +92,7 @@ error: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name ca.desrt.
The solution on NixOS is to add
[source,nix]
services.dbus.packages = with pkgs; [ gnome3.dconf ];
services.dbus.packages = with pkgs; [ gnome.dconf ];
to your system configuration.

View File

@@ -47,11 +47,11 @@ $ nix-channel --add https://github.com/nix-community/home-manager/archive/master
$ nix-channel --update
----
+
and if you follow a Nixpkgs version 20.09 channel, you can run
and if you follow a Nixpkgs version 21.05 channel, you can run
+
[source,console]
----
$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-20.09.tar.gz home-manager
$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.05.tar.gz home-manager
$ nix-channel --update
----
+
@@ -125,11 +125,11 @@ or an unstable channel, you can run
# nix-channel --update
----
and if you follow a Nixpkgs version 20.09 channel, you can run
and if you follow a Nixpkgs version 21.05 channel, you can run
[source,console]
----
# nix-channel --add https://github.com/nix-community/home-manager/archive/release-20.09.tar.gz home-manager
# nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.05.tar.gz home-manager
# nix-channel --update
----
@@ -203,11 +203,11 @@ or an unstable channel, you can run
# nix-channel --update
----
and if you follow a Nixpkgs version 20.09 channel, you can run
and if you follow a Nixpkgs version 21.05 channel, you can run
[source,console]
----
# nix-channel --add https://github.com/nix-community/home-manager/archive/release-20.09.tar.gz home-manager
# nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.05.tar.gz home-manager
# nix-channel --update
----

View File

@@ -12,47 +12,47 @@
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>home-manager</command> <group choice="req">
<command>home-manager</command> <group choice="req">
<arg choice="plain">
build
</arg>
<arg choice="plain">
instantiate
</arg>
<arg choice="plain">
edit
</arg>
<arg choice="plain">
expire-generations <replaceable>timestamp</replaceable>
</arg>
<arg choice="plain">
generations
</arg>
<arg choice="plain">
help
</arg>
<arg choice="plain">
news
</arg>
<arg choice="plain">
packages
</arg>
<arg choice="plain">
remove-generations <replaceable>ID …</replaceable>
</arg>
<arg choice="plain">
switch
</arg>
<arg choice="plain">
uninstall
</arg>
@@ -61,63 +61,63 @@
<arg>
-A <replaceable>attrPath</replaceable>
</arg>
<arg>
-I <replaceable>path</replaceable>
</arg>
<arg>
--flake <replaceable>flake-uri</replaceable>
</arg>
<arg>
-b <replaceable>ext</replaceable>
</arg>
<arg>
<group choice="req">
<group choice="req">
<arg choice="plain">
-f
</arg>
<arg choice="plain">
--file
</arg>
</group> <replaceable>path</replaceable>
</arg>
<arg>
<group choice="req">
<group choice="req">
<arg choice="plain">
-h
</arg>
<arg choice="plain">
--help
</arg>
</group>
</arg>
<arg>
<group choice="req">
<group choice="req">
<arg choice="plain">
-n
</arg>
<arg choice="plain">
--dry-run
</arg>
</group>
</arg>
<arg>
--option <replaceable>name</replaceable> <replaceable>value</replaceable>
</arg>
<arg>
--cores <replaceable>number</replaceable>
</arg>
<arg>
<group choice="req">
<arg choice="plain">
@@ -130,29 +130,33 @@
</group>
<replaceable>number</replaceable>
</arg>
<arg>
--debug
</arg>
<arg>
--keep-failed
</arg>
<arg>
--keep-going
</arg>
<arg>
--show-trace
</arg>
<arg>
--(no-)substitute
</arg>
<arg>
<group choice="req">
<group choice="req">
<arg choice="plain">
-v
</arg>
<arg choice="plain">
--verbose
</arg>
@@ -456,6 +460,18 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--debug</option>
</term>
<listitem>
<para>
Passed on to <citerefentry>
<refentrytitle>nix-build</refentrytitle>
<manvolnum>1</manvolnum> </citerefentry>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--keep-failed</option>

View File

@@ -14,10 +14,8 @@
</para>
<para>
If you encounter problems then please reach out on the IRC channel
<link xlink:href="https://webchat.freenode.net/?url=irc%3A%2F%2Firc.freenode.net%2Fhome-manager">#home-manager</link>
hosted by <link xlink:href="https://freenode.net/">freenode</link>.
The <link xlink:href="https://logs.nix.samueldr.com/home-manager/">channel logs</link>
are hosted courtesy of <link xlink:href="https://github.com/samueldr/">samueldr</link>.
<link xlink:href="https://webchat.oftc.net/?channels=home-manager">#home-manager</link>
hosted by <link xlink:href="https://oftc.net/">OFTC</link>.
If your problem is caused by a bug in Home Manager then it should
be reported on the
<link xlink:href="https://github.com/nix-community/home-manager/issues">Home Manager issue tracker</link>.

View File

@@ -1,8 +1,7 @@
[[sec-release-21.05]]
== Release 21.05
This is the current unstable branch and the information in this
section is therefore not final.
The 21.05 release branch became the stable branch in May, 2021.
[[sec-release-21.05-highlights]]
=== Highlights
@@ -172,6 +171,24 @@ font = {
};
----
* The <<opt-programs.htop.settings>> option is introduced to replace individual
options in `programs.htop`. To migrate, set the htop options directly in
<<opt-programs.htop.settings>>. For example:
+
[source,nix]
----
programs.htop = {
enabled = true;
settings = {
color_scheme = 5;
delay = 15;
highlight_base_name = 1;
highlight_megabytes = 1;
highlight_threads = 1;
};
};
----
[[sec-release-21.05-state-version-changes]]
=== State Version Changes
@@ -179,4 +196,5 @@ The state version in this release includes the changes below. These
changes are only active if the `home.stateVersion` option is set to
"21.05" or later.
* Nothing has happened.
* The `newsboat` module now stores generated configuration in
`$XDG_CONFIG_HOME/newsboat`.

View File

@@ -1,26 +1,46 @@
{
description = "Home Manager for Nix";
outputs = { self, nixpkgs }: rec {
nixosModules.home-manager = import ./nixos;
nixosModule = self.nixosModules.home-manager;
outputs = { self, nixpkgs }:
let
# List of systems supported by home-manager binary
supportedSystems = nixpkgs.lib.platforms.unix;
darwinModules.home-manager = import ./nix-darwin;
darwinModule = self.darwinModules.home-manager;
# Function to generate a set based on supported systems
forAllSystems = f:
nixpkgs.lib.genAttrs supportedSystems (system: f system);
lib = {
hm = import ./modules/lib { lib = nixpkgs.lib; };
homeManagerConfiguration = { configuration, system, homeDirectory
, username, extraSpecialArgs ? { }
, pkgs ? builtins.getAttr system nixpkgs.outputs.legacyPackages
, check ? true }@args:
import ./modules {
inherit pkgs check extraSpecialArgs;
configuration = { ... }: {
imports = [ configuration ];
home = { inherit homeDirectory username; };
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
in rec {
nixosModules.home-manager = import ./nixos;
nixosModule = self.nixosModules.home-manager;
darwinModules.home-manager = import ./nix-darwin;
darwinModule = self.darwinModules.home-manager;
packages = forAllSystems (system: {
home-manager = nixpkgsFor.${system}.callPackage ./home-manager { };
});
defaultPackage =
forAllSystems (system: self.packages.${system}.home-manager);
lib = {
hm = import ./modules/lib { lib = nixpkgs.lib; };
homeManagerConfiguration = { configuration, system, homeDirectory
, username, extraModules ? [ ], extraSpecialArgs ? { }
, pkgs ? builtins.getAttr system nixpkgs.outputs.legacyPackages
, check ? true, stateVersion ? "20.09" }@args:
assert nixpkgs.lib.versionAtLeast stateVersion "20.09";
import ./modules {
inherit pkgs check extraSpecialArgs;
configuration = { ... }: {
imports = [ configuration ] ++ extraModules;
home = { inherit homeDirectory stateVersion username; };
nixpkgs = { inherit (pkgs) config overlays; };
};
};
};
};
};
};
}

6
format
View File

@@ -29,24 +29,18 @@ find . -name '*.nix' \
! -path ./modules/misc/nixpkgs.nix \
! -path ./modules/misc/xdg.nix \
! -path ./modules/modules.nix \
! -path ./modules/programs/afew.nix \
! -path ./modules/programs/bash.nix \
! -path ./modules/programs/firefox.nix \
! -path ./modules/programs/gpg.nix \
! -path ./modules/programs/lesspipe.nix \
! -path ./modules/programs/ssh.nix \
! -path ./modules/programs/tmux.nix \
! -path ./modules/programs/zsh.nix \
! -path ./modules/services/gpg-agent.nix \
! -path ./modules/services/kbfs.nix \
! -path ./modules/services/keybase.nix \
! -path ./modules/services/mpd.nix \
! -path ./modules/services/sxhkd.nix \
! -path ./modules/services/window-managers/i3.nix \
! -path ./modules/systemd.nix \
! -path ./nix-darwin/default.nix \
! -path ./tests/default.nix \
! -path ./tests/modules/home-environment/default.nix \
! -path ./tests/modules/home-environment/session-variables.nix \
! -path ./tests/modules/programs/gpg/override-defaults.nix \
! -path ./tests/modules/programs/zsh/session-variables.nix \

View File

@@ -285,8 +285,8 @@ _home-manager_completions ()
#--------------------------#
local Options
Options=( "-f" "--file" "-b" "-A" "-I" "-h" "--help" "-n" "--dry-run" "-v" "--verbose" "--show-trace" \
"-j" "--max-jobs" )
Options=( "-f" "--file" "-b" "-A" "-I" "-h" "--help" "-n" "--dry-run" "-v" "--verbose" \
"--cores" "--debug" "--keep-failed" "--keep-going" "-j" "--max-jobs" "--no-substitute" "--show-trace" "--substitute")
# ^ « home-manager »'s options.

View File

@@ -7,6 +7,7 @@ _arguments \
'-I[search path]:PATH:_files -/' \
'-b[backup files]:EXT:()' \
'--cores[cores]:NUM:()' \
'--debug[debug]' \
'--keep-failed[keep failed]' \
'--keep-going[keep going]' \
'(-h --help)'{--help,-h}'[help]' \
@@ -42,11 +43,14 @@ case "$state" in
build|switch)
_arguments \
'--cores[cores]:NUM:()' \
'--debug[debug]' \
'--keep-failed[keep failed]' \
'--keep-going[keep going]' \
'--max-jobs[max jobs]:NUM:()' \
'--no-substitute[no substitute]' \
'--option[option]:NAME VALUE:()' \
'--show-trace[show trace]'
'--show-trace[show trace]' \
'--substitute[substitute]'
;;
esac
esac

View File

@@ -473,6 +473,7 @@ function doHelp() {
echo
echo " --arg(str) NAME VALUE Override inputs passed to home-manager.nix"
echo " --cores NUM"
echo " --debug"
echo " --keep-failed"
echo " --keep-going"
echo " -j, --max-jobs NUM"
@@ -572,7 +573,7 @@ while [[ $# -gt 0 ]]; do
PASSTHROUGH_OPTS+=("$opt" "$1")
shift
;;
--keep-failed|--keep-going|--show-trace\
--debug|--keep-failed|--keep-going|--show-trace\
|--substitute|--no-substitute)
PASSTHROUGH_OPTS+=("$opt")
;;

View File

@@ -236,12 +236,22 @@ in
home.activation.checkFilesChanged = hm.dag.entryBefore ["linkGeneration"] (
''
function _cmp() {
if [[ -d $1 && -d $2 ]]; then
diff -rq "$1" "$2" &> /dev/null
else
cmp --quiet "$1" "$2"
fi
}
declare -A changedFiles
'' + concatMapStrings (v: ''
cmp --quiet "${sourceStorePath v}" "${homeDirectory}/${v.target}" \
_cmp "${sourceStorePath v}" "${homeDirectory}/${v.target}" \
&& changedFiles["${v.target}"]=0 \
|| changedFiles["${v.target}"]=1
'') (filter (v: v.onChange != "") (attrValues cfg))
+ ''
unset -f _cmp
''
);
home.activation.onFilesChange = hm.dag.entryAfter ["linkGeneration"] (

View File

@@ -493,7 +493,24 @@ in
''
else
''
$DRY_RUN_CMD nix-env -i ${cfg.path}
if ! $DRY_RUN_CMD nix-env -i ${cfg.path} ; then
cat <<EOF
Oops, nix-env failed to install your new Home Manager profile!
Perhaps there is a conflict with a package that was installed using
'nix-env -i'? Try running
nix-env -q
and if there is a conflicting package you can remove it with
nix-env -e {package name}
Then try activating your Home Manager configuration again.
EOF
exit 1
fi
''
);
@@ -524,9 +541,7 @@ in
]
+ optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH";
activationScript = pkgs.writeScript "activation-script" ''
#!${pkgs.runtimeShell}
activationScript = pkgs.writeShellScript "activation-script" ''
set -eu
set -o pipefail

View File

@@ -82,6 +82,9 @@ with lib;
generations. The script will be run
<emphasis>after</emphasis> the new files have been linked
into place.
</para><para>
Note, this code is always run when <literal>recursive</literal> is
enabled.
'';
};

View File

@@ -31,6 +31,12 @@
github = "olmokramer";
githubId = 3612514;
};
kalhauge = {
name = "Christian Gram Kalhauge";
email = "kalhauge@users.noreply.github.com";
github = "kalhauge";
githubId = 1182166;
};
kubukoz = {
name = "Jakub Kozłowski";
email = "kubukoz@users.noreply.github.com";
@@ -65,4 +71,20 @@
githubId = 46252070;
name = "Sara Johnsson";
};
msfjarvis = {
email = "me@msfjarvis.dev";
github = "msfjarvis";
githubId = "13348378";
name = "Harsh Shandilya";
keys = [{
longkeyid = "rsa4096/0xB7843F823355E9B9";
fingerprint = "8F87 050B 0F9C B841 1515 7399 B784 3F82 3355 E9B9";
}];
};
ambroisie = {
email = "bruno.home-manager@belanyi.fr";
github = "ambroisie";
githubId = 12465195;
name = "Bruno BELANYI";
};
}

View File

@@ -33,7 +33,7 @@ let
package = mkOption {
type = types.nullOr types.package;
default = null;
example = literalExample "pkgs.gnome3.gnome_themes_standard";
example = literalExample "pkgs.gnome.gnome_themes_standard";
description = ''
Package providing the theme. This package will be installed
to your profile. If <literal>null</literal> then the theme
@@ -92,6 +92,18 @@ in {
<filename>~/.gtkrc-2.0</filename>.
'';
};
configLocation = mkOption {
type = types.path;
default = "${config.home.homeDirectory}/.gtkrc-2.0";
defaultText =
literalExample ''"''${config.home.homeDirectory}/.gtkrc-2.0"'';
example =
literalExample ''"''${config.xdg.configHome}/gtk-2.0/gtkrc"'';
description = ''
The location to put the GTK configuration file.
'';
};
};
gtk3 = {
@@ -138,8 +150,12 @@ in {
gtk-icon-theme-name = cfg.iconTheme.name;
};
dconfIni = optionalAttrs (cfg.font != null) { font-name = cfg.font.name; }
// optionalAttrs (cfg.theme != null) { gtk-theme = cfg.theme.name; }
dconfIni = optionalAttrs (cfg.font != null) {
font-name = let
fontSize =
optionalString (cfg.font.size != null) " ${toString cfg.font.size}";
in "${cfg.font.name}" + fontSize;
} // optionalAttrs (cfg.theme != null) { gtk-theme = cfg.theme.name; }
// optionalAttrs (cfg.iconTheme != null) {
icon-theme = cfg.iconTheme.name;
};
@@ -150,10 +166,12 @@ in {
home.packages = optionalPackage cfg.font ++ optionalPackage cfg.theme
++ optionalPackage cfg.iconTheme;
home.file.".gtkrc-2.0".text =
home.file.${cfg2.configLocation}.text =
concatStringsSep "\n" (mapAttrsToList formatGtk2Option ini) + "\n"
+ cfg2.extraConfig;
home.sessionVariables.GTK2_RC_FILES = cfg2.configLocation;
xdg.configFile."gtk-3.0/settings.ini".text =
toGtk3Ini { Settings = ini // cfg3.extraConfig; };

View File

@@ -116,6 +116,9 @@ in
#
# date --iso-8601=second --universal
#
# On darwin (or BSD like systems) use
#
# date -u +'%Y-%m-%dT%H:%M:%S+00:00'
news.entries = [
{
time = "2017-09-01T10:56:28+00:00";
@@ -1863,6 +1866,7 @@ in
lists to polybar-style 'foo-0, foo-1, ...' lists.
'';
}
{
time = "2021-02-25T22:36:43+00:00";
condition = config.programs.git.enable && any (msmtp: msmtp.enable)
@@ -1873,6 +1877,7 @@ in
'accounts.email.accounts.<name>.msmtp.enable' is true.
'';
}
{
time = "2021-03-03T22:16:05+00:00";
message = ''
@@ -1880,6 +1885,7 @@ in
https://no-color.org/.
'';
}
{
time = "2021-03-29T21:05:50+00:00";
message = ''
@@ -1887,6 +1893,167 @@ in
applied after 'programs.dircolors.settings'.
'';
}
{
time = "2021-04-11T20:44:54+00:00";
message = ''
A new module is available: 'programs.exa'.
'';
}
{
time = "2021-04-23T10:00:00+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.pass-secret-service'.
'';
}
{
time = "2021-04-26T07:00:00+00:00";
condition = hostPlatform.isLinux;
message = ''
A new service is available: 'services.poweralertd'.
'';
}
{
time = "2021-04-28T10:00:00+00:00";
condition = hostPlatform.isLinux;
message = ''
A new service is available: 'services.mpris-proxy'.
'';
}
{
time = "2021-04-28T12:00:00+00:00";
message = ''
A new module is available: 'programs.topgrade'.
'';
}
{
time = "2021-04-30T22:05:01+00:00";
condition = hostPlatform.isLinux;
message = ''
A new service is available: 'services.barrier'.
'';
}
{
time = "2021-05-01T15:16:08+00:00";
message = ''
A new module is available: 'programs.lazygit'.
'';
}
{
time = "2021-04-27T00:00:00+00:00";
message = ''
A new module is available: 'programs.ncspot'.
'';
}
{
time = "2021-05-02T11:22:42+00:00";
condition = hostPlatform.isLinux && config.services.sxhkd.enable;
message = ''
The sxhkd service now is started using 'xsession.initExtra',
therefore this module loses systemd service management capabilities
and works only if Home Manager starts the user X session.
The option 'services.sxhkd.extraPath' has been deprecated.
'';
}
{
time = "2021-05-06T20:47:37+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.etesync-dav'
'';
}
{
time = "2021-05-06T11:01:41+00:00";
message = ''
A new module is available: 'programs.nix-index'.
'';
}
{
time = "2021-05-10T18:50:07+00:00";
message = ''
A new module is available: 'xdg.systemDirs'. Options are:
- xdg.systemDirs.config
Extra directory names to add to $XDG_CONFIG_DIRS in the user
session.
- xdg.systemDirs.data
Extra directory names to add to $XDG_DATA_DIRS in the user
session.
These variables are visible in both systemd user services and
login shells.
'';
}
{
time = "2021-05-18T12:22:42+00:00";
condition = config.services.syncthing != {};
message = ''
Setting 'services.syncthing.tray' as a boolean will be deprecated in
the future.
This is to make the syncthing tray package configurable, with
`services.syncthing.tray.package`, following QSyncthingTray becoming
no longer actively maintained. The default syncthing tray package has
also changed to https://github.com/Martchus/syncthingtray. To
continue as before, set `services.syncthing.tray.enable`.
See
https://github.com/nix-community/home-manager/pull/1257
for discussion.
'';
}
{
time = "2021-05-18T20:28:50+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'programs.foot'.
'';
}
{
time = "2021-05-23T18:31:38+00:00";
condition = config.programs.mbsync.enable;
message = ''
mbsync channels no longer accepts the masterPattern or slavePattern
attribute keys. This is due to an upstream change.
They have been renamed: masterPattern -> farPattern, and
slavePattern -> nearPattern.
This is a stateful change, where the database file(s) used to keep track
of mail are silently upgraded once you upgrade both your configuration file
and the mbsync program.
Note that this change is non-reversible, meaning once you choose to switch to
near/farPattern, you can no longer use your previous slave/masterPattern
configuration file.
'';
}
{
time = "2021-10-03T20:00:52+00:00";
message = ''
A new module is available: 'programs.java'.
'';
}
];
};
}

View File

@@ -0,0 +1,55 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.xdg.systemDirs;
configDirs = concatStringsSep ":" cfg.config;
dataDirs = concatStringsSep ":" cfg.data;
in {
meta.maintainers = with maintainers; [ tadfisher ];
options.xdg.systemDirs = {
config = mkOption {
type = types.listOf types.str;
default = [ ];
example = literalExample ''[ "/etc/xdg" ]'';
description = ''
Directory names to add to <envar>XDG_CONFIG_DIRS</envar>
in the user session.
'';
};
data = mkOption {
type = types.listOf types.str;
default = [ ];
example = literalExample ''[ "/usr/share" "/usr/local/share" ]'';
description = ''
Directory names to add to <envar>XDG_DATA_DIRS</envar>
in the user session.
'';
};
};
config = mkMerge [
(mkIf (cfg.config != [ ]) {
home.sessionVariables.XDG_CONFIG_DIRS =
"${configDirs}\${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS}";
systemd.user.sessionVariables.XDG_CONFIG_DIRS =
"${configDirs}\${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS}";
})
(mkIf (cfg.data != [ ]) {
home.sessionVariables.XDG_DATA_DIRS =
"${dataDirs}\${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}";
systemd.user.sessionVariables.XDG_DATA_DIRS =
"${dataDirs}\${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}";
})
];
}

View File

@@ -6,8 +6,6 @@ let
cfg = config.xdg;
dag = config.lib.dag;
fileType = (import ../lib/file-type.nix {
inherit (config.home) homeDirectory;
inherit lib pkgs;

View File

@@ -40,6 +40,7 @@ let
(loadModule ./misc/tmpfiles.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/version.nix { })
(loadModule ./misc/vte.nix { })
(loadModule ./misc/xdg-system-dirs.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/xdg-mime.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/xdg-mime-apps.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/xdg-user-dirs.nix { condition = hostPlatform.isLinux; })
@@ -63,9 +64,11 @@ let
(loadModule ./programs/direnv.nix { })
(loadModule ./programs/eclipse.nix { })
(loadModule ./programs/emacs.nix { })
(loadModule ./programs/exa.nix { })
(loadModule ./programs/feh.nix { })
(loadModule ./programs/firefox.nix { })
(loadModule ./programs/fish.nix { })
(loadModule ./programs/foot.nix { condition = hostPlatform.isLinux; })
(loadModule ./programs/fzf.nix { })
(loadModule ./programs/getmail.nix { condition = hostPlatform.isLinux; })
(loadModule ./programs/gh.nix { })
@@ -80,10 +83,12 @@ let
(loadModule ./programs/info.nix { })
(loadModule ./programs/irssi.nix { })
(loadModule ./programs/lieer.nix { })
(loadModule ./programs/java.nix { })
(loadModule ./programs/jq.nix { })
(loadModule ./programs/kakoune.nix { })
(loadModule ./programs/keychain.nix { })
(loadModule ./programs/kitty.nix { })
(loadModule ./programs/lazygit.nix { })
(loadModule ./programs/lesspipe.nix { })
(loadModule ./programs/lf.nix { })
(loadModule ./programs/lsd.nix { })
@@ -96,10 +101,12 @@ let
(loadModule ./programs/msmtp.nix { })
(loadModule ./programs/mu.nix { })
(loadModule ./programs/ncmpcpp.nix { })
(loadModule ./programs/ncspot.nix { })
(loadModule ./programs/ne.nix { })
(loadModule ./programs/neomutt.nix { })
(loadModule ./programs/neovim.nix { })
(loadModule ./programs/newsboat.nix { })
(loadModule ./programs/nix-index.nix { })
(loadModule ./programs/noti.nix { })
(loadModule ./programs/notmuch.nix { })
(loadModule ./programs/nushell.nix { })
@@ -117,6 +124,7 @@ let
(loadModule ./programs/rofi.nix { })
(loadModule ./programs/rofi-pass.nix { })
(loadModule ./programs/rtorrent.nix { })
(loadModule ./programs/scmpuff.nix { })
(loadModule ./programs/skim.nix { })
(loadModule ./programs/starship.nix { })
(loadModule ./programs/sbt.nix { })
@@ -125,6 +133,7 @@ let
(loadModule ./programs/termite.nix { })
(loadModule ./programs/texlive.nix { })
(loadModule ./programs/tmux.nix { })
(loadModule ./programs/topgrade.nix { })
(loadModule ./programs/urxvt.nix { })
(loadModule ./programs/vim.nix { })
(loadModule ./programs/vscode.nix { })
@@ -136,6 +145,7 @@ let
(loadModule ./programs/zplug.nix { })
(loadModule ./programs/zsh.nix { })
(loadModule ./programs/zsh/prezto.nix { })
(loadModule ./services/barrier.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/blueman-applet.nix { })
(loadModule ./services/caffeine.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/cbatticon.nix { condition = hostPlatform.isLinux; })
@@ -145,6 +155,7 @@ let
(loadModule ./services/dunst.nix { })
(loadModule ./services/dwm-status.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/emacs.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/etesync-dav.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/flameshot.nix { })
(loadModule ./services/fluidsynth.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/redshift-gammastep/gammastep.nix { condition = hostPlatform.isLinux; })
@@ -166,11 +177,13 @@ let
(loadModule ./services/mbsync.nix { })
(loadModule ./services/mpd.nix { })
(loadModule ./services/mpdris2.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/mpris-proxy.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/muchsync.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/network-manager-applet.nix { })
(loadModule ./services/nextcloud-client.nix { })
(loadModule ./services/owncloud-client.nix { })
(loadModule ./services/parcellite.nix { })
(loadModule ./services/pass-secret-service.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/password-store-sync.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/pasystray.nix { })
(loadModule ./services/pbgopy.nix { condition = hostPlatform.isLinux; })
@@ -178,6 +191,7 @@ let
(loadModule ./services/plan9port.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/playerctld.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/polybar.nix { })
(loadModule ./services/poweralertd.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/pulseeffects.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/random-background.nix { })
(loadModule ./services/redshift-gammastep/redshift.nix { })

View File

@@ -6,9 +6,7 @@ let
cfg = config.programs.afew;
in
{
in {
options.programs.afew = {
enable = mkEnableOption "the afew initial tagging script for Notmuch";

View File

@@ -169,9 +169,7 @@ in
}
));
in mkIf cfg.enable {
home.file.".bash_profile".text = ''
# -*- mode: sh -*-
home.file.".bash_profile".source = pkgs.writeShellScript "bash_profile" ''
# include .profile if it exists
[[ -f ~/.profile ]] && . ~/.profile
@@ -179,9 +177,7 @@ in
[[ -f ~/.bashrc ]] && . ~/.bashrc
'';
home.file.".profile".text = ''
# -*- mode: sh -*-
home.file.".profile".source = pkgs.writeShellScript "profile" ''
. "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh"
${sessionVarsStr}
@@ -189,9 +185,7 @@ in
${cfg.profileExtra}
'';
home.file.".bashrc".text = ''
# -*- mode: sh -*-
home.file.".bashrc".source = pkgs.writeShellScript "bashrc" ''
${cfg.bashrcExtra}
# Commands that should be applied only for interactive shells.
@@ -207,11 +201,7 @@ in
'';
home.file.".bash_logout" = mkIf (cfg.logoutExtra != "") {
text = ''
# -*- mode: sh -*-
${cfg.logoutExtra}
'';
source = pkgs.writeShellScript "bash_logout" cfg.logoutExtra;
};
}
);

View File

@@ -114,10 +114,12 @@ let
brave = "BraveSoftware/Brave-Browser";
};
linuxDirs = { brave = "BraveSoftware/Brave-Browser"; };
configDir = if pkgs.stdenv.isDarwin then
"Library/Application Support/${getAttr browser darwinDirs}"
"Library/Application Support/" + (darwinDirs."${browser}" or browser)
else
"${config.xdg.configHome}/${browser}";
"${config.xdg.configHome}/" + (linuxDirs."${browser}" or browser);
extensionJson = ext:
assert ext.crxPath != null -> ext.version != null;

View File

@@ -9,6 +9,14 @@ let
tomlFormat = pkgs.formats.toml { };
in {
imports = [
(mkRenamedOptionModule [
"programs"
"direnv"
"enableNixDirenvIntegration"
] [ "programs" "direnv" "nix-direnv" "enable" ])
];
meta.maintainers = [ maintainers.rycee ];
options.programs.direnv = {
@@ -63,10 +71,14 @@ in {
'';
};
enableNixDirenvIntegration = mkEnableOption ''
<link
xlink:href="https://github.com/nix-community/nix-direnv">nix-direnv</link>,
a fast, persistent use_nix implementation for direnv'';
nix-direnv = {
enable = mkEnableOption ''
<link
xlink:href="https://github.com/nix-community/nix-direnv">nix-direnv</link>,
a fast, persistent use_nix implementation for direnv'';
enableFlakes = mkEnableOption "Flake support in nix-direnv";
};
};
config = mkIf cfg.enable {
@@ -77,9 +89,11 @@ in {
};
xdg.configFile."direnv/direnvrc" = let
package =
pkgs.nix-direnv.override { inherit (cfg.nix-direnv) enableFlakes; };
text = concatStringsSep "\n" (optional (cfg.stdlib != "") cfg.stdlib
++ optional cfg.enableNixDirenvIntegration
"source ${pkgs.nix-direnv}/share/nix-direnv/direnvrc");
++ optional cfg.nix-direnv.enable
"source ${package}/share/nix-direnv/direnvrc");
in mkIf (text != "") { inherit text; };
programs.bash.initExtra = mkIf cfg.enableBashIntegration (

36
modules/programs/exa.nix Normal file
View File

@@ -0,0 +1,36 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.exa;
aliases = {
ls = "${pkgs.exa}/bin/exa";
ll = "${pkgs.exa}/bin/exa -l";
la = "${pkgs.exa}/bin/exa -a";
lt = "${pkgs.exa}/bin/exa --tree";
lla = "${pkgs.exa}/bin/exa -la";
};
in {
meta.maintainers = [ maintainers.kalhauge ];
options.programs.exa = {
enable =
mkEnableOption "exa, a modern replacement for <command>ls</command>";
enableAliases = mkEnableOption "recommended exa aliases";
};
config = mkIf cfg.enable {
home.packages = [ pkgs.exa ];
programs.bash.shellAliases = mkIf cfg.enableAliases aliases;
programs.zsh.shellAliases = mkIf cfg.enableAliases aliases;
programs.fish.shellAliases = mkIf cfg.enableAliases aliases;
};
}

View File

@@ -86,6 +86,17 @@ in
then pkgs.firefox
else pkgs.firefox-unwrapped;
defaultText = literalExample "pkgs.firefox";
example = literalExample ''
pkgs.firefox.override {
# See nixpkgs' firefox/wrapper.nix to check which options you can use
cfg = {
# Gnome shell native connector
enableGnomeExtensions = true;
# Tridactyl native connector
enableTridactylNative = true;
};
}
'';
description = ''
The Firefox package to use. If state version  19.09 then
this should be a wrapped Firefox package. For earlier state
@@ -264,6 +275,13 @@ in
)
];
warnings = optional (cfg.enableGnomeExtensions or false) ''
Using 'programs.firefox.enableGnomeExtensions' has been deprecated and
will be removed in the future. Please change to overriding the package
configuration using 'programs.firefox.package' instead. You can refer to
its example for how to do this.
'';
home.packages =
let
# The configuration expected by the Firefox wrapper.
@@ -282,7 +300,7 @@ in
if isDarwin then
cfg.package
else if versionAtLeast config.home.stateVersion "19.09" then
cfg.package.override { cfg = fcfg; }
cfg.package.override (old: { cfg = old.cfg or {} // fcfg; })
else
(pkgs.wrapFirefox.override { config = bcfg; }) cfg.package { };
in
@@ -300,6 +318,8 @@ in
};
}]
++ flip mapAttrsToList cfg.profiles (_: profile: {
"${profilesPath}/${profile.path}/.keep".text = "";
"${profilesPath}/${profile.path}/chrome/userChrome.css" =
mkIf (profile.userChrome != "") {
text = profile.userChrome;

77
modules/programs/foot.nix Normal file
View File

@@ -0,0 +1,77 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.foot;
iniFormat = pkgs.formats.ini { };
in {
meta.maintainers = with lib.maintainers; [ plabadens ];
options.programs.foot = {
enable = mkEnableOption "Foot terminal";
package = mkOption {
type = types.package;
default = pkgs.foot;
defaultText = literalExample "pkgs.foot";
description = "The foot package to install";
};
server.enable = mkEnableOption "Foot terminal server";
settings = mkOption {
type = iniFormat.type;
default = { };
description = ''
Configuration written to
<filename>$XDG_CONFIG_HOME/foot/foot.ini</filename>. See <link
xlink:href="https://codeberg.org/dnkl/foot/src/branch/master/foot.ini"/>
for a list of available options.
'';
example = literalExample ''
{
main = {
term = "xterm-256color";
font = "Fira Code:size=11";
dpi-aware = "yes";
};
mouse = {
hide-when-typing = "yes";
};
}
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."foot/foot.ini" = mkIf (cfg.settings != { }) {
source = iniFormat.generate "foot.ini" cfg.settings;
};
systemd.user.services = mkIf cfg.server.enable {
foot = {
Unit = {
Description =
"Fast, lightweight and minimalistic Wayland terminal emulator.";
Documentation = "man:foot(1)";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${cfg.package}/bin/foot --server";
Restart = "on-failure";
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
};
}

View File

@@ -88,6 +88,23 @@ in {
'';
};
tmux = {
enableShellIntegration = mkEnableOption ''
setting <literal>FZF_TMUX=1</literal> which causes shell integration to use fzf-tmux
'';
shellIntegrationOptions = mkOption {
type = types.listOf types.str;
default = [ ];
example = literalExample ''[ "-d 40%" ]'';
description = ''
If <option>programs.fzf.tmux.enableShellIntegration</option> is set to <literal>true</literal>,
shell integration will use these options for fzf-tmux.
See <command>fzf-tmux --help</command> for available options.
'';
};
};
enableBashIntegration = mkOption {
default = true;
type = types.bool;
@@ -125,6 +142,8 @@ in {
FZF_CTRL_T_OPTS = cfg.fileWidgetOptions;
FZF_DEFAULT_COMMAND = cfg.defaultCommand;
FZF_DEFAULT_OPTS = cfg.defaultOptions;
FZF_TMUX = if cfg.tmux.enableShellIntegration then "1" else null;
FZF_TMUX_OPTS = cfg.tmux.shellIntegrationOptions;
});
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''

View File

@@ -315,7 +315,7 @@ in {
};
config = mkIf cfg.enable {
home.packages = [ pkgs.gnome3.gnome-terminal ];
home.packages = [ pkgs.gnome.gnome-terminal ];
dconf.settings = let dconfPath = "org/gnome/terminal/legacy";
in {

View File

@@ -15,12 +15,25 @@ let
listsAsDuplicateKeys = true;
} cfg.settings;
scdaemonCfgText = generators.toKeyValue {
inherit mkKeyValue;
listsAsDuplicateKeys = true;
} cfg.scdaemonSettings;
primitiveType = types.oneOf [ types.str types.bool ];
in
{
options.programs.gpg = {
enable = mkEnableOption "GnuPG";
package = mkOption {
type = types.package;
default = pkgs.gnupg;
defaultText = literalExample "pkgs.gnupg";
example = literalExample "pkgs.gnupg23";
description = "The Gnupg package to use (also used the gpg-agent service).";
};
settings = mkOption {
type = types.attrsOf (types.either primitiveType (types.listOf types.str));
example = literalExample ''
@@ -33,8 +46,33 @@ in
GnuPG configuration options. Available options are described
in the gpg manpage:
<link xlink:href="https://gnupg.org/documentation/manpage.html"/>.
</para>
<para>
Note that lists are converted to duplicate keys.
'';
};
scdaemonSettings = mkOption {
type = types.attrsOf (types.either primitiveType (types.listOf types.str));
example = literalExample ''
{
disable-ccid = true;
}
'';
description = ''
SCdaemon configuration options. Available options are described
in the gpg scdaemon manpage:
<link xlink:href="https://www.gnupg.org/documentation/manuals/gnupg/Scdaemon-Options.html"/>.
'';
};
homedir = mkOption {
type = types.path;
example = literalExample "\"\${config.xdg.dataHome}/gnupg\"";
default = "${config.home.homeDirectory}/.gnupg";
defaultText = literalExample "\"\${config.home.homeDirectory}/.gnupg\"";
description = "Directory to store keychains and configuration.";
};
};
config = mkIf cfg.enable {
@@ -59,8 +97,17 @@ in
use-agent = mkDefault true;
};
home.packages = [ pkgs.gnupg ];
programs.gpg.scdaemonSettings = {
# no defaults for scdaemon
};
home.file.".gnupg/gpg.conf".text = cfgText;
home.packages = [ cfg.package ];
home.sessionVariables = {
GNUPGHOME = cfg.homedir;
};
home.file."${cfg.homedir}/gpg.conf".text = cfgText;
home.file."${cfg.homedir}/scdaemon.conf".text = scdaemonCfgText;
};
}

View File

@@ -6,8 +6,6 @@ let
cfg = config.programs.home-manager;
dag = config.lib.dag;
in {
meta.maintainers = [ maintainers.rycee ];

View File

@@ -6,9 +6,20 @@ let
cfg = config.programs.htop;
list = xs: concatMapStrings (x: "${toString x} ") xs;
formatOption = n: v:
let v' = if isBool v then (if v then "1" else "0") else toString v;
in "${n}=${v'}";
bool = b: if b then "1" else "0";
formatMeters = side: meters:
let
warn' = warn "htop: meters should be passed as a list";
meters' = if isList meters then meters else warn' [ meters ];
in {
"${side}_meters" = concatMap (mapAttrsToList (x: _: x)) meters';
"${side}_meter_modes" = concatMap (mapAttrsToList (_: y: y)) meters';
};
leftMeters = formatMeters "left";
rightMeters = formatMeters "right";
fields = {
PID = 0;
@@ -66,13 +77,32 @@ let
M_PSSWP = 120;
};
modes = {
Bar = 1;
Text = 2;
Graph = 3;
LED = 4;
};
# Utilities for constructing meters
meter = mode: name: { ${name} = mode; };
bar = meter modes.Bar;
text = meter modes.Text;
graph = meter modes.Graph;
led = meter modes.LED;
blank = text "Blank";
# Mapping from names to defaults
meters = {
Clock = 2;
Date = 2;
DateTime = 2;
LoadAverage = 2;
Load = 2;
Memory = 1;
Swap = 1;
Zram = 2;
HugePages = 2;
Tasks = 2;
Uptime = 2;
Battery = 2;
@@ -80,6 +110,7 @@ let
AllCPUs = 1;
AllCPUs2 = 1;
AllCPUs4 = 1;
AllCPUs8 = 1;
LeftCPUs = 1;
RightCPUs = 1;
Right = 1;
@@ -88,6 +119,8 @@ let
RightCPUs2 = 1;
LeftCPUs4 = 1;
RightCPUs4 = 1;
LeftCPUs8 = 1;
RightCPUs8 = 1;
Blank = 2;
PressureStallCPUSome = 2;
PressureStallIOSome = 2;
@@ -105,6 +138,10 @@ let
"CPU(6)" = 1;
"CPU(7)" = 1;
"CPU(8)" = 1;
SELinux = 2;
Systemd = 2;
DiskIO = 2;
NetworkIO = 2;
};
singleMeterType = let
@@ -166,22 +203,102 @@ in {
options.programs.htop = {
enable = mkEnableOption "htop";
settings = mkOption {
type = types.attrs;
default = {
account_guest_in_cpu_meter = false;
color_scheme = 0;
cpu_count_from_zero = false;
delay = 15;
detailed_cpu_time = false;
enable_mouse = true;
fields = with fields; [
PID
USER
PRIORITY
NICE
M_SIZE
M_RESIDENT
M_SHARE
STATE
PERCENT_CPU
PERCENT_MEM
TIME
COMM
];
header_margin = true;
hide_kernel_threads = true;
hide_threads = false;
hide_userland_threads = false;
highlight_base_name = false;
highlight_megabytes = true;
highlight_threads = true;
shadow_other_users = false;
show_cpu_frequency = false;
show_cpu_usage = false;
show_program_path = true;
show_thread_names = false;
sort_direction = 1;
sort_key = fields.PERCENT_CPU;
tree_view = false;
update_process_names = false;
vim_mode = false;
} // (leftMeters [
(bar "AllCPUs2")
(bar "Memory")
(bar "Swap")
(text "Zram")
]) // (rightMeters [
(text "Tasks")
(text "LoadAverage")
(text "Uptime")
(text "Systemd")
]);
example = literalExample ''
{
color_scheme = 6;
cpu_count_from_one = 0;
delay = 15;
fields = with config.lib.htop.fields; [
PID
USER
PRIORITY
NICE
M_SIZE
M_RESIDENT
M_SHARE
STATE
PERCENT_CPU
PERCENT_MEM
TIME
COMM
];
highlight_base_name = 1;
highlight_megabytes = 1;
highlight_threads = 1;
} // (with config.lib.htop; leftMeters [
(bar "AllCPUs2")
(bar "Memory")
(bar "Swap")
(text "Zram")
]) // (with config.lib.htop; rightMeters [
(text "Tasks")
(text "LoadAverage")
(text "Uptime")
(text "Systemd")
]);
'';
description = ''
Configuration options to add to
<filename>~/.config/htop/htoprc</filename>.
This superseedes any other (deprecated) settings in this module.
'';
};
fields = mkOption {
type = types.listOf (types.enum (attrNames fields));
default = [
"PID"
"USER"
"PRIORITY"
"NICE"
"M_SIZE"
"M_RESIDENT"
"M_SHARE"
"STATE"
"PERCENT_CPU"
"PERCENT_MEM"
"TIME"
"COMM"
];
type = types.nullOr (types.listOf (types.enum (attrNames fields)));
default = null;
example = [
"PID"
"USER"
@@ -192,151 +309,247 @@ in {
"TIME"
"COMM"
];
description = "Active fields shown in the table.";
description = ''
Deprecated. Please use programs.htop.settings.fields instead.
Active fields shown in the table.
'';
};
sortKey = mkOption {
type = types.enum (attrNames fields);
default = "PERCENT_CPU";
type = types.nullOr (types.enum (attrNames fields));
default = null;
example = "TIME";
description = "Which field to use for sorting.";
description = ''
Deprecated. Please use programs.htop.settings.sort_key instead.
Which field to use for sorting.
'';
};
sortDescending = mkOption {
type = types.bool;
default = true;
description = "Whether to sort descending or not.";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.sort_direction instead.
Whether to sort descending or not.
'';
};
hideThreads = mkOption {
type = types.bool;
default = false;
description = "Hide threads.";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.hide_threads instead.
Hide threads.
'';
};
hideKernelThreads = mkOption {
type = types.bool;
default = true;
description = "Hide kernel threads.";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.hide_kernel_threads instead.
Hide kernel threads.
'';
};
hideUserlandThreads = mkOption {
type = types.bool;
default = false;
description = "Hide userland process threads.";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.hide_userland_threads instead.
Hide userland process threads.
'';
};
shadowOtherUsers = mkOption {
type = types.bool;
default = false;
description = "Shadow other users' processes.";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.shadow_other_users instead.
Shadow other users' processes.
'';
};
showThreadNames = mkOption {
type = types.bool;
default = false;
description = "Show custom thread names.";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.show_thread_names instead.
Show custom thread names.
'';
};
showProgramPath = mkOption {
type = types.bool;
default = true;
description = "Show program path.";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.show_program_path instead.
Show program path.
'';
};
highlightBaseName = mkOption {
type = types.bool;
default = false;
description = "Highlight program <quote>basename</quote>.";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.highlight_base_name instead.
Highlight program <quote>basename</quote>.
'';
};
highlightMegabytes = mkOption {
type = types.bool;
default = true;
description = "Highlight large numbers in memory counters.";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.highlight_megabytes instead.
Highlight large numbers in memory counters.
'';
};
highlightThreads = mkOption {
type = types.bool;
default = true;
description = "Display threads in a different color.";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.highlight_threads instead.
Display threads in a different color.
'';
};
treeView = mkOption {
type = types.bool;
default = false;
description = "Tree view.";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.tree_view instead.
Tree view.
'';
};
headerMargin = mkOption {
type = types.bool;
default = true;
description = "Leave a margin around header.";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.header_margin instead.
Leave a margin around header.
'';
};
detailedCpuTime = mkOption {
type = types.bool;
default = false;
description =
"Detailed CPU time (System/IO-Wait/Hard-IRQ/Soft-IRQ/Steal/Guest).";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.detailed_cpu_time instead.
Detailed CPU time (System/IO-Wait/Hard-IRQ/Soft-IRQ/Steal/Guest).
'';
};
cpuCountFromZero = mkOption {
type = types.bool;
default = false;
description = "Count CPUs from 0 instead of 1.";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.cpu_count_from_zero instead.
Count CPUs from 0 instead of 1.
'';
};
showCpuUsage = mkOption {
type = types.bool;
default = false;
description = "Show CPU usage frequency.";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.show_cpu_usage instead.
Show CPU usage frequency.
'';
};
showCpuFrequency = mkOption {
type = types.bool;
default = false;
description = "Show CPU frequency.";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.show_cpu_frequency instead.
Show CPU frequency.
'';
};
updateProcessNames = mkOption {
type = types.bool;
default = false;
description = "Update process names on every refresh.";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.update_process_names instead.
Update process names on every refresh.
'';
};
accountGuestInCpuMeter = mkOption {
type = types.bool;
default = false;
description = "Add guest time in CPU meter percentage.";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.account_guest_in_cpu_meter instead.
Add guest time in CPU meter percentage.
'';
};
colorScheme = mkOption {
type = types.enum [ 0 1 2 3 4 5 6 ];
default = 0;
type = types.nullOr (types.enum [ 0 1 2 3 4 5 6 ]);
default = null;
example = 6;
description = "Which color scheme to use.";
description = ''
Deprecated. Please use programs.htop.settings.color_scheme instead.
Which color scheme to use.
'';
};
enableMouse = mkOption {
type = types.bool;
default = true;
description = "Enable mouse support.";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.enable_mouse instead.
Enable mouse support.
'';
};
delay = mkOption {
type = types.int;
default = 15;
type = types.nullOr types.int;
default = null;
example = 2;
description = "Set the delay between updates, in tenths of seconds.";
description = ''
Deprecated. Please use programs.htop.settings.delay instead.
Set the delay between updates, in tenths of seconds.
'';
};
meters = mkOption {
description = "Meters shown in the header.";
default = {
left = [ "AllCPUs" "Memory" "Swap" ];
right = [ "Tasks" "LoadAverage" "Uptime" ];
};
description = ''
Deprecated. Please use programs.htop.settings.left_meters,
programs.htop.settings.left_meter_modes,
programs.htop.settings.right_meters and
programs.htop.settings.right_meter_modes instead. Or consider using
lib.htop.leftMeters and lib.htop.rightMeters.
Meters shown in the header.
'';
default = null;
example = {
left = [
"Memory"
@@ -362,55 +575,101 @@ in {
}
];
};
type = meterType;
type = types.nullOr meterType;
};
vimMode = mkOption {
type = types.bool;
default = false;
description = "Vim key bindings.";
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.vim_mode instead.
Vim key bindings.
'';
};
};
config = mkIf cfg.enable {
lib.htop = {
inherit fields modes leftMeters rightMeters bar text graph led blank;
};
home.packages = [ pkgs.htop ];
xdg.configFile."htop/htoprc".text = let
leftMeters = map (m: m.kind) cfg.meters.left;
leftModes = map (m: m.mode) cfg.meters.left;
rightMeters = map (m: m.kind) cfg.meters.right;
rightModes = map (m: m.mode) cfg.meters.right;
in ''
# This file is regenerated by home-manager
# when options are changed in the config
fields=${list (map (n: fields.${n}) cfg.fields)}
sort_key=${toString (fields.${cfg.sortKey})}
sort_direction=${bool cfg.sortDescending}
hide_threads=${bool cfg.hideThreads}
hide_kernel_threads=${bool cfg.hideKernelThreads}
hide_userland_threads=${bool cfg.hideUserlandThreads}
shadow_other_users=${bool cfg.shadowOtherUsers}
show_thread_names=${bool cfg.showThreadNames}
show_program_path=${bool cfg.showProgramPath}
highlight_base_name=${bool cfg.highlightBaseName}
highlight_megabytes=${bool cfg.highlightMegabytes}
highlight_threads=${bool cfg.highlightThreads}
tree_view=${bool cfg.treeView}
header_margin=${bool cfg.headerMargin}
detailed_cpu_time=${bool cfg.detailedCpuTime}
cpu_count_from_zero=${bool cfg.cpuCountFromZero}
show_cpu_usage=${bool cfg.showCpuUsage}
show_cpu_frequency=${bool cfg.showCpuFrequency}
update_process_names=${bool cfg.updateProcessNames}
account_guest_in_cpu_meter=${bool cfg.accountGuestInCpuMeter}
color_scheme=${toString cfg.colorScheme}
enable_mouse=${bool cfg.enableMouse}
delay=${toString cfg.delay}
left_meters=${list leftMeters}
left_meter_modes=${list leftModes}
right_meters=${list rightMeters}
right_meter_modes=${list rightModes}
vim_mode=${bool cfg.vimMode}
'';
deprecate = settingsKey: optionKey: optionValue:
let
warn' = warn
"htop: programs.htop.${optionKey} is deprecated; please is programs.htop.settings.${settingsKey} instead";
in if !isNull optionValue then
warn' optionValue
else if hasAttr settingsKey cfg.settings then
cfg.settings.${settingsKey}
else
null;
deprecate' = settingsKey: optionKey:
deprecate settingsKey optionKey cfg.${optionKey};
ifNonNull = x: y: if isNull x then null else y;
leftMeters = deprecate "left_meters" "meters.left"
(ifNonNull cfg.meters (map (m: m.kind) cfg.meters.left));
leftModes = deprecate "left_meter_modes" "meters.left"
(ifNonNull cfg.meters (map (m: m.mode) cfg.meters.left));
rightMeters = deprecate "right_meters" "meters.right"
(ifNonNull cfg.meters (map (m: m.kind) cfg.meters.right));
rightModes = deprecate "right_meter_modes" "meters.right"
(ifNonNull cfg.meters (map (m: m.mode) cfg.meters.right));
before = optionalAttrs (cfg.settings ? header_layout) {
inherit (cfg.settings) header_layout;
};
settings' = (removeAttrs cfg.settings (attrNames before))
// (filterAttrs (_: v: !isNull v) {
fields = deprecate "fields" "fields"
(ifNonNull cfg.fields (map (n: fields.${n}) cfg.fields));
sort_key = deprecate "sort_key" "sortKey"
(ifNonNull cfg.sortKey fields.${cfg.sortKey});
sort_direction = deprecate' "sort_direction" "sortDescending";
hide_threads = deprecate' "hide_threads" "hideThreads";
hide_kernel_threads =
deprecate' "hide_kernel_threads" "hideKernelThreads";
hide_userland_threads =
deprecate' "hide_userland_threads" "hideUserlandThreads";
shadow_other_users =
deprecate' "shadow_other_users" "shadowOtherUsers";
show_thread_names = deprecate' "show_thread_names" "showThreadNames";
show_program_path = deprecate' "show_program_path" "showProgramPath";
highlight_base_name =
deprecate' "highlight_base_name" "highlightBaseName";
highlight_megabytes =
deprecate' "highlight_megabytes" "highlightMegabytes";
highlight_threads = deprecate' "highlight_threads" "highlightThreads";
tree_view = deprecate' "tree_view" "treeView";
header_margin = deprecate' "header_margin" "headerMargin";
detailed_cpu_time = deprecate' "detailed_cpu_time" "detailedCpuTime";
cpu_count_from_zero =
deprecate' "cpu_count_from_zero" "cpuCountFromZero";
show_cpu_usage = deprecate' "show_cpu_usage" "showCpuUsage";
show_cpu_frequency =
deprecate' "show_cpu_frequency" "showCpuFrequency";
update_process_names =
deprecate' "update_process_names" "updateProcessNames";
account_guest_in_cpu_meter =
deprecate' "account_guest_in_cpu_meter" "accountGuestInCpuMeter";
color_scheme = deprecate' "color_scheme" "colorScheme";
enable_mouse = deprecate' "enable_mouse" "enableMouse";
delay = deprecate' "delay" "delay";
left_meters = leftMeters;
left_meter_modes = leftModes;
right_meters = rightMeters;
right_meter_modes = rightModes;
vim_mode = deprecate' "vim_mode" "vimMode";
});
in concatStringsSep "\n" (mapAttrsToList formatOption before
++ mapAttrsToList formatOption settings');
};
}

View File

@@ -85,7 +85,7 @@ in {
on_click = "pavucontrol --tab=3";
mappings = {
"alsa_output.pci-0000_00_1f.3.analog-stereo" = "";
"bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = ""
"bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = "";
};
}
];

46
modules/programs/java.nix Normal file
View File

@@ -0,0 +1,46 @@
# This module provides JAVA_HOME, with a different way to install java locally.
# This module is modified from the NixOS module `programs.java`
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.java;
in {
meta.maintainers = with maintainers; [ ShamrockLee ];
options = {
programs.java = {
enable = mkEnableOption "" // {
description = ''
Install the Java development kit and set the <envar>JAVA_HOME</envar>
variable.
'';
};
package = mkOption {
type = types.package;
default = pkgs.jdk;
defaultText = "pkgs.jdk";
description = ''
Java package to install. Typical values are
<literal>pkgs.jdk</literal> or <literal>pkgs.jre</literal>.
'';
};
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
home.sessionVariables = {
JAVA_HOME = fileContents (pkgs.runCommandLocal "java-home" { } ''
source "${cfg.package}/nix-support/setup-hook"
echo "$JAVA_HOME" > $out
'');
};
};
}

View File

@@ -30,6 +30,13 @@ in {
programs.jq = {
enable = mkEnableOption "the jq command-line JSON processor";
package = mkOption {
type = types.package;
default = pkgs.jq;
defaultText = literalExample "pkgs.jq";
description = "jq package to use.";
};
colors = mkOption {
description = ''
The colors used in colored JSON output.</para>
@@ -65,7 +72,7 @@ in {
};
config = mkIf cfg.enable {
home.packages = [ pkgs.jq ];
home.packages = [ cfg.package ];
home.sessionVariables = let c = cfg.colors;
in {

View File

@@ -0,0 +1,56 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.lazygit;
yamlFormat = pkgs.formats.yaml { };
inherit (pkgs.stdenv.hostPlatform) isDarwin;
in {
meta.maintainers = [ maintainers.kalhauge ];
options.programs.lazygit = {
enable = mkEnableOption "lazygit, a simple terminal UI for git commands";
settings = mkOption {
type = yamlFormat.type;
default = { };
defaultText = literalExample "{ }";
example = literalExample ''
{
gui.theme = {
lightTheme = true;
activeBorderColor = [ "blue" "bold" ];
inactiveBorderColor = [ "black" ];
selectedLineBgColor = [ "default" ];
};
}
'';
description = ''
Configuration written to
<filename>~/.config/lazygit/config.yml</filename> on Linux
or <filename>~/Library/Application Support/lazygit/config.yml</filename> on Darwin. See
<link xlink:href="https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md"/>
for supported values.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.lazygit ];
home.file."Library/Application Support/lazygit/config.yml" =
mkIf (cfg.settings != { } && isDarwin) {
source = yamlFormat.generate "lazygit-config" cfg.settings;
};
xdg.configFile."lazygit/config.yml" =
mkIf (cfg.settings != { } && !isDarwin) {
source = yamlFormat.generate "lazygit-config" cfg.settings;
};
};
}

View File

@@ -50,13 +50,13 @@ let
'';
};
masterPattern = mkOption {
farPattern = mkOption {
type = types.str;
default = "";
example = "[Gmail]/Sent Mail";
description = ''
IMAP4 patterns for which mailboxes on the remote mail server to sync.
If <literal>Patterns</literal> are specified, <literal>masterPattern</literal>
If <literal>Patterns</literal> are specified, <literal>farPattern</literal>
is interpreted as a prefix which is not matched against the patterns,
and is not affected by mailbox list overrides.
</para><para>
@@ -65,14 +65,14 @@ let
'';
};
slavePattern = mkOption {
nearPattern = mkOption {
type = types.str;
default = "";
example = "Sent";
description = ''
Name for where mail coming from the master mail server will end up
locally. The mailbox specified by the master's pattern will be placed
in this directory.
Name for where mail coming from the remote (far) mail server will end up
locally. The mailbox specified by the far pattern will be placed in
this directory.
</para><para>
If this is left as the default, then mbsync will default to the pattern
<literal>INBOX</literal>.
@@ -85,7 +85,7 @@ let
example = [ "INBOX" ];
description = ''
Instead of synchronizing <emphasis>just</emphasis> the mailboxes that
match the <literal>masterPattern</literal>, use it as a prefix which is
match the <literal>farPattern</literal>, use it as a prefix which is
not matched against the patterns, and is not affected by mailbox list
overrides.
'';

View File

@@ -10,6 +10,24 @@ let
mbsyncAccounts =
filter (a: a.mbsync.enable) (attrValues config.accounts.email.accounts);
# Given a SINGLE group's channels attribute set, return true if ANY of the channel's
# patterns use the invalidOption attribute set value name.
channelInvalidOption = channels: invalidOption:
any (c: c) (mapAttrsToList (c: hasAttr invalidOption) channels);
# Given a SINGLE account's groups attribute set, return true if ANY of the account's group's channel's patterns use the invalidOption attribute set value name.
groupInvalidOption = groups: invalidOption:
any (g: g) (mapAttrsToList (groupName: groupVals:
channelInvalidOption groupVals.channels invalidOption) groups);
# Given all accounts (ensure that accounts passed in here ARE mbsync-using accounts)
# return true if ANY of the account's groups' channels' patterns use the
# invalidOption attribute set value name.
accountInvalidOption = accounts: invalidOption:
any (a: a)
(map (account: groupInvalidOption account.mbsync.groups invalidOption)
mbsyncAccounts);
genTlsConfig = tls:
{
SSLType = if !tls.enable then
@@ -22,10 +40,18 @@ let
CertificateFile = toString tls.certificatesFile;
};
masterSlaveMapping = {
imports = [
(mkRenamedOptionModule [ "programs" "mbsync" "masterSlaveMapping" ] [
"programs"
"mbsync"
"nearFarMapping"
])
];
nearFarMapping = {
none = "None";
imap = "Master";
maildir = "Slave";
imap = "Far";
maildir = "Near";
both = "Both";
};
@@ -88,18 +114,18 @@ let
genAccountWideChannel = account:
with account;
genSection "Channel ${name}" ({
Master = ":${name}-remote:";
Slave = ":${name}-local:";
Far = ":${name}-remote:";
Near = ":${name}-local:";
Patterns = mbsync.patterns;
Create = masterSlaveMapping.${mbsync.create};
Remove = masterSlaveMapping.${mbsync.remove};
Expunge = masterSlaveMapping.${mbsync.expunge};
Create = nearFarMapping.${mbsync.create};
Remove = nearFarMapping.${mbsync.remove};
Expunge = nearFarMapping.${mbsync.expunge};
SyncState = "*";
} // mbsync.extraConfig.channel) + "\n";
# Given the attr set of groups, return a string of channels that will direct
# mail to the proper directories, according to the pattern used in channel's
# master pattern definition.
# "far" pattern definition.
genGroupChannelConfig = storeName: groups:
let
# Given the name of the group this channel is part of and the channel
@@ -118,8 +144,8 @@ let
else
"";
in genSection "Channel ${groupName}-${channel.name}" ({
Master = ":${storeName}-remote:${channel.masterPattern}";
Slave = ":${storeName}-local:${channel.slavePattern}";
Far = ":${storeName}-remote:${channel.farPattern}";
Near = ":${storeName}-local:${channel.nearPattern}";
} // channel.extraConfig) + genChannelPatterns channel.patterns;
# Given the group name, and a attr set of channels within that group,
# Generate a list of strings for each channels' configuration.
@@ -206,50 +232,66 @@ in {
};
};
config = mkIf cfg.enable {
assertions = let
checkAccounts = pred: msg:
let badAccounts = filter pred mbsyncAccounts;
in {
assertion = badAccounts == [ ];
message = "mbsync: ${msg} for accounts: "
+ concatMapStringsSep ", " (a: a.name) badAccounts;
};
in [
(checkAccounts (a: a.maildir == null) "Missing maildir configuration")
(checkAccounts (a: a.imap == null) "Missing IMAP configuration")
(checkAccounts (a: a.passwordCommand == null) "Missing passwordCommand")
(checkAccounts (a: a.userName == null) "Missing username")
];
config = mkIf cfg.enable (mkMerge [
{
assertions = let
checkAccounts = pred: msg:
let badAccounts = filter pred mbsyncAccounts;
in {
assertion = badAccounts == [ ];
message = "mbsync: ${msg} for accounts: "
+ concatMapStringsSep ", " (a: a.name) badAccounts;
};
in [
(checkAccounts (a: a.maildir == null) "Missing maildir configuration")
(checkAccounts (a: a.imap == null) "Missing IMAP configuration")
(checkAccounts (a: a.passwordCommand == null) "Missing passwordCommand")
(checkAccounts (a: a.userName == null) "Missing username")
];
}
home.packages = [ cfg.package ];
(mkIf (accountInvalidOption mbsyncAccounts "masterPattern") {
warnings = [
"mbsync channels no longer use masterPattern. Use farPattern in its place."
];
})
programs.notmuch.new.ignore = [ ".uidvalidity" ".mbsyncstate" ];
(mkIf (accountInvalidOption mbsyncAccounts "slavePattern") {
warnings = [
"mbsync channels no longer use slavePattern. Use nearPattern in its place."
];
})
home.file.".mbsyncrc".text = let
accountsConfig = map genAccountConfig mbsyncAccounts;
# Only generate this kind of Group configuration if there are ANY accounts
# that do NOT have a per-account groups/channels option(s) specified.
groupsConfig =
if any (account: account.mbsync.groups == { }) mbsyncAccounts then
mapAttrsToList genGroupConfig cfg.groups
else
[ ];
in ''
# Generated by Home Manager.
{
home.packages = [ cfg.package ];
''
+ concatStringsSep "\n" (optional (cfg.extraConfig != "") cfg.extraConfig)
+ concatStringsSep "\n\n" accountsConfig
+ concatStringsSep "\n" groupsConfig;
programs.notmuch.new.ignore = [ ".uidvalidity" ".mbsyncstate" ];
home.activation = mkIf (mbsyncAccounts != [ ]) {
createMaildir =
hm.dag.entryBetween [ "linkGeneration" ] [ "writeBoundary" ] ''
$DRY_RUN_CMD mkdir -m700 -p $VERBOSE_ARG ${
concatMapStringsSep " " (a: a.maildir.absPath) mbsyncAccounts
}
'';
};
};
home.file.".mbsyncrc".text = let
accountsConfig = map genAccountConfig mbsyncAccounts;
# Only generate this kind of Group configuration if there are ANY accounts
# that do NOT have a per-account groups/channels option(s) specified.
groupsConfig =
if any (account: account.mbsync.groups == { }) mbsyncAccounts then
mapAttrsToList genGroupConfig cfg.groups
else
[ ];
in ''
# Generated by Home Manager.
''
+ concatStringsSep "\n" (optional (cfg.extraConfig != "") cfg.extraConfig)
+ concatStringsSep "\n\n" accountsConfig
+ concatStringsSep "\n" groupsConfig;
home.activation = mkIf (mbsyncAccounts != [ ]) {
createMaildir =
hm.dag.entryBetween [ "linkGeneration" ] [ "writeBoundary" ] ''
$DRY_RUN_CMD mkdir -m700 -p $VERBOSE_ARG ${
concatMapStringsSep " " (a: a.maildir.absPath) mbsyncAccounts
}
'';
};
}
]);
}

View File

@@ -37,6 +37,8 @@ let
${cfg.extraConfig}
${concatStringsSep "\n\n" (map accountStr mailAccounts)}
${cfg.extraAccounts}
'';
in {
@@ -51,6 +53,20 @@ in {
description = ''
Extra configuration lines to add to <filename>~/.msmtprc</filename>.
See <link xlink:href="https://marlam.de/msmtp/msmtprc.txt"/> for examples.
</para><para>
Note, if running msmtp fails with the error message "account default
was already defined" then you probably have an account command here.
Account commands should be placed in
<xref linkend="opt-accounts.email.accounts._name_.msmtp.extraConfig"/>.
'';
};
extraAccounts = mkOption {
type = types.lines;
default = "";
description = ''
Extra configuration lines to add to the end of <filename>~/.msmtprc</filename>.
See <link xlink:href="https://marlam.de/msmtp/msmtprc.txt"/> for examples.
'';
};
};

View File

@@ -0,0 +1,50 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.ncspot;
tomlFormat = pkgs.formats.toml { };
in {
meta.maintainers = [ maintainers.marsam ];
options.programs.ncspot = {
enable = mkEnableOption "ncspot";
package = mkOption {
type = types.package;
default = pkgs.ncspot;
defaultText = literalExample "pkgs.ncspot";
description = "The package to use for ncspot.";
};
settings = mkOption {
type = tomlFormat.type;
default = { };
example = literalExample ''
{
shuffle = true;
gapless = true;
}
'';
description = ''
Configuration written to
<filename>~/.config/ncspot/config.toml</filename>.
</para><para>
See <link xlink:href="https://github.com/hrkfdn/ncspot#configuration" />
for the full list of options.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."ncspot/config.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "ncspot-config" cfg.settings;
};
};
}

View File

@@ -124,9 +124,10 @@ let
genMaildirAccountConfig = account:
with account;
let
folderHook = mapAttrsToList setOption (genCommonFolderHooks account // {
folder = "'${account.maildir.absPath}'";
});
folderHook = mapAttrsToList setOption (genCommonFolderHooks account
// optionalAttrs cfg.changeFolderWhenSourcingAccount {
folder = "'${account.maildir.absPath}'";
});
in ''
${concatStringsSep "\n" folderHook}
'';
@@ -189,6 +190,7 @@ let
# GPG section
set crypt_use_gpgme = yes
set crypt_autosign = ${yesno (gpg.signByDefault or false)}
set crypt_opportunistic_encrypt = ${yesno (gpg.encryptByDefault or false)}
set pgp_use_gpg_agent = yes
set mbox_type = ${if maildir != null then "Maildir" else "mbox"}
set sort = "${cfg.sort}"
@@ -265,6 +267,11 @@ in {
description = "Extra configuration appended to the end.";
};
changeFolderWhenSourcingAccount =
mkEnableOption "changing the folder when sourcing an account" // {
default = true;
};
extraConfig = mkOption {
type = types.lines;
default = "";
@@ -311,16 +318,16 @@ in {
${optionalString cfg.vimKeys
"source ${pkgs.neomutt}/share/doc/neomutt/vim-keys/vim-keys.rc"}
# Extra configuration
${optionsStr cfg.settings}
${cfg.extraConfig}
# Register accounts
${concatMapStringsSep "\n" registerAccount neomuttAccounts}
# Source primary account
source ${accountFilename primary}
# Extra configuration
${optionsStr cfg.settings}
${cfg.extraConfig}
'';
};

View File

@@ -6,14 +6,6 @@ let
cfg = config.programs.neovim;
extraPythonPackageType = mkOptionType {
name = "extra-python-packages";
description = "python packages in python.withPackages format";
check = with types;
(x: if isFunction x then isList (x pkgs.pythonPackages) else false);
merge = mergeOneOption;
};
extraPython3PackageType = mkOptionType {
name = "extra-python3-packages";
description = "python3 packages in python.withPackages format";
@@ -67,6 +59,13 @@ let
''--suffix PATH : "${lib.makeBinPath cfg.extraPackages}"'';
in {
imports = [
(mkRemovedOptionModule [ "programs" "neovim" "withPython" ]
"Python2 support has been removed from neovim.")
(mkRemovedOptionModule [ "programs" "neovim" "extraPythonPackages" ]
"Python2 support has been removed from neovim.")
];
options = {
programs.neovim = {
enable = mkEnableOption "Neovim";
@@ -104,26 +103,6 @@ in {
'';
};
withPython = mkOption {
type = types.bool;
default = true;
description = ''
Enable Python 2 provider. Set to <literal>true</literal> to
use Python 2 plugins.
'';
};
extraPythonPackages = mkOption {
type = with types; either extraPythonPackageType (listOf package);
default = (_: [ ]);
defaultText = "ps: []";
example = literalExample "(ps: with ps; [ pandas jedi ])";
description = ''
A function in python.withPackages format, which returns a
list of Python 2 packages required for your plugins to work.
'';
};
withRuby = mkOption {
type = types.nullOr types.bool;
default = true;
@@ -245,10 +224,10 @@ in {
config = let
neovimConfig = pkgs.neovimUtils.makeNeovimConfig {
inherit (cfg)
extraPython3Packages withPython3 extraPythonPackages withPython
withNodeJs withRuby viAlias vimAlias;
extraPython3Packages withPython3 withNodeJs withRuby viAlias vimAlias;
configure = cfg.configure // moduleConfigure;
plugins = cfg.plugins;
customRC = cfg.extraConfig;
};
in mkIf cfg.enable {

View File

@@ -6,7 +6,35 @@ let
cfg = config.programs.newsboat;
wrapQuote = x: ''"${x}"'';
urlsFileContents = let
mkUrlEntry = u:
concatStringsSep " " ([ u.url ] ++ map wrapQuote u.tags
++ optional (u.title != null) (wrapQuote "~${u.title}"));
urls = map mkUrlEntry cfg.urls;
mkQueryEntry = n: v: ''"query:${n}:${escape [ ''"'' ] v}"'';
queries = mapAttrsToList mkQueryEntry cfg.queries;
in concatStringsSep "\n"
(if versionAtLeast config.home.stateVersion "20.03" then
queries ++ urls
else
urls ++ queries) + "\n";
configFileContents = ''
max-items ${toString cfg.maxItems}
browser ${cfg.browser}
reload-threads ${toString cfg.reloadThreads}
auto-reload ${if cfg.autoReload then "yes" else "no"}
${optionalString (cfg.reloadTime != null)
(toString "reload-time ${toString cfg.reloadTime}")}
prepopulate-query-feeds yes
${cfg.extraConfig}
'';
in {
meta.maintainers = [ maintainers.sumnerevans ];
options = {
programs.newsboat = {
enable = mkEnableOption "the Newsboat feed reader";
@@ -94,30 +122,16 @@ in {
config = mkIf cfg.enable {
home.packages = [ pkgs.newsboat ];
home.file.".newsboat/urls".text = let
mkUrlEntry = u:
concatStringsSep " " ([ u.url ] ++ map wrapQuote u.tags
++ optional (u.title != null) (wrapQuote "~${u.title}"));
urls = map mkUrlEntry cfg.urls;
mkQueryEntry = n: v: ''"query:${n}:${escape [ ''"'' ] v}"'';
queries = mapAttrsToList mkQueryEntry cfg.queries;
in concatStringsSep "\n"
(if versionAtLeast config.home.stateVersion "20.03" then
queries ++ urls
else
urls ++ queries) + "\n";
home.file.".newsboat/config".text = ''
max-items ${toString cfg.maxItems}
browser ${cfg.browser}
reload-threads ${toString cfg.reloadThreads}
auto-reload ${if cfg.autoReload then "yes" else "no"}
${optionalString (cfg.reloadTime != null)
(toString "reload-time ${toString cfg.reloadTime}")}
prepopulate-query-feeds yes
${cfg.extraConfig}
'';
# Use ~/.newsboat on stateVersion < 21.05 and use ~/.config/newsboat for
# stateVersion >= 21.05.
home.file = mkIf (versionOlder config.home.stateVersion "21.05") {
".newsboat/urls".text = urlsFileContents;
".newsboat/config".text = configFileContents;
};
xdg.configFile = mkIf (versionAtLeast config.home.stateVersion "21.05") {
"newsboat/urls".text = urlsFileContents;
"newsboat/config".text = configFileContents;
};
};
}

View File

@@ -0,0 +1,63 @@
{ config, lib, pkgs, ... }:
let cfg = config.programs.nix-index;
in {
meta.maintainers = with lib.hm.maintainers; [ ambroisie ];
options.programs.nix-index = with lib; {
enable = mkEnableOption "nix-index, a file database for nixpkgs";
package = mkOption {
type = types.package;
default = pkgs.nix-index;
defaultText = literalExample "pkgs.nix-index";
description = "Package providing the <command>nix-index</command> tool.";
};
enableBashIntegration = mkEnableOption "Bash integration" // {
default = true;
};
enableZshIntegration = mkEnableOption "Zsh integration" // {
default = true;
};
enableFishIntegration = mkEnableOption "Fish integration" // {
default = true;
};
};
config = lib.mkIf cfg.enable {
assertions = let
checkOpt = name: {
assertion = cfg.${name} -> !config.programs.command-not-found.enable;
message = ''
The 'programs.command-not-found.enable' option is mutually exclusive
with the 'programs.nix-index.${name}' option.
'';
};
in [ (checkOpt "enableBashIntegration") (checkOpt "enableZshIntegration") ];
home.packages = [ cfg.package ];
programs.bash.initExtra = lib.mkIf cfg.enableBashIntegration ''
source ${cfg.package}/etc/profile.d/command-not-found.sh
'';
programs.zsh.initExtra = lib.mkIf cfg.enableZshIntegration ''
source ${cfg.package}/etc/profile.d/command-not-found.sh
'';
# See https://github.com/bennofs/nix-index/issues/126
programs.fish.shellInit = let
wrapper = pkgs.writeScript "command-not-found" ''
#!${pkgs.bash}/bin/bash
source ${cfg.package}/etc/profile.d/command-not-found.sh
command_not_found_handle "$@"
'';
in lib.mkIf cfg.enableFishIntegration ''
function __fish_command_not_found_handler --on-event fish_command_not_found
${wrapper} $argv
end
'';
};
}

View File

@@ -36,6 +36,15 @@ let
Example output of the command.
'';
};
tag = mkOption {
type = types.listOf types.str;
default = [ ];
example = literalExample ''["git" "nixpkgs"]'';
description = ''
List of tags attached to the command.
'';
};
};
};

View File

@@ -260,16 +260,13 @@ in {
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."qutebrowser/config.py".text = concatStringsSep "\n" ([ ]
++ [
"${if cfg.loadAutoconfig then
"config.load_autoconfig()"
else
"config.load_autoconfig(False)"}"
] ++ mapAttrsToList (formatLine "c.") cfg.settings
config = let
qutebrowserConfig = concatStringsSep "\n" ([
(if cfg.loadAutoconfig then
"config.load_autoconfig()"
else
"config.load_autoconfig(False)")
] ++ mapAttrsToList (formatLine "c.") cfg.settings
++ mapAttrsToList (formatDictLine "c.aliases") cfg.aliases
++ mapAttrsToList (formatDictLine "c.url.searchengines") cfg.searchEngines
++ mapAttrsToList (formatDictLine "c.bindings.key_mappings")
@@ -277,5 +274,13 @@ in {
++ optional (!cfg.enableDefaultBindings) "c.bindings.default = {}"
++ mapAttrsToList formatKeyBindings cfg.keyBindings
++ optional (cfg.extraConfig != "") cfg.extraConfig);
in mkIf cfg.enable {
home.packages = [ cfg.package ];
home.file.".qutebrowser/config.py" =
mkIf pkgs.stdenv.hostPlatform.isDarwin { text = qutebrowserConfig; };
xdg.configFile."qutebrowser/config.py" =
mkIf pkgs.stdenv.hostPlatform.isLinux { text = qutebrowserConfig; };
};
}

View File

@@ -261,7 +261,7 @@ in {
description = ''
Path to the terminal which will be used to run console applications
'';
example = "\${pkgs.gnome3.gnome_terminal}/bin/gnome-terminal";
example = "\${pkgs.gnome.gnome_terminal}/bin/gnome-terminal";
};
separator = mkOption {

View File

@@ -0,0 +1,47 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.programs.scmpuff;
in {
meta.maintainers = [ maintainers.cpcloud ];
options.programs.scmpuff = {
enable = mkEnableOption ''
scmpuff, a command line tool that allows you to work quicker with Git by
substituting numeric shortcuts for files'';
package = mkOption {
type = types.package;
default = pkgs.scmpuff;
defaultText = literalExample "pkgs.scmpuff";
description = "Package providing the <command>scmpuff</command> tool.";
};
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 = [ cfg.package ];
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
eval "$(${cfg.package}/bin/scmpuff init -s)"
'';
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
eval "$(${cfg.package}/bin/scmpuff init -s)"
'';
};
}

View File

@@ -26,7 +26,8 @@ let
};
port = mkOption {
type = types.port;
type = types.nullOr types.port;
default = null;
example = 8080;
description = "Specifies port number to bind on bind address.";
};
@@ -42,13 +43,15 @@ let
host = {
address = mkOption {
type = types.str;
type = types.nullOr types.str;
default = null;
example = "example.org";
description = "The address where to forward the traffic to.";
};
port = mkOption {
type = types.port;
type = types.nullOr types.port;
default = null;
example = 80;
description = "Specifies port number to forward the traffic to.";
};
@@ -450,7 +453,7 @@ in
any' = pred: items: if items == [] then true else any pred items;
# Check that if `entry.address` is defined, and is a path, that `entry.port` has not
# been defined.
noPathWithPort = entry: entry ? address && isPath entry.address -> !(entry ? port);
noPathWithPort = entry: entry.address != null && isPath entry.address -> entry.port == null;
checkDynamic = block: any' noPathWithPort block.dynamicForwards;
checkBindAndHost = fwd: noPathWithPort fwd.bind && noPathWithPort fwd.host;
checkLocal = block: any' checkBindAndHost block.localForwards;

View File

@@ -98,8 +98,6 @@ in {
config = mkIf cfg.enable {
home.packages = [ pkgs.taskwarrior ];
home.file."${cfg.dataLocation}/.keep".text = "";
home.file.".taskrc".text = ''
data.location=${cfg.dataLocation}
${includeTheme cfg.colorTheme}

View File

@@ -6,13 +6,6 @@ let
cfg = config.programs.termite;
vteInitStr = ''
# See https://github.com/thestinger/termite#id1
if [[ $TERM == xterm-termite ]]; then
. ${pkgs.termite.vte-ng}/etc/profile.d/vte.sh
fi
'';
in {
options = {
programs.termite = {
@@ -50,6 +43,10 @@ in {
'';
};
enableVteIntegration = mkEnableOption "Shell VTE integration" // {
default = true;
};
fullscreen = mkOption {
default = null;
type = types.nullOr types.bool;
@@ -381,7 +378,7 @@ in {
${cfg.hintsExtra}
'';
programs.bash.initExtra = vteInitStr;
programs.zsh.initExtra = vteInitStr;
programs.bash.enableVteIntegration = lib.mkDefault cfg.enableVteIntegration;
programs.zsh.enableVteIntegration = lib.mkDefault cfg.enableVteIntegration;
});
}

View File

@@ -6,14 +6,21 @@ let
cfg = config.programs.texlive;
texlivePkgs = cfg.extraPackages pkgs.texlive;
texlive = cfg.packageSet;
texlivePkgs = cfg.extraPackages texlive;
in {
meta.maintainers = [ maintainers.rycee ];
options = {
programs.texlive = {
enable = mkEnableOption "Texlive";
enable = mkEnableOption "TeX Live";
packageSet = mkOption {
default = pkgs.texlive;
defaultText = literalExample "pkgs.texlive";
description = "TeX Live package set to use.";
};
extraPackages = mkOption {
default = tpkgs: { inherit (tpkgs) collection-basic; };
@@ -21,12 +28,12 @@ in {
example = literalExample ''
tpkgs: { inherit (tpkgs) collection-fontsrecommended algorithms; }
'';
description = "Extra packages available to Texlive.";
description = "Extra packages available to TeX Live.";
};
package = mkOption {
type = types.package;
description = "Resulting customized Texlive package.";
description = "Resulting customized TeX Live package.";
readOnly = true;
};
};
@@ -41,6 +48,6 @@ in {
home.packages = [ cfg.package ];
programs.texlive.package = pkgs.texlive.combine texlivePkgs;
programs.texlive.package = texlive.combine texlivePkgs;
};
}

View File

@@ -109,7 +109,7 @@ let
}
)];
home.file.".tmux.conf".text = ''
xdg.configFile."tmux/tmux.conf".text = ''
# ============================================= #
# Load plugins with Home Manager #
# --------------------------------------------- #
@@ -335,10 +335,9 @@ in
};
})
# config file ~/.tmux.conf
{ home.file.".tmux.conf".text = mkBefore tmuxConf; }
{ xdg.configFile."tmux/tmux.conf".text = mkBefore tmuxConf; }
(mkIf (cfg.plugins != []) configPlugins)
{ home.file.".tmux.conf".text = mkAfter cfg.extraConfig; }
{ xdg.configFile."tmux/tmux.conf".text = mkAfter cfg.extraConfig; }
])
);
}

View File

@@ -0,0 +1,60 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.topgrade;
tomlFormat = pkgs.formats.toml { };
in {
meta.maintainers = [ hm.maintainers.msfjarvis ];
options.programs.topgrade = {
enable = mkEnableOption "topgrade";
package = mkOption {
type = types.package;
default = pkgs.topgrade;
defaultText = literalExample "pkgs.topgrade";
description = "The package to use for the topgrade binary.";
};
settings = mkOption {
type = tomlFormat.type;
default = { };
defaultText = literalExample "{ }";
example = literalExample ''
{
assume_yes = true;
disable = [
"flutter"
"node"
];
set_title = false;
cleanup = true;
commands = {
"Run garbage collection on Nix store" = "nix-collect-garbage";
};
}
'';
description = ''
Configuration written to
<filename>~/.config/topgrade.toml</filename>.
</para><para>
See <link xlink:href="https://github.com/r-darwish/topgrade/wiki/Step-list" /> for the full list
of options.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."topgrade.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "topgrade-config" cfg.settings;
};
};
}

View File

@@ -370,14 +370,13 @@ in {
"Highly customizable Wayland bar for Sway and Wlroots based compositors.";
Documentation = "https://github.com/Alexays/Waybar/wiki";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service = {
Type = "dbus";
BusName = "fr.arouillard.waybar";
ExecStart = "${cfg.package}/bin/waybar";
Restart = "always";
RestartSec = "1sec";
ExecReload = "kill -SIGUSR2 $MAINPID";
Restart = "on-failure";
KillMode = "mixed";
};

View File

@@ -56,10 +56,24 @@ let
default = if versionAtLeast stateVersion "20.03"
then "$HOME/.zsh_history"
else relToDotDir ".zsh_history";
defaultText = literalExample ''
"$HOME/.zsh_history" if state version 20.03,
"$ZDOTDIR/.zsh_history" otherwise
'';
example = literalExample ''"''${config.xdg.dataHome}/zsh/zsh_history"'';
description = "History file location";
};
ignorePatterns = mkOption {
type = types.listOf types.str;
default = [];
example = literalExample ''[ "rm *" "pkill *" ]'';
description = ''
Do not enter command lines into the history list
if they match any one of the given shell patterns.
'';
};
ignoreDups = mkOption {
type = types.bool;
default = true;
@@ -265,6 +279,12 @@ in
type = types.bool;
};
completionInit = mkOption {
default = "autoload -U compinit && compinit";
description = "Initialization commands to run when completion is enabled.";
type = types.lines;
};
enableAutosuggestions = mkOption {
default = false;
description = "Enable zsh autosuggestions";
@@ -455,7 +475,7 @@ in
# calling it twice causes slight start up slowdown
# as all $fpath entries will be traversed again.
${optionalString (cfg.enableCompletion && !cfg.oh-my-zsh.enable && !cfg.prezto.enable)
"autoload -U compinit && compinit"
cfg.completionInit
}
${optionalString cfg.enableAutosuggestions
@@ -486,7 +506,7 @@ in
(builtins.readFile "${pkgs.zsh-prezto}/share/zsh-prezto/runcoms/zshrc")}
${concatStrings (map (plugin: ''
if [ -f "$HOME/${pluginsDir}/${plugin.name}/${plugin.file}" ]; then
if [[ -f "$HOME/${pluginsDir}/${plugin.name}/${plugin.file}" ]]; then
source "$HOME/${pluginsDir}/${plugin.name}/${plugin.file}"
fi
'') cfg.plugins)}
@@ -495,6 +515,7 @@ in
# See https://github.com/nix-community/home-manager/issues/177.
HISTSIZE="${toString cfg.history.size}"
SAVEHIST="${toString cfg.history.save}"
${optionalString (cfg.history.ignorePatterns != []) "HISTORY_IGNORE=${lib.escapeShellArg "(${lib.concatStringsSep "|" cfg.history.ignorePatterns})"}"}
${if versionAtLeast config.home.stateVersion "20.03"
then ''HISTFILE="${cfg.history.path}"''
else ''HISTFILE="$HOME/${cfg.history.path}"''}

View File

@@ -0,0 +1,71 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.barrier;
in {
meta.maintainers = with maintainers; [ kritnich ];
options.services.barrier = {
client = {
enable = mkEnableOption "Barrier Client daemon";
name = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
Screen name of client. Defaults to hostname.
'';
};
server = mkOption {
type = types.str;
description = ''
Server to connect to formatted as
<literal>&lt;host&gt;[:&lt;port&gt;]</literal>.
Port defaults to <literal>24800</literal>.
'';
};
tray = mkEnableOption "the system tray icon" // { default = true; };
enableCrypto = mkEnableOption "crypto (SSL) plugin" // {
default = true;
};
enableDragDrop = mkEnableOption "file drag &amp; drop";
extraFlags = mkOption {
type = types.listOf types.str;
default = [ "-f" ];
defaultText = literalExample ''[ "-f" ]'';
description = ''
Additional flags to pass to <command>barrierc</command>.
See <command>barrierc --help</command>.
'';
};
};
};
config = mkIf cfg.client.enable {
systemd.user.services.barrierc = {
Unit = {
Description = "Barrier Client daemon";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install.WantedBy = [ "graphical-session.target" ];
Service.ExecStart = with cfg.client;
toString ([ "${pkgs.barrier}/bin/barrierc" ]
++ optional (name != null) "--name ${name}"
++ optional (!tray) "--no-tray"
++ optional enableCrypto "--enable-crypto"
++ optional enableDragDrop "--enable-drag-drop" ++ extraFlags
++ [ server ]);
};
};
}

View File

@@ -24,7 +24,8 @@ with lib;
systemd.user.services.blueman-applet = {
Unit = {
Description = "Blueman applet";
After = [ "graphical-session-pre.target" ];
Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
PartOf = [ "graphical-session.target" ];
};

View File

@@ -103,7 +103,8 @@ in {
systemd.user.services.cbatticon = {
Unit = {
Description = "cbatticon system tray battery icon";
After = [ "graphical-session-pre.target" ];
Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
PartOf = [ "graphical-session.target" ];
};

View File

@@ -25,7 +25,7 @@ let
options = {
package = mkOption {
type = types.package;
example = literalExample "pkgs.gnome3.adwaita-icon-theme";
example = literalExample "pkgs.gnome.adwaita-icon-theme";
description = "Package providing the theme.";
};
@@ -57,12 +57,26 @@ in {
services.dunst = {
enable = mkEnableOption "the dunst notification daemon";
package = mkOption {
type = types.package;
default = pkgs.dunst;
defaultText = literalExample "pkgs.dunst";
description = "Package providing <command>dunst</command>.";
};
iconTheme = mkOption {
type = themeType;
default = hicolorTheme;
description = "Set the icon theme.";
};
waylandDisplay = mkOption {
type = types.str;
default = "";
description =
"Set the service's <envar>WAYLAND_DISPLAY</envar> environment variable.";
};
settings = mkOption {
type = with types; attrsOf (attrsOf eitherStrBoolIntList);
default = { };
@@ -89,7 +103,7 @@ in {
config = mkIf cfg.enable (mkMerge [
{
home.packages = [ (getOutput "man" pkgs.dunst) ];
home.packages = [ cfg.package ];
xdg.dataFile."dbus-1/services/org.knopwob.dunst.service".source =
"${pkgs.dunst}/share/dbus-1/services/org.knopwob.dunst.service";
@@ -140,7 +154,9 @@ in {
Service = {
Type = "dbus";
BusName = "org.freedesktop.Notifications";
ExecStart = "${pkgs.dunst}/bin/dunst";
ExecStart = "${cfg.package}/bin/dunst";
Environment = optionalString (cfg.waylandDisplay != "")
"WAYLAND_DISPLAY=${cfg.waylandDisplay}";
};
};
}

View File

@@ -0,0 +1,62 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.etesync-dav;
toEnvironmentCfg = vars:
(concatStringsSep " "
(mapAttrsToList (k: v: "${k}=${escapeShellArg v}") vars));
in {
meta.maintainers = [ maintainers.valodim ];
options.services.etesync-dav = {
enable = mkEnableOption "etesync-dav";
package = mkOption {
type = types.package;
default = pkgs.etesync-dav;
defaultText = "pkgs.etesync-dav";
description = "The etesync-dav derivation to use.";
};
serverUrl = mkOption {
type = types.str;
default = "https://api.etesync.com/";
description = "The URL to the etesync server.";
};
settings = mkOption {
type = types.attrsOf (types.oneOf [ types.str types.int ]);
default = { };
example = literalExample ''
{
ETESYNC_LISTEN_ADDRESS = "localhost";
ETESYNC_LISTEN_PORT = 37358;
}
'';
description = ''
Settings for etesync-dav, passed as environment variables.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
systemd.user.services.etesync-dav = {
Unit = { Description = "etesync-dav"; };
Service = {
ExecStart = "${cfg.package}/bin/etesync-dav";
Environment =
toEnvironmentCfg ({ ETESYNC_URL = cfg.serverUrl; } // cfg.settings);
};
Install = { WantedBy = [ "default.target" ]; };
};
};
}

View File

@@ -18,12 +18,8 @@ in {
systemd.user.services.flameshot = {
Unit = {
Description = "Flameshot screenshot tool";
After = [
"graphical-session-pre.target"
"polybar.service"
"stalonetray.service"
"taffybar.service"
];
Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
PartOf = [ "graphical-session.target" ];
};

View File

@@ -36,7 +36,7 @@ in {
args = concatStringsSep " " ([ "--start" "--foreground" ]
++ optional (cfg.components != [ ])
("--components=" + concatStringsSep "," cfg.components));
in "${pkgs.gnome3.gnome-keyring}/bin/gnome-keyring-daemon ${args}";
in "${pkgs.gnome.gnome-keyring}/bin/gnome-keyring-daemon ${args}";
Restart = "on-abort";
};

View File

@@ -1,17 +1,41 @@
{ config, lib, pkgs, ... }:
{ config, options, lib, pkgs, ... }:
with lib;
let
cfg = config.services.gpg-agent;
gpgPkg = config.programs.gpg.package;
homedir = config.programs.gpg.homedir;
gpgInitStr = ''
GPG_TTY="$(tty)"
export GPG_TTY
''
+ optionalString cfg.enableSshSupport
"${pkgs.gnupg}/bin/gpg-connect-agent updatestartuptty /bye > /dev/null";
"${gpgPkg}/bin/gpg-connect-agent updatestartuptty /bye > /dev/null";
# mimic `gpgconf` output for use in `systemd` unit definitions.
# we cannot use `gpgconf` directly because it heavily depends on system
# state, but we need the values at build time. original:
# https://github.com/gpg/gnupg/blob/c6702d77d936b3e9d91b34d8fdee9599ab94ee1b/common/homedir.c#L672-L681
gpgconf = dir: let
f = pkgs.runCommand dir {} ''
PATH=${pkgs.coreutils}/bin:${pkgs.xxd}/bin:$PATH
if [[ ${homedir} = ${options.programs.gpg.homedir.default} ]]
then
echo -n "%t/gnupg/${dir}" > $out
else
hash=$(echo -n ${homedir} | sha1sum -b | xxd -r -p | base32 | \
cut -c -24 | tr '[:upper:]' '[:lower:]' | \
tr abcdefghijklmnopqrstuvwxyz234567 \
ybndrfg8ejkmcpqxot1uwisza345h769)
echo -n "%t/gnupg/d.$hash/${dir}" > $out
fi
'';
in "${builtins.readFile f}";
in
@@ -154,7 +178,7 @@ in
config = mkIf cfg.enable (mkMerge [
{
home.file.".gnupg/gpg-agent.conf".text = concatStringsSep "\n" (
home.file."${homedir}/gpg-agent.conf".text = concatStringsSep "\n" (
optional (cfg.enableSshSupport) "enable-ssh-support"
++
optional (!cfg.grabKeyboardAndMouse) "no-grab"
@@ -181,7 +205,7 @@ in
home.sessionVariables =
optionalAttrs cfg.enableSshSupport {
SSH_AUTH_SOCK = "$(${pkgs.gnupg}/bin/gpgconf --list-dirs agent-ssh-socket)";
SSH_AUTH_SOCK = "$(${gpgPkg}/bin/gpgconf --list-dirs agent-ssh-socket)";
};
programs.bash.initExtra = gpgInitStr;
@@ -193,13 +217,13 @@ in
(mkIf (cfg.sshKeys != null) {
# Trailing newlines are important
home.file.".gnupg/sshcontrol".text = concatMapStrings (s: "${s}\n") cfg.sshKeys;
home.file."${homedir}/sshcontrol".text = concatMapStrings (s: "${s}\n") cfg.sshKeys;
})
# The systemd units below are direct translations of the
# descriptions in the
#
# ${pkgs.gnupg}/share/doc/gnupg/examples/systemd-user
# ${gpgPkg}/share/doc/gnupg/examples/systemd-user
#
# directory.
{
@@ -214,9 +238,10 @@ in
};
Service = {
ExecStart = "${pkgs.gnupg}/bin/gpg-agent --supervised"
ExecStart = "${gpgPkg}/bin/gpg-agent --supervised"
+ optionalString cfg.verbose " --verbose";
ExecReload = "${pkgs.gnupg}/bin/gpgconf --reload gpg-agent";
ExecReload = "${gpgPkg}/bin/gpgconf --reload gpg-agent";
Environment = "GNUPGHOME=${homedir}";
};
};
@@ -227,7 +252,7 @@ in
};
Socket = {
ListenStream = "%t/gnupg/S.gpg-agent";
ListenStream = gpgconf "S.gpg-agent";
FileDescriptorName = "std";
SocketMode = "0600";
DirectoryMode = "0700";
@@ -247,7 +272,7 @@ in
};
Socket = {
ListenStream = "%t/gnupg/S.gpg-agent.ssh";
ListenStream = gpgconf "S.gpg-agent.ssh";
FileDescriptorName = "ssh";
Service = "gpg-agent.service";
SocketMode = "0600";
@@ -268,7 +293,7 @@ in
};
Socket = {
ListenStream = "%t/gnupg/S.gpg-agent.extra";
ListenStream = gpgconf "S.gpg-agent.extra";
FileDescriptorName = "extra";
Service = "gpg-agent.service";
SocketMode = "0600";

View File

@@ -104,23 +104,26 @@ let
};
exec = mkOption {
type = types.nullOr types.str;
default = null;
type = with types; coercedTo str singleton (listOf str);
default = [ ];
example =
"\${pkg.sway}/bin/swaymsg workspace 1, move workspace to eDP-1";
"[ \${pkg.sway}/bin/swaymsg workspace 1, move workspace to eDP-1 ]";
description = ''
Command executed after the profile is succesfully applied.
Commands executed after the profile is succesfully applied.
Note that if you provide multiple commands, they will be
executed asynchronously with no guaranteed ordering.
'';
};
};
};
profileStr = name:
{ outputs, exec, ... }:
''
{ outputs, exec, ... }: ''
profile ${name} {
${concatStringsSep "\n " (map outputStr outputs)}
'' + optionalString (exec != null) " exec ${exec}\n" + ''
${
concatStringsSep "\n "
(map outputStr outputs ++ map (cmd: "exec ${cmd}") exec)
}
}
'';
in {
@@ -146,6 +149,26 @@ in {
description = ''
List of profiles.
'';
example = literalExample ''
undocked = {
outputs = [
{
criteria = "eDP-1";
}
];
};
docked = {
outputs = [
{
criteria = "eDP-1";
}
{
criteria = "Some Company ASDF 4242";
transform = "90";
}
];
};
'';
};
extraConfig = mkOption {

View File

@@ -6,9 +6,7 @@ let
cfg = config.services.kbfs;
in
{
in {
options = {
services.kbfs = {
enable = mkEnableOption "Keybase File System";
@@ -24,11 +22,8 @@ in
extraFlags = mkOption {
type = types.listOf types.str;
default = [];
example = [
"-label kbfs"
"-mount-type normal"
];
default = [ ];
example = [ "-label kbfs" "-mount-type normal" ];
description = ''
Additional flags to pass to the Keybase filesystem on launch.
'';
@@ -44,21 +39,18 @@ in
After = [ "keybase.service" ];
};
Service =
let
mountPoint = "\"%h/${cfg.mountPoint}\"";
in {
Environment = "PATH=/run/wrappers/bin KEYBASE_SYSTEMD=1";
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p ${mountPoint}";
ExecStart ="${pkgs.kbfs}/bin/kbfsfuse ${toString cfg.extraFlags} ${mountPoint}";
ExecStopPost = "/run/wrappers/bin/fusermount -u ${mountPoint}";
Restart = "on-failure";
PrivateTmp = true;
};
Install = {
WantedBy = [ "default.target" ];
Service = let mountPoint = ''"%h/${cfg.mountPoint}"'';
in {
Environment = "PATH=/run/wrappers/bin KEYBASE_SYSTEMD=1";
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p ${mountPoint}";
ExecStart =
"${pkgs.kbfs}/bin/kbfsfuse ${toString cfg.extraFlags} ${mountPoint}";
ExecStopPost = "/run/wrappers/bin/fusermount -u ${mountPoint}";
Restart = "on-failure";
PrivateTmp = true;
};
Install.WantedBy = [ "default.target" ];
};
home.packages = [ pkgs.kbfs ];

View File

@@ -6,22 +6,14 @@ let
cfg = config.services.keybase;
in
{
options = {
services.keybase = {
enable = mkEnableOption "Keybase";
};
};
in {
options.services.keybase.enable = mkEnableOption "Keybase";
config = mkIf cfg.enable {
home.packages = [ pkgs.keybase ];
systemd.user.services.keybase = {
Unit = {
Description = "Keybase service";
};
Unit.Description = "Keybase service";
Service = {
ExecStart = "${pkgs.keybase}/bin/keybase service --auto-forked";
@@ -29,9 +21,7 @@ in
PrivateTmp = true;
};
Install = {
WantedBy = [ "default.target" ];
};
Install.WantedBy = [ "default.target" ];
};
};
}

View File

@@ -26,6 +26,8 @@ let
Type = "oneshot";
ExecStart = "${pkgs.gmailieer}/bin/gmi sync";
WorkingDirectory = account.maildir.absPath;
Environment =
"NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/notmuchrc";
};
};
};

View File

@@ -0,0 +1,32 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.mpris-proxy;
in {
meta.maintainers = [ maintainers.thibautmarty ];
options.services.mpris-proxy.enable = mkEnableOption
"a proxy forwarding Bluetooth MIDI controls via MPRIS2 to control media players";
config = mkIf cfg.enable {
systemd.user.services.mpris-proxy = {
Unit = {
Description =
"Proxy forwarding Bluetooth MIDI controls via MPRIS2 to control media players";
BindsTo = [ "bluetooth.target" ];
After = [ "bluetooth.target" ];
};
Install.WantedBy = [ "bluetooth.target" ];
Service = {
Type = "simple";
ExecStart = "${pkgs.bluez}/bin/mpris-proxy";
};
};
};
}

View File

@@ -19,7 +19,8 @@ in {
systemd.user.services.network-manager-applet = {
Unit = {
Description = "Network Manager applet";
After = [ "graphical-session-pre.target" ];
Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
PartOf = [ "graphical-session.target" ];
};

View File

@@ -17,6 +17,13 @@ in {
defaultText = literalExample "pkgs.nextcloud-client";
description = "The package to use for the nextcloud client binary.";
};
startInBackground = mkOption {
type = types.bool;
default = false;
description =
"Whether to start the Nextcloud client in the background.";
};
};
};
@@ -30,7 +37,8 @@ in {
Service = {
Environment = "PATH=${config.home.profileDirectory}/bin";
ExecStart = "${cfg.package}/bin/nextcloud";
ExecStart = "${cfg.package}/bin/nextcloud"
+ (optionalString cfg.startInBackground " --background");
};
Install = { WantedBy = [ "graphical-session.target" ]; };

View File

@@ -27,7 +27,8 @@ in {
systemd.user.services.parcellite = {
Unit = {
Description = "Lightweight GTK+ clipboard manager";
After = [ "graphical-session-pre.target" ];
Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
PartOf = [ "graphical-session.target" ];
};

View File

@@ -0,0 +1,28 @@
{ pkgs, config, lib, ... }:
with lib;
let serviceCfg = config.services.pass-secret-service;
in {
meta.maintainers = [ maintainers.cab404 ];
options.services.pass-secret-service = {
enable = mkEnableOption "Pass libsecret service";
};
config = mkIf serviceCfg.enable {
assertions = [{
assertion = config.programs.password-store.enable;
message = "The 'services.pass-secret-service' module requires"
+ " 'programs.password-store.enable = true'.";
}];
systemd.user.services.pass-secret-service = {
Unit = { Description = "Pass libsecret service"; };
Service = {
# pass-secret-service doesn't use environment variables for some reason.
ExecStart =
"${pkgs.pass-secret-service}/bin/pass_secret_service --path ${config.programs.password-store.settings.PASSWORD_STORE_DIR}";
};
Install = { WantedBy = [ "default.target" ]; };
};
};
}

View File

@@ -13,7 +13,8 @@ with lib;
systemd.user.services.pasystray = {
Unit = {
Description = "PulseAudio system tray";
After = [ "graphical-session-pre.target" ];
Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
PartOf = [ "graphical-session.target" ];
};

View File

@@ -3,14 +3,32 @@
with lib;
let
cfg = config.services.pbgopy;
package = pkgs.pbgopy;
commandLine = concatStringsSep " " ([
"${package}/bin/pbgopy serve"
"--port ${toString cfg.port}"
"--ttl ${cfg.cache.ttl}"
] ++ optional (cfg.httpAuth != null)
"--basic-auth ${escapeShellArg cfg.httpAuth}");
in {
meta.maintainers = [ maintainers.ivar ];
options.services.pbgopy = {
enable = mkEnableOption "pbgopy";
port = mkOption {
type = types.port;
default = 9090;
example = 8080;
description = ''
The port to host the pbgopy server on.
'';
};
cache.ttl = mkOption {
type = types.str;
default = "24h";
@@ -19,6 +37,16 @@ in {
The TTL for the cache. Use <literal>"0s"</literal> to disable it.
'';
};
httpAuth = mkOption {
type = types.nullOr types.str;
default = null;
example = "user:pass";
description = ''
Basic HTTP authentication's username and password. Both the username and
password are escaped.
'';
};
};
config = mkIf cfg.enable {
@@ -31,7 +59,7 @@ in {
PartOf = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${package}/bin/pbgopy serve --ttl ${cfg.cache.ttl}";
ExecStart = commandLine;
Restart = "on-abort";
};
Install = { WantedBy = [ "graphical-session.target" ]; };

View File

@@ -197,8 +197,7 @@ in {
systemd.user.services.polybar = {
Unit = {
Description = "Polybar status bar";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
PartOf = [ "tray.target" ];
X-Restart-Triggers =
[ "${config.xdg.configFile."polybar/config".source}" ];
};
@@ -212,7 +211,7 @@ in {
Restart = "on-failure";
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Install = { WantedBy = [ "tray.target" ]; };
};
};

View File

@@ -0,0 +1,31 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.poweralertd;
in {
meta.maintainers = [ maintainers.thibautmarty ];
options.services.poweralertd.enable =
mkEnableOption "the Upower-powered power alerterd";
config = mkIf cfg.enable {
systemd.user.services.poweralertd = {
Unit = {
Description = "UPower-powered power alerter";
Documentation = "man:poweralertd(1)";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install.WantedBy = [ "graphical-session.target" ];
Service = {
Type = "simple";
ExecStart = "${pkgs.poweralertd}/bin/poweralertd";
Restart = "always";
};
};
};
}

View File

@@ -38,7 +38,7 @@ in {
# "AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files"
home.packages = [ cfg.package pkgs.at-spi2-core ];
# Will need to add `services.dbus.packages = with pkgs; [ gnome3.dconf ];`
# Will need to add `services.dbus.packages = with pkgs; [ gnome.dconf ];`
# to /etc/nixos/configuration.nix for daemon to work correctly
systemd.user.services.pulseeffects = {

View File

@@ -56,11 +56,10 @@ in {
systemd.user.services.stalonetray = {
Unit = {
Description = "Stalonetray system tray";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
PartOf = [ "tray.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Install = { WantedBy = [ "tray.target" ]; };
Service = {
ExecStart = "${cfg.package}/bin/stalonetray";

View File

@@ -29,23 +29,17 @@ in {
systemd.user.services.status-notifier-watcher = {
Unit = {
Description = "SNI watcher";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
PartOf = [ "tray.target" ];
Before = [ "taffybar.service" ];
};
Service = {
Type = "dbus";
BusName = "org.kde.StatusNotifierWatcher";
ExecStart = "${cfg.package}/bin/status-notifier-watcher";
# Delay the unit start a bit to allow the program to get fully
# set up before letting dependent services start. This is
# brittle and a better solution using, e.g., `BusName=` might
# be possible.
ExecStartPost = "${pkgs.coreutils}/bin/sleep 1";
};
Install = {
WantedBy = [ "graphical-session.target" "taffybar.service" ];
};
Install = { WantedBy = [ "tray.target" "taffybar.service" ]; };
};
};
}

View File

@@ -19,6 +19,11 @@ let
in
{
imports = [
(mkRemovedOptionModule ["services" "sxhkd" "extraPath"]
"This option is no longer needed and can be removed.")
];
options.services.sxhkd = {
enable = mkEnableOption "simple X hotkey daemon";
@@ -57,44 +62,19 @@ in
i3-msg {workspace,move container to workspace} {1-10}
'';
};
extraPath = mkOption {
default = "";
type = types.envVar;
description = ''
Additional <envar>PATH</envar> entries to search for commands.
'';
example = "/home/some-user/bin:/extra/path/bin";
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.sxhkd ];
home.packages = [ cfg.package ];
xdg.configFile."sxhkd/sxhkdrc".text = concatStringsSep "\n" [
keybindingsStr
cfg.extraConfig
];
systemd.user.services.sxhkd = {
Unit = {
Description = "simple X hotkey daemon";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Environment =
"PATH="
+ "${config.home.profileDirectory}/bin"
+ optionalString (cfg.extraPath != "") ":"
+ cfg.extraPath;
ExecStart = "${cfg.package}/bin/sxhkd ${toString cfg.extraOptions}";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
xsession.initExtra = ''
systemd-cat -t sxhkd systemd-run --user --scope -u sxhkd \
${cfg.package}/bin/sxhkd ${toString cfg.extraOptions} &
'';
};
}

View File

@@ -10,9 +10,34 @@ with lib;
enable = mkEnableOption "Syncthing continuous file synchronization";
tray = mkOption {
type = types.bool;
default = false;
description = "Whether to enable QSyncthingTray service.";
type = with types;
either bool (submodule {
options = {
enable = mkOption {
type = types.bool;
default = false;
description = "Whether to enable a syncthing tray service.";
};
command = mkOption {
type = types.str;
default = "syncthingtray";
defaultText = literalExample "syncthingtray";
example = literalExample "qsyncthingtray";
description = "Syncthing tray command to use.";
};
package = mkOption {
type = types.package;
default = pkgs.syncthingtray-minimal;
defaultText = literalExample "pkgs.syncthingtray-minimal";
example = literalExample "pkgs.qsyncthingtray";
description = "Syncthing tray package to use.";
};
};
});
default = { enable = false; };
description = "Syncthing tray service configuration.";
};
};
};
@@ -43,28 +68,49 @@ with lib;
};
})
(mkIf config.services.syncthing.tray {
systemd.user.services = {
qsyncthingtray = {
Unit = {
Description = "QSyncthingTray";
After = [
"graphical-session-pre.target"
"polybar.service"
"taffybar.service"
"stalonetray.service"
];
PartOf = [ "graphical-session.target" ];
};
(mkIf (isAttrs config.services.syncthing.tray
&& config.services.syncthing.tray.enable) {
systemd.user.services = {
${config.services.syncthing.tray.package.pname} = {
Unit = {
Description = config.services.syncthing.tray.package.pname;
Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Environment = "PATH=${config.home.profileDirectory}/bin";
ExecStart = "${pkgs.qsyncthingtray}/bin/QSyncthingTray";
};
Service = {
ExecStart =
"${config.services.syncthing.tray.package}/bin/${config.services.syncthing.tray.command}";
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
};
})
})
# deprecated
(mkIf (isBool config.services.syncthing.tray
&& config.services.syncthing.tray) {
systemd.user.services = {
"syncthingtray" = {
Unit = {
Description = "syncthingtray";
Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.syncthingtray-minimal}/bin/syncthingtray";
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
warnings = [
"Specifying 'services.syncthing.tray' as a boolean is deprecated, set 'services.syncthing.tray.enable' instead. See https://github.com/nix-community/home-manager/pull/1257."
];
})
];
}

View File

@@ -27,16 +27,17 @@ in {
systemd.user.services.taffybar = {
Unit = {
Description = "Taffybar desktop bar";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
PartOf = [ "tray.target" ];
};
Service = {
Type = "dbus";
BusName = "org.taffybar.Bar";
ExecStart = "${cfg.package}/bin/taffybar";
Restart = "on-failure";
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Install = { WantedBy = [ "tray.target" ]; };
};
xsession.importedVariables = [ "GDK_PIXBUF_MODULE_FILE" ];

View File

@@ -77,7 +77,8 @@ in {
systemd.user.services.udiskie = {
Unit = {
Description = "udiskie mount daemon";
After = [ "graphical-session-pre.target" ];
Requires = [ "tray.target" ];
After = [ "graphical-session-pre.target" "tray.target" ];
PartOf = [ "graphical-session.target" ];
};

View File

@@ -17,7 +17,7 @@ let
inherit (commonOptions)
fonts window floating focus assigns modifier workspaceLayout
workspaceAutoBackAndForth keycodebindings colors bars startup gaps menu
terminal;
terminal defaultWorkspace;
keybindings = mkOption {
type = types.attrsOf (types.nullOr types.str);
@@ -140,7 +140,8 @@ let
inherit (commonFunctions)
keybindingsStr keycodebindingsStr modeStr assignStr barStr gapsStr
floatingCriteriaStr windowCommandsStr colorSetStr;
floatingCriteriaStr windowCommandsStr colorSetStr windowBorderString
fontConfigStr keybindingDefaultWorkspace keybindingsRest;
startupEntryStr = { command, always, notification, workspace, ... }: ''
${if always then "exec_always" else "exec"} ${
@@ -155,14 +156,9 @@ let
configFile = pkgs.writeText "i3.conf" ((if cfg.config != null then
with cfg.config; ''
font pango:${concatStringsSep ", " fonts}
${fontConfigStr fonts}
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
}
${windowBorderString window floating}
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"}
@@ -180,7 +176,8 @@ let
client.placeholder ${colorSetStr colors.placeholder}
client.background ${colors.background}
${keybindingsStr { inherit keybindings; }}
${keybindingsStr { keybindings = keybindingDefaultWorkspace; }}
${keybindingsStr { keybindings = keybindingsRest; }}
${keycodebindingsStr keycodebindings}
${concatStringsSep "\n" (mapAttrsToList modeStr modes)}
${concatStringsSep "\n" (mapAttrsToList assignStr assigns)}
@@ -209,6 +206,8 @@ let
'';
in {
meta.maintainers = with maintainers; [ sumnerevans ];
options = {
xsession.windowManager.i3 = {
enable = mkEnableOption "i3 window manager.";
@@ -260,6 +259,15 @@ in {
mkDefault (if (cfg.config.gaps != null) then pkgs.i3-gaps else pkgs.i3);
})
(mkIf (cfg.config != null) {
warnings = (optional (isList cfg.config.fonts)
"Specifying i3.config.fonts as a list is deprecated. Use the attrset version instead.")
++ flatten (map (b:
optional (isList b.fonts)
"Specifying i3.config.bars[].fonts as a list is deprecated. Use the attrset version instead.")
cfg.config.bars);
})
(mkIf (cfg.config != null
&& (any (s: s.workspace != null) cfg.config.startup)) {
warnings = [

View File

@@ -8,6 +8,14 @@ rec {
concatStringsSep " " (mapAttrsToList (k: v: ''${k}="${v}"'') criteria)
}]";
keybindingDefaultWorkspace = filterAttrs (n: v:
cfg.config.defaultWorkspace != null && v == cfg.config.defaultWorkspace)
cfg.config.keybindings;
keybindingsRest = filterAttrs (n: v:
cfg.config.defaultWorkspace == null || v != cfg.config.defaultWorkspace)
cfg.config.keybindings;
keybindingsStr = { keybindings, bindsymArgs ? "" }:
concatStringsSep "\n" (mapAttrsToList (keycomb: action:
optionalString (action != null) "bindsym ${
@@ -39,6 +47,23 @@ rec {
concatStringsSep "\n"
(map (c: "assign ${criteriaStr c} ${workspace}") criteria);
fontConfigStr = let
toFontStr = { names, style ? "", size ? "" }:
optionalString (names != [ ]) concatStringsSep " " (filter (x: x != "") [
"font"
"pango:${concatStringsSep ", " names}"
style
size
]);
in fontCfg:
if isList fontCfg then
toFontStr { names = fontCfg; }
else
toFontStr {
inherit (fontCfg) names style;
size = toString fontCfg.size;
};
barStr = { id, fonts, mode, hiddenState, position, workspaceButtons
, workspaceNumbers, command, statusCommand, colors, trayOutput, extraConfig
, ... }:
@@ -46,10 +71,7 @@ rec {
in ''
bar {
${optionalString (id != null) "id ${id}"}
${
optionalString (fonts != [ ])
"font pango:${concatStringsSep ", " fonts}"
}
${fontConfigStr fonts}
${optionalString (mode != null) "mode ${mode}"}
${optionalString (hiddenState != null) "hidden_state ${hiddenState}"}
${optionalString (position != null) "position ${position}"}
@@ -120,6 +142,15 @@ rec {
${optionalString (smartBorders != "off") "smart_borders ${smartBorders}"}
'';
windowBorderString = window: floating:
let
titlebarString = { titlebar, border, ... }:
"${if titlebar then "normal" else "pixel"} ${toString border}";
in concatStringsSep "\n" [
"default_border ${titlebarString window}"
"default_floating_border ${titlebarString floating}"
];
floatingCriteriaStr = criteria:
"for_window ${criteriaStr criteria} floating enable";
windowCommandsStr = { command, criteria, ... }:

View File

@@ -7,14 +7,37 @@ let
isI3 = moduleName == "i3";
isSway = !isI3;
fonts = mkOption {
type = types.listOf types.str;
default = [ "monospace 8" ];
description = ''
Font list used for window titles. Only FreeType fonts are supported.
The order here is important (e.g. icons font should go before the one used for text).
'';
example = [ "FontAwesome 10" "Terminus 10" ];
fontOptions = types.submodule {
options = {
names = mkOption {
type = types.listOf types.str;
default = [ "monospace" ];
defaultText = literalExample ''[ "monospace" ]'';
description = ''
List of font names list used for window titles. Only FreeType fonts are supported.
The order here is important (e.g. icons font should go before the one used for text).
'';
example = literalExample ''[ "FontAwesome" "Terminus" ]'';
};
style = mkOption {
type = types.str;
default = "";
description = ''
The font style to use for window titles.
'';
example = "Bold Semi-Condensed";
};
size = mkOption {
type = types.float;
default = 8.0;
description = ''
The font size to use for window titles.
'';
example = 11.5;
};
};
};
startupModule = types.submodule {
@@ -56,20 +79,27 @@ let
options = let
versionAtLeast2009 = versionAtLeast config.home.stateVersion "20.09";
mkNullableOption = { type, default, ... }@args:
mkOption (args // optionalAttrs versionAtLeast2009 {
mkOption (args // {
type = types.nullOr type;
default = null;
example = default;
} // {
default = if versionAtLeast2009 then null else default;
defaultText = literalExample ''
${
if isString default then default else "See code"
} for state version < 20.09,
null for state version 20.09
null for state version 20.09, as example otherwise
'';
example = default;
});
in {
fonts = fonts // optionalAttrs versionAtLeast2009 { default = [ ]; };
fonts = mkOption {
type = with types; either (listOf str) fontOptions;
default = { };
example = literalExample ''
{
names = [ "DejaVu Sans Mono" "FontAwesome5Free" ];
style = "Bold Semi-Condensed";
size = 11.0;
}
'';
description = "Font configuration for this bar.";
};
extraConfig = mkOption {
type = types.lines;
@@ -133,11 +163,9 @@ let
"\${pkgs.waybar}/bin/waybar";
};
statusCommand = mkOption {
type = types.nullOr types.str;
default =
if versionAtLeast2009 then null else "${pkgs.i3status}/bin/i3status";
example = "i3status";
statusCommand = mkNullableOption {
type = types.str;
default = "${pkgs.i3status}/bin/i3status";
description = "Command that will be used to get status lines.";
};
@@ -310,7 +338,18 @@ let
criteriaModule = types.attrsOf types.str;
in {
inherit fonts;
fonts = mkOption {
type = with types; either (listOf str) fontOptions;
default = { };
example = literalExample ''
{
names = [ "DejaVu Sans Mono" "FontAwesome5Free" ];
style = "Bold Semi-Condensed";
size = 11.0;
}
'';
description = "Font configuration for window titles, nagbar...";
};
window = mkOption {
type = types.submodule {
@@ -605,7 +644,10 @@ in {
workspaceButtons = true;
workspaceNumbers = true;
statusCommand = "${pkgs.i3status}/bin/i3status";
fonts = [ "monospace 8" ];
fonts = {
names = [ "monospace" ];
size = 8.0;
};
trayOutput = "primary";
colors = {
background = "#000000";
@@ -639,6 +681,7 @@ in {
};
}] else
[ { } ];
defaultText = literalExample "see code";
description = ''
${capitalModuleName} bars settings blocks. Set to empty list to remove bars completely.
'';
@@ -776,4 +819,16 @@ in {
description = "Default launcher to use.";
example = "bemenu-run";
};
defaultWorkspace = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
The default workspace to show when ${
if isSway then "sway" else "i3"
} is launched.
This must to correspond to the value of the keybinding of the default workspace.
'';
example = "workspace number 9";
};
}

View File

@@ -17,7 +17,7 @@ let
inherit (commonOptions)
fonts window floating focus assigns workspaceLayout
workspaceAutoBackAndForth modifier keycodebindings colors bars startup
gaps menu terminal;
gaps menu terminal defaultWorkspace;
left = mkOption {
type = types.str;
@@ -153,7 +153,12 @@ let
default = { };
example = { "*" = { xkb_variant = "dvorak"; }; };
description = ''
An attribute set that defines input modules. See man sway_input for options.
An attribute set that defines input modules. See
<citerefentry>
<refentrytitle>sway-input</refentrytitle>
<manvolnum>5</manvolnum>
</citerefentry>
for options.
'';
};
@@ -162,7 +167,26 @@ let
default = { };
example = { "HDMI-A-2" = { bg = "~/path/to/background.png fill"; }; };
description = ''
An attribute set that defines output modules. See man sway_output for options.
An attribute set that defines output modules. See
<citerefentry>
<refentrytitle>sway-output</refentrytitle>
<manvolnum>5</manvolnum>
</citerefentry>
for options.
'';
};
seat = mkOption {
type = types.attrsOf (types.attrsOf types.str);
default = { };
example = { "*" = { hide_cursor = "when-typing enable"; }; };
description = ''
An attribute set that defines seat modules. See
<citerefentry>
<refentrytitle>sway-input</refentrytitle>
<manvolnum>5</manvolnum>
</citerefentry>
for options.
'';
};
@@ -221,36 +245,28 @@ let
inherit (commonFunctions)
keybindingsStr keycodebindingsStr modeStr assignStr barStr gapsStr
floatingCriteriaStr windowCommandsStr colorSetStr;
floatingCriteriaStr windowCommandsStr colorSetStr windowBorderString
fontConfigStr keybindingDefaultWorkspace keybindingsRest;
startupEntryStr = { command, always, ... }: ''
${if always then "exec_always" else "exec"} ${command}
'';
inputStr = name: attrs: ''
input "${name}" {
${concatStringsSep "\n"
(mapAttrsToList (name: value: "${name} ${value}") attrs)}
}
'';
outputStr = name: attrs: ''
output "${name}" {
moduleStr = moduleType: name: attrs: ''
${moduleType} "${name}" {
${concatStringsSep "\n"
(mapAttrsToList (name: value: "${name} ${value}") attrs)}
}
'';
inputStr = moduleStr "input";
outputStr = moduleStr "output";
seatStr = moduleStr "seat";
configFile = pkgs.writeText "sway.conf" ((if cfg.config != null then
with cfg.config; ''
font pango:${concatStringsSep ", " fonts}
${fontConfigStr fonts}
floating_modifier ${floating.modifier}
default_border ${if window.titlebar then "normal" else "pixel"} ${
toString window.border
}
default_floating_border ${
if floating.titlebar then "normal" else "pixel"
} ${toString floating.border}
${windowBorderString window floating}
hide_edge_borders ${window.hideEdgeBorders}
focus_wrapping ${if focus.forceWrapping then "yes" else "no"}
focus_follows_mouse ${focus.followMouse}
@@ -269,20 +285,29 @@ let
client.background ${colors.background}
${keybindingsStr {
inherit keybindings;
keybindings = keybindingDefaultWorkspace;
bindsymArgs =
lib.optionalString (cfg.config.bindkeysToCode) "--to-code";
}}
${keybindingsStr {
keybindings = keybindingsRest;
bindsymArgs =
lib.optionalString (cfg.config.bindkeysToCode) "--to-code";
}}
${keycodebindingsStr keycodebindings}
${concatStringsSep "\n" (mapAttrsToList inputStr input)}
${concatStringsSep "\n" (mapAttrsToList outputStr output)}
${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)}
${concatStringsSep "\n" (
# Append all of the lists together to avoid unnecessary whitespace.
mapAttrsToList inputStr input # inputs
++ mapAttrsToList outputStr output # outputs
++ mapAttrsToList seatStr seat # seats
++ mapAttrsToList modeStr modes # modes
++ mapAttrsToList assignStr assigns # assigns
++ map barStr bars # bars
++ optional (gaps != null) gapsStr # gaps
++ map floatingCriteriaStr floating.criteria # floating
++ map windowCommandsStr window.commands # window commands
++ map startupEntryStr startup # startup
)}
''
else
"") + "\n" + (if cfg.systemdIntegration then ''
@@ -298,7 +323,7 @@ let
};
in {
meta.maintainers = [ maintainers.alexarice ];
meta.maintainers = with maintainers; [ alexarice sumnerevans ];
options.wayland.windowManager.sway = {
enable = mkEnableOption "sway wayland compositor";
@@ -390,27 +415,38 @@ in {
};
};
config = mkIf cfg.enable {
home.packages = optional (cfg.package != null) cfg.package
++ optional cfg.xwayland pkgs.xwayland;
xdg.configFile."sway/config" = {
source = configFile;
onChange = ''
swaySocket=''${XDG_RUNTIME_DIR:-/run/user/$UID}/sway-ipc.$UID.$(${pkgs.procps}/bin/pgrep -x sway || ${pkgs.coreutils}/bin/true).sock
if [ -S $swaySocket ]; then
echo "Reloading sway"
$DRY_RUN_CMD ${pkgs.sway}/bin/swaymsg -s $swaySocket reload
fi
'';
};
systemd.user.targets.sway-session = mkIf cfg.systemdIntegration {
Unit = {
Description = "sway compositor session";
Documentation = [ "man:systemd.special(7)" ];
BindsTo = [ "graphical-session.target" ];
Wants = [ "graphical-session-pre.target" ];
After = [ "graphical-session-pre.target" ];
config = mkIf cfg.enable (mkMerge [
(mkIf (cfg.config != null) {
warnings = (optional (isList cfg.config.fonts)
"Specifying sway.config.fonts as a list is deprecated. Use the attrset version instead.")
++ flatten (map (b:
optional (isList b.fonts)
"Specifying sway.config.bars[].fonts as a list is deprecated. Use the attrset version instead.")
cfg.config.bars);
})
{
home.packages = optional (cfg.package != null) cfg.package
++ optional cfg.xwayland pkgs.xwayland;
xdg.configFile."sway/config" = {
source = configFile;
onChange = ''
swaySocket=''${XDG_RUNTIME_DIR:-/run/user/$UID}/sway-ipc.$UID.$(${pkgs.procps}/bin/pgrep -x sway || ${pkgs.coreutils}/bin/true).sock
if [ -S $swaySocket ]; then
echo "Reloading sway"
$DRY_RUN_CMD ${pkgs.sway}/bin/swaymsg -s $swaySocket reload
fi
'';
};
};
};
systemd.user.targets.sway-session = mkIf cfg.systemdIntegration {
Unit = {
Description = "sway compositor session";
Documentation = [ "man:systemd.special(7)" ];
BindsTo = [ "graphical-session.target" ];
Wants = [ "graphical-session-pre.target" ];
After = [ "graphical-session-pre.target" ];
};
};
}
]);
}

View File

@@ -4,9 +4,19 @@ with lib;
let
cfg = config.targets.genericLinux;
profileDirectory = config.home.profileDirectory;
in {
imports = [
(mkRenamedOptionModule [ "targets" "genericLinux" "extraXdgDataDirs" ] [
"xdg"
"systemDirs"
"data"
])
];
options.targets.genericLinux = {
enable = mkEnableOption "" // {
description = ''
@@ -14,39 +24,20 @@ in {
GNU/Linux distributions other than NixOS.
'';
};
extraXdgDataDirs = mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "/usr/share" "/usr/local/share" ];
description = ''
List of directory names to add to <envar>XDG_DATA_DIRS</envar>.
'';
};
};
config = mkIf config.targets.genericLinux.enable {
home.sessionVariables = let
profiles =
[ "\${NIX_STATE_DIR:-/nix/var/nix}/profiles/default" profileDirectory ];
dataDirs = concatStringsSep ":"
(map (profile: "${profile}/share") profiles
++ config.targets.genericLinux.extraXdgDataDirs);
config = mkIf cfg.enable {
xdg.systemDirs.data = [
# Nix profiles
"\${NIX_STATE_DIR:-/nix/var/nix}/profiles/default/share"
"${profileDirectory}/share"
# https://github.com/archlinux/svntogit-packages/blob/packages/ncurses/trunk/PKGBUILD
# https://salsa.debian.org/debian/ncurses/-/blob/master/debian/rules
# https://src.fedoraproject.org/rpms/ncurses/blob/main/f/ncurses.spec
# https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-libs/ncurses/ncurses-6.2-r1.ebuild
distroTerminfoDirs = concatStringsSep ":" [
"/etc/terminfo" # debian, fedora, gentoo
"/lib/terminfo" # debian
"/usr/share/terminfo" # package default, all distros
];
in {
XDG_DATA_DIRS = "${dataDirs}\${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS";
TERMINFO_DIRS =
"${profileDirectory}/share/terminfo:$TERMINFO_DIRS\${TERMINFO_DIRS:+:}${distroTerminfoDirs}";
};
# Distribution-specific
"/usr/share/ubuntu"
"/usr/local/share"
"/usr/share"
"/var/lib/snapd/desktop"
];
home.sessionVariablesExtra = ''
. "${pkgs.nix}/etc/profile.d/nix.sh"
@@ -62,8 +53,20 @@ in {
. "${profileDirectory}/etc/profile.d/hm-session-vars.sh"
'';
systemd.user.sessionVariables = {
systemd.user.sessionVariables = let
# https://github.com/archlinux/svntogit-packages/blob/packages/ncurses/trunk/PKGBUILD
# https://salsa.debian.org/debian/ncurses/-/blob/master/debian/rules
# https://src.fedoraproject.org/rpms/ncurses/blob/main/f/ncurses.spec
# https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-libs/ncurses/ncurses-6.2-r1.ebuild
distroTerminfoDirs = concatStringsSep ":" [
"/etc/terminfo" # debian, fedora, gentoo
"/lib/terminfo" # debian
"/usr/share/terminfo" # package default, all distros
];
in {
NIX_PATH = "$HOME/.nix-defexpr/channels\${NIX_PATH:+:}$NIX_PATH";
TERMINFO_DIRS =
"${profileDirectory}/share/terminfo:$TERMINFO_DIRS\${TERMINFO_DIRS:+:}${distroTerminfoDirs}";
};
};
}

View File

@@ -23,6 +23,8 @@ let
toString v;
in "${n}: ${formatValue v}";
xrdbMerge = "${pkgs.xorg.xrdb}/bin/xrdb -merge ${cfg.path}";
in {
meta.maintainers = [ maintainers.rycee ];
@@ -45,7 +47,7 @@ in {
X server resources that should be set.
Booleans are formatted as "true" or "false" respectively.
List elements are recursively formatted as a string and joined by commas.
All other values are directly formatted using builtins.toString.
All other values are directly formatted using builtins.toString.
Note, that 2-dimensional lists are not supported and specifying one will throw an exception.
If this and all other xresources options are
<code>null</code>, then this feature is disabled and no
@@ -73,20 +75,30 @@ in {
<filename>~/.Xresources</filename> link is produced.
'';
};
xresources.path = mkOption {
type = types.str;
default = "${config.home.homeDirectory}/.Xresources";
defaultText = "$HOME/.Xresources";
description =
"Path where Home Manager should link the <filename>.Xresources</filename> file.";
};
};
config = mkIf ((cfg.properties != null && cfg.properties != { })
|| cfg.extraConfig != "") {
home.file.".Xresources" = {
home.file.${cfg.path} = {
text = concatStringsSep "\n" ([ ]
++ optional (cfg.extraConfig != "") cfg.extraConfig
++ optionals (cfg.properties != null)
(mapAttrsToList formatLine cfg.properties)) + "\n";
onChange = ''
if [[ -v DISPLAY ]] ; then
$DRY_RUN_CMD ${pkgs.xorg.xrdb}/bin/xrdb -merge $HOME/.Xresources
$DRY_RUN_CMD ${xrdbMerge}
fi
'';
};
xsession.initExtra = xrdbMerge;
};
}

View File

@@ -104,18 +104,27 @@ in {
args = optional (layout != null) "-layout '${layout}'"
++ optional (variant != null) "-variant '${variant}'"
++ optional (model != null) "-model '${model}'"
++ map (v: "-option '${v}'") options;
++ [ "-option ''" ] ++ map (v: "-option '${v}'") options;
in "${pkgs.xorg.setxkbmap}/bin/setxkbmap ${toString args}";
};
};
};
# A basic graphical session target for Home Manager.
targets.hm-graphical-session = {
Unit = {
Description = "Home Manager X session";
Requires = [ "graphical-session-pre.target" ];
BindsTo = [ "graphical-session.target" ];
targets = {
# A basic graphical session target for Home Manager.
hm-graphical-session = {
Unit = {
Description = "Home Manager X session";
Requires = [ "graphical-session-pre.target" ];
BindsTo = [ "graphical-session.target" "tray.target" ];
};
};
tray = {
Unit = {
Description = "Home Manager System Tray";
Requires = [ "graphical-session-pre.target" ];
};
};
};
};

View File

@@ -125,11 +125,14 @@ in {
wantedBy = [ "multi-user.target" ];
wants = [ "nix-daemon.socket" ];
after = [ "nix-daemon.socket" ];
before = [ "systemd-user-sessions.service" ];
environment = serviceEnvironment;
unitConfig = { RequiresMountsFor = usercfg.home.homeDirectory; };
stopIfChanged = false;
serviceConfig = {
User = usercfg.home.username;
Type = "oneshot";

View File

@@ -53,6 +53,7 @@ import nmt {
./modules/programs/gh
./modules/programs/git
./modules/programs/gpg
./modules/programs/htop
./modules/programs/i3status
./modules/programs/kakoune
./modules/programs/kitty
@@ -65,15 +66,19 @@ import nmt {
./modules/programs/ne
./modules/programs/neomutt
./modules/programs/newsboat
./modules/programs/nix-index
./modules/programs/nushell
./modules/programs/pet
./modules/programs/powerline-go
./modules/programs/qutebrowser
./modules/programs/readline
./modules/programs/sbt
./modules/programs/scmpuff
./modules/programs/ssh
./modules/programs/starship
./modules/programs/texlive
./modules/programs/tmux
./modules/programs/topgrade
./modules/programs/vscode
./modules/programs/zplug
./modules/programs/zsh
@@ -83,6 +88,7 @@ import nmt {
] ++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [
./modules/config/i18n
./modules/misc/debug
./modules/misc/gtk
./modules/misc/numlock
./modules/misc/pam
./modules/misc/qt
@@ -91,6 +97,7 @@ import nmt {
./modules/programs/abook
./modules/programs/autorandr
./modules/programs/firefox
./modules/programs/foot
./modules/programs/getmail
./modules/programs/i3status-rust
./modules/programs/ncmpcpp-linux
@@ -98,16 +105,18 @@ import nmt {
./modules/programs/rofi
./modules/programs/rofi-pass
./modules/programs/waybar
./modules/services/barrier
./modules/services/dropbox
./modules/services/emacs
./modules/services/fluidsynth
./modules/services/kanshi
./modules/services/lieer
./modules/services/redshift-gammastep
./modules/services/pbgopy
./modules/services/playerctld
./modules/services/polybar
./modules/services/redshift-gammastep
./modules/services/sxhkd
./modules/services/syncthing
./modules/services/window-managers/i3
./modules/services/window-managers/sway
./modules/services/wlsunset

View File

@@ -4,7 +4,7 @@ with lib;
let
dag = config.lib.dag;
dag = lib.hm.dag;
result = let
sorted = dag.topoSort config.tested.dag;

Some files were not shown because too many files have changed in this diff Show More