Compare commits

...

388 Commits

Author SHA1 Message Date
Robert Helgesson
b78b5fa4a0 firefox: force extension file linking
(cherry picked from commit b9d4f55228)
2020-04-09 11:42:55 +02:00
Andrei Shumailov
7aa2bd5bf4 firefox: backport extensions fix to release-19.09 2020-04-09 11:42:09 +02:00
Robert Helgesson
57f3b72d3a files: add force flag
Enabling this flag for a `home.file` entry causes the target to be
unconditionally overwritten. The option is not visible in
documentation for now and shouldn't be relied on for general use.

(cherry picked from commit 37694e9f51)
2020-04-09 11:29:54 +02:00
Robert Helgesson
0d1ca254d0 readline: fix example
(cherry picked from commit a4a07ba996)
2020-02-16 18:10:00 +01:00
Robert Helgesson
3166ae7993 readline: add variables option
Also add a basic test case.

(cherry picked from commit 284b8d94d4)
2020-02-16 18:08:26 +01:00
Vojtěch Káně
2b71762384 readline: add module
Add basic readline configuration (~/.inputrc) management.

(cherry picked from commit bb5dea02b9)
2020-02-16 18:08:07 +01:00
dind
1261ffee91 termite: fix scrollbar position option description
Signed-off-by: dind <lewdavatar@gmail.com>
(cherry picked from commit d8d5f85ab7)
2020-02-16 18:05:32 +01:00
Robert Helgesson
f5c9303ced mpv: allow string values in scripts list
Fixes #976

(cherry picked from commit 297ed97166)
2020-01-18 23:53:20 +01:00
Ross A. Baker
8d663335eb lorri: add gitMinimal to daemon path
Fixes https://github.com/target/lorri/issues/255 when the service is
installed through home-manager.

PR #975

(cherry picked from commit 0fce533e70)
2020-01-11 17:24:16 +01:00
Robert Helgesson
72400b2c29 contributing.md: minor update
This elaborates the instructions for the news entry of new modules.

