Compare commits

...

76 Commits

Author SHA1 Message Date
Robert Helgesson
677f1f05df emacs: remove custom emacsPackages
We can now directly use the existing package set since it supports
overrides.
2021-10-01 01:25:05 +02:00
Marin
959217e51d astroid: fix maildir paths (#2350)
By maildir spec, emails should be under mailbox/folder/[cur,tmp,new]

This commit changes the default maildir path to more closely match the example config:
https://github.com/astroidmail/astroid/wiki/Configuration-Reference#accountsaccountnamesave_sent_to
2021-09-28 08:16:13 -06:00
Robert Helgesson
cb09a968e9 tests: add option test.stubs
This option provides a more convenient way to overlay dummy packages.
It also adds a function `config.lib.test.mkStubPackage` that can,
e.g., be used for `package` options.
2021-09-26 23:26:38 +02:00
Naïm Favier
b0651cc217 nixos: import existing environment during activation
If the user has a running systemd session, source their environment
from the systemd manager and export a few variables in order to allow
activation scripts to reload applications on the fly.

The list of variables to export is arbitrary and could be extended in
the future.

Fixes #1399, fixes #2112.
2021-09-23 23:09:00 +02:00
Robert Helgesson
eee807560b dbus: improve recommended NixOS configuration
Specifically, instead of

    services.dbus.packages = with pkgs; [ gnome.dconf ];

we now recommend

    programs.dconf.enable = true;

which does the same and more.
2021-09-23 22:35:30 +02:00
Robert Helgesson
58aa667e28 starship: initialize using command in profile
Fixes #2316
2021-09-21 22:37:31 +02:00
Jakub Kozłowski
821299e90e sbt: run passwordCommand without trailing newline 2021-09-21 22:16:34 +02:00
Samuel Gräfenstein
4320399a3e flake: add docs to packages output 2021-09-21 22:12:55 +02:00
polykernel
7cb118c9d2 xdg: coerce XDG base directories settings to strings
Currently, when a custom path is set for any of the XDG base
directories (i.e XDG_DATA_HOME, XDG_CONFIG_HOME, ...), the path will
be coerced into a string when consumed by other options such as
xdg.configFile et al. This causes the the given path to be copied to
the nix store which in the case of xdg.configFile et al, translate to
the file being written there as it is a absolute path.

Interestingly, the default base directories all work as intended as
they are encoded as a string.

This commit converts the option to a string regardless of whether it
is a primitive path or a string encoded path. This allows downstream
consumers to use the base directories in arbitrary way without
accidentally copying the content of the directory to the store. It is
implemented in a similar manner as how home.homeDirectory undergoes
string conversion.

The existing file-attr-name test was modified to test also custom xdg
base directories, and the home.file generation test was removed as
there is a dedicated test for this case in the files module. The test
case was renamed to file-gen to better reflect the new scope.
2021-09-21 21:29:44 +02:00
Naïm Favier
371576cdc2 gpg-agent: remove unnecessary IFD
Make `gpgconf` only perform an import from derivation when the GPG
`homedir` is set to a non-default value, which probably isn't the case
for most users.
2021-09-15 23:09:02 +02:00
Samuel Ainsworth
562449b503 files: clarify "Please move the above files" message 2021-09-15 00:25:00 +02:00
Tad Fisher
514acaebb9 lieer: change settings to freeform type
Also add missing options.
2021-09-14 23:59:56 +02:00
polykernel
4b964d2f7b bottom: add module
Bottom is a cross-platform graphical process/system monitor with a
customizable interface and a multitude of features.

Two unit tests were added validate the module behavior for an empty
configuration and the example configuration.
2021-09-14 23:40:21 +02:00
Robert Helgesson
2cfea84e6f modules: fix list sorting 2021-09-14 23:14:41 +02:00
dependabot[bot]
5199bc841a 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>
2021-09-13 01:12:40 +00:00
Renee Margaret McConahy
208e310e94 bash: allow unsetting shell options 2021-09-13 00:19:17 +02:00
polykernel
039f786e60 fnott: refactor module
- Change generation behavior to always generate a configuration file
  and pass it explicitly to fnott, it enforces the module to be
  hermetic instead of offloading the configuration selection to
  heuristics.
- Various style changes.
- Fix issue where fnott would abort due to an invalid config file when
  both the configFile and settings options are unset.
- Remove the empty-settings test as a configuration file is now
  already generated.

Suggested-by: Robert Helgesson <robert@rycee.net>
2021-09-08 22:48:44 +02:00
Colin Summers
275f39611d generic-linux: add system fpaths for zsh
PR #2013
2021-09-07 23:47:49 +02:00
Robert Helgesson
0dab813748 betterlockscreen: limit to platform linux 2021-09-07 07:55:17 +02:00
Basti
5e46262cb1 betterlockscreen: add module (#2292) 2021-09-05 19:00:28 -06:00
Romanos Skiadas
2952168ed5 docs: update session-vars info about fish shell
The docs implied that fish was not really supported, but if fish is
managed by Home Manager, the generated config does use fenv to source
the session-vars file. Update the installation instructions and FAQ to
mention that fish does work, and mention fenv in the README.
2021-09-04 23:12:17 +02:00
arcnmx
bd747c5a53 nixos: add timeout to hm-activate service
Oneshot services do not have a timeout by default, so a misbehaving
activation script can stall and prevent a system from ever booting.
2021-09-04 22:55:30 +02:00
Seth Etter
21a2ff4496 broot: expose modal option (#2300)
* broot: expose modal option

* broot: add basic test

* Use `mkEnableOption`
2021-08-31 10:52:20 -06:00
Mario Rodas
61ca2fc1c0 mcfly: switch to init command (#2301)
mcfly migrated its initialization method to a subcomand called `init`,
which available since mcfly 0.5.4 released on Feb 28, 2021.
2021-08-29 23:42:54 -04:00
Jason Felice
33db7cc6a6 kitty: add environment and darwinLaunchOptions options (#2280)
* kitty: add environment option

* kitty: add darwinLaunchOptions option

See https://sw.kovidgoyal.net/kitty/faq/#how-do-i-specify-command-line-options-for-kitty-on-macos

* kitty: only allow darwinLaunchOptions on darwin

* kitty: make expression shorter

* kitty: fix assertion message
2021-08-26 22:08:34 -04:00
Tanya Bouman
f637e145d7 docs/manual: describes -> describe 2021-08-26 09:04:20 +02:00
polykernel
521a03d8bf fnott: add module
Fnott is a keyboard driven and lightweight Wayland notification daemon
for wlroots-based compositors.

There are four unit test to validate behavior for an empty
configuration, the default configuration, global properties and
systemd service file generation.
2021-08-26 08:43:39 +02:00
Nicolas Berbiche
84d54402a5 format: update nixpkgs revision in format script (#2283) 2021-08-24 21:49:46 +02:00
Michael Adler
2cf19d1d98 neomutt: configurable package (#2294)
This makes it possible to easily use a different (e.g. more recent or
patched) neomutt package.

Co-authored-by: Michael Adler <therisen06@gmail.com>
2021-08-24 13:34:52 -06:00
Sandro
9029fd2b9d service/window-manager/awesome: replace not existing package (#2293)
See https://github.com/NixOS/nixpkgs/pull/135117
2021-08-23 08:39:42 -06:00
Connor Prussin
f6d1cad6ba [nixos] Fix race condition with user units (#2286)
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 22:14:40 -04:00
Nicolas Berbiche
c5b3069145 i3/sway: allow empty criterias using a value of 'true' (#2277)
Co-authored-by: Sumner Evans <me@sumnerevans.com>
2021-08-21 20:41:06 -04:00
John Ericson
4367119ca3 local gpg-agent acting as ssh-agent should yield (#667) (#2253)
* gpg-agent: local agent acting as ssh-agent should yield

This happens commonly if someone using home manager with gpg-agent
acting as ssh-agent on both machines.

@rycee brought up how gpg-itself has some support for agents on both
ends, but in that case one is forwarding the gpg-agent socket rather
than forwardning the gpg-agent-as-ssh-agent socket. There is no need to
forward both.

So I think this is a good default:

 - Forward just gpg-agent socket and this doesn't matter.

 - Forward just the ssh-agent socket and this does the right thing.

 - Forward both sockets and now the ssh one takes priority instead, but
   forwarding both was always a silly thing to do.

Fix #667

* Update modules/services/gpg-agent.nix

Co-authored-by: Nicolas Berbiche <nic.berbiche@gmail.com>

Co-authored-by: Nicolas Berbiche <nic.berbiche@gmail.com>
2021-08-21 01:43:41 -04:00
Jan van Brügge
bf6b85136b neomutt: Allow named mailboxes (#2212)
At the moment, only the inbox of each mail account is added to neomutt.
This inbox is always called "Inbox", so if you configure multiple
accounts, it is hard to know which one is which.

This change allows the user to specify a display name per account that
uses `named-mailboxes` under the hood.

Additionally this change now allows to add other folders than the inbox,
for example the Trash, Spam or Drafts folders to be added on a per-account
basis. Using extraOptions is not possible here, as those are lazily
loaded on mailbox open and thus would appear at the bottom and not sorted
by account.

This commit also changes the default sidebar format string to use %D
instead of %B because %B will ignore named mailboxes and show the folder
name instead.
2021-08-19 00:33:53 -04:00
c4605
1a6df903e3 home-manager: add command line argument --impure 2021-08-19 00:07:49 +02:00
Kid
49a03303e1 fish: provide different examples 2021-08-18 23:51:33 +02:00
Ivan Kovnatsky
a5c609b4b1 sway: workspaceLayout: stacked -> stacking (#2272) 2021-08-17 22:58:03 -04:00
Vonfry
ec260995e2 xsession: set default value of windowManager.command to handle display manager parameter (#2123)
Co-authored-by: Nicolas Berbiche <nicolas@normie.dev>
2021-08-17 21:44:23 -04:00
Nicholas Coltharp
72394f6d6b fluidsynth: add sound service option
Fluidsynth's systemd unit currently has a hard dependency on the
pulseaudio systemd service. Since fluidsynth can use other sound
services (e.g., pipewire-pulse), this should be configurable. This
commit adds the relevant option.

PR #2238
2021-08-18 00:38:29 +02:00
Timur Demin
d11afee973 home-manager: allow remote builders for nix-build (#2268)
This allows running home-manager with --builders option passed through
to nix-build, which will then pass build execution to remote builders on
other machines.

This may be useful with relatively complex home-manager configurations
where building on a local machine is not feasible.
2021-08-17 16:53:44 -04:00
Naïm Favier
5569770d1e files: move dry run logic out of onChange hooks
Fixes #751
2021-08-17 22:14:32 +02:00
Luka T. Korošec
8d68dbd144 doc: Add an example for a git includes section (#2275)
This adds an example for the `programs.git.includes.*.contents` section
since it was a bit ambiguous as to what kind of format it expects.
2021-08-17 16:12:00 -04:00
Robert Helgesson
7ef3db3730 docs: rename "doc" directory to "docs"
Also remove `CONTRIBUTING.adoc` and `FAQ.adoc` from project root since
GitHub knows to pick them up from the docs directory.

Fixes #2273
2021-08-17 19:35:11 +02:00
Ivan Malison
ad0fc085c7 git-sync: add module 2021-08-17 00:00:38 +02:00
Robert Helgesson
763b1a1c55 Merge PR #2245 2021-08-16 23:40:17 +02:00
Robert Helgesson
5ed3a41afa htop: use dummy package in tests 2021-08-16 23:31:59 +02:00
Bart Bakker
2c3a968f57 htop: make self code owner of tests too 2021-08-16 23:20:33 +02:00
Bart Bakker
e60dca7bb3 htop: fix htoprc when fields is not explicitly set
When the 'fields' setting is not set in htoprc, the htop program won't read any
of the settings. Provide a default value for fields in case it's not explicitly
set by the user.
2021-08-16 23:20:32 +02:00
Bart Bakker
447f80f676 htop: verify htoprc contents for example settings test
Fix ending the generated htoprc with a newline.
2021-08-16 23:20:31 +02:00
Bart Bakker
e4553546cc htop: let htop program use its default settings
Don't generate the `htoprc` when using default settings to use the defaults of
the htop program.

Rename the test for this case to 'empty-settings'.
2021-08-16 23:20:31 +02:00
Bart Bakker
7226c2db46 htop: add self as maintainer 2021-08-16 23:20:30 +02:00
Bart Bakker
6eb88173e9 htop: remove deprecated options and definitions 2021-08-16 23:20:29 +02:00
Robert Helgesson
72f3bc6fa4 flameshot: add some service sandboxing 2021-08-14 15:13:31 +02:00
Robert Helgesson
654d82f888 syncthing: add more service sandboxing 2021-08-14 15:13:27 +02:00
Robert Helgesson
a965b097b1 lib.gvariant: fix rendering of empty non-string arrays
Before, empty arrays would always be rendered as an empty string
array.
2021-08-13 08:52:13 +02:00
Robert Helgesson
a3d691c053 lib.gvariant: add a few more functions to test case 2021-08-13 00:45:10 +02:00
Robert Helgesson
d819e0741a rofi-pass: remove test dependency on rofi 2021-08-13 00:30:51 +02:00
Robert Helgesson
479e26dc8c scmpuff: remove test dependency on zsh 2021-08-12 23:11:15 +02:00
Robert Helgesson
3d93e1e802 bat: support list settings and shell escaping
Fixes #2262
2021-08-12 21:29:14 +02:00
Robert Helgesson
604561ba9a lib.gvariant: escape newlines in strings
See #2096
2021-08-11 23:30:24 +02:00
Mihai Fufezan
c049a09d1a easyeffects: add module (#2182)
* pulseeffects: change default example

pulseeffects-pw is now an alias to easyeffects, and the `pulseeffects` binary
that this module references is no longer in that package.

* easyeffects: add module

The easyeffects service is the PipeWire equivalent of the pulseeffects
service.
2021-08-11 09:21:43 -06:00
Shamrock Lee
a4a8307897 java: add module 2021-08-10 23:30:12 +02:00
zach latta
a57ef9dad1 doc: darwin: user.users.eve -> users.users.eve (#2258)
This fixes a broken example for nix-darwin in the docs.
2021-08-10 12:41:00 -06:00
Matthew Leach
5515ec99cc email: allow null certificatesFile
Allow the value of certificatesFile to be null.

Also fixup uses of this variable.

Fixes: #2206
2021-08-10 00:12:13 +02:00
Ivan Malison
2c4234cb79 notify-osd: init (#2240)
Daemon that displays passive pop-up notifications
2021-08-08 20:29:36 -04:00
Ctem
59be1f4983 dunst: add option to read alternative configuration file (#2113) 2021-08-07 20:44:36 -04:00
midchildan
b0d769691c emacs: add extraConfig option 2021-08-06 23:57:14 +02:00
Robert Helgesson
29ea37374d fish: use dummy fish package in tests 2021-08-06 23:33:19 +02:00
Robert Helgesson
d490797179 nix-index: use dummy fish package in tests 2021-08-06 22:55:57 +02:00
Vanilla
ab6517d34a powerline-go: add fish integration 2021-08-06 22:46:58 +02:00
piegames
7f976da068 files: ignore conflict when files are identical
When the target file exists but has the exact same content then we
will now skip creation of the link from the source file.

Fixes #1213
2021-07-29 23:01:52 +02:00
zseri
7c19bcb822 nixos: remove indirection via activate-${username}
Fixes #2191
2021-07-29 22:23:24 +02:00
Sandro Jäckel
5f6364fc28 home-manager: add --no-out-link command line option
When this option is used then `home-manager build` will not produce a
`result` link in the current working directory.
2021-07-29 16:04:41 +02:00
Yisrael Dov Lebow
2272fc312d doc: darwin: need to specify a system user (#2220) 2021-07-28 15:52:22 -04:00
Nicolas Berbiche
e08c696524 volnoti: fix package option namespace (#2227) 2021-07-28 15:39:29 -04:00
Robert Helgesson
ae8cb242f2 home-environment: use declare -gr in activation init
This marks the setup variables as read-only. Just to add a bit extra
safety.
2021-07-27 23:50:33 +02:00
277 changed files with 2741 additions and 1798 deletions

17
.github/CODEOWNERS vendored
View File

@@ -58,6 +58,9 @@
/modules/programs/beets.nix @rycee
/modules/programs/bottom.nix @polykernel
/tests/modules/programs/bottom @polykernel
/modules/programs/broot.nix @aheaume
/modules/programs/dircolors.nix @JustinLovinger
@@ -90,11 +93,14 @@
/modules/programs/home-manager.nix @rycee
/modules/programs/htop.nix @bjpbakker
/tests/modules/htop @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
@@ -211,6 +217,8 @@
/modules/services/barrier.nix @Kritnich
/tests/modules/services/barrier @Kritnich
/modules/services/betterlockscreen.nix @SebTM
/modules/services/caffeine.nix @uvNikita
/modules/services/cbatticon.nix @pmiddend
@@ -225,6 +233,8 @@
/modules/services/dunst.nix @rycee
/modules/services/easyeffects.nix @fufexan
/modules/services/emacs.nix @tadfisher
/modules/services/etesync-dav.nix @Valodim
@@ -233,6 +243,11 @@
/modules/services/fluidsynth.nix @Valodim
/modules/services/fnott.nix @polykernel
/tests/modules/services/fnott @polykernel
/modules/services/git-sync.nix @IvanMalison
/modules/services/gnome-keyring.nix @rycee
/modules/services/gpg-agent.nix @rycee
@@ -266,6 +281,8 @@
/modules/services/network-manager-applet.nix @rycee
/modules/services/notify-osd.nix @imalison
/modules/services/pantalaimon.nix @jojosch
/tests/modules/services/pantalaimon @jojosch

View File

@@ -15,7 +15,7 @@ pull-request.
Also make sure to read the guidelines found at
https://github.com/nix-community/home-manager/blob/master/doc/contributing.adoc#sec-guidelines
https://github.com/nix-community/home-manager/blob/master/docs/contributing.adoc#sec-guidelines
-->
@@ -35,7 +35,7 @@ Also make sure to read the guidelines found at
{long description}
```
See [CONTRIBUTING](https://github.com/nix-community/home-manager/blob/master/doc/contributing.adoc#sec-commit-style) for more information and [recent commit messages](https://github.com/nix-community/home-manager/commits/master) for examples.
See [CONTRIBUTING](https://github.com/nix-community/home-manager/blob/master/docs/contributing.adoc#sec-commit-style) for more information and [recent commit messages](https://github.com/nix-community/home-manager/commits/master) for examples.
- If this PR adds a new module

View File

@@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v13
- uses: cachix/install-nix-action@v14
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v10

View File

@@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v13
- uses: cachix/install-nix-action@v14
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v10
@@ -20,4 +20,4 @@ jobs:
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- run: ./format -c
- run: nix-shell . -A install
- run: nix-shell --pure tests -A run.all
- run: nix-shell --arg enableBig false --pure tests -A run.all

View File

@@ -1 +0,0 @@
doc/contributing.adoc

View File

@@ -1 +0,0 @@
doc/faq.adoc

View File

@@ -107,9 +107,8 @@ Currently the easiest way to install Home Manager is as follows:
$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
```
file in your shell configuration. Unfortunately, in this specific
case we currently only support POSIX.2-like shells such as
[Bash][] or [Z shell][].
file in your shell configuration. This file can be sourced
directly by POSIX.2-like shells such as [Bash][] or [Z shell][].
For example, if you use Bash then add
@@ -124,7 +123,9 @@ Currently the easiest way to install Home Manager is as follows:
. "/etc/profiles/per-user/$USER/etc/profile.d/hm-session-vars.sh"
```
to your `~/.profile` file.
to your `~/.profile` file. For fish shell, it is possible to use
[foreign-env](https://github.com/oh-my-fish/plugin-foreign-env) to
source the file.
If instead of using channels you want to run Home Manager from a Git
checkout of the repository then you can use the

View File

@@ -1,7 +1,7 @@
{ pkgs ? import <nixpkgs> { } }:
rec {
docs = with import ./doc { inherit pkgs; }; {
docs = with import ./docs { inherit pkgs; }; {
html = manual.html;
manPages = manPages;
json = options.json;

View File

@@ -43,15 +43,21 @@ The solution is typically to uninstall the package from the environment using `n
You could also opt to unistall _all_ of the packages from your profile with `nix-env --uninstall '*'`.
=== Why are the session variables not set?
:foreign-env: https://github.com/oh-my-fish/plugin-foreign-env
Home Manager is only able to set session variables automatically if it manages your Bash or Z shell configuration. If you don't want to let Home Manager manage your shell then you will have to manually source the `~/.nix-profile/etc/profile.d/hm-session-vars.sh` file in an appropriate way. In Bash and Z shell this can be done by adding
Home Manager is only able to set session variables automatically if it manages your Bash, Z shell, or fish shell configuration. If you don't want to let Home Manager manage your shell then you will have to manually source the `~/.nix-profile/etc/profile.d/hm-session-vars.sh` file in an appropriate way. In Bash and Z shell this can be done by adding
[source,bash]
----
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
----
to your `.profile` and `.zshrc` files, respectively. The `hm-session-vars.sh` file should work in most Bourne-like shells.
to your `.profile` and `.zshrc` files, respectively. The `hm-session-vars.sh` file should work in most Bourne-like shells. For fish shell, it is possible to source it using {foreign-env}[the foreign-env plugin]
[source,bash]
----
fenv source "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" > /dev/null
----
=== How to set up a configuration for multiple users/machines?
:post-your-homenix: https://www.reddit.com/r/NixOS/comments/9bb9h9/post_your_homemanager_homenix_file/
@@ -94,7 +100,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; [ gnome.dconf ];
programs.dconf.enable = true;
to your system configuration.

View File

@@ -86,7 +86,7 @@ file in your shell configuration. Alternatively source
+
when managing home configuration together with system configuration.
+
Unfortunately, we currently only support POSIX.2-like shells such as
This file can be sourced directly by POSIX.2-like shells such as
https://www.gnu.org/software/bash/[Bash] or
http://zsh.sourceforge.net/[Z shell].
+
@@ -97,7 +97,9 @@ For example, if you use Bash then add
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
----
+
to your `~/.profile` file.
to your `~/.profile` file. For fish shell, it is possible to use
https://github.com/oh-my-fish/plugin-foreign-env[foreign-env] to
source the file.
If instead of using channels you want to run Home Manager from a Git
checkout of the repository then you can use the
@@ -224,6 +226,10 @@ For example, a nix-darwin configuration may include the lines
[source,nix]
----
users.users.eve = {
name = "eve";
home = "/Users/eve";
}
home-manager.users.eve = { pkgs, ... }: {
home.packages = [ pkgs.atool pkgs.httpie ];
programs.bash.enable = true;

View File

@@ -139,6 +139,10 @@
--debug
</arg>
<arg>
--impure
</arg>
<arg>
--keep-failed
</arg>
@@ -155,6 +159,10 @@
--(no-)substitute
</arg>
<arg>
--no-out-link
</arg>
<arg>
<group choice="req">
<arg choice="plain">
@@ -488,6 +496,18 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--impure</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>
@@ -536,6 +556,19 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--no-out-link</option>
</term>
<listitem>
<para>
Passed on to <citerefentry>
<refentrytitle>nix-build</refentrytitle>
<manvolnum>1</manvolnum> </citerefentry>
when running <command>home-manager build</command>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-v</option>

View File

@@ -9,7 +9,7 @@
<preface>
<title>Preface</title>
<para>
This manual will eventually describes how to install, use, and extend Home
This manual will eventually describe how to install, use, and extend Home
Manager.
</para>
<para>

View File

@@ -18,9 +18,14 @@
darwinModules.home-manager = import ./nix-darwin;
darwinModule = self.darwinModules.home-manager;
packages = forAllSystems (system: {
home-manager = nixpkgsFor.${system}.callPackage ./home-manager { };
});
packages = forAllSystems (system:
let docs = import ./docs { pkgs = nixpkgsFor.${system}; };
in {
home-manager = nixpkgsFor.${system}.callPackage ./home-manager { };
docs-html = docs.manual.html;
docs-manpages = docs.manPages;
docs-json = docs.options.json;
});
defaultPackage =
forAllSystems (system: self.packages.${system}.home-manager);

2
format
View File

@@ -1,5 +1,5 @@
#! /usr/bin/env nix-shell
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/05f0934825c2a0750d4888c4735f9420c906b388.tar.gz -i bash -p findutils nixfmt
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/5edf5b60c3d8f82b5fc5e73e822b6f7460584945.tar.gz -i bash -p findutils nixfmt
CHECK_ARG=

View File

@@ -290,8 +290,10 @@ _home-manager_completions ()
#--------------------------#
local Options
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")
Options=( "-f" "--file" "-b" "-A" "-I" "-h" "--help" "-n" "--dry-run" "-v" \
"--verbose" "--cores" "--debug" "--impure" "--keep-failed" \
"--keep-going" "-j" "--max-jobs" "--no-substitute" "--no-out-link" \
"--show-trace" "--substitute" "--builders")
# ^ « home-manager »'s options.

View File

@@ -53,10 +53,13 @@ complete -c home-manager -x -l "arg" -d "Override inputs passed to home-manager.
complete -c home-manager -x -l "argstr" -d "Like --arg but the value is a string"
complete -c home-manager -x -l "cores" -d "Threads per job (e.g. -j argument to make)"
complete -c home-manager -x -l "debug"
complete -c home-manager -x -l "impure"
complete -c home-manager -f -l "keep-failed" -d "Keep temporary directory used by failed builds"
complete -c home-manager -f -l "keep-going" -d "Keep going in case of failed builds"
complete -c home-manager -x -s j -l "max-jobs" -d "Max number of build jobs in parallel"
complete -c home-manager -x -l "option" -d "Set Nix configuration option"
complete -c home-manager -x -l "builders" -d "Remote builders"
complete -c home-manager -f -l "show-trace" -d "Print stack trace of evaluation errors"
complete -c home-manager -f -l "substitute"
complete -c home-manager -f -l "no-substitute"
complete -c home-manager -f -l "no-out-link"

View File

@@ -8,6 +8,7 @@ _arguments \
'-b[backup files]:EXT:()' \
'--cores[cores]:NUM:()' \
'--debug[debug]' \
'--impure[impure]' \
'--keep-failed[keep failed]' \
'--keep-going[keep going]' \
'(-h --help)'{--help,-h}'[help]' \
@@ -16,6 +17,7 @@ _arguments \
'(-f --file)'{--file,-f}'[configuration file]:FILE:_files' \
'(-j --max-jobs)'{--max-jobs,-j}'[max jobs]:NUM:()' \
'--option[option]:NAME VALUE:()' \
'--builders[builders]:SPEC:()' \
'--show-trace[show trace]' \
'1: :->cmds' \
'*:: :->args' && ret=0
@@ -45,13 +47,16 @@ case "$state" in
_arguments \
'--cores[cores]:NUM:()' \
'--debug[debug]' \
'--impure[impure]' \
'--keep-failed[keep failed]' \
'--keep-going[keep going]' \
'--max-jobs[max jobs]:NUM:()' \
'--no-out-link[no out link]' \
'--no-substitute[no substitute]' \
'--option[option]:NAME VALUE:()' \
'--show-trace[show trace]' \
'--substitute[substitute]'
'--substitute[substitute]' \
'--builders[builders]:SPEC:()'
;;
esac
esac

View File

@@ -252,6 +252,7 @@ function doBuild() {
nix build \
"${PASSTHROUGH_OPTS[@]}" \
${DRY_RUN+--dry-run} \
${NO_OUT_LINK+--no-out-link} \
"$FLAKE_CONFIG_URI.activationPackage" \
|| exitCode=1
return $exitCode
@@ -263,8 +264,9 @@ function doBuild() {
newsInfo=$(buildNews)
local exitCode
doBuildAttr --attr activationPackage \
doBuildAttr \
${NO_OUT_LINK+--no-out-link} \
--attr activationPackage \
&& exitCode=0 || exitCode=1
presentNews "$newsInfo"
@@ -514,12 +516,15 @@ function doHelp() {
echo " --arg(str) NAME VALUE Override inputs passed to home-manager.nix"
echo " --cores NUM"
echo " --debug"
echo " --impure"
echo " --keep-failed"
echo " --keep-going"
echo " -j, --max-jobs NUM"
echo " --option NAME VALUE"
echo " --show-trace"
echo " --(no-)substitute"
echo " --no-out-link Do not create a symlink to the output path"
echo " --builders VALUE"
echo
echo "Commands"
echo
@@ -601,6 +606,9 @@ while [[ $# -gt 0 ]]; do
PASSTHROUGH_OPTS+=("$opt" "$1" "$2")
shift 2
;;
--no-out-link)
NO_OUT_LINK=1
;;
-h|--help)
doHelp
exit 0
@@ -612,12 +620,12 @@ while [[ $# -gt 0 ]]; do
PASSTHROUGH_OPTS+=("$opt" "$1" "$2")
shift 2
;;
-j|--max-jobs|--cores)
-j|--max-jobs|--cores|--builders)
PASSTHROUGH_OPTS+=("$opt" "$1")
shift
;;
--debug|--keep-failed|--keep-going|--show-trace\
|--substitute|--no-substitute)
|--substitute|--no-substitute|--impure)
PASSTHROUGH_OPTS+=("$opt")
;;
-v|--verbose)
@@ -695,3 +703,5 @@ case $COMMAND in
exit 1
;;
esac
# vim: ft=bash

View File

@@ -71,7 +71,7 @@ let
};
certificatesFile = mkOption {
type = types.path;
type = types.nullOr types.path;
default = config.accounts.email.certificatesFile;
defaultText = "config.accounts.email.certificatesFile";
description = ''
@@ -354,7 +354,7 @@ let
in {
options.accounts.email = {
certificatesFile = mkOption {
type = types.path;
type = types.nullOr types.path;
default = "/etc/ssl/certs/ca-certificates.crt";
description = ''
Path to default file containing certificate authorities that

View File

@@ -106,7 +106,12 @@ in
$VERBOSE_ECHO "Skipping collision check for $targetPath"
elif [[ -e "$targetPath" \
&& ! "$(readlink "$targetPath")" == $homeFilePattern ]] ; then
if [[ ! -L "$targetPath" && -n "$HOME_MANAGER_BACKUP_EXT" ]] ; then
# The target file already exists and it isn't a symlink owned by Home Manager.
if cmp -s $sourcePath $targetPath; then
# First compare the files' content. If they're equal, we're fine.
warnEcho "Existing file '$targetPath' is in the way of '$sourcePath', will be skipped since they are the same"
elif [[ ! -L "$targetPath" && -n "$HOME_MANAGER_BACKUP_EXT" ]] ; then
# Next, try to move the file to a backup location if configured and possible
backup="$targetPath.$HOME_MANAGER_BACKUP_EXT"
if [[ -e "$backup" ]]; then
errorEcho "Existing file '$backup' would be clobbered by backing up '$targetPath'"
@@ -115,6 +120,7 @@ in
warnEcho "Existing file '$targetPath' is in the way of '$sourcePath', will be moved to '$backup'"
fi
else
# Fail if nothing else works
errorEcho "Existing file '$targetPath' is in the way of '$sourcePath'"
collision=1
fi
@@ -122,7 +128,7 @@ in
done
if [[ -v collision ]] ; then
errorEcho "Please move the above files and try again or use -b <ext> to move automatically."
errorEcho "Please move the above files and try again or use 'home-manager switch -b backup' to back up existing files automatically."
exit 1
fi
'';
@@ -169,11 +175,19 @@ in
relativePath="''${sourcePath#$newGenFiles/}"
targetPath="$HOME/$relativePath"
if [[ -e "$targetPath" && ! -L "$targetPath" && -n "$HOME_MANAGER_BACKUP_EXT" ]] ; then
# The target exists, back it up
backup="$targetPath.$HOME_MANAGER_BACKUP_EXT"
$DRY_RUN_CMD mv $VERBOSE_ARG "$targetPath" "$backup" || errorEcho "Moving '$targetPath' failed!"
fi
$DRY_RUN_CMD mkdir -p $VERBOSE_ARG "$(dirname "$targetPath")"
$DRY_RUN_CMD ln -nsf $VERBOSE_ARG "$sourcePath" "$targetPath"
if [[ -e "$targetPath" && ! -L "$targetPath" ]] && cmp -s $sourcePath $targetPath ; then
# The target exists but is identical don't do anything.
$VERBOSE_ECHO "Skipping '$targetPath' as it is identical to '$sourcePath'"
else
# Place that symlink, --force
$DRY_RUN_CMD mkdir -p $VERBOSE_ARG "$(dirname "$targetPath")"
$DRY_RUN_CMD ln -nsf $VERBOSE_ARG "$sourcePath" "$targetPath"
fi
done
'';
@@ -284,8 +298,13 @@ in
home.activation.onFilesChange = hm.dag.entryAfter ["linkGeneration"] (
concatMapStrings (v: ''
if [[ ''${changedFiles[${escapeShellArg v.target}]} -eq 1 ]]; then
${v.onChange}
if (( ''${changedFiles[${escapeShellArg v.target}]} == 1 )); then
if [[ -v DRY_RUN || -v VERBOSE ]]; then
echo "Running onChange hook for" ${escapeShellArg v.target}
fi
if [[ ! -v DRY_RUN ]]; then
${v.onChange}
fi
fi
'') (filter (v: v.onChange != "") (attrValues cfg))
);

View File

@@ -5,9 +5,9 @@ function setupVars() {
local profilesPath="$nixStateDir/profiles/per-user/$USER"
local gcPath="$nixStateDir/gcroots/per-user/$USER"
genProfilePath="$profilesPath/home-manager"
newGenPath="@GENERATION_DIR@";
newGenGcPath="$gcPath/current-home"
declare -gr genProfilePath="$profilesPath/home-manager"
declare -gr newGenPath="@GENERATION_DIR@";
declare -gr newGenGcPath="$gcPath/current-home"
local greatestGenNum
greatestGenNum=$( \
@@ -16,14 +16,15 @@ function setupVars() {
| sed -E 's/ *([[:digit:]]+) .*/\1/')
if [[ -n $greatestGenNum ]] ; then
oldGenNum=$greatestGenNum
newGenNum=$((oldGenNum + 1))
declare -gr oldGenNum=$greatestGenNum
declare -gr newGenNum=$((oldGenNum + 1))
else
newGenNum=1
declare -gr newGenNum=1
fi
if [[ -e $profilesPath/home-manager ]] ; then
oldGenPath="$(readlink -e "$profilesPath/home-manager")"
declare -gr oldGenPath
fi
$VERBOSE_ECHO "Sanity checking oldGenNum and oldGenPath"

View File

@@ -71,6 +71,8 @@ in rec {
inherit type typeOf;
isGVariant = v: v._type or "" == "gvariant";
isArray = hasPrefix "a";
isMaybe = hasPrefix "m";
isTuple = hasPrefix "(";
@@ -122,8 +124,9 @@ in rec {
};
mkString = v:
mkPrimitive type.string v // {
__toString = self: "'${escape [ "'" "\\" ] self.value}'";
let sanitize = s: replaceStrings [ "\n" ] [ "\\n" ] (escape [ "'" "\\" ] s);
in mkPrimitive type.string v // {
__toString = self: "'${sanitize self.value}'";
};
mkObjectpath = v:

View File

@@ -121,4 +121,10 @@
githubId = 5646732;
name = "Andreas Mager";
};
bjpbakker = {
email = "bart@thesoftwarecraft.com";
github = "bjpbakker";
githubId = 605641;
name = "Bart Bakker";
};
}

View File

@@ -70,7 +70,11 @@ in rec {
check = v: gvar.mkValue v != null;
merge = loc: defs:
let
vdefs = map (d: d // { value = gvar.mkValue d.value; }) defs;
vdefs = map (d:
d // {
value =
if gvar.isGVariant d.value then d.value else gvar.mkValue d.value;
}) defs;
vals = map (d: d.value) vdefs;
defTypes = map (x: x.type) vals;
sameOrNull = x: y: if x == y then y else null;
@@ -82,8 +86,10 @@ in rec {
+ " mismatched GVariant types given in"
+ " ${showFiles (getFiles defs)}.")
else if gvar.isArray sharedDefType && allChecked then
(types.listOf gvariant).merge loc
(map (d: d // { value = d.value.value; }) vdefs)
gvar.mkValue ((types.listOf gvariant).merge loc
(map (d: d // { value = d.value.value; }) vdefs)) // {
type = sharedDefType;
}
else if gvar.isTuple sharedDefType && allChecked then
mergeOneOption loc defs
else if gvar.isMaybe sharedDefType && allChecked then

View File

@@ -6,7 +6,7 @@ let
cfg = config.manual;
docs = import ../doc { inherit lib pkgs; };
docs = import ../docs { inherit lib pkgs; };
in

View File

@@ -2149,6 +2149,60 @@ in
A new module is available: 'services.trayer'.
'';
}
{
time = "2021-07-19T01:30:46+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.notify-osd'.
'';
}
{
time = "2021-08-10T21:28:40+00:00";
message = ''
A new module is available: 'programs.java'.
'';
}
{
time = "2021-08-11T13:55:51+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.easyeffects'.
'';
}
{
time = "2021-08-16T21:59:02+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.git-sync'.
'';
}
{
time = "2021-08-26T06:40:59+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.fnott'.
'';
}
{
time = "2021-08-31T18:44:26+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.betterlockscreen'.
'';
}
{
time = "2021-09-14T21:31:03+00:00";
message = ''
A new module is available: 'programs.bottom'.
'';
}
];
};
}

View File

@@ -15,7 +15,7 @@ let
defaultConfigHome = "${config.home.homeDirectory}/.config";
defaultDataHome = "${config.home.homeDirectory}/.local/share";
getXdgDir = name: fallback:
getEnvFallback = name: fallback:
let value = builtins.getEnv name;
in if value != "" then value else fallback;
@@ -26,6 +26,7 @@ in {
cacheHome = mkOption {
type = types.path;
defaultText = "~/.cache";
apply = toString;
description = ''
Absolute path to directory holding application caches.
'';
@@ -43,6 +44,7 @@ in {
configHome = mkOption {
type = types.path;
defaultText = "~/.config";
apply = toString;
description = ''
Absolute path to directory holding application configurations.
'';
@@ -60,6 +62,7 @@ in {
dataHome = mkOption {
type = types.path;
defaultText = "~/.local/share";
apply = toString;
description = ''
Absolute path to directory holding application data.
'';
@@ -81,9 +84,11 @@ in {
# Legacy non-deterministic setup.
(mkIf (!cfg.enable && versionOlder config.home.stateVersion "20.09") {
xdg.cacheHome = getXdgDir "XDG_CACHE_HOME" defaultCacheHome;
xdg.configHome = getXdgDir "XDG_CONFIG_HOME" defaultConfigHome;
xdg.dataHome = getXdgDir "XDG_DATA_HOME" defaultDataHome;
xdg.cacheHome =
mkDefault (getEnvFallback "XDG_CACHE_HOME" defaultCacheHome);
xdg.configHome =
mkDefault (getEnvFallback "XDG_CONFIG_HOME" defaultConfigHome);
xdg.dataHome = mkDefault (getEnvFallback "XDG_DATA_HOME" defaultDataHome);
})
# "Modern" deterministic setup.
@@ -95,13 +100,11 @@ in {
{
home.file = mkMerge [
(mapAttrs'
(name: file: nameValuePair "${config.xdg.configHome}/${name}" file)
(mapAttrs' (name: file: nameValuePair "${cfg.configHome}/${name}" file)
cfg.configFile)
(mapAttrs'
(name: file: nameValuePair "${config.xdg.dataHome}/${name}" file)
(mapAttrs' (name: file: nameValuePair "${cfg.dataHome}/${name}" file)
cfg.dataFile)
{ "${config.xdg.cacheHome}/.keep".text = ""; }
{ "${cfg.cacheHome}/.keep".text = ""; }
];
}
];

View File

@@ -50,6 +50,7 @@ let
./programs/bash.nix
./programs/bat.nix
./programs/beets.nix
./programs/bottom.nix
./programs/broot.nix
./programs/browserpass.nix
./programs/chromium.nix
@@ -77,6 +78,7 @@ let
./programs/i3status.nix
./programs/info.nix
./programs/irssi.nix
./programs/java.nix
./programs/jq.nix
./programs/kakoune.nix
./programs/keychain.nix
@@ -147,6 +149,7 @@ let
./programs/zsh.nix
./programs/zsh/prezto.nix
./services/barrier.nix
./services/betterlockscreen.nix
./services/blueman-applet.nix
./services/caffeine.nix
./services/cbatticon.nix
@@ -156,11 +159,14 @@ let
./services/dropbox.nix
./services/dunst.nix
./services/dwm-status.nix
./services/easyeffects.nix
./services/emacs.nix
./services/etesync-dav.nix
./services/flameshot.nix
./services/fluidsynth.nix
./services/fnott.nix
./services/getmail.nix
./services/git-sync.nix
./services/gnome-keyring.nix
./services/gpg-agent.nix
./services/grobi.nix
@@ -182,6 +188,7 @@ let
./services/muchsync.nix
./services/network-manager-applet.nix
./services/nextcloud-client.nix
./services/notify-osd.nix
./services/owncloud-client.nix
./services/pantalaimon.nix
./services/parcellite.nix
@@ -206,9 +213,9 @@ let
./services/sxhkd.nix
./services/syncthing.nix
./services/taffybar.nix
./services/trayer.nix
./services/tahoe-lafs.nix
./services/taskwarrior-sync.nix
./services/trayer.nix
./services/udiskie.nix
./services/unclutter.nix
./services/unison.nix

View File

@@ -22,9 +22,9 @@ let
sendmail = astroid.sendMailCommand;
additional_sent_tags = "";
default = boolOpt primary;
save_drafts_to = "${maildir.absPath}/${folders.drafts}";
save_drafts_to = "${maildir.absPath}/${folders.drafts}/cur/";
save_sent = "true";
save_sent_to = "${maildir.absPath}/${folders.sent}";
save_sent_to = "${maildir.absPath}/${folders.sent}/cur/";
select_query = "";
} // optionalAttrs (signature.showSignature != "none") {
signature_attach = boolOpt (signature.showSignature == "attach");

View File

@@ -75,7 +75,14 @@ in
# Warn if closing shell with running jobs.
"checkjobs"
];
description = "Shell options to set.";
example = [
"extglob"
"-cdspell"
];
description = ''
Shell options to set. Prefix an option with
<quote><literal>-</literal></quote> to unset.
'';
};
sessionVariables = mkOption {
@@ -146,8 +153,10 @@ in
mapAttrsToList (k: v: "alias ${k}=${escapeShellArg v}") cfg.shellAliases
);
shoptsStr = concatStringsSep "\n" (
map (v: "shopt -s ${v}") cfg.shellOptions
shoptsStr = let
switch = v: if hasPrefix "-" v then "-u" else "-s";
in concatStringsSep "\n" (
map (v: "shopt ${switch v} ${removePrefix "-" v}") cfg.shellOptions
);
sessionVarsStr = config.lib.shell.exportAll cfg.sessionVariables;

View File

@@ -6,6 +6,11 @@ let
cfg = config.programs.bat;
toConfigFile = generators.toKeyValue {
mkKeyValue = k: v: "--${k}=${lib.escapeShellArg v}";
listsAsDuplicateKeys = true;
};
in {
meta.maintainers = [ maintainers.marsam ];
@@ -13,11 +18,12 @@ in {
enable = mkEnableOption "bat, a cat clone with wings";
config = mkOption {
type = types.attrsOf types.str;
type = with types; attrsOf (either str (listOf str));
default = { };
example = {
theme = "TwoDark";
pager = "less -FR";
map-syntax = [ "*.jenkinsfile:Groovy" "*.props:Java Properties" ];
};
description = ''
Bat configuration.
@@ -48,10 +54,8 @@ in {
home.packages = [ pkgs.bat ];
xdg.configFile = mkMerge ([{
"bat/config" = mkIf (cfg.config != { }) {
text = concatStringsSep "\n"
(mapAttrsToList (n: v: ''--${n}="${v}"'') cfg.config);
};
"bat/config" =
mkIf (cfg.config != { }) { text = toConfigFile cfg.config; };
}] ++ flip mapAttrsToList cfg.themes
(name: body: { "bat/themes/${name}.tmTheme" = { text = body; }; }));
};

View File

@@ -0,0 +1,66 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.bottom;
tomlFormat = pkgs.formats.toml { };
configDir = if pkgs.stdenv.isDarwin then
"Library/Application Support"
else
config.xdg.configHome;
in {
options = {
programs.bottom = {
enable = mkEnableOption ''
bottom, a cross-platform graphical process/system monitor with a
customizable interface'';
package = mkOption {
type = types.package;
default = pkgs.bottom;
defaultText = literalExample "pkgs.bottom";
description = "Package providing <command>bottom</command>.";
};
settings = mkOption {
type = tomlFormat.type;
default = { };
description = ''
Configuration written to
<filename>$XDG_CONFIG_HOME/bottom/bottom.toml</filename> on Linux or
<filename>$HOME/Library/Application Support/bottom/bottom.toml</filename> on Darwin.
</para><para>
See <link xlink:href="https://github.com/ClementTsang/bottom/blob/master/sample_configs/default_config.toml"/>
for the default configuration.
'';
example = literalExample ''
{
flags = {
avg_cpu = true;
temperature_type = "c";
};
colors = {
low_battery_color = "red";
};
}
'';
};
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
home.file."${configDir}/bottom/bottom.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "bottom.toml" cfg.settings;
};
};
meta.maintainers = [ maintainers.polykernel ];
}

View File

@@ -11,6 +11,7 @@ let
brootConf = {
verbs = cfg.verbs;
skin = cfg.skin;
modal = cfg.modal;
};
in {
@@ -43,6 +44,8 @@ in {
'';
};
modal = mkEnableOption "modal (vim) mode";
verbs = mkOption {
type = with types; listOf (attrsOf (either bool str));
default = [

View File

@@ -6,13 +6,15 @@ let
cfg = config.programs.emacs;
# Copied from all-packages.nix, with modifications to support
# overrides.
emacsPackages = let epkgs = pkgs.emacsPackagesFor cfg.package;
in epkgs.overrideScope' cfg.overrides;
emacsPackages = cfg.package.pkgs.overrideScope' cfg.overrides;
emacsWithPackages = emacsPackages.emacsWithPackages;
createConfPackage = epkgs:
epkgs.trivialBuild {
pname = "default";
src = pkgs.writeText "default.el" cfg.extraConfig;
};
in {
meta.maintainers = [ maintainers.rycee ];
@@ -28,6 +30,23 @@ in {
description = "The Emacs package to use.";
};
# NOTE: The config is placed in default.el instead of ~/.emacs.d so that
# it won't conflict with Emacs configuration frameworks. Users of these
# frameworks would still benefit from this option as it would easily allow
# them to have Nix-computed paths in their configuration.
extraConfig = mkOption {
type = types.lines;
default = "";
example = ''
(setq standard-indent 2)
'';
description = ''
Configuration to include in the Emacs default init file. See
<link xlink:href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Init-File.html"/>
for more.
'';
};
extraPackages = mkOption {
default = self: [ ];
type = hm.types.selectorFunction;
@@ -68,6 +87,10 @@ in {
config = mkIf cfg.enable {
home.packages = [ cfg.finalPackage ];
programs.emacs.finalPackage = emacsWithPackages cfg.extraPackages;
programs.emacs = {
finalPackage = emacsWithPackages cfg.extraPackages;
extraPackages = epkgs:
optional (cfg.extraConfig != "") (createConfPackage epkgs);
};
};
}

View File

@@ -164,8 +164,8 @@ in {
default = { };
example = literalExample ''
{
ll = "ls -l";
".." = "cd ..";
g = "git";
"..." = "cd ../..";
}
'';
description = ''

View File

@@ -108,8 +108,26 @@ let
contents = mkOption {
type = types.attrsOf types.anything;
default = { };
example = literalExample ''
{
user = {
email = "bob@work.example.com";
name = "Bob Work";
signingKey = "1A2B3C4D5E6F7G8H";
};
commit = {
gpgSign = true;
};
};
'';
description = ''
Configuration to include. If empty then a path must be given.
This follows the configuration structure as described in
<citerefentry>
<refentrytitle>git-config</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>.
'';
};
};
@@ -295,7 +313,8 @@ in {
"ssl")
else
"";
smtpSslCertPath = mkIf smtp.tls.enable smtp.tls.certificatesFile;
smtpSslCertPath =
mkIf smtp.tls.enable (toString smtp.tls.certificatesFile);
smtpServer = smtp.host;
smtpUser = userName;
from = address;

View File

@@ -10,14 +10,10 @@ let
let v' = if isBool v then (if v then "1" else "0") else toString v;
in "${n}=${v'}";
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';
};
formatMeters = side: meters: {
"${side}_meters" = concatMap (mapAttrsToList (x: _: x)) meters;
"${side}_meter_modes" = concatMap (mapAttrsToList (_: y: y)) meters;
};
leftMeters = formatMeters "left";
rightMeters = formatMeters "right";
@@ -92,168 +88,15 @@ let
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;
Hostname = 2;
AllCPUs = 1;
AllCPUs2 = 1;
AllCPUs4 = 1;
AllCPUs8 = 1;
LeftCPUs = 1;
RightCPUs = 1;
Right = 1;
CPUs = 1;
LeftCPUs2 = 1;
RightCPUs2 = 1;
LeftCPUs4 = 1;
RightCPUs4 = 1;
LeftCPUs8 = 1;
RightCPUs8 = 1;
Blank = 2;
PressureStallCPUSome = 2;
PressureStallIOSome = 2;
PressureStallIOFull = 2;
PressureStallMemorySome = 2;
PressureStallMemoryFull = 2;
ZFSARC = 2;
ZFSCARC = 2;
CPU = 1;
"CPU(1)" = 1;
"CPU(2)" = 1;
"CPU(3)" = 1;
"CPU(4)" = 1;
"CPU(5)" = 1;
"CPU(6)" = 1;
"CPU(7)" = 1;
"CPU(8)" = 1;
SELinux = 2;
Systemd = 2;
DiskIO = 2;
NetworkIO = 2;
};
singleMeterType = let
meterEnum = types.enum (attrNames meters);
meterSubmodule = types.submodule {
options = {
kind = mkOption {
type = types.enum (attrNames meters);
example = "AllCPUs";
description = "What kind of meter.";
};
mode = mkOption {
type = types.enum [ 1 2 3 4 ];
example = 2;
description =
"Which mode the meter should use, one of 1(Bar) 2(Text) 3(Graph) 4(LED).";
};
};
};
in types.coercedTo meterEnum (m: {
kind = m;
mode = meters.${m};
}) meterSubmodule;
meterType = types.submodule {
options = {
left = mkOption {
description = "Meters shown in the left header.";
default = [ "AllCPUs" "Memory" "Swap" ];
example = [
"Memory"
"LeftCPUs2"
"RightCPUs2"
{
kind = "CPU";
mode = 3;
}
];
type = types.listOf singleMeterType;
};
right = mkOption {
description = "Meters shown in the right header.";
default = [ "Tasks" "LoadAverage" "Uptime" ];
example = [
{
kind = "Clock";
mode = 4;
}
"Uptime"
"Tasks"
];
type = types.listOf singleMeterType;
};
};
};
in {
meta.maintainers = [ maintainers.bjpbakker ];
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")
]);
default = { };
example = literalExample ''
{
color_scheme = 6;
@@ -291,300 +134,6 @@ in {
description = ''
Configuration options to add to
<filename>~/.config/htop/htoprc</filename>.
This superseedes any other (deprecated) settings in this module.
'';
};
fields = mkOption {
type = types.nullOr (types.listOf (types.enum (attrNames fields)));
default = null;
example = [
"PID"
"USER"
"PRIORITY"
"PERCENT_CPU"
"M_RESIDENT"
"PERCENT_MEM"
"TIME"
"COMM"
];
description = ''
Deprecated. Please use programs.htop.settings.fields instead.
Active fields shown in the table.
'';
};
sortKey = mkOption {
type = types.nullOr (types.enum (attrNames fields));
default = null;
example = "TIME";
description = ''
Deprecated. Please use programs.htop.settings.sort_key instead.
Which field to use for sorting.
'';
};
sortDescending = mkOption {
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.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.hide_threads instead.
Hide threads.
'';
};
hideKernelThreads = mkOption {
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.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.hide_userland_threads instead.
Hide userland process threads.
'';
};
shadowOtherUsers = mkOption {
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.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.show_thread_names instead.
Show custom thread names.
'';
};
showProgramPath = mkOption {
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.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.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.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.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.tree_view instead.
Tree view.
'';
};
headerMargin = mkOption {
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.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.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.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.show_cpu_usage instead.
Show CPU usage frequency.
'';
};
showCpuFrequency = mkOption {
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.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.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.nullOr (types.enum [ 0 1 2 3 4 5 6 ]);
default = null;
example = 6;
description = ''
Deprecated. Please use programs.htop.settings.color_scheme instead.
Which color scheme to use.
'';
};
enableMouse = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.enable_mouse instead.
Enable mouse support.
'';
};
delay = mkOption {
type = types.nullOr types.int;
default = null;
example = 2;
description = ''
Deprecated. Please use programs.htop.settings.delay instead.
Set the delay between updates, in tenths of seconds.
'';
};
meters = mkOption {
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"
"CPU"
"LeftCPUs2"
"RightCPUs2"
{
kind = "CPU";
mode = 3;
}
];
right = [
{
kind = "Clock";
mode = 4;
}
"Uptime"
"Tasks"
"LoadAverage"
{
kind = "Battery";
mode = 1;
}
];
};
type = types.nullOr meterType;
};
vimMode = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Deprecated. Please use programs.htop.settings.vim_mode instead.
Vim key bindings.
'';
};
};
@@ -596,72 +145,27 @@ in {
home.packages = [ pkgs.htop ];
xdg.configFile."htop/htoprc".text = let
xdg.configFile."htop/htoprc" = let
defaults = {
fields = with fields; [
PID
USER
PRIORITY
NICE
M_SIZE
M_RESIDENT
M_SHARE
STATE
PERCENT_CPU
PERCENT_MEM
TIME
COMM
];
};
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));
settings' = cfg.settings // (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 settings');
in mkIf (cfg.settings != { }) {
text = concatStringsSep "\n"
(mapAttrsToList formatOption (defaults // cfg.settings)) + "\n";
};
};
}

View File

@@ -6,14 +6,6 @@ let
cfg = config.programs.i3status-rust;
restartI3 = ''
i3Socket=''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.*
if [ -S $i3Socket ]; then
echo "Reloading i3"
$DRY_RUN_CMD ${config.xsession.windowManager.i3.package}/bin/i3-msg -s $i3Socket restart 1>/dev/null
fi
'';
settingsFormat = pkgs.formats.toml { };
in {
@@ -258,7 +250,12 @@ in {
xdg.configFile = mapAttrs' (cfgFileSuffix: cfg:
nameValuePair ("i3status-rust/config-${cfgFileSuffix}.toml") ({
onChange = mkIf config.xsession.windowManager.i3.enable restartI3;
onChange = mkIf config.xsession.windowManager.i3.enable ''
i3Socket="''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.*"
if [[ -S $i3Socket ]]; then
${config.xsession.windowManager.i3.package}/bin/i3-msg -s $i3Socket restart >/dev/null
fi
'';
source = settingsFormat.generate ("config-${cfgFileSuffix}.toml") ({
theme = cfg.theme;

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

@@ -25,10 +25,26 @@ let
mkKeyValue = key: command: "map ${key} ${command}";
};
toKittyEnv =
generators.toKeyValue { mkKeyValue = name: value: "env ${name}=${value}"; };
in {
options.programs.kitty = {
enable = mkEnableOption "Kitty terminal emulator";
darwinLaunchOptions = mkOption {
type = types.nullOr (types.listOf types.str);
default = null;
description = "Command-line options to use when launched by Mac OS GUI";
example = literalExample ''
[
"--single-instance"
"--directory=/tmp/my-dir"
"--listen-on=unix:/tmp/my-socket"
]
'';
};
settings = mkOption {
type = types.attrsOf eitherStrBoolInt;
default = { };
@@ -65,6 +81,17 @@ in {
'';
};
environment = mkOption {
type = types.attrsOf types.str;
default = { };
description = "Environment variables to set or override.";
example = literalExample ''
{
"LS_COLORS" = "1";
}
'';
};
extraConfig = mkOption {
default = "";
type = types.lines;
@@ -73,6 +100,14 @@ in {
};
config = mkIf cfg.enable {
assertions = [{
assertion = (cfg.darwinLaunchOptions != null)
-> pkgs.stdenv.hostPlatform.isDarwin;
message = ''
The 'programs.kitty.darwinLaunchOptions' option is only available on darwin.
'';
}];
home.packages = [ pkgs.kitty ] ++ optionalPackage cfg.font;
xdg.configFile."kitty/kitty.conf".text = ''
@@ -89,7 +124,14 @@ in {
${toKittyKeybindings cfg.keybindings}
${toKittyEnv cfg.environment}
${cfg.extraConfig}
'';
xdg.configFile."kitty/macos-launch-services-cmdline" =
mkIf (cfg.darwinLaunchOptions != null) {
text = concatStringsSep " " cfg.darwinLaunchOptions;
};
};
}

View File

@@ -1,69 +0,0 @@
{ lib, ... }:
with lib;
{
options.lieer = {
enable = mkEnableOption "lieer Gmail synchronization for notmuch";
timeout = mkOption {
type = types.ints.unsigned;
default = 0;
description = ''
HTTP timeout in seconds. 0 means forever or system timeout.
'';
};
replaceSlashWithDot = mkOption {
type = types.bool;
default = false;
description = ''
Replace '/' with '.' in Gmail labels.
'';
};
dropNonExistingLabels = mkOption {
type = types.bool;
default = false;
description = ''
Allow missing labels on the Gmail side to be dropped.
'';
};
ignoreTagsLocal = mkOption {
type = types.listOf types.str;
default = [ ];
description = ''
Set custom tags to ignore when syncing from local to
remote (after translations).
'';
};
ignoreTagsRemote = mkOption {
type = types.listOf types.str;
default = [
"CATEGORY_FORUMS"
"CATEGORY_PROMOTIONS"
"CATEGORY_UPDATES"
"CATEGORY_SOCIAL"
"CATEGORY_PERSONAL"
];
description = ''
Set custom tags to ignore when syncing from remote to
local (before translations).
'';
};
notmuchSetupWarning = mkOption {
type = types.bool;
default = true;
description = ''
Warn if Notmuch is not also enabled for this account.
</para><para>
This can safely be disabled if <command>notmuch init</command>
has been used to configure this account outside of Home
Manager.
'';
};
};
}

View File

@@ -23,30 +23,231 @@ let
map (name: "accounts.email.accounts.${name}.notmuch.enable = true;")
missingNotmuchAccounts;
settingsFormat = pkgs.formats.json { };
configFile = account: {
name = "${account.maildir.absPath}/.gmailieer.json";
value = {
text = builtins.toJSON {
inherit (account.lieer) timeout;
account = account.address;
replace_slash_with_dot = account.lieer.replaceSlashWithDot;
drop_non_existing_label = account.lieer.dropNonExistingLabels;
ignore_tags = account.lieer.ignoreTagsLocal;
ignore_remote_labels = account.lieer.ignoreTagsRemote;
} + "\n";
value.source = settingsFormat.generate "lieer-${account.address}.json"
({ account = account.address; } // account.lieer.settings);
};
settingsOpts = {
drop_non_existing_label = mkOption {
type = types.bool;
default = false;
description = ''
Allow missing labels on the Gmail side to be dropped.
'';
};
file_extension = mkOption {
type = types.str;
default = "";
example = "mbox";
description = ''
Extension to include in local file names, which can be useful
for indexing with third-party programs.
'';
};
ignore_empty_history = mkOption {
type = types.bool;
default = false;
description = ''
Work around a Gmail API quirk where an empty change history
is sometimes returned.
</para><para>
See this
<link xlink:href="https://github.com/gauteh/lieer/issues/120">GitHub issue</link>
for more details.
'';
};
ignore_remote_labels = mkOption {
type = types.listOf types.str;
default = [
"CATEGORY_FORUMS"
"CATEGORY_PROMOTIONS"
"CATEGORY_UPDATES"
"CATEGORY_SOCIAL"
"CATEGORY_PERSONAL"
];
description = ''
Set Gmail labels to ignore when syncing from remote labels to
local tags (before translations).
'';
};
ignore_tags = mkOption {
type = types.listOf types.str;
default = [ ];
description = ''
Set labels to ignore when syncing from local tags to
remote labels (after translations).
'';
};
local_trash_tag = mkOption {
type = types.str;
default = "trash";
description = ''
Local tag to which the remote Gmail 'TRASH' label is translated.
'';
};
remove_local_messages = mkOption {
type = types.bool;
default = true;
description = ''
Remove local messages that have been deleted on the remote.
'';
};
replace_slash_with_dot = mkOption {
type = types.bool;
default = false;
description = ''
Replace '/' with '.' in Gmail labels.
'';
};
timeout = mkOption {
type = types.ints.unsigned;
default = 600;
description = ''
HTTP timeout in seconds. 0 means forever or system timeout.
'';
};
};
syncOpts = {
enable = mkEnableOption "lieer synchronization service";
frequency = mkOption {
type = types.str;
default = "*:0/5";
description = ''
How often to synchronize the account.
</para><para>
This value is passed to the systemd timer configuration as the
onCalendar option. See
<citerefentry>
<refentrytitle>systemd.time</refentrytitle>
<manvolnum>7</manvolnum>
</citerefentry>
for more information about the format.
'';
};
};
lieerOpts = {
enable = mkEnableOption "lieer Gmail synchronization for notmuch";
notmuchSetupWarning = mkOption {
type = types.bool;
default = true;
description = ''
Warn if Notmuch is not also enabled for this account.
</para><para>
This can safely be disabled if <command>notmuch init</command>
has been used to configure this account outside of Home
Manager.
'';
};
settings = mkOption {
type = types.submodule {
freeformType = settingsFormat.type;
options = settingsOpts;
};
default = { };
description = ''
Settings which are applied to <filename>.gmailieer.json</filename>
for the account.
</para><para>
See the <link xlink:href="https://github.com/gauteh/lieer/">lieer manual</link>
for documentation of settings not explicitly covered by this module.
'';
};
sync = syncOpts;
};
lieerModule = types.submodule {
imports = [
(mkRenamedOptionModule [ "lieer" "dropNonExistingLabels" ] [
"lieer"
"settings"
"drop_non_existing_label"
])
(mkRenamedOptionModule [ "lieer" "ignoreTagsRemote" ] [
"lieer"
"settings"
"ignore_remote_labels"
])
(mkRenamedOptionModule [ "lieer" "ignoreTagsLocal" ] [
"lieer"
"settings"
"ignore_tags"
])
(mkRenamedOptionModule [ "lieer" "timeout" ] [
"lieer"
"settings"
"timeout"
])
(mkRenamedOptionModule [ "lieer" "replaceSlashWithDot" ] [
"lieer"
"settings"
"replace_slash_with_dot"
])
];
options = {
lieer = lieerOpts;
warnings = mkOption {
type = types.listOf types.str;
default = [ ];
internal = true;
visible = false;
};
};
};
renamedOptions = account:
let prefix = [ "accounts" "email" "accounts" account.name "lieer" ];
in [
(mkRenamedOptionModule (prefix ++ [ "dropNonExistingLabels" ])
(prefix ++ [ "settings" "drop_non_existing_label" ]))
(mkRenamedOptionModule (prefix ++ [ "ignoreTagsRemote" ])
(prefix ++ [ "settings" "ignore_remote_labels" ]))
(mkRenamedOptionModule (prefix ++ [ "ignoreTagsLocal" ])
(prefix ++ [ "settings" "ignore_tags" ]))
(mkRenamedOptionModule (prefix ++ [ "timeout" ])
(prefix ++ [ "settings" "timeout" ]))
(mkRenamedOptionModule (prefix ++ [ "replaceSlashWithDot" ])
(prefix ++ [ "settings" "replace_slash_with_dot" ]))
];
in {
meta.maintainers = [ maintainers.tadfisher ];
options = {
programs.lieer.enable =
mkEnableOption "lieer Gmail synchronization for notmuch";
programs.lieer = {
enable = mkEnableOption "lieer Gmail synchronization for notmuch";
accounts.email.accounts = mkOption {
type = with types; attrsOf (submodule (import ./lieer-accounts.nix));
package = mkOption {
type = types.package;
default = pkgs.gmailieer;
defaultText = "pkgs.gmailieer";
description = ''
lieer package to use.
'';
};
};
accounts.email.accounts =
mkOption { type = with types; attrsOf lieerModule; };
};
config = mkIf cfg.enable (mkMerge [
@@ -82,7 +283,9 @@ in {
'';
}];
home.packages = [ pkgs.gmailieer ];
warnings = flatten (map (account: account.warnings) lieerAccounts);
home.packages = [ cfg.package ];
# Notmuch should ignore non-mail files created by lieer.
programs.notmuch.new.ignore = [ "/.*[.](json|lock|bak)$/" ];

View File

@@ -65,18 +65,15 @@ in {
home.packages = [ pkgs.mcfly ];
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
source "${pkgs.mcfly}/share/mcfly/mcfly.bash"
eval "$(${pkgs.mcfly}/bin/mcfly init bash)"
'';
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
source "${pkgs.mcfly}/share/mcfly/mcfly.zsh"
eval "$(${pkgs.mcfly}/bin/mcfly init zsh)"
'';
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
source "${pkgs.mcfly}/share/mcfly/mcfly.fish"
if status is-interactive
mcfly_key_bindings
end
${pkgs.mcfly}/bin/mcfly init fish | source
'';
home.sessionVariables.MCFLY_KEY_SCHEME = cfg.keyScheme;

View File

@@ -21,11 +21,12 @@ let
user = userName;
tls = onOff smtp.tls.enable;
tls_starttls = onOff smtp.tls.useStartTls;
tls_trust_file = smtp.tls.certificatesFile;
} // optionalAttrs (msmtp.tls.fingerprint != null) {
tls_fingerprint = msmtp.tls.fingerprint;
} // optionalAttrs (smtp.port != null) { port = toString smtp.port; }
// optionalAttrs (passwordCommand != null) {
// optionalAttrs (smtp.tls.certificatesFile != null) {
tls_trust_file = smtp.tls.certificatesFile;
} // optionalAttrs (passwordCommand != null) {
passwordeval = toString passwordCommand;
} // msmtp.extraConfig) ++ optional primary ''

View File

@@ -2,7 +2,25 @@
with lib;
{
let
extraMailboxOptions = {
options = {
mailbox = mkOption {
type = types.str;
example = "Sent";
description = "Name of mailbox folder to be included";
};
name = mkOption {
type = types.nullOr types.str;
example = "Junk";
default = null;
description = "Name to display";
};
};
};
in {
options.neomutt = {
enable = mkEnableOption "NeoMutt";
@@ -32,5 +50,18 @@ with lib;
Extra lines to add to the folder hook for this account.
'';
};
mailboxName = mkOption {
type = types.nullOr types.str;
default = null;
example = "==== <mailbox-name> ===";
description = "Use a different name as mailbox name";
};
extraMailboxes = mkOption {
type = with types; listOf (either str (submodule extraMailboxOptions));
default = [ ];
description = "List of extra mailboxes";
};
};
}

View File

@@ -30,7 +30,7 @@ let
format = mkOption {
type = types.str;
default = "%B%?F? [%F]?%* %?N?%N/?%S";
default = "%D%?F? [%F]?%* %?N?%N/?%S";
description = ''
Sidebar format. Check neomutt documentation for details.
'';
@@ -133,10 +133,25 @@ let
'';
registerAccount = account:
with account; ''
let
mailboxes = if account.neomutt.mailboxName == null then
"mailboxes"
else
''named-mailboxes "${account.neomutt.mailboxName}"'';
extraMailboxes = concatMapStringsSep "\n" (extra:
if isString extra then
''mailboxes "${account.maildir.absPath}/${extra}"''
else if extra.name == null then
''mailboxes "${account.maildir.absPath}/${extra.mailbox}"''
else
''
named-mailboxes "${extra.name}" "${account.maildir.absPath}/${extra.mailbox}"'')
account.neomutt.extraMailboxes;
in with account; ''
# register account ${name}
mailboxes "${account.maildir.absPath}/${folders.inbox}"
folder-hook ${account.maildir.absPath}/ " \
${mailboxes} "${maildir.absPath}/${folders.inbox}"
${extraMailboxes}
folder-hook ${maildir.absPath}/ " \
source ${accountFilename account} "
'';
@@ -185,7 +200,7 @@ let
''
# Generated by Home Manager.
set ssl_force_tls = yes
set certificate_file=${config.accounts.email.certificatesFile}
set certificate_file=${toString config.accounts.email.certificatesFile}
# GPG section
set crypt_use_gpgme = yes
@@ -216,6 +231,13 @@ in {
programs.neomutt = {
enable = mkEnableOption "the NeoMutt mail client";
package = mkOption {
type = types.package;
default = pkgs.neomutt;
defaultText = literalExample "pkgs.neomutt";
description = "The neomutt package to use.";
};
sidebar = mkOption {
type = sidebarModule;
default = { };
@@ -285,7 +307,7 @@ in {
};
config = mkIf cfg.enable {
home.packages = [ pkgs.neomutt ];
home.packages = [ cfg.package ];
home.file = let
rcFile = account: {
"${accountFilename account}".text = accountStr account;

View File

@@ -56,7 +56,7 @@ let
ssl = if imap.tls.enable then {
ssl = true;
sslcacertfile = imap.tls.certificatesFile;
sslcacertfile = toString imap.tls.certificatesFile;
starttls = imap.tls.useStartTls;
} else {
ssl = false;

View File

@@ -140,5 +140,14 @@ in {
install_powerline_precmd
fi
'';
# https://github.com/justjanne/powerline-go#fish
programs.fish.promptInit =
mkIf (cfg.enable && config.programs.fish.enable) ''
function fish_prompt
eval ${pkgs.powerline-go}/bin/powerline-go -error $status -jobs (count (jobs -p)) ${commandLineArguments}
${cfg.extraUpdatePS1}
end
'';
};
}

View File

@@ -309,10 +309,9 @@ in {
mkIf pkgs.stdenv.hostPlatform.isLinux {
text = qutebrowserConfig;
onChange = ''
hash="$(echo -n $USER | md5sum | cut -d' ' -f1)"
hash="$(echo -n "$USER" | md5sum | cut -d' ' -f1)"
socket="''${XDG_RUNTIME_DIR:-/run/user/$UID}/qutebrowser/ipc-$hash"
if [ -S $socket ]; then
echo "Reloading qutebrowser"
if [[ -S $socket ]]; then
command=${
escapeShellArg (builtins.toJSON {
args = [ ":config-source" ];
@@ -320,7 +319,7 @@ in {
protocol_version = 1;
})
}
$DRY_RUN_CMD echo $command | ${pkgs.socat}/bin/socat -lf /dev/null - UNIX-CONNECT:$socket
echo "$command" | ${pkgs.socat}/bin/socat -lf /dev/null - UNIX-CONNECT:"$socket"
fi
unset hash socket command
'';

View File

@@ -9,7 +9,7 @@ let
'';
renderCredential = cred: ''
credentials += Credentials("${cred.realm}", "${cred.host}", "${cred.user}", "${cred.passwordCommand}".!!)
credentials += Credentials("${cred.realm}", "${cred.host}", "${cred.user}", "${cred.passwordCommand}".lazyLines.mkString("\n"))
'';
renderCredentials = creds: ''

View File

@@ -8,6 +8,8 @@ let
tomlFormat = pkgs.formats.toml { };
starshipCmd = "${config.home.profileDirectory}/bin/starship";
in {
meta.maintainers = [ maintainers.marsam ];
@@ -90,19 +92,19 @@ in {
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then
eval "$(${cfg.package}/bin/starship init bash)"
eval "$(${starshipCmd} init bash)"
fi
'';
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then
eval "$(${cfg.package}/bin/starship init zsh)"
eval "$(${starshipCmd} init zsh)"
fi
'';
programs.fish.promptInit = mkIf cfg.enableFishIntegration ''
if test "$TERM" != "dumb" -a \( -z "$INSIDE_EMACS" -o "$INSIDE_EMACS" = "vterm" \)
eval (${cfg.package}/bin/starship init fish)
eval (${starshipCmd} init fish)
end
'';
};

View File

@@ -0,0 +1,55 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.betterlockscreen;
in {
meta.maintainers = with maintainers; [ sebtm ];
options = {
services.betterlockscreen = {
enable = mkEnableOption "betterlockscreen, a screen-locker module";
package = mkOption {
type = types.package;
default = pkgs.betterlockscreen;
defaultText = literalExample "pkgs.betterlockscreen";
description = "Package providing <command>betterlockscreen</command>.";
};
arguments = mkOption {
type = types.listOf types.str;
default = [ ];
description =
"List of arguments appended to <literal>./betterlockscreen --lock [args]</literal>";
};
inactiveInterval = mkOption {
type = types.int;
default = 10;
description = ''
Value used for <option>services.screen-locker.inactiveInterval</option>.
'';
};
};
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.betterlockscreen" pkgs
lib.platforms.linux)
];
home.packages = [ cfg.package ];
services.screen-locker = {
enable = true;
inactiveInterval = cfg.inactiveInterval;
lockCmd = "${cfg.package}/bin/betterlockscreen --lock ${
concatStringsSep " " cfg.arguments
}";
};
};
}

View File

@@ -64,6 +64,21 @@ in {
description = "Package providing <command>dunst</command>.";
};
configFile = mkOption {
type = with types; either str path;
default = "${config.xdg.configHome}/dunst/dunstrc";
defaultText = "$XDG_CONFIG_HOME/dunst/dunstrc";
description = ''
Path to the configuration file read by dunst.
</para><para>
Note that the configuration generated by Home Manager will be
written to <filename>$XDG_CONFIG_HOME/dunst/dunstrc</filename>
regardless. This allows using a mutable configuration file generated
from the immutable one, useful in scenarios where live reloading is
desired.
'';
};
iconTheme = mkOption {
type = themeType;
default = hicolorTheme;
@@ -88,7 +103,8 @@ in {
};
};
default = { };
description = "Configuration written to ~/.config/dunst/dunstrc";
description =
"Configuration written to <filename>$XDG_CONFIG_HOME/dunst/dunstrc</filename>.";
example = literalExample ''
{
global = {
@@ -165,7 +181,7 @@ in {
Service = {
Type = "dbus";
BusName = "org.freedesktop.Notifications";
ExecStart = "${cfg.package}/bin/dunst";
ExecStart = "${cfg.package}/bin/dunst -config ${cfg.configFile}";
Environment = optionalString (cfg.waylandDisplay != "")
"WAYLAND_DISPLAY=${cfg.waylandDisplay}";
};
@@ -176,12 +192,7 @@ in {
xdg.configFile."dunst/dunstrc" = {
text = toDunstIni cfg.settings;
onChange = ''
pkillVerbose=""
if [[ -v VERBOSE ]]; then
pkillVerbose="-e"
fi
$DRY_RUN_CMD ${pkgs.procps}/bin/pkill -u $USER $pkillVerbose dunst || true
unset pkillVerbose
${pkgs.procps}/bin/pkill -u "$USER" ''${VERBOSE+-e} dunst || true
'';
};
})

View File

@@ -0,0 +1,62 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.easyeffects;
presetOpts = optionalString (cfg.preset != "") "--load-preset ${cfg.preset}";
in {
meta.maintainers = [ maintainers.fufexan ];
options.services.easyeffects = {
enable = mkEnableOption ''
Easyeffects daemon.
Note, it is necessary to add
<programlisting language="nix">
programs.dconf.enable = true;
</programlisting>
to your system configuration for the daemon to work correctly'';
preset = mkOption {
type = types.str;
default = "";
description = ''
Which preset to use when starting easyeffects.
Will likely need to launch easyeffects to initially create preset.
'';
};
};
config = mkIf cfg.enable {
assertions = [
(hm.assertions.assertPlatform "services.easyeffects" pkgs platforms.linux)
];
# running easyeffects will just attach itself to gapplication service
# at-spi2-core is to minimize journalctl noise of:
# "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 = with pkgs; [ easyeffects at-spi2-core ];
systemd.user.services.easyeffects = {
Unit = {
Description = "Easyeffects daemon";
Requires = [ "dbus.service" ];
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" "pipewire.service" ];
};
Install.WantedBy = [ "graphical-session.target" ];
Service = {
ExecStart =
"${pkgs.easyeffects}/bin/easyeffects --gapplication-service ${presetOpts}";
ExecStop = "${pkgs.easyeffects}/bin/easyeffects --quit";
Restart = "on-failure";
RestartSec = 5;
};
};
};
}

View File

@@ -34,6 +34,15 @@ in {
Environment = "PATH=${config.home.profileDirectory}/bin";
ExecStart = "${package}/bin/flameshot";
Restart = "on-abort";
# Sandboxing.
LockPersonality = true;
MemoryDenyWriteExecute = true;
NoNewPrivileges = true;
PrivateUsers = true;
RestrictNamespaces = true;
SystemCallArchitectures = "native";
SystemCallFilter = "@system-service";
};
};
};

View File

@@ -21,6 +21,15 @@ in {
'';
};
soundService = mkOption {
type = types.enum [ "jack" "pipewire-pulse" "pulseaudio" ];
default = "pulseaudio";
example = "pipewire-pulse";
description = ''
The systemd sound service to depend on.
'';
};
extraOptions = mkOption {
type = types.listOf types.str;
default = [ ];
@@ -46,8 +55,8 @@ in {
Unit = {
Description = "FluidSynth Daemon";
Documentation = "man:fluidsynth(1)";
BindsTo = [ "pulseaudio.service" ];
After = [ "pulseaudio.service" ];
BindsTo = [ (cfg.soundService + ".service") ];
After = [ (cfg.soundService + ".service") ];
};
Install = { WantedBy = [ "default.target" ]; };

127
modules/services/fnott.nix Normal file
View File

@@ -0,0 +1,127 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.fnott;
concatStringsSep' = sep: list:
concatStringsSep sep (filter (x: x != "") list);
mkKeyValue = generators.mkKeyValueDefault { } "=";
genINI = generators.toINI { };
iniFormatType = with types;
let
iniAtom = types.nullOr (types.oneOf [ bool int float str ]) // {
description = "INI atom (null, bool, int, float or string)";
};
in attrsOf (attrsOf iniAtom);
in {
options = {
services.fnott = {
enable = mkEnableOption ''
fnott, a lightweight Wayland notification daemon for wlroots-based compositors
'';
package = mkOption {
type = types.package;
default = pkgs.fnott;
defaultText = literalExample "pkgs.fnott";
description = "Package providing <command>fnott</command>.";
};
extraFlags = mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "-s" ];
description = ''
Extra arguments to use for executing fnott.
'';
};
configFile = mkOption {
type = types.either types.str types.path;
default = "${config.xdg.configHome}/fnott/fnott.ini";
defaultText = "$XDG_CONFIG_HOME/fnott/fnott.ini";
description = ''
Path to the configuration file read by fnott.
</para><para>
Note that environment variables in the path won't be properly expanded.
</para><para>
The configuration specified under
<option>services.fnott.settings</option> will be generated and
written to <filename>$XDG_CONFIG_HOME/fnott/fnott.ini</filename>
regardless of this option. This allows using a mutable configuration file
generated from the immutable one, useful in scenarios where live reloading is desired.
'';
};
settings = mkOption {
type = iniFormatType;
default = { };
description = ''
Configuration written to
<filename>$XDG_CONFIG_HOME/fnott/fnott.ini</filename>.
</para><para>
See
<citerefentry>
<refentrytitle>fnott.ini</refentrytitle>
<manvolnum>5</manvolnum>
</citerefentry> for a list of avaliable options and <link
xlink:href="https://codeberg.org/dnkl/fnott/src/branch/master/fnott.ini"/>
for an example configuration.
'';
example = literalExample ''
{
main = {
notification-margin = 5;
};
low = {
timeout = 5;
title-font = "Dina:weight=bold:slant=italic";
title-color = "ffffff";
};
}
'';
};
};
};
config = mkIf cfg.enable {
assertions =
[ (hm.assertions.assertPlatform "services.fnott" pkgs platforms.linux) ];
home.packages = [ cfg.package ];
systemd.user.services.fnott = {
Unit = {
Description = "Fnott notification daemon";
Documentation = "man:fnott(1)";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Type = "dbus";
BusName = "org.freedesktop.Notifications";
ExecStart = concatStringsSep' " " [
"${cfg.package}/bin/fnott"
"-c ${escapeShellArg cfg.configFile}"
(escapeShellArgs cfg.extraFlags)
];
};
};
xdg.configFile."fnott/fnott.ini" = {
# FIXME: Remove after next version release (https://codeberg.org/dnkl/fnott/pulls/24).
text = concatStringsSep' "\n" [
(optionalString (cfg.settings ? main) ''
${concatStringsSep "\n" (mapAttrsToList mkKeyValue cfg.settings.main)}
'')
(genINI (removeAttrs cfg.settings [ "main" ]))
];
};
};
}

View File

@@ -0,0 +1,100 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.git-sync;
mkUnit = name: repo: {
Unit.Description = "Git Sync ${name}";
Install.WantedBy = [ "default.target" ];
Service = {
Environment = [
"GIT_SYNC_DIRECTORY=${repo.path}"
"GIT_SYNC_COMMAND=${cfg.package}/bin/git-sync"
"GIT_SYNC_REPOSITORY=${repo.uri}"
"GIT_SYNC_INTERVAL=${toString repo.interval}"
];
ExecStart = "${cfg.package}/bin/git-sync-on-inotify";
Restart = "on-abort";
};
};
services = mapAttrs' (name: repo: {
name = "git-sync-${name}";
value = mkUnit name repo;
}) cfg.repositories;
repositoryType = types.submodule ({ name, ... }: {
options = {
name = mkOption {
internal = true;
default = name;
type = types.str;
description = "The name that should be given to this unit.";
};
path = mkOption {
type = types.path;
description = "The path at which to sync the repository";
};
uri = mkOption {
type = types.str;
example = "git+ssh://user@example.com:/~[user]/path/to/repo.git";
description = ''
The URI of the remote to be synchronized. This is only used in the
event that the directory does not already exist. See
<link xlink:href="https://git-scm.com/docs/git-clone#_git_urls"/>
for the supported URIs.
'';
};
interval = mkOption {
type = types.int;
default = 500;
description = ''
The interval, specified in seconds, at which the synchronization will
be triggered even without filesystem changes.
'';
};
};
});
in {
meta.maintainers = [ maintainers.imalison ];
options = {
services.git-sync = {
enable = mkEnableOption "git-sync services";
package = mkOption {
type = types.package;
default = pkgs.git-sync;
defaultText = literalExample "pkgs.git-sync";
description = ''
Package containing the <command>git-sync</command> program.
'';
};
repositories = mkOption {
type = with types; attrsOf repositoryType;
description = ''
The repositories that should be synchronized.
'';
};
};
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.git-sync" pkgs
lib.platforms.linux)
];
systemd.user.services = services;
};
}

View File

@@ -20,22 +20,19 @@ let
# 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
gpgconf = dir:
if homedir == options.programs.gpg.homedir.default then
"%t/gnupg/${dir}"
else
builtins.readFile (pkgs.runCommand dir {} ''
PATH=${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}";
echo -n "%t/gnupg/d.$hash/${dir}" > "$out"
'');
in
@@ -203,10 +200,11 @@ in
[ cfg.extraConfig ]
);
home.sessionVariables =
optionalAttrs cfg.enableSshSupport {
SSH_AUTH_SOCK = "$(${gpgPkg}/bin/gpgconf --list-dirs agent-ssh-socket)";
};
home.sessionVariablesExtra = optionalString cfg.enableSshSupport ''
if [[ -z "$SSH_AUTH_SOCK" ]]; then
export SSH_AUTH_SOCK="$(${gpgPkg}/bin/gpgconf --list-dirs agent-ssh-socket)"
fi
'';
programs.bash.initExtra = gpgInitStr;
programs.zsh.initExtra = gpgInitStr;

View File

@@ -1,25 +0,0 @@
{ lib, ... }:
with lib;
{
options.lieer.sync = {
enable = mkEnableOption "lieer synchronization service";
frequency = mkOption {
type = types.str;
default = "*:0/5";
description = ''
How often to synchronize the account.
</para><para>
This value is passed to the systemd timer configuration as the
onCalendar option. See
<citerefentry>
<refentrytitle>systemd.time</refentrytitle>
<manvolnum>7</manvolnum>
</citerefentry>
for more information about the format.
'';
};
};
}

View File

@@ -51,14 +51,8 @@ let
in {
meta.maintainers = [ maintainers.tadfisher ];
options = {
services.lieer.enable =
mkEnableOption "lieer Gmail synchronization service";
accounts.email.accounts = mkOption {
type = with types; attrsOf (submodule (import ./lieer-accounts.nix));
};
};
options.services.lieer.enable =
mkEnableOption "lieer Gmail synchronization service";
config = mkIf cfg.enable {
assertions = [

View File

@@ -0,0 +1,48 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.notify-osd;
in {
meta.maintainers = [ maintainers.imalison ];
options = {
services.notify-osd = {
enable = mkEnableOption "notify-osd";
package = mkOption {
type = types.package;
default = pkgs.notify-osd;
defaultText = literalExample "pkgs.notify-osd";
description = ''
Package containing the <command>notify-osd</command> program.
'';
};
};
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.notify-osd" pkgs
lib.platforms.linux)
];
systemd.user.services.notify-osd = {
Unit = {
Description = "notify-osd";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install.WantedBy = [ "graphical-session.target" ];
Service = {
ExecStart = "${cfg.package}/bin/notify-osd";
Restart = "on-abort";
};
};
};
}

View File

@@ -12,14 +12,19 @@ in {
meta.maintainers = [ maintainers.jonringer ];
options.services.pulseeffects = {
enable = mkEnableOption "Pulseeffects daemon";
enable = mkEnableOption ''
Pulseeffects daemon
Note, it is necessary to add
<programlisting language="nix">
programs.dconf.enable = true;
</programlisting>
to your system configuration for the daemon to work correctly'';
package = mkOption {
type = types.package;
default = pkgs.pulseeffects;
defaultText = literalExample "pkgs.pulseeffects";
default = pkgs.pulseeffects-legacy;
defaultText = literalExample "pkgs.pulseeffects-legacy";
description = "Pulseeffects package to use.";
example = literalExample "pkgs.pulseeffects-pw";
};
preset = mkOption {
@@ -43,9 +48,6 @@ 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; [ gnome.dconf ];`
# to /etc/nixos/configuration.nix for daemon to work correctly
systemd.user.services.pulseeffects = {
Unit = {
Description = "Pulseeffects daemon";

View File

@@ -61,8 +61,15 @@ with lib;
Restart = "on-failure";
SuccessExitStatus = [ 3 4 ];
RestartForceExitStatus = [ 3 4 ];
# Sandboxing.
LockPersonality = true;
MemoryDenyWriteExecute = true;
NoNewPrivileges = true;
PrivateUsers = true;
RestrictNamespaces = true;
SystemCallArchitectures = "native";
SystemCallFilter = "@system-service";
};
Install = { WantedBy = [ "default.target" ]; };

View File

@@ -10,15 +10,17 @@ in {
meta.maintainers = [ maintainers.imalison ];
options = {
services.volnoti = { enable = mkEnableOption "Volnoti volume HUD daemon"; };
services.volnoti = {
enable = mkEnableOption "Volnoti volume HUD daemon";
package = mkOption {
type = types.package;
default = pkgs.volnoti;
defaultText = literalExample "pkgs.volnoti";
description = ''
Package containing the <command>volnoti</command> program.
'';
package = mkOption {
type = types.package;
default = pkgs.volnoti;
defaultText = literalExample "pkgs.volnoti";
description = ''
Package containing the <command>volnoti</command> program.
'';
};
};
};

View File

@@ -30,7 +30,7 @@ in {
List of lua packages available for being
used in the Awesome configuration.
'';
example = literalExample "[ luaPackages.oocairo ]";
example = literalExample "[ pkgs.luaPackages.vicious ]";
};
noArgb = mkOption {

View File

@@ -255,8 +255,7 @@ in {
onChange = ''
i3Socket=''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.*
if [ -S $i3Socket ]; then
echo "Reloading i3"
$DRY_RUN_CMD ${cfg.package}/bin/i3-msg -s $i3Socket reload 1>/dev/null
${cfg.package}/bin/i3-msg -s $i3Socket reload >/dev/null
fi
'';
};

View File

@@ -4,9 +4,13 @@ with lib;
rec {
criteriaStr = criteria:
"[${
concatStringsSep " " (mapAttrsToList (k: v: ''${k}="${v}"'') criteria)
}]";
let
toCriteria = k: v:
if builtins.isBool v then
(if v then "${k}" else "")
else
''${k}="${v}"'';
in "[${concatStringsSep " " (mapAttrsToList toCriteria criteria)}]";
keybindingDefaultWorkspace = filterAttrs (n: v:
cfg.config.defaultWorkspace != null && v == cfg.config.defaultWorkspace)

View File

@@ -353,14 +353,23 @@ let
criteria = mkOption {
type = criteriaModule;
description =
"Criteria of the windows on which command should be executed.";
example = { title = "x200: ~/work"; };
description = ''
Criteria of the windows on which command should be executed.
</para><para>
A value of <literal>true</literal> is equivalent to using an empty
criteria (which is different from an empty string criteria).
'';
example = literalExample ''
{
title = "x200: ~/work";
floating = true;
};
'';
};
};
};
criteriaModule = types.attrsOf types.str;
criteriaModule = types.attrsOf (types.either types.str types.bool);
in {
fonts = mkOption {
type = with types; either (listOf str) fontOptions;
@@ -538,7 +547,7 @@ in {
};
workspaceLayout = mkOption {
type = types.enum [ "default" "stacked" "tabbed" ];
type = types.enum [ "default" "stacking" "tabbed" ];
default = "default";
example = "tabbed";
description = ''

View File

@@ -438,10 +438,9 @@ in {
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
swaySocket=''${XDG_RUNTIME_DIR:-/run/user/$UID}/sway-ipc.$UID.$(${pkgs.procps}/bin/pgrep -x sway || true).sock
if [ -S $swaySocket ]; then
echo "Reloading sway"
$DRY_RUN_CMD ${pkgs.sway}/bin/swaymsg -s $swaySocket reload
${pkgs.sway}/bin/swaymsg -s $swaySocket reload
fi
'';
};

View File

@@ -161,9 +161,8 @@ in {
source = xmonadBin;
onChange = ''
# Attempt to restart xmonad if X is running.
if [[ -v DISPLAY ]] ; then
echo "Restarting xmonad"
$DRY_RUN_CMD ${config.xsession.windowManager.command} --restart
if [[ -v DISPLAY ]]; then
${config.xsession.windowManager.command} --restart
fi
'';
};

View File

@@ -57,6 +57,24 @@ in {
. "${profileDirectory}/etc/profile.d/hm-session-vars.sh"
'';
programs.zsh.envExtra = ''
# Make system functions available to zsh
() {
setopt LOCAL_OPTIONS CASE_GLOB EXTENDED_GLOB
local system_fpaths=(
# Package default
/usr/share/zsh/site-functions(/-N)
# Debian
/usr/share/zsh/functions/**/*(/-N)
/usr/share/zsh/vendor-completions/(/-N)
/usr/share/zsh/vendor-functions/(/-N)
)
fpath=(''${fpath} ''${system_fpaths})
}
'';
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

View File

@@ -93,8 +93,8 @@ in {
++ optionals (cfg.properties != null)
(mapAttrsToList formatLine cfg.properties)) + "\n";
onChange = ''
if [[ -v DISPLAY ]] ; then
$DRY_RUN_CMD ${xrdbMerge}
if [[ -v DISPLAY ]]; then
${xrdbMerge}
fi
'';
};

View File

@@ -43,8 +43,13 @@ in {
in
"''${xmonad}/bin/xmonad";
'';
default = ''test -n "$1" && eval "$@"'';
description = ''
Window manager start command.
Command to use to start the window manager.
</para><para>
The default value allows integration with NixOS' generated xserver configuration.
</para><para>
Extra actions and commands can be specified in <option>xsession.initExtra</option>.
'';
};

View File

@@ -129,6 +129,7 @@ in {
wantedBy = [ "multi-user.target" ];
wants = [ "nix-daemon.socket" ];
after = [ "nix-daemon.socket" ];
before = [ "systemd-user-sessions.service" ];
environment = serviceEnvironment;
@@ -140,15 +141,38 @@ in {
User = usercfg.home.username;
Type = "oneshot";
RemainAfterExit = "yes";
TimeoutStartSec = 90;
SyslogIdentifier = "hm-activate-${username}";
# The activation script is run by a login shell to make sure
# that the user is given a sane Nix environment.
ExecStart = pkgs.writeScript "activate-${username}" ''
#! ${pkgs.runtimeShell} -el
echo Activating home-manager configuration for ${username}
exec ${usercfg.home.activationPackage}/activate
'';
ExecStart = let
systemctl =
"XDG_RUNTIME_DIR=\${XDG_RUNTIME_DIR:-/run/user/$UID} systemctl";
sed = "${pkgs.gnused}/bin/sed";
exportedSystemdVariables = concatStringsSep "|" [
"DBUS_SESSION_BUS_ADDRESS"
"DISPLAY"
"WAYLAND_DISPLAY"
"XAUTHORITY"
"XDG_RUNTIME_DIR"
];
setupEnv = pkgs.writeScript "hm-setup-env" ''
#! ${pkgs.runtimeShell} -el
# The activation script is run by a login shell to make sure
# that the user is given a sane environment.
# If the user is logged in, import variables from their current
# session environment.
eval "$(
${systemctl} --user show-environment 2> /dev/null \
| ${sed} -En '/^(${exportedSystemdVariables})=/s/^/export /p'
)"
exec "$1/activate"
'';
in "${setupEnv} ${usercfg.home.activationPackage}";
};
}) cfg.users;
};

View File

@@ -1,4 +1,4 @@
{ pkgs ? import <nixpkgs> {} }:
{ pkgs ? import <nixpkgs> {}, enableBig ? true }:
let
@@ -26,10 +26,13 @@ let
# unnecessary rebuilds of the tests.
manual.manpages.enable = false;
imports = [ ./asserts.nix ];
imports = [ ./asserts.nix ./stubs.nix ];
}
];
isDarwin = pkgs.stdenv.hostPlatform.isDarwin;
isLinux = pkgs.stdenv.hostPlatform.isLinux;
in
import nmt {
@@ -45,6 +48,9 @@ import nmt {
./modules/programs/aria2
./modules/programs/autojump
./modules/programs/bash
./modules/programs/bat
./modules/programs/bottom
./modules/programs/broot
./modules/programs/browserpass
./modules/programs/dircolors
./modules/programs/direnv
@@ -86,12 +92,11 @@ import nmt {
./modules/programs/zplug
./modules/programs/zsh
./modules/xresources
] ++ lib.optionals pkgs.stdenv.hostPlatform.isDarwin [
] ++ lib.optionals isDarwin [
./modules/targets-darwin
] ++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [
] ++ lib.optionals isLinux [
./modules/config/i18n
./modules/i18n/input-method
./modules/misc/debug
./modules/misc/gtk
./modules/misc/numlock
./modules/misc/pam
@@ -100,7 +105,6 @@ import nmt {
./modules/misc/xsession
./modules/programs/abook
./modules/programs/autorandr
./modules/programs/firefox
./modules/programs/foot
./modules/programs/getmail
./modules/programs/gnome-terminal
@@ -119,6 +123,8 @@ import nmt {
./modules/services/dropbox
./modules/services/emacs
./modules/services/fluidsynth
./modules/services/fnott
./modules/services/git-sync
./modules/services/kanshi
./modules/services/lieer
./modules/services/pantalaimon
@@ -135,5 +141,10 @@ import nmt {
./modules/services/wlsunset
./modules/systemd
./modules/targets-linux
] ++ lib.optionals enableBig [
./modules/programs/emacs
] ++ lib.optionals (enableBig && isLinux) [
./modules/misc/debug
./modules/programs/firefox
]);
}

View File

@@ -15,18 +15,39 @@ in {
{ float = 3.14; }
{ int = 42; }
{ int = 42; }
{ int = -42; }
{ int = -42; }
{ list = [ "one" ]; }
{ list = mkArray type.string [ "two" ]; }
{ uint32 = mkUint32 42; }
{ uint32 = mkUint32 42; }
{ int16 = mkInt16 (-42); }
{ int16 = mkInt16 (-42); }
{ uint16 = mkUint16 42; }
{ uint16 = mkUint16 42; }
{ int64 = mkInt64 (-42); }
{ int64 = mkInt64 (-42); }
{ uint64 = mkUint64 42; }
{ uint64 = mkUint64 42; }
{ array1 = [ "one" ]; }
{ array1 = mkArray type.string [ "two" ]; }
{ array2 = mkArray type.uint32 [ 1 ]; }
{ array2 = mkArray type.uint32 [ 2 ]; }
{ emptyArray1 = [ ]; }
{ emptyArray2 = mkEmptyArray type.uint32; }
{ string = "foo"; }
{ string = "foo"; }
{ escapedString = "' \\"; }
{
escapedString = ''
'\
'';
}
{ tuple = mkTuple [ 1 [ "foo" ] ]; }
@@ -44,17 +65,23 @@ in {
home-files/result.txt \
${
pkgs.writeText "expected.txt" ''
array1 = @as ['one','two']
array2 = @au [1,2]
bool = true
emptyArray1 = @as []
emptyArray2 = @as []
escapedString = '\' \\'
emptyArray2 = @au []
escapedString = '\'\\\n'
float = 3.140000
int = 42
list = @as ['one','two']
int = -42
int16 = @n -42
int64 = @x -42
maybe1 = @ms nothing
maybe2 = just @u 4
string = 'foo'
tuple = @(ias) (1,@as ['foo'])
uint16 = @q 42
uint32 = @u 42
uint64 = @t 42
''
}
'';

View File

@@ -1,15 +1,14 @@
{ config, pkgs, ... }:
{
config = {
nixpkgs.overlays = [ (import ./fcitx5-overlay.nix) ];
i18n.inputMethod = {
enabled = "fcitx5";
fcitx5.addons = with pkgs; [ fcitx5-chinese-addons ];
};
imports = [ ./fcitx5-stubs.nix ];
nmt.script = ''
assertFileExists home-files/.config/systemd/user/fcitx5-daemon.service
'';
i18n.inputMethod = {
enabled = "fcitx5";
fcitx5.addons = with pkgs; [ fcitx5-chinese-addons ];
};
nmt.script = ''
assertFileExists home-files/.config/systemd/user/fcitx5-daemon.service
'';
}

View File

@@ -1,22 +0,0 @@
final: prev:
let
dummy = prev.runCommandLocal "dummy-package" { } "mkdir $out";
in {
fcitx5 = prev.runCommandLocal "fcitx5" { version = "0"; } ''
mkdir -p $out/bin $out/share/applications $out/etc/xdg/autostart
touch $out/bin/fcitx5 \
$out/share/applications/org.fcitx.Fcitx5.desktop \
$out/etc/xdg/autostart/org.fcitx.Fcitx5.desktop
chmod +x $out/bin/fcitx5
'';
fcitx5-configtool = dummy;
fcitx5-lua = dummy;
fcitx5-qt = dummy;
fcitx5-gtk = dummy;
fcitx5-with-addons =
prev.fcitx5-with-addons.override { inherit (final) fcitx5-qt; };
fcitx5-chinese-addons = dummy;
}

View File

@@ -0,0 +1,27 @@
{
test.stubs = {
fcitx5 = {
version = "0";
outPath = null;
buildScript = ''
mkdir -p $out/bin $out/share/applications $out/etc/xdg/autostart
touch $out/bin/fcitx5 \
$out/share/applications/org.fcitx.Fcitx5.desktop \
$out/etc/xdg/autostart/org.fcitx.Fcitx5.desktop
chmod +x $out/bin/fcitx5
'';
};
fcitx5-configtool = { outPath = null; };
fcitx5-lua = { outPath = null; };
fcitx5-qt = { outPath = null; };
fcitx5-gtk = { outPath = null; };
fcitx5-chinese-addons = { outPath = null; };
};
nixpkgs.overlays = [
(self: super: {
fcitx5-with-addons =
super.fcitx5-with-addons.override { inherit (self) fcitx5-qt; };
})
];
}

View File

@@ -9,6 +9,8 @@ with lib;
gtk2.extraConfig = "gtk-can-change-accels = 1";
};
test.stubs.dconf = { };
nmt.script = ''
assertFileExists home-files/.gtkrc-2.0
assertFileContent home-files/.gtkrc-2.0 ${

View File

@@ -7,6 +7,8 @@ with lib;
gtk.enable = true;
gtk.gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
test.stubs.dconf = { };
nmt.script = ''
assertFileExists home-files/.config/gtk-2.0/gtkrc
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \

View File

@@ -6,9 +6,7 @@ with lib;
config = {
xsession.numlock.enable = true;
nixpkgs.overlays = [
(self: super: { numlockx = pkgs.writeScriptBin "dummy-numlockx" ""; })
];
test.stubs.numlockx = { };
nmt.script = ''
serviceFile=home-files/.config/systemd/user/numlockx.service

View File

@@ -7,15 +7,11 @@
platformTheme = "gnome";
style = {
name = "adwaita";
package = pkgs.dummyTheme;
package = config.lib.test.mkStubPackage { };
};
};
nixpkgs.overlays = [
(self: super: {
dummyTheme = pkgs.runCommandLocal "theme" { } "mkdir $out";
})
];
test.stubs.qgnomeplatform = { };
nmt.script = ''
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \

View File

@@ -1,6 +1,6 @@
{
xdg-mime-apps-basics = ./mime-apps-basics.nix;
xdg-file-attr-names = ./file-attr-names.nix;
xdg-system-dirs = ./system-dirs.nix;
xdg-desktop-entries = ./desktop-entries.nix;
xdg-file-gen = ./file-gen.nix;
}

View File

@@ -1,26 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
{
config = {
xdg.configFile.test.text = "config";
xdg.dataFile.test.text = "data";
home.file.test.text = "home";
nmt.script = ''
assertFileExists home-files/.config/test
assertFileExists home-files/.local/share/test
assertFileExists home-files/test
assertFileContent \
home-files/.config/test \
${builtins.toFile "test" "config"}
assertFileContent \
home-files/.local/share/test \
${builtins.toFile "test" "data"}
assertFileContent \
home-files/test \
${builtins.toFile "test" "home"}
'';
};
}

View File

@@ -0,0 +1,30 @@
{ config, lib, pkgs, ... }:
with lib;
{
config = {
xdg.configHome = /. + "${config.home.homeDirectory}/.dummy-config";
xdg.dataHome = /. + "${config.home.homeDirectory}/.dummy-data";
xdg.cacheHome = /. + "${config.home.homeDirectory}/.dummy-cache";
xdg.configFile.test.text = "config";
xdg.dataFile.test.text = "data";
home.file."${config.xdg.cacheHome}/test".text = "cache";
nmt.script = ''
assertFileExists home-files/.dummy-config/test
assertFileExists home-files/.dummy-cache/test
assertFileExists home-files/.dummy-data/test
assertFileContent \
home-files/.dummy-config/test \
${builtins.toFile "test" "config"}
assertFileContent \
home-files/.dummy-data/test \
${builtins.toFile "test" "data"}
assertFileContent \
home-files/.dummy-cache/test \
${builtins.toFile "test" "cache"}
'';
};
}

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