Project import generated by Copybara.

GitOrigin-RevId: ac319fd3149b23a3ad8ee24cb2def6e67acf194c
This commit is contained in:
Default email 2021-07-03 00:36:30 +02:00
parent 0d3567ea7e
commit a0869759be
491 changed files with 14231 additions and 2701 deletions

View file

@ -4,6 +4,9 @@
/modules/home-environment.nix @rycee
/modules/i18n/input-method @Kranzes
/tests/modules/i18n/input-method @Kranzes
/modules/misc/dconf.nix @gnidorah @rycee
/modules/misc/fontconfig.nix @rycee
@ -11,6 +14,9 @@
/modules/misc/gtk.nix @rycee
/modules/config/i18n.nix @midchildan
/tests/modules/config/i18n @midchildan
/modules/misc/news.nix @rycee
/modules/misc/numlock.nix @evanjs
@ -31,6 +37,14 @@
/modules/misc/xdg-user-dirs.nix @pacien
/modules/misc/xdg-system-dirs.nix @tadfisher
/tests/modules/misc/xdg/system-dirs.nix @tadfisher
/modules/misc/xdg-desktop-entries.nix @cwyc
/tests/modules/misc/xdg/desktop-entries.nix @cwyc
/tests/modules/misc/xdg/desktop-full-expected.desktop @cwyc
/tests/modules/misc/xdg/desktop-min-expected.desktop @cwyc
/modules/programs/aria2.nix @JustinLovinger
/modules/programs/autojump.nix @evanjs
@ -54,23 +68,37 @@
/modules/programs/emacs.nix @rycee
/modules/programs/exa.nix @kalhauge
/modules/programs/firefox.nix @rycee
/modules/programs/foot.nix @plabadens
/tests/modules/programs/foot @plabadens
/modules/programs/gh.nix @Gerschtli
/tests/modules/programs/gh @Gerschtli
/modules/programs/git.nix @rycee
/modules/programs/gnome-terminal.nix @rycee
/modules/programs/gnome-terminal.nix @kamadorueda @rycee
/modules/programs/go.nix @rvolosatovs
/modules/programs/himalaya.nix @ambroisie
/tests/modules/programs/himalaya @ambroisie
/modules/programs/home-manager.nix @rycee
/modules/programs/htop.nix @bjpbakker
/modules/programs/i3status.nix @JustinLovinger
/modules/programs/i3status-rust.nix @workflow
/modules/programs/keychain.nix @marsam
/modules/programs/lazygit.nix @kalhauge
/modules/programs/lesspipe.nix @rycee
/modules/programs/lf.nix @owm111
@ -82,12 +110,16 @@
/modules/programs/matplotlib.nix @rprospero
/modules/programs/mangohud.nix @ZerataX
/tests/modules/programs/mangohud @ZerataX
/modules/programs/mbsync.nix @KarlJoad
/tests/modules/programs/mbsync @KarlJoad
/modules/programs/mcfly.nix @marsam
/modules/programs/mpv.nix @tadeokondrak
/modules/programs/mpv.nix @tadeokondrak @thiagokokada
/tests/modules/programs/mpv @thiagokokada
/modules/programs/mu.nix @KarlJoad
@ -95,9 +127,17 @@
/tests/modules/programs/ncmpcpp @olmokramer
/tests/modules/programs/ncmpcpp-linux @olmokramer
/modules/programs/ncspot.nix @marsam
/modules/programs/ne.nix @cwyc
/tests/modules/programs/ne @cwyc
/modules/programs/newsboat.nix @sumnerevans
/tests/modules/programs/newsboat @sumnerevans
/modules/programs/nix-index.nix @ambroisie
/tests/modules/programs/nix-index @ambroisie
/modules/programs/noti.nix @marsam
/modules/programs/nushell.nix @Philipp-M
@ -105,6 +145,8 @@
/modules/programs/obs-studio.nix @adisbladis
/modules/programs/octant.nix @06kellyjac
/modules/programs/opam.nix @marsam
/modules/programs/openssh.nix @rycee
@ -115,19 +157,46 @@
/modules/programs/pidgin.nix @rycee
/modules/programs/piston-cli.nix @ethancedwards8
/modules/programs/powerline-go.nix @DamienCassou
/modules/programs/rbw.nix @ambroisie
/tests/modules/programs/rbw @ambroisie
/modules/programs/rofi.nix @thiagokokada
/tests/modules/programs/rofi @thiagokokada
/modules/programs/rofi-pass.nix @seylerius
/tests/modules/programs/rofi-pass @seylerius
/modules/programs/rtorrent.nix @marsam
/modules/programs/sbt.nix @kubukoz
/tests/modules/programs/sbt @kubukoz
/modules/programs/scmpuff.nix @cpcloud
/tests/modules/programs/scmpuff @cpcloud
/modules/programs/senpai.nix @malte-v
/modules/programs/ssh.nix @rycee
/modules/programs/starship.nix @marsam
/modules/programs/terminator.nix @chisui
/modules/programs/texlive.nix @rycee
/modules/programs/topgrade.nix @msfjarvis
/tests/modules/programs/topgrade @msfjarvis
/modules/programs/waybar.nix @berbiche
/tests/modules/programs/waybar @berbiche
/modules/programs/xmobar.nix @t4ccer
/tests/modules/programs/xmobar @t4ccer
/modules/programs/z-lua.nix @marsam
/modules/programs/zathura.nix @rprospero
@ -136,6 +205,11 @@
/modules/programs/zsh/prezto.nix @NickHu
/modules/services/barrier.nix @Kritnich
/tests/modules/services/barrier @Kritnich
/modules/services/caffeine.nix @uvNikita
/modules/services/cbatticon.nix @pmiddend
/modules/services/clipmenu.nix @DamienCassou
@ -147,12 +221,12 @@
/modules/services/emacs.nix @tadfisher
/modules/services/etesync-dav.nix @Valodim
/modules/services/flameshot.nix @moredhel
/modules/services/fluidsynth.nix @Valodim
/modules/services/gammastep.nix @petabyteboy
/modules/services/gnome-keyring.nix @rycee
/modules/services/gpg-agent.nix @rycee
@ -180,21 +254,39 @@
/modules/services/mpdris2.nix @pjones
/modules/services/mpris-proxy.nix @ThibautMarty
/modules/services/muchsync.nix @pacien
/modules/services/network-manager-applet.nix @rycee
/modules/services/pantalaimon.nix @jojosch
/tests/modules/services/pantalaimon @jojosch
/modules/services/parcellite.nix @gleber
/modules/services/pass-secret-service.nix @cab404
/modules/services/password-store-sync.nix @pacien
/modules/services/pasystray.nix @pltanton
/modules/services/pbgopy.nix @ivarwithoutbones
/tests/modules/services/pbgopy @ivarwithoutbones
/modules/services/plan9port.nix @ehmry
/modules/services/playerctld.nix @fendse
/tests/modules/playerctld @fendse
/modules/services/poweralertd.nix @ThibautMarty
/modules/services/pulseeffects.nix @jonringer
/modules/services/random-background.nix @rycee
/modules/services/redshift.nix @rycee
/modules/services/redshift-gammastep @rycee @petabyteboy @thiagokokada
/tests/modules/redshift-gammastep @thiagokokada
/modules/services/status-notifier-watcher.nix @pltanton
@ -210,12 +302,26 @@
/modules/services/unison.nix @pacien
/modules/services/window-managers/i3-sway/sway.nix @alexarice
/modules/services/window-managers/bspwm @ncfavier
/tests/modules/services/window-managers/bspwm @ncfavier
/modules/services/window-managers/i3-sway/i3.nix @sumnerevans
/tests/modules/services/window-managers/i3 @sumnerevans
/modules/services/window-managers/i3-sway/lib @sumnerevans
/modules/services/window-managers/i3-sway/sway.nix @alexarice @sumnerevans
/tests/modules/services/window-managers/sway @sumnerevans
/modules/services/wlsunset.nix @matrss
/tests/modules/services/wlsunset @matrss
/modules/services/xcape.nix @nickhu
/modules/services/xembed-sni-proxy.nix @rycee
/modules/services/xidlehook.nix @dschrempf
/modules/services/xscreensaver.nix @rycee
/modules/services/xsuspender.nix @offlinehacker

View file

@ -1,8 +1,16 @@
<!--
Don't forget to check if there already exists a relevant issue before
creating a new one.
-->
### Issue description
<!--
Please describe the issue. For support and help please use the IRC
channel #home-manager @ freenode.net instead.
channel #home-manager at irc.oftc.net or Matrix room
https://matrix.to/#/#hm:rycee.net instead.
-->
### Meta

View file

@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "master"
schedule:
interval: "weekly"
commit-message:
prefix: "ci:"
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "release-20.09"
schedule:
interval: "weekly"
commit-message:
prefix: "ci:"

View file

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

View file

@ -11,10 +11,10 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v10
- uses: cachix/install-nix-action@v13
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v6
- uses: cachix/cachix-action@v10
with:
name: nix-community
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'

View file

@ -11,12 +11,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v10
- uses: cachix/install-nix-action@v13
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v6
- uses: cachix/cachix-action@v10
with:
name: nix-community
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- run: ./format -c
- run: nix-shell . -A install
- run: nix-shell --pure --max-jobs 4 tests -A run.all
- run: nix-shell --pure tests -A run.all

View file

@ -1,8 +1,7 @@
image: nixos/nix:latest
variables:
# Pinned 2020-09-11.
NIX_PATH: "nixpkgs=https://github.com/NixOS/nixpkgs/archive/6d4b93323e7f78121f8d6db6c59f3889aa1dd931.tar.gz"
NIX_PATH: "nixpkgs=channel:nixos-unstable"
stages:
- test

1
third_party/home-manager/.release vendored Normal file
View file

@ -0,0 +1 @@
21.11

View file

@ -44,9 +44,10 @@ The first option is good if you only temporarily want to use your clone.
[[sec-guidelines]]
=== Guidelines
:irc-home-manager: https://webchat.freenode.net/?url=irc%3A%2F%2Firc.freenode.net%2Fhome-manager
:irc-home-manager: https://webchat.oftc.net/?channels=home-manager
:valuable-options: https://github.com/Infinisil/rfcs/blob/config-option/rfcs/0042-config-option.md#valuable-options
:rfc-42: https://github.com/Infinisil/rfcs/blob/config-option/rfcs/0042-config-option.md
:assertions: https://nixos.org/manual/nixos/stable/index.html#sec-assertions
If your contribution satisfy the following rules then there is a good chance it will be merged without too much trouble. The rules are enforced by the Home Manager maintainers and to a lesser extent the Home Manager CI system.
@ -55,7 +56,9 @@ If you are uncertain how these rules affect the change you would like to make th
[[sec-guidelines-back-compat]]
==== Maintain backward compatibility
Your contribution should never cause another user's existing configuration to break. Home Manager is used in many different environments and you should consider how you change may effect others. For example,
Your contribution should not cause another user's existing configuration to break unless there is a very good reason and the change should be announced to the user through an {assertions}[assertion] or similar.
Remember that Home Manager is used in many different environments and you should consider how your change may effect others. For example,
- Does your change work for people that do not use NixOS? Consider other GNU/Linux distributions and macOS.
- Does your change work for people whose configuration is built on one system and deployed on another system?
@ -88,7 +91,7 @@ All contributed code _must_ pass the test suite.
==== Add relevant documentation
:docbook: https://tdg.docbook.org/
:asciidoc: https://asciidoc.org/
:docbook-rocks: https://docbook.rocks/
:docbook-rocks: https://berbiche.github.io/docbook.rocks/
Many code changes require changing the documentation as well. Module options should be documented with DocBook. See {docbook-rocks}[DocBook rocks!] for a quick introduction and {docbook}[DocBook 5: The Definitive Guide] for in-depth information of DocBook. Home Manager is itself documented using a combination of DocBook and {asciidoc}[AsciiDoc]. All text is hosted in Home Manager's Git repository.
@ -160,7 +163,7 @@ The commit messages should follow the {seven-rules}[seven rules]. We also ask yo
{long description}
----
where `{component}` refers to the code component (or module) your change affects, `{description}` is a very brief description of your change, and `{long description}` is an optional clarifying description. Note, `{description}` should start with a lower case letter. As a rare exception, if there is no clear component, or your change affects many components, then the `{component}` part is optional. See <<ex-commit-message>> for a commit message that fulfills these requirements.
where `{component}` refers to the code component (or module) your change affects, `{description}` is a very brief description of your change, and `{long description}` is an optional clarifying description. As a rare exception, if there is no clear component, or your change affects many components, then the `{component}` part is optional. See <<ex-commit-message>> for a commit message that fulfills these requirements.
[[ex-commit-message]]
.Compliant commit message

View file

@ -40,6 +40,8 @@ error: build of /nix/store/b37x3s7pzxbasfqhaca5dqbf3pjjw0ip-user-environment.
The solution is typically to uninstall the package from the environment using `nix-env --uninstall` and reattempt the Home Manager generation switch.
You could also opt to unistall _all_ of the packages from your profile with `nix-env --uninstall '*'`.
=== Why are the session variables not set?
Home Manager is only able to set session variables automatically if it manages your Bash or Z shell configuration. If you don't want to let Home Manager manage your shell then you will have to manually source the `~/.nix-profile/etc/profile.d/hm-session-vars.sh` file in an appropriate way. In Bash and Z shell this can be done by adding
@ -51,7 +53,7 @@ Home Manager is only able to set session variables automatically if it manages y
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?
=== How to set up a configuration for multiple users/machines?
:post-your-homenix: https://www.reddit.com/r/NixOS/comments/9bb9h9/post_your_homemanager_homenix_file/
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.
@ -92,7 +94,7 @@ error: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name ca.desrt.
The solution on NixOS is to add
[source,nix]
services.dbus.packages = with pkgs; [ gnome3.dconf ];
services.dbus.packages = with pkgs; [ gnome.dconf ];
to your system configuration.

View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2017-2020 Robert Helgesson and Home Manager contributors
Copyright (c) 2017-2020 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