(cherry picked from commit ef6674d1d1)
2020-01-11 17:24:15 +01:00
risson
1d38ffc372 neovim: un-deprecate the configure option (#978)
The `programs.neovim.configure` option is consistent with NixOS's
`wrapNeovim` and offers features not supported by the `extraConfig`
and `plugins` option pair.

Closes #971

(cherry picked from commit 1b7b1bc294)

Co-authored-by: Wael Nasreddine <wael.nasreddine@gmail.com>
2020-01-09 15:08:26 +01:00
oxalica
10d2c4e7e4 home-manager: fix pass-through option passing
This resolves, e.g., the errors occurring when passing empty arguments
like `--option builders ''`.

Closes #967

(cherry picked from commit 7c30831e8f)
2020-01-06 11:28:39 +01:00
Robert Helgesson
b646623a39 kakoune: prepend extra configuration with newline (#870)
Fixes #869

(cherry picked from commit 1b987952b5)
2020-01-06 11:28:06 +01:00
Robert Helgesson
af2303526d install: add state version to initial configuration
This sets the state version in recent installs to the latest released
version. It is beneficial for people to be aware of this option and it
is also good to help new users get a more recent setup.

(cherry picked from commit 54f367b119)
2019-12-31 09:31:24 +01:00
Gregory Oakes
11f8b1c1ce random-background: add bgSupport documentation
On NixOS it is necessary to set `bgSupport = true` when creating a
Home Manager desktop manager session. Otherwise NixOS will add code
that sets the background, overriding the effort made by the
`random-background` module.

Fixes #955
Pull request #956

(cherry picked from commit a12a8f7977)
2019-12-31 09:31:09 +01:00
Robert Helgesson
94c0367dd8 blueman-applet: minor cleanup of enable option
In particular use proper DocBook format in description.

(cherry picked from commit 8d14ffbe88)
2019-12-28 09:46:24 +01:00
Cabia Rangris
24c6d8dfc5 blueman: update advice for removing error message
The old method for hiding the error no longer works in NixOS 19.09,
and ends up breaking blueman-applet entirely. Enable the NixOS service
instead.

Pull request #950

(cherry picked from commit a5d3d6f665)
2019-12-28 09:46:23 +01:00
arcnmx
8fb1ed5919 systemd: fix degraded warning
(cherry picked from commit 8abaa025ec)
2019-12-28 09:45:23 +01:00
Robert Helgesson
829b688827 mbsync: skip maildir creation if no account is defined
Fixes #937

(cherry picked from commit 621c98f15a)
2019-12-28 09:45:22 +01:00
adisbladis
9e69b0d8b9 emacs: Don't use emacsPackagesNg
It's deprecated and since Nixos 19.09 it's an alias to `emacsPackages`.

(cherry picked from commit 49852220f9)
2019-12-28 09:44:22 +01:00
Robert Helgesson
9bdfdfe14e lorri: restrict news entry to Linux
(cherry picked from commit 9e716025b6)
2019-12-10 21:00:02 +01:00
Tobias Happ
b41fc9e6e8 lorri: add service
(cherry picked from commit 286dd9b308)

Fixes #944
2019-12-10 20:59:29 +01:00
Robert Helgesson
5e7a4c55ed gpg: remove dummy gnupg package from test
It caused evaluation issues related to systemd.

Fixes #934

(cherry picked from commit ed9a6e34ad)
2019-12-08 23:05:44 +01:00
leotaku
22076437f3 mpdris2: improve service description
In particular, make sure the systemd service actually starts.

(cherry picked from commit 34dc4a5e03)
2019-12-08 23:04:48 +01:00
Philip Stears
0d7b515a65 files: additional support for symlinked /nix
In the case where `/nix` is a link, for example, on macOS Catalina,
`builtins.storeDir` returns `/nix`, not the canonical location.

This causes tests on existing files to result in Home Manager thinking
those files are outside of the store.

This change uses `readlink` on the store path so that the tests work
as intended.

(cherry picked from commit 0e9b7aab3c)
2019-12-08 23:04:39 +01:00
Robert Helgesson
eafc8897e6 systemd: perform reload even in degraded state
This fixes #355, fixes #798, and fixes #909.

(cherry picked from commit 9781f3766d)
2019-12-08 23:04:38 +01:00
Anton Plotnikov
415f12bae5 files: update script to support linked Nix store
(cherry picked from commit b1dd373f5a)
2019-12-08 23:04:20 +01:00
pacien
06f1b13c21 Revert "astroid: require notmuch synchronize flags"
The Astroid program can work without this option,
which should be disabled when synchronising emails with muchsync for example.

This reverts commit fa3d1f98e0.

(cherry picked from commit 24dbac8da7)
2019-12-08 23:03:45 +01:00
pacien
a0653a7fb0 astroid: fix maildir folder paths
Using the absolute path of maildir folders is required for Astroid to save
messages in those.

(cherry picked from commit 18dc4153c7)
2019-12-08 23:03:44 +01:00
Robert Helgesson
dff5f07952 tests: reduce number of downloads
This replaces some derivation outputs by simple strings rather than
full Nix store paths. This removes the need to download the whole
derivation when all we need is a static string.

(cherry picked from commit 797c77a00a)
2019-10-29 23:11:09 +01:00
Robert Helgesson
b905de5833 doc: update version number in some places
(cherry picked from commit 6b6f759e7a)
2019-10-29 23:10:42 +01:00
Robert Helgesson
ecf333d27a faq: describe how to install Nixpkgs unstable packages
(cherry picked from commit a93d01fb4d)
2019-10-29 23:10:33 +01:00
dnsdhrj
e413a1408e getmail: fix port option type mismatch
Fixed type mismatch in commit 410f573226.
Added test case to ensure it works well.

(cherry picked from commit a177d0282f)
2019-10-29 23:10:23 +01:00
SoonHo Seo
06ae8792e7 getmail: add port option (#882)
Fixed bug where "accounts.email.accounts.<name>.imap.port" option was being ignored in getmail.

(cherry picked from commit 410f573226)
2019-10-29 23:10:15 +01:00
Robert Helgesson
f856c78a4a doc: finalize the 19.09 release notes
(cherry picked from commit ad52dbe044)
2019-10-09 21:08:09 +02:00
Robert Helgesson
31e84945d5 gitlab-ci: activate 19.09 branch 2019-10-07 20:06:52 +02:00
Robert Helgesson
8bddc1adab redshift: add assertion on latitude and longitude
These two options must be set if the provider is set to "manual".

Closes #841
2019-10-02 23:17:57 +02:00
David Wood
e8dbc35613 ssh: sockets forwards; remote and dynamic forwards
This commit adds support for forwarding paths rather than just
addresses/ports. It also adds options for specifying remote and
dynamic forwards.
2019-10-02 20:42:29 +02:00
Robert Helgesson
3d546e0d01 starship: use [[ in bash init 2019-10-01 21:56:56 +02:00
Robert Helgesson
a5999a62cd starship: fix fish syntax
Fixes #858
2019-10-01 21:21:36 +02:00
Robert Helgesson
761b3d0c12 rtorrent: add news entry 2019-09-26 23:47:41 +02:00
Mario Rodas
bdb4cf6c59 rtorrent: add module 2019-09-26 23:42:52 +02:00
Mario Rodas
7205d3b2d2 starship: add module 2019-09-26 23:19:39 +02:00
Mario Rodas
bb5c29107e git: add attributes support 2019-09-26 22:11:01 +09:00
Tobias Happ
3f45630180 xdg-mime-apps: add legacy mimeapps.list path
Although `.local/share/applications/mimeapps.list` is deprecated, this
file is still being read by some applications. To ensure compatibility
duplicate the file as recommended in
https://wiki.archlinux.org/index.php/XDG_MIME_Applications#mimeapps.list
2019-09-20 20:15:47 +02:00
Nazarii Bardiuk
51581b7e43 sxhkd: add service 2019-09-17 21:42:05 +02:00
Robert Helgesson
b0544c8cde mpd: allow path literal values in options
This allows specifying, for example, the music directory using path
literals without causing the directory to be copied to the Nix store.

Suggested-by: Silvan Mosberger <infinisil@icloud.com>
2019-09-16 21:43:53 +02:00
pacien
e347e932af xdg-mime-apps: add module 2019-09-15 17:21:42 +02:00
Robert Helgesson
0dfa1eef25 xsession: remove bashisms in start scripts
Fixes #836
2019-09-12 21:28:36 +02:00
pacien
aa5ba177cc xdg-user-dirs: add module 2019-09-11 20:03:32 +02:00
Bjarki Ágúst Guðmundsson
41f918499b gpg: sane default for throw-keyids option
The [throw-keyids](https://www.gnupg.org/gph/en/manual/r2110.html)
option "hides the receiver of the encrypted data as a countermeasure
against traffic analysis." However, it also slows down decryption, and
even breaks some applications; see e.g.
https://github.com/open-keychain/open-keychain/issues/626

I think the sane default would be to leave it off, just as it is off
by default in gpg. The typical user will probably not need this level
of security, and will probably prefer a better user experience (faster
decryption and compatibility with a wider range of applications).

Closes #838
2019-09-11 19:30:26 +02:00
Bruno Bigras
d3e316eec5 imapnotify: pkgs.mbsync -> pkgs.isync 2019-09-11 19:27:04 +02:00
Robert Helgesson
45ec65e1cc doc: convert some DocBook files to AsciiDoc 2019-09-07 09:29:24 +02:00
Hugo Geoffroy
05d91c5f50 mpd: use systemd journal instead of syslog
MPD is using syslog for its logging output, while it could directly
log to systemd's journal, as this daemon is primarily used as a
systemd user service. This change makes MPD log to standard output,
which is captured by systemd.

See https://github.com/NixOS/nixpkgs/pull/57608, which does the same
thing to NixOS's MPD service.
2019-09-05 22:38:35 +02:00
Robert Helgesson
d6b36f12ff keyboard: make the model option optional
Also, actually use it in the call to setxkbmap.
2019-09-05 01:56:14 +02:00
Robert Helgesson
824d31a21c keyboard: make layout and variant optional
Also default these options to `null` for state version ≥ 19.09.

Fixes #811

Suggested-by: Sean Marshallsay <srm.1708@gmail.com>
2019-09-05 01:56:06 +02:00
Robert Helgesson
0083087e01 xsession: verify setxkbmap service in test 2019-09-05 01:32:53 +02:00
Robert Helgesson
1923ac3358 rofi: add test to verify assertion 2019-09-04 12:52:14 +02:00
Robert Helgesson
698d0f0a44 polybar: restart service on failure 2019-09-03 23:51:23 +02:00
Alex Rice
ec0459e139 rofi: string -> str 2019-09-03 01:25:24 +01:00
dawidsowa
d5e73c39fc mpv: add scripts option 2019-09-02 18:23:17 +02:00
Robert Helgesson
a144c723a1 doc: surround name? with fancier characters 2019-09-01 21:28:40 +02:00
Robert Helgesson
a28614e65d git: deprecate extraConfig as string 2019-08-30 14:50:10 +02:00
Robert Helgesson
8ab1d22a82 home-manager: support --option argument
Fixes #784
2019-08-30 00:52:09 +02:00
Tobias Happ
b6289f7022 vim: always add sensible plugin 2019-08-29 23:18:11 +02:00
Robert Helgesson
875eea1330 systemd: fix unit examples
Closes #823
2019-08-29 19:12:39 +02:00
Robert Helgesson
7c76ae1814 manual: add nmd as a generation dependency
This is to allow network-less rebuilding of a generation after a
garbage collection.

Fixes #819
2019-08-28 20:36:11 +02:00
Tobias Happ
c142e5264d neovim: add extraConfig and plugins options 2019-08-28 12:35:48 +02:00
Tobias Happ
5d7eabb93f neovim: add finalPackage option as readOnly 2019-08-28 12:25:06 +02:00
Tobias Happ
f1146a1fef vim: allow packages to be passed as plugins
This change allows to pass custom packages into the `vim.plugins`
option.

Additionally this adds a deprecation warning and an error message if a
vim plugin is not present. This is an improvement because the user
gets instant feedback, when a plugin is not found.
2019-08-28 12:18:24 +02:00
Robert Helgesson
55b71223d4 Fix option defaultText when referencing packages
By using `literalExample` the documentation will show the option
default without surrounding quotes.
2019-08-28 00:14:22 +02:00
Robert Helgesson
db86bd6c01 doc: update nmd
Also perform scrubbing of `pkgs` since nmd no longer does this
automatically.
2019-08-27 23:40:52 +02:00
Robert Helgesson
13fa61744c doc: minor grammar fix 2019-08-26 23:14:51 +02:00
Robert Helgesson
8fe4e0879c home-manager: support a few extra pass-through options
These options will be passed through to the `nix-build` tool.
2019-08-26 23:06:36 +02:00
Robert Helgesson
6bec9547c6 home-manager: exit directly after printing help 2019-08-26 23:06:36 +02:00
Robert Helgesson
bfc28cacbe random-background: disable creation of ~/.fehbg file 2019-08-26 20:07:07 +02:00
Michael Fellinger
b2a787ca69 random-background: add option enableXinerama 2019-08-26 16:42:00 +02:00
Robert Helgesson
eb1b86a5ec Replace use of stdenv.shell by runtimeShell 2019-08-22 08:35:06 +02:00
Robert Helgesson
7159c293af gitlab-ci: fix deployment of manual 2019-08-21 23:00:04 +02:00
Robert Helgesson
eb0ccf7286 docs: use nmd for generating documentation
The nmd library is an external library for generating Nix-centric
documentation.
2019-08-21 20:35:59 +02:00
Robert Helgesson
35752e07fa kakoune: add missing period at end of description 2019-08-21 20:34:43 +02:00
Robert Helgesson
57925c50bf nixpkgs: improve description formatting slightly 2019-08-21 20:20:08 +02:00
Tobias Happ
0e871b490e ssh: add localForwards option for matchBlocks 2019-08-20 12:11:00 +02:00
Robert Helgesson
ed4f66185f Use types.port where applicable
This changes the type of all options that specify ports to
`types.port`. This type restricts values to between 0 and 65535.
2019-08-19 20:37:48 +02:00
leotaku
3d645c0ce1 kdeconnect: fix incorrect path to kdeconnectd 2019-08-18 23:35:53 +02:00
Robert Helgesson
8830b8d082 gitlab-ci: only run a single test
Unfortunately the full test suite seems to run out of memory on the
GitLab CI runner.
2019-08-18 21:33:56 +02:00
Robert Helgesson
73641e492c firefox: use wrapped package
This makes the

    programs.firefox.package

option take a pre-wrapped Firefox package as value if state version is
set to "19.09" or later. This should make the Firefox module work with
a wider range of Firefox packages.
2019-08-18 18:04:04 +02:00
Robert Helgesson
c2429ca0cf nix-darwin: pass on warnings to the system configuration 2019-08-18 17:37:26 +02:00
Robert Helgesson
7834ffbbf1 nixos: pass on warnings to the system configuration
Fixes #804
2019-08-18 17:35:42 +02:00
Robert Helgesson
fa82ced414 nixos: use non-deprecated fontconfig option 2019-08-18 17:35:41 +02:00
Tobias Happ
9cc30b18f7 nixos: add backup file extension and verbosity options 2019-08-18 17:19:39 +02:00
Tobias Happ
db0dfb4b08 dwm-status: add module 2019-08-18 16:23:31 +02:00
Robert Helgesson
5eed33ef08 emacs: document how to list available extra packages 2019-08-18 13:34:26 +02:00
pacien
31ae1bc2ff alot: fix account extraConfig section 2019-08-18 12:00:38 +02:00
Robert Helgesson
6932e6330e muchsync: add news entry 2019-08-17 14:25:15 +02:00
pacien
a124dae35a muchsync: add module 2019-08-17 20:08:11 +09:00
Tobias Happ
5203340b64 zsh: add envExtra option 2019-08-16 17:00:08 +09:00
Tobias Happ
ed0e40dee8 zsh: add initExtraBeforeCompInit config option
The new initExtraBeforeCompInit option enables the user to inject
commands in zshrc before compinit is executed.
2019-08-16 16:57:52 +09:00
Tobias Happ
8b759c24e6 bash: add logoutExtra option 2019-08-16 16:46:38 +09:00
paumr
1499b85ac6 alot: added send/draf_box to configuration file 2019-08-16 16:27:28 +09:00
Robert Helgesson
fcdab6a62d install: restrict to nix-shell
This commit adds a "build" command to the install derivation that
tells the user that `nix-shell` should be used.

A derivation attribute `shellHookOnly = true` is also added with the
intent to indicate that the shell hook is the entire point of the
derivation.
2019-08-15 23:23:43 +02:00
Tobias Happ
5c94538c7d numlock: set RemainAfterExit for numlockx.service 2019-08-15 11:53:34 +02:00
Tobias Happ
2eae9daae7 xsession: set RemainAfterExit for setxkbmap.service 2019-08-15 11:53:34 +02:00
Robert Helgesson
55c962fda2 gitlab-ci: trigger NUR update
This will trigger a CI job at

    https://gitlab.com/rycee/nur-expressions

that will update Home Manager in NUR.
2019-08-14 21:57:22 +02:00
Robert Helgesson
eb7f39f0aa gitlab-ci: add test stage 2019-08-14 17:38:47 +02:00
Nikita Uvarov
7310cfc557 zsh: fix completion when oh-my-zsh is enabled
enableCompletion option not only calls compinit but also adds
nix-zsh-completions package to home.packages which should still happen
even if oh-my-zsh is enabled.

The double compinit call will still be eliminated by moving guarding condition
down to the compinit call itself.

Fixes #771.
2019-08-09 15:02:31 +02:00
Nikita Uvarov
42ad0effdd zsh: create oh-my-zsh cache directory
Fixes #761.
2019-08-09 14:53:03 +02:00
paumr
bce63e4dff msmtp: add account option tls.fingerprint 2019-08-08 14:12:34 +02:00
Robert Helgesson
9302523d34 modules: fix module order 2019-08-08 13:53:22 +02:00
adisbladis
a9ecef1fa9 hound: add module 2019-08-08 13:52:27 +02:00
Evan Stoll
e59b8b0c37 numlock: add module
This adds an option `xsession.numlock` that enable the Num Lock key
when starting a graphical session.

Fixes #651
2019-08-08 13:25:01 +02:00
paumr
3743e8995a mbsync: fix use of certificatesFile
The `tls.certificatesFile` option may be set to a path but the
`CertificateFile` attribute should be a string.
2019-08-08 00:50:52 +02:00
Tobias Happ
4c9b40ca0e systemd-activate.rb: add start/stop/restart sockets 2019-08-07 23:12:30 +02:00
Robert Helgesson
d625186ce5 Remove use of network-online.target
This target is only available at the system level and has no effect on
user services.
2019-07-28 14:17:28 +02:00
Olli Helenius
caf3349f01 dconf: assume empty list value is a list of strings
Fixes #769.
2019-07-28 13:01:29 +03:00
Brian Hicks
6239ce20af nix-darwin: add docs 2019-07-26 23:45:05 +02:00
Robert Helgesson
54de0e1d79 xdg: create cache directory using keep file
We can avoid the activation block by instead creating a hidden file in
the directory.
2019-07-26 23:23:51 +02:00
Robert Helgesson
056443ccbd vscode: fix configuration path for Darwin
Fixes #737
2019-07-22 12:44:52 +02:00
Sebastian Zivota
7d68c46feb kakoune: add module 2019-07-17 22:40:26 +02:00
Shanon McQuay
734128930f skim: correctly name default options
skim uses SKIM_DEFAULT_OPTIONS rather than SKIM_DEFAULT_OPTS.
2019-07-17 21:53:30 +02:00
pacien
cc0cd538e6 taskwarrior-sync: add service module 2019-07-17 21:34:53 +02:00
Robert Helgesson
ca4f22be85 mbsync: use full path to mu in example 2019-07-17 10:02:35 +02:00
Robert Helgesson
c3520bfa52 mbsync: put extra config at the beginning
If it is at the end it will just end up applying to the last defined
section.

Fixes #748
2019-07-05 22:16:15 +02:00
Andreas Fehn
2029e104d4 xsuspender: write all options to config 2019-07-05 18:44:28 +02:00
Andreas Fehn
7c76f4a71f xsuspender: correctly name default section 2019-07-05 18:44:28 +02:00
arcnmx
95382060eb git: support nested section options
Closes #614
2019-07-04 16:51:28 +02:00
arcnmx
472d7731d6 git: support multiple values
Closes #614
2019-07-04 16:51:24 +02:00
Alexandre Héaumé
28f2dd612e broot: add module 2019-07-02 11:28:31 +02:00
Robert Helgesson
8467e7e10a getmail: restrict tests to Linux 2019-06-28 05:56:42 +02:00
Robert Helgesson
8f7cd53204 getmail: restrict platform to Linux
Need to limit this module to Linux since it uses systemd.
2019-06-27 20:04:18 +02:00
Róman Joost
68fe8623ad Address code review comments for getmail service
This patch started by addresssing the code review comments to close
https://github.com/rycee/home-manager/pull/290. However initiating a new
pull request it became clear, that home-manager changed significantly
since then.

This changes the initial pull request to be consistent with the email
account management in home-manager now. It also adds a simple test and support
for multiple accounts.
2019-06-27 07:48:09 +02:00
Mats Rauhala
8243cc0a5d getmail: add module 2019-06-27 07:48:09 +02:00
Robert Helgesson
95d55b8da1 xsession: add option importedVariables
This option lists the environment variables to be imported into the
systemd user session.

Also add a basic test of the xsession module.
2019-06-23 14:06:29 +02:00
Kai Wohlfahrt
f83c49baa3 gpg-agent: add sshcontrol configuration
This lets gpg-agent serve specific keys with authentication capability
as SSH keys
2019-06-18 13:37:19 +01:00
Jonas Holst Damtoft
cf0aad391c emacs: fix merging of extraPackages and overrides
Because `extraPackages` and `overrides` expect functions as values it
has not been possible to perform merges. This adds suitable types for
these options that allow reasonable merging.
2019-06-10 22:56:47 +02:00
Robert Helgesson
42732990cd home-manager: rewrite argument parsing
This rewrite allows "long options" but unfortunately does not allow
merged options such as `-vn`.

Also improve the home-manager manual page, with this it should include
all sub-commands and arguments.

Finally, include the home-manager manual page in the generated HTML
documentation.
2019-06-09 22:19:03 +02:00
Judson
f82246171b files: backup file collisions
When a configuration file would be written to an existing file, rather
than failing switch (and having the user have to move or delete those
files), move the files automatically to a new path.

Closes #585
2019-06-09 14:26:12 +02:00
Robert Helgesson
5b50eb18fc network-manager-applet: fix indentation 2019-06-09 12:13:11 +02:00
Sebastián Estrella
29824a8cf6 tmux: Disable confirmation prompt 2019-06-05 13:05:10 +09:00
Jaka Hudoklin
0db26fc3ab gpg: add module 2019-06-03 23:50:50 +02:00
Florian Klink
8991fe2e90 screen-locker: fix systemd unit
In particular, don't add trailing backslashes introduced by
`xautolockExtraOptions`. Systemd's unit file parser seems to have
gotten a bit stricter and with systemd 242, the trailing backslash
caused the next non-empty line to be ignored.

In that case, this was `[Section]`, so all subsequent settings were
mistakenly added to `[Service]`, causing them to be ignored entirely.

Simplify and fix this by using `concatStringsSep` to build a single
`ExecStart` line.
2019-06-02 23:29:37 +02:00
Sam Boosalis
2211770d8b home-manager: add Bash completion 2019-06-01 14:00:38 +02:00
Tad Fisher
e25113bcf0 browserpass: fix host/policy link sources 2019-06-01 12:24:30 +02:00
Robert Helgesson
e1535d2bd8 vscode: add example for extensions option 2019-05-31 21:37:28 +02:00
Robert Helgesson
d5bf68d77d xsuspender: limit module to Linux 2019-05-30 23:25:30 +02:00
Jaka Hudoklin
5b95fd0521 firefox: add profile options 2019-05-30 22:58:36 +02:00
Jaka Hudoklin
fcacba268d xsuspender: add module 2019-05-30 19:53:10 +02:00
Richard Marko
d7eaeaf636 random-background: add option display
This option parameterizes the `--bg-*` argument for feh.
2019-05-30 13:40:15 +02:00
Jaka Hudoklin
2e13c3cdfd nixos: use usercfg.home.username for username
Use `usercfg.home.username` for username instead of attribute name,
as this way we can change username regardless of the name of the attribute.
2019-05-25 14:26:49 +02:00
Robert Helgesson
d726afd9e4 imapnotify: specify notmuch configuration path 2019-05-19 01:08:06 +02:00
Roman Volosatovs
1480a6ca14 nix-darwin: actually install packages
Also apply assertions when using the nix-darwin module.

Closes #702
2019-05-19 00:36:35 +02:00
kalium
02a07f19a1 zsh: add autocd option 2019-05-17 09:39:26 +02:00
Tadeo Kondrak
d2ed39f103 alacritty: don't create file if settings is empty
Also add a few test cases for the alacritty module.
2019-05-14 23:53:10 +02:00
Tadeo Kondrak
8b15f18993 mpv: add module 2019-05-08 00:42:18 +02:00
Robert Helgesson
b256e3a44f fontconfig: fix build error
This fixes a build error occurring when building a configuration
having fontconfig enabled and `home.packages` only containing one
package installing things to `/lib`.

Also adds a number of test cases to verify the fontconfig cache
generation functionality.

Fixes #703
2019-05-06 00:44:23 +02:00
Robert Helgesson
939274281a tests: bump nmt version 2019-05-06 00:17:30 +02:00
Jos van Bakel
be4b100ae5 rsibreak: add module 2019-05-05 01:56:53 +02:00
Robert Helgesson
f99d4ba7c4 flameshot: fix service description 2019-05-01 13:13:38 +02:00
Robert Helgesson
1f4e9681f7 fontconfig: fix error on missing cachedir file
Fixes #699
2019-04-30 18:43:58 +02:00
Will Dietz
f56256f488 files: fix find invocation broken in c94eaa0e
Add parens to expression so the `-exec` includes files matching both.

Otherwise (before this change) the `-exec` is only invoked for
links (`-type l`):

    file or (link -> doexec)
      =>
    (file or link) -> doexec
2019-04-30 15:07:47 +02:00
Robert Helgesson
f18e2933d4 fontconfig: generate font cache files
Also deprecates the `fonts.fontconfig.enableProfileFonts` option. The
configuration is now always generated if `fonts.fontconfig.enable` is
set.

Fixes #520
2019-04-30 00:28:07 +02:00
Nick Hu
2f819d1647 imapnotify: add service 2019-04-29 00:05:02 +02:00
Mario Rodas
821df406c9 z-lua: add module 2019-04-28 23:57:31 +02:00
Robert Helgesson
3bb7c75db3 home-manager: add uninstall command 2019-04-28 18:40:41 +02:00
Robert Helgesson
c94eaa0e6c files: replace unnecessary use of xargs 2019-04-27 13:48:57 +02:00
Robert Helgesson
a16439e38e firefox: deprecate Google Talk and IcedTea options 2019-04-27 10:01:30 +02:00
Robert Helgesson
b6e613c771 Fix type of various sessionVariables options
Unfortunately, using `attrsOf` is not possible since it results in too
eager evaluation. In particular, the

    home.sessionVariables = {
      FOO = "Hello";
      BAR = "${config.home.sessionVariables.FOO} World!";
    };

example will cause an infinite recursion.

This commit restores the option type of

- `home.sessionVariables`,
- `pam.sessionVariables`,
- `programs.bash.sessionVariables`, and
- `programs.zsh.sessionVariables`

to `attrs`. It also adds test cases for the above options to avoid
regressions.

Fixes #659
2019-04-27 01:07:09 +02:00
Robert Hensing
c5f230e682 vscode.haskell: add module
- Haskell IDE Engine integration
- Syntax highlighting
2019-04-27 01:00:57 +02:00
Robert Helgesson
ba0375bf06 docs: add systemd type change to 19.03 release notes 2019-04-23 22:02:29 +02:00
Robert Helgesson
13ad532412 xscreensaver: add option settings 2019-04-22 23:44:46 +02:00
Robert Helgesson
8ecc311bcc Update stable version to 19.03
Also prepares for 19.09.
2019-04-22 20:04:31 +02:00
hyperfekt
e3831d8ecc alacritty: add module 2019-04-22 14:43:43 +02:00
Robert Helgesson
9c0536deda emacs: prevent service restart on change
Fixes #668
2019-04-18 01:38:25 +02:00
Robert Helgesson
6b42bd7abf systemd: support X-RestartIfChanged = false
Having this in the unit file will prevent the file from being
restarted if a change is detected. This is useful if data loss may
occur if the unit is suddenly restarted. For example, restarting the
Emacs service may result in the loss of unsaved open buffers.
2019-04-18 01:38:20 +02:00
Robert Helgesson
0d246aa435 systemd: escape unit names in systemctl commands 2019-04-18 01:37:59 +02:00
Benjamin Staffin
c5f35b7ff9 dconf: allow values to be floats
Technically dconf calls these "double" but nix floats ought to work.
2019-04-17 23:04:48 +02:00
Alex Ameen
ff602cb906 manual: add option manual.json.enable
Make it possible to install a JSON file containing the available Home
Manager options.
2019-04-15 22:43:46 +02:00
Olli Helenius
1806e5511e skim: add module 2019-04-14 17:36:27 +02:00
ash lea
cb93316fed browserpass: update app id 2019-04-14 11:40:37 +02:00
Nick Hu
a6f0fa90f7 email: add facility for email aliases
Also update the notmuch and alot modules to include support for email
aliases.
2019-04-12 21:26:46 +02:00
Robert Helgesson
30a16e3a87 polybar: change restart trigger to contain a string
The systemd unit type is a bit more strict now and needs an explicit
string in this position.
2019-04-12 17:56:14 +02:00
Robert Helgesson
3db46fa9bf news: limit mpdris2 and xcape news to Linux
These modules are limited to Linux since they define systemd services.
2019-04-12 01:02:12 +02:00
Robert Helgesson
12cb82af91 systemd: make the unit option type more robust
This should allow more sensible merging behavior. In particular, with
this change it is possible to use, for example, `mkForce` for greater
control of merging.

Fixes #543
2019-04-12 01:02:12 +02:00
Nick Hu
d49b514aa6 make notmuch search.exclude_tags configurable 2019-04-11 23:28:36 +09:00
Robert Helgesson
b6e1d82685 home-environment: make home.keyboard optional
When set to `null` then the `xsession` module will not attempt to
manage the keyboard settings.
2019-04-11 01:09:27 +02:00
Nick Hu
6cd5c8fca5 alot: fix address book completion regex 2019-04-10 23:55:07 +02:00
Robert Helgesson
67aee78fdf home-manager: remove unnecessary error message
An error message about the erroneous option is already printed by
`getopts` so there is no need to print it again.
2019-04-10 01:31:22 +02:00
Nick Hu
c48db4fbba xcape: add service 2019-04-09 22:15:48 +02:00
Robert Helgesson
f8b03f5750 modules: register the base modules path
This is needed, for example, to support relative paths when disabling
modules.
2019-04-07 13:26:38 +02:00
arcnmx
2c07829be2 home-manager: use callPackage where appropriate 2019-04-06 18:48:29 +02:00
Wael M. Nasreddine
652c694244 programs.tmux: implement secureSocket 2019-04-04 17:14:29 -07:00
Olli Helenius
995fa3af36 qt: add option platformTheme
This deprecates `useGtkTheme=true` with the intention of replacing it
with the `platformTheme` selection.
2019-04-03 23:55:36 +02:00
Robert Helgesson
4323b35198 pam: use attrsOf instead of attrs 2019-04-03 00:09:56 +02:00
Robert Helgesson
fd50f5465f zsh: use attrsOf instead of attrs 2019-04-03 00:09:55 +02:00
Robert Helgesson
13d2c470be home-environment: use attrsOf instead of attrs 2019-04-03 00:09:55 +02:00
Robert Helgesson
b690a8be2f bash: use attrsOf instead of attrs 2019-04-03 00:09:55 +02:00
Robert Helgesson
e85804efa2 feh: use attrsOf instead of attrs 2019-04-03 00:09:55 +02:00
Robert Helgesson
e26ad2026c gtk: use attrsOf instead of attrs 2019-04-03 00:09:46 +02:00
Olli Helenius
03162970cd gnome-terminal: add cursor and highlight color settings 2019-03-31 14:24:31 +02:00
Tadeo Kondrak
bc2b7d4f09 qt: use xdg.configHome instead of hard-coding 2019-03-27 22:40:12 +01:00
Robert Helgesson
f77d6b7a2d taffybar: restart the service on failure 2019-03-26 18:05:44 +01:00
Olli Helenius
1fdb16866b systemd: add support for session variables
Via environment.d(5).
2019-03-24 17:23:50 +01:00
Robert Helgesson
6ebf14143a systemd: add some basic tests 2019-03-24 15:52:30 +01:00
Robert Helgesson
cf5dac9563 random-background: minor documentation improvements 2019-03-24 15:29:08 +01:00
Robert Helgesson
2e1c825b90 readme: expand contact section slightly
In particular, mention that the channel is hosted by freenode and the
channel logs are hosted by samueldr.
2019-03-23 23:20:22 +01:00
Robert Helgesson
a974ce6257 readme: add contact section with the IRC channel 2019-03-22 19:10:43 +01:00
Robert Helgesson
5d81cb6ac7 manual: use writeShellScriptBin 2019-03-21 00:39:54 +01:00
Robert Helgesson
41356ac267 polybar: use writeShellScriptBin 2019-03-21 00:39:36 +01:00
Robert Helgesson
86af599a18 firefox: make the extensions option visible
Also change the example to use the firefox-addons available on NUR.
2019-03-20 23:41:02 +01:00
Mario Rodas
95e36dfe74 lsd: add module 2019-03-20 00:07:49 +01:00
Mario Rodas
24b5f62090 bat: add module 2019-03-19 23:58:12 +01:00
Robert Helgesson
989e636d98 ssh: add some basic tests 2019-03-19 23:00:17 +01:00
Robert Helgesson
eec78fbd1e ssh: support multiple identity files in a match block
Fixes #625
2019-03-19 22:35:13 +01:00
Robert Helgesson
70d4cf2cd9 Remove some use of mkDerivation
Instead use `runCommand`, which by default uses `stdenvNoCC` resulting
in a reduced dependency footprint.

Fixes #612
2019-03-18 23:09:54 +01:00
arcnmx
52692e299d git: make userName and userEmail options optional 2019-03-17 20:46:00 +01:00
Robert Helgesson
fd2bc150d8 faq: add entry about missing ca.desrt.dconf 2019-03-17 15:30:59 +01:00
Robert Helgesson
267afa5a3b firefox: add support for add-on packages
Since no official source of packages exist the option is hidden for
now. For adventurous people there is an overlay of a few selected
add-ons available at

    https://rycee.gitlab.io/nixpkgs-firefox-addons/overlay.tar.gz

This overlay is automatically built daily using the REST API available
on https://addons.mozilla.org/.
2019-03-11 00:55:32 +01:00
Wael M. Nasreddine
7ec153889c nix-darwin: login as the user when activating 2019-03-10 02:10:15 +01:00
Wael M. Nasreddine
efc795920b nix-darwin: support package install through user packages 2019-03-10 02:09:00 +01:00
Wael M. Nasreddine
d3fd287efb nix-darwin: activate home-manager through postActivation 2019-03-10 02:03:26 +01:00
Robert Prije
0fa19ed555 gnome-terminal: add support for light/dark theme variants 2019-03-10 01:59:00 +01:00
Robert Helgesson
52fdf5b7ec docs: add NixOS module installation instructions 2019-03-06 19:20:42 +01:00
Robert Helgesson
a09196c4ae docs: add language attribute to program listings 2019-03-06 18:52:54 +01:00
Robert Helgesson
1d8997633c docs: use <screen> for terminal interaction 2019-03-06 18:52:54 +01:00
Maximilian Bosch
0898b6b482 nixos module: evaluate assertions from Home Manager modules 2019-03-06 18:37:37 +01:00
Olli Helenius
848b8b983e pam: enclose session variable values in quotes 2019-03-06 18:00:51 +01:00
Maximilian Bosch
465d08d99f programs/zsh: properly escape shell aliases
Otherwise all aliases break that use single quotes inside.

Already fixed in the nixpkgs module in 1e211a70cbdaf230a18ea4cb67a959039d5c2ddb.
2019-02-28 14:10:14 +01:00
Peter Jones
f07510e2b6 mpdris2: add module 2019-02-24 01:32:34 +01:00
Robert Helgesson
b8b391ad18 tests: remove tests attribute from root default.nix
Having it there prevented, e.g., `nix-env -qaP` from working in some
cases.

Fixes #509
2019-02-23 22:32:44 +01:00
Matthieu Coudron
81dae2f88e alot: support contact completion
Make choice of contact completion easier.
2019-02-20 00:55:39 +01:00
Douglas Wilson
74811679b7 systemd: sanitize unit derivation names
To allow a few special characters such as "@".

This is taken from

    c414e5bd08/nixos/modules/system/boot/systemd-lib.nix (L14)
2019-02-19 23:43:47 +01:00
Robert Helgesson
93f5fcae1e msmtp: use <parameter> for CLI options in description 2019-02-17 23:25:42 +01:00
Robert Helgesson
92d4e3e75a autorandr: remove unnecessary method attribute
I mistakenly added this before noticing that it was already defaulted
to "factory". Sorry!
2019-02-17 23:06:39 +01:00
Terje Larsen
03f1aea069 autorandr: add support for xrandr scale and dpi 2019-02-17 22:56:01 +01:00
Mario Rodas
6da88339f5 git: allow contents in git.includes 2019-02-17 22:28:15 +01:00
Robert Helgesson
e0e8d5061d keychain: add news entry 2019-02-17 22:12:25 +01:00
Mario Rodas
62e73b17d2 keychain: add module 2019-02-17 22:07:24 +01:00
Robert Helgesson
799a90ecfa fontconfig: make fonts accessible when in NixOS module 2019-02-16 21:42:47 +01:00
Robert Helgesson
ef168979bf nixos module: support NixOS user packages install
When using the NixOS module we cannot guarantee that the Nix store
will be writable during startup. Installing the user packages through
`nix-env -i` will fail in these cases.

This commit adds a NixOS option `home-manager.useUserPackages` that,
when enabled, installs user packages through the NixOS

    users.users.<name?>.packages

option.

Note, when submodule support and external package install is enabled
then the installed packages are not available in `~/.nix-profile`. We
therefore set `home.profileDirectory` directly to the HM profile
packages.
2019-02-16 21:42:47 +01:00
Wael M. Nasreddine
2093cf425f tmux: general improvements and added options
See #575 for discussion.
2019-02-13 22:14:30 +01:00
Olli Helenius
a3462daeb1 msmtp: use XDG config directory 2019-02-11 01:06:28 +01:00
Robert Helgesson
a334a941c4 tests: bump to latest nmt version 2019-02-10 12:09:47 +01:00
Robert Helgesson
1cdb8abf30 git: add basic support for LFS
Fixes #542
2019-02-10 00:51:16 +01:00
Ingolf Wanger
fbdb5beb59 nixos: use correct username for systemd service 2019-02-10 00:46:44 +01:00
Robert Helgesson
2f372ab4d6 Clean up support code for Home Manager as a submodule
This removes the `nixosSubmodule` option in favor of a new option
`submoduleSupport.enable`. This name better indicates that the
submodule mode applies to both NixOS and nix-darwin.
2019-02-10 00:44:55 +01:00
Lorenzo Manacorda
524ce43e23 doc: add "See also" section to manpages
Pointing to each other.
2019-02-10 00:38:35 +01:00
Lorenzo Manacorda
7f8e139413 doc: remove extraneous contrib element
`contrib` is "A summary of the contributions made to a document by a
credited source", which we don't need in this case.
2019-02-10 00:38:35 +01:00
Robert Helgesson
99d79d0a80 doc: move home-manager man page to section 1
This is not really a system administration tool so 8 is unsuitable.
2019-02-10 00:38:28 +01:00
Jonas Holst Damtoft
0ca1bf3cfd emacs: add service module 2019-02-09 15:28:11 +01:00
Matthieu Coudron
c18984c452 neovim: allow to override package
If you want to run a development version for instance, it is easier to
set neovim.package rather than work around the wrapping mechanism etc.
2019-02-04 21:52:01 +01:00
Robert Helgesson
445c0b1482 git: use attrsOf instead of attrs
This makes sure that values added to

    programs.git.aliases

or

    programs.git.extraConfig

are merged as expected.

Also add a few option examples.
2019-02-01 01:12:58 +01:00
Robert Helgesson
0590c2a4f6 mbsync: add basic test of result configuration 2019-01-31 02:08:40 +01:00
Nadrieril
81ec856a0f mbsync: add some required assertions 2019-01-31 01:41:12 +01:00
Yurii Rashkovskii
2410bc603b nixpkgs: fix installation on non-x86
On non-x86 architectures (for example, aarch64) the installation of
home-manager fails indicating that it is attempting to select i686
packages for Linux and those aren't available.

Solution: make the condition for choosing these packages stricter
2019-01-29 20:15:18 +01:00
Robert Helgesson
45cadbd4f3 git: quote sendemail section header
This will allow, e.g., the character `@` in the email identity.

Also adds a test case.

Fixes #557
2019-01-29 18:28:55 +01:00
Amarandus
02a5a678f6 irssi: add module
irssi is a cli IRC client.
2019-01-29 00:53:39 +01:00
Robert Helgesson
98f534e172 flameshot: add bars to systemd After
Fixes #544
2019-01-29 00:20:16 +01:00
Matthieu Coudron
a68c8cf5f1 git: generate identities from mail accounts 2019-01-29 00:13:21 +01:00
wedens
604fc92943 polybar: add /run/wrappers/bin to PATH
Without this the network module in polybar is unable to check
connection as it invokes 'ping' command directly.
2019-01-26 14:44:57 +01:00
Robert Helgesson
008d93928f xembed-sni-proxy: add module 2019-01-26 14:20:46 +01:00
Jonas Holst Damtoft
601619660d fish: use global for abbr
Makes fish use global scope for abbreviations.
This makes it so that they don't stick across config changes.
Before, an abbreviation would still exist even if removed from the config.
2019-01-23 21:19:23 +01:00
Robert Helgesson
4aa07c3547 doc: bump copyright year to 2019 in man pages 2019-01-20 18:03:04 +01:00
Robert Helgesson
f3f7c5cc57 doc: reformat XML files 2019-01-20 18:01:22 +01:00
Robert Helgesson
c035046999 doc: add basic release notes 2019-01-20 17:56:44 +01:00
Robert Helgesson
e15cd64ac9 Update LICENSE file for 2019 2019-01-19 22:12:55 +01:00
Robert Helgesson
59a4ac71f9 i3: replace use of types.string by types.str 2019-01-19 19:02:59 +01:00
Robert Helgesson
7c04351a57 files: allow a wider range of source file names
In particular support source files whose name start with `.` or
contain characters not allowed in the nix store, such as spaces.

Also add some test cases for `home.file`.
2019-01-19 12:44:58 +01:00
Robert Helgesson
46f787950a tests: bump nmt version 2019-01-19 12:41:45 +01:00
Adam Washington
6a244b3a8d matplotlib: add module 2019-01-18 01:23:36 +01:00
John Wiegley
3cf8b9ea86 ssh: add proxyJump option 2019-01-15 22:31:08 +01:00
Nadrieril
df8a14e12a i3: add bar.extraConfig option 2019-01-15 12:31:10 +09:00
Robert Helgesson
f6ec26075d tests: simplify test names 2019-01-14 23:02:33 +01:00
Robert Helgesson
c42206db02 i3: add test of keybinding merge logic 2019-01-14 22:50:11 +01:00
Robert Helgesson
bb64012914 tests: bump nmt to latest 2019-01-14 22:48:59 +01:00
Nadrieril
d5cc53a4e1 i3: reallow using null to disable a keybinding 2019-01-14 22:21:42 +01:00
Robert Helgesson
55100918cc dunst: avoid error on missing dunst process 2019-01-14 00:04:50 +01:00
Robert Helgesson
faee571850 dunst: kill daemon on configuration change
Since Dunst is DBus activated it is OK to simply kill it since DBus
will restart it when necessary.
2019-01-13 23:48:20 +01:00
hyperfekt
6f422785c3 fish: autogenerate completions from man pages 2019-01-13 01:06:46 +01:00
David Guibert
a7affc93ba msmtp: add extraConfig account option
This patch allow to define custom msmtp options per email account. For
example: to change the "auth" method from "on" to "login", add
`msmtp.extraConfig.auth="login"`.
2019-01-13 00:25:05 +01:00
Marcial Gaißert
9052131aef programs.zsh: option localVariables
Add option "extraLocalVars" for additional local variable definitions
in .zshrc, at the top of the file.

Some zsh plugins/themes expect configuration in local variables before they
are loaded (example: https://github.com/bhilburn/powerlevel9k). Exporting
those clutters the environment and is unnecessary.
2019-01-11 10:26:13 +01:00
Marcial Gaißert
6b5e0efd1e programs.zsh: generate export statements in zsh syntax
Use the new module lib.zsh to generate export statements in zsh syntax, using
zsh arrays for lists.

Being a zsh script, this seems more intuitive for .zshrc
2019-01-11 10:26:12 +01:00
Marcial Gaißert
62eb7ebeba lib.zsh: add module
Added utilities to generate export statements and definitions for zsh scripts.

Currently, there is only lib.shell which generates export statements in bash
syntax. However, this does not allow to generate export statements for zsh
arrays (syntax: NAME=(elem1 elem2 ...) ), which would be the natural
representation of lists in the nix language.
2019-01-11 10:26:12 +01:00
Wael M. Nasreddine
c48fd9d842 autorandr: add support for xrandr transformation 2019-01-10 01:39:01 +01:00
Robert Helgesson
e150dd4a66 texlive: always require at least one extra package
Fixes #526
2019-01-09 02:09:23 +01:00
Olli Helenius
b3d73e0aff gnome-terminal: enable VTE OSC7 support for bash and zsh 2019-01-08 23:14:55 +01:00
Olli Helenius
16946a6f00 Address review comments 2019-01-03 10:51:37 +01:00
Olli Helenius
a4383075af zsh: add default keymap configuration 2019-01-03 10:51:37 +01:00
Robert Helgesson
20a60be550 emacs: make finalPackage option more accessible
Instead of "internal" mark it as "invisible".
2019-01-03 02:15:17 +01:00
Mario Rodas
7afefcf75d opam: add module 2018-12-28 13:33:13 +01:00
Robert Helgesson
40b3443c8f dconf: add some information of use under NixOS 2018-12-24 18:36:55 +01:00
Robert Helgesson
e3167068d9 Merge PR #436 2018-12-24 17:35:48 +01:00
Robert Helgesson
cc964b4609 gtk: remove option gtk.gtk3.waylandSupport 2018-12-24 17:26:34 +01:00
Robert Helgesson
370a84192e gtk: make gtk.gtk2 and gtk.gtk3 not submodules 2018-12-24 17:26:34 +01:00
Robert Helgesson
4104ff2b6a gtk: use dconf module for settings 2018-12-24 17:26:34 +01:00
Robert Helgesson
a0162dacf6 gnome-terminal: use dconf module for settings 2018-12-24 17:26:34 +01:00
Robert Helgesson
b2cc186d22 dconf: add module
This module allows unified configuration of dconf settings.
2018-12-24 17:26:34 +01:00
Robert Helgesson
235a6617c4 readme: add notice that relog may be needed
Also add instructions for non-NixOS users to add the user channel
directory to `NIX_PATH`.
2018-12-23 10:55:30 +01:00
Robert Helgesson
218a8c4d90 modules: support conditional module inclusion
Also make use of this functionality for the `programs.chromium`
module.

See #501
2018-12-22 23:57:00 +01:00
Robert Helgesson
e68d6e7924 emacs: add overrides option
This option enables overriding packages within the generated Emacs
package set.

Fixes #486
2018-12-17 23:01:43 +01:00
Olli Helenius
dc72aa2305 jq: add module 2018-12-12 22:02:51 +01:00
Lorenzo
93b10bcf3c readme: fix .gitconfig example
The example was referencing `~/.gitconfig`, which isn't being checked
anymore since 356c0bf751.
2018-12-12 00:17:09 +01:00
Lorenzo Manacorda
4971e3735e readme: clarify bash/zsh compatibility
Makes it clearer that the compatibility mentioned only relates to the
manual loading approach.
2018-12-12 00:15:54 +01:00
Robert Helgesson
6d56abcec1 tests: add initial test framework 2018-12-11 00:57:58 +01:00
Nikita Uvarov
5d63abb473 i3: fix default keybindings override
All default keybindings should have a default priority attached to them.
This will allow users to redefine some of the default keybindings
without using mkForce. Fixes #485.
2018-12-08 15:32:30 +01:00
Robert Helgesson
6e67bb7ae6 doc: add installation instructions to manual
Also minor cleanups in README.
2018-12-06 00:57:49 +01:00
Nikita Uvarov
d67835260d polybar: switch from attrs to attrsOf 2018-12-05 12:14:43 +01:00
Nikita Uvarov
b085344b91 dunst: switch from attrs to attrsOf 2018-12-05 12:14:40 +01:00
Nikita Uvarov
c108eaba42 i3: switch from attrs to attrsOf 2018-12-05 12:00:20 +01:00
dsx
6ce3ce69b9 ssh: add addressFamily option 2018-12-05 00:24:34 +01:00
Robert Helgesson
6826521ec5 ssh: add certificateFile option 2018-12-05 00:19:40 +01:00
Robert Helgesson
5fe62660aa ssh: realign options 2018-12-05 00:14:15 +01:00
dsx
7a28f68ad0 dunst: use 'icon_path' instead of 'icon_folders'
The 'icon_folders' option is deprecated.
2018-12-05 00:05:06 +01:00
Robert Helgesson
ea9d44bede rofi: switch from types.string to types.str 2018-12-04 23:43:12 +01:00
Robert Helgesson
fd3692b36f newsboat: switch from types.string to types.str 2018-12-04 23:42:30 +01:00
Robert Helgesson
cd7b6fdbc1 autorandr: switch from types.string to types.str 2018-12-04 23:41:42 +01:00
zimbatm
571e17410a home-manager: add edit command
With this change, running

    home-manager edit

opens `$HOME_MANAGER_CONFIG` in `$EDITOR`.

This is mainly for convenience. Users should not have to remember the
exact location of the Home Manager configuration.
2018-12-04 23:17:19 +01:00
Robert Helgesson
797fbbf826 beets: add enable option 2018-12-04 23:03:23 +01:00
Robert Helgesson
a37b5c9c61 Change installation instructions to use nix-channel
This avoids the uncontrollable nature of fetching the tarball as part
of the evaluation. Instead the user can decide when to update and also
perform rollbacks, if necessary.
2018-12-04 00:59:52 +01:00
Wael M. Nasreddine
30f3baabaf home-manager: import modules using relative path 2018-12-04 00:39:34 +01:00
Robert Helgesson
ef29f321e0 readme: switch stable channel to 18.09 2018-12-03 01:06:12 +01:00
dsx
15bca92b2c i3: support for workspace_layout option 2018-12-01 01:01:35 +01:00
dsx
71f6bc41eb i3: support for bar tray_output option 2018-12-01 00:53:16 +01:00
Robert Helgesson
6d2f16a7ae pasystray: add paprefs and pavucontrol
This enables the "volume control" and "control local sound server"
menu options.

Fixes #461
2018-11-30 23:43:26 +01:00
zimbatm
40b279e3a3 ssh: tweak default controlPath
Instead of using the hostname `%h`, which can be changed by the
~/.ssh/config file, use the commandline-given hostname `%n`.

This allows to alias a host with different hostnames, which then point
to different configurations. A common use-case for this is if you have
multiple accounts on github with each access to different private repos:

    Host github.com
      IdentitiesOnly yes
      User git
      IdentityFile ~/.ssh/id_rsa

    Host customer.github.com
      IdentitiesOnly yes
      User git
      IdentityFile ~/.ssh/customer
      HostName github.com

Without this change, if a connection was established with the first
github.com alias, then the user would try to pull a repo from the second
account, ssh would re-use the SSH connection which doesn't have access
to that repository.
2018-11-30 00:13:50 +01:00
Lee Henson
5d8b089188 neovim: support withNodeJs option 2018-11-29 00:54:27 +01:00
Wael M. Nasreddine
9686d93ff6 keybase: install the keybase package 2018-11-29 00:51:58 +01:00
zimbatm
67ebe16b40 termite: setup the shell hook
This fixes Ctrl+Shift+T not working.
2018-11-26 21:28:06 +01:00
hyperfekt
6ab6488e5a vscode: add module 2018-11-26 00:01:01 +01:00
Manuel Bärenz
ffdbefe22c nextcloud-client: add module
Adds the nextcloud-client as a service, simply copying the syntax from owncloud.client.
2018-11-25 23:13:13 +01:00
zimbatm
456e2d7ed5 ssh: add more options 2018-11-25 22:46:06 +01:00
Robert Helgesson
fa3d1f98e0 astroid: require notmuch synchronize flags 2018-11-25 13:53:45 +01:00
Robert Helgesson
c21b69e73e notmuch: add maildir.synchronizeFlags option 2018-11-25 13:33:30 +01:00
Robert Helgesson
9318bd3b0d notmuch: replace incorrect use of toJSON 2018-11-25 13:33:30 +01:00
Robert Helgesson
59448d635c version: add module 2018-11-24 17:27:59 +01:00
Will Fancher
a9a4fb641f nix-darwin: add system module for nix-darwin 2018-11-20 00:22:53 +01:00
Wael M. Nasreddine
f247b3b99b offlineimap: add an extraConfig for the account section 2018-11-19 23:57:58 +01:00
Robert Helgesson
fa62c5afb6 modules: fix list sort order 2018-11-19 00:07:29 +01:00
Ben Sima
061c7b633f afew: add module 2018-11-18 23:47:45 +01:00
Matthieu Coudron
dacc07136c astroid: add module
Astroid is a notmuch/gtk based MUA: https://github.com/astroidmail/astroid
2018-11-18 19:55:28 +01:00
Robert Helgesson
abfc37076a compton: minor reformatting 2018-11-15 00:28:52 +01:00
Robert Helgesson
9a0f388f66 compton: fix corrupt colors under Mesa 18
Fixes #441
2018-11-15 00:28:50 +01:00
Ben Sima
b08e6221e0 faq: add instructions on targeting multiple logins
Content adapted from

    https://github.com/rycee/home-manager/issues/394#issuecomment-422958338
2018-11-14 23:25:17 +01:00
Robert Helgesson
0efda9cd6b Use preferLocalBuild with runCommand 2018-11-14 20:59:45 +01:00
Sam Stites
f4ebbcbf70 tmux: add module
This commit adds the tmux program to Home Manager.

In addition to configuring tmux, a user may specify tmux plugins from
Nixpkgs. These can be included in the list of `plugins` and can either
be a package (all tmux plugins live under `nixpkgs.tmuxPlugins.*`), or
an object which includes the plugin and an `extraConfig`, which will
be run immediately after sourcing the tmux plugin.

Finally, this commit introduces two nested programs which may be
enabled which depend on tmux: tmuxp and tmuxinator. These do not have
the ability to be configured, although this may be a future
contribution.
2018-11-14 00:08:39 +01:00
Robert Helgesson
36ecad6cbe Add basic gitignore file 2018-11-14 00:08:39 +01:00
Robert Helgesson
22568a3d26 Revert PR #408
This reverts the commits

- "alot: change msmtp default command"
  8e798e4c28

- "astroid: init"
  736e340bde

because they include changes that break some configurations and some
options that are misplaced.
2018-11-12 21:59:11 +01:00
Matthieu Coudron
8e798e4c28 alot: change msmtp default command 2018-11-12 23:16:03 +09:00
Matthieu Coudron
736e340bde astroid: init
Astroid is a notmuch/gtk based MUA: https://github.com/astroidmail/astroid
2018-11-12 23:16:03 +09:00
Robert Helgesson
05c93ff3ae home-manager: remove uninstall activation phase
The manual install has been long deprecated so it should be safe to no
longer attempt to do an uninstall on each activation.
2018-11-04 09:58:00 +01:00
Robert Helgesson
8d4c65f259 fzf: only enable when line editing is available
Fixes #401

Suggested-by: Alex Vorobiev
Suggested-by: Mario Rodas
2018-10-30 00:17:09 +01:00
Robert Helgesson
0435d9c338 news: remove news item about removed vim options 2018-10-29 19:42:09 +01:00
Jonas Carpay
15a5f3278a Remove tabSize and lineNumbers check from news item 2018-10-20 16:57:27 +02:00
Nikita Uvarov
34bbd0ded1 vim: remove deprecated options 2018-10-20 13:13:19 +02:00
Nikita Uvarov
c17f37857c urxvt: add module 2018-10-20 11:35:39 +02:00
Nikita Uvarov
a2e09b4c9d vim: add options 2018-10-20 11:00:13 +02:00
Robert Helgesson
5013155e58 readme: documentation is now hosted on GitLab 2018-10-18 23:42:15 +02:00
Alex Brandt
7575e119d6 systemd: add more detail to user unit documentation
The current documentation does not provide guidance to users on how
systemd units are defined in Home Manager. A user may expect the
configuration to be similar to NixOS, when it actually differs.

Fixes #418
2018-10-18 23:39:28 +02:00
Alex Brandt
3b9b897af3 home-manager: add generation expiration command
This adds a new command to the home-manager shell script that allows
generations to be removed that are older than an given absolute or
relative date.

This allows users to manage the expiration of their home-manager
generations separately from their system or user profiles via
nix-collect-garbage. It is most important if the user desires to have
a convenient way to have different expiration times for Home Manager
generations than other system or user profiles.
2018-10-18 23:12:29 +02:00
Will Dietz
0cfd21cc15 compton: drop no-dock-blur option, add dock and dnd shadow
no-dock-blur doesn't exist in compton and was added by mistake.
2018-10-14 12:13:57 +02:00
Daniël de Kok
05a98b6be0 mbsync: change service unit type to 'oneshot'
The ExecStartPost command is currently started when the mbsync is
invoked succesfully. However, we typically want to run something like
'mu index' or 'notmuch new' after mbsync completes.  This changes the
unit type to oneshot, so that the ExecStartPost command is run after
mbsync finishes succesfully.
2018-10-13 19:28:40 +02:00
Nikita Uvarov
52b9363745 rofi: set configPath defaultText to avoid rebuilds 2018-10-12 10:52:41 +02:00
Mario Rodas
f947fafec9 direnv: add config option 2018-10-10 23:05:30 +02:00
Mario Rodas
68d3cdd722 direnv: add stdlib option 2018-10-10 23:02:31 +02:00
Will Dietz
5770dc58b9 mbsync: add option to add extra account configuration 2018-10-03 13:35:04 -05:00
Edward Betts
36da7a918f Correct spelling mistakes 2018-10-02 22:41:08 +02:00
Matthieu Coudron
782d2fab83 rofi: fix default path 2018-10-01 09:27:33 +02:00
Matthieu Coudron
d9c5d3c868 alot: add module
Alot is a python mail user agent (MUA) built around the Notmuch mail
system.
2018-09-28 23:43:40 +02:00
Robert Helgesson
9b3122e92c lib: copy module from NixOS
Importing the module directly from NixOS causes the documentation to
break, in particular the "Declared by" section.

Fixes #405
2018-09-27 21:01:13 +02:00
adisbladis
f44d4a1d86 obs-studio: add module 2018-09-27 19:58:31 +02:00
gnidorah
33a2943e8c gtk: add support for wayland 2018-09-26 21:32:43 +02:00
Mario Rodas
a1a7e7cd24 bash: fix bashrcExtra interactive shell test
To determine if bash is running interactively test whether "$-"
contains "i".

See: https://www.gnu.org/software/bash/manual/html_node/Is-this-Shell-Interactive_003f.html
2018-09-26 18:18:57 +02:00
Robert Helgesson
6957911657 xresources: remove unnecessary parentheses 2018-09-24 23:24:04 +02:00
Robert Helgesson
7cc36b7703 xresources: run xrdb -merge on change
Fixes #400
2018-09-24 23:19:54 +02:00
Matthieu Coudron
9407b42f97 accounts.emails: adding gpg/signature modules 2018-09-23 23:22:39 +02:00
Matthieu Coudron
151f29a17a mbsync: add options extraConfig.{channel|local|remote}
To allow supporting more advanced configurations. The local refers to
the "maildir store" configuration, remote to the "IMAP store", and
"channel" to the channel.
2018-09-23 23:22:39 +02:00
Roman Volosatovs
f7dc354f42 go: Fix package example 2018-09-21 09:46:11 +02:00
Robert Helgesson
4d870f665b taffybar: fix indentation 2018-09-21 00:51:23 +02:00
Roman Volosatovs
0635423e73 go: add module 2018-09-21 00:11:25 +02:00
Mario Rodas
3f34bf4465 noti: add module 2018-09-20 21:26:55 +02:00
Robert Helgesson
9f0fdc68a9 xsession: add option xsession.scriptPath
This option allows overriding the default script path `~/.xsession`.
On NixOS, this is needed to allow multiple possible graphical login
sessions.

Fixes #391.
2018-09-19 23:33:13 +02:00
Robert Helgesson
701b4130bd Remove unnecessary dag variables
Also remove a few trailing whitespaces.
2018-09-19 00:13:31 +02:00
Adam Washington
d27bccdff1 zathura: add module
Add the zathura document viewer as a program option with support for
managing the zathurarc configuration file.
2018-09-18 23:57:36 +02:00
Minijackson
5ff03ce5ac taskwarrior: add module 2018-09-18 23:31:37 +02:00
Nikita Uvarov
6eea2a409e vim: improve instructions for listing available plugins 2018-09-15 12:01:36 +02:00
Robert Helgesson
ea74820176 home-environment: add option home.extraProfileCommands
This _internal_ option indicates extra commands that should be run in
the `postBuild` step of the profile environment build.

Fixes #386
2018-09-14 21:08:51 +02:00
Robert Helgesson
50de1a6885 emacs: add internal finalPackage option 2018-09-11 21:23:11 +02:00
gnidorah
055d100548 i3 module: add missing pieces to default config 2018-09-10 11:33:51 +09:00
Roman Volosatovs
63efd26767 neovim: support new extraPython*Packages options
Also fix `configure` argument.
2018-09-09 22:09:00 +02:00
266 changed files with 12698 additions and 1930 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/result*

View File

@@ -1,6 +1,18 @@
image: nixos/nix:latest
stages:
- test
- deploy
Run tests:
stage: test
script:
- nix-shell tests -A run.files-text
only:
- release-19.09
pages:
stage: deploy
script:
- mkdir -p ~/.config/nixpkgs
- echo '{ manual.html.enable = true; }' > ~/.config/nixpkgs/home.nix
@@ -12,3 +24,14 @@ pages:
- public
only:
- master
Deploy NUR:
stage: deploy
variables:
HM_BRANCH: $CI_COMMIT_REF_NAME
HM_COMMIT_SHA: $CI_COMMIT_SHA
trigger:
project: rycee/nur-expressions
branch: master
only:
- release-19.09

View File

@@ -6,8 +6,7 @@ os:
before_script:
- mkdir -m 0755 -p /nix/var/nix/{profiles,gcroots}/per-user/$USER
- mkdir -p ~/.config/nixpkgs
- echo "{}" > ~/.config/nixpkgs/home.nix
script:
nix-shell . -A install
- nix-shell . -A install
- nix-shell tests -A run.all

View File

@@ -139,15 +139,18 @@ If you do have a change worthy of a news entry then please add one in
> use 'services.myservice.bar' instead.
- A new module, say `foo.nix`, should always include a news entry
(without any condition) that has a message along the lines of
that has a message along the lines of
> A new service is available: 'services.foo'.
> A new module is available: 'services.foo'.
or
If the module is platform specific, e.g., a service module using
systemd, then a condition like
> A new program configuration is available: 'program.foo'.
```
condition = hostPlatform.isLinux;
```
depending on the type of module.
should be added.
[open issues]: https://github.com/rycee/home-manager/issues
[new issue]: https://github.com/rycee/home-manager/issues/new

85
FAQ.md
View File

@@ -64,3 +64,88 @@ adding
to your `.profile` and `.zshrc` files, respectively. The
`hm-session-vars.sh` file should work in most Bourne-like shells.
How do set up a configuration for multiple users/machines?
----------------------------------------------------------
A typical way to prepare a repository of configurations for multiple
logins and machines is to prepare one "top-level" file for each unique
combination.
For example, if you have two machines, called "kronos" and "rhea" on
which you want to configure your user "jane" then you could create the
files
- `kronos-jane.nix`,
- `rhea-jane.nix`, and
- `common.nix`
in your repository. On the kronos and rhea machines you can then make
`~jane/.config/nixpkgs/home.nix` be a symbolic link to the
corresponding file in your configuration repository.
The `kronos-jane.nix` and `rhea-jane.nix` files follow the format
```nix
{ ... }:
{
imports = [ ./common.nix ];
# Various options that are specific for this machine/user.
}
```
while the `common.nix` file contains configuration shared across the
two logins. Of course, instead of just a single `common.nix` file you
can have multiple ones, even one per program or service.
You can get some inspiration from the [Post your home-manager home.nix
file!][1] Reddit thread.
[1]: https://www.reddit.com/r/NixOS/comments/9bb9h9/post_your_homemanager_homenix_file/
Why do I get an error message about `ca.desrt.dconf`?
-----------------------------------------------------
You are most likely trying to configure the GTK or Gnome Terminal but
the DBus session is not aware of the dconf service. The full error you
might get is
error: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name ca.desrt.dconf was not provided by any .service files
The solution on NixOS is to add
services.dbus.packages = with pkgs; [ gnome3.dconf ];
to your system configuration.
How do I install packages from Nixpkgs unstable?
------------------------------------------------
If you are using a stable version of Nixpkgs but would like to install
some particular packages from Nixpkgs unstable then you can import the
unstable Nixpkgs and refer to its packages within your configuration.
Something like
```nix
{ pkgs, config, ... }:
let
pkgsUnstable = import <nixpkgs-unstable> {};
in
{
home.packages = [
pkgsUnstable.foo
];
# …
}
```
should work provided you have a Nix channel called `nixpkgs-unstable`.
Note, the package will not be affected by any package overrides,
overlays, etc.

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2017-2018 Robert Helgesson
Copyright (c) 2017-2019 Robert Helgesson and Home Manager contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -19,7 +19,7 @@ will write to your dconf store and cannot tell whether a configuration
that it is about to be overwrite was from a previous Home Manager
generation or from manual configuration.
Home Manager targets [NixOS][] unstable and NixOS version 18.03 (the
Home Manager targets [NixOS][] unstable and NixOS version 19.09 (the
current stable version), it may or may not work on other Linux
distributions and NixOS versions.
@@ -31,6 +31,13 @@ on how to manually perform a rollback.
Now when your expectations have been built up and you are eager to try
all this out you can go ahead and read the rest of this text.
Contact
-------
You can chat with us on IRC in the channel [#home-manager][] on
[freenode][]. The [channel logs][] are hosted courtesy of
[samueldr][].
Installation
------------
@@ -48,56 +55,57 @@ Currently the easiest way to install Home Manager is as follows:
Also make sure that your user is able to build and install Nix
packages. For example, you should be able to successfully run a
command like `nix-instantiate '<nixpkgs>' -A hello`. For a
multi-user install of Nix this means that your user must be
covered by the [`allowed-users`][nixAllowedUsers] Nix option. On
NixOS you can control this option using the
command like `nix-instantiate '<nixpkgs>' -A hello` without having
to switch to the root user. For a multi-user install of Nix this
means that your user must be covered by the
[`allowed-users`][nixAllowedUsers] Nix option. On NixOS you can
control this option using the
[`nix.allowedUsers`][nixosAllowedUsers] system option.
2. Assign a temporary variable holding the URL to the appropriate
archive. Typically this is
2. Add the appropriate Home Manager channel. Typically this is
```console
$ HM_PATH=https://github.com/rycee/home-manager/archive/master.tar.gz
$ nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager
$ nix-channel --update
```
if you are following Nixpkgs master or an unstable channel and
```console
$ HM_PATH=https://github.com/rycee/home-manager/archive/release-18.03.tar.gz
$ nix-channel --add https://github.com/rycee/home-manager/archive/release-19.09.tar.gz home-manager
$ nix-channel --update
```
if you follow a Nixpkgs version 18.03 channel.
if you follow a Nixpkgs version 19.09 channel.
3. Create an initial Home Manager configuration file:
On NixOS you may need to log out and back in for the channel to
become available. On non-NixOS you may have to add
```shell
export NIX_PATH=$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH
```
to your shell (see [nix#2033](https://github.com/NixOS/nix/issues/2033)).
3. Install Home Manager and create the first Home Manager generation:
```console
$ cat > ~/.config/nixpkgs/home.nix <<EOF
{
programs.home-manager.enable = true;
programs.home-manager.path = $HM_PATH;
}
EOF
$ nix-shell '<home-manager>' -A install
```
4. Install Home Manager and create the first Home Manager generation:
Once finished, Home Manager should be active and available in your
user environment.
```console
$ nix-shell $HM_PATH -A install
```
Home Manager should now be active and available in your user
environment.
5. If you do not plan on having Home Manager manage your shell
3. If you do not plan on having Home Manager manage your shell
configuration then you must source the
```
"$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
```
file in your shell configuration. Unfortunately, we currently only
support POSIX.2-like shells such as [Bash][] or [Z shell][].
file in your shell configuration. Unfortunately, in this specific
case we currently only support POSIX.2-like shells such as
[Bash][] or [Z shell][].
For example, if you use Bash then add
@@ -107,11 +115,10 @@ Currently the easiest way to install Home Manager is as follows:
to your `~/.profile` file.
Note, because the `HM_PATH` variable above points to the live Home
Manager repository you will automatically get updates whenever you
build a new generation. If you dislike automatic updates then perform
a Git clone of the desired branch and instead do the above steps with
`HM_PATH` set to the _absolute path_ of your clone.
If instead of using channels you want to run Home Manager from a Git
checkout of the repository then you can use the
`programs.home-manager.path` option to specify the absolute path to
the repository.
Usage
-----
@@ -232,7 +239,7 @@ such collision is detected the activation will terminate before
changing anything on your computer.
For example, suppose you have a wonderful, painstakingly created
`~/.gitconfig` and add
`~/.config/git/config` and add
```nix
{
@@ -300,4 +307,8 @@ in your Home Manager configuration.
[nixAllowedUsers]: https://nixos.org/nix/manual/#conf-allowed-users
[nixosAllowedUsers]: https://nixos.org/nixos/manual/options.html#opt-nix.allowedUsers
[Z shell]: http://zsh.sourceforge.net/
[configuration options]: https://rycee.github.io/home-manager/options.html
[configuration options]: https://rycee.gitlab.io/home-manager/options.html
[#home-manager]: https://webchat.freenode.net/?url=irc%3A%2F%2Firc.freenode.net%2Fhome-manager
[freenode]: https://freenode.net/
[channel logs]: https://logs.nix.samueldr.com/home-manager/
[samueldr]: https://github.com/samueldr/

View File

@@ -1,13 +1,12 @@
{ pkgs ? import <nixpkgs> {} }:
rec {
home-manager = import ./home-manager {
inherit pkgs;
home-manager = pkgs.callPackage ./home-manager {
path = toString ./.;
};
install = import ./home-manager/install.nix {
inherit home-manager pkgs;
install = pkgs.callPackage ./home-manager/install.nix {
inherit home-manager;
};
nixos = import ./nixos;

View File

@@ -1,327 +1,72 @@
{ pkgs, options, config, version, revision, extraSources ? [] }:
with pkgs;
{ pkgs }:
let
lib = pkgs.lib;
# Remove invisible and internal options.
optionsListVisible = lib.filter (opt: opt.visible && !opt.internal) (lib.optionAttrSetToDocList options);
nmdSrc = pkgs.fetchFromGitLab {
name = "nmd";
owner = "rycee";
repo = "nmd";
rev = "9751ca5ef6eb2ef27470010208d4c0a20e89443d";
sha256 = "0rbx10n8kk0bvp1nl5c8q79lz1w0p1b8103asbvwps3gmqd070hi";
};
# Replace functions by the string <function>
substFunction = x:
if builtins.isAttrs x then lib.mapAttrs (name: substFunction) x
else if builtins.isList x then map substFunction x
else if lib.isFunction x then "<function>"
else x;
nmd = import nmdSrc { inherit pkgs; };
# Generate DocBook documentation for a list of packages. This is
# what `relatedPackages` option of `mkOption` from
# ../../../lib/options.nix influences.
#
# Each element of `relatedPackages` can be either
# - a string: that will be interpreted as an attribute name from `pkgs`,
# - a list: that will be interpreted as an attribute path from `pkgs`,
# - an attrset: that can specify `name`, `path`, `package`, `comment`
# (either of `name`, `path` is required, the rest are optional).
genRelatedPackages = packages:
let
unpack = p: if lib.isString p then { name = p; }
else if lib.isList p then { path = p; }
else p;
describe = args:
let
name = args.name or (lib.concatStringsSep "." args.path);
path = args.path or [ args.name ];
package = args.package or (lib.attrByPath path (throw "Invalid package attribute path `${toString path}'") pkgs);
in "<listitem>"
+ "<para><literal>pkgs.${name} (${package.meta.name})</literal>"
+ lib.optionalString (!package.meta.available) " <emphasis>[UNAVAILABLE]</emphasis>"
+ ": ${package.meta.description or "???"}.</para>"
+ lib.optionalString (args ? comment) "\n<para>${args.comment}</para>"
# Lots of `longDescription's break DocBook, so we just wrap them into <programlisting>
+ lib.optionalString (package.meta ? longDescription) "\n<programlisting>${package.meta.longDescription}</programlisting>"
+ "</listitem>";
in "<itemizedlist>${lib.concatStringsSep "\n" (map (p: describe (unpack p)) packages)}</itemizedlist>";
# Make sure the used package is scrubbed to avoid actually
# instantiating derivations.
scrubbedPkgsModule = {
imports = [
{
_module.args = {
pkgs = lib.mkForce (nmd.scrubDerivations "pkgs" pkgs);
pkgs_i686 = lib.mkForce { };
};
}
];
};
optionsListDesc = lib.flip map optionsListVisible (opt: opt // {
# Clean up declaration sites to not refer to the NixOS source tree.
declarations = map stripAnyPrefixes opt.declarations;
}
// lib.optionalAttrs (opt ? example) { example = substFunction opt.example; }
// lib.optionalAttrs (opt ? default) { default = substFunction opt.default; }
// lib.optionalAttrs (opt ? type) { type = substFunction opt.type; }
// lib.optionalAttrs (opt ? relatedPackages) { relatedPackages = genRelatedPackages opt.relatedPackages; });
hmModulesDocs = nmd.buildModulesDocs {
modules =
import ../modules/modules.nix { inherit lib pkgs; }
++ [ scrubbedPkgsModule ];
moduleRootPaths = [ ./.. ];
mkModuleUrl = path:
"https://github.com/rycee/home-manager/blob/master/${path}#blob-path";
channelName = "home-manager";
docBook.id = "home-manager-options";
};
# We need to strip references to /nix/store/* from options,
# including any `extraSources` if some modules came from elsewhere,
# or else the build will fail.
#
# E.g. if some `options` came from modules in ${pkgs.customModules}/nix,
# you'd need to include `extraSources = [ pkgs.customModules ]`
prefixesToStrip = map (p: "${toString p}/") ([ ./.. ] ++ extraSources);
stripAnyPrefixes = lib.flip (lib.fold lib.removePrefix) prefixesToStrip;
# Custom "less" that pushes up all the things ending in ".enable*"
# and ".package*"
optionLess = a: b:
let
ise = lib.hasPrefix "enable";
isp = lib.hasPrefix "package";
cmp = lib.splitByAndCompare ise lib.compare
(lib.splitByAndCompare isp lib.compare lib.compare);
in lib.compareLists cmp a.loc b.loc < 0;
# Customly sort option list for the man page.
optionsList = lib.sort optionLess optionsListDesc;
# Convert the list of options into an XML file.
optionsXML = builtins.toFile "options.xml" (builtins.toXML optionsList);
optionsDocBook = runCommand "options-db.xml"
{
nativeBuildInputs = [ buildPackages.libxslt.bin ];
}
''
optionsXML=${optionsXML}
xsltproc \
--stringparam program 'home-manager' \
--stringparam revision '${revision}' \
-o $out ${./options-to-docbook.xsl} $optionsXML
'';
sources = lib.sourceFilesBySuffices ./. [".xml"];
modulesDoc = builtins.toFile "modules.xml" ''
<section xmlns:xi="http://www.w3.org/2001/XInclude" id="modules">
${(lib.concatMapStrings (path: ''
<xi:include href="${path}" />
'') (lib.catAttrs "value" config.meta.doc))}
</section>
'';
generatedSources = runCommand "generated-docbook" {} ''
mkdir $out
ln -s ${modulesDoc} $out/modules.xml
ln -s ${optionsDocBook} $out/options-db.xml
printf "%s" "${version}" > $out/version
'';
copySources =
''
cp -prd $sources/* . # */
ln -s ${generatedSources} ./generated
chmod -R u+w .
'';
toc = builtins.toFile "toc.xml"
''
<toc role="chunk-toc">
docs = nmd.buildDocBookDocs {
pathName = "home-manager";
modulesDocs = [ hmModulesDocs ];
documentsDirectory = ./.;
chunkToc = ''
<toc>
<d:tocentry xmlns:d="http://docbook.org/ns/docbook" linkend="book-home-manager-manual"><?dbhtml filename="index.html"?>
<d:tocentry linkend="ch-options"><?dbhtml filename="options.html"?></d:tocentry>
<d:tocentry linkend="ch-tools"><?dbhtml filename="tools.html"?></d:tocentry>
<d:tocentry linkend="ch-release-notes"><?dbhtml filename="release-notes.html"?></d:tocentry>
</d:tocentry>
</toc>
'';
};
manualXsltprocOptions = toString [
"--param section.autolabel 1"
"--param section.label.includes.component.label 1"
"--stringparam html.stylesheet 'style.css overrides.css highlightjs/mono-blue.css'"
"--stringparam html.script './highlightjs/highlight.pack.js ./highlightjs/loader.js'"
"--param xref.with.number.and.title 1"
"--param toc.section.depth 3"
"--stringparam admon.style ''"
"--stringparam callout.graphics.extension .svg"
"--stringparam current.docid manual"
"--param chunk.section.depth 0"
"--param chunk.first.sections 1"
"--param use.id.as.filename 1"
"--stringparam generate.toc 'book toc appendix toc'"
"--stringparam chunk.toc ${toc}"
];
in
manual-combined = runCommand "home-manager-manual-combined"
{ inherit sources;
nativeBuildInputs = [ buildPackages.libxml2.bin buildPackages.libxslt.bin ];
meta.description = "The Home Manager manual as plain docbook XML";
}
''
${copySources}
{
inherit nmdSrc;
xmllint --xinclude --output ./manual-combined.xml ./manual.xml
xmllint --xinclude --noxincludenode \
--output ./man-pages-combined.xml ./man-pages.xml
options = {
json = hmModulesDocs.json.override {
path = "share/doc/home-manager/options.json";
};
};
# outputs the context of an xmllint error output
# LEN lines around the failing line are printed
function context {
# length of context
local LEN=6
# lines to print before error line
local BEFORE=4
# xmllint output lines are:
# file.xml:1234: there was an error on line 1234
while IFS=':' read -r file line rest; do
echo
if [[ -n "$rest" ]]; then
echo "$file:$line:$rest"
local FROM=$(($line>$BEFORE ? $line - $BEFORE : 1))
# number lines & filter context
nl --body-numbering=a "$file" | sed -n "$FROM,+$LEN p"
else
if [[ -n "$line" ]]; then
echo "$file:$line"
else
echo "$file"
fi
fi
done
}
function lintrng {
xmllint --debug --noout --nonet \
--relaxng ${docbook5}/xml/rng/docbook/docbook.rng \
"$1" \
2>&1 | context 1>&2
# ^ redirect assumes xmllint doesnt print to stdout
}
lintrng manual-combined.xml
lintrng man-pages-combined.xml
mkdir $out
cp manual-combined.xml $out/
cp man-pages-combined.xml $out/
'';
olinkDB = runCommand "manual-olinkdb"
{ inherit sources;
nativeBuildInputs = [ buildPackages.libxml2.bin buildPackages.libxslt.bin ];
}
''
xsltproc \
${manualXsltprocOptions} \
--stringparam collect.xref.targets only \
--stringparam targets.filename "$out/manual.db" \
--nonet \
${docbook5_xsl}/xml/xsl/docbook/xhtml/chunktoc.xsl \
${manual-combined}/manual-combined.xml
cat > "$out/olinkdb.xml" <<EOF
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE targetset SYSTEM
"file://${docbook5_xsl}/xml/xsl/docbook/common/targetdatabase.dtd" [
<!ENTITY manualtargets SYSTEM "file://$out/manual.db">
]>
<targetset>
<targetsetinfo>
Allows for cross-referencing olinks between the manpages
and manual.
</targetsetinfo>
<document targetdoc="manual">&manualtargets;</document>
</targetset>
EOF
'';
in rec {
inherit generatedSources;
# The Home Manager options in JSON format.
optionsJSON = runCommand "options-json"
{ meta.description = "List of Home Manager options in JSON format";
}
''
# Export list of options in different format.
dst=$out/share/doc/home-manager
mkdir -p $dst
cp ${builtins.toFile "options.json" (builtins.unsafeDiscardStringContext (builtins.toJSON
(builtins.listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) optionsList))))
} $dst/options.json
mkdir -p $out/nix-support
echo "file json $dst/options.json" >> $out/nix-support/hydra-build-products
''; # */
# Generate the Home Manager manual.
manual = runCommand "home-manager-manual"
{ inherit sources;
nativeBuildInputs = [ buildPackages.libxml2.bin buildPackages.libxslt.bin ];
meta.description = "The Home Manager manual in HTML format";
allowedReferences = ["out"];
}
''
# Generate the HTML manual.
dst=$out/share/doc/home-manager
mkdir -p $dst
xsltproc \
${manualXsltprocOptions} \
--stringparam target.database.document "${olinkDB}/olinkdb.xml" \
--nonet --output $dst/ \
${docbook5_xsl}/xml/xsl/docbook/xhtml/chunktoc.xsl \
${manual-combined}/manual-combined.xml
mkdir -p $dst/images/callouts
cp ${docbook5_xsl}/xml/xsl/docbook/images/callouts/*.svg $dst/images/callouts/
cp ${./style.css} $dst/style.css
cp ${./overrides.css} $dst/overrides.css
cp -r ${pkgs.documentation-highlighter} $dst/highlightjs
mkdir -p $out/nix-support
echo "nix-build out $out" >> $out/nix-support/hydra-build-products
echo "doc manual $dst" >> $out/nix-support/hydra-build-products
''; # */
manualEpub = runCommand "home-manager-manual-epub"
{ inherit sources;
buildInputs = [ libxml2.bin libxslt.bin zip ];
}
''
# Generate the epub manual.
dst=$out/share/doc/home-manager
xsltproc \
${manualXsltprocOptions} \
--stringparam target.database.document "${olinkDB}/olinkdb.xml" \
--nonet --xinclude --output $dst/epub/ \
${docbook5_xsl}/xml/xsl/docbook/epub/docbook.xsl \
${manual-combined}/manual-combined.xml
mkdir -p $dst/epub/OEBPS/images/callouts
cp -r ${docbook5_xsl}/xml/xsl/docbook/images/callouts/*.svg $dst/epub/OEBPS/images/callouts # */
echo "application/epub+zip" > mimetype
manual="$dst/home-manager-manual.epub"
zip -0Xq "$manual" mimetype
cd $dst/epub && zip -Xr9D "$manual" *
rm -rf $dst/epub
mkdir -p $out/nix-support
echo "doc-epub manual $manual" >> $out/nix-support/hydra-build-products
'';
# Generate the Home Manager manpages.
manpages = runCommand "home-manager-manpages"
{ inherit sources;
nativeBuildInputs = [ buildPackages.libxml2.bin buildPackages.libxslt.bin ];
allowedReferences = ["out"];
}
''
# Generate manpages.
mkdir -p $out/share/man
xsltproc --nonet \
--param man.output.in.separate.dir 1 \
--param man.output.base.dir "'$out/share/man/'" \
--param man.endnotes.are.numbered 0 \
--param man.break.after.slash 1 \
--stringparam target.database.document "${olinkDB}/olinkdb.xml" \
${docbook5_xsl}/xml/xsl/docbook/manpages/docbook.xsl \
${manual-combined}/man-pages-combined.xml
'';
manPages = docs.manPages;
manual = {
inherit (docs) html htmlOpenTool;
};
}

310
doc/installation.xml Normal file
View File

@@ -0,0 +1,310 @@
<chapter xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
version="5.0"
xml:id="ch-installation">
<title>Installing Home Manager</title>
<para>
Home Manager can be used in three primary ways:
<orderedlist>
<listitem>
<para>
Using the standalone <command>home-manager</command> tool. For platforms
other than NixOS and Darwin, this is the only available choice. It is also
recommended for people on NixOS or Darwin that want to manage their home
directory independent of the system as a whole. See
<xref linkend="sec-install-standalone"/> for instructions on how to
perform this installation.
</para>
</listitem>
<listitem>
<para>
As a module within a NixOS system configuration. This allows the user
profiles to be built together with the system when running
<command>nixos-rebuild</command>. See
<xref linkend="sec-install-nixos-module"/> for a description of this
setup.
</para>
</listitem>
<listitem>
<para>
As a module within a
<link xlink:href="https://github.com/LnL7/nix-darwin/">nix-darwin</link>
system configuration. This allows the user profiles to be built together
with the system when running <command>darwin-rebuild</command>. See
<xref linkend="sec-install-nix-darwin-module"/> for a description of this
setup.
</para>
</listitem>
</orderedlist>
</para>
<section xml:id="sec-install-standalone">
<title>Standalone installation</title>
<orderedlist>
<listitem>
<para>
Make sure you have a working Nix installation. If you are not using NixOS
then it may be necessary to run
</para>
<screen>
<prompt>$</prompt> <userinput>mkdir -m 0755 -p /nix/var/nix/{profiles,gcroots}/per-user/$USER</userinput>
</screen>
<para>
since Home Manager uses these directories to manage your profile
generations. On NixOS these should already be available.
</para>
<para>
Also make sure that your user is able to build and install Nix packages.
For example, you should be able to successfully run a command like
<literal>nix-instantiate '&lt;nixpkgs&gt;' -A hello</literal> without
having to switch to the root user. For a multi-user install of Nix this
means that your user must be covered by the
<link xlink:href="https://nixos.org/nix/manual/#conf-allowed-users"><literal>allowed-users</literal></link>
Nix option. On NixOS you can control this option using the
<link xlink:href="https://nixos.org/nixos/manual/options.html#opt-nix.allowedUsers"><literal>nix.allowedUsers</literal></link>
system option.
</para>
</listitem>
<listitem>
<para>
Add the Home Manager channel that you wish to follow. This is done by
running
</para>
<screen>
<prompt>$</prompt> <userinput>nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager</userinput>
<prompt>$</prompt> <userinput>nix-channel --update</userinput>
</screen>
<para>
if you are following Nixpkgs master or an unstable channel and
</para>
<screen>
<prompt>$</prompt> <userinput>nix-channel --add https://github.com/rycee/home-manager/archive/release-19.09.tar.gz home-manager</userinput>
<prompt>$</prompt> <userinput>nix-channel --update</userinput>
</screen>
<para>
if you follow a Nixpkgs version 19.09 channel.
</para>
<para>
On NixOS you may need to log out and back in for the channel to become
available. On non-NixOS you may have to add
<programlisting language="bash">
export NIX_PATH=$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH
</programlisting>
to your shell (see
<link xlink:href="https://github.com/NixOS/nix/issues/2033">nix#2033</link>).
</para>
</listitem>
<listitem>
<para>
Run the Home Manager installation command and create the first Home
Manager generation:
</para>
<screen>
<prompt>$</prompt> <userinput>nix-shell '&lt;home-manager&gt;' -A install</userinput>
</screen>
<para>
Once finished, Home Manager should be active and available in your user
environment.
</para>
</listitem>
<listitem>
<para>
If you do not plan on having Home Manager manage your shell configuration
then you must source the
</para>
<programlisting language="bash">
$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
</programlisting>
<para>
file in your shell configuration. Unfortunately, we currently only support
POSIX.2-like shells such as
<link xlink:href="https://www.gnu.org/software/bash/">Bash</link> or
<link xlink:href="http://zsh.sourceforge.net/">Z shell</link>.
</para>
<para>
For example, if you use Bash then add
</para>
<programlisting language="bash">
. &quot;$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh&quot;
</programlisting>
<para>
to your <literal>~/.profile</literal> file.
</para>
</listitem>
</orderedlist>
<para>
If instead of using channels you want to run Home Manager from a Git
checkout of the repository then you can use the
<literal>programs.home-manager.path</literal> option to specify the absolute
path to the repository.
</para>
</section>
<section xml:id="sec-install-nixos-module">
<title>NixOS module</title>
<para>
Home Manager provides a NixOS module that allows you to prepare user
environments directly from the system configuration file, which often is
more convenient than using the <command>home-manager</command> tool. It also
opens up additional possibilities, for example, to automatically configure
user environments in NixOS declarative containers or on systems deployed
through NixOps.
</para>
<para>
To make the NixOS module available for use you must <option>import</option>
it into your system configuration. This is most conveniently done by adding
a Home Manager channel, for example
</para>
<screen>
<prompt>#</prompt> <userinput>nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager</userinput>
<prompt>#</prompt> <userinput>nix-channel --update</userinput>
</screen>
<para>
if you are following Nixpkgs master or an unstable channel and
</para>
<screen>
<prompt>#</prompt> <userinput>nix-channel --add https://github.com/rycee/home-manager/archive/release-19.09.tar.gz home-manager</userinput>
<prompt>#</prompt> <userinput>nix-channel --update</userinput>
</screen>
<para>
if you follow a Nixpkgs version 19.09 channel.
</para>
<para>
It is then possible to add
</para>
<programlisting language="nix">
imports = [ &lt;home-manager/nixos&gt; ];
</programlisting>
<para>
to your system <filename>configuration.nix</filename> file, which will
introduce a new NixOS option called <option>home-manager.users</option>
whose type is an attribute set that maps user names to Home Manager
configurations.
</para>
<para>
For example, a NixOS configuration may include the lines
</para>
<programlisting language="nix">
users.users.eve.isNormalUser = true;
home-manager.users.eve = { pkgs, ... }: {
home.packages = [ pkgs.atool pkgs.httpie ];
programs.bash.enable = true;
};
</programlisting>
<para>
and after a <command>nixos-rebuild switch</command> the user eve's
environment should include a basic Bash configuration and the packages atool
and httpie.
</para>
<note>
<para>
By default packages will be installed to
<filename>$HOME/.nix-profile</filename> but they can be installed to
<filename>/etc/profiles</filename> if
</para>
<programlisting language="nix">
home-manager.useUserPackages = true;
</programlisting>
<para>
is added to the system configuration. This is necessary if, for example,
you wish to use <command>nixos-rebuild build-vm</command>. This option may
become the default value in the future.
</para>
</note>
</section>
<section xml:id="sec-install-nix-darwin-module">
<title>nix-darwin module</title>
<para>
Home Manager provides a module that allows you to prepare user
environments directly from the nix-darwin configuration file, which often is
more convenient than using the <command>home-manager</command> tool.
</para>
<para>
To make the NixOS module available for use you must <option>import</option>
it into your system configuration. This is most conveniently done by adding
a Home Manager channel, for example
</para>
<screen>
<prompt>#</prompt> <userinput>nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager</userinput>
<prompt>#</prompt> <userinput>nix-channel --update</userinput>
</screen>
<para>
if you are following Nixpkgs master or an unstable channel and
</para>
<screen>
<prompt>#</prompt> <userinput>nix-channel --add https://github.com/rycee/home-manager/archive/release-19.09.tar.gz home-manager</userinput>
<prompt>#</prompt> <userinput>nix-channel --update</userinput>
</screen>
<para>
if you follow a Nixpkgs version 19.09 channel.
</para>
<para>
It is then possible to add
</para>
<programlisting language="nix">
imports = [ &lt;home-manager/nix-darwin&gt; ];
</programlisting>
<para>
to your nix-darwin <filename>configuration.nix</filename> file, which will
introduce a new NixOS option called <option>home-manager</option> whose type
is an attribute set that maps user names to Home Manager configurations.
</para>
<para>
For example, a nix-darwin configuration may include the lines
</para>
<programlisting language="nix">
home-manager.users.eve = { pkgs, ... }: {
home.packages = [ pkgs.atool pkgs.httpie ];
programs.bash.enable = true;
};
</programlisting>
<para>
and after a <command>darwin-rebuild --switch</command> the user eve's
environment should include a basic Bash configuration and the packages atool
and httpie.
</para>
<note>
<para>
By default user packages will not be ignored in favor of
<option>environment.systemPackages</option>, but they will be intalled to
<option>/etc/profiles/per-user/$USERNAME</option> if
</para>
<programlisting language="nix">
home-manager.useUserPackages = true;
</programlisting>
<para>
is added to the nix-darwin configuration. This option may become the default
value in the future.
</para>
</note>
</section>
</chapter>

View File

@@ -7,28 +7,34 @@
<refmiscinfo class="source">Home Manager</refmiscinfo>
<!-- <refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo> -->
</refmeta>
<refnamediv>
<refname><filename>home-configuration.nix</filename></refname>
<refpurpose>Home Manager configuration specification</refpurpose>
</refnamediv>
<refsection>
<title>Description</title>
<para>
The file <filename>~/.config/nixpkgs/home.nix</filename> contains
the declarative specification of your Home Manager configuration.
The command <command>home-manager</command> takes this file and
realises the user environment configuration specified therein.
The file <filename>~/.config/nixpkgs/home.nix</filename> contains the
declarative specification of your Home Manager configuration. The command
<command>home-manager</command> takes this file and realises the user
environment configuration specified therein.
</para>
</refsection>
<refsection>
<title>Options</title>
<para>
You can use the following options in
<filename>home-configuration.nix</filename>:
</para>
<xi:include href="./generated/options-db.xml" xpointer="configuration-variable-list" />
<xi:include href="./nmd-result/home-manager-options.xml" />
</refsection>
<refsection>
<title>See also</title>
<para>
<citerefentry>
<refentrytitle>home-manager</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>
</para>
</refsection>
</refentry>

View File

@@ -2,61 +2,496 @@
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude">
<refmeta>
<refentrytitle><command>home-manager</command></refentrytitle>
<manvolnum>8</manvolnum>
<refentrytitle><command>home-manager</command>
</refentrytitle><manvolnum>1</manvolnum>
<refmiscinfo class="source">Home Manager</refmiscinfo>
<!-- <refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo> -->
</refmeta>
<refnamediv>
<refname><command>home-manager</command></refname>
<refpurpose>reconfigure a user environment</refpurpose>
<refname><command>home-manager</command>
</refname><refpurpose>reconfigure a user environment</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>home-manager</command>
<group choice='req'>
<arg choice='plain'><option>help</option></arg>
<arg choice='plain'><option>build</option></arg>
<arg choice='plain'><option>switch</option></arg>
<arg choice='plain'><option>generations</option></arg>
<arg choice='plain'><option>remove-generations</option></arg>
<arg choice='plain'><option>packages</option></arg>
<arg choice='plain'><option>news</option></arg>
<command>home-manager</command> <group choice="req">
<arg choice="plain">
build
</arg>
<arg choice="plain">
edit
</arg>
<arg choice="plain">
expire-generations <replaceable>timestamp</replaceable>
</arg>
<arg choice="plain">
generations
</arg>
<arg choice="plain">
help
</arg>
<arg choice="plain">
news
</arg>
<arg choice="plain">
packages
</arg>
<arg choice="plain">
remove-generations <replaceable>ID …</replaceable>
</arg>
<arg choice="plain">
switch
</arg>
<arg choice="plain">
uninstall
</arg>
</group>
<sbr />
<arg>
-A <replaceable>attrPath</replaceable>
</arg>
<arg>
-I <replaceable>path</replaceable>
</arg>
<arg>
-b <replaceable>ext</replaceable>
</arg>
<arg>
<group choice="req">
<arg choice="plain">
-f
</arg>
<arg choice="plain">
--file
</arg>
</group> <replaceable>path</replaceable>
</arg>
<arg>
<group choice="req">
<arg choice="plain">
-h
</arg>
<arg choice="plain">
--help
</arg>
</group>
</arg>
<arg>
<group choice="req">
<arg choice="plain">
-n
</arg>
<arg choice="plain">
--dry-run
</arg>
</group>
</arg>
<arg>
--option <replaceable>name</replaceable> <replaceable>value</replaceable>
</arg>
<arg>
--cores <replaceable>number</replaceable>
</arg>
<arg>
--max-jobs <replaceable>number</replaceable>
</arg>
<arg>
--keep-failed
</arg>
<arg>
--keep-going
</arg>
<arg>
--show-trace
</arg>
<arg>
<group choice="req">
<arg choice="plain">
-v
</arg>
<arg choice="plain">
--verbose
</arg>
</group>
</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsection>
<title>Description</title>
<para>
This command updates the user environment so that it corresponds to the configuration
specified in <filename>~/.config/nixpkgs/home.nix</filename>.
This command updates the user environment so that it corresponds to the
configuration specified in <filename>~/.config/nixpkgs/home.nix</filename>.
</para>
<para>
All operations using this tool expects a sub-command that indicates the
operation to perform. It must be one of
<variablelist>
<varlistentry>
<term>
<option>build</option>
</term>
<listitem>
<para>
Build configuration into a <filename>result</filename> directory.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>edit</option>
</term>
<listitem>
<para>
Open the home configuration using the editor indicated by
<envar>EDITOR</envar>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>expire-generations <replaceable>timestamp</replaceable></option>
</term>
<listitem>
<para>
Remove generations older than <replaceable>timestamp</replaceable> where
<replaceable>timestamp</replaceable> is interpreted as in the
<option>-d</option> argument of the <citerefentry>
<refentrytitle>date</refentrytitle>
<manvolnum>1</manvolnum> </citerefentry> tool. For example <literal>-30
days</literal> or <literal>2018-01-01</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>generations</option>
</term>
<listitem>
<para>
List all home environment generations.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>help</option>
</term>
<listitem>
<para>
Print tool help.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>news</option>
</term>
<listitem>
<para>
Show news entries in a pager.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>packages</option>
</term>
<listitem>
<para>
List all packages installed in <varname>home-manager-path</varname>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>remove-generations <replaceable>ID …</replaceable></option>
</term>
<listitem>
<para>
Remove indicated generations. Use the <option>generations</option>
sub-command to find suitable generation numbers.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>switch</option>
</term>
<listitem>
<para>
Build and activate the configuration.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>uninstall</option>
</term>
<listitem>
<para>
Remove Home Manager from the user environment. This will
<itemizedlist>
<listitem>
<para>
remove all managed files from the home directory,
</para>
</listitem>
<listitem>
<para>
remove packages installed through Home Manager from the user profile,
and
</para>
</listitem>
<listitem>
<para>
optionally remove all Home Manager generations and make them
available for immediate garbage collection.
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsection>
<refsection>
<title>Files</title>
<title>Options</title>
<para>
The tool accepts the options
</para>
<variablelist>
<varlistentry>
<term><filename>~/.local/share/home-manager/news-read-ids</filename></term>
<term>
<option>-A <replaceable>attrPath</replaceable></option>
</term>
<listitem>
<para>
Identifiers of news items that have been shown. Can be deleted
to reset the read news indicator.
Optional attribute that selects a configuration expression in the
configuration file. That is, if <filename>home.nix</filename> contains
<programlisting language="nix">
{
joe-at-work = {pkgs, ...}: { home.packages = [ pkgs.fortune ]; };
joe-at-home = {pkgs, ...}: { home.packages = [ pkgs.cowsay ]; };
}
</programlisting>
then the command <command>home-manager switch -A joe-at-work</command>
will activate the profile containing the fortune program.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-I <replaceable>path</replaceable></option>
</term>
<listitem>
<para>
Add a path to the Nix expression search path. For example, to build a
Home Manager profile using a specific Nixpkgs run <command>home-manager
-I nixpkgs=/absolute/path/to/nixpkgs build</command>. By default
<literal>&lt;nixpkgs&gt;</literal> is used.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-b <replaceable>extension</replaceable></option>
</term>
<listitem>
<para>
Enable automatic resolution of collisions between unmanaged and managed
files. The name of the original file will be suffixed by the given
extension. For example,
<screen>
<prompt>$</prompt> <userinput>home-manager -b bck switch</userinput>
</screen>
will cause a colliding file <filename>~/.config/foo.conf</filename> to be
moved to <filename>~/.config/foo.conf.bck</filename>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-f <replaceable>path</replaceable></option>
</term>
<term>
<option>--file <replaceable>path</replaceable></option>
</term>
<listitem>
<para>
Indicates the path to the Home Manager configuration file. If not given,
<filename>~/.config/nixpkgs/home.nix</filename> is used.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-h</option>
</term>
<term>
<option>--help</option>
</term>
<listitem>
<para>
Prints usage information for the <command>home-manager</command> tool.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-n</option>
</term>
<term>
<option>--dry-run</option>
</term>
<listitem>
<para>
Perform a dry-run of the given operation, only prints what actions would
be taken.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--option <replaceable>name</replaceable> <replaceable>value</replaceable></option>
</term>
<listitem>
<para>
Passed on to <citerefentry>
<refentrytitle>nix-build</refentrytitle>
<manvolnum>1</manvolnum> </citerefentry>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--cores <replaceable>number</replaceable></option>
</term>
<listitem>
<para>
Passed on to <citerefentry>
<refentrytitle>nix-build</refentrytitle>
<manvolnum>1</manvolnum> </citerefentry>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--max-jobs <replaceable>number</replaceable></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>
</term>
<listitem>
<para>
Passed on to <citerefentry>
<refentrytitle>nix-build</refentrytitle>
<manvolnum>1</manvolnum> </citerefentry>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--keep-going</option>
</term>
<listitem>
<para>
Passed on to <citerefentry>
<refentrytitle>nix-build</refentrytitle>
<manvolnum>1</manvolnum> </citerefentry>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--show-trace</option>
</term>
<listitem>
<para>
Passed on to <citerefentry>
<refentrytitle>nix-build</refentrytitle>
<manvolnum>1</manvolnum> </citerefentry>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-v</option>
</term>
<term>
<option>--verbose</option>
</term>
<listitem>
<para>
Activates verbose output.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection>
<title>Files</title>
<variablelist>
<varlistentry>
<term>
<filename>~/.local/share/home-manager/news-read-ids</filename>
</term>
<listitem>
<para>
Identifiers of news items that have been shown. Can be deleted to reset
the read news indicator.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection>
<title>Bugs</title>
<para>
Please report any bugs on the <link
Please report any bugs on the
<link
xlink:href="https://github.com/rycee/home-manager/issues">project
issue tracker</link>.
</para>
</refsection>
<refsection>
<title>See also</title>
<para>
<citerefentry>
<refentrytitle>home-configuration.nix</refentrytitle>
<manvolnum>5</manvolnum> </citerefentry>
</para>
</refsection>
</refentry>

View File

@@ -3,12 +3,8 @@
xmlns:xi="http://www.w3.org/2001/XInclude">
<title>Home Manager Reference Pages</title>
<info>
<author>
<personname>Home Manager contributors</personname>
<contrib>Author</contrib>
</author>
<copyright>
<year>2017-2018</year><holder>Home Manager contributors</holder>
<author><personname>Home Manager contributors</personname></author>
<copyright><year>20172019</year><holder>Home Manager contributors</holder>
</copyright>
</info>
<xi:include href="man-configuration.xml" />

View File

@@ -9,12 +9,13 @@
<preface>
<title>Preface</title>
<para>
This manual will eventually describes how to install, use, and
extend Home Manager.
This manual will eventually describes how to install, use, and extend Home
Manager.
</para>
<para>
If you encounter problems or bugs then please report them on the
<link xlink:href="https://github.com/rycee/home-manager/issues">Home Manager issue tracker</link>.
<link xlink:href="https://github.com/rycee/home-manager/issues">Home Manager
issue tracker</link>.
</para>
<note>
<para>
@@ -24,8 +25,14 @@
</para>
</note>
</preface>
<xi:include href="installation.xml" />
<appendix xml:id="ch-options">
<title>Configuration Options</title>
<xi:include href="./generated/options-db.xml" xpointer="configuration-variable-list" />
<xi:include href="./nmd-result/home-manager-options.xml" />
</appendix>
<appendix xml:id="ch-tools">
<title>Tools</title>
<xi:include href="./man-home-manager.xml" />
</appendix>
<xi:include href="./release-notes/release-notes.xml" />
</book>

View File

@@ -1,239 +0,0 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:str="http://exslt.org/strings"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://docbook.org/ns/docbook"
extension-element-prefixes="str"
>
<xsl:output method='xml' encoding="UTF-8" />
<xsl:param name="revision" />
<xsl:param name="program" />
<xsl:template match="/expr/list">
<appendix>
<title>Configuration Options</title>
<variablelist xml:id="configuration-variable-list">
<xsl:for-each select="attrs">
<xsl:variable name="id" select="concat('opt-', str:replace(str:replace(str:replace(str:replace(attr[@name = 'name']/string/@value, '*', '_'), '&lt;', '_'), '>', '_'), '?', '_'))" />
<varlistentry>
<term xlink:href="#{$id}">
<xsl:attribute name="xml:id"><xsl:value-of select="$id"/></xsl:attribute>
<option>
<xsl:value-of select="attr[@name = 'name']/string/@value" />
</option>
</term>
<listitem>
<para>
<xsl:value-of disable-output-escaping="yes"
select="attr[@name = 'description']/string/@value" />
</para>
<xsl:if test="attr[@name = 'type']">
<para>
<emphasis>Type:</emphasis>
<xsl:text> </xsl:text>
<xsl:value-of select="attr[@name = 'type']/string/@value"/>
<xsl:if test="attr[@name = 'readOnly']/bool/@value = 'true'">
<xsl:text> </xsl:text>
<emphasis>(read only)</emphasis>
</xsl:if>
</para>
</xsl:if>
<xsl:if test="attr[@name = 'default']">
<para>
<emphasis>Default:</emphasis>
<xsl:text> </xsl:text>
<xsl:apply-templates select="attr[@name = 'default']" mode="top" />
</para>
</xsl:if>
<xsl:if test="attr[@name = 'example']">
<para>
<emphasis>Example:</emphasis>
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="attr[@name = 'example']/attrs[attr[@name = '_type' and string[@value = 'literalExample']]]">
<programlisting><xsl:value-of select="attr[@name = 'example']/attrs/attr[@name = 'text']/string/@value" /></programlisting>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="attr[@name = 'example']" mode="top" />
</xsl:otherwise>
</xsl:choose>
</para>
</xsl:if>
<xsl:if test="attr[@name = 'relatedPackages']">
<para>
<emphasis>Related packages:</emphasis>
<xsl:text> </xsl:text>
<xsl:value-of disable-output-escaping="yes"
select="attr[@name = 'relatedPackages']/string/@value" />
</para>
</xsl:if>
<xsl:if test="count(attr[@name = 'declarations']/list/*) != 0">
<para>
<emphasis>Declared by:</emphasis>
</para>
<xsl:apply-templates select="attr[@name = 'declarations']" />
</xsl:if>
<xsl:if test="count(attr[@name = 'definitions']/list/*) != 0">
<para>
<emphasis>Defined by:</emphasis>
</para>
<xsl:apply-templates select="attr[@name = 'definitions']" />
</xsl:if>
</listitem>
</varlistentry>
</xsl:for-each>
</variablelist>
</appendix>
</xsl:template>
<xsl:template match="*" mode="top">
<xsl:choose>
<xsl:when test="string[contains(@value, '&#010;')]">
<programlisting>
<xsl:text>''
</xsl:text><xsl:value-of select='str:replace(string/@value, "${", "&apos;&apos;${")' /><xsl:text>''</xsl:text></programlisting>
</xsl:when>
<xsl:otherwise>
<literal><xsl:apply-templates /></literal>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="null">
<xsl:text>null</xsl:text>
</xsl:template>
<xsl:template match="string">
<xsl:choose>
<xsl:when test="(contains(@value, '&quot;') or contains(@value, '\')) and not(contains(@value, '&#010;'))">
<xsl:text>''</xsl:text><xsl:value-of select='str:replace(@value, "${", "&apos;&apos;${")' /><xsl:text>''</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>"</xsl:text><xsl:value-of select="str:replace(str:replace(str:replace(str:replace(@value, '\', '\\'), '&quot;', '\&quot;'), '&#010;', '\n'), '$', '\$')" /><xsl:text>"</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="int">
<xsl:value-of select="@value" />
</xsl:template>
<xsl:template match="bool[@value = 'true']">
<xsl:text>true</xsl:text>
</xsl:template>
<xsl:template match="bool[@value = 'false']">
<xsl:text>false</xsl:text>
</xsl:template>
<xsl:template match="list">
[
<xsl:for-each select="*">
<xsl:apply-templates select="." />
<xsl:text> </xsl:text>
</xsl:for-each>
]
</xsl:template>
<xsl:template match="attrs[attr[@name = '_type' and string[@value = 'literalExample']]]">
<xsl:value-of select="attr[@name = 'text']/string/@value" />
</xsl:template>
<xsl:template match="attrs">
{
<xsl:for-each select="attr">
<xsl:value-of select="@name" />
<xsl:text> = </xsl:text>
<xsl:apply-templates select="*" /><xsl:text>; </xsl:text>
</xsl:for-each>
}
</xsl:template>
<xsl:template match="derivation">
<replaceable>(build of <xsl:value-of select="attr[@name = 'name']/string/@value" />)</replaceable>
</xsl:template>
<xsl:template match="attr[@name = 'declarations' or @name = 'definitions']">
<simplelist>
<xsl:for-each select="list/string">
<member><filename>
<!-- Hyperlink the filename either to the NixOS Subversion
repository (if its a module and we have a revision number),
or to the local filesystem. -->
<xsl:choose>
<xsl:when test="not(starts-with(@value, '/'))">
<xsl:choose>
<xsl:when test="$program = 'home-manager'">
<xsl:attribute name="xlink:href">https://github.com/rycee/home-manager/blob/<xsl:value-of select="$revision"/>/<xsl:value-of select="@value"/>#blob-path</xsl:attribute>
</xsl:when>
<xsl:when test="$revision = 'local'">
<xsl:attribute name="xlink:href">https://github.com/NixOS/nixpkgs/blob/master/<xsl:value-of select="@value"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="xlink:href">https://github.com/NixOS/nixpkgs/blob/<xsl:value-of select="$revision"/>/<xsl:value-of select="@value"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$revision != 'local' and $program = 'nixops' and contains(@value, '/nix/')">
<xsl:attribute name="xlink:href">https://github.com/NixOS/nixops/blob/<xsl:value-of select="$revision"/>/nix/<xsl:value-of select="substring-after(@value, '/nix/')"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="xlink:href">file://<xsl:value-of select="@value"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<!-- Print the filename and make it user-friendly by replacing the
/nix/store/<hash> prefix by the default location of nixos
sources. -->
<xsl:choose>
<xsl:when test="$program = 'home-manager'">
&lt;home-manager/<xsl:value-of select="@value"/>&gt;
</xsl:when>
<xsl:when test="not(starts-with(@value, '/'))">
&lt;nixpkgs/<xsl:value-of select="@value"/>&gt;
</xsl:when>
<xsl:when test="contains(@value, 'nixops') and contains(@value, '/nix/')">
&lt;nixops/<xsl:value-of select="substring-after(@value, '/nix/')"/>&gt;
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@value" />
</xsl:otherwise>
</xsl:choose>
</filename></member>
</xsl:for-each>
</simplelist>
</xsl:template>
<xsl:template match="function">
<xsl:text>λ</xsl:text>
</xsl:template>
</xsl:stylesheet>

View File

@@ -1,9 +0,0 @@
.docbook .xref img[src^=images\/callouts\/],
.screen img,
.programlisting img {
width: 1em;
}
.calloutlist img {
width: 1.5em;
}

View File

@@ -0,0 +1,14 @@
<appendix xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
version="5.0"
xml:id="ch-release-notes">
<title>Release Notes</title>
<para>
This section lists the release notes for stable versions of Home Manager and
the current unstable version.
</para>
<xi:include href="rl-1909.xml" />
<xi:include href="rl-1903.xml" />
<xi:include href="rl-1809.xml" />
</appendix>

View File

@@ -0,0 +1,4 @@
[[sec-release-18.09]]
== Release 18.09
The 18.09 release branch became the stable branch in September, 2018.

View File

@@ -0,0 +1,59 @@
[[sec-release-19.03]]
== Release 19.03
The 19.03 release branch became the stable branch in April, 2019.
[[sec-release-19.03-highlights]]
=== Highlights
:opt-home-file-source: opt-home.file._name__.source
This release has the following notable changes:
* The <<{opt-home-file-source}>> option now allows source files to be
hidden, that is, having a name starting with the `.` character. It
also allows the source file name to contain characters not typically
allowed for Nix store paths. For example, your configuration can now
contain things such as
+
[source,nix]
----
home.file."my file".source = ./. + "/file with spaces!";
----
* The type used for the systemd unit options under
<<opt-systemd.user.services>>, <<opt-systemd.user.sockets>>, etc. has
been changed to offer more robust merging of configurations. If you
don't override values within systemd units then you are not affected
by this change. Unfortunately, if you do override unit values you may
encounter errors.
+
In particular, if you get an error saying that a ``unique option'' is
``defined multiple times'' then you need to use the
https://nixos.org/nixos/manual/#sec-option-definitions-setting-priorities[`mkForce`]
function. For example,
+
[source,nix]
----
systemd.user.services.foo.Service.ExecStart = "/foo/bar";
----
+
becomes
+
[source,nix]
----
systemd.user.services.foo.Service.ExecStart = lib.mkForce "/foo/bar";
----
+
We had to make this change because the old merging was causing too
many confusing situations for people.
[[sec-release-19.03-state-version-changes]]
=== State Version Changes
The state version in this release includes the changes below. These
changes are only active if the <<opt-home.stateVersion>> option is set
to ``19.03'' or later.
* There is now an option <<opt-programs.beets.enable>> that defaults
to `false`. Before the module would be active if the
<<opt-programs.beets.settings>> option was non-empty.

View File

@@ -0,0 +1,31 @@
[[sec-release-19.09]]
== Release 19.09
The 19.09 release branch became the stable branch in October, 2019.
[[sec-release-19.09-highlights]]
=== Highlights
This release has the following notable changes:
* The <<opt-programs.firefox.enableGoogleTalk>> and
<<opt-programs.firefox.enableIcedTea>> options are now deprecated
and will only work if Firefox ESR 52.x is used.
* The `home-manager` tool now provides an `uninstall` sub-command that
can be used to uninstall Home Manager, if used in the standalone
mode. That is, not as a NixOS module.
[[sec-release-19.09-state-version-changes]]
=== State Version Changes
The state version in this release includes the changes below. These
changes are only active if the `home.stateVersion` option is set to
"19.09" or later.
* The <<opt-programs.firefox.package>> option now expects a wrapped
Firefox package and defaults to `pkgs.firefox`.
* The options <<opt-home.keyboard.layout>> and
<<opt-home.keyboard.variant>> now default to `null`, which indicates
that the system value should be used.

View File

@@ -1,271 +0,0 @@
/* Copied from http://bakefile.sourceforge.net/, which appears
licensed under the GNU GPL. */
/***************************************************************************
Basic headers and text:
***************************************************************************/
body
{
font-family: "Nimbus Sans L", sans-serif;
background: white;
margin: 2em 1em 2em 1em;
}
h1, h2, h3, h4
{
color: #005aa0;
}
h1 /* title */
{
font-size: 200%;
}
h2 /* chapters, appendices, subtitle */
{
font-size: 180%;
}
/* Extra space between chapters, appendices. */
div.chapter > div.titlepage h2, div.appendix > div.titlepage h2
{
margin-top: 1.5em;
}
div.section > div.titlepage h2 /* sections */
{
font-size: 150%;
margin-top: 1.5em;
}
h3 /* subsections */
{
font-size: 125%;
}
div.simplesect h2
{
font-size: 110%;
}
div.appendix h3
{
font-size: 150%;
margin-top: 1.5em;
}
div.refnamediv h2, div.refsynopsisdiv h2, div.refsection h2 /* refentry parts */
{
margin-top: 1.4em;
font-size: 125%;
}
div.refsection h3
{
font-size: 110%;
}
/***************************************************************************
Examples:
***************************************************************************/
div.example
{
border: 1px solid #b0b0b0;
padding: 6px 6px;
margin-left: 1.5em;
margin-right: 1.5em;
background: #f4f4f8;
border-radius: 0.4em;
box-shadow: 0.4em 0.4em 0.5em #e0e0e0;
}
div.example p.title
{
margin-top: 0em;
}
div.example pre
{
box-shadow: none;
}
/***************************************************************************
Screen dumps:
***************************************************************************/
pre.screen, pre.programlisting
{
border: 1px solid #b0b0b0;
padding: 3px 3px;
margin-left: 1.5em;
margin-right: 1.5em;
background: #f4f4f8;
font-family: monospace;
border-radius: 0.4em;
box-shadow: 0.4em 0.4em 0.5em #e0e0e0;
}
div.example pre.programlisting
{
border: 0px;
padding: 0 0;
margin: 0 0 0 0;
}
/***************************************************************************
Notes, warnings etc:
***************************************************************************/
.note, .warning
{
border: 1px solid #b0b0b0;
padding: 3px 3px;
margin-left: 1.5em;
margin-right: 1.5em;
margin-bottom: 1em;
padding: 0.3em 0.3em 0.3em 0.3em;
background: #fffff5;
border-radius: 0.4em;
box-shadow: 0.4em 0.4em 0.5em #e0e0e0;
}
div.note, div.warning
{
font-style: italic;
}
div.note h3, div.warning h3
{
color: red;
font-size: 100%;
padding-right: 0.5em;
display: inline;
}
div.note p, div.warning p
{
margin-bottom: 0em;
}
div.note h3 + p, div.warning h3 + p
{
display: inline;
}
div.note h3
{
color: blue;
font-size: 100%;
}
div.navfooter *
{
font-size: 90%;
}
/***************************************************************************
Links colors and highlighting:
***************************************************************************/
a { text-decoration: none; }
a:hover { text-decoration: underline; }
a:link { color: #0048b3; }
a:visited { color: #002a6a; }
/***************************************************************************
Table of contents:
***************************************************************************/
div.toc
{
font-size: 90%;
}
div.toc dl
{
margin-top: 0em;
margin-bottom: 0em;
}
/***************************************************************************
Special elements:
***************************************************************************/
tt, code
{
color: #400000;
}
.term
{
font-weight: bold;
}
div.variablelist dd p, div.glosslist dd p
{
margin-top: 0em;
}
div.variablelist dd, div.glosslist dd
{
margin-left: 1.5em;
}
div.glosslist dt
{
font-style: italic;
}
.varname
{
color: #400000;
}
span.command strong
{
font-weight: normal;
color: #400000;
}
div.calloutlist table
{
box-shadow: none;
}
table
{
border-collapse: collapse;
box-shadow: 0.4em 0.4em 0.5em #e0e0e0;
}
table.simplelist
{
text-align: left;
color: #005aa0;
border: 0;
padding: 5px;
background: #fffff5;
font-weight: normal;
font-style: italic;
box-shadow: none;
margin-bottom: 1em;
}
div.navheader table, div.navfooter table {
box-shadow: none;
}
div.affiliation
{
font-style: italic;
}

View File

@@ -0,0 +1,356 @@
#!/bin/env bash
##################################################
# « home-manager » command-line completion
#
# © 2019 "Sam Boosalis" <samboosalis@gmail.com>
#
# MIT License
#
##################################################
# Contributing:
# Compatibility — Bash 3.
#
# OSX won't update Bash 3 (last updated circa 2009) to Bash 4,
# and we'd like this completion script to work on both Linux and Mac.
#
# For example, OSX Yosemite (released circa 2014) ships with Bash 3:
#
# $ echo $BASH_VERSION
# 3.2
#
# While Ubuntu LTS 14.04 (a.k.a. Trusty, also released circa 2016)
# ships with the latest version, Bash 4 (updated circa 2016):
#
# $ echo $BASH_VERSION
# 4.3
#
# Testing
#
# (1) Invoke « shellcheck »
#
# * source: « https://github.com/koalaman/shellcheck »
# * run: « shellcheck ./share/bash-completion/completions/home-manager »
#
# (2) Interpret via Bash 3
#
# * run: « bash --noprofile --norc ./share/bash-completion/completions/home-manager »
#
##################################################
# Examples:
# $ home-manager <TAB>
#
# -A
# -I
# -f
# --file
# -h
# --help
# -n
# --dry-run
# -v
# --verbose
# build
# edit
# expire-generations
# generations
# help
# news
# packages
# remove-generations
# switch
# uninstall
# $ home-manager e<TAB>
#
# edit
# expire-generations
# $ home-manager remove-generations 20<TAB>
#
# 200
# 201
# 202
# 203
##################################################
# Notes:
# « home-manager » Subcommands:
#
# help
# edit
# build
# switch
# generations
# remove-generations
# expire-generations
# packages
# news
# uninstall
# « home-manager » Options:
#
# -b EXT
# -f FILE
# --file FILE
# -A ATTRIBUTE
# -I PATH
# -v
# --verbose
# -n
# --dry-run
# -h
# --help
# $ home-manager
#
# Usage: /home/sboo/.nix-profile/bin/home-manager [OPTION] COMMAND
#
# Options
#
# -f FILE The home configuration file.
# Default is '~/.config/nixpkgs/home.nix'.
# -A ATTRIBUTE Optional attribute that selects a configuration
# expression in the configuration file.
# -I PATH Add a path to the Nix expression search path.
# -b EXT Move existing files to new path rather than fail.
# -v Verbose output
# -n Do a dry run, only prints what actions would be taken
# -h Print this help
#
# Commands
#
# help Print this help
#
# edit Open the home configuration in $EDITOR
#
# build Build configuration into result directory
#
# switch Build and activate configuration
#
# generations List all home environment generations
#
# remove-generations ID...
# Remove indicated generations. Use 'generations' command to
# find suitable generation numbers.
#
# expire-generations TIMESTAMP
# Remove generations older than TIMESTAMP where TIMESTAMP is
# interpreted as in the -d argument of the date tool. For
# example "-30 days" or "2018-01-01".
#
# packages List all packages installed in home-manager-path
#
# news Show news entries in a pager
#
# uninstall Remove Home Manager
#
##################################################
# Dependencies:
command -v home-manager >/dev/null
command -v grep >/dev/null
command -v sed >/dev/null
##################################################
# Code:
_home-manager_list-generation-identifiers ()
{
home-manager generations | sed -n -e 's/^................ : id \([[:alnum:]]\+\) -> .*/\1/p'
}
# NOTES
#
# (1) the « sed -n -e 's/.../.../p' » invocation:
#
# * the « -e '...' » option takes a Sed Script.
# * the « -n » option only prints when « .../p » would print.
# * the « s/xxx/yyy/ » Sed Script substitutes « yyy » whenever « xxx » is matched.
#
# (2) the « '^................ : id \([[:alnum:]]\+\) -> .*' » regular expression:
#
# * matches « 199 », for example, in the line « 2019-03-13 15:26 : id 199 -> /nix/store/mv619y9pzgsx3kndq0q7fjfvbqqdy5k8-home-manager-generation »
#
#
#------------------------------------------------#
# shellcheck disable=SC2120
_home-manager_list-nix-attributes ()
{
local HomeFile
local HomeAttrsString
# local HomeAttrsArray
# local HomeAttr
if [ -z "$1" ]
then
HomeFile=$(readlink -f "$(_home-manager_get-default-home-file)")
else
HomeFile="$1"
fi
HomeAttrsString=$(nix-instantiate --eval -E "let home = import ${HomeFile}; in (builtins.trace (builtins.toString (builtins.attrNames home)) null)" |& grep '^trace: ')
HomeAttrsString="${HomeAttrsString#trace: }"
echo "${HomeAttrsString}"
# IFS=" " read -ar HomeAttrsArray <<< "${HomeAttrsString}"
#
# local HomeAttr
# for HomeAttr in "${HomeAttrsArray[@]}"
# do
# echo "${HomeAttr}"
# done
}
# e.g.:
#
# $ nix-instantiate --eval -E 'let home = import /home/sboo/configuration/configs/nixpkgs/home-attrs.nix; in (builtins.trace (builtins.toString (builtins.attrNames home)) null)' 1>/dev/null
# trace: darwin linux
#
# $ _home-manager_list-nix-attributes
# linux darwin
#
#------------------------------------------------#
_home-manager_get-default-home-file ()
{
local HomeFileDefault
HomeFileDefault="$(_home-manager_xdg-get-config-home)/nixpkgs/home.nix"
echo "${HomeFileDefault}"
}
# e.g.:
#
# $ _home-manager_get-default-home-file
# ~/.config/nixpkgs/home.nix
#
##################################################
# XDG-BaseDirs:
_home-manager_xdg-get-config-home () {
echo "${XDG_CONFIG_HOME:-$HOME/.config}"
}
#------------------------------------------------#
_home-manager_xdg-get-data-home () {
echo "${XDG_DATA_HOME:-$HOME/.local/share}"
}
#------------------------------------------------#
_home-manager_xdg-get-cache-home () {
echo "${XDG_CACHE_HOME:-$HOME/.cache}"
}
##################################################
# shellcheck disable=SC2207
_home-manager_completions ()
{
#--------------------------#
local Subcommands
Subcommands=( "help" "edit" "build" "switch" "generations" "remove-generations" "expire-generations" "packages" "news" "uninstall" )
# ^ « home-manager »'s subcommands.
#--------------------------#
local Options
Options=( "-f" "--file" "-b" "-A" "-I" "-h" "--help" "-n" "--dry-run" "-v" "--verbose" "--show-trace" )
# ^ « home-manager »'s options.
#--------------------------#
local CurrentWord
CurrentWord="${COMP_WORDS[$COMP_CWORD]}"
# ^ the word currently being completed
local PreviousWord
if [ "$COMP_CWORD" -ge 1 ]
then
PreviousWord="${COMP_WORDS[COMP_CWORD-1]}"
else
PreviousWord=""
fi
# ^ the word to the left of the current word.
#
# e.g. in « home-manager -v -f ./<TAB> »:
#
# PreviousWord="-f"
# CurrentWord="./"
#--------------------------#
COMPREPLY=()
case "$PreviousWord" in
"-f"|"--file")
COMPREPLY+=( $( compgen -A file -- "$CurrentWord") )
;;
"-I")
COMPREPLY+=( $( compgen -A directory -- "$CurrentWord") )
;;
"-A")
# shellcheck disable=SC2119
COMPREPLY+=( $( compgen -W "$(_home-manager_list-nix-attributes)" -- "$CurrentWord") )
;;
"remove-generations")
COMPREPLY+=( $( compgen -W "$(_home-manager_list-generation-identifiers)" -- "$CurrentWord" ) )
;;
*)
COMPREPLY+=( $( compgen -W "${Subcommands[*]}" -- "$CurrentWord" ) )
COMPREPLY+=( $( compgen -W "${Options[*]}" -- "$CurrentWord" ) )
;;
esac
#--------------------------#
}
##################################################
complete -F _home-manager_completions -o default home-manager
#complete -W "help edit build switch generations remove-generations expire-generations packages news" home-manager

View File

@@ -1,4 +1,4 @@
{ pkgs
{ runCommand, lib, bash, coreutils, findutils, gnused, less
# Extra path to Home Manager. If set then this path will be tried
# before `$HOME/.config/nixpkgs/home-manager` and
@@ -12,23 +12,29 @@ let
in
pkgs.stdenv.mkDerivation {
name = "home-manager";
buildCommand = ''
install -v -D -m755 ${./home-manager} $out/bin/home-manager
runCommand
"home-manager"
{
preferLocalBuild = true;
allowSubstitutes = false;
meta = with lib; {
description = "A user environment configurator";
maintainers = [ maintainers.rycee ];
platforms = platforms.unix;
license = licenses.mit;
};
}
''
install -v -D -m755 ${./home-manager} $out/bin/home-manager
substituteInPlace $out/bin/home-manager \
--subst-var-by bash "${pkgs.bash}" \
--subst-var-by coreutils "${pkgs.coreutils}" \
--subst-var-by less "${pkgs.less}" \
--subst-var-by bash "${bash}" \
--subst-var-by coreutils "${coreutils}" \
--subst-var-by findutils "${findutils}" \
--subst-var-by gnused "${gnused}" \
--subst-var-by less "${less}" \
--subst-var-by HOME_MANAGER_PATH '${pathStr}'
'';
meta = with pkgs.stdenv.lib; {
description = "A user environment configurator";
maintainers = [ maintainers.rycee ];
platforms = platforms.unix;
license = licenses.mit;
};
}
install -D -m755 ${./completion.bash} \
$out/share/bash-completion/completions/home-manager
''

View File

@@ -1,9 +1,7 @@
#!@bash@/bin/bash
# This code explicitly requires GNU Core Utilities and we therefore
# need to ensure they are prioritized over any other similarly named
# tools on the system.
PATH=@coreutils@/bin:@less@/bin${PATH:+:}$PATH
# Prepare to use tools from Nixpkgs.
PATH=@coreutils@/bin:@findutils@/bin:@gnused@/bin:@less@/bin${PATH:+:}$PATH
set -euo pipefail
@@ -12,6 +10,20 @@ function errorEcho() {
echo $* >&2
}
function setVerboseAndDryRun() {
if [[ -v VERBOSE ]]; then
export VERBOSE_ARG="--verbose"
else
export VERBOSE_ARG=""
fi
if [[ -v DRY_RUN ]] ; then
export DRY_RUN_CMD=echo
else
export DRY_RUN_CMD=""
fi
}
function setWorkDir() {
if [[ ! -v WORK_DIR ]]; then
WORK_DIR="$(mktemp --tmpdir -d home-manager-build.XXXXXXXXXX)"
@@ -81,12 +93,14 @@ function doBuildAttr() {
nix build \
-f "<home-manager/home-manager/home-manager.nix>" \
$extraArgs \
"${PASSTHROUGH_OPTS[@]}" \
--argstr confPath "$HOME_MANAGER_CONFIG" \
--argstr confAttr "$HOME_MANAGER_CONFIG_ATTRIBUTE"
else
nix-build \
"<home-manager/home-manager/home-manager.nix>" \
$extraArgs \
"${PASSTHROUGH_OPTS[@]}" \
--argstr confPath "$HOME_MANAGER_CONFIG" \
--argstr confAttr "$HOME_MANAGER_CONFIG_ATTRIBUTE"
fi
@@ -131,6 +145,17 @@ function presentNews() {
fi
}
function doEdit() {
if [[ ! -v EDITOR || -z $EDITOR ]]; then
errorEcho "Please set the \$EDITOR environment variable"
return 1
fi
setConfigFile
exec "$EDITOR" "$HOME_MANAGER_CONFIG"
}
function doBuild() {
if [[ ! -w . ]]; then
errorEcho "Cannot run build in read-only directory";
@@ -207,17 +232,7 @@ function doListGens() {
# Removes linked generations. Takes as arguments identifiers of
# generations to remove.
function doRmGenerations() {
if [[ -v VERBOSE ]]; then
export VERBOSE_ARG="--verbose"
else
export VERBOSE_ARG=""
fi
if [[ -v DRY_RUN ]] ; then
export DRY_RUN_CMD=echo
else
export DRY_RUN_CMD=""
fi
setVerboseAndDryRun
pushd "/nix/var/nix/profiles/per-user/$USER" > /dev/null
@@ -237,6 +252,28 @@ function doRmGenerations() {
popd > /dev/null
}
function doRmAllGenerations() {
$DRY_RUN_CMD rm $VERBOSE_ARG \
"/nix/var/nix/profiles/per-user/$USER/home-manager"*
}
function doExpireGenerations() {
local profileDir="/nix/var/nix/profiles/per-user/$USER"
local generations
generations="$( \
find "$profileDir" -name 'home-manager-*-link' -not -newermt "$1" \
| sed 's/^.*-\([0-9]*\)-link$/\1/' \
)"
if [[ -n $generations ]]; then
# shellcheck disable=2086
doRmGenerations $generations
elif [[ -v VERBOSE ]]; then
echo "No generations to expire"
fi
}
function doListPackages() {
local outPath
outPath="$(nix-env -q --out-path | grep -o '/.*home-manager-path$')"
@@ -321,6 +358,56 @@ function doShowNews() {
fi
}
function doUninstall() {
setVerboseAndDryRun
echo "This will remove Home Manager from your system."
if [[ -v DRY_RUN ]]; then
echo "This is a dry run, nothing will actually be uninstalled."
fi
local confirmation
read -r -n 1 -p "Really uninstall Home Manager? [y/n] " confirmation
echo
case $confirmation in
y|Y)
echo "Switching to empty Home Manager configuration..."
HOME_MANAGER_CONFIG="$(mktemp --tmpdir home-manager.XXXXXXXXXX)"
echo "{}" > "$HOME_MANAGER_CONFIG"
doSwitch
rm "$HOME_MANAGER_CONFIG"
$DRY_RUN_CMD rm $VERBOSE_ARG -r \
"${XDG_DATA_HOME:-$HOME/.local/share}/home-manager"
$DRY_RUN_CMD rm $VERBOSE_ARG \
"/nix/var/nix/gcroots/per-user/$USER/current-home"
;;
*)
echo "Yay!"
exit 0
;;
esac
local deleteProfiles
read -r -n 1 \
-p 'Remove all Home Manager generations? [y/n] ' \
deleteProfiles
echo
case $deleteProfiles in
y|Y)
doRmAllGenerations
echo "All generations are now eligible for garbage collection."
;;
*)
echo "Leaving generations but they may still be garbage collected."
;;
esac
echo "Home Manager is uninstalled but your home.nix is left untouched."
}
function doHelp() {
echo "Usage: $0 [OPTION] COMMAND"
echo
@@ -331,14 +418,26 @@ function doHelp() {
echo " -A ATTRIBUTE Optional attribute that selects a configuration"
echo " expression in the configuration file."
echo " -I PATH Add a path to the Nix expression search path."
echo " -b EXT Move existing files to new path rather than fail."
echo " -v Verbose output"
echo " -n Do a dry run, only prints what actions would be taken"
echo " -h Print this help"
echo
echo "Options passed on to nix-build(1)"
echo
echo " --cores NUM"
echo " --keep-failed"
echo " --keep-going"
echo " --max-jobs NUM"
echo " --option NAME VALUE"
echo " --show-trace"
echo
echo "Commands"
echo
echo " help Print this help"
echo
echo " edit Open the home configuration in \$EDITOR"
echo
echo " build Build configuration into result directory"
echo
echo " switch Build and activate configuration"
@@ -349,67 +448,95 @@ function doHelp() {
echo " Remove indicated generations. Use 'generations' command to"
echo " find suitable generation numbers."
echo
echo " expire-generations TIMESTAMP"
echo " Remove generations older than TIMESTAMP where TIMESTAMP is"
echo " interpreted as in the -d argument of the date tool. For"
echo " example \"-30 days\" or \"2018-01-01\"."
echo
echo " packages List all packages installed in home-manager-path"
echo
echo " news Show news entries in a pager"
echo
echo " uninstall Remove Home Manager"
}
EXTRA_NIX_PATH=()
HOME_MANAGER_CONFIG_ATTRIBUTE=""
PASSTHROUGH_OPTS=()
COMMAND=""
COMMAND_ARGS=()
# As a special case, if the user has given --help anywhere on the
# command line then print help and exit.
for arg in "$@"; do
if [[ $arg == "--help" ]]; then
doHelp
exit 0
fi
done
while getopts 2f:I:A:vnh opt; do
while [[ $# -gt 0 ]]; do
opt="$1"
shift
case $opt in
2)
build|edit|expire-generations|generations|help|news|packages|remove-generations|switch|uninstall)
COMMAND="$opt"
;;
-2)
USE_NIX2_COMMAND=1
;;
f)
HOME_MANAGER_CONFIG="$OPTARG"
-A)
HOME_MANAGER_CONFIG_ATTRIBUTE="$1"
shift
;;
I)
EXTRA_NIX_PATH+=("$OPTARG")
-I)
EXTRA_NIX_PATH+=("$1")
shift
;;
A)
HOME_MANAGER_CONFIG_ATTRIBUTE="$OPTARG"
-b)
export HOME_MANAGER_BACKUP_EXT="$1"
shift
;;
v)
export VERBOSE=1
-f|--file)
HOME_MANAGER_CONFIG="$1"
shift
;;
n)
export DRY_RUN=1
;;
h)
-h|--help)
doHelp
exit 0
;;
-n|--dry-run)
export DRY_RUN=1
;;
--option)
PASSTHROUGH_OPTS+=("$opt" "$1" "$2")
shift 2
;;
--max-jobs|--cores)
PASSTHROUGH_OPTS+=("$opt" "$1")
shift
;;
--keep-failed|--keep-going|--show-trace)
PASSTHROUGH_OPTS+=("$opt")
;;
-v|--verbose)
export VERBOSE=1
;;
*)
errorEcho "Unknown option -$OPTARG"
doHelp >&2
exit 1
case $COMMAND in
expire-generations|remove-generations)
COMMAND_ARGS+=("$opt")
;;
*)
errorEcho "$0: unknown option '$opt'"
errorEcho "Run '$0 --help' for usage help"
exit 1
;;
esac
;;
esac
done
# Get rid of the options.
shift "$((OPTIND-1))"
if [[ $# -eq 0 ]]; then
if [[ -z $COMMAND ]]; then
doHelp >&2
exit 1
fi
cmd="$1"
shift 1
case "$cmd" in
case $COMMAND in
edit)
doEdit
;;
build)
doBuild
;;
@@ -420,7 +547,15 @@ case "$cmd" in
doListGens
;;
remove-generations)
doRmGenerations "$@"
doRmGenerations "${COMMAND_ARGS[@]}"
;;
expire-generations)
if [[ ${#COMMAND_ARGS[@]} != 1 ]]; then
errorEcho "expire-generations expects one argument, got ${#COMMAND_ARGS[@]}."
exit 1
else
doExpireGenerations "${COMMAND_ARGS[@]}"
fi
;;
packages)
doListPackages
@@ -428,11 +563,14 @@ case "$cmd" in
news)
doShowNews --all
;;
help|--help)
uninstall)
doUninstall
;;
help)
doHelp
;;
*)
errorEcho "Unknown command: $cmd"
errorEcho "Unknown command: $COMMAND"
doHelp >&2
exit 1
;;