@ -3,8 +3,10 @@ Home Manager using Nix
This project provides a basic system for managing a user environment
using the [Nix][] package manager together with the Nix libraries
found in [Nixpkgs][]. Before attempting to use Home Manager please
read the warning below.
found in [Nixpkgs][]. It allows declarative configuration of user
specific (non global) packages and dotfiles.
Before attempting to use Home Manager please read the warning below.
For a more systematic overview of Home Manager and its available
options, please see the [Home Manager manual][manual].
@ -12,22 +14,25 @@ options, please see the [Home Manager manual][manual].
Words of warning
----------------
This project is under development. I personally use it to manage
several user configurations but it may fail catastrophically for you.
So beware!
Unfortunately, it is quite possible to get difficult to understand
errors when working with Home Manager, such as infinite loops with no
clear source reference. You should therefore be comfortable using the
Nix language and the various tools in the Nix ecosystem. Reading
through the [Nix Pills][] document is a good way to familiarize
yourself with them.
Before using Home Manager you should be comfortable using the Nix
language and the various tools in the Nix ecosystem. Reading through
the [Nix Pills][] document is a good way to familiarize yourself with
them.
If you are not very familiar with Nix but still want to use Home
Manager then you are strongly encouraged to start with a small and
very simple configuration and gradually make it more elaborate as you
learn.
In some cases Home Manager cannot detect whether it will overwrite a
previous manual configuration. For example, the Gnome Terminal module
will write to your dconf store and cannot tell whether a configuration
that it is about to be overwrite was from a previous Home Manager
that it is about to be overwritten was from a previous Home Manager
generation or from manual configuration.
Home Manager targets [NixOS][] unstable and NixOS version 20.03 (the
Home Manager targets [NixOS][] unstable and NixOS version 21.05 (the
current stable version), it may or may not work on other Linux
distributions and NixOS versions.
@ -43,8 +48,7 @@ Contact
-------
You can chat with us on IRC in the channel [#home-manager][] on
[freenode][]. The [channel logs][] are hosted courtesy of
[samueldr][].
[OFTC][].
Installation
------------
@ -61,22 +65,23 @@ Currently the easiest way to install Home Manager is as follows:
control this option using the
[`nix.allowedUsers`][nixosAllowedUsers] system option.
2. Add the appropriate Home Manager channel. Typically this is
Note that Nix 2.4 (`nixUnstable`) is not yet supported.
2. Add the appropriate Home Manager channel. If you are following
Nixpkgs master or an unstable channel you can run
```console
$ nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
$ nix-channel --update
```
if you are following Nixpkgs master or an unstable channel and
and if you follow a Nixpkgs version 21.05 channel you can run
```console
$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-20.03.tar.gz home-manager
$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.05.tar.gz home-manager
$ nix-channel --update
```
if you follow a Nixpkgs version 20.03 channel.
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
@ -112,6 +117,13 @@ Currently the easiest way to install Home Manager is as follows:
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
```
or this when managing home configuration together with system
configuration
```bash
. "/etc/profiles/per-user/$USER/etc/profile.d/hm-session-vars.sh"
```
to your `~/.profile` file.
If instead of using channels you want to run Home Manager from a Git
@ -129,8 +141,8 @@ configuration generations.
As an example, let us expand the initial configuration file from the
installation above to install the htop and fortune packages, install
Emacs with a few extra packages enabled, install Firefox with the
IcedTea plugin enabled, and enable the user gpg-agent service.
Emacs with a few extra packages enabled, install Firefox with
smooth scrolling disabled, and enable the user gpg-agent service.
To satisfy the above setup we should elaborate the
`~/.config/nixpkgs/home.nix` file as follows:
@ -267,7 +279,7 @@ then result in
$ home-manager switch
Activating checkLinkTargets
Existing file '/home/jdoe/.gitconfig' is in the way
Existing file '/home/jdoe/.config/git/config' is in the way
Please move the above files and try again
```
@ -331,7 +343,7 @@ as follows:
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.user = import ./home.nix;
home-manager.users.jdoe = import ./home.nix;
}
];
};
@ -340,6 +352,13 @@ as follows:
}
```
Note, the Home Manager library is exported by the flake under
`lib.hm`.
When using flakes, switch to new configurations as you do for the
whole system (e. g. `nixos-rebuild switch --flake <path>`) instead of
using the `home-manager` command line tool.
Releases
--------
@ -347,7 +366,7 @@ Home Manager is developed against `nixpkgs-unstable` branch, which
often causes it to contain tweaks for changes/packages not yet
released in stable NixOS. To avoid breaking users' configurations,
Home Manager is released in branches corresponding to NixOS releases
(e.g. `release-20.03`). These branches get fixes, but usually not new
(e.g. `release-21.05`). These branches get fixes, but usually not new
modules. If you need a module to be backported, then feel free to open
an issue.
@ -360,9 +379,8 @@ an issue.
[Z shell]: http://zsh.sourceforge.net/
[manual]: https://nix-community.github.io/home-manager/
[configuration options]: https://nix-community.github.io/home-manager/options.html
[#home-manager]: https://webchat.freenode.net/?url=irc%3A%2F%2Firc.freenode.net%2Fhome-manager
[freenode]: https://freenode.net/
[channel logs]: https://logs.nix.samueldr.com/home-manager/
[#home-manager]: https://webchat.oftc.net/?channels=home-manager
[OFTC]: https://oftc.net/
[samueldr]: https://github.com/samueldr/
[Nix Pills]: https://nixos.org/nixos/nix-pills/
[Nix Flakes]: https://nixos.wiki/wiki/Flakes

View file

@ -44,9 +44,10 @@ The first option is good if you only temporarily want to use your clone.
[[sec-guidelines]]
=== Guidelines
:irc-home-manager: https://webchat.freenode.net/?url=irc%3A%2F%2Firc.freenode.net%2Fhome-manager
:irc-home-manager: https://webchat.oftc.net/?channels=home-manager
:valuable-options: https://github.com/Infinisil/rfcs/blob/config-option/rfcs/0042-config-option.md#valuable-options
:rfc-42: https://github.com/Infinisil/rfcs/blob/config-option/rfcs/0042-config-option.md
:assertions: https://nixos.org/manual/nixos/stable/index.html#sec-assertions
If your contribution satisfy the following rules then there is a good chance it will be merged without too much trouble. The rules are enforced by the Home Manager maintainers and to a lesser extent the Home Manager CI system.
@ -55,7 +56,9 @@ If you are uncertain how these rules affect the change you would like to make th
[[sec-guidelines-back-compat]]
==== Maintain backward compatibility
Your contribution should never cause another user's existing configuration to break. Home Manager is used in many different environments and you should consider how you change may effect others. For example,
Your contribution should not cause another user's existing configuration to break unless there is a very good reason and the change should be announced to the user through an {assertions}[assertion] or similar.
Remember that Home Manager is used in many different environments and you should consider how your change may effect others. For example,
- Does your change work for people that do not use NixOS? Consider other GNU/Linux distributions and macOS.
- Does your change work for people whose configuration is built on one system and deployed on another system?
@ -88,7 +91,7 @@ All contributed code _must_ pass the test suite.
==== Add relevant documentation
:docbook: https://tdg.docbook.org/
:asciidoc: https://asciidoc.org/
:docbook-rocks: https://docbook.rocks/
:docbook-rocks: https://berbiche.github.io/docbook.rocks/
Many code changes require changing the documentation as well. Module options should be documented with DocBook. See {docbook-rocks}[DocBook rocks!] for a quick introduction and {docbook}[DocBook 5: The Definitive Guide] for in-depth information of DocBook. Home Manager is itself documented using a combination of DocBook and {asciidoc}[AsciiDoc]. All text is hosted in Home Manager's Git repository.
@ -160,7 +163,7 @@ The commit messages should follow the {seven-rules}[seven rules]. We also ask yo
{long description}
----
where `{component}` refers to the code component (or module) your change affects, `{description}` is a very brief description of your change, and `{long description}` is an optional clarifying description. Note, `{description}` should start with a lower case letter. As a rare exception, if there is no clear component, or your change affects many components, then the `{component}` part is optional. See <<ex-commit-message>> for a commit message that fulfills these requirements.
where `{component}` refers to the code component (or module) your change affects, `{description}` is a very brief description of your change, and `{long description}` is an optional clarifying description. As a rare exception, if there is no clear component, or your change affects many components, then the `{component}` part is optional. See <<ex-commit-message>> for a commit message that fulfills these requirements.
[[ex-commit-message]]
.Compliant commit message

View file

@ -26,27 +26,78 @@ let
}];
};
hmModulesDocs = nmd.buildModulesDocs {
modules = import ../modules/modules.nix {
inherit lib pkgs;
check = false;
} ++ [ scrubbedPkgsModule ];
buildModulesDocs = args:
nmd.buildModulesDocs ({
moduleRootPaths = [ ./.. ];
mkModuleUrl = path:
"https://github.com/nix-community/home-manager/blob/master/${path}#blob-path";
channelName = "home-manager";
} // args);
hmModulesDocs = buildModulesDocs {
modules = import ../modules/modules.nix {
inherit lib pkgs;
check = false;
} ++ [ scrubbedPkgsModule ];
docBook.id = "home-manager-options";
};
nixosModuleDocs = buildModulesDocs {
modules = let
nixosModule = module: pkgs.path + "/nixos/modules" + module;
mockedNixos = with lib; {
options = {
environment.pathsToLink = mkSinkUndeclaredOptions { };
systemd.services = mkSinkUndeclaredOptions { };
users.users = mkSinkUndeclaredOptions { };
};
};
in [
../nixos/default.nix
mockedNixos
(nixosModule "/misc/assertions.nix")
scrubbedPkgsModule
];
docBook = {
id = "nixos-options";
optionIdPrefix = "nixos-opt";
};
};
nixDarwinModuleDocs = buildModulesDocs {
modules = let
nixosModule = module: pkgs.path + "/nixos/modules" + module;
mockedNixDarwin = with lib; {
options = {
environment.pathsToLink = mkSinkUndeclaredOptions { };
system.activationScripts.postActivation.text =
mkSinkUndeclaredOptions { };
users.users = mkSinkUndeclaredOptions { };
};
};
in [
../nix-darwin/default.nix
mockedNixDarwin
(nixosModule "/misc/assertions.nix")
scrubbedPkgsModule
];
docBook = {
id = "nix-darwin-options";
optionIdPrefix = "nix-darwin-opt";
};
};
docs = nmd.buildDocBookDocs {
pathName = "home-manager";
modulesDocs = [ hmModulesDocs ];
modulesDocs = [ hmModulesDocs nixDarwinModuleDocs nixosModuleDocs ];
documentsDirectory = ./.;
documentType = "book";
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-nixos-options"><?dbhtml filename="nixos-options.html"?></d:tocentry>
<d:tocentry linkend="ch-nix-darwin-options"><?dbhtml filename="nix-darwin-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>

View file

@ -40,6 +40,8 @@ error: build of /nix/store/b37x3s7pzxbasfqhaca5dqbf3pjjw0ip-user-environment.
The solution is typically to uninstall the package from the environment using `nix-env --uninstall` and reattempt the Home Manager generation switch.
You could also opt to unistall _all_ of the packages from your profile with `nix-env --uninstall '*'`.
=== Why are the session variables not set?
Home Manager is only able to set session variables automatically if it manages your Bash or Z shell configuration. If you don't want to let Home Manager manage your shell then you will have to manually source the `~/.nix-profile/etc/profile.d/hm-session-vars.sh` file in an appropriate way. In Bash and Z shell this can be done by adding
@ -51,7 +53,7 @@ Home Manager is only able to set session variables automatically if it manages y
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?
=== How to set up a configuration for multiple users/machines?
:post-your-homenix: https://www.reddit.com/r/NixOS/comments/9bb9h9/post_your_homemanager_homenix_file/
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.
@ -92,7 +94,7 @@ error: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name ca.desrt.
The solution on NixOS is to add
[source,nix]
services.dbus.packages = with pkgs; [ gnome3.dconf ];
services.dbus.packages = with pkgs; [ gnome.dconf ];
to your system configuration.

View file

@ -0,0 +1,263 @@
[[ch-installation]]
== Installing Home Manager
:nix-darwin: https://github.com/LnL7/nix-darwin/
Home Manager can be used in three primary ways:
1. Using the standalone `home-manager` 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
<<sec-install-standalone>> for instructions on how to perform this
installation.
2. As a module within a NixOS system configuration. This allows the
user profiles to be built together with the system when running
`nixos-rebuild`. See <<sec-install-nixos-module>> for a description of
this setup.
3. As a module within a {nix-darwin}[nix-darwin] system configuration.
This allows the user profiles to be built together with the system
when running `darwin-rebuild`. See <<sec-install-nix-darwin-module>>
for a description of this setup.
[[sec-install-standalone]]
=== Standalone installation
:nix-allowed-users: https://nixos.org/nix/manual/#conf-allowed-users
:nixos-allowed-users: https://nixos.org/nixos/manual/options.html#opt-nix.allowedUsers
1. Make sure you have a working Nix installation. Specifically, 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` 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 {nix-allowed-users}[`allowed-users`] Nix
option. On NixOS you can control this option using the
{nixos-allowed-users}[`nix.allowedUsers`] system option.
2. Add the Home Manager channel that you wish to follow. If you are
following Nixpkgs master or an unstable channel then this is done by
running
+
[source,console]
----
$ nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
$ nix-channel --update
----
+
and if you follow a Nixpkgs version 21.05 channel, you can run
+
[source,console]
----
$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.05.tar.gz home-manager
$ nix-channel --update
----
+
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
+
[source,bash]
export NIX_PATH=$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH
+
to your shell (see
https://github.com/NixOS/nix/issues/2033[nix#2033]).
3. Run the Home Manager installation command and create the first Home
Manager generation:
+
[source,console]
$ nix-shell '<home-manager>' -A install
+
Once finished, Home Manager should be active and available in your
user environment.
4. If you do not plan on having Home Manager manage your shell
configuration then you must source the
+
[source,bash]
$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
+
file in your shell configuration. Alternatively source
+
[source,bash]
/etc/profiles/per-user/$USER/etc/profile.d/hm-session-vars.sh
+
when managing home configuration together with system configuration.
+
Unfortunately, we currently only support POSIX.2-like shells such as
https://www.gnu.org/software/bash/[Bash] or
http://zsh.sourceforge.net/[Z shell].
+
For example, if you use Bash then add
+
[source,bash]
----
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
----
+
to your `~/.profile` file.
If instead of using channels you want to run Home Manager from a Git
checkout of the repository then you can use the
<<opt-programs.home-manager.path>> option to specify the absolute path
to the repository.
[[sec-install-nixos-module]]
=== NixOS module
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 `home-manager` tool. It also opens
up additional possibilities, for example, to automatically configure
user environments in NixOS declarative containers or on systems
deployed through NixOps.
To make the NixOS module available for use you must `import` it into
your system configuration. This is most conveniently done by adding a
Home Manager channel. For example, if you are following Nixpkgs master
or an unstable channel, you can run
[source,console]
----
# nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
# nix-channel --update
----
and if you follow a Nixpkgs version 21.05 channel, you can run
[source,console]
----
# nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.05.tar.gz home-manager
# nix-channel --update
----
It is then possible to add
[source,nix]
imports = [ <home-manager/nixos> ];
to your system `configuration.nix` file, which will introduce a new
NixOS option called `home-manager.users` whose type is an attribute
set that maps user names to Home Manager configurations.
For example, a NixOS configuration may include the lines
[source,nix]
----
users.users.eve.isNormalUser = true;
home-manager.users.eve = { pkgs, ... }: {
home.packages = [ pkgs.atool pkgs.httpie ];
programs.bash.enable = true;
};
----
and after a `nixos-rebuild switch` the user eve's environment should
include a basic Bash configuration and the packages atool and httpie.
[NOTE]
====
By default packages will be installed to `$HOME/.nix-profile` but they
can be installed to `/etc/profiles` if
[source,nix]
home-manager.useUserPackages = true;
is added to the system configuration. This is necessary if, for
example, you wish to use `nixos-rebuild build-vm`. This option may
become the default value in the future.
====
[NOTE]
====
By default, Home Manager uses a private `pkgs` instance that is
configured via the `home-manager.users.<name>.nixpkgs` options. To
instead use the global `pkgs` that is configured via the system level
`nixpkgs` options, set
[source,nix]
home-manager.useGlobalPkgs = true;
This saves an extra Nixpkgs evaluation, adds consistency, and removes
the dependency on `NIX_PATH`, which is otherwise used for importing
Nixpkgs.
====
[[sec-install-nix-darwin-module]]
=== nix-darwin module
Home Manager provides a module that allows you to prepare user
environments directly from the {nix-darwin}[nix-darwin] configuration
file, which often is more convenient than using the `home-manager`
tool.
To make the NixOS module available for use you must `import` it into
your system configuration. This is most conveniently done by adding a
Home Manager channel. For example, if you are following Nixpkgs master
or an unstable channel, you can run
[source,console]
----
# nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
# nix-channel --update
----
and if you follow a Nixpkgs version 21.05 channel, you can run
[source,console]
----
# nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.05.tar.gz home-manager
# nix-channel --update
----
It is then possible to add
[source,nix]
imports = [ <home-manager/nix-darwin> ];
to your nix-darwin `configuration.nix` file, which will introduce a
new NixOS option called `home-manager` whose type is an attribute set
that maps user names to Home Manager configurations.
For example, a nix-darwin configuration may include the lines
[source,nix]
----
home-manager.users.eve = { pkgs, ... }: {
home.packages = [ pkgs.atool pkgs.httpie ];
programs.bash.enable = true;
};
----
and after a `darwin-rebuild switch` the user eve's environment
should include a basic Bash configuration and the packages atool and
httpie.
[NOTE]
====
By default user packages will not be ignored in favor of
`environment.systemPackages`, but they will be intalled to
`/etc/profiles/per-user/$USERNAME` if
[source,nix]
home-manager.useUserPackages = true;
is added to the nix-darwin configuration. This option may become the
default value in the future.
====
[NOTE]
====
By default, Home Manager uses a private `pkgs` instance that is
configured via the `home-manager.users.<name>.nixpkgs` options. To
instead use the global `pkgs` that is configured via the system level
`nixpkgs` options, set
[source,nix]
home-manager.useGlobalPkgs = true;
This saves an extra Nixpkgs evaluation, adds consistency, and removes
the dependency on `NIX_PATH`, which is otherwise used for importing
Nixpkgs.
====

View file

@ -1,334 +0,0 @@
<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. Specifically, 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/nix-community/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/nix-community/home-manager/archive/release-20.03.tar.gz home-manager</userinput>
<prompt>$</prompt> <userinput>nix-channel --update</userinput>
</screen>
<para>
if you follow a Nixpkgs version 20.03 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 language="console">
<prompt>#</prompt> <userinput>nix-channel --add https://github.com/nix-community/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 language="console">
<prompt>#</prompt> <userinput>nix-channel --add https://github.com/nix-community/home-manager/archive/release-20.03.tar.gz home-manager</userinput>
<prompt>#</prompt> <userinput>nix-channel --update</userinput>
</screen>
<para>
if you follow a Nixpkgs version 20.03 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>
<note>
<para>
By default, Home Manager uses a private <literal>pkgs</literal> instance
that is configured via the <option>home-manager.users.&lt;name&gt;.nixpkgs</option> options.
To instead use the global <literal>pkgs</literal> that is configured via
the system level <option>nixpkgs</option> options, set
</para>
<programlisting language="nix">
home-manager.useGlobalPkgs = true;
</programlisting>
<para>
This saves an extra Nixpkgs evaluation, adds consistency, and removes the
dependency on <envar>NIX_PATH</envar>, which is otherwise used for
importing Nixpkgs.
</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 language="console">
<prompt>#</prompt> <userinput>nix-channel --add https://github.com/nix-community/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 language="console">
<prompt>#</prompt> <userinput>nix-channel --add https://github.com/nix-community/home-manager/archive/release-20.03.tar.gz home-manager</userinput>
<prompt>#</prompt> <userinput>nix-channel --update</userinput>
</screen>
<para>
if you follow a Nixpkgs version 20.03 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>
<note>
<para>
By default, Home Manager uses a private <literal>pkgs</literal> instance
that is configured via the <option>home-manager.users.&lt;name&gt;.nixpkgs</option> options.
To instead use the global <literal>pkgs</literal> that is configured via
the system level <option>nixpkgs</option> options, set
</para>
<programlisting language="nix">
home-manager.useGlobalPkgs = true;
</programlisting>
<para>
This saves an extra Nixpkgs evaluation, adds consistency, and removes the
dependency on <envar>NIX_PATH</envar>, which is otherwise used for
importing Nixpkgs.
</para>
</note>
</section>
</chapter>

View file

@ -41,6 +41,10 @@
news
</arg>
<arg choice="plain">
option <replaceable>option.name</replaceable>
</arg>
<arg choice="plain">
packages
</arg>
@ -66,6 +70,10 @@
-I <replaceable>path</replaceable>
</arg>
<arg>
--flake <replaceable>flake-uri</replaceable>
</arg>
<arg>
-b <replaceable>ext</replaceable>
</arg>
@ -115,7 +123,20 @@
</arg>
<arg>
--max-jobs <replaceable>number</replaceable>
<group choice="req">
<arg choice="plain">
-j
</arg>
<arg choice="plain">
--max-jobs
</arg>
</group>
<replaceable>number</replaceable>
</arg>
<arg>
--debug
</arg>
<arg>
@ -151,7 +172,7 @@
<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>.
configuration specified in <filename>~/.config/nixpkgs/home.nix</filename> or <filename>~/.config/nixpkgs/flake.nix</filename>.
</para>
<para>
All operations using this tool expects a sub-command that indicates the
@ -233,6 +254,18 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>option <replaceable>option.name</replaceable></option>
</term>
<listitem>
<para>
Inspect the given option name in the home configuration, like <citerefentry>
<refentrytitle>nixos-option</refentrytitle>
<manvolnum>8</manvolnum> </citerefentry>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>packages</option>
@ -334,6 +367,18 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--flake <replaceable>flake-uri[#name]</replaceable></option>
</term>
<listitem>
<para>
Build Home Manager configuration from the flake, which must contain the
output homeConfigurations.name. If no name is specified it will first try
username@hostname and then username.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-b <replaceable>extension</replaceable></option>
@ -417,6 +462,9 @@
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-j <replaceable>number</replaceable></option>
</term>
<term>
<option>--max-jobs <replaceable>number</replaceable></option>
</term>
@ -428,6 +476,18 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--debug</option>
</term>
<listitem>
<para>
Passed on to <citerefentry>
<refentrytitle>nix-build</refentrytitle>
<manvolnum>1</manvolnum> </citerefentry>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--keep-failed</option>

View file

@ -14,10 +14,8 @@
</para>
<para>
If you encounter problems then please reach out on the IRC channel
<link xlink:href="https://webchat.freenode.net/?url=irc%3A%2F%2Firc.freenode.net%2Fhome-manager">#home-manager</link>
hosted by <link xlink:href="https://freenode.net/">freenode</link>.
The <link xlink:href="https://logs.nix.samueldr.com/home-manager/">channel logs</link>
are hosted courtesy of <link xlink:href="https://github.com/samueldr/">samueldr</link>.
<link xlink:href="https://webchat.oftc.net/?channels=home-manager">#home-manager</link>
hosted by <link xlink:href="https://oftc.net/">OFTC</link>.
If your problem is caused by a bug in Home Manager then it should
be reported on the
<link xlink:href="https://github.com/nix-community/home-manager/issues">Home Manager issue tracker</link>.
@ -38,6 +36,14 @@
<title>Configuration Options</title>
<xi:include href="./nmd-result/home-manager-options.xml" />
</appendix>
<appendix xml:id="ch-nixos-options">
<title>NixOS Module Options</title>
<xi:include href="./nmd-result/nixos-options.xml" />
</appendix>
<appendix xml:id="ch-nix-darwin-options">
<title>nix-darwin Module Options</title>
<xi:include href="./nmd-result/nix-darwin-options.xml" />
</appendix>
<appendix xml:id="ch-tools">
<title>Tools</title>
<xi:include href="./man-home-manager.xml" />

View file

@ -6,6 +6,10 @@ This section lists the release notes for stable versions of Home Manager and the
:leveloffset: 1
include::rl-2111.adoc[]
include::rl-2105.adoc[]
include::rl-2009.adoc[]
include::rl-2003.adoc[]

View file

@ -1,8 +1,7 @@
[[sec-release-20.09]]
== Release 20.09 (unreleased)
== Release 20.09
This is the current unstable branch and the information in this
section is therefore not final.
The 20.09 release branch became the stable branch in late September, 2020.
[[sec-release-20.09-highlights]]
=== Highlights

View file

@ -0,0 +1,200 @@
[[sec-release-21.05]]
== Release 21.05
The 21.05 release branch became the stable branch in May, 2021.
[[sec-release-21.05-highlights]]
=== Highlights
This release has the following notable changes:
* The <<opt-programs.broot.verbs>> option is now a list rather than an
attribute set. To migrate, move the keys of the attrset into the list
items' `invocation` keys. For example,
+
[source,nix]
----
programs.broot.verbs = {
"p" = { execution = ":parent"; };
};
----
+
becomes
+
[source,nix]
----
programs.broot.verbs = [
{
invocation = "p";
execution = ":parent";
}
];
----
* The <<opt-programs.mpv.package>> option has been changed to allow custom
derivations. The following configuration is now possible:
+
[source,nix]
----
programs.mpv.package = (pkgs.wrapMpv (pkgs.mpv-unwrapped.override {
vapoursynthSupport = true;
}) {
extraMakeWrapperArgs = [
"--prefix" "LD_LIBRARY_PATH" ":" "${pkgs.vapoursynth-mvtools}/lib/vapoursynth"
];
});
----
+
As a result of this change, <<opt-programs.mpv.package>> is no longer the
resulting derivation. Use the newly introduced `programs.mpv.finalPackage`
instead.
* The <<opt-programs.rofi.extraConfig>> option is now an attribute set rather
than a string. To migrate, move each line into the attribute set,
removing the `rofi.` prefix from the keys. For example,
+
[source,nix]
----
programs.rofi.extraConfig = ''
rofi.show-icons: true
rofi.modi: drun,emoji,ssh
'';
----
+
becomes
+
[source,nix]
----
programs.rofi.extraConfig = {
show-icons = true;
modi = "drun,emoji,ssh";
};
----
+
* The <<opt-programs.rofi.theme>> option now supports defining a theme
using an attribute set, the following configuration is now possible:
+
[source,nix]
----
programs.rofi.theme = let
# Necessary to avoid quoting non-string values
inherit (config.lib.formats.rasi) mkLiteral;
in {
"@import" = "~/.config/rofi/theme.rasi";
"*" = {
background-color = mkLiteral "#000000";
foreground-color = mkLiteral "rgba ( 250, 251, 252, 100 % )";
border-color = mkLiteral "#FFFFFF";
width = 512;
};
"#textbox-prompt-colon" = {
expand = false;
str = ":";
margin = mkLiteral "0px 0.3em 0em 0em";
text-color = mkLiteral "@foreground-color";
};
};
----
* The `services.redshift.extraOptions` and `services.gammastep.extraOptions`
options were removed in favor of <<opt-services.redshift.settings>> and
`services.gammastep.settings`, that are now an attribute set rather
than a string. They also support new features not available before, for
example:
+
[source,nix]
----
services.redshift = {
dawnTime = "6:00-7:45";
duskTime = "18:35-20:15";
settings = {
redshift = {
gamma = 0.8;
adjustment-method = "randr";
};
randr = {
screen = 0;
};
};
};
----
+
It is recommended to check either
https://github.com/jonls/redshift/blob/master/redshift.conf.sample[redshift.conf.sample] or
https://gitlab.com/chinstrap/gammastep/-/blob/master/gammastep.conf.sample[gammastep.conf.sample]
for the available additional options in each program.
* Specifying `programs.neomutt.binds.map` or `programs.neomutt.macros.map` as a
single string is now deprecated in favor of specfiying it as a list of
strings.
* The `programs.neovim.configure` is deprecated in favor of other `programs.neovim` options;
please use the other options at your disposal:
+
[source,nix]
----
configure.packages.*.opt -> programs.neovim.plugins = [ { plugin = ...; optional = true; }]
configure.packages.*.start -> programs.neovim.plugins = [ { plugin = ...; }]
configure.customRC -> programs.neovim.extraConfig
----
* Home Manager now respects the `NO_COLOR` environment variable as per
https://no-color.org/[].
* Qt module now supports <<opt-qt.style.name>> to specify a theme name and
<<opt-qt.style.package>> to specify a theme package. If you have set
<<opt-qt.platformTheme>> to `gnome`, a <<opt-qt.style.package>> compatible
with both Qt and Gtk is now required to be set. For instance:
+
[source,nix]
----
qt = {
platformTheme = "gnome";
style = {
name = "adwaita-dark";
package = pkgs.adwaita-qt;
};
};
----
* The library type `fontType` now has a `size` attribute in addition to `name`. For example:
+
[source,nix]
----
font = {
name = "DejaVu Sans";
size = 8;
};
----
* The <<opt-programs.htop.settings>> option is introduced to replace individual
options in `programs.htop`. To migrate, set the htop options directly in
<<opt-programs.htop.settings>>. For example:
+
[source,nix]
----
programs.htop = {
enabled = true;
settings = {
color_scheme = 5;
delay = 15;
highlight_base_name = 1;
highlight_megabytes = 1;
highlight_threads = 1;
};
};
----
[[sec-release-21.05-state-version-changes]]
=== State Version Changes
The state version in this release includes the changes below. These
changes are only active if the `home.stateVersion` option is set to
"21.05" or later.
* The `newsboat` module now stores generated configuration in
`$XDG_CONFIG_HOME/newsboat`.

View file

@ -0,0 +1,21 @@
[[sec-release-21.11]]
== Release 21.11
This is the current unstable branch and the information in this
section is therefore not final.
[[sec-release-21.11-highlights]]
=== Highlights
This release has the following notable changes:
* Nothing has happened.
[[sec-release-21.11-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
"21.11" or later.
* Nothing has happened.

View file

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

View file

@ -18,7 +18,6 @@ esac
find . -name '*.nix' \
! -path ./modules/programs/irssi.nix \
\
! -path ./home-manager/default.nix \
! -path ./home-manager/home-manager.nix \
! -path ./modules/default.nix \
! -path ./modules/files.nix \
@ -26,32 +25,24 @@ find . -name '*.nix' \
! -path ./modules/lib/default.nix \
! -path ./modules/lib/file-type.nix \
! -path ./modules/manual.nix \
! -path ./modules/misc/dconf.nix \
! -path ./modules/misc/news.nix \
! -path ./modules/misc/nixpkgs.nix \
! -path ./modules/misc/xdg.nix \
! -path ./modules/modules.nix \
! -path ./modules/programs/afew.nix \
! -path ./modules/programs/bash.nix \
! -path ./modules/programs/firefox.nix \
! -path ./modules/programs/gpg.nix \
! -path ./modules/programs/lesspipe.nix \
! -path ./modules/programs/ssh.nix \
! -path ./modules/programs/tmux.nix \
! -path ./modules/programs/zsh.nix \
! -path ./modules/services/gpg-agent.nix \
! -path ./modules/services/kbfs.nix \
! -path ./modules/services/keybase.nix \
! -path ./modules/services/mpd.nix \
! -path ./modules/services/sxhkd.nix \
! -path ./modules/services/window-managers/i3.nix \
! -path ./modules/systemd.nix \
! -path ./nix-darwin/default.nix \
! -path ./tests/default.nix \
! -path ./tests/modules/home-environment/default.nix \
! -path ./tests/modules/home-environment/session-variables.nix \
! -path ./tests/modules/programs/gpg/override-defaults.nix \
! -path ./tests/modules/programs/tmux/default.nix \
! -path ./tests/modules/programs/zsh/session-variables.nix \
! -path ./tests/modules/services/sxhkd/service.nix \
! -path ./tests/modules/systemd/services.nix \

View file

@ -62,6 +62,7 @@
# generations
# help
# news
# option
# packages
# remove-generations
# switch
@ -86,6 +87,7 @@
#
# help
# edit
# option
# build
# switch
# generations
@ -131,6 +133,9 @@
#
# edit Open the home configuration in $EDITOR
#
# option OPTION.NAME
# Inspect configuration option named OPTION.NAME.
#
# build Build configuration into result directory
#
# switch Build and activate configuration
@ -278,14 +283,15 @@ _home-manager_completions ()
#--------------------------#
local Subcommands
Subcommands=( "help" "edit" "build" "instantiate" "switch" "generations" "remove-generations" "expire-generations" "packages" "news" "uninstall" )
Subcommands=( "help" "edit" "option" "build" "instantiate" "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" )
Options=( "-f" "--file" "-b" "-A" "-I" "-h" "--help" "-n" "--dry-run" "-v" "--verbose" \
"--cores" "--debug" "--keep-failed" "--keep-going" "-j" "--max-jobs" "--no-substitute" "--show-trace" "--substitute")
# ^ « home-manager »'s options.
@ -353,4 +359,4 @@ _home-manager_completions ()
complete -F _home-manager_completions -o default home-manager
#complete -W "help edit build switch generations remove-generations expire-generations packages news" home-manager
#complete -W "help edit option build switch generations remove-generations expire-generations packages news" home-manager

View file

@ -0,0 +1,59 @@
#compdef home-manager
local state ret=1
_arguments \
'-A[attribute]:ATTRIBUTE:()' \
'-I[search path]:PATH:_files -/' \
'-b[backup files]:EXT:()' \
'--cores[cores]:NUM:()' \
'--debug[debug]' \
'--keep-failed[keep failed]' \
'--keep-going[keep going]' \
'(-h --help)'{--help,-h}'[help]' \
'(-v --verbose)'{--verbose,-v}'[verbose]' \
'(-n --dry-run)'{--dry-run,-n}'[dry run]' \
'(-f --file)'{--file,-f}'[configuration file]:FILE:_files' \
'(-j --max-jobs)'{--max-jobs,-j}'[max jobs]:NUM:()' \
'--option[option]:NAME VALUE:()' \
'--show-trace[show trace]' \
'1: :->cmds' \
'*:: :->args' && ret=0
case "$state" in
cmds)
_values 'command' \
'help[help]' \
'edit[edit]' \
'option[inspect option]' \
'build[build]' \
'switch[switch]' \
'generations[list generations]' \
'remove-generations[remove generations]' \
'expire-generations[expire generations]' \
'packages[managed packages]' \
'news[read the news]' \
'uninstall[uninstall]' && ret=0
;;
args)
case $line[1] in
remove-generations)
_values 'generations' \
$(home-manager generations | cut -d ' ' -f 5) && ret=0
;;
build|switch)
_arguments \
'--cores[cores]:NUM:()' \
'--debug[debug]' \
'--keep-failed[keep failed]' \
'--keep-going[keep going]' \
'--max-jobs[max jobs]:NUM:()' \
'--no-substitute[no substitute]' \
'--option[option]:NAME VALUE:()' \
'--show-trace[show trace]' \
'--substitute[substitute]'
;;
esac
esac
return ret