View File

@@ -9,7 +9,7 @@ with pkgs.lib;
let
env = import <home-manager/modules> {
env = import ../modules {
configuration =
if confAttr == ""
then confPath

View File

@@ -1,12 +1,40 @@
{ home-manager, pkgs }:
{ home-manager, runCommand }:
pkgs.runCommand
runCommand
"home-manager-install"
{
propagatedBuildInputs = [ home-manager ];
preferLocalBuild = true;
allowSubstitutes = false;
shellHookOnly = true;
shellHook = ''
confFile="''${XDG_CONFIG_HOME:-$HOME/.config}/nixpkgs/home.nix"
if [[ ! -e $confFile ]]; then
echo
echo "Creating initial Home Manager configuration..."
mkdir -p "$(dirname "$confFile")"
cat > $confFile <<EOF
{ config, pkgs, ... }:
{
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "19.09";
}
EOF
fi
echo
echo "Creating initial Home Manager generation..."
echo
@@ -17,7 +45,7 @@ pkgs.runCommand
All done! The home-manager tool should now be installed and you
can edit
''${XDG_CONFIG_HOME:-~/.config}/nixpkgs/home.nix
$confFile
to configure Home Manager. Run 'man home-configuration.nix' to
see all available options.
@@ -36,4 +64,7 @@ pkgs.runCommand
fi
'';
}
""
''
echo This derivation is not buildable, instead run it using nix-shell.
exit 1
''

View File

@@ -1,4 +1,4 @@
{ config, lib, ... }:
{ config, lib, pkgs, ... }:
with lib;
@@ -6,6 +6,52 @@ let
cfg = config.accounts.email;
gpgModule = types.submodule {
options = {
key = mkOption {
type = types.str;
description = ''
The key to use as listed in <command>gpg --list-keys</command>.
'';
};
signByDefault = mkOption {
type = types.bool;
default = false;
description = "Sign messages by default.";
};
encryptByDefault = mkOption {
type = types.bool;
default = false;
description = "Encrypt outgoing messages by default.";
};
};
};
signatureModule = types.submodule {
options = {
text = mkOption {
type = types.str;
default = "";
example = ''
--
Luke Skywalker
May the force be with you.
'';
description = ''
Signature content.
'';
};
showSignature = mkOption {
type = types.enum [ "append" "attach" "none" ];
default = "none";
description = "Method to communicate the signature.";
};
};
};
tlsModule = types.submodule {
options = {
enable = mkOption {
@@ -49,7 +95,7 @@ let
};
port = mkOption {
type = types.nullOr types.ints.positive;
type = types.nullOr types.port;
default = null;
example = 993;
description = ''
@@ -79,7 +125,7 @@ let
};
port = mkOption {
type = types.nullOr types.ints.positive;
type = types.nullOr types.port;
default = null;
example = 465;
description = ''
@@ -161,6 +207,13 @@ let
description = "The email address of this account.";
};
aliases = mkOption {
type = types.listOf (types.strMatching ".*@.*");
default = [];
example = [ "webmaster@example.org" "admin@example.org" ];
description = "Alternative email addresses of this account.";
};
realName = mkOption {
type = types.str;
example = "Jane Doe";
@@ -237,6 +290,22 @@ let
'';
};
signature = mkOption {
type = signatureModule;
default = {};
description = ''
Signature configuration.
'';
};
gpg = mkOption {
type = types.nullOr gpgModule;
default = null;
description = ''
GPG configuration.
'';
};
smtp = mkOption {
type = types.nullOr smtpModule;
default = null;
@@ -317,6 +386,9 @@ in
accounts = mkOption {
type = types.attrsOf (types.submodule [
mailAccountOpts
(import ../programs/alot-accounts.nix pkgs)
(import ../programs/astroid-accounts.nix)
(import ../programs/getmail-accounts.nix)
(import ../programs/mbsync-accounts.nix)
(import ../programs/msmtp-accounts.nix)
(import ../programs/notmuch-accounts.nix)

View File

@@ -23,6 +23,9 @@ let
modules =
[ configuration ]
++ (import ./modules.nix { inherit check lib pkgs; });
specialArgs = {
modulesPath = builtins.toString ./.;
};
};
module = showWarnings (

View File

@@ -14,9 +14,14 @@ let
inherit homeDirectory lib pkgs;
}).fileType;
# A symbolic link whose target path matches this pattern will be
# considered part of a Home Manager generation.
homeFilePattern = "${builtins.storeDir}/*-home-manager-files/*";
sourceStorePath = file:
let
sourcePath = toString file.source;
sourceName = config.lib.strings.storeFileName (baseNameOf sourcePath);
in
if builtins.hasContext sourcePath
then file.source
else builtins.path { path = file.source; name = sourceName; };
in
@@ -36,41 +41,61 @@ in
};
config = {
assertions = [
(let
badFiles =
filter (f: hasPrefix "." (baseNameOf f))
(map (v: toString v.source)
(attrValues cfg));
badFilesStr = toString badFiles;
in
{
assertion = badFiles == [];
message = "Source file names must not start with '.': ${badFilesStr}";
})
];
# This verifies that the links we are about to create will not
# overwrite an existing file.
home.activation.checkLinkTargets = dag.entryBefore ["writeBoundary"] (
let
# Paths that should be forcibly overwritten by Home Manager.
# Caveat emptor!
forcedPaths =
concatMapStringsSep " " (p: ''"$HOME/${p}"'')
(mapAttrsToList (n: v: v.target)
(filterAttrs (n: v: v.force) cfg));
check = pkgs.writeText "check" ''
. ${./lib-bash/color-echo.sh}
# A symbolic link whose target path matches this pattern will be
# considered part of a Home Manager generation.
homeFilePattern="$(readlink -e "${builtins.storeDir}")/*-home-manager-files/*"
forcedPaths=(${forcedPaths})
newGenFiles="$1"
shift
for sourcePath in "$@" ; do
relativePath="''${sourcePath#$newGenFiles/}"
targetPath="$HOME/$relativePath"
if [[ -e "$targetPath" \
&& ! "$(readlink "$targetPath")" == ${homeFilePattern} ]] ; then
errorEcho "Existing file '$targetPath' is in the way"
collision=1
forced=""
for forcedPath in "''${forcedPaths[@]}"; do
if [[ $targetPath == $forcedPath* ]]; then
forced="yeah"
break
fi
done
if [[ -n $forced ]]; then
$VERBOSE_ECHO "Skipping collision check for $targetPath"
elif [[ -e "$targetPath" \
&& ! "$(readlink "$targetPath")" == $homeFilePattern ]] ; then
if [[ ! -L "$targetPath" && -n "$HOME_MANAGER_BACKUP_EXT" ]] ; then
backup="$targetPath.$HOME_MANAGER_BACKUP_EXT"
if [[ -e "$backup" ]]; then
errorEcho "Existing file '$backup' would be clobbered by backing up '$targetPath'"
collision=1
else
warnEcho "Existing file '$targetPath' is in the way, will be moved to '$backup'"
fi
else
errorEcho "Existing file '$targetPath' is in the way"
collision=1
fi
fi
done
if [[ -v collision ]] ; then
errorEcho "Please move the above files and try again"
errorEcho "Please move the above files and try again or use -b <ext> to move automatically."
exit 1
fi
'';
@@ -79,8 +104,8 @@ in
function checkNewGenCollision() {
local newGenFiles
newGenFiles="$(readlink -e "$newGenPath/home-files")"
find "$newGenFiles" -type f -print0 -or -type l -print0 \
| xargs -0 bash ${check} "$newGenFiles"
find "$newGenFiles" \( -type f -or -type l \) \
-exec bash ${check} "$newGenFiles" {} +
}
checkNewGenCollision || exit 1
@@ -116,6 +141,10 @@ in
for sourcePath in "$@" ; do
relativePath="''${sourcePath#$newGenFiles/}"
targetPath="$HOME/$relativePath"
if [[ -e "$targetPath" && ! -L "$targetPath" && -n "$HOME_MANAGER_BACKUP_EXT" ]] ; then
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"
done
@@ -124,13 +153,17 @@ in
cleanup = pkgs.writeText "cleanup" ''
. ${./lib-bash/color-echo.sh}
# A symbolic link whose target path matches this pattern will be
# considered part of a Home Manager generation.
homeFilePattern="$(readlink -e "${builtins.storeDir}")/*-home-manager-files/*"
newGenFiles="$1"
shift 1
for relativePath in "$@" ; do
targetPath="$HOME/$relativePath"
if [[ -e "$newGenFiles/$relativePath" ]] ; then
$VERBOSE_ECHO "Checking $targetPath: exists"
elif [[ ! "$(readlink "$targetPath")" == ${homeFilePattern} ]] ; then
elif [[ ! "$(readlink "$targetPath")" == $homeFilePattern ]] ; then
warnEcho "Path '$targetPath' not link into Home Manager generation. Skipping delete."
else
$VERBOSE_ECHO "Checking $targetPath: gone (deleting)"
@@ -160,8 +193,8 @@ in
local newGenFiles
newGenFiles="$(readlink -e "$newGenPath/home-files")"
find "$newGenFiles" -type f -print0 -or -type l -print0 \
| xargs -0 bash ${link} "$newGenFiles"
find "$newGenFiles" \( -type f -or -type l \) \
-exec bash ${link} "$newGenFiles" {} +
}
function cleanOldGen() {
@@ -201,7 +234,7 @@ in
''
declare -A changedFiles
'' + concatMapStrings (v: ''
cmp --quiet "${v.source}" "${config.home.homeDirectory}/${v.target}" \
cmp --quiet "${sourceStorePath v}" "${homeDirectory}/${v.target}" \
&& changedFiles["${v.target}"]=0 \
|| changedFiles["${v.target}"]=1
'') (filter (v: v.onChange != "") (attrValues cfg))
@@ -215,19 +248,21 @@ in
'') (filter (v: v.onChange != "") (attrValues cfg))
);
home-files = pkgs.stdenv.mkDerivation {
name = "home-manager-files";
nativeBuildInputs = [ pkgs.xlibs.lndir ];
preferLocalBuild = true;
allowSubstitutes = false;
# Symlink directories and files that have the right execute bit.
# Copy files that need their execute bit changed.
buildCommand = ''
# Symlink directories and files that have the right execute bit.
# Copy files that need their execute bit changed.
home-files = pkgs.runCommand
"home-manager-files"
{
nativeBuildInputs = [ pkgs.xlibs.lndir ];
preferLocalBuild = true;
allowSubstitutes = false;
}
(''
mkdir -p $out
# Needed in case /nix is a symbolic link.
realOut="$(realpath -m "$out")"
function insertFile() {
local source="$1"
local relTarget="$2"
@@ -236,10 +271,10 @@ in
# Figure out the real absolute path to the target.
local target
target="$(realpath -m "$out/$relTarget")"
target="$(realpath -m "$realOut/$relTarget")"
# Target path must be within $HOME.
if [[ ! $target == $out* ]] ; then
if [[ ! $target == $realOut* ]] ; then
echo "Error installing file '$relTarget' outside \$HOME" >&2
exit 1
fi
@@ -277,14 +312,13 @@ in
}
'' + concatStrings (
mapAttrsToList (n: v: ''
insertFile "${v.source}" \
insertFile "${sourceStorePath v}" \
"${v.target}" \
"${if v.executable == null
then "inherit"
else builtins.toString v.executable}" \
"${builtins.toString v.recursive}"
'') cfg
);
};
));
};
}

View File

@@ -55,16 +55,24 @@ let
keyboardSubModule = types.submodule {
options = {
layout = mkOption {
type = types.str;
default = "us";
type = with types; nullOr str;
default =
if versionAtLeast config.home.stateVersion "19.09"
then null
else "us";
defaultText = literalExample "null";
description = ''
Keyboard layout.
Keyboard layout. If <literal>null</literal>, then the system
configuration will be used.
</para><para>
This defaults to <literal>null</literal> for state
version  19.09 and <literal>"us"</literal> otherwise.
'';
};
model = mkOption {
type = types.str;
default = "pc104";
type = with types; nullOr str;
default = null;
example = "presario";
description = ''
Keyboard model.
@@ -81,11 +89,19 @@ let
};
variant = mkOption {
type = types.str;
default = "";
type = with types; nullOr str;
default =
if versionAtLeast config.home.stateVersion "19.09"
then null
else "";
defaultText = literalExample "null";
example = "colemak";
description = ''
X keyboard variant.
X keyboard variant. If <literal>null</literal>, then the
system configuration will be used.
</para><para>
This defaults to <literal>null</literal> for state
version  19.09 and <literal>""</literal> otherwise.
'';
};
};
@@ -139,9 +155,12 @@ in
};
home.keyboard = mkOption {
type = keyboardSubModule;
type = types.nullOr keyboardSubModule;
default = {};
description = "Keyboard configuration.";
description = ''
Keyboard configuration. Set to <literal>null</literal> to
disable Home Manager keyboard management.
'';
};
home.sessionVariables = mkOption {
@@ -163,20 +182,20 @@ in
Note, these variables may be set in any order so no session
variable may have a runtime dependency on another session
variable. In particular code like
<programlisting>
home.sessionVariables = {
FOO = "Hello";
BAR = "$FOO World!";
};
<programlisting language="nix">
home.sessionVariables = {
FOO = "Hello";
BAR = "$FOO World!";
};
</programlisting>
may not work as expected. If you need to reference another
session variable, then do so inside Nix instead. The above
example then becomes
<programlisting>
home.sessionVariables = {
FOO = "Hello";
BAR = "''${config.home.sessionVariables.FOO} World!";
};
<programlisting language="nix">
home.sessionVariables = {
FOO = "Hello";
BAR = "''${config.home.sessionVariables.FOO} World!";
};
</programlisting>
'';
};
@@ -243,6 +262,15 @@ in
Extra commands to run in the Home Manager generation builder.
'';
};
home.extraProfileCommands = mkOption {
type = types.lines;
default = "";
internal = true;
description = ''
Extra commands to run in the Home Manager profile builder.
'';
};
};
config = {
@@ -260,7 +288,11 @@ in
home.username = mkDefault (builtins.getEnv "USER");
home.homeDirectory = mkDefault (builtins.getEnv "HOME");
home.profileDirectory = cfg.homeDirectory + "/.nix-profile";
home.profileDirectory =
if config.submoduleSupport.enable
&& config.submoduleSupport.externalPackageInstall
then config.home.path
else cfg.homeDirectory + "/.nix-profile";
home.sessionVariables =
let
@@ -298,9 +330,33 @@ in
home.activation.writeBoundary = dag.entryAnywhere "";
# Install packages to the user environment.
home.activation.installPackages = dag.entryAfter ["writeBoundary"] ''
$DRY_RUN_CMD nix-env -i ${cfg.path}
'';
#
# Note, sometimes our target may not allow modification of the Nix
# store and then we cannot rely on `nix-env -i`. This is the case,
# for example, if we are running as a NixOS module and building a
# virtual machine. Then we must instead rely on an external
# mechanism for installing packages, which in NixOS is provided by
# the `users.users.<name?>.packages` option. The activation
# command is still needed since some modules need to run their
# activation commands after the packages are guaranteed to be
# installed.
#
# In case the user has moved from a user-install of Home Manager
# to a submodule managed one we attempt to uninstall the
# `home-manager-path` package if it is installed.
home.activation.installPackages = dag.entryAfter ["writeBoundary"] (
if config.submoduleSupport.externalPackageInstall
then
''
if nix-env -q | grep '^home-manager-path$'; then
$DRY_RUN_CMD nix-env -e home-manager-path
fi
''
else
''
$DRY_RUN_CMD nix-env -i ${cfg.path}
''
);
home.activationPackage =
let
@@ -330,7 +386,7 @@ in
+ optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH";
activationScript = pkgs.writeScript "activation-script" ''
#!${pkgs.stdenv.shell}
#!${pkgs.runtimeShell}
set -eu
set -o pipefail
@@ -346,13 +402,13 @@ in
${activationCmds}
'';
in
pkgs.stdenv.mkDerivation {
name = "home-manager-generation";
preferLocalBuild = true;
allowSubstitutes = false;
buildCommand = ''
pkgs.runCommand
"home-manager-generation"
{
preferLocalBuild = true;
allowSubstitutes = false;
}
''
mkdir -p $out
cp ${activationScript} $out/activate
@@ -365,7 +421,6 @@ in
${cfg.extraBuilderCommands}
'';
};
home.path = pkgs.buildEnv {
name = "home-manager-path";
@@ -373,6 +428,8 @@ in
paths = cfg.packages;
inherit (cfg) extraOutputsToInstall;
postBuild = cfg.extraProfileCommands;
meta = {
description = "Environment of packages installed through home-manager";
};

View File

@@ -16,5 +16,8 @@
entryBefore = d.dagEntryBefore;
};
strings = import ./strings.nix { inherit lib; };
shell = import ./shell.nix { inherit lib; };
zsh = import ./zsh.nix { inherit lib; };
}