View file

@ -1,20 +1,20 @@
{ runCommand, lib, bash, coreutils, findutils, gnused, less
{ runCommand, lib, bash, callPackage, coreutils, findutils, gnused, less
# used for pkgs.path for nixos-option
, pkgs
# Extra path to Home Manager. If set then this path will be tried
# before `$HOME/.config/nixpkgs/home-manager` and
# `$HOME/.nixpkgs/home-manager`.
, path ? null
}:
# Extra path to Home Manager. If set then this path will be tried
# before `$HOME/.config/nixpkgs/home-manager` and
# `$HOME/.nixpkgs/home-manager`.
, path ? null }:
let
pathStr = if path == null then "" else path;
in
nixos-option =
callPackage (pkgs.path + "/nixos/modules/installer/tools/nixos-option") { };
runCommand
"home-manager"
{
in runCommand "home-manager" {
preferLocalBuild = true;
allowSubstitutes = false;
meta = with lib; {
@ -23,8 +23,7 @@ runCommand
platforms = platforms.unix;
license = licenses.mit;
};
}
''
} ''
install -v -D -m755 ${./home-manager} $out/bin/home-manager
substituteInPlace $out/bin/home-manager \
@ -33,8 +32,11 @@ runCommand
--subst-var-by findutils "${findutils}" \
--subst-var-by gnused "${gnused}" \
--subst-var-by less "${less}" \
--subst-var-by nixos-option "${nixos-option}" \
--subst-var-by HOME_MANAGER_PATH '${pathStr}'
install -D -m755 ${./completion.bash} \
$out/share/bash-completion/completions/home-manager
''
install -D -m755 ${./completion.zsh} \
$out/share/zsh/site-functions/_home-manager
''

View file

@ -1,7 +1,7 @@
#!@bash@/bin/bash
# Prepare to use tools from Nixpkgs.
PATH=@coreutils@/bin:@findutils@/bin:@gnused@/bin:@less@/bin${PATH:+:}$PATH
PATH=@coreutils@/bin:@findutils@/bin:@gnused@/bin:@less@/bin:@nixos-option@/bin${PATH:+:}$PATH
set -euo pipefail
@ -74,7 +74,75 @@ function setHomeManagerNixPath() {
done
}
function setFlakeAttribute() {
local configFlake="${XDG_CONFIG_HOME:-$HOME/.config}/nixpkgs/flake.nix"
if [[ -z $FLAKE_ARG && ! -v HOME_MANAGER_CONFIG && -e "$configFlake" ]]; then
FLAKE_ARG="$(dirname "$(readlink -f "$configFlake")")"
fi
if [[ -n "$FLAKE_ARG" ]]; then
local flake="${FLAKE_ARG%#*}"
case $FLAKE_ARG in
*#*)
local name="${FLAKE_ARG#*#}"
;;
*)
local name="$USER@$(hostname)"
if [ "$(nix eval "$flake#homeConfigurations" --apply "x: x ? \"$name\"")" = "false" ]; then
name="$USER"
fi
;;
esac
export FLAKE_CONFIG_URI="$flake#homeConfigurations.\"$name\""
fi
}
function doInspectOption() {
setFlakeAttribute
if [[ -v FLAKE_CONFIG_URI ]]; then
errorEcho "Can't inspect options of a flake configuration"
exit 1
fi
setConfigFile
setHomeManagerNixPath
local extraArgs=("$@")
for p in "${EXTRA_NIX_PATH[@]}"; do
extraArgs=("${extraArgs[@]}" "-I" "$p")
done
if [[ -v VERBOSE ]]; then
extraArgs=("${extraArgs[@]}" "--show-trace")
fi
local HOME_MANAGER_CONFIG_NIX HOME_MANAGER_CONFIG_ATTRIBUTE_NIX
HOME_MANAGER_CONFIG_NIX=${HOME_MANAGER_CONFIG//'\'/'\\'}
HOME_MANAGER_CONFIG_NIX=${HOME_MANAGER_CONFIG_NIX//'"'/'\"'}
HOME_MANAGER_CONFIG_NIX=${HOME_MANAGER_CONFIG_NIX//$'\n'/$'\\n'}
HOME_MANAGER_CONFIG_ATTRIBUTE_NIX=${HOME_MANAGER_CONFIG_ATTRIBUTE//'\'/'\\'}
HOME_MANAGER_CONFIG_ATTRIBUTE_NIX=${HOME_MANAGER_CONFIG_ATTRIBUTE_NIX//'"'/'\"'}
HOME_MANAGER_CONFIG_ATTRIBUTE_NIX=${HOME_MANAGER_CONFIG_ATTRIBUTE_NIX//$'\n'/$'\\n'}
local modulesExpr
modulesExpr="let confPath = \"${HOME_MANAGER_CONFIG_NIX}\"; "
modulesExpr+="confAttr = \"${HOME_MANAGER_CONFIG_ATTRIBUTE_NIX}\"; in "
modulesExpr+="(import <home-manager/modules> {"
modulesExpr+=" configuration = if confAttr == \"\" then confPath else (import confPath).\${confAttr};"
modulesExpr+=" pkgs = import <nixpkgs> {}; check = true; })"
nixos-option \
--options_expr "$modulesExpr.options" \
--config_expr "$modulesExpr.config" \
"${extraArgs[@]}" \
"${PASSTHROUGH_OPTS[@]}"
}
function doInstantiate() {
setFlakeAttribute
if [[ -v FLAKE_CONFIG_URI ]]; then
errorEcho "Can't instantiate a flake configuration"
exit 1
fi
setConfigFile
setHomeManagerNixPath
@ -178,6 +246,17 @@ function doBuild() {
return 1
fi
setFlakeAttribute
if [[ -v FLAKE_CONFIG_URI ]]; then
local exitCode=0
nix build \
"${PASSTHROUGH_OPTS[@]}" \
${DRY_RUN+--dry-run} \
"$FLAKE_CONFIG_URI.activationPackage" \
|| exitCode=1
return $exitCode
fi
setWorkDir
local newsInfo
@ -194,6 +273,16 @@ function doBuild() {
}
function doSwitch() {
setFlakeAttribute
if [[ -v FLAKE_CONFIG_URI ]]; then
local exitCode=0
nix run \
"${PASSTHROUGH_OPTS[@]}" \
"$FLAKE_CONFIG_URI.activationPackage" \
|| exitCode=1
return $exitCode
fi
setWorkDir
local newsInfo
@ -221,7 +310,7 @@ function doSwitch() {
function doListGens() {
# Whether to colorize the generations output.
local color="never"
if [[ -t 1 ]]; then
if [[ ! -v NO_COLOR && -t 1 ]]; then
color="always"
fi
@ -414,6 +503,7 @@ 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 " --flake flake-uri Use home-manager configuration at flake-uri"
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"
@ -421,10 +511,12 @@ function doHelp() {
echo
echo "Options passed on to nix-build(1)"
echo
echo " --arg(str) NAME VALUE Override inputs passed to home-manager.nix"
echo " --cores NUM"
echo " --debug"
echo " --keep-failed"
echo " --keep-going"
echo " --max-jobs NUM"
echo " -j, --max-jobs NUM"
echo " --option NAME VALUE"
echo " --show-trace"
echo " --(no-)substitute"
@ -435,6 +527,9 @@ function doHelp() {
echo
echo " edit Open the home configuration in \$EDITOR"
echo
echo " option OPTION.NAME"
echo " Inspect configuration option named OPTION.NAME."
echo
echo " build Build configuration into result directory"
echo
echo " instantiate Instantiate the configuration and print the resulting derivation"
@ -466,12 +561,13 @@ HOME_MANAGER_CONFIG_ATTRIBUTE=""
PASSTHROUGH_OPTS=()
COMMAND=""
COMMAND_ARGS=()
FLAKE_ARG=""
while [[ $# -gt 0 ]]; do
opt="$1"
shift
case $opt in
build|instantiate|edit|expire-generations|generations|help|news|packages|remove-generations|switch|uninstall)
build|instantiate|option|edit|expire-generations|generations|help|news|packages|remove-generations|switch|uninstall)
COMMAND="$opt"
;;
-A)
@ -490,6 +586,21 @@ while [[ $# -gt 0 ]]; do
HOME_MANAGER_CONFIG="$1"
shift
;;
--flake)
FLAKE_ARG="$1"
shift
;;
--recreate-lock-file|--no-update-lock-file|--no-write-lock-file|--no-registries|--commit-lock-file)
PASSTHROUGH_OPTS+=("$opt")
;;
--update-input)
PASSTHROUGH_OPTS+=("$opt" "$1")
shift
;;
--override-input)
PASSTHROUGH_OPTS+=("$opt" "$1" "$2")
shift 2
;;
-h|--help)
doHelp
exit 0
@ -497,24 +608,28 @@ while [[ $# -gt 0 ]]; do
-n|--dry-run)
export DRY_RUN=1
;;
--option)
--option|--arg|--argstr)
PASSTHROUGH_OPTS+=("$opt" "$1" "$2")
shift 2
;;
--max-jobs|--cores)
-j|--max-jobs|--cores)
PASSTHROUGH_OPTS+=("$opt" "$1")
shift
;;
--keep-failed|--keep-going|--show-trace\
--debug|--keep-failed|--keep-going|--show-trace\
|--substitute|--no-substitute)
PASSTHROUGH_OPTS+=("$opt")
;;
-v|--verbose)
export VERBOSE=1
;;
--version)
echo 21.11
exit 0
;;
*)
case $COMMAND in
expire-generations|remove-generations)
expire-generations|remove-generations|option)
COMMAND_ARGS+=("$opt")
;;
*)
@ -559,6 +674,9 @@ case $COMMAND in
doExpireGenerations "${COMMAND_ARGS[@]}"
fi
;;
option)
doInspectOption "${COMMAND_ARGS[@]}"
;;
packages)
doListPackages
;;

View file

@ -45,7 +45,7 @@ runCommand "home-manager-install" {
# 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 = "20.09";
home.stateVersion = "21.11";
}
EOF
fi

View file