View File

@@ -4,27 +4,7 @@ with lib;
let
# Figures out a valid Nix store name for the given path.
storeFileName = path:
let
# All characters that are considered safe. Note "-" is not
# included to avoid "-" followed by digit being interpreted as a
# version.
safeChars =
[ "+" "." "_" "?" "=" ]
++ lowerChars
++ upperChars
++ stringToCharacters "0123456789";
empties = l: genList (x: "") (length l);
unsafeInName = stringToCharacters (
replaceStrings safeChars (empties safeChars) path
);
safeName = replaceStrings unsafeInName (empties unsafeInName) path;
in
"home_file_" + safeName;
stringsExtra = import ./strings.nix { inherit lib; };
in
@@ -106,6 +86,18 @@ in
into place.
'';
};
force = mkOption {
type = types.bool;
default = false;
visible = false;
description = ''
Whether the target path should be unconditionally replaced
by the managed file source. Warning, this will silently
delete the target regardless of whether it is a file or
link.
'';
};
};
config = {
@@ -113,7 +105,7 @@ in
source = mkIf (config.text != null) (
mkDefault (pkgs.writeTextFile {
inherit (config) executable text;
name = storeFileName name;
name = stringsExtra.storeFileName name;
})
);
};

27
modules/lib/strings.nix Normal file
View File

@@ -0,0 +1,27 @@
{ lib }:
with lib;
{
# Figures out a valid Nix store name for the given path.
storeFileName = path:
let
# All characters that are considered safe. Note "-" is not
# included to avoid "-" followed by digit being interpreted as a
# version.
safeChars =
[ "+" "." "_" "?" "=" ]
++ lowerChars
++ upperChars
++ stringToCharacters "0123456789";
empties = l: genList (x: "") (length l);
unsafeInName = stringToCharacters (
replaceStrings safeChars (empties safeChars) path
);
safeName = replaceStrings unsafeInName (empties unsafeInName) path;
in
"hm_" + safeName;
}

28
modules/lib/types.nix Normal file
View File

@@ -0,0 +1,28 @@
{ lib }:
with lib;
{
selectorFunction = mkOptionType {
name = "selectorFunction";
description =
"Function that takes an attribute set and returns a list"
+ " containing a selection of the values of the input set";
check = isFunction;
merge = _loc: defs:
as: concatMap (select: select as) (getValues defs);
};
overlayFunction = mkOptionType {
name = "overlayFunction";
description =
"An overlay function, takes self and super and returns"
+ " an attribute set overriding the desired attributes.";
check = isFunction;
merge = _loc: defs:
self: super:
foldl' (res: def: mergeAttrs res (def.value self super)) {} defs;
};
}

28
modules/lib/zsh.nix Normal file
View File

@@ -0,0 +1,28 @@
{ lib }:
rec {
# Produces a Zsh shell like value
toZshValue = v: if builtins.isBool v then
if v then "true" else "false"
else if builtins.isString v then
"\"${v}\""
else if builtins.isList v then
"(${lib.concatStringsSep " " (map toZshValue v)})"
else "\"${toString v}\"";
# Produces a Zsh shell like definition statement
define = n: v: "${n}=${toZshValue v}";
# Given an attribute set containing shell variable names and their
# assignments, this function produces a string containing a definition
# statement for each set entry.
defineAll = vars: lib.concatStringsSep "\n" (lib.mapAttrsToList define vars);
# Produces a Zsh shell like export statement
export = n: v: "export ${define n v}";
# Given an attribute set containing shell variable names and their
# assignments, this function produces a string containing an export
# statement for each set entry.
exportAll = vars: lib.concatStringsSep "\n" (lib.mapAttrsToList export vars);
}

View File

@@ -1,4 +1,4 @@
{ config, lib, pkgs, baseModules, ... }:
{ config, lib, pkgs, ... }:
with lib;
@@ -6,55 +6,7 @@ let
cfg = config.manual;
/* For the purpose of generating docs, evaluate options with each derivation
in `pkgs` (recursively) replaced by a fake with path "\${pkgs.attribute.path}".
It isn't perfect, but it seems to cover a vast majority of use cases.
Caveat: even if the package is reached by a different means,
the path above will be shown and not e.g. `${config.services.foo.package}`. */
homeManagerManual = import ../doc {
inherit pkgs config;
version = "0.1";
revision = "master";
options =
let
scrubbedEval = evalModules {
modules = [ { nixpkgs.localSystem = config.nixpkgs.localSystem; } ] ++ baseModules;
args = (config._module.args) // { modules = [ ]; };
specialArgs = { pkgs = scrubDerivations "pkgs" pkgs; };
};
scrubDerivations = namePrefix: pkgSet: mapAttrs
(name: value:
let wholeName = "${namePrefix}.${name}"; in
if isAttrs value then
scrubDerivations wholeName value
// (optionalAttrs (isDerivation value) { outPath = "\${${wholeName}}"; })
else value
)
pkgSet;
in scrubbedEval.options;
};
manualHtmlRoot = "${homeManagerManual.manual}/share/doc/home-manager/index.html";
helpScript = pkgs.writeScriptBin "home-manager-help" ''
#!${pkgs.bash}/bin/bash -e
if [ -z "$BROWSER" ]; then
for candidate in xdg-open open w3m; do
BROWSER="$(type -P $candidate || true)"
if [ -x "$BROWSER" ]; then
break;
fi
done
fi
if [ -z "$BROWSER" ]; then
echo "$0: unable to start a web browser; please set \$BROWSER"
exit 1
fi
exec "$BROWSER" ${manualHtmlRoot}
'';
docs = import ../doc { inherit pkgs; };
in
@@ -83,19 +35,34 @@ in
Thanks!
'';
};
manual.json.enable = mkOption {
type = types.bool;
default = false;
example = true;
description = ''
Whether to install a JSON formatted list of all Home Manager
options. This can be located at
<filename>&lt;profile directory&gt;/share/doc/home-manager/options.json</filename>,
and may be used for navigating definitions, auto-completing,
and other miscellaneous tasks.
'';
};
};
config = {
home.packages = mkMerge [
(mkIf cfg.html.enable [ helpScript homeManagerManual.manual ])
(mkIf cfg.manpages.enable [ homeManagerManual.manpages ])
(mkIf cfg.html.enable [ docs.manual.html docs.manual.htmlOpenTool ])
(mkIf cfg.manpages.enable [ docs.manPages ])
(mkIf cfg.json.enable [ docs.options.json ])
];
# Whether a dependency on nmd should be introduced.
home.extraBuilderCommands =
mkIf (cfg.html.enable || cfg.manpages.enable || cfg.json.enable) ''
mkdir $out/lib
ln -s ${docs.nmdSrc} $out/lib/nmd
'';
};
# To fix error during manpage build.
meta = {
maintainers = [ maintainers.rycee ];
doc = builtins.toFile "nothingness" "";
};
}

89
modules/misc/dconf.nix Normal file
View File

@@ -0,0 +1,89 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.dconf;
dag = config.lib.dag;
toDconfIni = generators.toINI { mkKeyValue = mkIniKeyValue; };
mkIniKeyValue = key: value:
let
tweakVal = v:
if isString v then "'${v}'"
else if isList v then tweakList v
else if isBool v then (if v then "true" else "false")
else toString v;
# Assume empty list is a list of strings, see #769
tweakList = v:
if v == [] then "@as []"
else "[" + concatMapStringsSep "," tweakVal v + "]";
in
"${key}=${tweakVal value}";
primitive = with types; either bool (either int (either float str));
in
{
meta.maintainers = [ maintainers.gnidorah maintainers.rycee ];
options = {
dconf = {
enable = mkOption {
type = types.bool;
default = true;
visible = false;
description = ''
Whether to enable dconf settings.
'';
};
settings = mkOption {
type = with types;
attrsOf (attrsOf (either primitive (listOf primitive)));
default = {};
example = literalExample ''
{
"org/gnome/calculator" = {
button-mode = "programming";
show-thousands = true;
base = 10;
word-size = 64;
};
}
'';
description = ''
Settings to write to the dconf configuration system.
'';
};
};
};
config = mkIf (cfg.enable && cfg.settings != {}) {
home.activation.dconfSettings = dag.entryAfter ["installPackages"] (
let
iniFile = pkgs.writeText "hm-dconf.ini" (toDconfIni cfg.settings);
in
''
if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then
DCONF_DBUS_RUN_SESSION=""
else
DCONF_DBUS_RUN_SESSION="${pkgs.dbus}/bin/dbus-run-session"
fi
if [[ -v DRY_RUN ]]; then
echo $DCONF_DBUS_RUN_SESSION ${pkgs.gnome3.dconf}/bin/dconf load / "<" ${iniFile}
else
$DCONF_DBUS_RUN_SESSION ${pkgs.gnome3.dconf}/bin/dconf load / < ${iniFile}
fi
unset DCONF_DBUS_RUN_SESSION
''
);
};
}

View File

@@ -6,36 +6,100 @@ let
cfg = config.fonts.fontconfig;
profileDirectory = config.home.profileDirectory;
in
{
meta.maintainers = [ maintainers.rycee ];
imports = [
(mkRenamedOptionModule
[ "fonts" "fontconfig" "enableProfileFonts" ]
[ "fonts" "fontconfig" "enable" ])
];
options = {
fonts.fontconfig = {
enableProfileFonts = mkOption {
enable = mkOption {
type = types.bool;
default = false;
example = true;
description = ''
Configure fontconfig to discover fonts installed through
Whether to enable fontconfig configuration. This will, for
example, allow fontconfig to discover fonts and
configurations installed through
<varname>home.packages</varname> and
<command>nix-env</command>.
</para><para>
Note, this is only necessary on non-NixOS systems.
'';
};
};
};
config = mkIf cfg.enableProfileFonts {
xdg.configFile."fontconfig/conf.d/10-nix-profile-fonts.conf".text = ''
config = mkIf cfg.enable {
# Create two dummy files in /lib/fontconfig to make sure that
# buildEnv creates a real directory path. These files are removed
# in home.extraProfileCommands below so the packages will not
# become "runtime" dependencies.
home.packages = [
(pkgs.writeTextFile {
name = "hm-dummy1";
destination = "/lib/fontconfig/hm-dummy1";
text = "dummy";
})
(pkgs.writeTextFile {
name = "hm-dummy2";
destination = "/lib/fontconfig/hm-dummy2";
text = "dummy";
})
];
home.extraProfileCommands = ''
if [[ -d $out/lib/X11/fonts || -d $out/share/fonts ]]; then
export FONTCONFIG_FILE="$(pwd)/fonts.conf"
cat > $FONTCONFIG_FILE << EOF
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<dir>${config.home.profileDirectory}/lib/X11/fonts</dir>
<dir>${config.home.profileDirectory}/share/fonts</dir>
<dir>$out/lib/X11/fonts</dir>
<dir>$out/share/fonts</dir>
<cachedir>$out/lib/fontconfig/cache</cachedir>
</fontconfig>
EOF
${getBin pkgs.fontconfig}/bin/fc-cache -f
rm -f $out/lib/fontconfig/cache/CACHEDIR.TAG
rmdir --ignore-fail-on-non-empty -p $out/lib/fontconfig/cache
rm "$FONTCONFIG_FILE"
unset FONTCONFIG_FILE
fi
# Remove hacky dummy files.
rm $out/lib/fontconfig/hm-dummy?
rmdir --ignore-fail-on-non-empty -p $out/lib/fontconfig
'';
xdg.configFile = {
"fontconfig/conf.d/10-hm-fonts.conf".text = ''
<?xml version='1.0'?>
<!-- Generated by Home Manager. -->
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<include ignore_missing="yes">${config.home.path}/etc/fonts/conf.d</include>
<include ignore_missing="yes">${config.home.path}/etc/fonts/fonts.conf</include>
<dir>${config.home.path}/lib/X11/fonts</dir>
<dir>${config.home.path}/share/fonts</dir>
<dir>${profileDirectory}/lib/X11/fonts</dir>
<dir>${profileDirectory}/share/fonts</dir>
<cachedir>${config.home.path}/lib/fontconfig/cache</cachedir>
</fontconfig>
'';
};
};
}

View File

@@ -76,6 +76,12 @@ in
{
meta.maintainers = [ maintainers.rycee ];
imports = [
(mkRemovedOptionModule ["gtk" "gtk3" "waylandSupport"] ''
This options is not longer needed and can be removed.
'')
];
options = {
gtk = {
enable = mkEnableOption "GTK 2/3 configuration";
@@ -100,48 +106,36 @@ in
description = "The GTK+2/3 theme to use.";
};
gtk2 = mkOption {
description = "Options specific to GTK+ 2";
default = {};
type = types.submodule {
options = {
extraConfig = mkOption {
type = types.lines;
default = "";
example = "gtk-can-change-accels = 1";
description = ''
Extra configuration lines to add verbatim to
<filename>~/.gtkrc-2.0</filename>.
'';
};
};
gtk2 = {
extraConfig = mkOption {
type = types.lines;
default = "";
example = "gtk-can-change-accels = 1";
description = ''
Extra configuration lines to add verbatim to
<filename>~/.gtkrc-2.0</filename>.
'';
};
};
gtk3 = mkOption {
description = "Options specific to GTK+ 3";
default = {};
type = types.submodule {
options = {
extraConfig = mkOption {
type = types.attrs;
default = {};
example = { gtk-cursor-blink = false; gtk-recent-files-limit = 20; };
description = ''
Extra configuration options to add to
<filename>~/.config/gtk-3.0/settings.ini</filename>.
'';
};
gtk3 = {
extraConfig = mkOption {
type = with types; attrsOf (either bool (either int str));
default = {};
example = { gtk-cursor-blink = false; gtk-recent-files-limit = 20; };
description = ''
Extra configuration options to add to
<filename>~/.config/gtk-3.0/settings.ini</filename>.
'';
};
extraCss = mkOption {
type = types.lines;
default = "";
description = ''
Extra configuration lines to add verbatim to
<filename>~/.config/gtk-3.0/gtk.css</filename>.
'';
};
};
extraCss = mkOption {
type = types.lines;
default = "";
description = ''
Extra configuration lines to add verbatim to
<filename>~/.config/gtk-3.0/gtk.css</filename>.
'';
};
};
};
@@ -159,11 +153,20 @@ in
optionalAttrs (cfg.iconTheme != null)
{ gtk-icon-theme-name = cfg.iconTheme.name; };
dconfIni =
optionalAttrs (cfg.font != null)
{ font-name = cfg.font.name; }
//
optionalAttrs (cfg.theme != null)
{ gtk-theme = cfg.theme.name; }
//
optionalAttrs (cfg.iconTheme != null)
{ icon-theme = cfg.iconTheme.name; };
optionalPackage = opt:
optional (opt != null && opt.package != null) opt.package;
in
{
home.packages =
optionalPackage cfg.font
++ optionalPackage cfg.theme
@@ -178,6 +181,8 @@ in
toGtk3Ini { Settings = ini // cfg3.extraConfig; };
xdg.configFile."gtk-3.0/gtk.css".text = cfg3.extraCss;
dconf.settings."org/gnome/desktop/interface" = dconfIni;
}
);
}

14
modules/misc/lib.nix Normal file
View File

@@ -0,0 +1,14 @@
{ lib, ... }:
{
options = {
lib = lib.mkOption {
type = lib.types.attrsOf lib.types.attrs;
default = {};
description = ''
This option allows modules to define helper functions,
constants, etc.
'';
};
};
}

View File

@@ -6,6 +6,8 @@ let
cfg = config.news;
hostPlatform = pkgs.stdenv.hostPlatform;
entryModule = types.submodule ({ config, ... }: {
options = {
id = mkOption {
@@ -240,25 +242,6 @@ in
'';
}
{
time = "2017-09-30T09:44:18+00:00";
condition = with config.programs.vim;
enable && (tabSize != null || lineNumbers != null);
message = ''
The options 'programs.vim.tabSize' and 'programs.vim.lineNumbers' have
been deprecated and will be removed in the near future.
The new and preferred way to configure tab size and line numbers is to
use the more general 'programs.vim.settings' option. Specifically,
instead of
- 'programs.vim.lineNumbers' use 'programs.vim.settings.number', and
- 'programs.vim.tabSize' use 'programs.vim.settings.tabstop' and
'programs.vim.settings.shiftwidth'.
'';
}
{
time = "2017-10-02T11:15:03+00:00";
condition = config.services.udiskie.enable;
@@ -753,7 +736,7 @@ in
{
time = "2018-08-19T20:46:09+00:00";
condition = pkgs.stdenv.isLinux;
condition = hostPlatform.isLinux;
message = ''
A new modules is available: 'programs.chromium'.
'';
@@ -779,6 +762,492 @@ in
A new module is available: 'programs.offlineimap'.
'';
}
{
time = "2018-09-18T21:25:14+00:00";
message = ''
A new module is available: 'programs.taskwarrior'.
'';
}
{
time = "2018-09-18T21:43:54+00:00";
message = ''
A new module is available: 'programs.zathura'.
'';
}
{
time = "2018-09-20T19:26:40+00:00";
message = ''
A new module is available: 'programs.noti'.
'';
}
{
time = "2018-09-20T22:10:45+00:00";
message = ''
A new module is available: 'programs.go'.
'';
}
{
time = "2018-09-27T17:48:08+00:00";
message = ''
A new module is available: 'programs.obs-studio'.
'';
}
{
time = "2018-09-28T21:38:48+00:00";
message = ''
A new module is available: 'programs.alot'.
'';
}
{
time = "2018-10-20T09:30:57+00:00";
message = ''
A new module is available: 'programs.urxvt'.
'';
}
{
time = "2018-11-13T23:08:03+00:00";
message = ''
A new module is available: 'programs.tmux'.
'';
}
{
time = "2018-11-18T18:55:15+00:00";
message = ''
A new module is available: 'programs.astroid'.
'';
}
{
time = "2018-11-18T21:41:51+00:00";
message = ''
A new module is available: 'programs.afew'.
'';
}
{
time = "2018-11-19T00:40:34+00:00";
message = ''
A new nix-darwin module is available. Use it the same way the NixOS
module is used. A major limitation is that Home Manager services don't
work, as they depend explicitly on Linux and systemd user services.
However, 'home.file' and 'home.packages' do work. Everything else is
untested at this time.
'';
}
{
time = "2018-11-24T16:22:19+00:00";
message = ''
A new option 'home.stateVersion' is available. Its function
is much like the 'system.stateVersion' option in NixOS.
Briefly, the state version indicates a stable set of option
defaults. In the future, whenever Home Manager changes an
option default in a way that may cause program breakage it
will do so only for the unstable state version, currently
19.03. Once 19.03 becomes the stable version only backwards
compatible changes will be made and 19.09 becomes the
unstable state version.
The default value for this option is 18.09 but it may still
be a good idea to explicitly add
home.stateVersion = "18.09";
to your Home Manager configuration.
'';
}
{
time = "2018-11-25T22:10:15+00:00";
message = ''
A new module is available: 'services.nextcloud-client'.
'';
}
{
time = "2018-11-25T22:55:12+00:00";
message = ''
A new module is available: 'programs.vscode'.
'';
}
{
time = "2018-12-04T21:54:38+00:00";
condition = config.programs.beets.settings != {};
message = ''
A new option 'programs.beets.enable' has been added.
Starting with state version 19.03 this option defaults to
false. For earlier versions it defaults to true if
'programs.beets.settings' is non-empty.
It is recommended to explicitly add
programs.beets.enable = true;
to your configuration.
'';
}
{
time = "2018-12-12T21:02:05+00:00";
message = ''
A new module is available: 'programs.jq'.
'';
}
{
time = "2018-12-24T16:26:16+00:00";
message = ''
A new module is available: 'dconf'.
Note, on NixOS you may need to add
services.dbus.packages = with pkgs; [ gnome3.dconf ];
to the system configuration for this module to work as
expected. In particular if you get the error message
The name ca.desrt.dconf was not provided by any .service files
when activating your Home Manager configuration.
'';
}
{
time = "2018-12-28T12:32:30+00:00";
message = ''
A new module is available: 'programs.opam'.
'';
}
{
time = "2019-01-18T00:21:56+00:00";
message = ''
A new module is available: 'programs.matplotlib'.
'';
}
{
time = "2019-01-26T13:20:37+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.xembed-sni-proxy'.
'';
}
{
time = "2019-01-28T23:36:10+00:00";
message = ''
A new module is available: 'programs.irssi'.
'';
}
{
time = "2019-02-09T14:09:58+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.emacs'.
This module provides a user service that runs the Emacs
configured in
programs.emacs
as an Emacs daemon.
'';
}
{
time = "2019-02-16T20:33:56+00:00";
condition = hostPlatform.isLinux;
message = ''
When using Home Manager as a NixOS submodule it is now
possible to install packages using the NixOS
users.users.<name?>.packages
option. This is enabled by adding
home-manager.useUserPackages = true;
to your NixOS system configuration. This mode of operation
is necessary if you want to use 'nixos-rebuild build-vm'.
'';
}
{
time = "2019-02-17T21:11:24+00:00";
message = ''
A new module is available: 'programs.keychain'.
'';
}
{
time = "2019-02-24T00:32:23+00:00";
condition = hostPlatform.isLinux;
message = ''
A new service is available: 'services.mpdris2'.
'';
}
{
time = "2019-03-19T22:56:20+00:00";
message = ''
A new module is available: 'programs.bat'.
'';
}
{
time = "2019-03-19T23:07:34+00:00";
message = ''
A new module is available: 'programs.lsd'.
'';
}
{
time = "2019-04-09T20:10:22+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.xcape'.
'';
}
{
time = "2019-04-11T22:50:10+00:00";
condition = hostPlatform.isLinux;
message = ''
The type used for the systemd unit options under
systemd.user.services, systemd.user.sockets, etc.
has been changed to offer more robust merging of configurations.
If you don't override values within systemd units then you are not
affected by this change. Unfortunately, if you do override unit values
you may encounter errors due to this change.
In particular, if you get an error saying that a "unique option" is
"defined multiple times" then you need to use 'lib.mkForce'. For
example,
systemd.user.services.foo.Service.ExecStart = "/foo/bar";
becomes
systemd.user.services.foo.Service.ExecStart = lib.mkForce "/foo/bar";
We had to make this change because the old merging was causing too
many confusing situations for people. Apologies for potentially
breaking your configuration!
'';
}
{
time = "2019-04-14T15:35:16+00:00";
message = ''
A new module is available: 'programs.skim'.
'';
}
{
time = "2019-04-22T12:43:20+00:00";
message = ''
A new module is available: 'programs.alacritty'.
'';
}
{
time = "2019-04-26T22:53:48+00:00";
condition = config.programs.vscode.enable;
message = ''
A new module is available: 'programs.vscode.haskell'.
Enable to add Haskell IDE Engine and syntax highlighting
support to your VSCode.
'';
}
{
time = "2019-05-04T23:56:39+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.rsibreak'.
'';
}
{
time = "2019-05-07T20:49:29+00:00";
message = ''
A new module is available: 'programs.mpv'.
'';
}
{
time = "2019-05-30T17:49:29+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.xsuspender'.
'';
}
{
time = "2019-06-03T21:47:10+00:00";
message = ''
A new module is available: 'programs.gpg'.
'';
}
{
time = "2019-06-09T12:19:18+00:00";
message = ''
Collisions between unmanaged and managed files can now be
automatically resolved by moving the target file to a new
path instead of failing the switch operation. To enable
this, use the new '-b' command line argument. For example,
home-manager -b bck switch
where 'bck' is the suffix to give the moved file. In this
case a colliding file 'foo.conf' will be moved to
'foo.conf.bck'.
'';
}
{
time = "2019-06-19T17:49:29+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: `services.getmail`.
'';
}
{
time = "2019-07-02T09:27:56+00:00";
message = ''
A new module is available: 'programs.broot'.
'';
}
{
time = "2019-07-17T19:30:29+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.taskwarrior-sync'.
'';
}
{
time = "2019-07-17T20:05:29+00:00";
message = ''
A new module is available: 'programs.kakoune'.
'';
}
{
time = "2019-08-08T11:49:35+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.hound'.
'';
}
{
time = "2019-08-17T12:24:58+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.muchsync'.
'';
}
{
time = "2019-08-18T14:22:41+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.dwm-status'.
'';
}
{
time = "2019-08-28T10:18:07+00:00";
condition = config.programs.vim.enable;
message = ''
The 'programs.vim.plugins' option now accepts packages.
Specifying them as strings is deprecated.
'';
}
{
time = "2019-09-17T19:33:49+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.sxhkd'.
'';
}
{
time = "2019-09-26T21:05:24+00:00";
message = ''
A new module is available: 'programs.starship'.
'';
}
{
time = "2019-09-26T21:47:13+00:00";
message = ''
A new module is available: 'programs.rtorrent'.
'';
}
{
time = "2019-12-10T19:58:00+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.lorri'.
'';
}
{
time = "2020-02-16T17:07:44+00:00";
message = ''
A new module is available: 'programs.readline'.
'';
}
{
time = "2020-03-15T16:55:28+00:00";
condition = config.programs.firefox.enable;
message = ''
In anticipation of Firefox dropping support for extension
sideloading[1], we now install extensions directly to
Firefox profiles managed through Home Manager's
'programs.firefox.profiles'
option.
Unfortunately this will most likely trigger an "Existing
file is in the way" error when activating your configuration
since Firefox keeps a copy of the add-on in the location
Home Manager wants to overwrite. If this is the case, remove
the listed '.xpi' files and try again.
This change also means that extensions installed through
Home Manager may disappear from unmanaged profiles in future
Firefox releases.
[1] https://blog.mozilla.org/addons/2019/10/31/firefox-to-discontinue-sideloaded-extensions/
'';
}
];
};
}

View File

@@ -80,10 +80,9 @@ in
inside and outside Home Manager you can put it in a separate
file and include something like
<programlisting>
<programlisting language="nix">
nixpkgs.config = import ./nixpkgs-config.nix;
xdg.configFile."nixpkgs/config.nix".source =
./nixpkgs-config.nix;
xdg.configFile."nixpkgs/config.nix".source = ./nixpkgs-config.nix;
</programlisting>
in your Home Manager configuration.
@@ -144,7 +143,10 @@ in
config = {
_module.args = {
pkgs = _pkgs;
pkgs_i686 = if _pkgs.stdenv.isLinux then _pkgs.pkgsi686Linux else {};
pkgs_i686 =
if _pkgs.stdenv.isLinux && _pkgs.stdenv.hostPlatform.isx86
then _pkgs.pkgsi686Linux
else { };
};
};
}

35
modules/misc/numlock.nix Normal file
View File

@@ -0,0 +1,35 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.xsession.numlock;
in
{
options = {
xsession.numlock.enable = mkEnableOption "Num Lock";
};
config = mkIf cfg.enable {
systemd.user.services.numlockx = {
Unit = {
Description = "NumLockX";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = "${pkgs.numlockx}/bin/numlockx";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
};
}

View File

@@ -30,7 +30,7 @@ in
config = mkIf (vars != {}) {
home.file.".pam_environment".text =
concatStringsSep "\n" (
mapAttrsToList (n: v: "${n} OVERRIDE=${toString v}") vars
mapAttrsToList (n: v: "${n} OVERRIDE=\"${toString v}\"") vars
) + "\n";
};
}

View File

@@ -12,30 +12,66 @@ in
{
meta.maintainers = [ maintainers.rycee ];
imports = [
(mkChangedOptionModule
[ "qt" "useGtkTheme" ]
[ "qt" "platformTheme" ]
(config:
if getAttrFromPath [ "qt" "useGtkTheme" ] config
then "gtk"
else null))
];
options = {
qt = {
enable = mkEnableOption "Qt 4 and 5 configuration";
useGtkTheme = mkOption {
type = types.bool;
default = false;
platformTheme = mkOption {
type = types.nullOr (types.enum [ "gtk" "gnome" ]);
default = null;
example = "gnome";
relatedPackages = [
"qgnomeplatform"
["libsForQt5" "qtstyleplugins"]
];
description = ''
Whether Qt 4 and 5 should be set up to use the GTK theme
settings.
Selects the platform theme to use for Qt applications.</para>
<para>The options are
<variablelist>
<varlistentry>
<term><literal>gtk</literal></term>
<listitem><para>Use GTK theme with
<link xlink:href="https://github.com/qt/qtstyleplugins">qtstyleplugins</link>
</para></listitem>
</varlistentry>
<varlistentry>
<term><literal>gnome</literal></term>
<listitem><para>Use GNOME theme with
<link xlink:href="https://github.com/FedoraQt/QGnomePlatform">qgnomeplatform</link>
</para></listitem>
</varlistentry>
</variablelist>
'';
};
};
};
config = mkIf (cfg.enable && cfg.useGtkTheme) {
home.sessionVariables.QT_QPA_PLATFORMTHEME = "gtk2";
home.packages = [ pkgs.libsForQt5.qtstyleplugins ];
xsession.profileExtra =
"systemctl --user import-environment QT_QPA_PLATFORMTHEME";
config = mkIf (cfg.enable && cfg.platformTheme != null) {
home.sessionVariables.QT_QPA_PLATFORMTHEME =
if cfg.platformTheme == "gnome" then "gnome" else "gtk2";
home.packages =
if cfg.platformTheme == "gnome"
then [ pkgs.qgnomeplatform ]
else [ pkgs.libsForQt5.qtstyleplugins ];
xsession.importedVariables = [ "QT_QPA_PLATFORMTHEME" ];
# Enable GTK+ style for Qt4 in either case.
# It doesnt support the platform theme packages.
home.activation.useGtkThemeInQt4 = dag.entryAfter ["writeBoundary"] ''
$DRY_RUN_CMD ${pkgs.crudini}/bin/crudini $VERBOSE_ARG \
--set $HOME/.config/Trolltech.conf Qt style GTK+
--set "${config.xdg.configHome}/Trolltech.conf" Qt style GTK+
'';
};
}

View File

@@ -0,0 +1,32 @@
{ lib, ... }:
with lib;
{
meta.maintainers = [ maintainers.rycee ];
options.submoduleSupport = {
enable = mkOption {
type = types.bool;
default = false;
internal = true;
description = ''
Whether the Home Manager module system is used as a submodule
in, for example, NixOS or nix-darwin.
'';
};
externalPackageInstall = mkOption {
type = types.bool;
default = false;
internal = true;
description = ''
Whether the packages of <option>home.packages</option> are
installed separately from the Home Manager activation script.
In NixOS, for example, this may be accomplished by installing
the packages through
<option>users.users.name?.packages</option>.
'';
};
};
}

24
modules/misc/version.nix Normal file
View File

@@ -0,0 +1,24 @@
{ config, lib, ... }:
with lib;
{
options = {
home.stateVersion = mkOption {
type = types.enum [ "18.09" "19.03" "19.09" ];
default = "18.09";
description = ''
It is occasionally necessary for Home Manager to change
configuration defaults in a way that is incompatible with
stateful data. This could, for example, include switching the
default data format or location of a file.
</para><para>
The <emphasis>state version</emphasis> indicates which default
settings are in effect and will therefore help avoid breaking
program configurations. Switching to a higher state version
typically requires performing some manual steps, such as data
conversion or moving files.
'';
};
};
}

View File

@@ -0,0 +1,92 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.xdg.mimeApps;
strListOrSingleton = with types;
coercedTo (either (listOf str) str) toList (listOf str);
in
{
meta.maintainers = with maintainers; [ pacien ];
options.xdg.mimeApps = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Whether to manage <filename>$XDG_CONFIG_HOME/mimeapps.list</filename>.
</para>
<para>
The generated file is read-only.
'';
};
# descriptions from
# https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-1.0.1.html
associations.added = mkOption {
type = types.attrsOf strListOrSingleton;
default = { };
example = literalExample ''
{
"mimetype1" = [ "foo1.desktop" "foo2.desktop" "foo3.desktop" ];
"mimetype2" = "foo4.desktop";
}
'';
description = ''
Defines additional associations of applications with
mimetypes, as if the .desktop file was listing this mimetype
in the first place.
'';
};
associations.removed = mkOption {
type = types.attrsOf strListOrSingleton;
default = { };
example = { "mimetype1" = "foo5.desktop"; };
description = ''
Removes associations of applications with mimetypes, as if the
.desktop file was <emphasis>not</emphasis> listing this
mimetype in the first place.
'';
};
defaultApplications = mkOption {
type = types.attrsOf strListOrSingleton;
default = { };
example = literalExample ''
{
"mimetype1" = [ "default1.desktop" "default2.desktop" ];
}
'';
description = ''
The default application to be used for a given mimetype. This
is, for instance, the one that will be started when
double-clicking on a file in a file manager. If the
application is no longer installed, the next application in
the list is attempted, and so on.
'';
};
};
config = mkIf cfg.enable {
# Deprecated but still used by some applications.
home.file.".local/share/applications/mimeapps.list".source =
config.xdg.configFile."mimeapps.list".source;
xdg.configFile."mimeapps.list".text =
let
joinValues = mapAttrs (n: concatStringsSep ";");
in
generators.toINI {} {
"Added Associations" = joinValues cfg.associations.added;
"Removed Associations" = joinValues cfg.associations.removed;
"Default Applications" = joinValues cfg.defaultApplications;
};
};
}

View File

@@ -0,0 +1,100 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.xdg.userDirs;
in
{
meta.maintainers = with maintainers; [ pacien ];
options.xdg.userDirs = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Whether to manage <filename>$XDG_CONFIG_HOME/user-dirs.dirs</filename>.
</para>
<para>
The generated file is read-only.
'';
};
# Well-known directory list from
# https://gitlab.freedesktop.org/xdg/xdg-user-dirs/blob/master/man/user-dirs.dirs.xml
desktop = mkOption {
type = types.str;
default = "$HOME/Desktop";
description = "The Desktop directory.";
};
documents = mkOption {
type = types.str;
default = "$HOME/Documents";
description = "The Documents directory.";
};
download = mkOption {
type = types.str;
default = "$HOME/Downloads";
description = "The Downloads directory.";
};
music = mkOption {
type = types.str;
default = "$HOME/Music";
description = "The Music directory.";
};
pictures = mkOption {
type = types.str;
default = "$HOME/Pictures";
description = "The Pictures directory.";
};
publishShare = mkOption {
type = types.str;
default = "$HOME/Public";
description = "The Public share directory.";
};
templates = mkOption {
type = types.str;
default = "$HOME/Templates";
description = "The Templates directory.";
};
videos = mkOption {
type = types.str;
default = "$HOME/Videos";
description = "The Videos directory.";
};
extraConfig = mkOption {
type = with types; attrsOf str;
default = { };
example = { XDG_MISC_DIR = "$HOME/Misc"; };
description = "Other user directories.";
};
};
config = mkIf cfg.enable {
xdg.configFile."user-dirs.dirs".text = generators.toKeyValue {} (
{
XDG_DESKTOP_DIR = cfg.desktop;
XDG_DOCUMENTS_DIR = cfg.documents;
XDG_DOWNLOAD_DIR = cfg.download;
XDG_MUSIC_DIR = cfg.music;
XDG_PICTURES_DIR = cfg.pictures;
XDG_PUBLICSHARE_DIR = cfg.publishShare;
XDG_TEMPLATES_DIR = cfg.templates;
XDG_VIDEOS_DIR = cfg.videos;
}
// cfg.extraConfig
);
};
}

View File

@@ -92,10 +92,13 @@ in
})
{
home.file = mkMerge [ cfg.configFile cfg.dataFile ];
home.activation.xdgCreateCache = dag.entryAfter [ "writeBoundary" ] ''
$DRY_RUN_CMD mkdir $VERBOSE_ARG -m0700 -p "${config.xdg.cacheHome}"
'';
home.file = mkMerge [
cfg.configFile
cfg.dataFile
{
"${config.xdg.cacheHome}/.keep".text = "";
}
];
}
];
}

View File

@@ -3,114 +3,164 @@
# Whether to enable module type checking.
, check ? true
# Whether these modules are inside a NixOS submodule.
, nixosSubmodule ? false
}:
with lib;
let
modules = [
./accounts/email.nix
./files.nix
./home-environment.nix
./manual.nix
./misc/fontconfig.nix
./misc/gtk.nix
./misc/news.nix
./misc/nixpkgs.nix
./misc/pam.nix
./misc/qt.nix
./misc/xdg.nix
./programs/autorandr.nix
./programs/bash.nix
./programs/beets.nix
./programs/browserpass.nix
./programs/command-not-found/command-not-found.nix
./programs/direnv.nix
./programs/eclipse.nix
./programs/emacs.nix
./programs/feh.nix
./programs/firefox.nix
./programs/fish.nix
./programs/fzf.nix
./programs/git.nix
./programs/gnome-terminal.nix
./programs/home-manager.nix
./programs/htop.nix
./programs/info.nix
./programs/lesspipe.nix
./programs/man.nix
./programs/mbsync.nix
./programs/mercurial.nix
./programs/msmtp.nix
./programs/neovim.nix
./programs/newsboat.nix
./programs/notmuch.nix
./programs/offlineimap.nix
./programs/pidgin.nix
./programs/rofi.nix
./programs/ssh.nix
./programs/termite.nix
./programs/texlive.nix
./programs/vim.nix
./programs/zsh.nix
./services/blueman-applet.nix
./services/compton.nix
./services/dunst.nix
./services/flameshot.nix
./services/gnome-keyring.nix
./services/gpg-agent.nix
./services/kbfs.nix
./services/kdeconnect.nix
./services/keepassx.nix
./services/keybase.nix
./services/mbsync.nix
./services/mpd.nix
./services/network-manager-applet.nix
./services/owncloud-client.nix
./services/parcellite.nix
./services/pasystray.nix
./services/polybar.nix
./services/random-background.nix
./services/redshift.nix
./services/screen-locker.nix
./services/stalonetray.nix
./services/status-notifier-watcher.nix
./services/syncthing.nix
./services/taffybar.nix
./services/tahoe-lafs.nix
./services/udiskie.nix
./services/unclutter.nix
./services/window-managers/awesome.nix
./services/window-managers/i3.nix
./services/window-managers/xmonad.nix
./services/xscreensaver.nix
./systemd.nix
./xcursor.nix
./xresources.nix
./xsession.nix
<nixpkgs/nixos/modules/misc/assertions.nix>
<nixpkgs/nixos/modules/misc/lib.nix>
<nixpkgs/nixos/modules/misc/meta.nix>
]
++
optional pkgs.stdenv.isLinux ./programs/chromium.nix;
hostPlatform = pkgs.stdenv.hostPlatform;
checkPlatform = any (meta.platformMatch pkgs.stdenv.hostPlatform);
loadModule = file: { condition ? true }: {
inherit file condition;
};
allModules = [
(loadModule ./accounts/email.nix { })
(loadModule ./files.nix { })
(loadModule ./home-environment.nix { })
(loadModule ./manual.nix { })
(loadModule ./misc/dconf.nix { })
(loadModule ./misc/fontconfig.nix { })
(loadModule ./misc/gtk.nix { })
(loadModule ./misc/lib.nix { })
(loadModule ./misc/news.nix { })
(loadModule ./misc/nixpkgs.nix { })
(loadModule ./misc/numlock.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/pam.nix { })
(loadModule ./misc/qt.nix { })
(loadModule ./misc/submodule-support.nix { })
(loadModule ./misc/version.nix { })
(loadModule ./misc/xdg-mime-apps.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/xdg-user-dirs.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/xdg.nix { })
(loadModule ./programs/afew.nix { })
(loadModule ./programs/alacritty.nix { })
(loadModule ./programs/alot.nix { })
(loadModule ./programs/astroid.nix { })
(loadModule ./programs/autorandr.nix { })
(loadModule ./programs/bash.nix { })
(loadModule ./programs/bat.nix { })
(loadModule ./programs/beets.nix { })
(loadModule ./programs/broot.nix { })
(loadModule ./programs/browserpass.nix { })
(loadModule ./programs/chromium.nix { condition = hostPlatform.isLinux; })
(loadModule ./programs/command-not-found/command-not-found.nix { })
(loadModule ./programs/direnv.nix { })
(loadModule ./programs/eclipse.nix { })
(loadModule ./programs/emacs.nix { })
(loadModule ./programs/feh.nix { })
(loadModule ./programs/firefox.nix { })
(loadModule ./programs/fish.nix { })
(loadModule ./programs/fzf.nix { })
(loadModule ./programs/getmail.nix { condition = hostPlatform.isLinux; })
(loadModule ./programs/git.nix { })
(loadModule ./programs/gnome-terminal.nix { })
(loadModule ./programs/go.nix { })
(loadModule ./programs/gpg.nix { })
(loadModule ./programs/home-manager.nix { })
(loadModule ./programs/htop.nix { })
(loadModule ./programs/info.nix { })
(loadModule ./programs/irssi.nix { })
(loadModule ./programs/jq.nix { })
(loadModule ./programs/kakoune.nix { })
(loadModule ./programs/keychain.nix { })
(loadModule ./programs/lesspipe.nix { })
(loadModule ./programs/lsd.nix { })
(loadModule ./programs/man.nix { })
(loadModule ./programs/matplotlib.nix { })
(loadModule ./programs/mbsync.nix { })
(loadModule ./programs/mercurial.nix { })
(loadModule ./programs/mpv.nix { })
(loadModule ./programs/msmtp.nix { })
(loadModule ./programs/neovim.nix { })
(loadModule ./programs/newsboat.nix { })
(loadModule ./programs/noti.nix { })
(loadModule ./programs/notmuch.nix { })
(loadModule ./programs/obs-studio.nix { })
(loadModule ./programs/offlineimap.nix { })
(loadModule ./programs/opam.nix { })
(loadModule ./programs/pidgin.nix { })
(loadModule ./programs/readline.nix { })
(loadModule ./programs/rofi.nix { })
(loadModule ./programs/rtorrent.nix { })
(loadModule ./programs/skim.nix { })
(loadModule ./programs/starship.nix { })
(loadModule ./programs/ssh.nix { })
(loadModule ./programs/taskwarrior.nix { })
(loadModule ./programs/termite.nix { })
(loadModule ./programs/texlive.nix { })
(loadModule ./programs/tmux.nix { })
(loadModule ./programs/urxvt.nix { })
(loadModule ./programs/vim.nix { })
(loadModule ./programs/vscode.nix { })
(loadModule ./programs/vscode/haskell.nix { })
(loadModule ./programs/z-lua.nix { })
(loadModule ./programs/zathura.nix { })
(loadModule ./programs/zsh.nix { })
(loadModule ./services/blueman-applet.nix { })
(loadModule ./services/compton.nix { })
(loadModule ./services/dunst.nix { })
(loadModule ./services/dwm-status.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/emacs.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/flameshot.nix { })
(loadModule ./services/getmail.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/gnome-keyring.nix { })
(loadModule ./services/gpg-agent.nix { })
(loadModule ./services/hound.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/imapnotify.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/kbfs.nix { })
(loadModule ./services/kdeconnect.nix { })
(loadModule ./services/keepassx.nix { })
(loadModule ./services/keybase.nix { })
(loadModule ./services/lorri.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/mbsync.nix { })
(loadModule ./services/mpd.nix { })
(loadModule ./services/mpdris2.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/muchsync.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/network-manager-applet.nix { })
(loadModule ./services/nextcloud-client.nix { })
(loadModule ./services/owncloud-client.nix { })
(loadModule ./services/parcellite.nix { })
(loadModule ./services/pasystray.nix { })
(loadModule ./services/polybar.nix { })
(loadModule ./services/random-background.nix { })
(loadModule ./services/redshift.nix { })
(loadModule ./services/rsibreak.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/screen-locker.nix { })
(loadModule ./services/stalonetray.nix { })
(loadModule ./services/status-notifier-watcher.nix { })
(loadModule ./services/sxhkd.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/syncthing.nix { })
(loadModule ./services/taffybar.nix { })
(loadModule ./services/tahoe-lafs.nix { })
(loadModule ./services/taskwarrior-sync.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/udiskie.nix { })
(loadModule ./services/unclutter.nix { })
(loadModule ./services/window-managers/awesome.nix { })
(loadModule ./services/window-managers/i3.nix { })
(loadModule ./services/window-managers/xmonad.nix { })
(loadModule ./services/xcape.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/xembed-sni-proxy.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/xscreensaver.nix { })
(loadModule ./services/xsuspender.nix { condition = hostPlatform.isLinux; })
(loadModule ./systemd.nix { })
(loadModule ./xcursor.nix { })
(loadModule ./xresources.nix { })
(loadModule ./xsession.nix { })
(loadModule <nixpkgs/nixos/modules/misc/assertions.nix> { })
(loadModule <nixpkgs/nixos/modules/misc/meta.nix> { })
];
modules = map (getAttr "file") (filter (getAttr "condition") allModules);
pkgsModule = {
options.nixosSubmodule = mkOption {
type = types.bool;
internal = true;
readOnly = true;
};
config._module.args.baseModules = modules;
config._module.args.pkgs = lib.mkDefault pkgs;
config._module.check = check;
config.lib = import ./lib { inherit lib; };
config.nixosSubmodule = nixosSubmodule;
config.nixpkgs.system = mkDefault pkgs.system;
};