@ -332,7 +332,10 @@ let
(mkIf (config.flavor == "gmail.com") {
userName = mkDefault config.address;
imap = { host = "imap.gmail.com"; };
imap = {
host = "imap.gmail.com";
port = 993;
};
smtp = {
host = "smtp.gmail.com";

View file

@ -0,0 +1,46 @@
# The glibc package in Nixpkgs is patched to make it possible to specify
# an alternative path for the locale archive through a special environment
# variable. This would allow different versions of glibc to coexist on the
# same system because each version of glibc could look up different paths
# for its locale archive should the archive format ever change in
# incompatible ways.
#
# See also:
# - localedef(1)
# - https://nixos.org/manual/nixpkgs/stable/#locales
# - https://github.com/NixOS/nixpkgs/issues/38991
#
# Note, the name of the said environment variable gets updated with each
# breaking release of the glibcLocales package. Periodically check the link
# below for changes:
# https://github.com/NixOS/nixpkgs/blob/nixpkgs-unstable/pkgs/development/libraries/glibc/nix-locale-archive.patch
{ lib, pkgs, ... }:
with lib;
let
inherit (pkgs.glibcLocales) version;
archivePath = "${pkgs.glibcLocales}/lib/locale/locale-archive";
# lookup the version of glibcLocales and set the appropriate environment vars
localeVars = if versionAtLeast version "2.27" then {
LOCALE_ARCHIVE_2_27 = archivePath;
} else if versionAtLeast version "2.11" then {
LOCALE_ARCHIVE_2_11 = archivePath;
} else
{ };
in {
meta.maintainers = with maintainers; [ midchildan ];
config = {
# For shell sessions.
home.sessionVariables = localeVars;
# For desktop apps.
systemd.user.sessionVariables = localeVars;
};
}

View file

@ -1,9 +1,11 @@
{ configuration
, pkgs
, lib ? pkgs.stdenv.lib
, lib ? pkgs.lib
# Whether to check that each option has a matching declaration.
, check ? true
# Extra arguments passed to specialArgs.
, extraSpecialArgs ? { }
}:
with lib;
@ -31,7 +33,7 @@ let
modules = [ configuration ] ++ hmModules;
specialArgs = {
modulesPath = builtins.toString ./.;
};
} // extraSpecialArgs;
};
module = showWarnings (

View file

@ -39,6 +39,28 @@ in
};
config = {
assertions = [(
let
dups =
attrNames
(filterAttrs (n: v: v > 1)
(foldAttrs (acc: v: acc + v) 0
(mapAttrsToList (n: v: { ${v.target} = 1; }) cfg)));
dupsStr = concatStringsSep ", " dups;
in {
assertion = dups == [];
message = ''
Conflicting managed target files: ${dupsStr}
This may happen, for example, if you have a configuration similar to
home.file = {
conflict1 = { source = ./foo.nix; target = "baz"; };
conflict2 = { source = ./bar.nix; target = "baz"; };
}'';
})
];
lib.file.mkOutOfStoreSymlink = path:
let
pathStr = toString path;
@ -53,7 +75,7 @@ in
# Paths that should be forcibly overwritten by Home Manager.
# Caveat emptor!
forcedPaths =
concatMapStringsSep " " (p: ''"$HOME/${p}"'')
concatMapStringsSep " " (p: ''"$HOME"/${escapeShellArg p}'')
(mapAttrsToList (n: v: v.target)
(filterAttrs (n: v: v.force) cfg));
@ -62,7 +84,7 @@ in
# 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/*"
homeFilePattern="$(readlink -e ${escapeShellArg builtins.storeDir})/*-home-manager-files/*"
forcedPaths=(${forcedPaths})
@ -140,7 +162,7 @@ in
# source and target generation.
home.activation.linkGeneration = hm.dag.entryAfter ["writeBoundary"] (
let
link = pkgs.writeText "link" ''
link = pkgs.writeShellScript "link" ''
newGenFiles="$1"
shift
for sourcePath in "$@" ; do
@ -155,12 +177,12 @@ in
done
'';
cleanup = pkgs.writeText "cleanup" ''
cleanup = pkgs.writeShellScript "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/*"
homeFilePattern="$(readlink -e ${escapeShellArg builtins.storeDir})/*-home-manager-files/*"
newGenFiles="$1"
shift 1
@ -235,18 +257,34 @@ in
);
home.activation.checkFilesChanged = hm.dag.entryBefore ["linkGeneration"] (
''
let
homeDirArg = escapeShellArg homeDirectory;
in ''
function _cmp() {
if [[ -d $1 && -d $2 ]]; then
diff -rq "$1" "$2" &> /dev/null
else
cmp --quiet "$1" "$2"
fi
}
declare -A changedFiles
'' + concatMapStrings (v: ''
cmp --quiet "${sourceStorePath v}" "${homeDirectory}/${v.target}" \
&& changedFiles["${v.target}"]=0 \
|| changedFiles["${v.target}"]=1
'' + concatMapStrings (v:
let
sourceArg = escapeShellArg (sourceStorePath v);
targetArg = escapeShellArg v.target;
in ''
_cmp ${sourceArg} ${homeDirArg}/${targetArg} \
&& changedFiles[${targetArg}]=0 \
|| changedFiles[${targetArg}]=1
'') (filter (v: v.onChange != "") (attrValues cfg))
+ ''
unset -f _cmp
''
);
home.activation.onFilesChange = hm.dag.entryAfter ["linkGeneration"] (
concatMapStrings (v: ''
if [[ ${"$\{changedFiles"}["${v.target}"]} -eq 1 ]]; then
if [[ ''${changedFiles[${escapeShellArg v.target}]} -eq 1 ]]; then
${v.onChange}
fi
'') (filter (v: v.onChange != "") (attrValues cfg))
@ -254,12 +292,10 @@ in
# Symlink directories and files that have the right execute bit.
# Copy files that need their execute bit changed.
home-files = pkgs.runCommand
home-files = pkgs.runCommandLocal
"home-manager-files"
{
nativeBuildInputs = [ pkgs.xorg.lndir ];
preferLocalBuild = true;
allowSubstitutes = false;
}
(''
mkdir -p $out
@ -273,6 +309,15 @@ in
local executable="$3"
local recursive="$4"
# If the target already exists then we have a collision. Note, this
# should not happen due to the assertion found in the 'files' module.
# We therefore simply log the conflict and otherwise ignore it, mainly
# to make the `files-target-config` test work as expected.
if [[ -e "$realOut/$relTarget" ]]; then
echo "File conflict for file '$relTarget'" >&2
return
fi
# Figure out the real absolute path to the target.
local target
target="$(realpath -m "$realOut/$relTarget")"

View file

@ -390,6 +390,21 @@ in
Extra commands to run in the Home Manager profile builder.
'';
};
home.enableNixpkgsReleaseCheck = mkOption {
type = types.bool;
default = true;
description = ''
Determines whether to check for release version mismatch between Home
Manager and Nixpkgs. Using mismatched versions is likely to cause errors
and unexpected behavior. It is therefore highly recommended to use a
release of Home Manager than corresponds with your chosen release of
Nixpkgs.
</para><para>
When this option is enabled and a mismatch is detected then a warning
will be printed when the user configuration is being built.
'';
};
};
config = {
@ -404,6 +419,31 @@ in
}
];
warnings =
let
hmRelease = fileContents ../.release;
nixpkgsRelease = pkgs.lib.trivial.release;
releaseMismatch =
config.home.enableNixpkgsReleaseCheck
&& hmRelease != nixpkgsRelease;
in
optional releaseMismatch ''
You are using
Home Manager version ${hmRelease} and
Nixpkgs version ${nixpkgsRelease}.
Using mismatched versions is likely to cause errors and unexpected
behavior. It is therefore highly recommended to use a release of Home
Manager than corresponds with your chosen release of Nixpkgs.
If you insist then you can disable this warning by adding
home.enableNixpkgsReleaseCheck = false;
to your configuration.
'';
home.username =
mkIf (versionOlder config.home.stateVersion "20.09")
(mkDefault (builtins.getEnv "USER"));
@ -493,7 +533,24 @@ in
''
else
''
$DRY_RUN_CMD nix-env -i ${cfg.path}
if ! $DRY_RUN_CMD nix-env -i ${cfg.path} ; then
cat <<EOF
Oops, nix-env failed to install your new Home Manager profile!
Perhaps there is a conflict with a package that was installed using
'nix-env -i'? Try running
nix-env -q
and if there is a conflicting package you can remove it with
nix-env -e {package name}
Then try activating your Home Manager configuration again.
EOF
exit 1
fi
''
);
@ -524,9 +581,7 @@ in
]
+ optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH";
activationScript = pkgs.writeScript "activation-script" ''
#!${pkgs.runtimeShell}
activationScript = pkgs.writeShellScript "activation-script" ''
set -eu
set -o pipefail
@ -552,6 +607,9 @@ in
cp ${activationScript} $out/activate
mkdir $out/bin
ln -s $out/activate $out/bin/home-manager-generation
substituteInPlace $out/activate \
--subst-var-by GENERATION_DIR $out

View file

@ -0,0 +1,102 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.i18n.inputMethod;
gtk2Cache = pkgs.runCommandLocal "gtk2-immodule.cache" {
buildInputs = [ pkgs.gtk2 cfg.package ];
} ''
mkdir -p $out/etc/gtk-2.0/
GTK_PATH=${cfg.package}/lib/gtk-2.0/ \
gtk-query-immodules-2.0 > $out/etc/gtk-2.0/immodules.cache
'';
gtk3Cache = pkgs.runCommandLocal "gtk3-immodule.cache" {
buildInputs = [ pkgs.gtk3 cfg.package ];
} ''
mkdir -p $out/etc/gtk-3.0/
GTK_PATH=${cfg.package}/lib/gtk-3.0/ \
gtk-query-immodules-3.0 > $out/etc/gtk-3.0/immodules.cache
'';
in {
imports =
[ ./fcitx.nix ./fcitx5.nix ./hime.nix ./kime.nix ./nabi.nix ./uim.nix ];
options.i18n = {
inputMethod = {
enabled = mkOption {
type = types.nullOr
(types.enum [ "fcitx" "fcitx5" "nabi" "uim" "hime" "kime" ]);
default = null;
example = "fcitx";
description = ''
Select the enabled input method. Input methods is a software to input
symbols that are not available on standard input devices.
</para><para>
Input methods are specially used to input Chinese, Japanese and Korean
characters.
</para><para>
Currently the following input methods are available in Home Manager:
<variablelist>
<varlistentry>
<term><literal>fcitx</literal></term>
<listitem><para>
A customizable lightweight input method
extra input engines can be added using
<literal>i18n.inputMethod.fcitx.engines</literal>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><literal>fcitx5</literal></term>
<listitem><para>
The next generation of fcitx,
addons (including engines, dictionaries, skins) can be added using
<literal>i18n.inputMethod.fcitx5.addons</literal>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><literal>nabi</literal></term>
<listitem><para>
A Korean input method based on XIM. Nabi doesn't support Qt 5.
</para></listitem>
</varlistentry>
<varlistentry>
<term><literal>uim</literal></term>
<listitem><para>
The universal input method, is a library with a XIM bridge.
uim mainly support Chinese, Japanese and Korean.
</para></listitem>
</varlistentry>
<varlistentry>
<term><literal>hime</literal></term>
<listitem><para>An extremely easy-to-use input method framework.</para></listitem>
</varlistentry>
<varlistentry>
<term><literal>kime</literal></term>
<listitem><para>A Korean IME.</para></listitem>
</varlistentry>
</variablelist>
'';
};
package = mkOption {
internal = true;
type = types.nullOr types.path;
default = null;
description = ''
The input method method package.
'';
};
};
};
config = mkIf (cfg.enabled != null) {
home.packages = [ cfg.package gtk2Cache gtk3Cache ];
};
meta.maintainers = with lib; [ hm.maintainers.kranzes ];
}

View file

@ -0,0 +1,50 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.i18n.inputMethod.fcitx;
fcitxPackage = pkgs.fcitx.override { plugins = cfg.engines; };
fcitxEngine = types.package // {
name = "fcitx-engine";
check = x:
types.package.check x && attrByPath [ "meta" "isFcitxEngine" ] false x;
};
in {
options = {
i18n.inputMethod.fcitx = {
engines = mkOption {
type = with types; listOf fcitxEngine;
default = [ ];
example = literalExample "with pkgs.fcitx-engines; [ mozc hangul ]";
description = let
enginesDrv = filterAttrs (const isDerivation) pkgs.fcitx-engines;
engines = concatStringsSep ", "
(map (name: "<literal>${name}</literal>") (attrNames enginesDrv));
in "Enabled Fcitx engines. Available engines are: ${engines}.";
};
};
};
config = mkIf (config.i18n.inputMethod.enabled == "fcitx") {
i18n.inputMethod.package = fcitxPackage;
home.sessionVariables = {
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
};
systemd.user.services.fcitx-daemon = {
Unit = {
Description = "Fcitx input method editor";
PartOf = [ "graphical-session.desktop" ];
};
Service.ExecStart = "${fcitxPackage}/bin/fcitx";
Install.WantedBy = [ "graphical-session.target" ];
};
};
}

View file

@ -0,0 +1,42 @@
{ config, pkgs, lib, ... }:
with lib;
let
im = config.i18n.inputMethod;
cfg = im.fcitx5;
fcitx5Package = pkgs.fcitx5-with-addons.override { inherit (cfg) addons; };
in {
options = {
i18n.inputMethod.fcitx5 = {
addons = mkOption {
type = with types; listOf package;
default = [ ];
example = literalExample "with pkgs; [ fcitx5-rime ]";
description = ''
Enabled Fcitx5 addons.
'';
};
};
};
config = mkIf (im.enabled == "fcitx5") {
i18n.inputMethod.package = fcitx5Package;
home.sessionVariables = {
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
};
systemd.user.services.fcitx5-daemon = {
Unit = {
Description = "Fcitx5 input method editor";
PartOf = [ "graphical-session.target" ];
};
Service.ExecStart = "${fcitx5Package}/bin/fcitx5";
Install.WantedBy = [ "graphical-session.target" ];
};
};
}

View file

@ -0,0 +1,23 @@
{ config, pkgs, lib, ... }:
with lib; {
config = mkIf (config.i18n.inputMethod.enabled == "hime") {
i18n.inputMethod.package = pkgs.hime;
home.sessionVariables = {
GTK_IM_MODULE = "hime";
QT_IM_MODULE = "hime";
XMODIFIERS = "@im=hime";
};
systemd.user.services.hime-daemon = {
Unit = {
Description = "Hime input method editor";
PartOf = [ "graphical-session.desktop" ];
};
Service.ExecStart = "${pkgs.hime}/bin/hime";
Install.WantedBy = [ "graphical-session.target" ];
};
};
}

View file

@ -0,0 +1,58 @@
{ config, pkgs, lib, generators, ... }:
with lib;
let
cfg = config.i18n.inputMethod.kime;
yamlFormat = pkgs.formats.yaml { };
in {
options = {
i18n.inputMethod.kime = {
config = mkOption {
type = yamlFormat.type;
default = { };
example = literalExample ''
{
daemon = {
modules = ["Xim" "Indicator"];
};
indicator = {
icon_color = "White";
};
engine = {
hangul = {
layout = "dubeolsik";
};
};
}
'';
description = ''
kime configuration. Refer to
<link xlink:href="https://github.com/Riey/kime/blob/develop/docs/CONFIGURATION.md"/>
for details on supported values.
'';
};
};
};
config = mkIf (config.i18n.inputMethod.enabled == "kime") {
i18n.inputMethod.package = pkgs.kime;
home.sessionVariables = {
GTK_IM_MODULE = "kime";
QT_IM_MODULE = "kime";
XMODIFIERS = "@im=kime";
};
xdg.configFile."kime/config.yaml".text =
replaceStrings [ "\\\\" ] [ "\\" ] (builtins.toJSON cfg.config);
systemd.user.services.kime-daemon = {
Unit = { Description = "Kime input method editor"; };
PartOf = [ "graphical-session.target" ];
Service.ExecStart = "${pkgs.kime}/bin/kime";
Install.WantedBy = [ "graphical-session.target" ];
};
};
}

View file

@ -0,0 +1,23 @@
{ config, pkgs, lib, ... }:
with lib; {
config = mkIf (config.i18n.inputMethod.enabled == "nabi") {
i18n.inputMethod.package = pkgs.nabi;
home.sessionVariables = {
GTK_IM_MODULE = "nabi";
QT_IM_MODULE = "nabi";
XMODIFIERS = "@im=nabi";
};
systemd.user.services.nabi-daemon = {
Unit = {
Description = "Nabi input method editor";
PartOf = [ "graphical-session.desktop" ];
};
Service.ExecStart = "${pkgs.nabi}/bin/nabi";
Install.WantedBy = [ "graphical-session.target" ];
};
};
}

View file

@ -0,0 +1,45 @@
{ config, pkgs, lib, ... }:
with lib;
let cfg = config.i18n.inputMethod.uim;
in {
options = {
i18n.inputMethod.uim = {
toolbar = mkOption {
type = types.enum [ "gtk" "gtk3" "gtk-systray" "gtk3-systray" "qt4" ];
default = "gtk";
example = "gtk-systray";
description = ''
Selected UIM toolbar.
'';
};
};
};
config = mkIf (config.i18n.inputMethod.enabled == "uim") {
i18n.inputMethod.package = pkgs.uim;
home.sessionVariables = {
GTK_IM_MODULE = "uim";
QT_IM_MODULE = "uim";
XMODIFIERS = "@im=uim";
};
systemd.user.services.uim-daemon = {
Unit = {
Description = "Uim input method editor";
PartOf = [ "graphical-session.desktop" ];
};
Service.ExecStart = toString
(pkgs.writeShellScript "start-uim-xim-and-uim-toolbar" ''
${pkgs.uim}/bin/uim-xim &
${pkgs.uim}/bin/uim-toolbar-${cfg.toolbar}
'');
Install.WantedBy = [ "graphical-session.target" ];
};
};
}

View file

@ -1,5 +1,7 @@
# The check for terminal output and color support is heavily inspired
# by https://unix.stackexchange.com/a/10065.
#
# Allow opt out by respecting the `NO_COLOR` environment variable.
function setupColors() {
normalColor=""
@ -7,8 +9,8 @@ function setupColors() {
warnColor=""
noteColor=""
# Check if stdout is a terminal.
if [[ -t 1 ]]; then
# Enable colors for terminals, and allow opting out.
if [[ ! -v NO_COLOR && -t 1 ]]; then
# See if it supports colors.
local ncolors
ncolors=$(tput colors)

View file

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

View file

@ -25,10 +25,94 @@
github = "cwyc";
githubId = 16950437;
};
chisui = {
name = "Philipp Dargel";
email = "chisui@users.noreply.github.com";
github = "chisui";
githubId = 4526429;
};
olmokramer = {
name = "Olmo Kramer";
email = "olmokramer@users.noreply.github.com";
github = "olmokramer";
githubId = 3612514;
};
kalhauge = {
name = "Christian Gram Kalhauge";
email = "kalhauge@users.noreply.github.com";
github = "kalhauge";
githubId = 1182166;
};
kamadorueda = {
name = "Kevin Amado";
email = "kamadorueda@gmail.com";
github = "kamadorueda";
githubId = 47480384;
keys = [{
longkeyid = "rsa4096/0x04D0CEAF916A9A40";
fingerprint = "2BE3 BAFD 793E A349 ED1F F00F 04D0 CEAF 916A 9A40";
}];
};
kubukoz = {
name = "Jakub Kozłowski";
email = "kubukoz@users.noreply.github.com";
github = "kubukoz";
githubId = 894884;
};
matrss = {
name = "Matthias Riße";
email = "matrss@users.noreply.github.com";
github = "matrss";
githubId = 9308656;
};
seylerius = {
email = "sable@seyleri.us";
name = "Sable Seyler";
github = "seylerius";
githubId = 1145981;
keys = [{
logkeyid = "rsa4096/0x68BF2EAE6D91CAFF";
fingerprint = "F0E0 0311 126A CD72 4392 25E6 68BF 2EAE 6D91 CAFF";
}];
};
thiagokokada = {
email = "thiagokokada@gmail.com";
name = "Thiago Kenji Okada";
github = "thiagokokada";
githubId = 844343;
};
fendse = {
email = "46252070+Fendse@users.noreply.github.com";
github = "Fendse";
githubId = 46252070;
name = "Sara Johnsson";
};
msfjarvis = {
email = "me@msfjarvis.dev";
github = "msfjarvis";
githubId = "13348378";
name = "Harsh Shandilya";
keys = [{
longkeyid = "rsa4096/0xB7843F823355E9B9";
fingerprint = "8F87 050B 0F9C B841 1515 7399 B784 3F82 3355 E9B9";
}];
};
ambroisie = {
email = "bruno.home-manager@belanyi.fr";
github = "ambroisie";
githubId = 12465195;
name = "Bruno BELANYI";
};
malvo = {
email = "malte@malvo.org";
github = "malte-v";
githubId = 34393802;
name = "Malte Voos";
};
kranzes = {
email = "personal@ilanjoselevich.com";
github = "Kranzes";
githubId = 56614642;
name = "Ilan Joselevich";
};
}

View file

@ -47,9 +47,18 @@ in rec {
name = mkOption {
type = types.str;
example = "DejaVu Sans 8";
example = "DejaVu Sans";
description = ''
The family name and size of the font within the package.
The family name of the font within the package.
'';
};
size = mkOption {
type = types.nullOr types.int;
default = null;
example = "8";
description = ''
The size of the font.
'';
};
};

View file