52
modules/programs/afew.nix Normal file
View File

@@ -0,0 +1,52 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.afew;
in
{
options.programs.afew = {
enable = mkEnableOption "the afew initial tagging script for Notmuch";
extraConfig = mkOption {
type = types.lines;
default = ''
[SpamFilter]
[KillThreadsFilter]
[ListMailsFilter]
[ArchiveSentMailsFilter]
[InboxFilter]
'';
example = ''
[SpamFilter]
[Filter.0]
query = from:pointyheaded@boss.com
tags = -new;+boss
message = Message from above
[InboxFilter]
'';
description = ''
Extra lines added to afew configuration file. Available
configuration options are described in the afew manual:
<link xlink:href="https://afew.readthedocs.io/en/latest/configuration.html" />.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.afew ];
xdg.configFile."afew/config".text = ''
# Generated by Home Manager.
# See https://afew.readthedocs.io/
${cfg.extraConfig}
'';
};
}

View File

@@ -0,0 +1,53 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.alacritty;
in
{
options = {
programs.alacritty = {
enable = mkEnableOption "Alacritty";
settings = mkOption {
type = types.attrs;
default = {};
example = literalExample ''
{
window.dimensions = {
lines = 3;
columns = 200;
};
key_bindings = [
{
key = "K";
mods = "Control";
chars = "\\x0c";
}
];
}
'';
description = ''
Configuration written to
<filename>~/.config/alacritty/alacritty.yml</filename>. See
<link xlink:href="https://github.com/jwilm/alacritty/blob/master/alacritty.yml"/>
for the default configuration.
'';
};
};
};
config = mkMerge [
(mkIf cfg.enable {
home.packages = [ pkgs.alacritty ];
xdg.configFile."alacritty/alacritty.yml" = mkIf (cfg.settings != {}) {
text = replaceStrings ["\\\\"] ["\\"] (builtins.toJSON cfg.settings);
};
})
];
}

View File

@@ -0,0 +1,61 @@
pkgs:
{ config, lib, ... }:
with lib;
{
options.alot = {
sendMailCommand = mkOption {
type = types.nullOr types.str;
description = ''
Command to send a mail. If msmtp is enabled for the account,
then this is set to
<command>msmtpq --read-envelope-from --read-recipients</command>.
'';
};
contactCompletion = mkOption {
type = types.attrsOf types.str;
default = {
type = "shellcommand";
command = "'${pkgs.notmuch}/bin/notmuch address --format=json --output=recipients date:6M..'";
regexp =
"'\\[?{"
+ ''"name": "(?P<name>.*)", ''
+ ''"address": "(?P<email>.+)", ''
+ ''"name-addr": ".*"''
+ "}[,\\]]?'";
shellcommand_external_filtering = "False";
};
example = literalExample ''
{
type = "shellcommand";
command = "abook --mutt-query";
regexp = "'^(?P<email>[^@]+@[^\t]+)\t+(?P<name>[^\t]+)'";
ignorecase = "True";
}
'';
description = ''
Contact completion configuration as expected per alot.
See <link xlink:href="http://alot.readthedocs.io/en/latest/configuration/contacts_completion.html">alot's wiki</link> for
explanation about possible values.
'';
};
extraConfig = mkOption {
type = types.lines;
default = "";
description = ''
Extra settings to add to this Alot account configuration.
'';
};
};
config = mkIf config.notmuch.enable {
alot.sendMailCommand = mkOptionDefault (
if config.msmtp.enable
then "msmtpq --read-envelope-from --read-recipients"
else null
);
};
}

173
modules/programs/alot.nix Normal file
View File

@@ -0,0 +1,173 @@
# alot config loader is sensitive to leading space !
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.alot;
alotAccounts = filter (a: a.notmuch.enable)
(attrValues config.accounts.email.accounts);
boolStr = v: if v then "True" else "False";
accountStr = account: with account;
concatStringsSep "\n" (
[ "[[${name}]]" ]
++ mapAttrsToList (n: v: n + "=" + v) (
{
address = address;
realname = realName;
sendmail_command =
optionalString (alot.sendMailCommand != null) alot.sendMailCommand;
sent_box = "maildir" + "://" + maildir.absPath + "/" + folders.sent;
draft_box = "maildir" + "://"+ maildir.absPath + "/" + folders.drafts;
}
// optionalAttrs (aliases != []) {
aliases = concatStringsSep "," aliases;
}
// optionalAttrs (gpg != null) {
gpg_key = gpg.key;
encrypt_by_default = if gpg.encryptByDefault then "all" else "none";
sign_by_default = boolStr gpg.signByDefault;
}
// optionalAttrs (signature.showSignature != "none") {
signature = pkgs.writeText "signature.txt" signature.text;
signature_as_attachment =
boolStr (signature.showSignature == "attach");
}
)
++ [ alot.extraConfig ]
++ [ "[[[abook]]]" ]
++ mapAttrsToList (n: v: n + "=" + v) alot.contactCompletion
);
configFile =
let
bindingsToStr = attrSet:
concatStringsSep "\n" (mapAttrsToList (n: v: "${n} = ${v}") attrSet);
in
''
# Generated by Home Manager.
# See http://alot.readthedocs.io/en/latest/configuration/config_options.html
${cfg.extraConfig}
[bindings]
${bindingsToStr cfg.bindings.global}
[[bufferlist]]
${bindingsToStr cfg.bindings.bufferlist}
[[search]]
${bindingsToStr cfg.bindings.search}
[[envelope]]
${bindingsToStr cfg.bindings.envelope}
[[taglist]]
${bindingsToStr cfg.bindings.taglist}
[[thread]]
${bindingsToStr cfg.bindings.thread}
[accounts]
${concatStringsSep "\n\n" (map accountStr alotAccounts)}
'';
in
{
options.programs.alot = {
enable = mkOption {
type = types.bool;
default = false;
example = true;
description = ''
Whether to enable the Alot mail user agent. Alot uses the
Notmuch email system and will therefore be automatically
enabled for each email account that is managed by Notmuch.
'';
};
hooks = mkOption {
type = types.lines;
default = "";
description = ''
Content of the hooks file.
'';
};
bindings = mkOption {
type = types.submodule {
options = {
global = mkOption {
type = types.attrsOf types.str;
default = {};
description = "Global keybindings.";
};
bufferlist = mkOption {
type = types.attrsOf types.str;
default = {};
description = "Bufferlist mode keybindings.";
};
search = mkOption {
type = types.attrsOf types.str;
default = {};
description = "Search mode keybindings.";
};
envelope = mkOption {
type = types.attrsOf types.str;
default = {};
description = "Envelope mode keybindings.";
};
taglist = mkOption {
type = types.attrsOf types.str;
default = {};
description = "Taglist mode keybindings.";
};
thread = mkOption {
type = types.attrsOf types.str;
default = {};
description = "Thread mode keybindings.";
};
};
};
default = {};
description = ''
Keybindings.
'';
};
extraConfig = mkOption {
type = types.lines;
default = ''
auto_remove_unread = True
ask_subject = False
handle_mouse = True
initial_command = "search tag:inbox AND NOT tag:killed"
input_timeout = 0.3
prefer_plaintext = True
thread_indent_replies = 4
'';
description = ''
Extra lines added to alot configuration file.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.alot ];
xdg.configFile."alot/config".text = configFile;
xdg.configFile."alot/hooks.py".text =
''
# Generated by Home Manager.
''
+ cfg.hooks;
};
}

View File

@@ -0,0 +1,33 @@
{ config, lib, ... }:
with lib;
{
options.astroid = {
enable = mkEnableOption "Astroid";
sendMailCommand = mkOption {
type = types.str;
description = ''
Command to send a mail. If msmtp is enabled for the account,
then this is set to
<command>msmtpq --read-envelope-from --read-recipients</command>.
'';
};
extraConfig = mkOption {
type = types.attrs;
default = {};
example = { select_query = ""; };
description = ''
Extra settings to add to this astroid account configuration.
'';
};
};
config = mkIf config.notmuch.enable {
astroid.sendMailCommand = mkIf config.msmtp.enable (
mkOptionDefault "msmtpq --read-envelope-from --read-recipients"
);
};
}

View File

@@ -0,0 +1,113 @@
{
"astroid": {
"config": {
"version": "11"
},
"debug": {
"dryrun_sending": "false"
},
"hints": {
"level": "0"
},
"log": {
"syslog": "false",
"stdout": "true",
"level": "info"
}
},
"startup": {
"queries": {
"inbox": "tag:inbox"
}
},
"terminal": {
"height": "10",
"font_description": "default"
},
"thread_index": {
"page_jump_rows": "6",
"sort_order": "newest",
"cell": {
"font_description": "default",
"line_spacing": "2",
"date_length": "10",
"message_count_length": "4",
"authors_length": "20",
"subject_color": "#807d74",
"subject_color_selected": "#000000",
"background_color_selected": "",
"background_color_marked": "#fff584",
"background_color_marked_selected": "#bcb559",
"tags_length": "80",
"tags_upper_color": "#e5e5e5",
"tags_lower_color": "#333333",
"tags_alpha": "0.5",
"hidden_tags": "attachment,flagged,unread"
}
},
"general": {
"time": {
"clock_format": "local",
"same_year": "%b %-e",
"diff_year": "%x"
}
},
"editor": {
"charset": "utf-8",
"save_draft_on_force_quit": "true",
"attachment_words": "attach",
"attachment_directory": "~",
"markdown_processor": "marked"
},
"mail": {
"reply": {
"quote_line": "Excerpts from %1's message of %2:",
"mailinglist_reply_to_sender": "true"
},
"forward": {
"quote_line": "Forwarding %1's message of %2:",
"disposition": "inline"
},
"sent_tags": "sent",
"message_id_fqdn": "",
"message_id_user": "",
"user_agent": "default",
"send_delay": "2",
"close_on_success": "false",
"format_flowed": "false"
},
"poll": {
"interval": "60",
"always_full_refresh": "false"
},
"attachment": {
"external_open_cmd": "xdg-open"
},
"thread_view": {
"open_html_part_external": "false",
"preferred_type": "plain",
"preferred_html_only": "false",
"allow_remote_when_encrypted": "false",
"open_external_link": "xdg-open",
"default_save_directory": "~",
"indent_messages": "false",
"gravatar": {
"enable": "true"
},
"mark_unread_delay": "0.5",
"expand_flagged": "true"
},
"crypto": {
"gpg": {
"path": "gpg2",
"always_trust": "true",
"enabled": "true"
}
},
"saved_searches": {
"show_on_startup": "false",
"save_history": "true",
"history_lines_to_show": "15",
"history_lines": "1000"
}
}

View File

@@ -0,0 +1,131 @@
{ config, lib, pkgs, ... }:
with lib;
with builtins;
let
cfg = config.programs.astroid;
astroidAccounts =
filterAttrs
(n: v: v.astroid.enable)
config.accounts.email.accounts;
boolOpt = b: if b then "true" else "false";
accountAttr = account: with account; {
email = address;
name = realName;
sendmail = astroid.sendMailCommand;
additional_sent_tags = "";
default = boolOpt primary;
save_drafts_to = "${maildir.absPath}/${folders.drafts}";
save_sent = "true";
save_sent_to = "${maildir.absPath}/${folders.sent}";
select_query = "";
}
// optionalAttrs (signature.showSignature != "none") {
signature_attach = boolOpt (signature.showSignature == "attach");
signature_default_on = boolOpt (signature.showSignature != "none");
signature_file = pkgs.writeText "signature.txt" signature.text;
signature_file_markdown = "false";
signature_separate = "true"; # prepends '--\n' to the signature
}
// optionalAttrs (gpg != null) {
always_gpg_sign = boolOpt gpg.signByDefault;
gpgkey = gpg.key;
}
// astroid.extraConfig;
# See https://github.com/astroidmail/astroid/wiki/Configuration-Reference
configFile = mailAccounts:
let
template = fromJSON (readFile ./astroid-config-template.json);
astroidConfig = foldl' recursiveUpdate template [
{
astroid.notmuch_config = "${config.xdg.configHome}/notmuch/notmuchrc";
accounts = mapAttrs (n: accountAttr) astroidAccounts;
crypto.gpg.path = "${pkgs.gnupg}/bin/gpg";
}
cfg.extraConfig
cfg.externalEditor
];
in
builtins.toJSON astroidConfig;
in
{
options = {
programs.astroid = {
enable = mkEnableOption "Astroid";
pollScript = mkOption {
type = types.str;
default = "";
example = "mbsync gmail";
description = ''
Script to run to fetch/update mails.
'';
};
externalEditor = mkOption {
type = types.nullOr types.str;
default = null;
# Converts it into JSON that can be merged into the configuration.
apply = cmd:
optionalAttrs (cmd != null) {
editor = {
"external_editor" = "true";
"cmd" = cmd;
};
};
example = "nvim-qt -- -c 'set ft=mail' '+set fileencoding=utf-8' '+set ff=unix' '+set enc=utf-8' '+set fo+=w' %1";
description = ''
You can use <code>%1</code>, <code>%2</code>, and
<code>%3</code> to refer respectively to:
<orderedlist numeration="arabic">
<listitem><para>file name</para></listitem>
<listitem><para>server name</para></listitem>
<listitem><para>socket ID</para></listitem>
</orderedlist>
See <link xlink:href='https://github.com/astroidmail/astroid/wiki/Customizing-editor' />.
'';
};
extraConfig = mkOption {
type = types.attrs;
default = {};
example = { poll.interval = 0; };
description = ''
JSON config that will override the default Astroid configuration.
'';
};
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.astroid ];
xdg.configFile."astroid/config".source =
pkgs.runCommand "out.json"
{
json = configFile astroidAccounts;
preferLocalBuild = true;
allowSubstitutes = false;
}
''
echo -n "$json" | ${pkgs.jq}/bin/jq . > $out
'';
xdg.configFile."astroid/poll.sh" = {
executable = true;
text = ''
# Generated by Home Manager
${cfg.pollScript}
'';
};
};
}

View File

@@ -6,10 +6,25 @@ let
cfg = config.programs.autorandr;
matrixOf = n: m: elemType: mkOptionType rec {
name = "matrixOf";
description = "${toString n}×${toString m} matrix of ${elemType.description}s";
check = xss:
let
listOfSize = l: xs: isList xs && length xs == l;
in
listOfSize n xss && all (xs: listOfSize m xs && all elemType.check xs) xss;
merge = mergeOneOption;
getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["*" "*"]);
getSubModules = elemType.getSubModules;
substSubModules = mod: matrixOf n m (elemType.substSubModules mod);
functor = (defaultFunctor name) // { wrapped = elemType; };
};
profileModule = types.submodule {
options = {
fingerprint = mkOption {
type = types.attrsOf types.string;
type = types.attrsOf types.str;
description = ''
Output name to EDID mapping.
Use <code>autorandr --fingerprint</code> to get current setup values.
@@ -46,28 +61,28 @@ let
};
position = mkOption {
type = types.string;
type = types.str;
description = "Output position";
default = "";
example = "5760x0";
};
mode = mkOption {
type = types.string;
type = types.str;
description = "Output resolution.";
default = "";
example = "3840x2160";
};
rate = mkOption {
type = types.string;
type = types.str;
description = "Output framerate.";
default = "";
example = "60.00";
};
gamma = mkOption {
type = types.string;
type = types.str;
description = "Output gamma configuration.";
default = "";
example = "1.0:0.909:0.833";
@@ -79,6 +94,80 @@ let
default = null;
example = "left";
};
transform = mkOption {
type = types.nullOr (matrixOf 3 3 types.float);
default = null;
example = literalExample ''
[
[ 0.6 0.0 0.0 ]
[ 0.0 0.6 0.0 ]
[ 0.0 0.0 1.0 ]
]
'';
description = ''
Refer to
<citerefentry>
<refentrytitle>xrandr</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>
for the documentation of the transform matrix.
'';
};
dpi = mkOption {
type = types.nullOr types.ints.positive;
description = "Output DPI configuration.";
default = null;
example = 96;
};
scale = mkOption {
type = types.nullOr (types.submodule {
options = {
method = mkOption {
type = types.enum ["factor" "pixel" ];
description = "Output scaling method.";
default = "factor";
example = "pixel";
};
x = mkOption {
type = types.either types.float types.ints.positive;
description = "Horizontal scaling factor/pixels.";
};
y = mkOption {
type = types.either types.float types.ints.positive;
description = "Vertical scaling factor/pixels.";
};
};
});
description = ''
Output scale configuration.
</para><para>
Either configure by pixels or a scaling factor. When using pixel method the
<citerefentry>
<refentrytitle>xrandr</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>
option
<parameter class="command">--scale-from</parameter>
will be used; when using factor method the option
<parameter class="command">--scale</parameter>
will be used.
</para><para>
This option is a shortcut version of the transform option and they are mutually
exclusive.
'';
default = null;
example = literalExample ''
{
x = 1.25;
y = 1.25;
}
'';
};
};
};
@@ -146,10 +235,18 @@ let
output ${name}
${optionalString (config.position != "") "pos ${config.position}"}
${optionalString config.primary "primary"}
${optionalString (config.dpi != null) "dpi ${toString config.dpi}"}
${optionalString (config.gamma != "") "gamma ${config.gamma}"}
${optionalString (config.mode != "") "mode ${config.mode}"}
${optionalString (config.rate != "") "rate ${config.rate}"}
${optionalString (config.rotate != null) "rotate ${config.rotate}"}
${optionalString (config.scale != null) (
(if config.scale.method == "factor" then "scale" else "scale-from")
+ " ${toString config.scale.x}x${toString config.scale.y}"
)}
${optionalString (config.transform != null) (
"transform " + concatMapStringsSep "," toString (flatten config.transform)
)}
'' else ''
output ${name}
off
@@ -226,6 +323,19 @@ in
};
config = mkIf cfg.enable {
assertions = flatten (mapAttrsToList (
profile: { config, ... }: mapAttrsToList (
output: opts: {
assertion = opts.scale == null || opts.transform == null;
message = ''
Cannot use the profile output options 'scale' and 'transform' simultaneously.
Check configuration for: programs.autorandr.profiles.${profile}.config.${output}
'';
})
config
)
cfg.profiles);
home.packages = [ pkgs.autorandr ];
xdg.configFile = mkMerge ([
(mapAttrs' (hookToFile "postswitch.d") cfg.hooks.postswitch)

View File

@@ -81,12 +81,12 @@ in
shellAliases = mkOption {
default = {};
type = types.attrsOf types.str;
example = { ll = "ls -l"; ".." = "cd .."; };
description = ''
An attribute set that maps aliases (the top level attribute names in
this option) to command strings or directly to build outputs.
'';
type = types.attrs;
};
enableAutojump = mkOption {
@@ -123,6 +123,15 @@ in
interactive shell.
'';
};
logoutExtra = mkOption {
default = "";
type = types.lines;
description = ''
Extra commands that should be run when logging out of an
interactive shell.
'';
};
};
};
@@ -155,7 +164,7 @@ in
in mkIf cfg.enable {
programs.bash.bashrcExtra = ''
# Commands that should be applied only for interactive shells.
if [[ -n $PS1 ]]; then
if [[ $- == *i* ]]; then
${historyControlStr}
${shoptsStr}
@@ -195,6 +204,14 @@ in
${cfg.bashrcExtra}
'';
home.file.".bash_logout" = mkIf (cfg.logoutExtra != "") {
text = ''
# -*- mode: sh -*-
${cfg.logoutExtra}
'';
};
home.packages =
optional (cfg.enableAutojump) pkgs.autojump;
}

40
modules/programs/bat.nix Normal file
View File

@@ -0,0 +1,40 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.bat;
in
{
meta.maintainers = [ maintainers.marsam ];
options.programs.bat = {
enable = mkEnableOption "bat, a cat clone with wings";
config = mkOption {
type = types.attrsOf types.str;
default = {};
example = {
theme = "TwoDark";
pager = "less -FR";
};
description = ''
Bat configuration.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.bat ];
xdg.configFile."bat/config" = mkIf (cfg.config != {}) {
text = concatStringsSep "\n" (
mapAttrsToList (n: v: ''--${n}="${v}"'') cfg.config
);
};
};
}

View File

@@ -13,6 +13,21 @@ in
options = {
programs.beets = {
enable = mkOption {
type = types.bool;
default =
if versionAtLeast config.home.stateVersion "19.03"
then false
else cfg.settings != {};
defaultText = "false";
description = ''
Whether to enable the beets music library manager. This
defaults to <literal>false</literal> for state
version  19.03. For earlier versions beets is enabled if
<option>programs.beets.settings</option> is non-empty.
'';
};
settings = mkOption {
type = types.attrs;
default = {};
@@ -24,7 +39,7 @@ in
};
};
config = mkIf (cfg.settings != {}) {
config = mkIf cfg.enable {
home.packages = [ pkgs.beets ];
xdg.configFile."beets/config.yaml".text =

261
modules/programs/broot.nix Normal file
View File

@@ -0,0 +1,261 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.broot;
configFile = config:
pkgs.runCommand "conf.toml"
{
buildInputs = [ pkgs.remarshal ];
preferLocalBuild = true;
allowSubstitutes = false;
}
''
remarshal -if json -of toml \
< ${pkgs.writeText "verbs.json" (builtins.toJSON config)} \
> $out
'';
brootConf = {
verbs =
mapAttrsToList
(name: value: value // { invocation = name; })
cfg.verbs;
skin = cfg.skin;
};
in
{
meta.maintainers = [ maintainers.aheaume ];
options.programs.broot = {
enable = mkEnableOption "Broot, a better way to navigate directories";
enableBashIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Bash integration.
'';
};
enableZshIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Zsh integration.
'';
};
enableFishIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Fish integration.
'';
};
verbs = mkOption {
type = with types; attrsOf (attrsOf (either bool str));
default = {
"p" = { execution = ":parent"; };
"edit" = { shortcut = "e"; execution = "$EDITOR {file}" ; };
"create {subpath}" = { execution = "$EDITOR {directory}/{subpath}"; };
"view" = { execution = "less {file}"; };
};
example = literalExample ''
{
"p" = { execution = ":parent"; };
"edit" = { shortcut = "e"; execution = "$EDITOR {file}" ; };
"create {subpath}" = { execution = "$EDITOR {directory}/{subpath}"; };
"view" = { execution = "less {file}"; };
"blop {name}\\.{type}" = {
execution = "/bin/mkdir {parent}/{type} && /usr/bin/nvim {parent}/{type}/{name}.{type}";
from_shell = true;
};
}
'';
description = ''
Define new verbs. The attribute name indicates how the verb is
called by the user, with placeholders for arguments.
</para><para>
The possible attributes are:
</para>
<para>
<variablelist>
<varlistentry>
<term><literal>execution</literal> (mandatory)</term>
<listitem><para>how the verb is executed</para></listitem>
</varlistentry>
<varlistentry>
<term><literal>shortcut</literal> (optional)</term>
<listitem><para>an alternate way to call the verb (without
the arguments part)</para></listitem>
</varlistentry>
<varlistentry>
<term><literal>leave_broot</literal> (optional)</term>
<listitem><para>whether to quit broot on execution
(default: <literal>true</literal>)</para></listitem>
</varlistentry>
<varlistentry>
<term><literal>from_shell</literal> (optional)</term>
<listitem><para>whether the verb must be executed from the
parent shell (default:
<literal>false</literal>)</para></listitem>
</varlistentry>
</variablelist>
'';
};
skin = mkOption {
type = types.attrsOf types.str;
default = {};
example = literalExample ''
{
status_normal_fg = "grayscale(18)";
status_normal_bg = "grayscale(3)";
status_error_fg = "red";
status_error_bg = "yellow";
tree_fg = "red";
selected_line_bg = "grayscale(7)";
permissions_fg = "grayscale(12)";
size_bar_full_bg = "red";
size_bar_void_bg = "black";
directory_fg = "lightyellow";
input_fg = "cyan";
flag_value_fg = "lightyellow";
table_border_fg = "red";
code_fg = "lightyellow";
}
'';
description = ''
Color configuration.
</para><para>
Complete list of keys (expected to change before the v1 of broot):
<itemizedlist>
<listitem><para><literal>char_match</literal></para></listitem>
<listitem><para><literal>code</literal></para></listitem>
<listitem><para><literal>directory</literal></para></listitem>
<listitem><para><literal>exe</literal></para></listitem>
<listitem><para><literal>file</literal></para></listitem>
<listitem><para><literal>file_error</literal></para></listitem>
<listitem><para><literal>flag_label</literal></para></listitem>
<listitem><para><literal>flag_value</literal></para></listitem>
<listitem><para><literal>input</literal></para></listitem>
<listitem><para><literal>link</literal></para></listitem>
<listitem><para><literal>permissions</literal></para></listitem>
<listitem><para><literal>selected_line</literal></para></listitem>
<listitem><para><literal>size_bar_full</literal></para></listitem>
<listitem><para><literal>size_bar_void</literal></para></listitem>
<listitem><para><literal>size_text</literal></para></listitem>
<listitem><para><literal>spinner</literal></para></listitem>
<listitem><para><literal>status_error</literal></para></listitem>
<listitem><para><literal>status_normal</literal></para></listitem>
<listitem><para><literal>table_border</literal></para></listitem>
<listitem><para><literal>tree</literal></para></listitem>
<listitem><para><literal>unlisted</literal></para></listitem>
</itemizedlist></para>
<para>
Add <literal>_fg</literal> for a foreground color and
<literal>_bg</literal> for a background colors.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.broot ];
xdg.configFile."broot/conf.toml".source = configFile brootConf;
# Dummy file to prevent broot from trying to reinstall itself
xdg.configFile."broot/launcher/installed".text = "";
programs.bash.initExtra =
mkIf cfg.enableBashIntegration (
# Using mkAfter to make it more likely to appear after other
# manipulations of the prompt.
mkAfter ''
# This script was automatically generated by the broot function
# More information can be found in https://github.com/Canop/broot
# This function starts broot and executes the command
# it produces, if any.
# It's needed because some shell commands, like `cd`,
# have no useful effect if executed in a subshell.
function br {
f=$(mktemp)
(
set +e
broot --outcmd "$f" "$@"
code=$?
if [ "$code" != 0 ]; then
rm -f "$f"
exit "$code"
fi
)
code=$?
if [ "$code" != 0 ]; then
return "$code"
fi
d=$(cat "$f")
rm -f "$f"
eval "$d"
}
''
);
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
# This script was automatically generated by the broot function
# More information can be found in https://github.com/Canop/broot
# This function starts broot and executes the command
# it produces, if any.
# It's needed because some shell commands, like `cd`,
# have no useful effect if executed in a subshell.
function br {
f=$(mktemp)
(
set +e
broot --outcmd "$f" "$@"
code=$?
if [ "$code" != 0 ]; then
rm -f "$f"
exit "$code"
fi
)
code=$?
if [ "$code" != 0 ]; then
return "$code"
fi
d=$(cat "$f")
rm -f "$f"
eval "$d"
}
'';
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
# This script was automatically generated by the broot function
# More information can be found in https://github.com/Canop/broot
# This function starts broot and executes the command
# it produces, if any.
# It's needed because some shell commands, like `cd`,
# have no useful effect if executed in a subshell.
function br
set f (mktemp)
broot --outcmd $f $argv
if test $status -ne 0
rm -f "$f"
return "$code"
end
set d (cat "$f")
rm -f "$f"
eval "$d"
end
'';
};
}

View File

@@ -31,12 +31,12 @@ in {
else ".config/google-chrome/NativeMessagingHosts";
in [
{
target = "${dir}/com.dannyvankooten.browserpass.json";
source = "${pkgs.browserpass}/etc/chrome-host.json";
target = "${dir}/com.github.browserpass.native.json";
source = "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
}
{
target = "${dir}/../policies/managed/com.dannyvankooten.browserpass.json";
source = "${pkgs.browserpass}/etc/chrome-policy.json";
target = "${dir}/../policies/managed/com.github.browserpass.native.json";
source = "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
}
]
else if x == "chromium" then
@@ -45,12 +45,12 @@ in {
else ".config/chromium/NativeMessagingHosts";
in [
{
target = "${dir}/com.dannyvankooten.browserpass.json";
source = "${pkgs.browserpass}/etc/chrome-host.json";
target = "${dir}/com.github.browserpass.native.json";
source = "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
}
{
target = "${dir}/../policies/managed/com.dannyvankooten.browserpass.json";
source = "${pkgs.browserpass}/etc/chrome-policy.json";
target = "${dir}/../policies/managed/com.github.browserpass.native.json";
source = "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
}
]
else if x == "firefox" then
@@ -58,8 +58,8 @@ in {
target = (if isDarwin
then "Library/Application Support/Mozilla/NativeMessagingHosts"
else ".mozilla/native-messaging-hosts")
+ "/com.dannyvankooten.browserpass.json";
source = "${pkgs.browserpass}/lib/mozilla/native-messaging-hosts/com.dannyvankooten.browserpass.json";
+ "/com.github.browserpass.native.json";
source = "${pkgs.browserpass}/lib/browserpass/hosts/firefox/com.github.browserpass.native.json";
} ]
else if x == "vivaldi" then
let dir = if isDarwin
@@ -67,12 +67,12 @@ in {
else ".config/vivaldi/NativeMessagingHosts";
in [
{
target = "${dir}/com.dannyvankooten.browserpass.json";
source = "${pkgs.browserpass}/etc/chrome-host.json";
target = "${dir}/com.github.browserpass.native.json";
source = "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
}
{
target = "${dir}/../policies/managed/com.dannyvankooten.browserpass.json";
source = "${pkgs.browserpass}/etc/chrome-policy.json";
target = "${dir}/../policies/managed/com.github.browserpass.native.json";
source = "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
}
]
else throw "unknown browser ${x}") config.programs.browserpass.browsers);

View File

@@ -21,7 +21,7 @@ let
inherit visible;
type = types.package;
default = defaultPkg;
defaultText = "pkgs.${browser}";
defaultText = literalExample "pkgs.${browser}";
description = "The ${name} package to use.";
};

View File

@@ -5,6 +5,18 @@ with lib;
let
cfg = config.programs.direnv;
configFile = config:
pkgs.runCommand "config.toml"
{
buildInputs = [ pkgs.remarshal ];
preferLocalBuild = true;
allowSubstitutes = false;
}
''
remarshal -if json -of toml \
< ${pkgs.writeText "config.json" (builtins.toJSON config)} \
> $out
'';
in
@@ -14,6 +26,31 @@ in
options.programs.direnv = {
enable = mkEnableOption "direnv, the environment switcher";
config = mkOption {
type = types.attrs;
default = {};
description = ''
Configuration written to
<filename>~/.config/direnv/config.toml</filename>.
</para><para>
See
<citerefentry>
<refentrytitle>direnv.toml</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>.
for the full list of options.
'';
};
stdlib = mkOption {
type = types.lines;
default = "";
description = ''
Custom stdlib written to
<filename>~/.config/direnv/direnvrc</filename>.
'';
};
enableBashIntegration = mkOption {
default = true;
type = types.bool;
@@ -42,6 +79,14 @@ in
config = mkIf cfg.enable {
home.packages = [ pkgs.direnv ];
xdg.configFile."direnv/config.toml" = mkIf (cfg.config != {}) {
source = configFile cfg.config;
};
xdg.configFile."direnv/direnvrc" = mkIf (cfg.stdlib != "") {
text = cfg.stdlib;
};
programs.bash.initExtra =
mkIf cfg.enableBashIntegration (
# Using mkAfter to make it more likely to appear after other

View File

@@ -4,10 +4,17 @@ with lib;
let
hmTypes = import ../lib/types.nix { inherit lib; };
cfg = config.programs.emacs;
# Copied from all-packages.nix.
emacsPackages = pkgs.emacsPackagesNgGen cfg.package;
# Copied from all-packages.nix, with modifications to support
# overrides.
emacsPackages =
let
epkgs = pkgs.emacsPackagesGen cfg.package;
in
epkgs.overrideScope' cfg.overrides;
emacsWithPackages = emacsPackages.emacsWithPackages;
in
@@ -22,21 +29,51 @@ in
package = mkOption {
type = types.package;
default = pkgs.emacs;
defaultText = "pkgs.emacs";
defaultText = literalExample "pkgs.emacs";
example = literalExample "pkgs.emacs25-nox";
description = "The Emacs package to use.";
};
extraPackages = mkOption {
default = self: [];
type = hmTypes.selectorFunction;
defaultText = "epkgs: []";
example = literalExample "epkgs: [ epkgs.emms epkgs.magit ]";
description = "Extra packages available to Emacs.";
description = ''
Extra packages available to Emacs. To get a list of
available packages run:
<command>nix-env -f '&lt;nixpkgs&gt;' -qaP -A emacsPackages</command>.
'';
};
overrides = mkOption {
default = self: super: {};
type = hmTypes.overlayFunction;
defaultText = "self: super: {}";
example = literalExample ''
self: super: rec {
haskell-mode = self.melpaPackages.haskell-mode;
# ...
};
'';
description = ''
Allows overriding packages within the Emacs package set.
'';
};
finalPackage = mkOption {
type = types.package;
visible = false;
readOnly = true;
description = ''
The Emacs package including any overrides and extra packages.
'';
};
};
};
config = mkIf cfg.enable {
home.packages = [ (emacsWithPackages cfg.extraPackages) ];
home.packages = [ cfg.finalPackage ];
programs.emacs.finalPackage = emacsWithPackages cfg.extraPackages;
};
}

View File

@@ -17,7 +17,7 @@ in
keybindings = mkOption {
default = {};
type = types.attrs;
type = types.attrsOf types.str;
example = { zoom_in = "plus"; zoom_out = "minus"; };
description = ''
Set keybindings.

View File

@@ -6,6 +6,47 @@ let
cfg = config.programs.firefox;
mozillaConfigPath = ".mozilla";
firefoxConfigPath = "${mozillaConfigPath}/firefox";
profilesPath = firefoxConfigPath;
# The extensions path shared by all profiles; will not be supported
# by future Firefox versions.
extensionPath = "extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
extensionsEnvPkg = pkgs.buildEnv {
name = "hm-firefox-extensions";
paths = cfg.extensions;
};
profiles =
flip mapAttrs' cfg.profiles (_: profile:
nameValuePair "Profile${toString profile.id}" {
Name = profile.name;
Path = profile.path;
IsRelative = 1;
Default = if profile.isDefault then 1 else 0;
}
) // {
General = {
StartWithLastProfile = 1;
};
};
profilesIni = generators.toINI {} profiles;
mkUserJs = prefs: extraPrefs: ''
// Generated by Home Manager.
${concatStrings (mapAttrsToList (name: value: ''
user_pref("${name}", ${builtins.toJSON value});
'') prefs)}
${extraPrefs}
'';
in
{
@@ -17,9 +58,110 @@ in
package = mkOption {
type = types.package;
default = pkgs.firefox-unwrapped;
defaultText = "pkgs.firefox-unwrapped";
description = "The unwrapped Firefox package to use.";
default =
if versionAtLeast config.home.stateVersion "19.09"
then pkgs.firefox
else pkgs.firefox-unwrapped;
defaultText = literalExample "pkgs.firefox";
description = ''
The Firefox package to use. If state version  19.09 then
this should be a wrapped Firefox package. For earlier state
versions it should be an unwrapped Firefox package.
'';
};
extensions = mkOption {
type = types.listOf types.package;
default = [];
example = literalExample ''
with pkgs.nur.repos.rycee.firefox-addons; [
https-everywhere
privacy-badger
]
'';
description = ''
List of Firefox add-on packages to install. Note, it is
necessary to manually enable these extensions inside Firefox
after the first installation.
'';
};
profiles = mkOption {
type = types.attrsOf (types.submodule ({config, name, ...}: {
options = {
name = mkOption {
type = types.str;
default = name;
description = "Profile name.";
};
id = mkOption {
type = types.ints.unsigned;
default = 0;
description = ''
Profile ID. This should be set to a unique number per profile.
'';
};
settings = mkOption {
type = with types; attrsOf (either bool (either int str));
default = {};
example = literalExample ''
{
"browser.startup.homepage" = "https://nixos.org";
"browser.search.region" = "GB";
"browser.search.isUS" = false;
"distribution.searchplugins.defaultLocale" = "en-GB";
"general.useragent.locale" = "en-GB";
"browser.bookmarks.showMobileBookmarks" = true;
}
'';
description = "Attribute set of Firefox preferences.";
};
extraConfig = mkOption {
type = types.lines;
default = "";
description = ''
Extra preferences to add to <filename>user.js</filename>.
'';
};
userChrome = mkOption {
type = types.lines;
default = "";
description = "Custom Firefox CSS.";
example = ''
/* Hide tab bar in FF Quantum */
@-moz-document url("chrome://browser/content/browser.xul") {
#TabsToolbar {
visibility: collapse !important;
margin-bottom: 21px !important;
}
#sidebar-box[sidebarcommand="treestyletab_piro_sakura_ne_jp-sidebar-action"] #sidebar-header {
visibility: collapse !important;
}
}
'';
};
path = mkOption {
type = types.str;
default = name;
description = "Profile path.";
};
isDefault = mkOption {
type = types.bool;
default = config.id == 0;
defaultText = "true if profile ID is 0";
description = "Whether this is a default profile.";
};
};
}));
default = {};
description = "Attribute set of Firefox profiles.";
};
enableAdobeFlash = mkOption {
@@ -31,34 +173,122 @@ in
enableGoogleTalk = mkOption {
type = types.bool;
default = false;
description = "Whether to enable the unfree Google Talk plugin.";
description = ''
Whether to enable the unfree Google Talk plugin. This option
is <emphasis>deprecated</emphasis> and will only work if
<programlisting language="nix">
programs.firefox.package = pkgs.firefox-esr-52-unwrapped;
</programlisting>
and the <option>plugin.load_flash_only</option> Firefox
option has been disabled.
'';
};
enableIcedTea = mkOption {
type = types.bool;
default = false;
description = "Whether to enable the Java applet plugin.";
description = ''
Whether to enable the Java applet plugin. This option is
<emphasis>deprecated</emphasis> and will only work if
<programlisting language="nix">
programs.firefox.package = pkgs.firefox-esr-52-unwrapped;
</programlisting>
and the <option>plugin.load_flash_only</option> Firefox
option has been disabled.
'';
};
};
};
config = mkIf cfg.enable {
assertions = [
(
let
defaults =
catAttrs "name" (filter (a: a.isDefault) (attrValues cfg.profiles));
in {
assertion = cfg.profiles == {} || length defaults == 1;
message =
"Must have exactly one default Firefox profile but found "
+ toString (length defaults)
+ optionalString (length defaults > 1)
(", namely " + concatStringsSep ", " defaults);
}
)
(
let
duplicates =
filterAttrs (_: v: length v != 1)
(zipAttrs
(mapAttrsToList (n: v: { "${toString v.id}" = n; })
(cfg.profiles)));
mkMsg = n: v: " - ID ${n} is used by ${concatStringsSep ", " v}";
in {
assertion = duplicates == {};
message =
"Must not have Firefox profiles with duplicate IDs but\n"
+ concatStringsSep "\n" (mapAttrsToList mkMsg duplicates);
}
)
];
home.packages =
let
# A bit of hackery to force a config into the wrapper.
browserName = cfg.package.browserName
or (builtins.parseDrvName cfg.package.name).name;
fcfg = setAttrByPath [browserName] {
# The configuration expected by the Firefox wrapper.
fcfg = {
enableAdobeFlash = cfg.enableAdobeFlash;
enableGoogleTalkPlugin = cfg.enableGoogleTalk;
icedtea = cfg.enableIcedTea;
};
wrapper = pkgs.wrapFirefox.override {
config = fcfg;
};
# A bit of hackery to force a config into the wrapper.
browserName = cfg.package.browserName
or (builtins.parseDrvName cfg.package.name).name;
# The configuration expected by the Firefox wrapper builder.
bcfg = setAttrByPath [browserName] fcfg;
package =
if versionAtLeast config.home.stateVersion "19.09"
then cfg.package.override { cfg = fcfg; }
else (pkgs.wrapFirefox.override { config = bcfg; }) cfg.package { };
in
[ (wrapper cfg.package { }) ];
[ package ];
home.file = mkMerge (
[{
"${mozillaConfigPath}/${extensionPath}" = mkIf (cfg.extensions != []) {
source = "${extensionsEnvPkg}/share/mozilla/${extensionPath}";
recursive = true;
};
"${firefoxConfigPath}/profiles.ini" = mkIf (cfg.profiles != {}) {
text = profilesIni;
};
}]
++ flip mapAttrsToList cfg.profiles (_: profile: {
"${profilesPath}/${profile.path}/chrome/userChrome.css" =
mkIf (profile.userChrome != "") {
text = profile.userChrome;
};
"${profilesPath}/${profile.path}/user.js" =
mkIf (profile.settings != {} || profile.extraConfig != "") {
text = mkUserJs profile.settings profile.extraConfig;
};
"${profilesPath}/${profile.path}/extensions" = mkIf (cfg.extensions != []) {
source = "${extensionsEnvPkg}/share/mozilla/${extensionPath}";
recursive = true;
force = true;
};
})
);
};
}