@ -8,12 +8,9 @@ let
toDconfIni = generators.toINI { mkKeyValue = mkIniKeyValue; };
mkIniKeyValue = key: value:
"${key}=${toString (hm.gvariant.mkValue value)}";
mkIniKeyValue = key: value: "${key}=${toString (hm.gvariant.mkValue value)}";
in
{
in {
meta.maintainers = [ maintainers.gnidorah maintainers.rycee ];
options = {
@ -29,7 +26,7 @@ in
settings = mkOption {
type = with types; attrsOf (attrsOf hm.types.gvariant);
default = {};
default = { };
example = literalExample ''
{
"org/gnome/calculator" = {
@ -48,12 +45,13 @@ in
};
};
config = mkIf (cfg.enable && cfg.settings != {}) {
home.activation.dconfSettings = hm.dag.entryAfter ["installPackages"] (
let
iniFile = pkgs.writeText "hm-dconf.ini" (toDconfIni cfg.settings);
in
''
config = mkIf (cfg.enable && cfg.settings != { }) {
# Make sure the dconf directory exists.
xdg.configFile."dconf/.keep".source = builtins.toFile "keep" "";
home.activation.dconfSettings = hm.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
@ -67,7 +65,6 @@ in
fi
unset DCONF_DBUS_RUN_SESSION
''
);
'');
};
}

View file

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

View file

@ -116,6 +116,9 @@ in
#
# date --iso-8601=second --universal
#
# On darwin (or BSD like systems) use
#
# date -u +'%Y-%m-%dT%H:%M:%S+00:00'
news.entries = [
{
time = "2017-09-01T10:56:28+00:00";
@ -1720,6 +1723,401 @@ in
A new module is available: 'programs.gh'.
'';
}
{
time = "2020-11-01T11:17:02+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.caffeine'.
'';
}
{
time = "2020-11-05T22:59:21+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'programs.i3status-rust'.
'';
}
{
time = "2020-11-14T13:02:40+00:00";
condition = config.programs.broot.enable;
message = ''
The 'programs.broot.verbs' option is now a list rather than an
attribute set. To migrate, move the keys of the attrset into the
list items' 'invocation' keys. For example,
programs.broot.verbs = {
"p" = { execution = ":parent"; };
};
becomes
programs.broot.verbs = [
{
invocation = "p";
execution = ":parent";
}
];
'';
}
{
time = "2020-12-01T20:46:14+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.wlsunset'.
'';
}
{
time = "2020-12-09T22:34:33+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.pbgopy'.
'';
}
{
time = "2020-12-18T22:22:25+00:00";
message = ''
A new module is available: 'programs.rofi.pass'.
'';
}
{
time = "2020-12-31T14:16:47+00:00";
message = ''
A new module is available: 'programs.octant'.
'';
}
{
time = "2021-01-01T08:51:11+00:00";
condition = config.pam.sessionVariables != {};
message = ''
The option 'pam.sessionVariables' will be deprecated in the future.
This is due to PAM 1.5.0 deprecating reading of the user environment.
The deprecation will not take place immediately but you may wish to
consider alternatives to PAM environment variables.
See
https://github.com/nix-community/home-manager/issues/1691
for discussion.
'';
}
{
time = "2021-01-02T07:49:15+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.plan9port'.
'';
}
{
time = "2021-01-31T11:23:30+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.playerctld'.
'';
}
{
time = "2021-01-28T15:07:34+00:00";
condition = hostPlatform.isDarwin;
message = ''
New options are available for 'targets.darwin':
- targets.darwin.defaults
This adds options for configuring macOS through the defaults(1)
system.
- targets.darwin.keybindings
This adds options for configuring the default keybindings for macOS
text fields.
- targets.darwin.search
This adds options for configuring the default search engine for
macOS.
'';
}
{
time = "2021-02-04T22:28:26+00:00";
message = ''
A new module is available: 'programs.sbt'.
'';
}
{
time = "2021-02-20T00:00:00+00:00";
condition = config.services.polybar.enable;
message = ''
The polybar configuration can now be written in a more nix-friendly format.
The new 'services.polybar.settings' option is an alternative to
'services.polybar.config' that supports nested keys and converts nix
lists to polybar-style 'foo-0, foo-1, ...' lists.
'';
}
{
time = "2021-02-25T22:36:43+00:00";
condition = config.programs.git.enable && any (msmtp: msmtp.enable)
(mapAttrsToList (name: account: account.msmtp)
config.accounts.email.accounts);
message = ''
Git will now defer to msmtp for sending emails if
'accounts.email.accounts.<name>.msmtp.enable' is true.
'';
}
{
time = "2021-03-03T22:16:05+00:00";
message = ''
Home Manager now respects the 'NO_COLOR' environment variable as per
https://no-color.org/.
'';
}
{
time = "2021-03-29T21:05:50+00:00";
message = ''
Configuration specified by 'programs.dircolors.extraConfig' is now
applied after 'programs.dircolors.settings'.
'';
}
{
time = "2021-04-11T20:44:54+00:00";
message = ''
A new module is available: 'programs.exa'.
'';
}
{
time = "2021-04-23T10:00:00+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.pass-secret-service'.
'';
}
{
time = "2021-04-26T07:00:00+00:00";
condition = hostPlatform.isLinux;
message = ''
A new service is available: 'services.poweralertd'.
'';
}
{
time = "2021-04-28T10:00:00+00:00";
condition = hostPlatform.isLinux;
message = ''
A new service is available: 'services.mpris-proxy'.
'';
}
{
time = "2021-04-28T12:00:00+00:00";
message = ''
A new module is available: 'programs.topgrade'.
'';
}
{
time = "2021-04-30T22:05:01+00:00";
condition = hostPlatform.isLinux;
message = ''
A new service is available: 'services.barrier'.
'';
}
{
time = "2021-05-01T15:16:08+00:00";
message = ''
A new module is available: 'programs.lazygit'.
'';
}
{
time = "2021-04-27T00:00:00+00:00";
message = ''
A new module is available: 'programs.ncspot'.
'';
}
{
time = "2021-05-02T11:22:42+00:00";
condition = hostPlatform.isLinux && config.services.sxhkd.enable;
message = ''
The sxhkd service now is started using 'xsession.initExtra',
therefore this module loses systemd service management capabilities
and works only if Home Manager starts the user X session.
The option 'services.sxhkd.extraPath' has been deprecated.
'';
}
{
time = "2021-05-06T20:47:37+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.etesync-dav'
'';
}
{
time = "2021-05-06T11:01:41+00:00";
message = ''
A new module is available: 'programs.nix-index'.
'';
}
{
time = "2021-05-10T18:50:07+00:00";
message = ''
A new module is available: 'xdg.systemDirs'. Options are:
- xdg.systemDirs.config
Extra directory names to add to $XDG_CONFIG_DIRS in the user
session.
- xdg.systemDirs.data
Extra directory names to add to $XDG_DATA_DIRS in the user
session.
These variables are visible in both systemd user services and
login shells.
'';
}
{
time = "2021-05-18T12:22:42+00:00";
condition = config.services.syncthing != {};
message = ''
Setting 'services.syncthing.tray' as a boolean will be deprecated in
the future.
This is to make the syncthing tray package configurable, with
`services.syncthing.tray.package`, following QSyncthingTray becoming
no longer actively maintained. The default syncthing tray package has
also changed to https://github.com/Martchus/syncthingtray. To
continue as before, set `services.syncthing.tray.enable`.
See
https://github.com/nix-community/home-manager/pull/1257
for discussion.
'';
}
{
time = "2021-05-18T20:28:50+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'programs.foot'.
'';
}
{
time = "2021-05-23T18:31:38+00:00";
condition = config.programs.mbsync.enable;
message = ''
mbsync channels no longer accepts the masterPattern or slavePattern
attribute keys. This is due to an upstream change.
They have been renamed: masterPattern -> farPattern, and
slavePattern -> nearPattern.
This is a stateful change, where the database file(s) used to keep track
of mail are silently upgraded once you upgrade both your configuration file
and the mbsync program.
Note that this change is non-reversible, meaning once you choose to switch to
near/farPattern, you can no longer use your previous slave/masterPattern
configuration file.
'';
}
{
time = "2021-05-10T20:41:44+00:00";
message = ''
A new module is available: 'programs.rbw'.
'';
}
{
time = "2021-05-30T15:22:10+00:00";
message = ''
A new module is available: 'programs.piston-cli'.
'';
}
{
time = "2021-06-02T04:24:10+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.xidlehook'.
'';
}
{
time = "2021-06-07T20:44:00+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.pantalaimon'.
'';
}
{
time = "2021-06-12T05:00:22+00:00";
message = ''
A new module is available: 'programs.mangohud'.
'';
}
{
time = "2021-06-16T01:26:16+00:00";
condition = hostPlatform.isLinux;
message = ''
The xmonad module now compiles the configuration before
linking the binary to the place xmonad expects to find
the compiled configuration (the binary).
This breaks recompilation of xmonad (i.e. the 'q' binding or
'xmonad --recompile').
If this behavior is undesirable, do not use the
'xsession.windowManager.xmonad.config' option. Instead, set the
contents of the configuration file with
'home.file.".xmonad/config.hs".text = "content of the file"'
or 'home.file.".xmonad/config.hs".source = ./path-to-config'.
'';
}
{
time = "2021-06-24T22:36:11+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'i18n.inputMethod'.
'';
}
{
time = "2021-06-22T14:43:53+00:00";
message = ''
A new module is available: 'programs.himalaya'.
'';
}
];
};
}

View file

@ -21,6 +21,9 @@ in {
<refentrytitle>pam_env.conf</refentrytitle>
<manvolnum>5</manvolnum>
</citerefentry>.
</para><para>
Note, this option will become deprecated in the future and its use is
therefore discouraged.
'';
};
};

View file

@ -44,19 +44,72 @@ in {
</variablelist>
'';
};
style = {
name = mkOption {
type = types.nullOr types.str;
default = null;
example = "adwaita-dark";
relatedPackages = [ "adwaita-qt" [ "libsForQt5" "qtstyleplugins" ] ];
description = ''
Selects the style to use for Qt5 applications.</para>
<para>The options are
<variablelist>
<varlistentry>
<term><literal>adwaita</literal></term>
<term><literal>adwaita-dark</literal></term>
<listitem><para>Use Adwaita Qt style with
<link xlink:href="https://github.com/FedoraQt/adwaita-qt">adwaita</link>
</para></listitem>
</varlistentry>
<varlistentry>
<term><literal>cleanlooks</literal></term>
<term><literal>gtk2</literal></term>
<term><literal>motif</literal></term>
<term><literal>plastique</literal></term>
<listitem><para>Use styles from
<link xlink:href="https://github.com/qt/qtstyleplugins">qtstyleplugins</link>
</para></listitem>
</varlistentry>
</variablelist>
'';
};
package = mkOption {
type = types.nullOr types.package;
default = null;
example = literalExample "pkgs.adwaita-qt";
description = "Theme package to be used in Qt5 applications.";
};
};
};
};
config = mkIf (cfg.enable && cfg.platformTheme != null) {
home.sessionVariables.QT_QPA_PLATFORMTHEME =
assertions = [{
assertion = (cfg.platformTheme == "gnome")
-> ((cfg.style.name != null) && (cfg.style.package != null));
message = ''
`qt.platformTheme` "gnome" must have `qt.style` set to a theme that
supports both Qt and Gtk, for example "adwaita" or "adwaita-dark".
'';
}];
# Necessary because home.sessionVariables is of types.attrs
home.sessionVariables = (filterAttrs (n: v: v != null) {
QT_QPA_PLATFORMTHEME =
if cfg.platformTheme == "gnome" then "gnome" else "gtk2";
QT_STYLE_OVERRIDE = cfg.style.name;
});
home.packages = if cfg.platformTheme == "gnome" then
[ pkgs.qgnomeplatform ]
++ lib.optionals (cfg.style.package != null) [ cfg.style.package ]
else
[ pkgs.libsForQt5.qtstyleplugins ];
xsession.importedVariables = [ "QT_QPA_PLATFORMTHEME" ];
xsession.importedVariables = [ "QT_QPA_PLATFORMTHEME" ]
++ lib.optionals (cfg.style != null) [ "QT_STYLE_OVERRIDE" ];
# Enable GTK+ style for Qt4 in either case.
# It doesnt support the platform theme packages.

View file

@ -5,7 +5,16 @@ with lib;
{
options = {
home.stateVersion = mkOption {
type = types.enum [ "18.09" "19.03" "19.09" "20.03" "20.09" ];
type = types.enum [
"18.09"
"19.03"
"19.09"
"20.03"
"20.09"
"21.03"
"21.05"
"21.11"
];
default = "18.09";
description = ''
It is occasionally necessary for Home Manager to change

View file

@ -0,0 +1,178 @@
{ config, lib, pkgs, ... }:
with lib;
let
desktopEntry = {
options = {
# Since this module uses the nixpkgs/pkgs/build-support/make-desktopitem function,
# our options and defaults follow its parameters, with the following exceptions:
# `desktopName` on makeDesktopItem is controlled by `name`.
# This is what we'd commonly consider the name of the application.
# `name` on makeDesktopItem is controlled by this module's key in the attrset.
# This is the file's filename excluding ".desktop".
# `extraEntries` on makeDesktopItem is controlled by `extraConfig`,
# and `extraDesktopEntries` by `settings`,
# to match what's commonly used by other home manager modules.
# `startupNotify` on makeDesktopItem asks for "true" or "false" strings,
# for usability's sake we ask for a boolean.
# `mimeType` and `categories` on makeDesktopItem ask for a string in the format "one;two;three;",
# for the same reason we ask for a list of strings.
# Descriptions are taken from the desktop entry spec:
# https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys
type = mkOption {
description = "The type of the desktop entry.";
default = "Application";
type = types.enum [ "Application" "Link" "Directory" ];
};
exec = mkOption {
description = "Program to execute, possibly with arguments.";
type = types.str;
};
icon = mkOption {
description = "Icon to display in file manager, menus, etc.";
type = types.nullOr types.str;
default = null;
};
comment = mkOption {
description = "Tooltip for the entry.";
type = types.nullOr types.str;
default = null;
};
terminal = mkOption {
description = "Whether the program runs in a terminal window.";
type = types.bool;
default = false;
};
name = mkOption {
description = "Specific name of the application.";
type = types.str;
};
genericName = mkOption {
description = "Generic name of the application.";
type = types.nullOr types.str;
default = null;
};
mimeType = mkOption {
description = "The MIME type(s) supported by this application.";
type = types.nullOr (types.listOf types.str);
default = null;
};
categories = mkOption {
description =
"Categories in which the entry should be shown in a menu.";
type = types.nullOr (types.listOf types.str);
default = null;
};
startupNotify = mkOption {
description = ''
If true, it is KNOWN that the application will send a "remove"
message when started with the <literal>DESKTOP_STARTUP_ID</literal>
environment variable set. If false, it is KNOWN that the application
does not work with startup notification at all.'';
type = types.nullOr types.bool;
default = null;
};
extraConfig = mkOption {
description = ''
Extra configuration. Will be appended to the end of the file and
may thus contain extra sections.
'';
type = types.lines;
default = "";
};
settings = mkOption {
type = types.attrsOf types.string;
description = ''
Extra key-value pairs to add to the <literal>[Desktop Entry]</literal> section.
This may override other values.
'';
default = { };
example = literalExample ''
{
Keywords = "calc;math";
DBusActivatable = "false";
}
'';
};
fileValidation = mkOption {
type = types.bool;
description = "Whether to validate the generated desktop file.";
default = true;
};
};
};
#formatting helpers
ifNotNull = a: a': if a == null then null else a';
stringBool = bool: if bool then "true" else "false";
semicolonList = list:
(concatStringsSep ";" list) + ";"; # requires trailing semicolon
#passes config options to makeDesktopItem in expected format
makeFile = name: config:
pkgs.makeDesktopItem {
name = name;
type = config.type;
exec = config.exec;
icon = config.icon;
comment = config.comment;
terminal = config.terminal;
desktopName = config.name;
genericName = config.genericName;
mimeType = ifNotNull config.mimeType (semicolonList config.mimeType);
categories =
ifNotNull config.categories (semicolonList config.categories);
startupNotify =
ifNotNull config.startupNotify (stringBool config.startupNotify);
extraEntries = config.extraConfig;
extraDesktopEntries = config.settings;
};
in {
meta.maintainers = with maintainers; [ cwyc ];
options.xdg.desktopEntries = mkOption {
description = ''
Desktop Entries allow applications to be shown in your desktop environment's app launcher. </para><para>
You can define entries for programs without entries or override existing entries. </para><para>
See <link xlink:href="https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys" /> for more information on options.
'';
default = { };
type = types.attrsOf (types.submodule desktopEntry);
example = literalExample ''
{
firefox = {
name = "Firefox";
genericName = "Web Browser";
exec = "firefox %U";
terminal = false;
categories = [ "Application" "Network" "WebBrowser" ];
mimeType = [ "text/html" "text/xml" ];
};
}
'';
};
config.home.packages = mkIf (config.xdg.desktopEntries != { })
(map hiPrio # we need hiPrio to override existing entries
(attrsets.mapAttrsToList makeFile config.xdg.desktopEntries));
}

View file

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

View file

@ -86,11 +86,13 @@ in {
example = { XDG_MISC_DIR = "$HOME/Misc"; };
description = "Other user directories.";
};
createDirectories =
mkEnableOption "automatic creation of the XDG user directories";
};
config = mkIf cfg.enable {
xdg.configFile."user-dirs.dirs".text = let
options = {
config = let
directories = {
XDG_DESKTOP_DIR = cfg.desktop;
XDG_DOCUMENTS_DIR = cfg.documents;
XDG_DOWNLOAD_DIR = cfg.download;
@ -100,11 +102,20 @@ in {
XDG_TEMPLATES_DIR = cfg.templates;
XDG_VIDEOS_DIR = cfg.videos;
} // cfg.extraConfig;
in mkIf cfg.enable {
xdg.configFile."user-dirs.dirs".text = let
# For some reason, these need to be wrapped with quotes to be valid.
wrapped = mapAttrs (_: value: ''"${value}"'') options;
wrapped = mapAttrs (_: value: ''"${value}"'') directories;
in generators.toKeyValue { } wrapped;
xdg.configFile."user-dirs.conf".text = "enabled=False";
home.activation = mkIf cfg.createDirectories {
createXdgUserDirectories = let
directoriesList = attrValues directories;
mkdir = (dir: ''$DRY_RUN_CMD mkdir -p $VERBOSE_ARG "${dir}"'');
in lib.hm.dag.entryAfter [ "writeBoundary" ]
(strings.concatMapStringsSep "\n" mkdir directoriesList);
};
};
}

View file

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

View file

@ -22,8 +22,10 @@ let
allModules = [
(loadModule ./accounts/email.nix { })
(loadModule ./config/i18n.nix { condition = hostPlatform.isLinux; })
(loadModule ./files.nix { })
(loadModule ./home-environment.nix { })
(loadModule ./i18n/input-method/default.nix { condition = hostPlatform.isLinux; })
(loadModule ./manual.nix { })
(loadModule ./misc/dconf.nix { })
(loadModule ./misc/debug.nix { })
@ -39,6 +41,8 @@ let
(loadModule ./misc/tmpfiles.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/version.nix { })
(loadModule ./misc/vte.nix { })
(loadModule ./misc/xdg-system-dirs.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/xdg-desktop-entries.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/xdg-mime.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/xdg-mime-apps.nix { condition = hostPlatform.isLinux; })
(loadModule ./misc/xdg-user-dirs.nix { condition = hostPlatform.isLinux; })
@ -62,9 +66,11 @@ let
(loadModule ./programs/direnv.nix { })
(loadModule ./programs/eclipse.nix { })
(loadModule ./programs/emacs.nix { })
(loadModule ./programs/exa.nix { })
(loadModule ./programs/feh.nix { })
(loadModule ./programs/firefox.nix { })
(loadModule ./programs/fish.nix { })
(loadModule ./programs/foot.nix { condition = hostPlatform.isLinux; })
(loadModule ./programs/fzf.nix { })
(loadModule ./programs/getmail.nix { condition = hostPlatform.isLinux; })
(loadModule ./programs/gh.nix { })
@ -72,9 +78,11 @@ let
(loadModule ./programs/gnome-terminal.nix { })
(loadModule ./programs/go.nix { })
(loadModule ./programs/gpg.nix { })
(loadModule ./programs/himalaya.nix { })
(loadModule ./programs/home-manager.nix { })
(loadModule ./programs/htop.nix { })
(loadModule ./programs/i3status.nix { })
(loadModule ./programs/i3status-rust.nix { condition = hostPlatform.isLinux; })
(loadModule ./programs/info.nix { })
(loadModule ./programs/irssi.nix { })
(loadModule ./programs/lieer.nix { })
@ -82,10 +90,12 @@ let
(loadModule ./programs/kakoune.nix { })
(loadModule ./programs/keychain.nix { })
(loadModule ./programs/kitty.nix { })
(loadModule ./programs/lazygit.nix { })
(loadModule ./programs/lesspipe.nix { })
(loadModule ./programs/lf.nix { })
(loadModule ./programs/lsd.nix { })
(loadModule ./programs/man.nix { })
(loadModule ./programs/mangohud.nix { condition = hostPlatform.isLinux; })
(loadModule ./programs/matplotlib.nix { })
(loadModule ./programs/mbsync.nix { })
(loadModule ./programs/mcfly.nix { })
@ -94,44 +104,58 @@ let
(loadModule ./programs/msmtp.nix { })
(loadModule ./programs/mu.nix { })
(loadModule ./programs/ncmpcpp.nix { })
(loadModule ./programs/ncspot.nix { })
(loadModule ./programs/ne.nix { })
(loadModule ./programs/neomutt.nix { })
(loadModule ./programs/neovim.nix { })
(loadModule ./programs/newsboat.nix { })
(loadModule ./programs/nix-index.nix { })
(loadModule ./programs/noti.nix { })
(loadModule ./programs/notmuch.nix { })
(loadModule ./programs/nushell.nix { })
(loadModule ./programs/obs-studio.nix { })
(loadModule ./programs/octant.nix { })
(loadModule ./programs/offlineimap.nix { })
(loadModule ./programs/opam.nix { })
(loadModule ./programs/password-store.nix { })
(loadModule ./programs/pazi.nix { })
(loadModule ./programs/pet.nix { })
(loadModule ./programs/pidgin.nix { })
(loadModule ./programs/piston-cli.nix { })
(loadModule ./programs/powerline-go.nix { })
(loadModule ./programs/qutebrowser.nix { })
(loadModule ./programs/rbw.nix { })
(loadModule ./programs/readline.nix { })
(loadModule ./programs/rofi.nix { })
(loadModule ./programs/rofi-pass.nix { })
(loadModule ./programs/rtorrent.nix { })
(loadModule ./programs/scmpuff.nix { })
(loadModule ./programs/senpai.nix { })
(loadModule ./programs/skim.nix { })
(loadModule ./programs/starship.nix { })
(loadModule ./programs/sbt.nix { })
(loadModule ./programs/ssh.nix { })
(loadModule ./programs/taskwarrior.nix { })
(loadModule ./programs/termite.nix { })
(loadModule ./programs/texlive.nix { })
(loadModule ./programs/tmux.nix { })
(loadModule ./programs/terminator.nix { condition = hostPlatform.isLinux; })
(loadModule ./programs/topgrade.nix { })
(loadModule ./programs/urxvt.nix { })
(loadModule ./programs/vim.nix { })
(loadModule ./programs/vscode.nix { })
(loadModule ./programs/vscode/haskell.nix { })
(loadModule ./programs/waybar.nix { condition = hostPlatform.isLinux; })
(loadModule ./programs/xmobar.nix { })
(loadModule ./programs/z-lua.nix { })
(loadModule ./programs/zathura.nix { })
(loadModule ./programs/zoxide.nix { })
(loadModule ./programs/zplug.nix { })
(loadModule ./programs/zsh.nix { })
(loadModule ./programs/zsh/prezto.nix { })
(loadModule ./services/barrier.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/blueman-applet.nix { })
(loadModule ./services/caffeine.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/cbatticon.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/clipmenu.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/compton.nix { })
@ -139,9 +163,10 @@ let
(loadModule ./services/dunst.nix { })
(loadModule ./services/dwm-status.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/emacs.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/etesync-dav.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/flameshot.nix { })
(loadModule ./services/fluidsynth.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/gammastep.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/redshift-gammastep/gammastep.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/getmail.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/gnome-keyring.nix { })
(loadModule ./services/gpg-agent.nix { })
@ -160,18 +185,25 @@ let
(loadModule ./services/mbsync.nix { })
(loadModule ./services/mpd.nix { })
(loadModule ./services/mpdris2.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/mpris-proxy.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/muchsync.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/network-manager-applet.nix { })
(loadModule ./services/nextcloud-client.nix { })
(loadModule ./services/owncloud-client.nix { })
(loadModule ./services/pantalaimon.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/parcellite.nix { })
(loadModule ./services/pass-secret-service.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/password-store-sync.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/pasystray.nix { })
(loadModule ./services/pbgopy.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/picom.nix { })
(loadModule ./services/plan9port.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/playerctld.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/polybar.nix { })
(loadModule ./services/poweralertd.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/pulseeffects.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/random-background.nix { })
(loadModule ./services/redshift.nix { })
(loadModule ./services/redshift-gammastep/redshift.nix { })
(loadModule ./services/rsibreak.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/screen-locker.nix { })
(loadModule ./services/stalonetray.nix { })
@ -190,12 +222,14 @@ let
(loadModule ./services/window-managers/i3-sway/i3.nix { })
(loadModule ./services/window-managers/i3-sway/sway.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/window-managers/xmonad.nix { })
(loadModule ./services/wlsunset.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/xcape.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/xembed-sni-proxy.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/xidlehook.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/xscreensaver.nix { })
(loadModule ./services/xsuspender.nix { condition = hostPlatform.isLinux; })
(loadModule ./systemd.nix { })
(loadModule ./targets/darwin.nix { condition = hostPlatform.isDarwin; })
(loadModule ./targets/darwin { condition = hostPlatform.isDarwin; })
(loadModule ./targets/generic-linux.nix { condition = hostPlatform.isLinux; })
(loadModule ./xcursor.nix { })
(loadModule ./xresources.nix { })

View file

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

View file

@ -3,9 +3,8 @@
with lib;
let
cfg = config.programs.alacritty;
yamlFormat = pkgs.formats.yaml { };
in {
options = {
programs.alacritty = {
@ -19,7 +18,7 @@ in {
};
settings = mkOption {
type = types.attrs;
type = yamlFormat.type;
default = { };
example = literalExample ''
{
@ -51,6 +50,11 @@ in {
home.packages = [ cfg.package ];
xdg.configFile."alacritty/alacritty.yml" = mkIf (cfg.settings != { }) {
# TODO: Replace by the generate function but need to figure out how to
# handle the escaping first.
#
# source = yamlFormat.generate "alacritty.yml" cfg.settings;
text =
replaceStrings [ "\\\\" ] [ "\\" ] (builtins.toJSON cfg.settings);
};

View file

@ -7,9 +7,12 @@ let
cfg = config.programs.alot;
alotAccounts =
enabledAccounts =
filter (a: a.notmuch.enable) (attrValues config.accounts.email.accounts);
# sorted: primary first
alotAccounts = sort (a: b: !(a.primary -> b.primary)) enabledAccounts;
boolStr = v: if v then "True" else "False";
mkKeyValue = key: value:

View file

@ -16,7 +16,7 @@ with lib;
};
extraConfig = mkOption {
type = types.attrs;
type = types.attrsOf types.anything;
default = { };
example = { select_query = ""; };
description = ''

View file

@ -7,6 +7,8 @@ let
cfg = config.programs.astroid;
jsonFormat = pkgs.formats.json { };
astroidAccounts =
filterAttrs (n: v: v.astroid.enable) config.accounts.email.accounts;
@ -36,8 +38,7 @@ let
} // astroid.extraConfig;
# See https://github.com/astroidmail/astroid/wiki/Configuration-Reference
configFile = mailAccounts:
let
finalConfig = let
template = fromJSON (readFile ./astroid-config-template.json);
astroidConfig = foldl' recursiveUpdate template [
{
@ -48,7 +49,7 @@ let
cfg.extraConfig
cfg.externalEditor
];
in builtins.toJSON astroidConfig;
in astroidConfig;
in {
options = {
@ -90,9 +91,13 @@ in {
};
extraConfig = mkOption {
type = types.attrs;
type = jsonFormat.type;
default = { };
example = { poll.interval = 0; };
example = literalExample ''
{
poll.interval = 0;
}
'';
description = ''
JSON config that will override the default Astroid configuration.
'';
@ -107,13 +112,8 @@ in {
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/config".source =
jsonFormat.generate "astroid-config" finalConfig;
xdg.configFile."astroid/poll.sh" = {
executable = true;

View file

@ -30,8 +30,8 @@ in
};
historyFile = mkOption {
type = types.str;
default = "$HOME/.bash_history";
type = types.nullOr types.str;
default = null;
description = "Location of the bash history file.";
};
@ -111,17 +111,6 @@ in
'';
};
bashrcExtra = mkOption {
# Hide for now, may want to rename in the future.
visible = false;
default = "";
type = types.lines;
description = ''
Extra commands that should be added to
<filename>~/.bashrc</filename>.
'';
};
initExtra = mkOption {
default = "";
type = types.lines;
@ -131,6 +120,15 @@ in
'';
};
bashrcExtra = mkOption {
default = "";
type = types.lines;
description = ''
Extra commands that should be placed in <filename>~/.bashrc</filename>.
Note that these commands will be run even in non-interactive shells.
'';
};
logoutExtra = mkOption {
default = "";
type = types.lines;
@ -157,10 +155,12 @@ in
historyControlStr =
concatStringsSep "\n" (mapAttrsToList (n: v: "${n}=${v}") (
{
HISTFILE = "\"${cfg.historyFile}\"";
HISTFILESIZE = toString cfg.historyFileSize;
HISTSIZE = toString cfg.historySize;
}
// optionalAttrs (cfg.historyFile != null) {
HISTFILE = "\"${cfg.historyFile}\"";
}
// optionalAttrs (cfg.historyControl != []) {
HISTCONTROL = concatStringsSep ":" cfg.historyControl;
}
@ -169,22 +169,7 @@ in
}
));
in mkIf cfg.enable {
programs.bash.bashrcExtra = ''
# Commands that should be applied only for interactive shells.
if [[ $- == *i* ]]; then
${historyControlStr}
${shoptsStr}
${aliasesStr}
${cfg.initExtra}
fi
'';
home.file.".bash_profile".text = ''
# -*- mode: sh -*-
home.file.".bash_profile".source = pkgs.writeShellScript "bash_profile" ''
# include .profile if it exists
[[ -f ~/.profile ]] && . ~/.profile
@ -192,9 +177,7 @@ in
[[ -f ~/.bashrc ]] && . ~/.bashrc
'';
home.file.".profile".text = ''
# -*- mode: sh -*-
home.file.".profile".source = pkgs.writeShellScript "profile" ''
. "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh"
${sessionVarsStr}
@ -202,18 +185,23 @@ in
${cfg.profileExtra}
'';
home.file.".bashrc".text = ''
# -*- mode: sh -*-
home.file.".bashrc".source = pkgs.writeShellScript "bashrc" ''
${cfg.bashrcExtra}
# Commands that should be applied only for interactive shells.
[[ $- == *i* ]] || return
${historyControlStr}
${shoptsStr}
${aliasesStr}
${cfg.initExtra}
'';
home.file.".bash_logout" = mkIf (cfg.logoutExtra != "") {
text = ''
# -*- mode: sh -*-
${cfg.logoutExtra}
'';
source = pkgs.writeShellScript "bash_logout" cfg.logoutExtra;
};
}
);

View file

@ -6,6 +6,8 @@ let
cfg = config.programs.beets;
yamlFormat = pkgs.formats.yaml { };
in {
meta.maintainers = [ maintainers.rycee ];
@ -39,7 +41,7 @@ in {
};
settings = mkOption {
type = types.attrs;
type = yamlFormat.type;
default = { };
description = ''
Configuration written to
@ -52,7 +54,7 @@ in {
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."beets/config.yaml".text =
builtins.toJSON config.programs.beets.settings;
xdg.configFile."beets/config.yaml".source =
yamlFormat.generate "beets-config" cfg.settings;
};
}

View file

@ -6,20 +6,10 @@ 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
'';
tomlFormat = pkgs.formats.toml { };
brootConf = {
verbs =
mapAttrsToList (name: value: value // { invocation = name; }) cfg.verbs;
verbs = cfg.verbs;
skin = cfg.skin;
};
@ -54,41 +44,60 @@ in {
};
verbs = mkOption {
type = with types; attrsOf (attrsOf (either bool str));
default = {
"p" = { execution = ":parent"; };
"edit" = {
type = with types; listOf (attrsOf (either bool str));
default = [
{
invocation = "p";
execution = ":parent";
}
{
invocation = "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}" = {
invocation = "create {subpath}";
execution = "$EDITOR {directory}/{subpath}";
}
{
invocation = "view";
execution = "less {file}";
}
];
example = literalExample ''
[
{ invocation = "p"; execution = ":parent"; }
{ invocation = "edit"; shortcut = "e"; execution = "$EDITOR {file}" ; }
{ invocation = "create {subpath}"; execution = "$EDITOR {directory}/{subpath}"; }
{ invocation = "view"; execution = "less {file}"; }
{
invocation = "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.
Define new verbs. For more information, see
<link xlink:href="https://dystroy.org/broot/documentation/configuration/#verb-definition-attributes"/>.
</para><para>
The possible attributes are:
</para>
<para>
<variablelist>
<varlistentry>
<term><literal>invocation</literal> (optional)</term>
<listitem><para>how the verb is called by the user, with placeholders for arguments</para></listitem>
</varlistentry>
<varlistentry>
<term><literal>execution</literal> (mandatory)</term>
<listitem><para>how the verb is executed</para></listitem>
</varlistentry>
<varlistentry>
<term><literal>key</literal> (optional)</term>
<listitem><para>a keyboard key triggering execution</para></listitem>
</varlistentry>
<varlistentry>
<term><literal>shortcut</literal> (optional)</term>
<listitem><para>an alternate way to call the verb (without
@ -109,6 +118,13 @@ in {
'';
};
package = mkOption {
type = types.package;
default = pkgs.broot;
defaultText = literalExample "pkgs.broot";
description = "Package providing broot";
};
skin = mkOption {
type = types.attrsOf types.str;
default = { };
@ -167,9 +183,10 @@ in {
};
config = mkIf cfg.enable {
home.packages = [ pkgs.broot ];
home.packages = [ cfg.package ];
xdg.configFile."broot/conf.toml".source = configFile brootConf;
xdg.configFile."broot/conf.toml".source =
tomlFormat.generate "broot-config" brootConf;
# Dummy file to prevent broot from trying to reinstall itself
xdg.configFile."broot/launcher/installed-v1".text = "";

View file

@ -5,7 +5,9 @@ with lib;
let
browserModule = defaultPkg: name: visible:
let browser = (builtins.parseDrvName defaultPkg.name).name;
let
browser = (builtins.parseDrvName defaultPkg.name).name;
isProprietaryChrome = hasPrefix "Google Chrome" name;
in {
enable = mkOption {
inherit visible;
@ -22,23 +24,78 @@ let
defaultText = literalExample "pkgs.${browser}";
description = "The ${name} package to use.";
};
} // optionalAttrs (!isProprietaryChrome) {
# Extensions do not work with Google Chrome
# see https://github.com/nix-community/home-manager/issues/1383
extensions = mkOption {
inherit visible;
type = types.listOf types.str;
type = with types;
let
extensionType = submodule {
options = {
id = mkOption {
type = strMatching "[a-zA-Z]{32}";
description = ''
The extension's ID from the Chome Web Store url or the unpacked crx.
'';
default = "";
};
updateUrl = mkOption {
type = str;
description = ''
URL of the extension's update manifest XML file. Linux only.
'';
default = "https://clients2.google.com/service/update2/crx";
visible = pkgs.stdenv.isLinux;
readOnly = pkgs.stdenv.isDarwin;
};
crxPath = mkOption {
type = nullOr path;
description = ''
Path to the extension's crx file. Linux only.
'';
default = null;
visible = pkgs.stdenv.isLinux;
};
version = mkOption {
type = nullOr str;
description = ''
The extension's version, required for local installation. Linux only.
'';
default = null;
visible = pkgs.stdenv.isLinux;
};
};
};
in listOf (coercedTo str (v: { id = v; }) extensionType);
default = [ ];
example = literalExample ''
[
"chlffgpmiacpedhhbkiomidkjlcfhogd" # pushbullet
"mbniclmhobmnbdlbpiphghaielnnpgdp" # lightshot
"gcbommkclmclpchllfjekcdonpmejbdp" # https everywhere
"cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock origin
{ id = "cjpalhdlnbpafiamejdnhcphjbkeiagm"; } # ublock origin
{
id = "dcpihecpambacapedldabdbpakmachpb";
updateUrl = "https://raw.githubusercontent.com/iamadamdev/bypass-paywalls-chrome/master/updates.xml";
}
{
id = "aaaaaaaaaabbbbbbbbbbcccccccccc";
crxPath = "/home/share/extension.crx";
version = "1.0";
}
]
'';
description = ''
List of ${name} extensions to install.
To find the extension ID, check its URL on the
<link xlink:href="https://chrome.google.com/webstore/category/extensions">Chrome Web Store</link>.
</para><para>
To install extensions outside of the Chrome Web Store set
<literal>updateUrl</literal> or <literal>crxPath</literal> and
<literal>version</literal> as explained in the
<link xlink:href="https://developer.chrome.com/docs/extensions/mv2/external_extensions">Chrome
documentation</link>.
'';
};
};
@ -46,13 +103,15 @@ let
browserConfig = cfg:
let
browser = (builtins.parseDrvName cfg.package.name).name;
drvName = (builtins.parseDrvName cfg.package.name).name;
browser = if drvName == "ungoogled-chromium" then "chromium" else drvName;
darwinDirs = {
chromium = "Chromium";
google-chrome = "Google/Chrome";
google-chrome-beta = "Google/Chrome Beta";
google-chrome-dev = "Google/Chrome Dev";
brave = "BraveSoftware/Brave-Browser";
};
configDir = if pkgs.stdenv.isDarwin then
@ -60,20 +119,33 @@ let
else
"${config.xdg.configHome}/${browser}";
extensionJson = ext: {
name = "${configDir}/External Extensions/${ext}.json";
value.text = builtins.toJSON {
external_update_url =
"https://clients2.google.com/service/update2/crx";
};
extensionJson = ext:
assert ext.crxPath != null -> ext.version != null;
with builtins; {
name = "${configDir}/External Extensions/${ext.id}.json";
value.text = toJSON (if ext.crxPath != null then {
external_crx = ext.crxPath;
external_version = ext.version;
} else {
external_update_url = ext.updateUrl;
});
};
in mkIf cfg.enable {
home.packages = [ cfg.package ];
home.file = listToAttrs (map extensionJson cfg.extensions);
home.file = listToAttrs (map extensionJson (cfg.extensions or [ ]));
};
in {
# Extensions do not work with the proprietary Google Chrome version
# see https://github.com/nix-community/home-manager/issues/1383
imports = map (flip mkRemovedOptionModule
"The `extensions` option does not work on Google Chrome anymore.") [
[ "programs" "google-chrome" "extensions" ]
[ "programs" "google-chrome-beta" "extensions" ]
[ "programs" "google-chrome-dev" "extensions" ]
];
options.programs = {
chromium = browserModule pkgs.chromium "Chromium" true;
google-chrome = browserModule pkgs.google-chrome "Google Chrome" false;
@ -81,6 +153,7 @@ in {
browserModule pkgs.google-chrome-beta "Google Chrome Beta" false;
google-chrome-dev =
browserModule pkgs.google-chrome-dev "Google Chrome Dev" false;
brave = browserModule pkgs.brave "Brave Browser" false;
};
config = mkMerge [
@ -88,5 +161,6 @@ in {
(browserConfig config.programs.google-chrome)
(browserConfig config.programs.google-chrome-beta)
(browserConfig config.programs.google-chrome-dev)
(browserConfig config.programs.brave)
];
}

View file

@ -11,13 +11,8 @@ let
dir = "bin";
src = ./command-not-found.pl;
isExecutable = true;
inherit (pkgs) perl;
inherit (cfg) dbPath;
perlFlags = concatStrings (map (path: "-I ${path}/lib/perl5/site_perl ") [
pkgs.perlPackages.DBI
pkgs.perlPackages.DBDSQLite
pkgs.perlPackages.StringShellQuote
]);
perl = pkgs.perl.withPackages (p: [ p.DBDSQLite p.StringShellQuote ]);
};
shInit = commandNotFoundHandlerName: ''

View file

@ -1,4 +1,4 @@
#! @perl@/bin/perl -w @perlFlags@
#! @perl@/bin/perl -w
use strict;
use DBI;
@ -29,16 +29,17 @@ if (!defined $res || scalar @$res == 0) {
exec("nix-shell", "-p", $package, "--run", shell_quote("exec", @ARGV));
} else {
print STDERR <<EOF;
The program $program is currently not installed. You can install it by typing:
nix-env -iA nixos.$package
The program '$program' is not in your PATH. You can make it available in an
ephemeral shell by typing:
nix-shell -p $package
EOF
}
} else {
print STDERR <<EOF;
The program $program is currently not installed. It is provided by
several packages. You can install it by typing one of the following:
The program '$program' is not in your PATH. It is provided by several packages.
You can make it available in an ephemeral shell by typing one of the following:
EOF
print STDERR " nix-env -iA nixos.$_->{package}\n" foreach @$res;
print STDERR " nix-shell -p $_->{package}\n" foreach @$res;
}
exit 127;

View file

@ -204,8 +204,8 @@ in {
};
home.file.".dir_colors".text = concatStringsSep "\n" ([ ]
++ optional (cfg.extraConfig != "") cfg.extraConfig
++ mapAttrsToList formatLine cfg.settings) + "\n";
++ mapAttrsToList formatLine cfg.settings ++ [ "" ]
++ optional (cfg.extraConfig != "") cfg.extraConfig);
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
eval $(${pkgs.coreutils}/bin/dircolors -b ~/.dir_colors)

View file

@ -5,25 +5,25 @@ 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
'';
tomlFormat = pkgs.formats.toml { };
in {
imports = [
(mkRenamedOptionModule [
"programs"
"direnv"
"enableNixDirenvIntegration"
] [ "programs" "direnv" "nix-direnv" "enable" ])
];
meta.maintainers = [ maintainers.rycee ];
options.programs.direnv = {
enable = mkEnableOption "direnv, the environment switcher";
config = mkOption {
type = types.attrs;
type = tomlFormat.type;
default = { };
description = ''
Configuration written to
@ -71,22 +71,29 @@ in {
'';
};
enableNixDirenvIntegration = mkEnableOption ''
nix-direnv = {
enable = mkEnableOption ''
<link
xlink:href="https://github.com/nix-community/nix-direnv">nix-direnv</link>,
a fast, persistent use_nix implementation for direnv'';
enableFlakes = mkEnableOption "Flake support in nix-direnv";
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.direnv ];
xdg.configFile."direnv/config.toml" =
mkIf (cfg.config != { }) { source = configFile cfg.config; };
xdg.configFile."direnv/config.toml" = mkIf (cfg.config != { }) {
source = tomlFormat.generate "direnv-config" cfg.config;
};
xdg.configFile."direnv/direnvrc" = let
package =
pkgs.nix-direnv.override { inherit (cfg.nix-direnv) enableFlakes; };
text = concatStringsSep "\n" (optional (cfg.stdlib != "") cfg.stdlib
++ optional cfg.enableNixDirenvIntegration
"source ${pkgs.nix-direnv}/share/nix-direnv/direnvrc");
++ optional cfg.nix-direnv.enable
"source ${package}/share/nix-direnv/direnvrc");
in mkIf (text != "") { inherit text; };
programs.bash.initExtra = mkIf cfg.enableBashIntegration (
@ -101,7 +108,7 @@ in {
'';
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
eval (${pkgs.direnv}/bin/direnv hook fish)
${pkgs.direnv}/bin/direnv hook fish | source
'';
};
}

View file

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

View file

@ -67,6 +67,8 @@ in
meta.maintainers = [ maintainers.rycee ];
imports = [
(mkRemovedOptionModule ["programs" "firefox" "enableAdobeFlash"]
"Support for this option has been removed.")
(mkRemovedOptionModule ["programs" "firefox" "enableGoogleTalk"]
"Support for this option has been removed.")
(mkRemovedOptionModule ["programs" "firefox" "enableIcedTea"]
@ -84,6 +86,17 @@ in
then pkgs.firefox
else pkgs.firefox-unwrapped;
defaultText = literalExample "pkgs.firefox";
example = literalExample ''
pkgs.firefox.override {
# See nixpkgs' firefox/wrapper.nix to check which options you can use
cfg = {
# Gnome shell native connector
enableGnomeExtensions = true;
# Tridactyl native connector
enableTridactylNative = true;
};
}
'';
description = ''
The Firefox package to use. If state version  19.09 then
this should be a wrapped Firefox package. For earlier state
@ -215,12 +228,6 @@ in
description = "Attribute set of Firefox profiles.";
};
enableAdobeFlash = mkOption {
type = types.bool;
default = false;
description = "Whether to enable the unfree Adobe Flash plugin.";
};
enableGnomeExtensions = mkOption {
type = types.bool;
default = false;
@ -268,11 +275,17 @@ in
)
];
warnings = optional (cfg.enableGnomeExtensions or false) ''
Using 'programs.firefox.enableGnomeExtensions' has been deprecated and
will be removed in the future. Please change to overriding the package
configuration using 'programs.firefox.package' instead. You can refer to
its example for how to do this.
'';
home.packages =
let
# The configuration expected by the Firefox wrapper.
fcfg = {
enableAdobeFlash = cfg.enableAdobeFlash;
enableGnomeExtensions = cfg.enableGnomeExtensions;
};
@ -287,7 +300,7 @@ in
if isDarwin then
cfg.package
else if versionAtLeast config.home.stateVersion "19.09" then
cfg.package.override { cfg = fcfg; }
cfg.package.override (old: { cfg = old.cfg or {} // fcfg; })
else
(pkgs.wrapFirefox.override { config = bcfg; }) cfg.package { };
in
@ -305,6 +318,8 @@ in
};
}]
++ flip mapAttrsToList cfg.profiles (_: profile: {
"${profilesPath}/${profile.path}/.keep".text = "";
"${profilesPath}/${profile.path}/chrome/userChrome.css" =
mkIf (profile.userChrome != "") {
text = profile.userChrome;

View file

@ -343,7 +343,12 @@ in {
# if we haven't sourced the general config, do it
if not set -q __fish_general_config_sourced
set -p fish_function_path ${pkgs.fish-foreign-env}/share/fish-foreign-env/functions
set --prepend fish_function_path ${
if pkgs ? fishPlugins && pkgs.fishPlugins ? foreign-env then
"${pkgs.fishPlugins.foreign-env}/share/fish/vendor_functions.d"
else
"${pkgs.fish-foreign-env}/share/fish-foreign-env/functions"
}
fenv source ${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh > /dev/null
set -e fish_function_path[1]

View file

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

View file

@ -7,9 +7,21 @@ let
cfg = config.programs.fzf;
in {
imports = [
(mkRemovedOptionModule [ "programs" "fzf" "historyWidgetCommand" ]
"This option is no longer supported by fzf.")
];
options.programs.fzf = {
enable = mkEnableOption "fzf - a command-line fuzzy finder";
package = mkOption {
type = types.package;
default = pkgs.fzf;
defaultText = literalExample "pkgs.fzf";
description = "Package providing the <command>fzf</command> tool.";
};
defaultCommand = mkOption {
type = types.nullOr types.str;
default = null;
@ -67,15 +79,6 @@ in {
'';
};
historyWidgetCommand = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
The command that gets executed as the source for fzf for the
CTRL-R keybinding.
'';
};
historyWidgetOptions = mkOption {
type = types.listOf types.str;
default = [ ];
@ -85,6 +88,23 @@ in {
'';
};
tmux = {
enableShellIntegration = mkEnableOption ''
setting <literal>FZF_TMUX=1</literal> which causes shell integration to use fzf-tmux
'';
shellIntegrationOptions = mkOption {
type = types.listOf types.str;
default = [ ];
example = literalExample ''[ "-d 40%" ]'';
description = ''
If <option>programs.fzf.tmux.enableShellIntegration</option> is set to <literal>true</literal>,
shell integration will use these options for fzf-tmux.
See <command>fzf-tmux --help</command> for available options.
'';
};
};
enableBashIntegration = mkOption {
default = true;
type = types.bool;
@ -111,36 +131,37 @@ in {
};
config = mkIf cfg.enable {
home.packages = [ pkgs.fzf ];
home.packages = [ cfg.package ];
home.sessionVariables = mapAttrs (n: v: toString v)
(filterAttrs (n: v: v != [ ] && v != null) {
FZF_ALT_C_COMMAND = cfg.changeDirWidgetCommand;
FZF_ALT_C_OPTS = cfg.changeDirWidgetOptions;
FZF_CTRL_R_COMMAND = cfg.historyWidgetCommand;
FZF_CTRL_R_OPTS = cfg.historyWidgetOptions;
FZF_CTRL_T_COMMAND = cfg.fileWidgetCommand;
FZF_CTRL_T_OPTS = cfg.fileWidgetOptions;
FZF_DEFAULT_COMMAND = cfg.defaultCommand;
FZF_DEFAULT_OPTS = cfg.defaultOptions;
FZF_TMUX = if cfg.tmux.enableShellIntegration then "1" else null;
FZF_TMUX_OPTS = cfg.tmux.shellIntegrationOptions;
});
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
if [[ :$SHELLOPTS: =~ :(vi|emacs): ]]; then
. ${pkgs.fzf}/share/fzf/completion.bash
. ${pkgs.fzf}/share/fzf/key-bindings.bash
. ${cfg.package}/share/fzf/completion.bash
. ${cfg.package}/share/fzf/key-bindings.bash
fi
'';
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
if [[ $options[zle] = on ]]; then
. ${pkgs.fzf}/share/fzf/completion.zsh
. ${pkgs.fzf}/share/fzf/key-bindings.zsh
. ${cfg.package}/share/fzf/completion.zsh
. ${cfg.package}/share/fzf/key-bindings.zsh
fi
'';
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
source ${pkgs.fzf}/share/fzf/key-bindings.fish && fzf_key_bindings
source ${cfg.package}/share/fzf/key-bindings.fish && fzf_key_bindings
'';
};
}

View file

@ -11,8 +11,7 @@ let
with account;
let
passCmd = concatMapStringsSep ", " (x: "'${x}'") passwordCommand;
renderedMailboxes =
concatMapStringsSep ", " (x: "'${x}'") getmail.mailboxes;
renderedMailboxes = concatMapStrings (x: "'${x}', ") getmail.mailboxes;
retrieverType = if imap.tls.enable then
"SimpleIMAPSSLRetriever"
else

View file

@ -45,9 +45,11 @@ in {
};
config = mkIf cfg.enable {
home.packages = [ pkgs.gitAndTools.gh ];
home.packages = [ pkgs.gh ];
xdg.configFile."gh/config.yml".text =
builtins.toJSON { inherit (cfg) aliases editor gitProtocol; };
xdg.configFile."gh/config.yml".text = builtins.toJSON {
inherit (cfg) aliases editor;
git_protocol = cfg.gitProtocol;
};
};
}

View file

@ -61,8 +61,13 @@ let
signModule = types.submodule {
options = {
key = mkOption {
type = types.str;
description = "The default GPG signing key fingerprint.";
type = types.nullOr types.str;
description = ''
The default GPG signing key fingerprint.
</para><para>
Set to <literal>null</literal> to let GnuPG decide what signing key
to use depending on commits author.
'';
};
signByDefault = mkOption {
@ -101,7 +106,7 @@ let
};
contents = mkOption {
type = types.attrs;
type = types.attrsOf types.anything;
default = { };
description = ''
Configuration to include. If empty then a path must be given.
@ -276,7 +281,12 @@ in {
genIdentity = name: account:
with account;
nameValuePair "sendemail.${name}" ({
nameValuePair "sendemail.${name}" (if account.msmtp.enable then {
smtpServer = "${pkgs.msmtp}/bin/msmtp";
envelopeSender = "auto";
from = address;
} else
{
smtpEncryption = if smtp.tls.enable then
(if smtp.tls.useStartTls
|| versionOlder config.home.stateVersion "20.09" then
@ -285,6 +295,7 @@ in {
"ssl")
else
"";
smtpSslCertPath = mkIf smtp.tls.enable smtp.tls.certificatesFile;
smtpServer = smtp.host;
smtpUser = userName;
from = address;
@ -297,7 +308,7 @@ in {
(mkIf (cfg.signing != null) {
programs.git.iniContent = {
user.signingKey = cfg.signing.key;
user.signingKey = mkIf (cfg.signing.key != null) cfg.signing.key;
commit.gpgSign = cfg.signing.signByDefault;
gpg.program = cfg.signing.gpgPath;
};
@ -348,8 +359,9 @@ in {
})
(mkIf cfg.delta.enable {
programs.git.iniContent =
let deltaCommand = "${pkgs.gitAndTools.delta}/bin/delta";
home.packages = [ pkgs.delta ];
programs.git.iniContent = let deltaCommand = "${pkgs.delta}/bin/delta";
in {
core.pager = deltaCommand;
interactive.diffFilter = "${deltaCommand} --color-only";

View file

@ -187,6 +187,12 @@ let
'';
};
boldIsBright = mkOption {
default = null;
type = types.nullOr types.bool;
description = "Whether bold text is shown in bright colors.";
};
deleteBinding = mkOption {
default = "delete-sequence";
type = eraseBinding;
@ -228,12 +234,26 @@ let
</variablelist>
'';
};
audibleBell = mkOption {
default = true;
type = types.bool;
description = "Turn on/off the terminal's bell.";
};
transparencyPercent = mkOption {
default = null;
type = types.nullOr (types.ints.between 0 100);
description = "Background transparency in percent.";
};
};
});
buildProfileSet = pcfg:
{
audible-bell = pcfg.audibleBell;
visible-name = pcfg.visibleName;
scroll-on-output = pcfg.scrollOnOutput;
scrollbar-policy = if pcfg.showScrollbar then "always" else "never";
scrollback-lines = pcfg.scrollbackLines;
cursor-shape = pcfg.cursorShape;
@ -266,7 +286,9 @@ let
} else {
bold-color-same-as-fg = false;
bold-color = pcfg.colors.boldColor;
}) // (if (pcfg.colors.cursor != null) then {
}) // optionalAttrs (pcfg.boldIsBright != null) {
bold-is-bright = pcfg.boldIsBright;
} // (if (pcfg.colors.cursor != null) then {
cursor-colors-set = true;
cursor-foreground-color = pcfg.colors.cursor.foreground;
cursor-background-color = pcfg.colors.cursor.background;
@ -278,10 +300,14 @@ let
highlight-background-color = pcfg.colors.highlight.background;
} else {
highlight-colors-set = false;
})));
}) // optionalAttrs (pcfg.transparencyPercent != null) {
background-transparency-percent = pcfg.transparencyPercent;
use-theme-transparency = false;
use-transparent-background = true;
}));
in {
meta.maintainers = [ maintainers.rycee ];
meta.maintainers = with maintainers; [ kamadorueda rycee ];
options = {
programs.gnome-terminal = {
@ -308,7 +334,7 @@ in {
};
config = mkIf cfg.enable {
home.packages = [ pkgs.gnome3.gnome-terminal ];
home.packages = [ pkgs.gnome.gnome-terminal ];
dconf.settings = let dconfPath = "org/gnome/terminal/legacy";
in {

View file

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

View file

@ -0,0 +1,100 @@
{ config, lib, pkgs, ... }:
let
cfg = config.programs.himalaya;
enabledAccounts =
lib.filterAttrs (_: a: a.himalaya.enable) (config.accounts.email.accounts);
tomlFormat = pkgs.formats.toml { };
himalayaConfig = let
toHimalayaConfig = account:
{
email = account.address;
name = account.realName;
default = account.primary;
# FIXME: does not support disabling TLS altogether
# NOTE: does not accept sequence of strings for password commands
imap-login = account.userName;
imap-passwd-cmd = lib.escapeShellArgs account.passwordCommand;
imap-host = account.imap.host;
imap-port = account.imap.port;
imap-starttls = account.imap.tls.useStartTls;
smtp-login = account.userName;
smtp-passwd-cmd = lib.escapeShellArgs account.passwordCommand;
smtp-host = account.smtp.host;
smtp-port = account.smtp.port;
smtp-starttls = account.imap.tls.useStartTls;
} // (lib.optionalAttrs (account.signature.showSignature == "append") {
# FIXME: signature cannot be attached
signature = account.signature.text;
}) // account.himalaya.settings;
in {
# NOTE: will not start without this configured, but each account overrides it
name = "";
} // cfg.settings // (lib.mapAttrs (_: toHimalayaConfig) enabledAccounts);
in {
meta.maintainers = with lib.hm.maintainers; [ ambroisie ];
options = with lib; {
programs.himalaya = {
enable = mkEnableOption "himalaya mail client";
package = mkOption {
type = types.package;
default = pkgs.himalaya;
defaultText = literalExample "pkgs.himalaya";
description = ''
Package providing the <command>himalaya</command> mail client.
'';
};
settings = mkOption {
type = tomlFormat.type;
default = { };
example = lib.literalExample ''
{
default-page-size = 50;
}
'';
description = ''
Global <command>himalaya</command> configuration values.
'';
};
};
accounts.email.accounts = mkOption {
type = with types;
attrsOf (submodule {
options.himalaya = {
enable = mkEnableOption ''
the himalaya mail client for this account
'';
settings = mkOption {
type = tomlFormat.type;
default = { };
example = lib.literalExample ''
{
default-page-size = 50;
}
'';
description = ''
Extra settings to add to this <command>himalaya</command>
account configuration.
'';
};
};
});
};
};
config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."himalaya/config.toml".source =
tomlFormat.generate "himalaya-config.toml" himalayaConfig;
};
}

View file

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

View file

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

View file

@ -0,0 +1,265 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.i3status-rust;
restartI3 = ''
i3Socket=''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.*
if [ -S $i3Socket ]; then
echo "Reloading i3"
$DRY_RUN_CMD ${config.xsession.windowManager.i3.package}/bin/i3-msg -s $i3Socket restart 1>/dev/null
fi
'';
settingsFormat = pkgs.formats.toml { };
in {
meta.maintainers = [ maintainers.farlion ];
options.programs.i3status-rust = {
enable = mkEnableOption "a replacement for i3-status written in Rust";
bars = mkOption {
type = types.attrsOf (types.submodule {
options = {
blocks = mkOption {
type = settingsFormat.type;
default = [
{
block = "disk_space";
path = "/";
alias = "/";
info_type = "available";
unit = "GB";
interval = 60;
warning = 20.0;
alert = 10.0;
}
{
block = "memory";
display_type = "memory";
format_mem = "{mem_used_percents}";
format_swap = "{swap_used_percents}";
}
{
block = "cpu";
interval = 1;
}
{
block = "load";
interval = 1;
format = "{1m}";
}
{ block = "sound"; }
{
block = "time";
interval = 60;
format = "%a %d/%m %R";
}
];
description = ''
Configuration blocks to add to i3status-rust
<filename>config</filename>. See
<link xlink:href="https://github.com/greshake/i3status-rust/blob/master/blocks.md"/>
for block options.
'';
example = literalExample ''
[
{
block = "disk_space";
path = "/";
alias = "/";
info_type = "available";
unit = "GB";
interval = 60;
warning = 20.0;
alert = 10.0;
}
{
block = "sound";
format = "{output_name} {volume}%";
on_click = "pavucontrol --tab=3";
mappings = {
"alsa_output.pci-0000_00_1f.3.analog-stereo" = "";
"bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = "";
};
}
];
'';
};
settings = mkOption {
type = settingsFormat.type;
default = { };
description = ''
Any extra options to add to i3status-rust
<filename>config</filename>.
'';
example = literalExample ''
{
theme = {
name = "solarized-dark";
overrides = {
idle_bg = "#123456";
idle_fg = "#abcdef";
};
};
}
'';
};
icons = mkOption {
type = types.str;
default = "none";
description = ''
The icons set to use. See
<link xlink:href="https://github.com/greshake/i3status-rust/blob/master/themes.md"/>
for a list of available icon sets.
'';
example = "awesome5";
};
theme = mkOption {
type = types.str;
default = "plain";
description = ''
The theme to use. See
<link xlink:href="https://github.com/greshake/i3status-rust/blob/master/themes.md"/>
for a list of available themes.
'';
example = "gruvbox-dark";
};
};
});
default = {
default = {
blocks = [
{
block = "disk_space";
path = "/";
alias = "/";
info_type = "available";
unit = "GB";
interval = 60;
warning = 20.0;
alert = 10.0;
}
{
block = "memory";
display_type = "memory";
format_mem = "{Mup}%";
format_swap = "{SUp}%";
}
{
block = "cpu";
interval = 1;
}
{
block = "load";
interval = 1;
format = "{1m}";
}
{ block = "sound"; }
{
block = "time";
interval = 60;
format = "%a %d/%m %R";
}
];
};
};
description = ''
Attribute set of i3status-rust bars, each with their own configuration.
Each bar <varname>name</varname> generates a config file suffixed with
the bar's <varname>name</varname> from the attribute set, like so:
<filename>config-<replaceable>name</replaceable>.toml</filename>.
</para><para>
This way, multiple config files can be generated, such as for having a
top and a bottom bar.
</para><para>
See
<citerefentry>
<refentrytitle>i3status-rust</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>
for options.
'';
example = literalExample ''
bottom = {
blocks = [
{
block = "disk_space";
path = "/";
alias = "/";
info_type = "available";
unit = "GB";
interval = 60;
warning = 20.0;
alert = 10.0;
}
{
block = "memory";
display_type = "memory";
format_mem = "{mem_used_percents}";
format_swap = "{swap_used_percents}";
}
{
block = "cpu";
interval = 1;
}
{
block = "load";
interval = 1;
format = "{1m}";
}
{ block = "sound"; }
{
block = "time";
interval = 60;
format = "%a %d/%m %R";
}
];
settings = {
theme = {
name = "solarized-dark";
overrides = {
idle_bg = "#123456";
idle_fg = "#abcdef";
};
};
};
icons = "awesome5";
theme = "gruvbox-dark";
};
'';
};
package = mkOption {
type = types.package;
default = pkgs.i3status-rust;
defaultText = literalExample "pkgs.i3status-rust";
description = "Package providing i3status-rust";
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile = mapAttrs' (cfgFileSuffix: cfg:
nameValuePair ("i3status-rust/config-${cfgFileSuffix}.toml") ({
onChange = mkIf config.xsession.windowManager.i3.enable restartI3;
source = settingsFormat.generate ("config-${cfgFileSuffix}.toml") ({
theme = cfg.theme;
icons = cfg.icons;
block = cfg.blocks;
} // cfg.settings);
})) cfg.bars;
};
}

View file

@ -35,6 +35,9 @@ let
use_ssl = "${boolStr v.server.ssl.enable}";
ssl_verify = "${boolStr v.server.ssl.verify}";
autoconnect = "${boolStr v.server.autoConnect}";
${lib.optionalString (v.server.ssl.certificateFile != null) ''
ssl_cert = "${v.server.ssl.certificateFile}";
''}
}
''));
@ -118,6 +121,15 @@ let
default = true;
description = "Whether the SSL certificate should be verified.";
};
certificateFile = mkOption {
type = types.nullOr types.path;
default = null;
description = ''
Path to a file containing the certificate used for
client authentication to the server.
'';
};
};
autoConnect = mkOption {

View file

@ -30,6 +30,13 @@ in {
programs.jq = {
enable = mkEnableOption "the jq command-line JSON processor";
package = mkOption {
type = types.package;
default = pkgs.jq;
defaultText = literalExample "pkgs.jq";
description = "jq package to use.";
};
colors = mkOption {
description = ''
The colors used in colored JSON output.</para>
@ -51,12 +58,12 @@ in {
default = {
null = "1;30";
false = "0;39";
true = "0;39";
numbers = "0;39";
false = "0;37";
true = "0;37";
numbers = "0;37";
strings = "0;32";
arrays = "1;39";
objects = "1;39";
arrays = "1;37";
objects = "1;37";
};
type = colorsType;
@ -65,7 +72,7 @@ in {
};
config = mkIf cfg.enable {
home.packages = [ pkgs.jq ];
home.packages = [ cfg.package ];
home.sessionVariables = let c = cfg.colors;
in {

View file

@ -574,7 +574,7 @@ let
hookString = h:
concatStringsSep " " [
"hook"
"${optionalString (h.group != null) "-group ${group}"}"
"${optionalString (h.group != null) "-group ${h.group}"}"
"${optionalString (h.once) "-once"}"
"global"
"${h.name}"

View file

@ -79,7 +79,11 @@ in {
# Generated by Home Manager.
# See https://sw.kovidgoyal.net/kitty/conf.html
${optionalString (cfg.font != null) "font_family ${cfg.font.name}"}
${optionalString (cfg.font != null) ''
font_family ${cfg.font.name}
${optionalString (cfg.font.size != null)
"font_size ${toString cfg.font.size}"}
''}
${toKittyConfig cfg.settings}

View file

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

View file

@ -6,12 +6,14 @@ let
cfg = config.programs.lsd;
yamlFormat = pkgs.formats.yaml { };
aliases = {
ls = "${pkgs.lsd}/bin/lsd";
ll = "ls -l";
la = "ls -a";
lt = "ls --tree";
lla = "ls -la";
ll = "${pkgs.lsd}/bin/lsd -l";
la = "${pkgs.lsd}/bin/lsd -a";
lt = "${pkgs.lsd}/bin/lsd --tree";
lla = "${pkgs.lsd}/bin/lsd -la";
};
in {
@ -27,6 +29,21 @@ in {
Whether to enable recommended lsd aliases.
'';
};
settings = mkOption {
type = yamlFormat.type;
default = { };
example = {
date = "relative";
ignore-globs = [ ".git" ".hg" ];
};
description = ''
Configuration written to
<filename>~/.config/lsd/config.yaml</filename>. See
<link xlink:href="https://github.com/Peltoche/lsd#config-file-content"/>
for supported values.
'';
};
};
config = mkIf cfg.enable {
@ -37,5 +54,9 @@ in {
programs.zsh.shellAliases = mkIf cfg.enableAliases aliases;
programs.fish.shellAliases = mkIf cfg.enableAliases aliases;
xdg.configFile."lsd/config.yaml" = mkIf (cfg.settings != { }) {
source = yamlFormat.generate "lsd-config" cfg.settings;
};
};
}

View file

@ -0,0 +1,105 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.mangohud;
settingsType = with types;
(oneOf [ bool int float str path (listOf (oneOf [ int str ])) ]);
renderOption = option:
rec {
int = toString option;
float = int;
path = int;
bool = "false";
string = option;
list = concatStringsSep "," (lists.forEach option (x: toString x));
}.${builtins.typeOf option};
renderLine = k: v: (if isBool v && v then k else "${k}=${renderOption v}");
renderSettings = attrs:
strings.concatStringsSep "\n" (attrsets.mapAttrsToList renderLine attrs)
+ "\n";
in {
options = {
programs.mangohud = {
enable = mkEnableOption "Mangohud";
package = mkOption {
type = types.package;
default = pkgs.mangohud;
defaultText = literalExample "pkgs.mangohud";
description = "The Mangohud package to install.";
};
enableSessionWide = mkOption {
type = types.bool;
default = false;
description = ''
Sets environment variables so that
MangoHud is started on any application that supports it.
'';
};
settings = mkOption {
type = with types; attrsOf settingsType;
default = { };
example = literalExample ''
{
output_folder = ~/Documents/mangohud/;
full = true;
}
'';
description = ''
Configuration written to
<filename>~/.config/MangoHud/MangoHud.conf</filename>. See
<link xlink:href="https://github.com/flightlessmango/MangoHud/blob/master/bin/MangoHud.conf"/>
for the default configuration.
'';
};
settingsPerApplication = mkOption {
type = with types; attrsOf (attrsOf settingsType);
default = { };
example = literalExample ''
{
mpv = {
no_display = true;
}
}
'';
description = ''
Sets MangoHud settings per application.
Configuration written to
<filename>~/.config/MangoHud/{application_name}.conf</filename>. See
<link xlink:href="https://github.com/flightlessmango/MangoHud/blob/master/bin/MangoHud.conf"/>
for the default configuration.
'';
};
};
};
config = mkIf cfg.enable (mkMerge [
{
home.packages = [ cfg.package ];
home.sessionVariables = mkIf cfg.enableSessionWide {
MANGOHUD = 1;
MANGOHUD_DLSYM = 1;
};
xdg.configFile."MangoHud/MangoHud.conf" =
mkIf (cfg.settings != { }) { text = renderSettings cfg.settings; };
}
{
xdg.configFile = mapAttrs'
(n: v: nameValuePair "MangoHud/${n}.conf" { text = renderSettings v; })
cfg.settingsPerApplication;
}
]);
meta.maintainers = with maintainers; [ zeratax ];
}

View file

@ -23,7 +23,7 @@ in {
config = mkOption {
default = { };
type = types.attrs;
type = types.attrsOf types.anything;
description = ''
Add terms to the <filename>matplotlibrc</filename> file to
control the default matplotlib behavior.

View file

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

View file

@ -10,6 +10,24 @@ let
mbsyncAccounts =
filter (a: a.mbsync.enable) (attrValues config.accounts.email.accounts);
# Given a SINGLE group's channels attribute set, return true if ANY of the channel's
# patterns use the invalidOption attribute set value name.
channelInvalidOption = channels: invalidOption:
any (c: c) (mapAttrsToList (c: hasAttr invalidOption) channels);
# Given a SINGLE account's groups attribute set, return true if ANY of the account's group's channel's patterns use the invalidOption attribute set value name.
groupInvalidOption = groups: invalidOption:
any (g: g) (mapAttrsToList (groupName: groupVals:
channelInvalidOption groupVals.channels invalidOption) groups);
# Given all accounts (ensure that accounts passed in here ARE mbsync-using accounts)
# return true if ANY of the account's groups' channels' patterns use the
# invalidOption attribute set value name.
accountInvalidOption = accounts: invalidOption:
any (a: a)
(map (account: groupInvalidOption account.mbsync.groups invalidOption)
mbsyncAccounts);
genTlsConfig = tls:
{
SSLType = if !tls.enable then
@ -22,10 +40,18 @@ let
CertificateFile = toString tls.certificatesFile;
};
masterSlaveMapping = {
imports = [
(mkRenamedOptionModule [ "programs" "mbsync" "masterSlaveMapping" ] [
"programs"
"mbsync"
"nearFarMapping"
])
];
nearFarMapping = {
none = "None";
imap = "Master";
maildir = "Slave";
imap = "Far";
maildir = "Near";
both = "Both";
};
@ -65,9 +91,12 @@ let
+ genSection "IMAPStore ${name}-remote"
({ Account = name; } // mbsync.extraConfig.remote) + "\n"
+ genSection "MaildirStore ${name}-local" ({
Path = "${maildir.absPath}/";
Inbox = "${maildir.absPath}/${folders.inbox}";
SubFolders = "Verbatim";
} // optionalAttrs
(mbsync.subFolders != "Maildir++" || mbsync.flatten != null) {
Path = "${maildir.absPath}/";
} // optionalAttrs (mbsync.flatten == null) {
SubFolders = mbsync.subFolders;
} // optionalAttrs (mbsync.flatten != null) { Flatten = mbsync.flatten; }
// mbsync.extraConfig.local) + "\n" + genChannels account;
@ -85,18 +114,18 @@ let
genAccountWideChannel = account:
with account;
genSection "Channel ${name}" ({
Master = ":${name}-remote:";
Slave = ":${name}-local:";
Far = ":${name}-remote:";
Near = ":${name}-local:";
Patterns = mbsync.patterns;
Create = masterSlaveMapping.${mbsync.create};
Remove = masterSlaveMapping.${mbsync.remove};
Expunge = masterSlaveMapping.${mbsync.expunge};
Create = nearFarMapping.${mbsync.create};
Remove = nearFarMapping.${mbsync.remove};
Expunge = nearFarMapping.${mbsync.expunge};
SyncState = "*";
} // mbsync.extraConfig.channel) + "\n";
# Given the attr set of groups, return a string of channels that will direct
# mail to the proper directories, according to the pattern used in channel's
# master pattern definition.
# "far" pattern definition.
genGroupChannelConfig = storeName: groups:
let
# Given the name of the group this channel is part of and the channel
@ -115,8 +144,8 @@ let
else
"";
in genSection "Channel ${groupName}-${channel.name}" ({
Master = ":${storeName}-remote:${channel.masterPattern}";
Slave = ":${storeName}-local:${channel.slavePattern}";
Far = ":${storeName}-remote:${channel.farPattern}";
Near = ":${storeName}-local:${channel.nearPattern}";
} // channel.extraConfig) + genChannelPatterns channel.patterns;
# Given the group name, and a attr set of channels within that group,
# Generate a list of strings for each channels' configuration.
@ -203,7 +232,8 @@ in {
};
};
config = mkIf cfg.enable {
config = mkIf cfg.enable (mkMerge [
{
assertions = let
checkAccounts = pred: msg:
let badAccounts = filter pred mbsyncAccounts;
@ -218,7 +248,21 @@ in {
(checkAccounts (a: a.passwordCommand == null) "Missing passwordCommand")
(checkAccounts (a: a.userName == null) "Missing username")
];
}
(mkIf (accountInvalidOption mbsyncAccounts "masterPattern") {
warnings = [
"mbsync channels no longer use masterPattern. Use farPattern in its place."
];
})
(mkIf (accountInvalidOption mbsyncAccounts "slavePattern") {
warnings = [
"mbsync channels no longer use slavePattern. Use nearPattern in its place."
];
})
{
home.packages = [ cfg.package ];
programs.notmuch.new.ignore = [ ".uidvalidity" ".mbsyncstate" ];
@ -248,5 +292,6 @@ in {
}
'';
};
};
}
]);
}

View file

@ -27,6 +27,14 @@ in {
'';
};
enableFuzzySearch = mkOption {
default = false;
type = types.bool;
description = ''
Whether to enable fuzzy searching.
'';
};
enableBashIntegration = mkOption {
default = true;
type = types.bool;
@ -75,5 +83,7 @@ in {
}
(mkIf cfg.enableLightTheme { home.sessionVariables.MCFLY_LIGHT = "TRUE"; })
(mkIf cfg.enableFuzzySearch { home.sessionVariables.MCFLY_FUZZY = "TRUE"; })
]);
}

View file

@ -6,6 +6,8 @@ let
cfg = config.programs.mercurial;
iniFormat = pkgs.formats.ini { };
in {
options = {
@ -30,19 +32,19 @@ in {
};
aliases = mkOption {
type = types.attrs;
type = types.attrsOf types.anything;
default = { };
description = "Mercurial aliases to define.";
};
extraConfig = mkOption {
type = types.either types.attrs types.lines;
type = types.either (types.attrsOf types.anything) types.lines;
default = { };
description = "Additional configuration to add.";
};
iniContent = mkOption {
type = types.attrsOf types.attrs;
type = iniFormat.type;
internal = true;
};
@ -71,7 +73,8 @@ in {
username = cfg.userName + " <" + cfg.userEmail + ">";
};
xdg.configFile."hg/hgrc".text = generators.toINI { } cfg.iniContent;
xdg.configFile."hg/hgrc".source =
iniFormat.generate "hgrc" cfg.iniContent;
}
(mkIf (cfg.ignores != [ ] || cfg.ignoresRegexp != [ ]) {

View file

@ -8,9 +8,11 @@ let
cfg = config.programs.mpv;
mpvOption = with types; either str (either int (either bool float));
mpvOptions = with types; attrsOf mpvOption;
mpvOptionDup = with types; either mpvOption (listOf mpvOption);
mpvOptions = with types; attrsOf mpvOptionDup;
mpvProfiles = with types; attrsOf mpvOptions;
mpvBindings = with types; attrsOf str;
mpvDefaultProfiles = with types; listOf str;
renderOption = option:
rec {
@ -22,25 +24,33 @@ let
string = option;
}.${typeOf option};
renderOptions = options:
concatStringsSep "\n" (mapAttrsToList (name: value:
renderOptionValue = value:
let
rendered = renderOption value;
length = toString (stringLength rendered);
in "${name}=%${length}%${rendered}") options);
in "%${length}%${rendered}";
renderProfiles = profiles:
concatStringsSep "\n" (mapAttrsToList (name: value: ''
[${name}]
${renderOptions value}
'') profiles);
renderOptions = generators.toKeyValue {
mkKeyValue =
generators.mkKeyValueDefault { mkValueString = renderOptionValue; } "=";
listsAsDuplicateKeys = true;
};
renderProfiles = generators.toINI {
mkKeyValue =
generators.mkKeyValueDefault { mkValueString = renderOptionValue; } "=";
listsAsDuplicateKeys = true;
};
renderBindings = bindings:
concatStringsSep "\n"
(mapAttrsToList (name: value: "${name} ${value}") bindings);
renderDefaultProfiles = profiles:
renderOptions { profile = concatStringsSep "," profiles; };
mpvPackage = if cfg.scripts == [ ] then
pkgs.mpv
cfg.package
else
pkgs.wrapMpv pkgs.mpv-unwrapped { scripts = cfg.scripts; };
@ -50,8 +60,19 @@ in {
enable = mkEnableOption "mpv";
package = mkOption {
type = types.package;
default = pkgs.mpv;
example = literalExample
"pkgs.wrapMpv (pkgs.mpv-unwrapped.override { vapoursynthSupport = true; }) { youtubeSupport = true; }";
description = ''
Package providing mpv.
'';
};
finalPackage = mkOption {
type = types.package;
readOnly = true;
visible = false;
description = ''
Resulting mpv package.
'';
@ -81,7 +102,7 @@ in {
example = literalExample ''
{
profile = "gpu-hq";
force-window = "yes";
force-window = true;
ytdl-format = "bestvideo+bestaudio";
cache-default = 4000000;
}
@ -109,6 +130,16 @@ in {
'';
};
defaultProfiles = mkOption {
description = ''
Profiles to be applied by default. Options set by them are overridden
by options set in <xref linkend="opt-programs.mpv.config"/>.
'';
type = mpvDefaultProfiles;
default = [ ];
example = [ "gpu-hq" ];
};
bindings = mkOption {
description = ''
Input configuration written to
@ -133,12 +164,21 @@ in {
};
config = mkIf cfg.enable (mkMerge [
{
assertions = [{
assertion = (cfg.scripts == [ ]) || (cfg.package == pkgs.mpv);
message = ''
The programs.mpv "package" option is mutually exclusive with "scripts" option.'';
}];
}
{
home.packages = [ mpvPackage ];
programs.mpv.package = mpvPackage;
programs.mpv.finalPackage = mpvPackage;
}
(mkIf (cfg.config != { } || cfg.profiles != { }) {
xdg.configFile."mpv/mpv.conf".text = ''
${optionalString (cfg.defaultProfiles != [ ])
(renderDefaultProfiles cfg.defaultProfiles)}
${optionalString (cfg.config != { }) (renderOptions cfg.config)}
${optionalString (cfg.profiles != { }) (renderProfiles cfg.profiles)}
'';
@ -148,5 +188,5 @@ in {
})
]);
meta.maintainers = with maintainers; [ tadeokondrak ];
meta.maintainers = with maintainers; [ tadeokondrak thiagokokada ];
}

View file

@ -26,9 +26,7 @@ let
tls_fingerprint = msmtp.tls.fingerprint;
} // optionalAttrs (smtp.port != null) { port = toString smtp.port; }
// optionalAttrs (passwordCommand != null) {
# msmtp requires the password to finish with a newline.
passwordeval =
''${pkgs.bash}/bin/bash -c "${toString passwordCommand}; echo"'';
passwordeval = toString passwordCommand;
} // msmtp.extraConfig) ++ optional primary ''
account default : ${name}'');
@ -39,6 +37,8 @@ let
${cfg.extraConfig}
${concatStringsSep "\n\n" (map accountStr mailAccounts)}
${cfg.extraAccounts}
'';
in {
@ -53,6 +53,20 @@ in {
description = ''
Extra configuration lines to add to <filename>~/.msmtprc</filename>.
See <link xlink:href="https://marlam.de/msmtp/msmtprc.txt"/> for examples.
</para><para>
Note, if running msmtp fails with the error message "account default
was already defined" then you probably have an account command here.
Account commands should be placed in
<xref linkend="opt-accounts.email.accounts._name_.msmtp.extraConfig"/>.
'';
};
extraAccounts = mkOption {
type = types.lines;
default = "";
description = ''
Extra configuration lines to add to the end of <filename>~/.msmtprc</filename>.
See <link xlink:href="https://marlam.de/msmtp/msmtprc.txt"/> for examples.
'';
};
};

View file

@ -50,7 +50,7 @@ in {
# In theory, mu is the only thing that creates that directory, and it is
# only created during the initial index.
if [[ ! -d "${dbLocation}" ]]; then
$DRY_RUN_CMD mu init ${maildirOption} $VERBOSE_ARG;
$DRY_RUN_CMD mu init ${maildirOption} ${myAddresses} $VERBOSE_ARG;
fi
'';
};

View file

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

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