View File

@@ -7,7 +7,7 @@ let
cfg = config.programs.fish;
abbrsStr = concatStringsSep "\n" (
mapAttrsToList (k: v: "abbr --add ${k} '${v}'") cfg.shellAbbrs
mapAttrsToList (k: v: "abbr --add --global ${k} '${v}'") cfg.shellAbbrs
);
aliasesStr = concatStringsSep "\n" (
@@ -21,6 +21,15 @@ in
programs.fish = {
enable = mkEnableOption "fish friendly interactive shell";
package = mkOption {
default = pkgs.fish;
defaultText = literalExample "pkgs.fish";
description = ''
The fish package to install. May be used to change the version.
'';
type = types.package;
};
shellAliases = mkOption {
default = {};
description = ''
@@ -74,7 +83,70 @@ in
};
config = mkIf cfg.enable {
home.packages = [ pkgs.fish ];
home.packages = [ cfg.package ];
xdg.dataFile."fish/home-manager_generated_completions".source =
let
# paths later in the list will overwrite those already linked
destructiveSymlinkJoin =
args_@{ name
, paths
, preferLocalBuild ? true
, allowSubstitutes ? false
, postBuild ? ""
, ...
}:
let
args = removeAttrs args_ [ "name" "postBuild" ]
// { inherit preferLocalBuild allowSubstitutes; }; # pass the defaults
in pkgs.runCommand name args
''
mkdir -p $out
for i in $paths; do
if [ -z "$(find $i -prune -empty)" ]; then
cp -srf $i/* $out
fi
done
${postBuild}
'';
generateCompletions = package: pkgs.runCommand
"${package.name}-fish-completions"
{
src = package;
nativeBuildInputs = [ pkgs.python2 ];
buildInputs = [ cfg.package ];
preferLocalBuild = true;
allowSubstitutes = false;
}
''
mkdir -p $out
if [ -d $src/share/man ]; then
find $src/share/man -type f \
| xargs python ${cfg.package}/share/fish/tools/create_manpage_completions.py --directory $out \
> /dev/null
fi
'';
in
destructiveSymlinkJoin {
name = "${config.home.username}-fish-completions";
paths =
let
cmp = (a: b: (a.meta.priority or 0) > (b.meta.priority or 0));
in
map generateCompletions (sort cmp config.home.packages);
};
programs.fish.interactiveShellInit = ''
# add completions generated by Home Manager to $fish_complete_path
begin
set -l joined (string join " " $fish_complete_path)
set -l prev_joined (string replace --regex "[^\s]*generated_completions.*" "" $joined)
set -l post_joined (string replace $prev_joined "" $joined)
set -l prev (string split " " (string trim $prev_joined))
set -l post (string split " " (string trim $post_joined))
set fish_complete_path $prev "${config.xdg.dataHome}/fish/home-manager_generated_completions" $post
end
'';
xdg.configFile."fish/config.fish".text = ''
# ~/.config/fish/config.fish: DO NOT EDIT -- this file has been generated automatically.

View File

@@ -122,13 +122,17 @@ in
);
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
. ${pkgs.fzf}/share/fzf/completion.bash
. ${pkgs.fzf}/share/fzf/key-bindings.bash
if [[ :$SHELLOPTS: =~ :(vi|emacs): ]]; then
. ${pkgs.fzf}/share/fzf/completion.bash
. ${pkgs.fzf}/share/fzf/key-bindings.bash
fi
'';
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
. ${pkgs.fzf}/share/fzf/completion.zsh
. ${pkgs.fzf}/share/fzf/key-bindings.zsh
if [[ $options[zle] = on ]]; then
. ${pkgs.fzf}/share/fzf/completion.zsh
. ${pkgs.fzf}/share/fzf/key-bindings.zsh
fi
'';
};
}

View File

@@ -0,0 +1,49 @@
{ config, lib, ... }:
with lib;
{
options.getmail = {
enable = mkEnableOption "the getmail mail retriever for this account";
destinationCommand = mkOption {
type = types.nullOr types.str;
default = null;
example = "\${pkgs.maildrop}/bin/maildrop";
description = ''
Specify a command delivering the incoming mail to your maildir.
'';
};
mailboxes = mkOption {
type = types.nonEmptyListOf types.str;
default = [];
example = ["INBOX" "INBOX.spam"];
description = ''
A non-empty list of mailboxes. To download all mail you can
use the <literal>ALL</literal> mailbox.
'';
};
delete = mkOption {
type = types.bool;
default = false;
description = ''
Enable if you want to delete read messages from the server. Most
users should either enable <literal>delete</literal> or disable
<literal>readAll</literal>.
'';
};
readAll = mkOption {
type = types.bool;
default = true;
description = ''
Enable if you want to fetch all, even the read messages from the
server. Most users should either enable <literal>delete</literal> or
disable <literal>readAll</literal>.
'';
};
};
}

View File

@@ -0,0 +1,60 @@
{ config, lib, pkgs, ... }:
with lib;
let
accounts = filter (a: a.getmail.enable)
(attrValues config.accounts.email.accounts);
renderAccountConfig = account: with account;
let
passCmd = concatMapStringsSep ", " (x: "'${x}'") passwordCommand;
renderedMailboxes = concatMapStringsSep ", " (x: "'${x}'") getmail.mailboxes;
retrieverType = if imap.tls.enable
then "SimpleIMAPSSLRetriever"
else "SimpleIMAPRetriever";
destination = if getmail.destinationCommand != null
then
{
destinationType = "MDA_external";
destinationPath = getmail.destinationCommand;
}
else
{
destinationType = "Maildir";
destinationPath = "${maildir.absPath}/";
};
renderGetmailBoolean = v: if v then "true" else "false";
in ''
# Generated by Home-Manager.
[retriever]
type = ${retrieverType}
server = ${imap.host}
${optionalString (imap.port != null) "port = ${toString imap.port}"}
username = ${userName}
password_command = (${passCmd})
mailboxes = ( ${renderedMailboxes} )
[destination]
type = ${destination.destinationType}
path = ${destination.destinationPath}
[options]
delete = ${renderGetmailBoolean getmail.delete}
read_all = ${renderGetmailBoolean getmail.readAll}
'';
getmailEnabled = length (filter (a: a.getmail.enable) accounts) > 0;
# Watch out! This is used by the getmail.service too!
renderConfigFilepath = a: ".getmail/getmail${if a.primary then "rc" else a.name}";
in
{
config = mkIf getmailEnabled {
home.file = map (a:
{ target = renderConfigFilepath a;
text = renderAccountConfig a;
}) accounts;
};
}

View File

@@ -6,6 +6,54 @@ let
cfg = config.programs.git;
# create [section "subsection"] keys from "section.subsection" attrset names
mkSectionName = name:
let
containsQuote = strings.hasInfix ''"'' name;
sections = splitString "." name;
section = head sections;
subsections = tail sections;
subsection = concatStringsSep "." subsections;
in
if containsQuote || subsections == []
then name
else "${section} \"${subsection}\"";
# generation for multiple ini values
mkKeyValue = k: v:
let
mkKeyValue = generators.mkKeyValueDefault {} "=" k;
in
concatStringsSep "\n" (map mkKeyValue (toList v));
# converts { a.b.c = 5; } to { "a.b".c = 5; } for toINI
gitFlattenAttrs =
let
recurse = path: value:
if isAttrs value then
mapAttrsToList (name: value: recurse ([name] ++ path) value) value
else if length path > 1 then
{ ${concatStringsSep "." (reverseList (tail path))}.${head path} = value; }
else
{ ${head path} = value; };
in
attrs: foldl recursiveUpdate {} (flatten (recurse [] attrs));
gitToIni = attrs:
let
toIni = generators.toINI { inherit mkKeyValue mkSectionName; };
in
toIni (gitFlattenAttrs attrs);
gitIniType = with types;
let
primitiveType = either str (either bool int);
multipleType = either primitiveType (listOf primitiveType);
sectionType = attrsOf multipleType;
supersectionType = attrsOf (either multipleType sectionType);
in
attrsOf supersectionType;
signModule = types.submodule {
options = {
key = mkOption {
@@ -28,7 +76,7 @@ let
};
};
includeModule = types.submodule {
includeModule = types.submodule ({ config, ... }: {
options = {
condition = mkOption {
type = types.nullOr types.str;
@@ -44,11 +92,23 @@ let
};
path = mkOption {
type = types.str;
type = with types; either str path;
description = "Path of the configuration file to include.";
};
contents = mkOption {
type = types.attrs;
default = {};
description = ''
Configuration to include. If empty then a path must be given.
'';
};
};
};
config.path = mkIf (config.contents != {}) (
mkDefault (pkgs.writeText "contents" (gitToIni config.contents))
);
});
in
@@ -62,23 +122,29 @@ in
package = mkOption {
type = types.package;
default = pkgs.git;
defaultText = "pkgs.git";
description = "Git package to install.";
defaultText = literalExample "pkgs.git";
description = ''
Git package to install. Use <varname>pkgs.gitAndTools.gitFull</varname>
to gain access to <command>git send-email</command> for instance.
'';
};
userName = mkOption {
type = types.str;
type = types.nullOr types.str;
default = null;
description = "Default user name to use.";
};
userEmail = mkOption {
type = types.str;
type = types.nullOr types.str;
default = null;
description = "Default user email to use.";
};
aliases = mkOption {
type = types.attrs;
type = types.attrsOf types.str;
default = {};
example = { co = "checkout"; };
description = "Git aliases to define.";
};
@@ -89,13 +155,20 @@ in
};
extraConfig = mkOption {
type = types.either types.attrs types.lines;
type = types.either types.lines gitIniType;
default = {};
description = "Additional configuration to add.";
example = {
core = { whitespace = "trailing-space,space-before-tab"; };
url."ssh://git@host".insteadOf = "otherhost";
};
description = ''
Additional configuration to add. The use of string values is
deprecated and will be removed in the future.
'';
};
iniContent = mkOption {
type = types.attrsOf types.attrs;
type = gitIniType;
internal = true;
};
@@ -106,6 +179,13 @@ in
description = "List of paths that should be globally ignored.";
};
attributes = mkOption {
type = types.listOf types.str;
default = [];
example = [ "*.pdf diff=pdf" ];
description = "List of defining attributes set globally.";
};
includes = mkOption {
type = types.listOf includeModule;
default = [];
@@ -120,6 +200,20 @@ in
'';
description = "List of configuration files to include.";
};
lfs = {
enable = mkEnableOption "Git Large File Storage";
skipSmudge = mkOption {
type = types.bool;
default = false;
description = ''
Skip automatic downloading of objects on clone or pull.
This requires a manual <command>git lfs pull</command>
every time a new commit is checked out on your repository.
'';
};
};
};
};
@@ -129,19 +223,43 @@ in
home.packages = [ cfg.package ];
programs.git.iniContent.user = {
name = cfg.userName;
email = cfg.userEmail;
name = mkIf (cfg.userName != null) cfg.userName;
email = mkIf (cfg.userEmail != null) cfg.userEmail;
};
xdg.configFile = {
"git/config".text = generators.toINI {} cfg.iniContent;
"git/config".text = gitToIni cfg.iniContent;
"git/ignore" = mkIf (cfg.ignores != []) {
text = concatStringsSep "\n" cfg.ignores + "\n";
};
"git/attributes" = mkIf (cfg.attributes != []) {
text = concatStringsSep "\n" cfg.attributes + "\n";
};
};
}
{
programs.git.iniContent =
let
hasSmtp = name: account: account.smtp != null;
genIdentity = name: account: with account;
nameValuePair "sendemail.${name}" ({
smtpEncryption = if smtp.tls.enable then "tls" else "";
smtpServer = smtp.host;
smtpUser = userName;
from = address;
}
// optionalAttrs (smtp.port != null) {
smtpServerPort = smtp.port;
});
in
mapAttrs' genIdentity
(filterAttrs hasSmtp config.accounts.email.accounts);
}
(mkIf (cfg.signing != null) {
programs.git.iniContent = {
user.signingKey = cfg.signing.key;
@@ -159,17 +277,48 @@ in
})
(mkIf (lib.isString cfg.extraConfig) {
warnings = [
''
Using programs.git.extraConfig as a string option is
deprecated and will be removed in the future. Please
change to using it as an attribute set instead.
''
];
xdg.configFile."git/config".text = cfg.extraConfig;
})
(mkIf (cfg.includes != []) {
xdg.configFile."git/config".text = mkAfter
(concatMapStringsSep "\n"
(i: with i; ''
[${if (condition == null) then "include" else "includeIf \"${condition}\""}]
path = ${path}
'')
cfg.includes);
xdg.configFile."git/config".text =
let
include = i: with i;
if condition != null
then { includeIf.${condition}.path = "${path}"; }
else { include.path = "${path}"; };
in
mkAfter
(concatStringsSep "\n"
(map gitToIni
(map include cfg.includes)));
})
(mkIf cfg.lfs.enable {
home.packages = [ pkgs.git-lfs ];
programs.git.iniContent.filter.lfs =
let
skipArg = optional cfg.lfs.skipSmudge "--skip";
in
{
clean = "git-lfs clean -- %f";
process = concatStringsSep " " (
[ "git-lfs" "filter-process" ] ++ skipArg
);
required = true;
smudge = concatStringsSep " " (
[ "git-lfs" "smudge" ] ++ skipArg ++ [ "--" "%f" ]
);
};
})
]
);

View File

@@ -6,7 +6,26 @@ let
cfg = config.programs.gnome-terminal;
dag = config.lib.dag;
vteInitStr = ''
# gnome-terminal: Show current directory in the terminal window title.
. ${pkgs.gnome3.vte}/etc/profile.d/vte.sh
'';
backForeSubModule = types.submodule (
{ ... }: {
options = {
foreground = mkOption {
type = types.str;
description = "The foreground color.";
};
background = mkOption {
type = types.str;
description = "The background color.";
};
};
}
);
profileColorsSubModule = types.submodule (
{ ... }: {
@@ -31,6 +50,18 @@ let
type = types.listOf types.str;
description = "The terminal palette.";
};
cursor = mkOption {
default = null;
type = types.nullOr backForeSubModule;
description = "The color for the terminal cursor.";
};
highlight = mkOption {
default = null;
type = types.nullOr backForeSubModule;
description = "The colors for the terminals highlighted area.";
};
};
}
);
@@ -67,6 +98,15 @@ let
description = "The font name, null to use system default.";
};
allowBold = mkOption {
default = null;
type = types.nullOr types.bool;
description = ''
If <literal>true</literal>, allow applications in the
terminal to make text boldface.
'';
};
scrollOnOutput = mkOption {
default = true;
type = types.bool;
@@ -91,19 +131,6 @@ let
}
);
toDconfIni = generators.toINI { mkKeyValue = mkIniKeyValue; };
mkIniKeyValue = key: value:
let
tweakVal = v:
if isString v then "'${v}'"
else if isList v then "[" + concatStringsSep "," (map tweakVal v) + "]"
else if isBool v && v then "true"
else if isBool v && !v then "false"
else toString v;
in
"${key}=${tweakVal value}";
buildProfileSet = pcfg:
{
visible-name = pcfg.visibleName;
@@ -125,6 +152,9 @@ let
background-color = pcfg.colors.backgroundColor;
palette = pcfg.colors.palette;
}
// optionalAttrs (pcfg.allowBold != null) {
allow-bold = pcfg.allowBold;
}
// (
if (pcfg.colors.boldColor == null)
then { bold-color-same-as-fg = true; }
@@ -133,28 +163,27 @@ let
bold-color = pcfg.colors.boldColor;
}
)
// (
if (pcfg.colors.cursor != null)
then {
cursor-colors-set = true;
cursor-foreground-color = pcfg.colors.cursor.foreground;
cursor-background-color = pcfg.colors.cursor.background;
}
else { cursor-colors-set = false; }
)
// (
if (pcfg.colors.highlight != null)
then {
highlight-colors-set = true;
highlight-foreground-color = pcfg.colors.highlight.foreground;
highlight-background-color = pcfg.colors.highlight.background;
}
else { highlight-colors-set = false; }
)
)
);
buildIniSet = cfg:
{
"/" = {
default-show-menubar = cfg.showMenubar;
schema-version = 3;
};
}
//
{
"profiles:" = {
default = head (attrNames (filterAttrs (n: v: v.default) cfg.profile));
list = attrNames cfg.profile;
};
}
//
mapAttrs' (name: value:
nameValuePair ("profiles:/:${name}") (buildProfileSet value)
) cfg.profile;
in
{
@@ -170,6 +199,12 @@ in
description = "Whether to show the menubar by default";
};
themeVariant = mkOption {
default = "default";
type = types.enum [ "default" "light" "dark" ];
description = "The theme variation to request";
};
profile = mkOption {
default = {};
type = types.attrsOf profileSubModule;
@@ -181,20 +216,27 @@ in
config = mkIf cfg.enable {
home.packages = [ pkgs.gnome3.gnome_terminal ];
# The dconf service needs to be installed and prepared.
home.activation.gnomeTerminal = dag.entryAfter ["installPackages"] (
dconf.settings =
let
iniText = toDconfIni (buildIniSet cfg);
iniFile = pkgs.writeText "gnome-terminal.ini" iniText;
dconfPath = "/org/gnome/terminal/legacy/";
dconfPath = "org/gnome/terminal/legacy";
in
''
if [[ -v DRY_RUN ]]; then
echo ${pkgs.gnome3.dconf}/bin/dconf load ${dconfPath} "<" ${iniFile}
else
${pkgs.gnome3.dconf}/bin/dconf load ${dconfPath} < ${iniFile}
fi
''
);
{
"${dconfPath}" = {
default-show-menubar = cfg.showMenubar;
theme-variant = cfg.themeVariant;
schema-version = 3;
};
"${dconfPath}/profiles:" = {
default = head (attrNames (filterAttrs (n: v: v.default) cfg.profile));
list = attrNames cfg.profile;
};
}
// mapAttrs' (n: v:
nameValuePair ("${dconfPath}/profiles:/:${n}") (buildProfileSet v)
) cfg.profile;
programs.bash.initExtra = mkBefore vteInitStr;
programs.zsh.initExtra = vteInitStr;
};
}

75
modules/programs/go.nix Normal file
View File

@@ -0,0 +1,75 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.go;
in
{
meta.maintainers = [ maintainers.rvolosatovs ];
options = {
programs.go = {
enable = mkEnableOption "Go";
package = mkOption {
type = types.package;
default = pkgs.go;
defaultText = literalExample "pkgs.go";
description = "The Go package to use.";
};
packages = mkOption {
type = with types; attrsOf path;
default = {};
example = literalExample ''
{
"golang.org/x/text" = builtins.fetchGit "https://go.googlesource.com/text";
"golang.org/x/time" = builtins.fetchGit "https://go.googlesource.com/time";
}
'';
description = "Packages to add to GOPATH.";
};
goPath = mkOption {
type = with types; nullOr str;
default = null;
example = "go";
description = "GOPATH relative to HOME";
};
goBin = mkOption {
type = with types; nullOr str;
default = null;
example = ".local/bin.go";
description = "GOBIN relative to HOME";
};
};
};
config = mkIf cfg.enable (mkMerge [
{
home.packages = [ cfg.package ];
home.file =
let
goPath = if cfg.goPath != null then cfg.goPath else "go";
mkSrc = n: v: {
target = "${goPath}/src/${n}";
source = v;
};
in
mapAttrsToList mkSrc cfg.packages;
}
(mkIf (cfg.goPath != null) {
home.sessionVariables.GOPATH = builtins.toPath "${config.home.homeDirectory}/${cfg.goPath}";
})
(mkIf (cfg.goBin != null) {
home.sessionVariables.GOBIN = builtins.toPath "${config.home.homeDirectory}/${cfg.goBin}";
})
]);
}

61
modules/programs/gpg.nix Normal file
View File

@@ -0,0 +1,61 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.gpg;
cfgText =
concatStringsSep "\n"
(attrValues
(mapAttrs (key: value:
if isString value
then "${key} ${value}"
else optionalString value key)
cfg.settings));
in {
options.programs.gpg = {
enable = mkEnableOption "GnuPG";
settings = mkOption {
type = types.attrsOf (types.either types.str types.bool);
example = {
no-comments = false;
s2k-cipher-algo = "AES128";
};
description = ''
GnuPG configuration options. Available options are described
in the gpg manpage:
<link xlink:href="https://gnupg.org/documentation/manpage.html"/>.
'';
};
};
config = mkIf cfg.enable {
programs.gpg.settings = {
personal-cipher-preferences = mkDefault "AES256 AES192 AES";
personal-digest-preferences = mkDefault "SHA512 SHA384 SHA256";
personal-compress-preferences = mkDefault "ZLIB BZIP2 ZIP Uncompressed";
default-preference-list = mkDefault "SHA512 SHA384 SHA256 AES256 AES192 AES ZLIB BZIP2 ZIP Uncompressed";
cert-digest-algo = mkDefault "SHA512";
s2k-digest-algo = mkDefault "SHA512";
s2k-cipher-algo = mkDefault "AES256";
charset = mkDefault "utf-8";
fixed-list-mode = mkDefault true;
no-comments = mkDefault true;
no-emit-version = mkDefault true;
keyid-format = mkDefault "0xlong";
list-options = mkDefault "show-uid-validity";
verify-options = mkDefault "show-uid-validity";
with-fingerprint = mkDefault true;
require-cross-certification = mkDefault true;
no-symkey-cache = mkDefault true;
use-agent = mkDefault true;
};
home.packages = [ pkgs.gnupg ];
home.file.".gnupg/gpg.conf".text = cfgText;
};
}

View File

@@ -32,24 +32,11 @@ in
};
};
config = mkIf (cfg.enable && !config.nixosSubmodule) {
config = mkIf (cfg.enable && !config.submoduleSupport.enable) {
home.packages = [
(import ../../home-manager {
inherit pkgs;
(pkgs.callPackage ../../home-manager {
inherit (cfg) path;
})
];
# Uninstall manually installed home-manager, if such exists.
# Without this a file collision error will be printed.
home.activation.uninstallHomeManager =
dag.entryBetween [ "installPackages" ] [ "writeBoundary" ] ''
if nix-env -q | grep -q "^home-manager$" ; then
$DRY_RUN_CMD nix-env -e home-manager
echo "You can now remove the 'home-manager' packageOverride"
echo "or overlay in '~/.config/nixpkgs/', if you want."
fi
'';
};
}

211
modules/programs/irssi.nix Normal file
View File

@@ -0,0 +1,211 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.irssi;
boolStr = b: if b then "yes" else "no";
quoteStr = s: escape ["\""] s;
assignFormat = set:
concatStringsSep "\n"
(mapAttrsToList (k: v: " ${k} = \"${quoteStr v}\";") set);
chatnetString =
concatStringsSep "\n"
(flip mapAttrsToList cfg.networks
(k: v: ''
${k} = {
type = "${v.type}";
nick = "${quoteStr v.nick}";
autosendcmd = "${concatMapStringsSep ";" quoteStr v.autoCommands}";
};
''));
serversString =
concatStringsSep ",\n"
(flip mapAttrsToList cfg.networks
(k: v: ''
{
chatnet = "${k}";
address = "${v.server.address}";
port = "${toString v.server.port}";
use_ssl = "${boolStr v.server.ssl.enable}";
ssl_verify = "${boolStr v.server.ssl.verify}";
autoconnect = "${boolStr v.server.autoConnect}";
}
''));
channelString =
concatStringsSep ",\n"
(flip mapAttrsToList cfg.networks
(k: v:
concatStringsSep ",\n"
(flip mapAttrsToList v.channels
(c: cv: ''
{
chatnet = "${k}";
name = "${c}";
autojoin = "${boolStr cv.autoJoin}";
}
''))));
channelType = types.submodule {
options = {
name = mkOption {
type = types.nullOr types.str;
visible = false;
default = null;
description = "Name of the channel.";
};
autoJoin = mkOption {
type = types.bool;
default = false;
description = "Whether to join this channel on connect.";
};
};
};
networkType = types.submodule ({ name, ...}: {
options = {
name = mkOption {
visible = false;
default = name;
type = types.str;
};
nick = mkOption {
type = types.str;
description = "Nickname in that network.";
};
type = mkOption {
type = types.str;
description = "Type of the network.";
default = "IRC";
};
autoCommands = mkOption {
type = types.listOf types.str;
default = [];
description = "List of commands to execute on connect.";
};
server = {
address = mkOption {
type = types.str;
description = "Address of the chat server.";
};
port = mkOption {
type = types.port;
default = 6667;
description = "Port of the chat server.";
};
ssl = {
enable = mkOption {
type = types.bool;
default = true;
description = "Whether SSL should be used.";
};
verify = mkOption {
type = types.bool;
default = true;
description = "Whether the SSL certificate should be verified.";
};
};
autoConnect = mkOption {
type = types.bool;
default = false;
description = "Whether Irssi connects to the server on launch.";
};
};
channels = mkOption {
description = "Channels for the given network.";
type = types.attrsOf channelType;
default = {};
};
};
});
in
{
options = {
programs.irssi = {
enable = mkEnableOption "the Irssi chat client";
extraConfig = mkOption {
default = "";
description = "These lines are appended to the Irssi configuration.";
type = types.str;
};
aliases = mkOption {
default = {};
example = { J = "join"; BYE = "quit";};
description = "An attribute set that maps aliases to commands.";
type = types.attrsOf types.str;
};
networks = mkOption {
default = {};
example = literalExample ''
{
freenode = {
nick = "hmuser";
server = {
address = "chat.freenode.net";
port = 6697;
autoConnect = true;
};
channels = {
nixos.autoJoin = true;
};
};
}
'';
description = "An attribute set of chat networks.";
type = types.attrsOf networkType;
};
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.irssi ];
home.file.".irssi/config".text = ''
settings = {
core = {
settings_autosave = "no";
};
};
aliases = {
${assignFormat cfg.aliases}
};
chatnets = {
${chatnetString}
};
servers = (
${serversString}
);
channels = (
${channelString}
);
${cfg.extraConfig}
'';
};
}

76
modules/programs/jq.nix Normal file
View File

@@ -0,0 +1,76 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.jq;
colorType = mkOption {
type = types.str;
description = "ANSI color definition";
example = "1;31";
visible = false;
};
colorsType = types.submodule {
options = {
null = colorType;
false = colorType;
true = colorType;
numbers = colorType;
strings = colorType;
arrays = colorType;
objects = colorType;
};
};
in
{
options = {
programs.jq = {
enable = mkEnableOption "the jq command-line JSON processor";
colors = mkOption {
description = ''
The colors used in colored JSON output.</para>
<para>See <link xlink:href="https://stedolan.github.io/jq/manual/#Colors"/>.
'';
example = literalExample ''
{
null = "1;30";
false = "0;31";
true = "0;32";
numbers = "0;36";
strings = "0;33";
arrays = "1;35";
objects = "1;37";
}
'';
default = {
null = "1;30";
false = "0;39";
true = "0;39";
numbers = "0;39";
strings = "0;32";
arrays = "1;39";
objects = "1;39";
};
type = colorsType;
};
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.jq ];
home.sessionVariables = let c = cfg.colors; in {
JQ_COLORS = "${c.null}:${c.false}:${c.true}:${c.numbers}:${c.strings}:${c.arrays}:${c.objects}";
};
};
}

View File

@@ -0,0 +1,575 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.kakoune;
hook = types.submodule {
options = {
name = mkOption {
type = types.enum [
"NormalBegin" "NormalIdle" "NormalEnd" "NormalKey"
"InsertBegin" "InsertIdle" "InsertEnd" "InsertKey"
"InsertChar" "InsertDelete" "InsertMove" "WinCreate"
"WinClose" "WinResize" "WinDisplay" "WinSetOption"
"BufSetOption" "BufNewFile" "BufOpenFile" "BufCreate"
"BufWritePre" "BufWritePost" "BufReload" "BufClose"
"BufOpenFifo" "BufReadFifo" "BufCloseFifo" "RuntimeError"
"ModeChange" "PromptIdle" "GlobalSetOption" "KakBegin"
"KakEnd" "FocusIn" "FocusOut" "RawKey"
"InsertCompletionShow" "InsertCompletionHide"
"InsertCompletionSelect"
];
example = "SetOption";
description = ''
The name of the hook. For a description, see
<link xlink:href="https://github.com/mawww/kakoune/blob/master/doc/pages/hooks.asciidoc#default-hooks"/>.
'';
};
once = mkOption {
type = types.bool;
default = false;
description = ''
Remove the hook after running it once.
'';
};
group = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
Add the hook to the named group.
'';
};
option = mkOption {
type = types.nullOr types.str;
default = null;
example = "filetype=latex";
description = ''
Additional option to pass to the hook.
'';
};
commands = mkOption {
type = types.lines;
default = "";
example = "set-option window indentwidth 2";
description = ''
Commands to run when the hook is activated.
'';
};
};
};
keyMapping = types.submodule {
options = {
mode = mkOption {
type = types.enum [
"insert"
"normal"
"prompt"
"menu"
"user"
"goto"
"view"
"object"
];
example = "user";
description = ''
The mode in which the mapping takes effect.
'';
};
docstring = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
Optional documentation text to display in info boxes.
'';
};
key = mkOption {
type = types.str;
example = "<a-x>";
description = ''
The key to be mapped. See
<link xlink:href="https://github.com/mawww/kakoune/blob/master/doc/pages/mapping.asciidoc#mappable-keys"/>
for possible values.
'';
};
effect = mkOption {
type = types.str;
example = ":wq<ret>";
description = ''
The sequence of keys to be mapped.
'';
};
};
};
configModule = types.submodule {
options = {
colorScheme = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
Set the color scheme. To see available schemes, enter
<command>colorscheme</command> at the kakoune prompt.
'';
};
tabStop = mkOption {
type = types.nullOr types.ints.unsigned;
default = null;
description = ''
The width of a tab in spaces. The kakoune default is
<literal>6</literal>.
'';
};
indentWidth = mkOption {
type = types.nullOr types.ints.unsigned;
default = null;
description = ''
The width of an indentation in spaces.
The kakoune default is <literal>4</literal>.
If <literal>0</literal>, a tab will be used instead.
'';
};
incrementalSearch = mkOption {
type = types.bool;
default = true;
description = ''
Execute a search as it is being typed.
'';
};
alignWithTabs = mkOption {
type = types.bool;
default = false;
description = ''
Use tabs for the align command.
'';
};
autoInfo = mkOption {
type = types.nullOr (types.listOf (types.enum [ "command" "onkey" "normal" ]));
default = null;
example = [ "command" "normal" ];
description = ''
Contexts in which to display automatic information box.
The kakoune default is <literal>[ "command" "onkey" ]</literal>.
'';
};
autoComplete = mkOption {
type = types.nullOr(types.listOf (types.enum [ "insert" "prompt" ]));
default = null;
description = ''
Modes in which to display possible completions.
The kakoune default is <literal>[ "insert" "prompt" ]</literal>.
'';
};
autoReload = mkOption {
type = types.nullOr (types.enum [ "yes" "no" "ask" ]);
default = null;
description = ''
Reload buffers when an external modification is detected.
The kakoune default is <literal>"ask"</literal>.
'';
};
scrollOff = mkOption {
type = types.nullOr (types.submodule {
options = {
lines = mkOption {
type = types.ints.unsigned;
default = 0;
description = ''
The number of lines to keep visible around the cursor.
'';
};
columns = mkOption {
type = types.ints.unsigned;
default = 0;
description = ''
The number of columns to keep visible around the cursor.
'';
};
};
});
default = null;
description = ''
How many lines and columns to keep visible around the cursor.
'';
};
ui = mkOption {
type = types.nullOr (types.submodule {
options = {
setTitle = mkOption {
type = types.bool;
default = false;
description = ''
Change the title of the terminal emulator.
'';
};
statusLine = mkOption {
type = types.enum [ "top" "bottom" ];
default = "bottom";
description = ''
Where to display the status line.
'';
};
assistant = mkOption {
type = types.enum [ "clippy" "cat" "dilbert" "none" ];
default = "clippy";
description = ''
The assistant displayed in info boxes.
'';
};
enableMouse = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable mouse support.
'';
};
changeColors = mkOption {
type = types.bool;
default = true;
description = ''
Change color palette.
'';
};
wheelDownButton = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
Button to send for wheel down events.
'';
};
wheelUpButton = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
Button to send for wheel up events.
'';
};
shiftFunctionKeys = mkOption {
type = types.nullOr types.ints.unsigned;
default = null;
description = ''
Amount by which shifted function keys are offset. That
is, if the terminal sends F13 for Shift-F1, this
should be <literal>12</literal>.
'';
};
useBuiltinKeyParser = mkOption {
type = types.bool;
default = false;
description = ''
Bypass ncurses key parser and use an internal one.
'';
};
};
});
default = null;
description = ''
Settings for the ncurses interface.
'';
};
showMatching = mkOption {
type = types.bool;
default = false;
description = ''
Highlight the matching char of the character under the
selections' cursor using the <literal>MatchingChar</literal>
face.
'';
};
wrapLines = mkOption {
type = types.nullOr (types.submodule {
options = {
enable = mkEnableOption "the wrap lines highlighter";
word = mkOption {
type = types.bool;
default = false;
description = ''
Wrap at word boundaries instead of codepoint boundaries.
'';
};
indent = mkOption {
type = types.bool;
default = false;
description = ''
Preserve line indentation when wrapping.
'';
};
maxWidth = mkOption {
type = types.nullOr types.ints.unsigned;
default = null;
description = ''
Wrap text at maxWidth, even if the window is wider.
'';
};
marker = mkOption {
type = types.nullOr types.str;
default = null;
example = "";
description = ''
Prefix wrapped lines with marker text.
If not <literal>null</literal>,
the marker text will be displayed in the indentation if possible.
'';
};
};
});
default = null;
description = ''
Settings for the wrap lines highlighter.
'';
};
numberLines = mkOption {
type = types.nullOr (types.submodule {
options = {
enable = mkEnableOption "the number lines highlighter";
relative = mkOption {
type = types.bool;
default = false;
description = ''
Show line numbers relative to the main cursor line.
'';
};
highlightCursor = mkOption {
type = types.bool;
default = false;
description = ''
Highlight the cursor line with a separate face.
'';
};
separator = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
String that separates the line number column from the
buffer contents. The kakoune default is
<literal>"|"</literal>.
'';
};
};
});
default = null;
description = ''
Settings for the number lines highlighter.
'';
};
showWhitespace = mkOption {
type = types.nullOr (types.submodule {
options = {
enable = mkEnableOption "the show whitespace highlighter";
lineFeed = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
The character to display for line feeds.
The kakoune default is <literal>"¬"</literal>.
'';
};
space = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
The character to display for spaces.
The kakoune default is <literal>"·"</literal>.
'';
};
nonBreakingSpace = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
The character to display for non-breaking spaces.
The kakoune default is <literal>""</literal>.
'';
};
tab = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
The character to display for tabs.
The kakoune default is <literal>""</literal>.
'';
};
tabStop = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
The character to append to tabs to reach the width of a tabstop.
The kakoune default is <literal>" "</literal>.
'';
};
};
});
default = null;
description = ''
Settings for the show whitespaces highlighter.
'';
};
keyMappings = mkOption {
type = types.listOf keyMapping;
default = [];
description = ''
User-defined key mappings. For documentation, see
<link xlink:href="https://github.com/mawww/kakoune/blob/master/doc/pages/mapping.asciidoc"/>.
'';
};
hooks = mkOption {
type = types.listOf hook;
default = [];
description = ''
Global hooks. For documentation, see
<link xlink:href="https://github.com/mawww/kakoune/blob/master/doc/pages/hooks.asciidoc"/>.
'';
};
};
};
configFile =
let
wrapOptions = with cfg.config.wrapLines; concatStrings [
"${optionalString word " -word"}"
"${optionalString indent " -indent"}"
"${optionalString (marker != null) " -marker ${marker}"}"
"${optionalString (maxWidth != null) " -width ${toString maxWidth}"}"
];
numberLinesOptions = with cfg.config.numberLines; concatStrings [
"${optionalString relative " -relative "}"
"${optionalString highlightCursor " -hlcursor"}"
"${optionalString (separator != null) " -separator ${separator}"}"
];
uiOptions = with cfg.config.ui; concatStringsSep " " [
"ncurses_set_title=${if setTitle then "true" else "false"}"
"ncurses_status_on_top=${if (statusLine == "top") then "true" else "false"}"
"ncurses_assistant=${assistant}"
"ncurses_enable_mouse=${if enableMouse then "true" else "false"}"
"ncurses_change_colors=${if changeColors then "true" else "false"}"
"${optionalString (wheelDownButton != null)
"ncurses_wheel_down_button=${wheelDownButton}"}"
"${optionalString (wheelUpButton != null)
"ncurses_wheel_up_button=${wheelUpButton}"}"
"${optionalString (shiftFunctionKeys != null)
"ncurses_shift_function_key=${toString shiftFunctionKeys}"}"
"ncurses_builtin_key_parser=${if useBuiltinKeyParser then "true" else "false"}"
];
keyMappingString = km: concatStringsSep " " [
"map global"
"${km.mode} ${km.key} '${km.effect}'"
"${optionalString (km.docstring != null) "-docstring '${km.docstring}'"}"
];
hookString = h: concatStringsSep " " [
"hook" "${optionalString (h.group != null) "-group ${group}"}"
"${optionalString (h.once) "-once"}" "global"
"${h.name}" "${optionalString (h.option != null) h.option}"
"%{ ${h.commands} }"
];
cfgStr = with cfg.config; concatStringsSep "\n" (
[ "# Generated by home-manager" ]
++ optional (colorScheme != null) "colorscheme ${colorScheme}"
++ optional (tabStop != null) "set-option global tabstop ${toString tabStop}"
++ optional (indentWidth != null) "set-option global indentwidth ${toString indentWidth}"
++ optional (!incrementalSearch) "set-option global incsearch false"
++ optional (alignWithTabs) "set-option global aligntab true"
++ optional (autoInfo != null) "set-option global autoinfo ${concatStringsSep "|" autoInfo}"
++ optional (autoComplete != null) "set-option global autocomplete ${concatStringsSep "|" autoComplete}"
++ optional (autoReload != null) "set-option global/ autoreload ${autoReload}"
++ optional (wrapLines != null && wrapLines.enable) "add-highlighter global/ wrap${wrapOptions}"
++ optional (numberLines != null && numberLines.enable)
"add-highlighter global/ number-lines${numberLinesOptions}"
++ optional showMatching "add-highlighter global/ show-matching"
++ optional (scrollOff != null)
"set-option global scrolloff ${toString scrollOff.lines},${toString scrollOff.columns}"
++ [ "# UI options" ]
++ optional (ui != null) "set-option global ui_options ${uiOptions}"
++ [ "# Key mappings" ]
++ map keyMappingString keyMappings
++ [ "# Hooks" ]
++ map hookString hooks
);
in
pkgs.writeText "kakrc" (
optionalString (cfg.config != null) cfgStr
+ "\n"
+ cfg.extraConfig
);
in
{
options = {
programs.kakoune = {
enable = mkEnableOption "the kakoune text editor";
config = mkOption {
type = types.nullOr configModule;
default = {};
description = "kakoune configuration options.";
};
extraConfig = mkOption {
type = types.lines;
default = "";
description = ''
Extra configuration lines to add to
<filename>~/.config/kak/kakrc</filename>.
'';
};
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.kakoune ];
xdg.configFile."kak/kakrc".source = configFile;
};
}

View File

@@ -0,0 +1,88 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.keychain;
flags = cfg.extraFlags
++ optional (cfg.agents != []) "--agents ${concatStringsSep "," cfg.agents}"
++ optional (cfg.inheritType != null) "--inherit ${cfg.inheritType}";
shellCommand = ''
eval "$(${cfg.package}/bin/keychain --eval ${concatStringsSep " " flags} ${concatStringsSep " " cfg.keys})"
'';
in
{
meta.maintainers = [ maintainers.marsam ];
options.programs.keychain = {
enable = mkEnableOption "keychain";
package = mkOption {
type = types.package;
default = pkgs.keychain;
defaultText = literalExample "pkgs.keychain";
description = ''
Keychain package to install.
'';
};
keys = mkOption {
type = types.listOf types.str;
default = [ "id_rsa" ];
description = ''
Keys to add to keychain.
'';
};
agents = mkOption {
type = types.listOf types.str;
default = [];
description = ''
Agents to add.
'';
};
inheritType = mkOption {
type = types.nullOr (types.enum ["local" "any" "local-once" "any-once"]);
default = null;
description = ''
Inherit type to attempt from agent variables from the environment.
'';
};
extraFlags = mkOption {
type = types.listOf types.str;
default = [ "--quiet" ];
description = ''
Extra flags to pass to keychain.
'';
};
enableBashIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Bash integration.
'';
};
enableZshIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Zsh integration.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
programs.bash.initExtra = mkIf cfg.enableBashIntegration shellCommand;
programs.zsh.initExtra = mkIf cfg.enableZshIntegration shellCommand;
};
}

41
modules/programs/lsd.nix Normal file
View File

@@ -0,0 +1,41 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.lsd;
aliases = {
ls = "${pkgs.lsd}/bin/lsd";
ll = "ls -l";
la = "ls -a";
lt = "ls --tree";
lla ="ls -la";
};
in
{
meta.maintainers = [ maintainers.marsam ];
options.programs.lsd = {
enable = mkEnableOption "lsd";
enableAliases = mkOption {
default = false;
type = types.bool;
description = ''
Whether to enable recommended lsd aliases.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.lsd ];
programs.bash.shellAliases = mkIf cfg.enableAliases aliases;
programs.zsh.shellAliases = mkIf cfg.enableAliases aliases;
};
}

View File

@@ -0,0 +1,64 @@
{ config, lib, ... }:
with lib;
let
cfg = config.programs.matplotlib;
formatLine = o: n: v:
let
formatValue = v:
if isBool v then (if v then "True" else "False")
else toString v;
in
if isAttrs v
then concatStringsSep "\n" (mapAttrsToList (formatLine "${o}${n}.") v)
else (if v == "" then "" else "${o}${n}: ${formatValue v}");
in
{
meta.maintainers = [ maintainers.rprospero ];
options.programs.matplotlib = {
enable = mkEnableOption "matplotlib, a plotting library for python";
config = mkOption {
default = { };
type = types.attrs;
description = ''
Add terms to the <filename>matplotlibrc</filename> file to
control the default matplotlib behavior.
'';
example = literalExample ''
{
backend = "Qt5Agg";
axes = {
grid = true;
facecolor = "black";
edgecolor = "FF9900";
};
grid.color = "FF9900";
}
'';
};
extraConfig = mkOption {
type = types.lines;
default = "";
description = ''
Additional commands for matplotlib that will be added to the
<filename>matplotlibrc</filename> file.
'';
};
};
config = mkIf cfg.enable {
xdg.configFile."matplotlib/matplotlibrc".text =
concatStringsSep "\n" ([]
++ mapAttrsToList (formatLine "") cfg.config
++ optional (cfg.extraConfig != "") cfg.extraConfig
) + "\n";
};
}

View File

@@ -2,6 +2,12 @@
with lib;
let
extraConfigType = with lib.types; attrsOf (either (either str int) bool);
in
{
options.mbsync = {
enable = mkEnableOption "synchronization using mbsync";
@@ -53,5 +59,49 @@ with lib;
Pattern of mailboxes to synchronize.
'';
};
extraConfig.channel = mkOption {
type = extraConfigType;
default = {};
example = literalExample ''
{
MaxMessages = 10000;
MaxSize = "1m";
};
'';
description = ''
Per channel extra configuration.
'';
};
extraConfig.local = mkOption {
type = extraConfigType;
default = {};
description = ''
Local store extra configuration.
'';
};
extraConfig.remote = mkOption {
type = extraConfigType;
default = {};
description = ''
Remote store extra configuration.
'';
};
extraConfig.account = mkOption {
type = extraConfigType;
default = {};
example = literalExample ''
{
PipelineDepth = 10;
Timeout = 60;
};
'';
description = ''
Account section extra configuration.
'';
};
};
}

View File

@@ -20,7 +20,7 @@ let
}
//
optionalAttrs (tls.enable && tls.certificatesFile != null) {
CertificateFile = tls.certificatesFile;
CertificateFile = toString tls.certificatesFile;
};
masterSlaveMapping = {
@@ -33,36 +33,42 @@ let
genSection = header: entries:
let
escapeValue = escape [ "\"" ];
genValue = v:
hasSpace = v: builtins.match ".* .*" v != null;
genValue = n: v:
if isList v
then concatMapStringsSep " " genValue v
else "\"${escapeValue v}\"";
then concatMapStringsSep " " (genValue n) v
else if isBool v then (if v then "yes" else "no")
else if isInt v then toString v
else if isString v && hasSpace v then "\"${escapeValue v}\""
else if isString v then v
else
let prettyV = lib.generators.toPretty {} v;
in throw "mbsync: unexpected value for option ${n}: '${prettyV}'";
in
''
${header}
${concatStringsSep "\n"
(mapAttrsToList (n: v: "${n} ${genValue v}") entries)}
(mapAttrsToList (n: v: "${n} ${genValue n v}") entries)}
'';
genAccountConfig = account: with account;
if (imap == null || maildir == null)
then ""
else
genSection "IMAPAccount ${name}" (
{
Host = imap.host;
User = userName;
PassCmd = toString passwordCommand;
}
//
genTlsConfig imap.tls
//
optionalAttrs (imap.port != null) { Port = toString imap.port; }
// genTlsConfig imap.tls
// optionalAttrs (imap.port != null) { Port = toString imap.port; }
// mbsync.extraConfig.account
)
+ "\n"
+ genSection "IMAPStore ${name}-remote" {
Account = name;
}
+ genSection "IMAPStore ${name}-remote" (
{
Account = name;
}
// mbsync.extraConfig.remote
)
+ "\n"
+ genSection "MaildirStore ${name}-local" (
{
@@ -70,19 +76,22 @@ let
Inbox = "${maildir.absPath}/${folders.inbox}";
SubFolders = "Verbatim";
}
//
optionalAttrs (mbsync.flatten != null) { Flatten = mbsync.flatten; }
// optionalAttrs (mbsync.flatten != null) { Flatten = mbsync.flatten; }
// mbsync.extraConfig.local
)
+ "\n"
+ genSection "Channel ${name}" {
Master = ":${name}-remote:";
Slave = ":${name}-local:";
Patterns = mbsync.patterns;
Create = masterSlaveMapping.${mbsync.create};
Remove = masterSlaveMapping.${mbsync.remove};
Expunge = masterSlaveMapping.${mbsync.expunge};
SyncState = "*";
}
+ genSection "Channel ${name}" (
{
Master = ":${name}-remote:";
Slave = ":${name}-local:";
Patterns = mbsync.patterns;
Create = masterSlaveMapping.${mbsync.create};
Remove = masterSlaveMapping.${mbsync.remove};
Expunge = masterSlaveMapping.${mbsync.expunge};
SyncState = "*";
}
// mbsync.extraConfig.channel
)
+ "\n";
genGroupConfig = name: channels:
@@ -103,7 +112,7 @@ in
package = mkOption {
type = types.package;
default = pkgs.isync;
defaultText = "pkgs.isync";
defaultText = literalExample "pkgs.isync";
example = literalExample "pkgs.isync";
description = "The package to use for the mbsync binary.";
};
@@ -135,29 +144,23 @@ in
};
config = mkIf cfg.enable {
assertions = [
(
let
badAccounts = filter (a: a.maildir == null) mbsyncAccounts;
in
{
assertions =
let
checkAccounts = pred: msg:
let
badAccounts = filter pred mbsyncAccounts;
in {
assertion = badAccounts == [];
message = "mbsync: Missing maildir configuration for accounts: "
message = "mbsync: ${msg} for accounts: "
+ concatMapStringsSep ", " (a: a.name) badAccounts;
}
)
(
let
badAccounts = filter (a: a.imap == null) mbsyncAccounts;
in
{
assertion = badAccounts == [];
message = "mbsync: Missing IMAP configuration for accounts: "
+ concatMapStringsSep ", " (a: a.name) badAccounts;
}
)
];
};
in
[
(checkAccounts (a: a.maildir == null) "Missing maildir configuration")
(checkAccounts (a: a.imap == null) "Missing IMAP configuration")
(checkAccounts (a: a.passwordCommand == null) "Missing passwordCommand")
(checkAccounts (a: a.userName == null) "Missing username")
];
home.packages = [ cfg.package ];
@@ -170,16 +173,18 @@ in
in
concatStringsSep "\n" (
[ "# Generated by Home Manager.\n" ]
++ optional (cfg.extraConfig != "") cfg.extraConfig
++ accountsConfig
++ groupsConfig
++ optional (cfg.extraConfig != "") cfg.extraConfig
);
) + "\n";
home.activation.createMaildir =
dag.entryBetween [ "linkGeneration" ] [ "writeBoundary" ] ''
$DRY_RUN_CMD mkdir -m700 -p $VERBOSE_ARG ${
concatMapStringsSep " " (a: a.maildir.absPath) mbsyncAccounts
}
'';
home.activation = mkIf (mbsyncAccounts != []) {
createMaildir =
dag.entryBetween [ "linkGeneration" ] [ "writeBoundary" ] ''
$DRY_RUN_CMD mkdir -m700 -p $VERBOSE_ARG ${
concatMapStringsSep " " (a: a.maildir.absPath) mbsyncAccounts
}
'';
};
};
}

View File

@@ -17,7 +17,7 @@ in
package = mkOption {
type = types.package;
default = pkgs.mercurial;
defaultText = "pkgs.mercurial";
defaultText = literalExample "pkgs.mercurial";
description = "Mercurial package to install.";
};

152
modules/programs/mpv.nix Normal file
View File

@@ -0,0 +1,152 @@
{ config, lib, pkgs, ... }:
with lib;
let
inherit (builtins) typeOf stringLength;
cfg = config.programs.mpv;
mpvOption = with types; either str (either int (either bool float));
mpvOptions = with types; attrsOf mpvOption;
mpvProfiles = with types; attrsOf mpvOptions;
mpvBindings = with types; attrsOf str;
renderOption = option:
rec {
int = toString option;
float = int;
bool = if option then "yes" else "no";
string = option;
}.${typeOf option};
renderOptions = options:
concatStringsSep "\n"
(mapAttrsToList
(name: value:
let
rendered = renderOption value;
length = toString (stringLength rendered);
in
"${name}=%${length}%${rendered}")
options);
renderProfiles = profiles:
concatStringsSep "\n"
(mapAttrsToList
(name: value: ''
[${name}]
${renderOptions value}
'')
profiles);
renderBindings = bindings:
concatStringsSep "\n"
(mapAttrsToList
(name: value:
"${name} ${value}")
bindings);
in {
options = {
programs.mpv = {
enable = mkEnableOption "mpv";
scripts = mkOption {
type = with types; listOf (either package str);
default = [];
example = literalExample "[ pkgs.mpvScripts.mpris ]";
description = ''
List of scripts to use with mpv.
'';
};
config = mkOption {
description = ''
Configuration written to
<filename>~/.config/mpv/mpv.conf</filename>. See
<citerefentry>
<refentrytitle>mpv</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>
for the full list of options.
'';
type = mpvOptions;
default = {};
example = literalExample ''
{
profile = "gpu-hq";
force-window = "yes";
ytdl-format = "bestvideo+bestaudio";
cache-default = 4000000;
}
'';
};
profiles = mkOption {
description = ''
Sub-configuration options for specific profiles written to
<filename>~/.config/mpv/mpv.conf</filename>. See
<option>programs.mpv.config</option> for more information.
'';
type = mpvProfiles;
default = {};
example = literalExample ''
{
fast = {
vo = "vdpau";
};
"protocol.dvd" = {
profile-desc = "profile for dvd:// streams";
alang = "en";
};
}
'';
};
bindings = mkOption {
description = ''
Input configuration written to
<filename>~/.config/mpv/input.conf</filename>. See
<citerefentry>
<refentrytitle>mpv</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>
for the full list of options.
'';
type = mpvBindings;
default = {};
example = literalExample ''
{
WHEEL_UP = "seek 10";
WHEEL_DOWN = "seek -10";
"Alt+0" = "set window-scale 0.5";
}
'';
};
};
};
config = mkIf cfg.enable (mkMerge [
{
home.packages = [(
if cfg.scripts == []
then pkgs.mpv
else pkgs.mpv-with-scripts.override { scripts = cfg.scripts; }
)];
}
(mkIf (cfg.config != {} || cfg.profiles != {}) {
xdg.configFile."mpv/mpv.conf".text = ''
${optionalString (cfg.config != {}) (renderOptions cfg.config)}
${optionalString (cfg.profiles != {}) (renderProfiles cfg.profiles)}
'';
})
(mkIf (cfg.bindings != {}) {
xdg.configFile."mpv/input.conf".text = renderBindings cfg.bindings;
})
]);
meta.maintainers = with maintainers; [ tadeokondrak ];
}

View File

@@ -11,14 +11,36 @@ with lib;
Whether to enable msmtp.
</para><para>
If enabled then it is possible to use the
<option>--account</option> command line option to send a
message for a given account using the <command>msmtp</command>
or <command>msmtpq</command> tool. For example,
<command>msmtp --account=private</command>
would send using the account defined in
<parameter class="command">--account</parameter> command line
option to send a message for a given account using the
<command>msmtp</command> or <command>msmtpq</command> tool.
For example, <command>msmtp --account=private</command> would
send using the account defined in
<option>accounts.email.accounts.private</option>. If the
<option>--account</option> option is not given then the
primary account will be used.
<parameter class="command">--account</parameter> option is not
given then the primary account will be used.
'';
};
tls.fingerprint = mkOption {
type = types.nullOr (types.strMatching "([[:alnum:]]{2}\:)+[[:alnum:]]{2}");
default = null;
example = "my:SH:a2:56:ha:sh";
description = ''
Fingerprint of a trusted TLS certificate.
The fingerprint can be obtained by executing
<command>msmtp --serverinfo --tls --tls-certcheck=off</command>.
'';
};
extraConfig = mkOption {
type = types.attrsOf types.str;
default = { };
example = { auth = "login"; };
description = ''
Extra configuration options to add to <filename>~/.msmtprc</filename>.
See <link xlink:href="https://marlam.de/msmtp/msmtprc.txt"/> for
examples.
'';
};
};

View File

@@ -6,8 +6,6 @@ let
cfg = config.programs.msmtp;
dag = config.lib.dag;
msmtpAccounts = filter (a: a.msmtp.enable)
(attrValues config.accounts.email.accounts);
@@ -26,6 +24,9 @@ let
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;
}
@@ -33,6 +34,7 @@ let
# msmtp requires the password to finish with a newline.
passwordeval = ''${pkgs.bash}/bin/bash -c "${toString passwordCommand}; echo"'';
}
// msmtp.extraConfig
)
++ optional primary "\naccount default : ${name}"
);
@@ -67,7 +69,7 @@ in
config = mkIf cfg.enable {
home.packages = [ pkgs.msmtp ];
home.file.".msmtprc".text = configFile msmtpAccounts;
xdg.configFile."msmtp/config".text = configFile msmtpAccounts;
home.sessionVariables = {
MSMTP_QUEUE = "${config.xdg.dataHome}/msmtp/queue";

View File

@@ -6,6 +6,32 @@ let
cfg = config.programs.neovim;
extraPythonPackageType = mkOptionType {
name = "extra-python-packages";
description = "python packages in python.withPackages format";
check = with types; (x: if isFunction x
then isList (x pkgs.pythonPackages)
else false);
merge = mergeOneOption;
};
extraPython3PackageType = mkOptionType {
name = "extra-python3-packages";
description = "python3 packages in python.withPackages format";
check = with types; (x: if isFunction x
then isList (x pkgs.python3Packages)
else false);
merge = mergeOneOption;
};
moduleConfigure =
optionalAttrs (cfg.extraConfig != "") {
customRC = cfg.extraConfig;
}
// optionalAttrs (cfg.plugins != []) {
packages.home-manager.start = cfg.plugins;
};
in
{
@@ -29,6 +55,15 @@ in
'';
};
withNodeJs = mkOption {
type = types.bool;
default = false;
description = ''
Enable node provider. Set to <literal>true</literal> to
use Node plugins.
'';
};
withPython = mkOption {
type = types.bool;
default = true;
@@ -39,12 +74,13 @@ in
};
extraPythonPackages = mkOption {
type = types.listOf types.package;
default = [ ];
example = literalExample "with pkgs.python2Packages; [ pandas jedi ]";
type = with types; either extraPythonPackageType (listOf package);
default = (_: []);
defaultText = "ps: []";
example = literalExample "(ps: with ps; [ pandas jedi ])";
description = ''
List here Python 2 packages required for your plugins to
work.
A function in python.withPackages format, which returns a
list of Python 2 packages required for your plugins to work.
'';
};
@@ -66,18 +102,33 @@ in
};
extraPython3Packages = mkOption {
type = types.listOf types.package;
default = [ ];
example = literalExample
"with pkgs.python3Packages; [ python-language-server ]";
type = with types; either extraPython3PackageType (listOf package);
default = (_: []);
defaultText = "ps: []";
example = literalExample "(ps: with ps; [ python-language-server ])";
description = ''
List here Python 3 packages required for your plugins to work.
A function in python.withPackages format, which returns a
list of Python 3 packages required for your plugins to work.
'';
};
package = mkOption {
type = types.package;
default = pkgs.neovim-unwrapped;
defaultText = literalExample "pkgs.neovim-unwrapped";
description = "The package to use for the neovim binary.";
};
finalPackage = mkOption {
type = types.package;
visible = false;
readOnly = true;
description = "Resulting customized neovim package.";
};
configure = mkOption {
type = types.nullOr types.attrs;
default = null;
type = types.attrs;
default = {};
example = literalExample ''
configure = {
customRC = $''''
@@ -92,21 +143,65 @@ in
};
'';
description = ''
Generate your init file from your list of plugins and custom commands,
Generate your init file from your list of plugins and custom commands,
and loads it from the store via <command>nvim -u /nix/store/hash-vimrc</command>
</para><para>
This option is mutually exclusive with <varname>extraConfig</varname>
and <varname>plugins</varname>.
'';
};
extraConfig = mkOption {
type = types.lines;
default = "";
example = ''
set nocompatible
set nobackup
'';
description = ''
Custom vimrc lines.
</para><para>
This option is mutually exclusive with <varname>configure</varname>.
'';
};
plugins = mkOption {
type = with types; listOf package;
default = [ ];
example = literalExample "[ pkgs.vimPlugins.yankring ]";
description = ''
List of vim plugins to install.
</para><para>
This option is mutually exclusive with <varname>configure</varname>.
'';
};
};
};
config = mkIf cfg.enable {
home.packages = [
(pkgs.neovim.override {
inherit (cfg)
extraPython3Packages withPython3
extraPythonPackages withPython
withRuby viAlias vimAlias configure;
})
assertions = [
{
assertion = cfg.configure == { } || moduleConfigure == { };
message = "The programs.neovim option configure is mutually exclusive"
+ " with extraConfig and plugins.";
}
];
home.packages = [ cfg.finalPackage ];
programs.neovim.finalPackage = pkgs.wrapNeovim cfg.package {
inherit (cfg)
extraPython3Packages withPython3
extraPythonPackages withPython
withNodeJs withRuby viAlias vimAlias;
configure = cfg.configure // moduleConfigure;
};
};
}

View File

@@ -45,13 +45,13 @@ in
};
browser = mkOption {
type = types.string;
type = types.str;
default = "${pkgs.xdg_utils}/bin/xdg-open";
description = "External browser to use.";
};
queries = mkOption {
type = types.attrsOf types.string;
type = types.attrsOf types.str;
default = {};
example = {
"foo" = "rssurl =~ \"example.com\"";

53
modules/programs/noti.nix Normal file
View File

@@ -0,0 +1,53 @@
{ config, lib, pkgs, ...}:
with lib;
let
cfg = config.programs.noti;
in
{
meta.maintainers = [ maintainers.marsam ];
options.programs.noti = {
enable = mkEnableOption "Noti";
settings = mkOption {
type = types.attrsOf (types.attrsOf types.str);
default = {};
description = ''
Configuration written to
<filename>~/.config/noti/noti.yaml</filename>.
</para><para>
See
<citerefentry>
<refentrytitle>noti.yaml</refentrytitle>
<manvolnum>5</manvolnum>
</citerefentry>.
for the full list of options.
'';
example = literalExample ''
{
say = {
voice = "Alex";
};
slack = {
token = "1234567890abcdefg";
channel = "@jaime";
};
}
'';
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.noti ];
xdg.configFile."noti/noti.yaml" = mkIf (cfg.settings != {}) {
text = generators.toYAML {} cfg.settings;
};
};
}

View File

@@ -4,8 +4,6 @@ with lib;
let
dag = config.lib.dag;
cfg = config.programs.notmuch;
mkIniKeyValue = key: value:
@@ -13,7 +11,7 @@ let
tweakVal = v:
if isString v then v
else if isList v then concatMapStringsSep ";" tweakVal v
else if isBool v then toJSON v
else if isBool v then (if v then "true" else "false")
else toString v;
in
"${key}=${tweakVal value}";
@@ -24,12 +22,16 @@ let
database = {
path = config.accounts.email.maildirBasePath;
};
maildir = {
synchronize_flags = cfg.maildir.synchronizeFlags;
};
new = {
ignore = cfg.new.ignore;
tags = cfg.new.tags;
};
user =
let
accounts =
@@ -40,11 +42,13 @@ let
in {
name = catAttrs "realName" primary;
primary_email = catAttrs "address" primary;
other_email = catAttrs "address" secondaries;
other_email = catAttrs "aliases" primary
++ catAttrs "address" secondaries
++ catAttrs "aliases" secondaries;
};
search = {
exclude_tags = [ "deleted" "spam" ];
exclude_tags = cfg.search.excludeTags;
};
}
cfg.extraConfig;
@@ -88,9 +92,7 @@ in
extraConfig = mkOption {
type = types.attrsOf (types.attrsOf types.str);
default = {
maildir = { synchronize_flags = "true"; };
};
default = {};
description = ''
Options that should be appended to the notmuch configuration file.
'';
@@ -128,6 +130,29 @@ in
'';
};
};
maildir = {
synchronizeFlags = mkOption {
type = types.bool;
default = true;
description = ''
Whether to synchronize Maildir flags.
'';
};
};
search = {
excludeTags = mkOption {
type = types.listOf types.str;
default = [ "deleted" "spam" ];
example = [ "trash" "spam" ];
description = ''
A list of tags that will be excluded from search results by
default. Using an excluded tag in a query will override that
exclusion.
'';
};
};
};
};
@@ -163,12 +188,12 @@ in
{
target = "${notmuchIni.database.path}/.notmuch/hooks/${name}";
source = pkgs.writeScript name ''
#!${pkgs.stdenv.shell}
#!${pkgs.runtimeShell}
export PATH="${pkgs.notmuch}/bin''${PATH:+:}$PATH"
export NOTMUCH_CONFIG="${config.xdg.configHome}/notmuch/notmuchrc"
export NMBGIT="${config.xdg.dataHome}/notmuch/nmbug"
${cmds}
'';
executable = true;

View File

@@ -0,0 +1,53 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.obs-studio;
package = pkgs.obs-studio;
mkPluginEnv = packages:
let
pluginDirs = map (pkg: "${pkg}/share/obs/obs-plugins") packages;
plugins = concatMapStringsSep " " (p: "${p}/*") pluginDirs;
in
pkgs.runCommand "obs-studio-plugins"
{
preferLocalBuild = true;
allowSubstitutes = false;
}
''
mkdir $out
[[ '${plugins}' ]] || exit 0
for plugin in ${plugins}; do
ln -s "$plugin" $out/
done
'';
in
{
meta.maintainers = [ maintainers.adisbladis ];
options = {
programs.obs-studio = {
enable = mkEnableOption "obs-studio";
plugins = mkOption {
default = [];
example = literalExample "[ pkgs.obs-linuxbrowser ]";
description = "Optional OBS plugins.";
type = types.listOf types.package;
};
};
};
config = mkIf cfg.enable {
home.packages = [ package ];
xdg.configFile."obs-studio/plugins" = mkIf (cfg.plugins != []) {
source = mkPluginEnv cfg.plugins;
};
};
}

View File

@@ -12,6 +12,17 @@ in
options.offlineimap = {
enable = mkEnableOption "OfflineIMAP";
extraConfig.account = mkOption {
type = extraConfigType;
default = {};
example = {
autorefresh = 20;
};
description = ''
Extra configuration options to add to the account section.
'';
};
extraConfig.local = mkOption {
type = extraConfigType;
default = {};

View File

@@ -88,7 +88,8 @@ let
localrepository = "${name}-local";
remoterepository = "${name}-remote";
}
// postSyncHook;
// postSyncHook
// offlineimap.extraConfig.account;
"Repository ${name}-local" = {
type = localType;

52
modules/programs/opam.nix Normal file
View File

@@ -0,0 +1,52 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.opam;
in
{
meta.maintainers = [ maintainers.marsam ];
options.programs.opam = {
enable = mkEnableOption "Opam";
package = mkOption {
type = types.package;
default = pkgs.opam;
defaultText = literalExample "pkgs.opam";
description = "Opam package to install.";
};
enableBashIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Bash integration.
'';
};
enableZshIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Zsh integration.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
eval "$(${cfg.package}/bin/opam env --shell=bash)"
'';
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
eval "$(${cfg.package}/bin/opam env --shell=zsh)"
'';
};
}

View File

@@ -18,7 +18,7 @@ in
package = mkOption {
type = types.package;
default = pkgs.pidgin;
defaultText = "pkgs.pidgin";
defaultText = literalExample "pkgs.pidgin";
description = "The Pidgin package to use.";
};

View File

@@ -0,0 +1,78 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.readline;
mkSetVariableStr = n: v:
let
mkValueStr = v:
if v == true then "on"
else if v == false then "off"
else if isInt v then toString v
else if isString v then v
else abort ("values ${toPretty v} is of unsupported type");
in
"set ${n} ${mkValueStr v}";
mkBindingStr = k: v: "\"${k}\": ${v}";
in
{
options.programs.readline = {
enable = mkEnableOption "readline";
bindings = mkOption {
default = {};
type = types.attrsOf types.str;
example = literalExample ''
{ "\\C-h" = "backward-kill-word"; }
'';
description = "Readline bindings.";
};
variables = mkOption {
type = with types; attrsOf (either str (either int bool));
default = {};
example = { expand-tilde = true; };
description = ''
Readline customization variable assignments.
'';
};
includeSystemConfig = mkOption {
type = types.bool;
default = true;
description = "Whether to include the system-wide configuration.";
};
extraConfig = mkOption {
type = types.lines;
default = "";
description = ''
Configuration lines appended unchanged to the end of the
<filename>~/.inputrc</filename> file.
'';
};
};
config = mkIf cfg.enable {
home.file.".inputrc".text =
let
configStr = concatStringsSep "\n" (
optional cfg.includeSystemConfig "$include /etc/inputrc"
++ mapAttrsToList mkSetVariableStr cfg.variables
++ mapAttrsToList mkBindingStr cfg.bindings
);
in
''
# Generated by Home Manager.
${configStr}
${cfg.extraConfig}
'';
};
}

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