mirror of
https://github.com/nix-community/home-manager.git
synced 2026-01-11 17:39:37 +08:00
Compare commits
181 Commits
release-18
...
release-18
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a61b83445 | ||
|
|
2ccbf43e46 | ||
|
|
5c1d10497d | ||
|
|
69851e4c35 | ||
|
|
9d23f09790 | ||
|
|
2fa6dd4cf5 | ||
|
|
d5f6e84862 | ||
|
|
0312d450e2 | ||
|
|
15ef36a7f4 | ||
|
|
78ce79e57d | ||
|
|
b8eb7a03c5 | ||
|
|
deb2868d57 | ||
|
|
6fcaef5235 | ||
|
|
6bc07d4f53 | ||
|
|
c40fa72cde | ||
|
|
594294e2ca | ||
|
|
2b19f15be3 | ||
|
|
9901509ef8 | ||
|
|
5d5bc3dc5a | ||
|
|
ec05213a41 | ||
|
|
9b82a37d28 | ||
|
|
0ac92c6a42 | ||
|
|
5342c9479b | ||
|
|
d99f0cbe62 | ||
|
|
87a897e0c9 | ||
|
|
fdda547e9e | ||
|
|
da31e466a1 | ||
|
|
fa19c18343 | ||
|
|
3c2823e3cd | ||
|
|
dd94a849df | ||
|
|
ee1bfa0d92 | ||
|
|
8980e08240 | ||
|
|
afd2d0fb84 | ||
|
|
2bdaf4ae98 | ||
|
|
1ade5cad80 | ||
|
|
cf5b16b45f | ||
|
|
45057f353c | ||
|
|
ee7631fbe3 | ||
|
|
fdb81a7ea0 | ||
|
|
1c3614cbc8 | ||
|
|
75538973db | ||
|
|
37760ed934 | ||
|
|
6924761aaf | ||
|
|
5ccc2298de | ||
|
|
0f4c798c81 | ||
|
|
f89522362f | ||
|
|
7772158ac4 | ||
|
|
fb96af9b9d | ||
|
|
c73685ec74 | ||
|
|
de2d6a5d95 | ||
|
|
3bef871dac | ||
|
|
27042d1050 | ||
|
|
a6475e3e60 | ||
|
|
17aaf04f72 | ||
|
|
708de1ac8d | ||
|
|
7d6a6cbbe3 | ||
|
|
016005a3a3 | ||
|
|
966b790859 | ||
|
|
bceb74a78c | ||
|
|
bde13d0482 | ||
|
|
6c30decf8d | ||
|
|
4bed99c71c | ||
|
|
f174f90fdf | ||
|
|
a9e218dddd | ||
|
|
3656bf1ad7 | ||
|
|
47450371d9 | ||
|
|
4bb40ac42d | ||
|
|
4c311835a7 | ||
|
|
e9942375ce | ||
|
|
e6bc17e7fb | ||
|
|
9f013a8fb8 | ||
|
|
3c429c2462 | ||
|
|
f60f0c647f | ||
|
|
6d8a296625 | ||
|
|
2d77421d7c | ||
|
|
257dcbcd8a | ||
|
|
f221e4935d | ||
|
|
29161b6e21 | ||
|
|
9e913a9a30 | ||
|
|
e57e34f799 | ||
|
|
af94896ba1 | ||
|
|
8026e4ff6f | ||
|
|
ad0b33387d | ||
|
|
c67d2a916f | ||
|
|
82ed4dae2a | ||
|
|
7e65605d8f | ||
|
|
be7017b9c8 | ||
|
|
5b66b89d6e | ||
|
|
1e7fbde1be | ||
|
|
54fc5f778b | ||
|
|
f60f9c4bb6 | ||
|
|
944c12dbbb | ||
|
|
17fd9cbbd0 | ||
|
|
dc9be1eee6 | ||
|
|
c2cff13f15 | ||
|
|
e267dfea2d | ||
|
|
461869b438 | ||
|
|
1484b1d48b | ||
|
|
d5e21feebb | ||
|
|
cb29a29055 | ||
|
|
c2646f9f2b | ||
|
|
48ba1010ab | ||
|
|
b837f8ae41 | ||
|
|
0312cb611e | ||
|
|
3b7f74ab87 | ||
|
|
c9945550de | ||
|
|
a471c62bf2 | ||
|
|
1e2d80a583 | ||
|
|
159ee7a269 | ||
|
|
ab562d4c2a | ||
|
|
3646088248 | ||
|
|
371715a51c | ||
|
|
c4a9546831 | ||
|
|
88c681606b | ||
|
|
63668b2172 | ||
|
|
0686063f62 | ||
|
|
4a574ca544 | ||
|
|
f4af8151de | ||
|
|
b535770bd4 | ||
|
|
7ab6441ab7 | ||
|
|
2297450ec8 | ||
|
|
ffdbefe22c | ||
|
|
456e2d7ed5 | ||
|
|
fa3d1f98e0 | ||
|
|
c21b69e73e | ||
|
|
9318bd3b0d | ||
|
|
59448d635c | ||
|
|
a9a4fb641f | ||
|
|
f247b3b99b | ||
|
|
fa62c5afb6 | ||
|
|
061c7b633f | ||
|
|
dacc07136c | ||
|
|
abfc37076a | ||
|
|
9a0f388f66 | ||
|
|
b08e6221e0 | ||
|
|
0efda9cd6b | ||
|
|
f4ebbcbf70 | ||
|
|
36ecad6cbe | ||
|
|
22568a3d26 | ||
|
|
8e798e4c28 | ||
|
|
736e340bde | ||
|
|
05c93ff3ae | ||
|
|
8d4c65f259 | ||
|
|
0435d9c338 | ||
|
|
15a5f3278a | ||
|
|
34bbd0ded1 | ||
|
|
c17f37857c | ||
|
|
a2e09b4c9d | ||
|
|
5013155e58 | ||
|
|
7575e119d6 | ||
|
|
3b9b897af3 | ||
|
|
0cfd21cc15 | ||
|
|
05a98b6be0 | ||
|
|
52b9363745 | ||
|
|
f947fafec9 | ||
|
|
68d3cdd722 | ||
|
|
5770dc58b9 | ||
|
|
36da7a918f | ||
|
|
782d2fab83 | ||
|
|
d9c5d3c868 | ||
|
|
9b3122e92c | ||
|
|
f44d4a1d86 | ||
|
|
33a2943e8c | ||
|
|
a1a7e7cd24 | ||
|
|
6957911657 | ||
|
|
7cc36b7703 | ||
|
|
9407b42f97 | ||
|
|
151f29a17a | ||
|
|
f7dc354f42 | ||
|
|
4d870f665b | ||
|
|
0635423e73 | ||
|
|
3f34bf4465 | ||
|
|
9f0fdc68a9 | ||
|
|
701b4130bd | ||
|
|
d27bccdff1 | ||
|
|
5ff03ce5ac | ||
|
|
6eea2a409e | ||
|
|
ea74820176 | ||
|
|
50de1a6885 | ||
|
|
055d100548 | ||
|
|
63efd26767 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/result*
|
||||
@@ -6,8 +6,7 @@ os:
|
||||
|
||||
before_script:
|
||||
- mkdir -m 0755 -p /nix/var/nix/{profiles,gcroots}/per-user/$USER
|
||||
- mkdir -p ~/.config/nixpkgs
|
||||
- echo "{}" > ~/.config/nixpkgs/home.nix
|
||||
|
||||
script:
|
||||
nix-shell . -A install
|
||||
- nix-shell . -A install
|
||||
- nix-shell tests -A run.all
|
||||
|
||||
55
FAQ.md
55
FAQ.md
@@ -64,3 +64,58 @@ adding
|
||||
|
||||
to your `.profile` and `.zshrc` files, respectively. The
|
||||
`hm-session-vars.sh` file should work in most Bourne-like shells.
|
||||
|
||||
How do set up a configuration for multiple users/machines?
|
||||
----------------------------------------------------------
|
||||
|
||||
A typical way to prepare a repository of configurations for multiple
|
||||
logins and machines is to prepare one "top-level" file for each unique
|
||||
combination.
|
||||
|
||||
For example, if you have two machines, called "kronos" and "rhea" on
|
||||
which you want to configure your user "jane" then you could create the
|
||||
files
|
||||
|
||||
- `kronos-jane.nix`,
|
||||
- `rhea-jane.nix`, and
|
||||
- `common.nix`
|
||||
|
||||
in your repository. On the kronos and rhea machines you can then make
|
||||
`~jane/.config/nixpkgs/home.nix` be a symbolic link to the
|
||||
corresponding file in your configuration repository.
|
||||
|
||||
The `kronos-jane.nix` and `rhea-jane.nix` files follow the format
|
||||
|
||||
```nix
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [ ./common.nix ];
|
||||
|
||||
# Various options that are specific for this machine/user.
|
||||
}
|
||||
```
|
||||
|
||||
while the `common.nix` file contains configuration shared across the
|
||||
two logins. Of course, instead of just a single `common.nix` file you
|
||||
can have multiple ones, even one per program or service.
|
||||
|
||||
You can get some inspiration from the [Post your home-manager home.nix
|
||||
file!][1] Reddit thread.
|
||||
|
||||
[1]: https://www.reddit.com/r/NixOS/comments/9bb9h9/post_your_homemanager_homenix_file/
|
||||
|
||||
Why do I get an error message about `ca.desrt.dconf`?
|
||||
-----------------------------------------------------
|
||||
|
||||
You are most likely trying to configure the GTK or Gnome Terminal but
|
||||
the DBus session is not aware of the dconf service. The full error you
|
||||
might get is
|
||||
|
||||
error: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name ca.desrt.dconf was not provided by any .service files
|
||||
|
||||
The solution on NixOS is to add
|
||||
|
||||
services.dbus.packages = with pkgs; [ gnome3.dconf ];
|
||||
|
||||
to your system configuration.
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017-2018 Robert Helgesson
|
||||
Copyright (c) 2017-2019 Robert Helgesson and Home Manager contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
83
README.md
83
README.md
@@ -19,7 +19,7 @@ will write to your dconf store and cannot tell whether a configuration
|
||||
that it is about to be overwrite was from a previous Home Manager
|
||||
generation or from manual configuration.
|
||||
|
||||
Home Manager targets [NixOS][] unstable and NixOS version 18.03 (the
|
||||
Home Manager targets [NixOS][] unstable and NixOS version 18.09 (the
|
||||
current stable version), it may or may not work on other Linux
|
||||
distributions and NixOS versions.
|
||||
|
||||
@@ -31,6 +31,13 @@ on how to manually perform a rollback.
|
||||
Now when your expectations have been built up and you are eager to try
|
||||
all this out you can go ahead and read the rest of this text.
|
||||
|
||||
Contact
|
||||
-------
|
||||
|
||||
You can chat with us on IRC in the channel [#home-manager][] on
|
||||
[freenode][]. The [channel logs][] are hosted courtesy of
|
||||
[samueldr][].
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
@@ -48,56 +55,57 @@ Currently the easiest way to install Home Manager is as follows:
|
||||
|
||||
Also make sure that your user is able to build and install Nix
|
||||
packages. For example, you should be able to successfully run a
|
||||
command like `nix-instantiate '<nixpkgs>' -A hello`. For a
|
||||
multi-user install of Nix this means that your user must be
|
||||
covered by the [`allowed-users`][nixAllowedUsers] Nix option. On
|
||||
NixOS you can control this option using the
|
||||
command like `nix-instantiate '<nixpkgs>' -A hello` without having
|
||||
to switch to the root user. For a multi-user install of Nix this
|
||||
means that your user must be covered by the
|
||||
[`allowed-users`][nixAllowedUsers] Nix option. On NixOS you can
|
||||
control this option using the
|
||||
[`nix.allowedUsers`][nixosAllowedUsers] system option.
|
||||
|
||||
2. Assign a temporary variable holding the URL to the appropriate
|
||||
archive. Typically this is
|
||||
2. Add the appropriate Home Manager channel. Typically this is
|
||||
|
||||
```console
|
||||
$ HM_PATH=https://github.com/rycee/home-manager/archive/master.tar.gz
|
||||
$ nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager
|
||||
$ nix-channel --update
|
||||
```
|
||||
|
||||
if you are following Nixpkgs master or an unstable channel and
|
||||
|
||||
```console
|
||||
$ HM_PATH=https://github.com/rycee/home-manager/archive/release-18.03.tar.gz
|
||||
$ nix-channel --add https://github.com/rycee/home-manager/archive/release-18.09.tar.gz home-manager
|
||||
$ nix-channel --update
|
||||
```
|
||||
|
||||
if you follow a Nixpkgs version 18.03 channel.
|
||||
if you follow a Nixpkgs version 18.09 channel.
|
||||
|
||||
3. Create an initial Home Manager configuration file:
|
||||
On NixOS you may need to log out and back in for the channel to
|
||||
become available. On non-NixOS you may have to add
|
||||
|
||||
```shell
|
||||
export NIX_PATH=$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH
|
||||
```
|
||||
|
||||
to your shell (see [nix#2033](https://github.com/NixOS/nix/issues/2033)).
|
||||
|
||||
3. Install Home Manager and create the first Home Manager generation:
|
||||
|
||||
```console
|
||||
$ cat > ~/.config/nixpkgs/home.nix <<EOF
|
||||
{
|
||||
programs.home-manager.enable = true;
|
||||
programs.home-manager.path = $HM_PATH;
|
||||
}
|
||||
EOF
|
||||
$ nix-shell '<home-manager>' -A install
|
||||
```
|
||||
|
||||
4. Install Home Manager and create the first Home Manager generation:
|
||||
Once finished, Home Manager should be active and available in your
|
||||
user environment.
|
||||
|
||||
```console
|
||||
$ nix-shell $HM_PATH -A install
|
||||
```
|
||||
|
||||
Home Manager should now be active and available in your user
|
||||
environment.
|
||||
|
||||
5. If you do not plan on having Home Manager manage your shell
|
||||
3. If you do not plan on having Home Manager manage your shell
|
||||
configuration then you must source the
|
||||
|
||||
```
|
||||
"$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
|
||||
$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
|
||||
```
|
||||
|
||||
file in your shell configuration. Unfortunately, we currently only
|
||||
support POSIX.2-like shells such as [Bash][] or [Z shell][].
|
||||
file in your shell configuration. Unfortunately, in this specific
|
||||
case we currently only support POSIX.2-like shells such as
|
||||
[Bash][] or [Z shell][].
|
||||
|
||||
For example, if you use Bash then add
|
||||
|
||||
@@ -107,11 +115,10 @@ Currently the easiest way to install Home Manager is as follows:
|
||||
|
||||
to your `~/.profile` file.
|
||||
|
||||
Note, because the `HM_PATH` variable above points to the live Home
|
||||
Manager repository you will automatically get updates whenever you
|
||||
build a new generation. If you dislike automatic updates then perform
|
||||
a Git clone of the desired branch and instead do the above steps with
|
||||
`HM_PATH` set to the _absolute path_ of your clone.
|
||||
If instead of using channels you want to run Home Manager from a Git
|
||||
checkout of the repository then you can use the
|
||||
`programs.home-manager.path` option to specify the absolute path to
|
||||
the repository.
|
||||
|
||||
Usage
|
||||
-----
|
||||
@@ -232,7 +239,7 @@ such collision is detected the activation will terminate before
|
||||
changing anything on your computer.
|
||||
|
||||
For example, suppose you have a wonderful, painstakingly created
|
||||
`~/.gitconfig` and add
|
||||
`~/.config/git/config` and add
|
||||
|
||||
```nix
|
||||
{
|
||||
@@ -300,4 +307,8 @@ in your Home Manager configuration.
|
||||
[nixAllowedUsers]: https://nixos.org/nix/manual/#conf-allowed-users
|
||||
[nixosAllowedUsers]: https://nixos.org/nixos/manual/options.html#opt-nix.allowedUsers
|
||||
[Z shell]: http://zsh.sourceforge.net/
|
||||
[configuration options]: https://rycee.github.io/home-manager/options.html
|
||||
[configuration options]: https://rycee.gitlab.io/home-manager/options.html
|
||||
[#home-manager]: https://webchat.freenode.net/?url=irc%3A%2F%2Firc.freenode.net%2Fhome-manager
|
||||
[freenode]: https://freenode.net/
|
||||
[channel logs]: https://logs.nix.samueldr.com/home-manager/
|
||||
[samueldr]: https://github.com/samueldr/
|
||||
|
||||
@@ -119,6 +119,7 @@ let
|
||||
<toc role="chunk-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-release-notes"><?dbhtml filename="release-notes.html"?></d:tocentry>
|
||||
</d:tocentry>
|
||||
</toc>
|
||||
'';
|
||||
|
||||
236
doc/installation.xml
Normal file
236
doc/installation.xml
Normal file
@@ -0,0 +1,236 @@
|
||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
version="5.0"
|
||||
xml:id="ch-installation">
|
||||
<title>Installing Home Manager</title>
|
||||
<para>
|
||||
Home Manager can be used in three primary ways:
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
Using the standalone <command>home-manager</command> tool. For platforms
|
||||
other than NixOS and Darwin, this is the only available choice. It is also
|
||||
recommended for people on NixOS or Darwin that want to manage their home
|
||||
directory independent of the system as a whole. See
|
||||
<xref linkend="sec-install-standalone"/> for instructions on how to
|
||||
perform this installation.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
As a module within a NixOS system configuration. This allows the user
|
||||
profiles to be built together with the system when running
|
||||
<command>nixos-rebuild</command>. See
|
||||
<xref linkend="sec-install-nixos-module"/> for a description of this
|
||||
setup.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
As a module within a
|
||||
<link xlink:href="https://github.com/LnL7/nix-darwin/">nix-darwin</link>
|
||||
system configuration. This allows the user profiles to be built together
|
||||
with the system when running <command>darwin-rebuild</command>. See
|
||||
<xref linkend="sec-install-nix-darwin-module"/> for a description of this
|
||||
setup.
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
<section xml:id="sec-install-standalone">
|
||||
<title>Standalone installation</title>
|
||||
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
Make sure you have a working Nix installation. If you are not using NixOS
|
||||
then it may be necessary to run
|
||||
</para>
|
||||
<screen>
|
||||
<prompt>$</prompt> <userinput>mkdir -m 0755 -p /nix/var/nix/{profiles,gcroots}/per-user/$USER</userinput>
|
||||
</screen>
|
||||
<para>
|
||||
since Home Manager uses these directories to manage your profile
|
||||
generations. On NixOS these should already be available.
|
||||
</para>
|
||||
<para>
|
||||
Also make sure that your user is able to build and install Nix packages.
|
||||
For example, you should be able to successfully run a command like
|
||||
<literal>nix-instantiate '<nixpkgs>' -A hello</literal> without
|
||||
having to switch to the root user. For a multi-user install of Nix this
|
||||
means that your user must be covered by the
|
||||
<link xlink:href="https://nixos.org/nix/manual/#conf-allowed-users"><literal>allowed-users</literal></link>
|
||||
Nix option. On NixOS you can control this option using the
|
||||
<link xlink:href="https://nixos.org/nixos/manual/options.html#opt-nix.allowedUsers"><literal>nix.allowedUsers</literal></link>
|
||||
system option.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Add the Home Manager channel that you wish to follow. This is done by
|
||||
running
|
||||
</para>
|
||||
<screen>
|
||||
<prompt>$</prompt> <userinput>nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager</userinput>
|
||||
<prompt>$</prompt> <userinput>nix-channel --update</userinput>
|
||||
</screen>
|
||||
<para>
|
||||
if you are following Nixpkgs master or an unstable channel and
|
||||
</para>
|
||||
<screen>
|
||||
<prompt>$</prompt> <userinput>nix-channel --add https://github.com/rycee/home-manager/archive/release-18.09.tar.gz home-manager</userinput>
|
||||
<prompt>$</prompt> <userinput>nix-channel --update</userinput>
|
||||
</screen>
|
||||
<para>
|
||||
if you follow a Nixpkgs version 18.09 channel.
|
||||
</para>
|
||||
<para>
|
||||
On NixOS you may need to log out and back in for the channel to become
|
||||
available. On non-NixOS you may have to add
|
||||
<programlisting language="bash">
|
||||
export NIX_PATH=$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH
|
||||
</programlisting>
|
||||
to your shell (see
|
||||
<link xlink:href="https://github.com/NixOS/nix/issues/2033">nix#2033</link>).
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Run the Home Manager installation command and create the first Home
|
||||
Manager generation:
|
||||
</para>
|
||||
<screen>
|
||||
<prompt>$</prompt> <userinput>nix-shell '<home-manager>' -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">
|
||||
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
|
||||
</programlisting>
|
||||
<para>
|
||||
to your <literal>~/.profile</literal> file.
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
|
||||
<para>
|
||||
If instead of using channels you want to run Home Manager from a Git
|
||||
checkout of the repository then you can use the
|
||||
<literal>programs.home-manager.path</literal> option to specify the absolute
|
||||
path to the repository.
|
||||
</para>
|
||||
</section>
|
||||
<section xml:id="sec-install-nixos-module">
|
||||
<title>NixOS module</title>
|
||||
|
||||
<para>
|
||||
Home Manager provides a NixOS module that allows you to prepare user
|
||||
environments directly from the system configuration file, which often is
|
||||
more convenient than using the <command>home-manager</command> tool. It also
|
||||
opens up additional possibilities, for example, to automatically configure
|
||||
user environments in NixOS declarative containers or on systems deployed
|
||||
through NixOps.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To make the NixOS module available for use you must <option>import</option>
|
||||
it into your system configuration. This is most conveniently done by adding
|
||||
a Home Manager channel, for example
|
||||
</para>
|
||||
|
||||
<screen>
|
||||
<prompt>#</prompt> <userinput>nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager</userinput>
|
||||
<prompt>#</prompt> <userinput>nix-channel --update</userinput>
|
||||
</screen>
|
||||
|
||||
<para>
|
||||
if you are following Nixpkgs master or an unstable channel and
|
||||
</para>
|
||||
|
||||
<screen>
|
||||
<prompt>#</prompt> <userinput>nix-channel --add https://github.com/rycee/home-manager/archive/release-18.09.tar.gz home-manager</userinput>
|
||||
<prompt>#</prompt> <userinput>nix-channel --update</userinput>
|
||||
</screen>
|
||||
|
||||
<para>
|
||||
if you follow a Nixpkgs version 18.09 channel.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
It is then possible to add
|
||||
</para>
|
||||
|
||||
<programlisting language="nix">
|
||||
imports = [ <home-manager/nixos> ];
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
to your system <filename>configuration.nix</filename> file, which will
|
||||
introduce a new NixOS option called <option>home-manager.users</option>
|
||||
whose type is an attribute set that maps user names to Home Manager
|
||||
configurations.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For example, a NixOS configuration may include the lines
|
||||
</para>
|
||||
|
||||
<programlisting language="nix">
|
||||
users.users.eve.isNormalUser = true;
|
||||
home-manager.users.eve = { pkgs, ... }: {
|
||||
home.packages = [ pkgs.atool pkgs.httpie ];
|
||||
programs.bash.enable = true;
|
||||
};
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
and after a <command>nixos-rebuild switch</command> the user eve's
|
||||
environment should include a basic Bash configuration and the packages atool
|
||||
and httpie.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
By default packages will be installed to
|
||||
<filename>$HOME/.nix-profile</filename> but they can be installed to
|
||||
<filename>/etc/profiles</filename> if
|
||||
</para>
|
||||
<programlisting language="nix">
|
||||
home-manager.useUserPackages = true;
|
||||
</programlisting>
|
||||
<para>
|
||||
is added to the system configuration. This is necessary if, for example,
|
||||
you wish to use <command>nixos-rebuild build-vm</command>. This option may
|
||||
become the default value in the future.
|
||||
</para>
|
||||
</note>
|
||||
</section>
|
||||
<section xml:id="sec-install-nix-darwin-module">
|
||||
<title>nix-darwin module</title>
|
||||
|
||||
<para>
|
||||
To be done.
|
||||
</para>
|
||||
</section>
|
||||
</chapter>
|
||||
@@ -7,22 +7,19 @@
|
||||
<refmiscinfo class="source">Home Manager</refmiscinfo>
|
||||
<!-- <refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo> -->
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname><filename>home-configuration.nix</filename></refname>
|
||||
<refpurpose>Home Manager configuration specification</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsection>
|
||||
<title>Description</title>
|
||||
<para>
|
||||
The file <filename>~/.config/nixpkgs/home.nix</filename> contains
|
||||
the declarative specification of your Home Manager configuration.
|
||||
The command <command>home-manager</command> takes this file and
|
||||
realises the user environment configuration specified therein.
|
||||
The file <filename>~/.config/nixpkgs/home.nix</filename> contains the
|
||||
declarative specification of your Home Manager configuration. The command
|
||||
<command>home-manager</command> takes this file and realises the user
|
||||
environment configuration specified therein.
|
||||
</para>
|
||||
</refsection>
|
||||
|
||||
<refsection>
|
||||
<title>Options</title>
|
||||
<para>
|
||||
@@ -31,4 +28,13 @@
|
||||
</para>
|
||||
<xi:include href="./generated/options-db.xml" xpointer="configuration-variable-list" />
|
||||
</refsection>
|
||||
<refsection>
|
||||
<title>See also</title>
|
||||
<para>
|
||||
<citerefentry>
|
||||
<refentrytitle>home-manager</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
</citerefentry>
|
||||
</para>
|
||||
</refsection>
|
||||
</refentry>
|
||||
|
||||
@@ -3,60 +3,86 @@
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<refmeta>
|
||||
<refentrytitle><command>home-manager</command></refentrytitle>
|
||||
<manvolnum>8</manvolnum>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="source">Home Manager</refmiscinfo>
|
||||
<!-- <refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo> -->
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname><command>home-manager</command></refname>
|
||||
<refpurpose>reconfigure a user environment</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>home-manager</command>
|
||||
<group choice='req'>
|
||||
<arg choice='plain'><option>help</option></arg>
|
||||
<arg choice='plain'><option>build</option></arg>
|
||||
<arg choice='plain'><option>switch</option></arg>
|
||||
<arg choice='plain'><option>generations</option></arg>
|
||||
<arg choice='plain'><option>remove-generations</option></arg>
|
||||
<arg choice='plain'><option>packages</option></arg>
|
||||
<arg choice='plain'><option>news</option></arg>
|
||||
<command>home-manager</command> <group choice="req">
|
||||
<arg choice="plain">
|
||||
<option>help</option>
|
||||
</arg>
|
||||
|
||||
<arg choice="plain">
|
||||
<option>build</option>
|
||||
</arg>
|
||||
|
||||
<arg choice="plain">
|
||||
<option>switch</option>
|
||||
</arg>
|
||||
|
||||
<arg choice="plain">
|
||||
<option>generations</option>
|
||||
</arg>
|
||||
|
||||
<arg choice="plain">
|
||||
<option>remove-generations</option>
|
||||
</arg>
|
||||
|
||||
<arg choice="plain">
|
||||
<option>packages</option>
|
||||
</arg>
|
||||
|
||||
<arg choice="plain">
|
||||
<option>news</option>
|
||||
</arg>
|
||||
</group>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsection>
|
||||
<title>Description</title>
|
||||
<para>
|
||||
This command updates the user environment so that it corresponds to the configuration
|
||||
specified in <filename>~/.config/nixpkgs/home.nix</filename>.
|
||||
This command updates the user environment so that it corresponds to the
|
||||
configuration specified in <filename>~/.config/nixpkgs/home.nix</filename>.
|
||||
</para>
|
||||
</refsection>
|
||||
|
||||
<refsection>
|
||||
<title>Files</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><filename>~/.local/share/home-manager/news-read-ids</filename></term>
|
||||
<term>
|
||||
<filename>~/.local/share/home-manager/news-read-ids</filename>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Identifiers of news items that have been shown. Can be deleted
|
||||
to reset the read news indicator.
|
||||
Identifiers of news items that have been shown. Can be deleted to reset
|
||||
the read news indicator.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsection>
|
||||
|
||||
<refsection>
|
||||
<title>Bugs</title>
|
||||
<para>
|
||||
Please report any bugs on the <link
|
||||
Please report any bugs on the
|
||||
<link
|
||||
xlink:href="https://github.com/rycee/home-manager/issues">project
|
||||
issue tracker</link>.
|
||||
</para>
|
||||
</refsection>
|
||||
<refsection>
|
||||
<title>See also</title>
|
||||
<para>
|
||||
<citerefentry>
|
||||
<refentrytitle>home-configuration.nix</refentrytitle>
|
||||
<manvolnum>5</manvolnum>
|
||||
</citerefentry>
|
||||
</para>
|
||||
</refsection>
|
||||
</refentry>
|
||||
|
||||
@@ -3,12 +3,8 @@
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<title>Home Manager Reference Pages</title>
|
||||
<info>
|
||||
<author>
|
||||
<personname>Home Manager contributors</personname>
|
||||
<contrib>Author</contrib>
|
||||
</author>
|
||||
<copyright>
|
||||
<year>2017-2018</year><holder>Home Manager contributors</holder>
|
||||
<author><personname>Home Manager contributors</personname></author>
|
||||
<copyright><year>2017–2019</year><holder>Home Manager contributors</holder>
|
||||
</copyright>
|
||||
</info>
|
||||
<xi:include href="man-configuration.xml" />
|
||||
|
||||
@@ -9,12 +9,13 @@
|
||||
<preface>
|
||||
<title>Preface</title>
|
||||
<para>
|
||||
This manual will eventually describes how to install, use, and
|
||||
extend Home Manager.
|
||||
This manual will eventually describes how to install, use, and extend Home
|
||||
Manager.
|
||||
</para>
|
||||
<para>
|
||||
If you encounter problems or bugs then please report them on the
|
||||
<link xlink:href="https://github.com/rycee/home-manager/issues">Home Manager issue tracker</link>.
|
||||
<link xlink:href="https://github.com/rycee/home-manager/issues">Home Manager
|
||||
issue tracker</link>.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
@@ -24,8 +25,10 @@
|
||||
</para>
|
||||
</note>
|
||||
</preface>
|
||||
<xi:include href="installation.xml" />
|
||||
<appendix xml:id="ch-options">
|
||||
<title>Configuration Options</title>
|
||||
<xi:include href="./generated/options-db.xml" xpointer="configuration-variable-list" />
|
||||
</appendix>
|
||||
<xi:include href="./release-notes/release-notes.xml" />
|
||||
</book>
|
||||
|
||||
13
doc/release-notes/release-notes.xml
Normal file
13
doc/release-notes/release-notes.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<appendix xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
version="5.0"
|
||||
xml:id="ch-release-notes">
|
||||
<title>Release Notes</title>
|
||||
<para>
|
||||
This section lists the release notes for stable versions of Home Manager and
|
||||
the current unstable version.
|
||||
</para>
|
||||
<xi:include href="rl-1903.xml" />
|
||||
<xi:include href="rl-1809.xml" />
|
||||
</appendix>
|
||||
11
doc/release-notes/rl-1809.xml
Normal file
11
doc/release-notes/rl-1809.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<section 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="sec-release-18.09">
|
||||
<title>Release 18.09</title>
|
||||
|
||||
<para>
|
||||
The 18.09 release branch became the stable branch in September, 2018.
|
||||
</para>
|
||||
</section>
|
||||
67
doc/release-notes/rl-1903.xml
Normal file
67
doc/release-notes/rl-1903.xml
Normal file
@@ -0,0 +1,67 @@
|
||||
<section 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="sec-release-19.03">
|
||||
<title>Release 19.03 (unstable)</title>
|
||||
|
||||
<para>
|
||||
This is the current unstable branch and the information in this section is
|
||||
therefore not final.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Scheduled released is March, 2019.
|
||||
</para>
|
||||
|
||||
<section 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="sec-release-19.03-highlights">
|
||||
<title>Highlights</title>
|
||||
|
||||
<para>
|
||||
This release has the following notable changes:
|
||||
</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
The <option>home.file.<name?>.source</option> now allows source
|
||||
files to be hidden, that is, having a name starting with the
|
||||
<literal>.</literal> character. It also allows the source file name to
|
||||
contain characters not typically allowed for Nix store paths. For example,
|
||||
your configuration can now contain things such as
|
||||
<programlisting>
|
||||
home.file."my file".source = ./. + "/file with spaces!";
|
||||
</programlisting>
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
|
||||
<section 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="sec-release-19.03-state-version-changes">
|
||||
<title>State Version Changes</title>
|
||||
|
||||
<para>
|
||||
The state version in this release includes the changes below. These changes
|
||||
are only active if the <option>home.stateVersion</option> option is set to
|
||||
"19.03" or later.
|
||||
</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
There is now an option <option>programs.beets.enable</option> that
|
||||
defaults to <literal>false</literal>. Before the module would be active if
|
||||
the <option>programs.beets.settings</option> option was non-empty.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
</section>
|
||||
@@ -12,23 +12,26 @@ let
|
||||
|
||||
in
|
||||
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "home-manager";
|
||||
|
||||
buildCommand = ''
|
||||
install -v -D -m755 ${./home-manager} $out/bin/home-manager
|
||||
pkgs.runCommand
|
||||
"home-manager"
|
||||
{
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
meta = with pkgs.stdenv.lib; {
|
||||
description = "A user environment configurator";
|
||||
maintainers = [ maintainers.rycee ];
|
||||
platforms = platforms.unix;
|
||||
license = licenses.mit;
|
||||
};
|
||||
}
|
||||
''
|
||||
install -v -D -m755 ${./home-manager} $out/bin/home-manager
|
||||
|
||||
substituteInPlace $out/bin/home-manager \
|
||||
--subst-var-by bash "${pkgs.bash}" \
|
||||
--subst-var-by coreutils "${pkgs.coreutils}" \
|
||||
--subst-var-by findutils "${pkgs.findutils}" \
|
||||
--subst-var-by gnused "${pkgs.gnused}" \
|
||||
--subst-var-by less "${pkgs.less}" \
|
||||
--subst-var-by HOME_MANAGER_PATH '${pathStr}'
|
||||
'';
|
||||
|
||||
meta = with pkgs.stdenv.lib; {
|
||||
description = "A user environment configurator";
|
||||
maintainers = [ maintainers.rycee ];
|
||||
platforms = platforms.unix;
|
||||
license = licenses.mit;
|
||||
};
|
||||
}
|
||||
''
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#!@bash@/bin/bash
|
||||
|
||||
# This code explicitly requires GNU Core Utilities and we therefore
|
||||
# need to ensure they are prioritized over any other similarly named
|
||||
# tools on the system.
|
||||
PATH=@coreutils@/bin:@less@/bin${PATH:+:}$PATH
|
||||
# Prepare to use tools from Nixpkgs.
|
||||
PATH=@coreutils@/bin:@findutils@/bin:@gnused@/bin:@less@/bin${PATH:+:}$PATH
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
@@ -131,6 +129,17 @@ function presentNews() {
|
||||
fi
|
||||
}
|
||||
|
||||
function doEdit() {
|
||||
if [[ ! -v EDITOR || -z $EDITOR ]]; then
|
||||
errorEcho "Please set the \$EDITOR environment variable"
|
||||
return 1
|
||||
fi
|
||||
|
||||
setConfigFile
|
||||
|
||||
exec "$EDITOR" "$HOME_MANAGER_CONFIG"
|
||||
}
|
||||
|
||||
function doBuild() {
|
||||
if [[ ! -w . ]]; then
|
||||
errorEcho "Cannot run build in read-only directory";
|
||||
@@ -237,6 +246,23 @@ function doRmGenerations() {
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
function doExpireGenerations() {
|
||||
local profileDir="/nix/var/nix/profiles/per-user/$USER"
|
||||
|
||||
local generations
|
||||
generations="$( \
|
||||
find "$profileDir" -name 'home-manager-*-link' -not -newermt "$1" \
|
||||
| sed 's/^.*-\([0-9]*\)-link$/\1/' \
|
||||
)"
|
||||
|
||||
if [[ -n $generations ]]; then
|
||||
# shellcheck disable=2086
|
||||
doRmGenerations $generations
|
||||
elif [[ -v VERBOSE ]]; then
|
||||
echo "No generations to expire"
|
||||
fi
|
||||
}
|
||||
|
||||
function doListPackages() {
|
||||
local outPath
|
||||
outPath="$(nix-env -q --out-path | grep -o '/.*home-manager-path$')"
|
||||
@@ -339,6 +365,8 @@ function doHelp() {
|
||||
echo
|
||||
echo " help Print this help"
|
||||
echo
|
||||
echo " edit Open the home configuration in \$EDITOR"
|
||||
echo
|
||||
echo " build Build configuration into result directory"
|
||||
echo
|
||||
echo " switch Build and activate configuration"
|
||||
@@ -349,6 +377,11 @@ function doHelp() {
|
||||
echo " Remove indicated generations. Use 'generations' command to"
|
||||
echo " find suitable generation numbers."
|
||||
echo
|
||||
echo " expire-generations TIMESTAMP"
|
||||
echo " Remove generations older than TIMESTAMP where TIMESTAMP is"
|
||||
echo " interpreted as in the -d argument of the date tool. For"
|
||||
echo " example \"-30 days\" or \"2018-01-01\"."
|
||||
echo
|
||||
echo " packages List all packages installed in home-manager-path"
|
||||
echo
|
||||
echo " news Show news entries in a pager"
|
||||
@@ -410,6 +443,9 @@ cmd="$1"
|
||||
shift 1
|
||||
|
||||
case "$cmd" in
|
||||
edit)
|
||||
doEdit
|
||||
;;
|
||||
build)
|
||||
doBuild
|
||||
;;
|
||||
@@ -422,6 +458,9 @@ case "$cmd" in
|
||||
remove-generations)
|
||||
doRmGenerations "$@"
|
||||
;;
|
||||
expire-generations)
|
||||
doExpireGenerations "$@"
|
||||
;;
|
||||
packages)
|
||||
doListPackages
|
||||
;;
|
||||
|
||||
@@ -9,7 +9,7 @@ with pkgs.lib;
|
||||
|
||||
let
|
||||
|
||||
env = import <home-manager/modules> {
|
||||
env = import ../modules {
|
||||
configuration =
|
||||
if confAttr == ""
|
||||
then confPath
|
||||
|
||||
@@ -7,6 +7,23 @@ pkgs.runCommand
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
shellHook = ''
|
||||
confFile="''${XDG_CONFIG_HOME:-$HOME/.config}/nixpkgs/home.nix"
|
||||
|
||||
if [[ ! -e $confFile ]]; then
|
||||
echo
|
||||
echo "Creating initial Home Manager configuration..."
|
||||
|
||||
mkdir -p "$(dirname "$confFile")"
|
||||
cat > $confFile <<EOF
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Creating initial Home Manager generation..."
|
||||
echo
|
||||
@@ -17,7 +34,7 @@ pkgs.runCommand
|
||||
All done! The home-manager tool should now be installed and you
|
||||
can edit
|
||||
|
||||
''${XDG_CONFIG_HOME:-~/.config}/nixpkgs/home.nix
|
||||
$confFile
|
||||
|
||||
to configure Home Manager. Run 'man home-configuration.nix' to
|
||||
see all available options.
|
||||
|
||||
@@ -6,6 +6,52 @@ let
|
||||
|
||||
cfg = config.accounts.email;
|
||||
|
||||
gpgModule = types.submodule {
|
||||
options = {
|
||||
key = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
The key to use as listed in <command>gpg --list-keys</command>.
|
||||
'';
|
||||
};
|
||||
|
||||
signByDefault = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Sign messages by default.";
|
||||
};
|
||||
|
||||
encryptByDefault = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Encrypt outgoing messages by default.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
signatureModule = types.submodule {
|
||||
options = {
|
||||
text = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
example = ''
|
||||
--
|
||||
Luke Skywalker
|
||||
May the force be with you.
|
||||
'';
|
||||
description = ''
|
||||
Signature content.
|
||||
'';
|
||||
};
|
||||
|
||||
showSignature = mkOption {
|
||||
type = types.enum [ "append" "attach" "none" ];
|
||||
default = "none";
|
||||
description = "Method to communicate the signature.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
tlsModule = types.submodule {
|
||||
options = {
|
||||
enable = mkOption {
|
||||
@@ -237,6 +283,22 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
signature = mkOption {
|
||||
type = signatureModule;
|
||||
default = {};
|
||||
description = ''
|
||||
Signature configuration.
|
||||
'';
|
||||
};
|
||||
|
||||
gpg = mkOption {
|
||||
type = types.nullOr gpgModule;
|
||||
default = null;
|
||||
description = ''
|
||||
GPG configuration.
|
||||
'';
|
||||
};
|
||||
|
||||
smtp = mkOption {
|
||||
type = types.nullOr smtpModule;
|
||||
default = null;
|
||||
@@ -317,6 +379,8 @@ in
|
||||
accounts = mkOption {
|
||||
type = types.attrsOf (types.submodule [
|
||||
mailAccountOpts
|
||||
(import ../programs/alot-accounts.nix)
|
||||
(import ../programs/astroid-accounts.nix)
|
||||
(import ../programs/mbsync-accounts.nix)
|
||||
(import ../programs/msmtp-accounts.nix)
|
||||
(import ../programs/notmuch-accounts.nix)
|
||||
|
||||
@@ -23,6 +23,9 @@ let
|
||||
modules =
|
||||
[ configuration ]
|
||||
++ (import ./modules.nix { inherit check lib pkgs; });
|
||||
specialArgs = {
|
||||
modulesPath = builtins.toString ./.;
|
||||
};
|
||||
};
|
||||
|
||||
module = showWarnings (
|
||||
|
||||
@@ -14,6 +14,15 @@ let
|
||||
inherit homeDirectory lib pkgs;
|
||||
}).fileType;
|
||||
|
||||
sourceStorePath = file:
|
||||
let
|
||||
sourcePath = toString file.source;
|
||||
sourceName = config.lib.strings.storeFileName (baseNameOf sourcePath);
|
||||
in
|
||||
if builtins.hasContext sourcePath
|
||||
then file.source
|
||||
else builtins.path { path = file.source; name = sourceName; };
|
||||
|
||||
# A symbolic link whose target path matches this pattern will be
|
||||
# considered part of a Home Manager generation.
|
||||
homeFilePattern = "${builtins.storeDir}/*-home-manager-files/*";
|
||||
@@ -36,20 +45,6 @@ in
|
||||
};
|
||||
|
||||
config = {
|
||||
assertions = [
|
||||
(let
|
||||
badFiles =
|
||||
filter (f: hasPrefix "." (baseNameOf f))
|
||||
(map (v: toString v.source)
|
||||
(attrValues cfg));
|
||||
badFilesStr = toString badFiles;
|
||||
in
|
||||
{
|
||||
assertion = badFiles == [];
|
||||
message = "Source file names must not start with '.': ${badFilesStr}";
|
||||
})
|
||||
];
|
||||
|
||||
# This verifies that the links we are about to create will not
|
||||
# overwrite an existing file.
|
||||
home.activation.checkLinkTargets = dag.entryBefore ["writeBoundary"] (
|
||||
@@ -201,7 +196,7 @@ in
|
||||
''
|
||||
declare -A changedFiles
|
||||
'' + concatMapStrings (v: ''
|
||||
cmp --quiet "${v.source}" "${config.home.homeDirectory}/${v.target}" \
|
||||
cmp --quiet "${sourceStorePath v}" "${homeDirectory}/${v.target}" \
|
||||
&& changedFiles["${v.target}"]=0 \
|
||||
|| changedFiles["${v.target}"]=1
|
||||
'') (filter (v: v.onChange != "") (attrValues cfg))
|
||||
@@ -215,17 +210,16 @@ in
|
||||
'') (filter (v: v.onChange != "") (attrValues cfg))
|
||||
);
|
||||
|
||||
home-files = pkgs.stdenv.mkDerivation {
|
||||
name = "home-manager-files";
|
||||
|
||||
nativeBuildInputs = [ pkgs.xlibs.lndir ];
|
||||
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
|
||||
# Symlink directories and files that have the right execute bit.
|
||||
# Copy files that need their execute bit changed.
|
||||
buildCommand = ''
|
||||
# Symlink directories and files that have the right execute bit.
|
||||
# Copy files that need their execute bit changed.
|
||||
home-files = pkgs.runCommand
|
||||
"home-manager-files"
|
||||
{
|
||||
nativeBuildInputs = [ pkgs.xlibs.lndir ];
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
}
|
||||
(''
|
||||
mkdir -p $out
|
||||
|
||||
function insertFile() {
|
||||
@@ -277,14 +271,13 @@ in
|
||||
}
|
||||
'' + concatStrings (
|
||||
mapAttrsToList (n: v: ''
|
||||
insertFile "${v.source}" \
|
||||
insertFile "${sourceStorePath v}" \
|
||||
"${v.target}" \
|
||||
"${if v.executable == null
|
||||
then "inherit"
|
||||
else builtins.toString v.executable}" \
|
||||
"${builtins.toString v.recursive}"
|
||||
'') cfg
|
||||
);
|
||||
};
|
||||
));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -139,9 +139,12 @@ in
|
||||
};
|
||||
|
||||
home.keyboard = mkOption {
|
||||
type = keyboardSubModule;
|
||||
type = types.nullOr keyboardSubModule;
|
||||
default = {};
|
||||
description = "Keyboard configuration.";
|
||||
description = ''
|
||||
Keyboard configuration. Set to <literal>null</literal> to
|
||||
disable Home Manager keyboard management.
|
||||
'';
|
||||
};
|
||||
|
||||
home.sessionVariables = mkOption {
|
||||
@@ -163,7 +166,7 @@ in
|
||||
Note, these variables may be set in any order so no session
|
||||
variable may have a runtime dependency on another session
|
||||
variable. In particular code like
|
||||
<programlisting>
|
||||
<programlisting language="nix">
|
||||
home.sessionVariables = {
|
||||
FOO = "Hello";
|
||||
BAR = "$FOO World!";
|
||||
@@ -172,7 +175,7 @@ in
|
||||
may not work as expected. If you need to reference another
|
||||
session variable, then do so inside Nix instead. The above
|
||||
example then becomes
|
||||
<programlisting>
|
||||
<programlisting language="nix">
|
||||
home.sessionVariables = {
|
||||
FOO = "Hello";
|
||||
BAR = "''${config.home.sessionVariables.FOO} World!";
|
||||
@@ -243,6 +246,15 @@ in
|
||||
Extra commands to run in the Home Manager generation builder.
|
||||
'';
|
||||
};
|
||||
|
||||
home.extraProfileCommands = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
internal = true;
|
||||
description = ''
|
||||
Extra commands to run in the Home Manager profile builder.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
@@ -260,7 +272,11 @@ in
|
||||
home.username = mkDefault (builtins.getEnv "USER");
|
||||
home.homeDirectory = mkDefault (builtins.getEnv "HOME");
|
||||
|
||||
home.profileDirectory = cfg.homeDirectory + "/.nix-profile";
|
||||
home.profileDirectory =
|
||||
if config.submoduleSupport.enable
|
||||
&& config.submoduleSupport.externalPackageInstall
|
||||
then config.home.path
|
||||
else cfg.homeDirectory + "/.nix-profile";
|
||||
|
||||
home.sessionVariables =
|
||||
let
|
||||
@@ -298,9 +314,33 @@ in
|
||||
home.activation.writeBoundary = dag.entryAnywhere "";
|
||||
|
||||
# Install packages to the user environment.
|
||||
home.activation.installPackages = dag.entryAfter ["writeBoundary"] ''
|
||||
$DRY_RUN_CMD nix-env -i ${cfg.path}
|
||||
'';
|
||||
#
|
||||
# Note, sometimes our target may not allow modification of the Nix
|
||||
# store and then we cannot rely on `nix-env -i`. This is the case,
|
||||
# for example, if we are running as a NixOS module and building a
|
||||
# virtual machine. Then we must instead rely on an external
|
||||
# mechanism for installing packages, which in NixOS is provided by
|
||||
# the `users.users.<name?>.packages` option. The activation
|
||||
# command is still needed since some modules need to run their
|
||||
# activation commands after the packages are guaranteed to be
|
||||
# installed.
|
||||
#
|
||||
# In case the user has moved from a user-install of Home Manager
|
||||
# to a submodule managed one we attempt to uninstall the
|
||||
# `home-manager-path` package if it is installed.
|
||||
home.activation.installPackages = dag.entryAfter ["writeBoundary"] (
|
||||
if config.submoduleSupport.externalPackageInstall
|
||||
then
|
||||
''
|
||||
if nix-env -q | grep '^home-manager-path$'; then
|
||||
$DRY_RUN_CMD nix-env -e home-manager-path
|
||||
fi
|
||||
''
|
||||
else
|
||||
''
|
||||
$DRY_RUN_CMD nix-env -i ${cfg.path}
|
||||
''
|
||||
);
|
||||
|
||||
home.activationPackage =
|
||||
let
|
||||
@@ -346,13 +386,13 @@ in
|
||||
${activationCmds}
|
||||
'';
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "home-manager-generation";
|
||||
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
|
||||
buildCommand = ''
|
||||
pkgs.runCommand
|
||||
"home-manager-generation"
|
||||
{
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
}
|
||||
''
|
||||
mkdir -p $out
|
||||
|
||||
cp ${activationScript} $out/activate
|
||||
@@ -365,7 +405,6 @@ in
|
||||
|
||||
${cfg.extraBuilderCommands}
|
||||
'';
|
||||
};
|
||||
|
||||
home.path = pkgs.buildEnv {
|
||||
name = "home-manager-path";
|
||||
@@ -373,6 +412,8 @@ in
|
||||
paths = cfg.packages;
|
||||
inherit (cfg) extraOutputsToInstall;
|
||||
|
||||
postBuild = cfg.extraProfileCommands;
|
||||
|
||||
meta = {
|
||||
description = "Environment of packages installed through home-manager";
|
||||
};
|
||||
|
||||
@@ -16,5 +16,8 @@
|
||||
entryBefore = d.dagEntryBefore;
|
||||
};
|
||||
|
||||
strings = import ./strings.nix { inherit lib; };
|
||||
|
||||
shell = import ./shell.nix { inherit lib; };
|
||||
zsh = import ./zsh.nix { inherit lib; };
|
||||
}
|
||||
|
||||
@@ -4,27 +4,7 @@ with lib;
|
||||
|
||||
let
|
||||
|
||||
# Figures out a valid Nix store name for the given path.
|
||||
storeFileName = path:
|
||||
let
|
||||
# All characters that are considered safe. Note "-" is not
|
||||
# included to avoid "-" followed by digit being interpreted as a
|
||||
# version.
|
||||
safeChars =
|
||||
[ "+" "." "_" "?" "=" ]
|
||||
++ lowerChars
|
||||
++ upperChars
|
||||
++ stringToCharacters "0123456789";
|
||||
|
||||
empties = l: genList (x: "") (length l);
|
||||
|
||||
unsafeInName = stringToCharacters (
|
||||
replaceStrings safeChars (empties safeChars) path
|
||||
);
|
||||
|
||||
safeName = replaceStrings unsafeInName (empties unsafeInName) path;
|
||||
in
|
||||
"home_file_" + safeName;
|
||||
stringsExtra = import ./strings.nix { inherit lib; };
|
||||
|
||||
in
|
||||
|
||||
@@ -113,7 +93,7 @@ in
|
||||
source = mkIf (config.text != null) (
|
||||
mkDefault (pkgs.writeTextFile {
|
||||
inherit (config) executable text;
|
||||
name = storeFileName name;
|
||||
name = stringsExtra.storeFileName name;
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
27
modules/lib/strings.nix
Normal file
27
modules/lib/strings.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{ lib }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
# Figures out a valid Nix store name for the given path.
|
||||
storeFileName = path:
|
||||
let
|
||||
# All characters that are considered safe. Note "-" is not
|
||||
# included to avoid "-" followed by digit being interpreted as a
|
||||
# version.
|
||||
safeChars =
|
||||
[ "+" "." "_" "?" "=" ]
|
||||
++ lowerChars
|
||||
++ upperChars
|
||||
++ stringToCharacters "0123456789";
|
||||
|
||||
empties = l: genList (x: "") (length l);
|
||||
|
||||
unsafeInName = stringToCharacters (
|
||||
replaceStrings safeChars (empties safeChars) path
|
||||
);
|
||||
|
||||
safeName = replaceStrings unsafeInName (empties unsafeInName) path;
|
||||
in
|
||||
"hm_" + safeName;
|
||||
}
|
||||
28
modules/lib/zsh.nix
Normal file
28
modules/lib/zsh.nix
Normal file
@@ -0,0 +1,28 @@
|
||||
{ lib }:
|
||||
|
||||
rec {
|
||||
# Produces a Zsh shell like value
|
||||
toZshValue = v: if builtins.isBool v then
|
||||
if v then "true" else "false"
|
||||
else if builtins.isString v then
|
||||
"\"${v}\""
|
||||
else if builtins.isList v then
|
||||
"(${lib.concatStringsSep " " (map toZshValue v)})"
|
||||
else "\"${toString v}\"";
|
||||
|
||||
# Produces a Zsh shell like definition statement
|
||||
define = n: v: "${n}=${toZshValue v}";
|
||||
|
||||
# Given an attribute set containing shell variable names and their
|
||||
# assignments, this function produces a string containing a definition
|
||||
# statement for each set entry.
|
||||
defineAll = vars: lib.concatStringsSep "\n" (lib.mapAttrsToList define vars);
|
||||
|
||||
# Produces a Zsh shell like export statement
|
||||
export = n: v: "export ${define n v}";
|
||||
|
||||
# Given an attribute set containing shell variable names and their
|
||||
# assignments, this function produces a string containing an export
|
||||
# statement for each set entry.
|
||||
exportAll = vars: lib.concatStringsSep "\n" (lib.mapAttrsToList export vars);
|
||||
}
|
||||
@@ -36,7 +36,7 @@ let
|
||||
|
||||
manualHtmlRoot = "${homeManagerManual.manual}/share/doc/home-manager/index.html";
|
||||
|
||||
helpScript = pkgs.writeScriptBin "home-manager-help" ''
|
||||
helpScript = pkgs.writeShellScriptBin "home-manager-help" ''
|
||||
#!${pkgs.bash}/bin/bash -e
|
||||
|
||||
if [ -z "$BROWSER" ]; then
|
||||
|
||||
83
modules/misc/dconf.nix
Normal file
83
modules/misc/dconf.nix
Normal file
@@ -0,0 +1,83 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.dconf;
|
||||
dag = config.lib.dag;
|
||||
|
||||
toDconfIni = generators.toINI { mkKeyValue = mkIniKeyValue; };
|
||||
|
||||
mkIniKeyValue = key: value:
|
||||
let
|
||||
tweakVal = v:
|
||||
if isString v then "'${v}'"
|
||||
else if isList v then "[" + concatMapStringsSep "," tweakVal v + "]"
|
||||
else if isBool v then (if v then "true" else "false")
|
||||
else toString v;
|
||||
in
|
||||
"${key}=${tweakVal value}";
|
||||
|
||||
primitive = with types; either bool (either int str);
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
meta.maintainers = [ maintainers.gnidorah maintainers.rycee ];
|
||||
|
||||
options = {
|
||||
dconf = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
visible = false;
|
||||
description = ''
|
||||
Whether to enable dconf settings.
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = with types;
|
||||
attrsOf (attrsOf (either primitive (listOf primitive)));
|
||||
default = {};
|
||||
example = literalExample ''
|
||||
{
|
||||
"org/gnome/calculator" = {
|
||||
button-mode = "programming";
|
||||
show-thousands = true;
|
||||
base = 10;
|
||||
word-size = 64;
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Settings to write to the dconf configuration system.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg.enable && cfg.settings != {}) {
|
||||
home.activation.dconfSettings = dag.entryAfter ["installPackages"] (
|
||||
let
|
||||
iniFile = pkgs.writeText "hm-dconf.ini" (toDconfIni cfg.settings);
|
||||
in
|
||||
''
|
||||
if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then
|
||||
DCONF_DBUS_RUN_SESSION=""
|
||||
else
|
||||
DCONF_DBUS_RUN_SESSION="${pkgs.dbus}/bin/dbus-run-session"
|
||||
fi
|
||||
|
||||
if [[ -v DRY_RUN ]]; then
|
||||
echo $DCONF_DBUS_RUN_SESSION ${pkgs.gnome3.dconf}/bin/dconf load / "<" ${iniFile}
|
||||
else
|
||||
$DCONF_DBUS_RUN_SESSION ${pkgs.gnome3.dconf}/bin/dconf load / < ${iniFile}
|
||||
fi
|
||||
|
||||
unset DCONF_DBUS_RUN_SESSION
|
||||
''
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -76,6 +76,12 @@ in
|
||||
{
|
||||
meta.maintainers = [ maintainers.rycee ];
|
||||
|
||||
imports = [
|
||||
(mkRemovedOptionModule ["gtk" "gtk3" "waylandSupport"] ''
|
||||
This options is not longer needed and can be removed.
|
||||
'')
|
||||
];
|
||||
|
||||
options = {
|
||||
gtk = {
|
||||
enable = mkEnableOption "GTK 2/3 configuration";
|
||||
@@ -100,48 +106,36 @@ in
|
||||
description = "The GTK+2/3 theme to use.";
|
||||
};
|
||||
|
||||
gtk2 = mkOption {
|
||||
description = "Options specific to GTK+ 2";
|
||||
default = {};
|
||||
type = types.submodule {
|
||||
options = {
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = "gtk-can-change-accels = 1";
|
||||
description = ''
|
||||
Extra configuration lines to add verbatim to
|
||||
<filename>~/.gtkrc-2.0</filename>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
gtk2 = {
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = "gtk-can-change-accels = 1";
|
||||
description = ''
|
||||
Extra configuration lines to add verbatim to
|
||||
<filename>~/.gtkrc-2.0</filename>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
gtk3 = mkOption {
|
||||
description = "Options specific to GTK+ 3";
|
||||
default = {};
|
||||
type = types.submodule {
|
||||
options = {
|
||||
extraConfig = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
example = { gtk-cursor-blink = false; gtk-recent-files-limit = 20; };
|
||||
description = ''
|
||||
Extra configuration options to add to
|
||||
<filename>~/.config/gtk-3.0/settings.ini</filename>.
|
||||
'';
|
||||
};
|
||||
gtk3 = {
|
||||
extraConfig = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
example = { gtk-cursor-blink = false; gtk-recent-files-limit = 20; };
|
||||
description = ''
|
||||
Extra configuration options to add to
|
||||
<filename>~/.config/gtk-3.0/settings.ini</filename>.
|
||||
'';
|
||||
};
|
||||
|
||||
extraCss = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Extra configuration lines to add verbatim to
|
||||
<filename>~/.config/gtk-3.0/gtk.css</filename>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
extraCss = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Extra configuration lines to add verbatim to
|
||||
<filename>~/.config/gtk-3.0/gtk.css</filename>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -159,11 +153,20 @@ in
|
||||
optionalAttrs (cfg.iconTheme != null)
|
||||
{ gtk-icon-theme-name = cfg.iconTheme.name; };
|
||||
|
||||
dconfIni =
|
||||
optionalAttrs (cfg.font != null)
|
||||
{ font-name = cfg.font.name; }
|
||||
//
|
||||
optionalAttrs (cfg.theme != null)
|
||||
{ gtk-theme = cfg.theme.name; }
|
||||
//
|
||||
optionalAttrs (cfg.iconTheme != null)
|
||||
{ icon-theme = cfg.iconTheme.name; };
|
||||
|
||||
optionalPackage = opt:
|
||||
optional (opt != null && opt.package != null) opt.package;
|
||||
in
|
||||
{
|
||||
|
||||
home.packages =
|
||||
optionalPackage cfg.font
|
||||
++ optionalPackage cfg.theme
|
||||
@@ -178,6 +181,8 @@ in
|
||||
toGtk3Ini { Settings = ini // cfg3.extraConfig; };
|
||||
|
||||
xdg.configFile."gtk-3.0/gtk.css".text = cfg3.extraCss;
|
||||
|
||||
dconf.settings."org/gnome/desktop/interface" = dconfIni;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
14
modules/misc/lib.nix
Normal file
14
modules/misc/lib.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
options = {
|
||||
lib = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.attrs;
|
||||
default = {};
|
||||
description = ''
|
||||
This option allows modules to define helper functions,
|
||||
constants, etc.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -6,6 +6,8 @@ let
|
||||
|
||||
cfg = config.news;
|
||||
|
||||
hostPlatform = pkgs.stdenv.hostPlatform;
|
||||
|
||||
entryModule = types.submodule ({ config, ... }: {
|
||||
options = {
|
||||
id = mkOption {
|
||||
@@ -240,25 +242,6 @@ in
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2017-09-30T09:44:18+00:00";
|
||||
condition = with config.programs.vim;
|
||||
enable && (tabSize != null || lineNumbers != null);
|
||||
message = ''
|
||||
The options 'programs.vim.tabSize' and 'programs.vim.lineNumbers' have
|
||||
been deprecated and will be removed in the near future.
|
||||
|
||||
The new and preferred way to configure tab size and line numbers is to
|
||||
use the more general 'programs.vim.settings' option. Specifically,
|
||||
instead of
|
||||
|
||||
- 'programs.vim.lineNumbers' use 'programs.vim.settings.number', and
|
||||
|
||||
- 'programs.vim.tabSize' use 'programs.vim.settings.tabstop' and
|
||||
'programs.vim.settings.shiftwidth'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2017-10-02T11:15:03+00:00";
|
||||
condition = config.services.udiskie.enable;
|
||||
@@ -753,7 +736,7 @@ in
|
||||
|
||||
{
|
||||
time = "2018-08-19T20:46:09+00:00";
|
||||
condition = pkgs.stdenv.isLinux;
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new modules is available: 'programs.chromium'.
|
||||
'';
|
||||
@@ -779,6 +762,241 @@ in
|
||||
A new module is available: 'programs.offlineimap'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2018-09-18T21:25:14+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.taskwarrior'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2018-09-18T21:43:54+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.zathura'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2018-09-20T19:26:40+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.noti'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2018-09-20T22:10:45+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.go'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2018-09-27T17:48:08+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.obs-studio'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2018-09-28T21:38:48+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.alot'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2018-10-20T09:30:57+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.urxvt'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2018-11-13T23:08:03+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.tmux'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2018-11-18T18:55:15+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.astroid'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2018-11-18T21:41:51+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.afew'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2018-11-19T00:40:34+00:00";
|
||||
message = ''
|
||||
A new nix-darwin module is available. Use it the same way the NixOS
|
||||
module is used. A major limitation is that Home Manager services don't
|
||||
work, as they depend explicitly on Linux and systemd user services.
|
||||
However, 'home.file' and 'home.packages' do work. Everything else is
|
||||
untested at this time.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2018-11-24T16:22:19+00:00";
|
||||
message = ''
|
||||
A new option 'home.stateVersion' is available. Its function
|
||||
is much like the 'system.stateVersion' option in NixOS.
|
||||
|
||||
Briefly, the state version indicates a stable set of option
|
||||
defaults. In the future, whenever Home Manager changes an
|
||||
option default in a way that may cause program breakage it
|
||||
will do so only for the unstable state version, currently
|
||||
19.03. Once 19.03 becomes the stable version only backwards
|
||||
compatible changes will be made and 19.09 becomes the
|
||||
unstable state version.
|
||||
|
||||
The default value for this option is 18.09 but it may still
|
||||
be a good idea to explicitly add
|
||||
|
||||
home.stateVersion = "18.09";
|
||||
|
||||
to your Home Manager configuration.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2018-11-25T22:10:15+00:00";
|
||||
message = ''
|
||||
A new module is available: 'services.nextcloud-client'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2018-12-04T21:54:38+00:00";
|
||||
condition = config.programs.beets.settings != {};
|
||||
message = ''
|
||||
A new option 'programs.beets.enable' has been added.
|
||||
Starting with state version 19.03 this option defaults to
|
||||
false. For earlier versions it defaults to true if
|
||||
'programs.beets.settings' is non-empty.
|
||||
|
||||
It is recommended to explicitly add
|
||||
|
||||
programs.beets.enable = true;
|
||||
|
||||
to your configuration.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2018-12-12T21:02:05+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.jq'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2019-01-07T17:35:19+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.vscode'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2019-01-14T17:37:23+00:00";
|
||||
message = ''
|
||||
A new module is available: 'dconf'.
|
||||
|
||||
Note, on NixOS you may need to add
|
||||
|
||||
services.dbus.packages = with pkgs; [ gnome3.dconf ];
|
||||
|
||||
to the system configuration for this module to work as
|
||||
expected. In particular if you get the error message
|
||||
|
||||
The name ca.desrt.dconf was not provided by any .service files
|
||||
|
||||
when activating your Home Manager configuration.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2018-12-28T12:32:30+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.opam'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2019-01-18T00:21:56+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.matplotlib'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2019-01-26T13:20:37+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'services.xembed-sni-proxy'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2019-01-28T23:36:10+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.irssi'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2019-02-09T14:09:58+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'services.emacs'.
|
||||
|
||||
This module provides a user service that runs the Emacs
|
||||
configured in
|
||||
|
||||
programs.emacs
|
||||
|
||||
as an Emacs daemon.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2019-02-16T20:33:56+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
When using Home Manager as a NixOS submodule it is now
|
||||
possible to install packages using the NixOS
|
||||
|
||||
users.users.<name?>.packages
|
||||
|
||||
option. This is enabled by adding
|
||||
|
||||
home-manager.useUserPackages = true;
|
||||
|
||||
to your NixOS system configuration. This mode of operation
|
||||
is necessary if you want to use 'nixos-rebuild build-vm'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2019-04-23T19:15:07+00:00";
|
||||
message = ''
|
||||
As of May 1, 2019 the release-18.09 branch of Home Manager
|
||||
will no longer be supported. You are encouraged to switch to
|
||||
the release-19.03 branch as soon as possible.
|
||||
|
||||
Some brief notes about the 19.03 branch is available at
|
||||
|
||||
https://rycee.gitlab.io/home-manager/release-notes.html#sec-release-19.03
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ in
|
||||
inside and outside Home Manager you can put it in a separate
|
||||
file and include something like
|
||||
|
||||
<programlisting>
|
||||
<programlisting language="nix">
|
||||
nixpkgs.config = import ./nixpkgs-config.nix;
|
||||
xdg.configFile."nixpkgs/config.nix".source =
|
||||
./nixpkgs-config.nix;
|
||||
@@ -144,7 +144,10 @@ in
|
||||
config = {
|
||||
_module.args = {
|
||||
pkgs = _pkgs;
|
||||
pkgs_i686 = if _pkgs.stdenv.isLinux then _pkgs.pkgsi686Linux else {};
|
||||
pkgs_i686 =
|
||||
if _pkgs.stdenv.isLinux && _pkgs.stdenv.hostPlatform.isx86
|
||||
then _pkgs.pkgsi686Linux
|
||||
else { };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ in
|
||||
config = mkIf (vars != {}) {
|
||||
home.file.".pam_environment".text =
|
||||
concatStringsSep "\n" (
|
||||
mapAttrsToList (n: v: "${n} OVERRIDE=${toString v}") vars
|
||||
mapAttrsToList (n: v: "${n} OVERRIDE=\"${toString v}\"") vars
|
||||
) + "\n";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ in
|
||||
|
||||
home.activation.useGtkThemeInQt4 = dag.entryAfter ["writeBoundary"] ''
|
||||
$DRY_RUN_CMD ${pkgs.crudini}/bin/crudini $VERBOSE_ARG \
|
||||
--set $HOME/.config/Trolltech.conf Qt style GTK+
|
||||
--set "${config.xdg.configHome}/Trolltech.conf" Qt style GTK+
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
32
modules/misc/submodule-support.nix
Normal file
32
modules/misc/submodule-support.nix
Normal file
@@ -0,0 +1,32 @@
|
||||
{ lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
meta.maintainers = [ maintainers.rycee ];
|
||||
|
||||
options.submoduleSupport = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
internal = true;
|
||||
description = ''
|
||||
Whether the Home Manager module system is used as a submodule
|
||||
in, for example, NixOS or nix-darwin.
|
||||
'';
|
||||
};
|
||||
|
||||
externalPackageInstall = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
internal = true;
|
||||
description = ''
|
||||
Whether the packages of <option>home.packages</option> are
|
||||
installed separately from the Home Manager activation script.
|
||||
In NixOS, for example, this may be accomplished by installing
|
||||
the packages through
|
||||
<option>users.users.<name?>.packages</option>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
24
modules/misc/version.nix
Normal file
24
modules/misc/version.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options = {
|
||||
home.stateVersion = mkOption {
|
||||
type = types.enum [ "18.09" "19.03" ];
|
||||
default = "18.09";
|
||||
description = ''
|
||||
It is occasionally necessary for Home Manager to change
|
||||
configuration defaults in a way that is incompatible with
|
||||
stateful data. This could, for example, include switching the
|
||||
default data format or location of a file.
|
||||
</para><para>
|
||||
The <emphasis>state version</emphasis> indicates which default
|
||||
settings are in effect and will therefore help avoid breaking
|
||||
program configurations. Switching to a higher state version
|
||||
typically requires performing some manual steps, such as data
|
||||
conversion or moving files.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -3,114 +3,134 @@
|
||||
|
||||
# Whether to enable module type checking.
|
||||
, check ? true
|
||||
|
||||
# Whether these modules are inside a NixOS submodule.
|
||||
, nixosSubmodule ? false
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
modules = [
|
||||
./accounts/email.nix
|
||||
./files.nix
|
||||
./home-environment.nix
|
||||
./manual.nix
|
||||
./misc/fontconfig.nix
|
||||
./misc/gtk.nix
|
||||
./misc/news.nix
|
||||
./misc/nixpkgs.nix
|
||||
./misc/pam.nix
|
||||
./misc/qt.nix
|
||||
./misc/xdg.nix
|
||||
./programs/autorandr.nix
|
||||
./programs/bash.nix
|
||||
./programs/beets.nix
|
||||
./programs/browserpass.nix
|
||||
./programs/command-not-found/command-not-found.nix
|
||||
./programs/direnv.nix
|
||||
./programs/eclipse.nix
|
||||
./programs/emacs.nix
|
||||
./programs/feh.nix
|
||||
./programs/firefox.nix
|
||||
./programs/fish.nix
|
||||
./programs/fzf.nix
|
||||
./programs/git.nix
|
||||
./programs/gnome-terminal.nix
|
||||
./programs/home-manager.nix
|
||||
./programs/htop.nix
|
||||
./programs/info.nix
|
||||
./programs/lesspipe.nix
|
||||
./programs/man.nix
|
||||
./programs/mbsync.nix
|
||||
./programs/mercurial.nix
|
||||
./programs/msmtp.nix
|
||||
./programs/neovim.nix
|
||||
./programs/newsboat.nix
|
||||
./programs/notmuch.nix
|
||||
./programs/offlineimap.nix
|
||||
./programs/pidgin.nix
|
||||
./programs/rofi.nix
|
||||
./programs/ssh.nix
|
||||
./programs/termite.nix
|
||||
./programs/texlive.nix
|
||||
./programs/vim.nix
|
||||
./programs/zsh.nix
|
||||
./services/blueman-applet.nix
|
||||
./services/compton.nix
|
||||
./services/dunst.nix
|
||||
./services/flameshot.nix
|
||||
./services/gnome-keyring.nix
|
||||
./services/gpg-agent.nix
|
||||
./services/kbfs.nix
|
||||
./services/kdeconnect.nix
|
||||
./services/keepassx.nix
|
||||
./services/keybase.nix
|
||||
./services/mbsync.nix
|
||||
./services/mpd.nix
|
||||
./services/network-manager-applet.nix
|
||||
./services/owncloud-client.nix
|
||||
./services/parcellite.nix
|
||||
./services/pasystray.nix
|
||||
./services/polybar.nix
|
||||
./services/random-background.nix
|
||||
./services/redshift.nix
|
||||
./services/screen-locker.nix
|
||||
./services/stalonetray.nix
|
||||
./services/status-notifier-watcher.nix
|
||||
./services/syncthing.nix
|
||||
./services/taffybar.nix
|
||||
./services/tahoe-lafs.nix
|
||||
./services/udiskie.nix
|
||||
./services/unclutter.nix
|
||||
./services/window-managers/awesome.nix
|
||||
./services/window-managers/i3.nix
|
||||
./services/window-managers/xmonad.nix
|
||||
./services/xscreensaver.nix
|
||||
./systemd.nix
|
||||
./xcursor.nix
|
||||
./xresources.nix
|
||||
./xsession.nix
|
||||
<nixpkgs/nixos/modules/misc/assertions.nix>
|
||||
<nixpkgs/nixos/modules/misc/lib.nix>
|
||||
<nixpkgs/nixos/modules/misc/meta.nix>
|
||||
]
|
||||
++
|
||||
optional pkgs.stdenv.isLinux ./programs/chromium.nix;
|
||||
hostPlatform = pkgs.stdenv.hostPlatform;
|
||||
|
||||
checkPlatform = any (meta.platformMatch pkgs.stdenv.hostPlatform);
|
||||
|
||||
loadModule = file: { condition ? true }: {
|
||||
inherit file condition;
|
||||
};
|
||||
|
||||
allModules = [
|
||||
(loadModule ./accounts/email.nix { })
|
||||
(loadModule ./files.nix { })
|
||||
(loadModule ./home-environment.nix { })
|
||||
(loadModule ./manual.nix { })
|
||||
(loadModule ./misc/dconf.nix { })
|
||||
(loadModule ./misc/fontconfig.nix { })
|
||||
(loadModule ./misc/gtk.nix { })
|
||||
(loadModule ./misc/lib.nix { })
|
||||
(loadModule ./misc/news.nix { })
|
||||
(loadModule ./misc/nixpkgs.nix { })
|
||||
(loadModule ./misc/pam.nix { })
|
||||
(loadModule ./misc/qt.nix { })
|
||||
(loadModule ./misc/submodule-support.nix { })
|
||||
(loadModule ./misc/version.nix { })
|
||||
(loadModule ./misc/xdg.nix { })
|
||||
(loadModule ./programs/afew.nix { })
|
||||
(loadModule ./programs/alot.nix { })
|
||||
(loadModule ./programs/astroid.nix { })
|
||||
(loadModule ./programs/autorandr.nix { })
|
||||
(loadModule ./programs/bash.nix { })
|
||||
(loadModule ./programs/beets.nix { })
|
||||
(loadModule ./programs/browserpass.nix { })
|
||||
(loadModule ./programs/chromium.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./programs/command-not-found/command-not-found.nix { })
|
||||
(loadModule ./programs/direnv.nix { })
|
||||
(loadModule ./programs/eclipse.nix { })
|
||||
(loadModule ./programs/emacs.nix { })
|
||||
(loadModule ./programs/feh.nix { })
|
||||
(loadModule ./programs/firefox.nix { })
|
||||
(loadModule ./programs/fish.nix { })
|
||||
(loadModule ./programs/fzf.nix { })
|
||||
(loadModule ./programs/git.nix { })
|
||||
(loadModule ./programs/gnome-terminal.nix { })
|
||||
(loadModule ./programs/go.nix { })
|
||||
(loadModule ./programs/home-manager.nix { })
|
||||
(loadModule ./programs/htop.nix { })
|
||||
(loadModule ./programs/info.nix { })
|
||||
(loadModule ./programs/irssi.nix { })
|
||||
(loadModule ./programs/jq.nix { })
|
||||
(loadModule ./programs/lesspipe.nix { })
|
||||
(loadModule ./programs/man.nix { })
|
||||
(loadModule ./programs/matplotlib.nix { })
|
||||
(loadModule ./programs/mbsync.nix { })
|
||||
(loadModule ./programs/mercurial.nix { })
|
||||
(loadModule ./programs/msmtp.nix { })
|
||||
(loadModule ./programs/neovim.nix { })
|
||||
(loadModule ./programs/newsboat.nix { })
|
||||
(loadModule ./programs/noti.nix { })
|
||||
(loadModule ./programs/notmuch.nix { })
|
||||
(loadModule ./programs/obs-studio.nix { })
|
||||
(loadModule ./programs/offlineimap.nix { })
|
||||
(loadModule ./programs/opam.nix { })
|
||||
(loadModule ./programs/pidgin.nix { })
|
||||
(loadModule ./programs/rofi.nix { })
|
||||
(loadModule ./programs/ssh.nix { })
|
||||
(loadModule ./programs/taskwarrior.nix { })
|
||||
(loadModule ./programs/termite.nix { })
|
||||
(loadModule ./programs/texlive.nix { })
|
||||
(loadModule ./programs/tmux.nix { })
|
||||
(loadModule ./programs/urxvt.nix { })
|
||||
(loadModule ./programs/vim.nix { })
|
||||
(loadModule ./programs/vscode.nix { })
|
||||
(loadModule ./programs/zathura.nix { })
|
||||
(loadModule ./programs/zsh.nix { })
|
||||
(loadModule ./services/blueman-applet.nix { })
|
||||
(loadModule ./services/compton.nix { })
|
||||
(loadModule ./services/dunst.nix { })
|
||||
(loadModule ./services/emacs.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./services/flameshot.nix { })
|
||||
(loadModule ./services/gnome-keyring.nix { })
|
||||
(loadModule ./services/gpg-agent.nix { })
|
||||
(loadModule ./services/kbfs.nix { })
|
||||
(loadModule ./services/kdeconnect.nix { })
|
||||
(loadModule ./services/keepassx.nix { })
|
||||
(loadModule ./services/keybase.nix { })
|
||||
(loadModule ./services/mbsync.nix { })
|
||||
(loadModule ./services/mpd.nix { })
|
||||
(loadModule ./services/network-manager-applet.nix { })
|
||||
(loadModule ./services/nextcloud-client.nix { })
|
||||
(loadModule ./services/owncloud-client.nix { })
|
||||
(loadModule ./services/parcellite.nix { })
|
||||
(loadModule ./services/pasystray.nix { })
|
||||
(loadModule ./services/polybar.nix { })
|
||||
(loadModule ./services/random-background.nix { })
|
||||
(loadModule ./services/redshift.nix { })
|
||||
(loadModule ./services/screen-locker.nix { })
|
||||
(loadModule ./services/stalonetray.nix { })
|
||||
(loadModule ./services/status-notifier-watcher.nix { })
|
||||
(loadModule ./services/syncthing.nix { })
|
||||
(loadModule ./services/taffybar.nix { })
|
||||
(loadModule ./services/tahoe-lafs.nix { })
|
||||
(loadModule ./services/udiskie.nix { })
|
||||
(loadModule ./services/unclutter.nix { })
|
||||
(loadModule ./services/window-managers/awesome.nix { })
|
||||
(loadModule ./services/window-managers/i3.nix { })
|
||||
(loadModule ./services/window-managers/xmonad.nix { })
|
||||
(loadModule ./services/xembed-sni-proxy.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./services/xscreensaver.nix { })
|
||||
(loadModule ./systemd.nix { })
|
||||
(loadModule ./xcursor.nix { })
|
||||
(loadModule ./xresources.nix { })
|
||||
(loadModule ./xsession.nix { })
|
||||
(loadModule <nixpkgs/nixos/modules/misc/assertions.nix> { })
|
||||
(loadModule <nixpkgs/nixos/modules/misc/meta.nix> { })
|
||||
];
|
||||
|
||||
modules = map (getAttr "file") (filter (getAttr "condition") allModules);
|
||||
|
||||
pkgsModule = {
|
||||
options.nixosSubmodule = mkOption {
|
||||
type = types.bool;
|
||||
internal = true;
|
||||
readOnly = true;
|
||||
};
|
||||
|
||||
config._module.args.baseModules = modules;
|
||||
config._module.args.pkgs = lib.mkDefault pkgs;
|
||||
config._module.check = check;
|
||||
config.lib = import ./lib { inherit lib; };
|
||||
config.nixosSubmodule = nixosSubmodule;
|
||||
config.nixpkgs.system = mkDefault pkgs.system;
|
||||
};
|
||||
|
||||
|
||||
52
modules/programs/afew.nix
Normal file
52
modules/programs/afew.nix
Normal file
@@ -0,0 +1,52 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.afew;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
options.programs.afew = {
|
||||
enable = mkEnableOption "the afew initial tagging script for Notmuch";
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = ''
|
||||
[SpamFilter]
|
||||
[KillThreadsFilter]
|
||||
[ListMailsFilter]
|
||||
[ArchiveSentMailsFilter]
|
||||
[InboxFilter]
|
||||
'';
|
||||
example = ''
|
||||
[SpamFilter]
|
||||
|
||||
[Filter.0]
|
||||
query = from:pointyheaded@boss.com
|
||||
tags = -new;+boss
|
||||
message = Message from above
|
||||
|
||||
[InboxFilter]
|
||||
'';
|
||||
description = ''
|
||||
Extra lines added to afew configuration file. Available
|
||||
configuration options are described in the afew manual:
|
||||
<link xlink:href="https://afew.readthedocs.io/en/latest/configuration.html" />.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.afew ];
|
||||
|
||||
xdg.configFile."afew/config".text = ''
|
||||
# Generated by Home Manager.
|
||||
# See https://afew.readthedocs.io/
|
||||
|
||||
${cfg.extraConfig}
|
||||
'';
|
||||
};
|
||||
}
|
||||
32
modules/programs/alot-accounts.nix
Normal file
32
modules/programs/alot-accounts.nix
Normal file
@@ -0,0 +1,32 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options.alot = {
|
||||
sendMailCommand = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
Command to send a mail. If msmtp is enabled for the account,
|
||||
then this is set to
|
||||
<command>msmtpq --read-envelope-from --read-recipients</command>.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Extra settings to add to this Alot account configuration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf config.notmuch.enable {
|
||||
alot.sendMailCommand = mkOptionDefault (
|
||||
if config.msmtp.enable
|
||||
then "msmtpq --read-envelope-from --read-recipients"
|
||||
else null
|
||||
);
|
||||
};
|
||||
}
|
||||
167
modules/programs/alot.nix
Normal file
167
modules/programs/alot.nix
Normal file
@@ -0,0 +1,167 @@
|
||||
# alot config loader is sensitive to leading space !
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.alot;
|
||||
|
||||
alotAccounts = filter (a: a.notmuch.enable)
|
||||
(attrValues config.accounts.email.accounts);
|
||||
|
||||
boolStr = v: if v then "True" else "False";
|
||||
|
||||
accountStr = account: with account;
|
||||
concatStringsSep "\n" (
|
||||
[ "[[${name}]]" ]
|
||||
++ mapAttrsToList (n: v: n + "=" + v) (
|
||||
{
|
||||
address = address;
|
||||
realname = realName;
|
||||
sendmail_command =
|
||||
optionalString (alot.sendMailCommand != null) alot.sendMailCommand;
|
||||
}
|
||||
// optionalAttrs (gpg != null) {
|
||||
gpg_key = gpg.key;
|
||||
encrypt_by_default = if gpg.encryptByDefault then "all" else "none";
|
||||
sign_by_default = boolStr gpg.signByDefault;
|
||||
}
|
||||
// optionalAttrs (signature.showSignature != "none") {
|
||||
signature = pkgs.writeText "signature.txt" signature.text;
|
||||
signature_as_attachment =
|
||||
boolStr (signature.showSignature == "attach");
|
||||
}
|
||||
)
|
||||
)
|
||||
+ "\n"
|
||||
+ alot.extraConfig;
|
||||
|
||||
configFile =
|
||||
let
|
||||
bindingsToStr = attrSet:
|
||||
concatStringsSep "\n" (mapAttrsToList (n: v: "${n} = ${v}") attrSet);
|
||||
in
|
||||
''
|
||||
# Generated by Home Manager.
|
||||
# See http://alot.readthedocs.io/en/latest/configuration/config_options.html
|
||||
|
||||
${cfg.extraConfig}
|
||||
|
||||
[bindings]
|
||||
${bindingsToStr cfg.bindings.global}
|
||||
|
||||
[[bufferlist]]
|
||||
${bindingsToStr cfg.bindings.bufferlist}
|
||||
[[search]]
|
||||
${bindingsToStr cfg.bindings.search}
|
||||
[[envelope]]
|
||||
${bindingsToStr cfg.bindings.envelope}
|
||||
[[taglist]]
|
||||
${bindingsToStr cfg.bindings.taglist}
|
||||
[[thread]]
|
||||
${bindingsToStr cfg.bindings.thread}
|
||||
|
||||
[accounts]
|
||||
|
||||
${concatStringsSep "\n\n" (map accountStr alotAccounts)}
|
||||
'';
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
options.programs.alot = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = ''
|
||||
Whether to enable the Alot mail user agent. Alot uses the
|
||||
Notmuch email system and will therefore be automatically
|
||||
enabled for each email account that is managed by Notmuch.
|
||||
'';
|
||||
};
|
||||
|
||||
hooks = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Content of the hooks file.
|
||||
'';
|
||||
};
|
||||
|
||||
bindings = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
global = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
description = "Global keybindings.";
|
||||
};
|
||||
|
||||
bufferlist = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
description = "Bufferlist mode keybindings.";
|
||||
};
|
||||
|
||||
search = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
description = "Search mode keybindings.";
|
||||
};
|
||||
|
||||
envelope = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
description = "Envelope mode keybindings.";
|
||||
};
|
||||
|
||||
taglist = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
description = "Taglist mode keybindings.";
|
||||
};
|
||||
|
||||
thread = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
description = "Thread mode keybindings.";
|
||||
};
|
||||
};
|
||||
};
|
||||
default = {};
|
||||
description = ''
|
||||
Keybindings.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = ''
|
||||
auto_remove_unread = True
|
||||
ask_subject = False
|
||||
handle_mouse = True
|
||||
initial_command = "search tag:inbox AND NOT tag:killed"
|
||||
input_timeout = 0.3
|
||||
prefer_plaintext = True
|
||||
thread_indent_replies = 4
|
||||
'';
|
||||
description = ''
|
||||
Extra lines added to alot configuration file.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.alot ];
|
||||
|
||||
xdg.configFile."alot/config".text = configFile;
|
||||
|
||||
xdg.configFile."alot/hooks.py".text =
|
||||
''
|
||||
# Generated by Home Manager.
|
||||
''
|
||||
+ cfg.hooks;
|
||||
};
|
||||
}
|
||||
33
modules/programs/astroid-accounts.nix
Normal file
33
modules/programs/astroid-accounts.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options.astroid = {
|
||||
enable = mkEnableOption "Astroid";
|
||||
|
||||
sendMailCommand = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
Command to send a mail. If msmtp is enabled for the account,
|
||||
then this is set to
|
||||
<command>msmtpq --read-envelope-from --read-recipients</command>.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
example = { select_query = ""; };
|
||||
description = ''
|
||||
Extra settings to add to this astroid account configuration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf config.notmuch.enable {
|
||||
astroid.sendMailCommand = mkIf config.msmtp.enable (
|
||||
mkOptionDefault "msmtpq --read-envelope-from --read-recipients"
|
||||
);
|
||||
};
|
||||
}
|
||||
113
modules/programs/astroid-config-template.json
Normal file
113
modules/programs/astroid-config-template.json
Normal file
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"astroid": {
|
||||
"config": {
|
||||
"version": "11"
|
||||
},
|
||||
"debug": {
|
||||
"dryrun_sending": "false"
|
||||
},
|
||||
"hints": {
|
||||
"level": "0"
|
||||
},
|
||||
"log": {
|
||||
"syslog": "false",
|
||||
"stdout": "true",
|
||||
"level": "info"
|
||||
}
|
||||
},
|
||||
"startup": {
|
||||
"queries": {
|
||||
"inbox": "tag:inbox"
|
||||
}
|
||||
},
|
||||
"terminal": {
|
||||
"height": "10",
|
||||
"font_description": "default"
|
||||
},
|
||||
"thread_index": {
|
||||
"page_jump_rows": "6",
|
||||
"sort_order": "newest",
|
||||
"cell": {
|
||||
"font_description": "default",
|
||||
"line_spacing": "2",
|
||||
"date_length": "10",
|
||||
"message_count_length": "4",
|
||||
"authors_length": "20",
|
||||
"subject_color": "#807d74",
|
||||
"subject_color_selected": "#000000",
|
||||
"background_color_selected": "",
|
||||
"background_color_marked": "#fff584",
|
||||
"background_color_marked_selected": "#bcb559",
|
||||
"tags_length": "80",
|
||||
"tags_upper_color": "#e5e5e5",
|
||||
"tags_lower_color": "#333333",
|
||||
"tags_alpha": "0.5",
|
||||
"hidden_tags": "attachment,flagged,unread"
|
||||
}
|
||||
},
|
||||
"general": {
|
||||
"time": {
|
||||
"clock_format": "local",
|
||||
"same_year": "%b %-e",
|
||||
"diff_year": "%x"
|
||||
}
|
||||
},
|
||||
"editor": {
|
||||
"charset": "utf-8",
|
||||
"save_draft_on_force_quit": "true",
|
||||
"attachment_words": "attach",
|
||||
"attachment_directory": "~",
|
||||
"markdown_processor": "marked"
|
||||
},
|
||||
"mail": {
|
||||
"reply": {
|
||||
"quote_line": "Excerpts from %1's message of %2:",
|
||||
"mailinglist_reply_to_sender": "true"
|
||||
},
|
||||
"forward": {
|
||||
"quote_line": "Forwarding %1's message of %2:",
|
||||
"disposition": "inline"
|
||||
},
|
||||
"sent_tags": "sent",
|
||||
"message_id_fqdn": "",
|
||||
"message_id_user": "",
|
||||
"user_agent": "default",
|
||||
"send_delay": "2",
|
||||
"close_on_success": "false",
|
||||
"format_flowed": "false"
|
||||
},
|
||||
"poll": {
|
||||
"interval": "60",
|
||||
"always_full_refresh": "false"
|
||||
},
|
||||
"attachment": {
|
||||
"external_open_cmd": "xdg-open"
|
||||
},
|
||||
"thread_view": {
|
||||
"open_html_part_external": "false",
|
||||
"preferred_type": "plain",
|
||||
"preferred_html_only": "false",
|
||||
"allow_remote_when_encrypted": "false",
|
||||
"open_external_link": "xdg-open",
|
||||
"default_save_directory": "~",
|
||||
"indent_messages": "false",
|
||||
"gravatar": {
|
||||
"enable": "true"
|
||||
},
|
||||
"mark_unread_delay": "0.5",
|
||||
"expand_flagged": "true"
|
||||
},
|
||||
"crypto": {
|
||||
"gpg": {
|
||||
"path": "gpg2",
|
||||
"always_trust": "true",
|
||||
"enabled": "true"
|
||||
}
|
||||
},
|
||||
"saved_searches": {
|
||||
"show_on_startup": "false",
|
||||
"save_history": "true",
|
||||
"history_lines_to_show": "15",
|
||||
"history_lines": "1000"
|
||||
}
|
||||
}
|
||||
139
modules/programs/astroid.nix
Normal file
139
modules/programs/astroid.nix
Normal file
@@ -0,0 +1,139 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.astroid;
|
||||
|
||||
astroidAccounts =
|
||||
filterAttrs
|
||||
(n: v: v.astroid.enable)
|
||||
config.accounts.email.accounts;
|
||||
|
||||
boolOpt = b: if b then "true" else "false";
|
||||
|
||||
accountAttr = account: with account; {
|
||||
email = address;
|
||||
name = realName;
|
||||
sendmail = astroid.sendMailCommand;
|
||||
additional_sent_tags = "";
|
||||
default = boolOpt primary;
|
||||
save_drafts_to = folders.drafts;
|
||||
save_sent = "true";
|
||||
save_sent_to = folders.sent;
|
||||
select_query = "";
|
||||
}
|
||||
// optionalAttrs (signature.showSignature != "none") {
|
||||
signature_attach = boolOpt (signature.showSignature == "attach");
|
||||
signature_default_on = boolOpt (signature.showSignature != "none");
|
||||
signature_file = pkgs.writeText "signature.txt" signature.text;
|
||||
signature_file_markdown = "false";
|
||||
signature_separate = "true"; # prepends '--\n' to the signature
|
||||
}
|
||||
// optionalAttrs (gpg != null) {
|
||||
always_gpg_sign = boolOpt gpg.signByDefault;
|
||||
gpgkey = gpg.key;
|
||||
}
|
||||
// astroid.extraConfig;
|
||||
|
||||
# See https://github.com/astroidmail/astroid/wiki/Configuration-Reference
|
||||
configFile = mailAccounts:
|
||||
let
|
||||
template = fromJSON (readFile ./astroid-config-template.json);
|
||||
astroidConfig = foldl' recursiveUpdate template [
|
||||
{
|
||||
astroid.notmuch_config = "${config.xdg.configHome}/notmuch/notmuchrc";
|
||||
accounts = mapAttrs (n: accountAttr) astroidAccounts;
|
||||
crypto.gpg.path = "${pkgs.gnupg}/bin/gpg";
|
||||
}
|
||||
cfg.extraConfig
|
||||
cfg.externalEditor
|
||||
];
|
||||
in
|
||||
builtins.toJSON astroidConfig;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
options = {
|
||||
programs.astroid = {
|
||||
enable = mkEnableOption "Astroid";
|
||||
|
||||
pollScript = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
example = "mbsync gmail";
|
||||
description = ''
|
||||
Script to run to fetch/update mails.
|
||||
'';
|
||||
};
|
||||
|
||||
externalEditor = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
# Converts it into JSON that can be merged into the configuration.
|
||||
apply = cmd:
|
||||
optionalAttrs (cmd != null) {
|
||||
editor = {
|
||||
"external_editor" = "true";
|
||||
"cmd" = cmd;
|
||||
};
|
||||
};
|
||||
example = "nvim-qt -- -c 'set ft=mail' '+set fileencoding=utf-8' '+set ff=unix' '+set enc=utf-8' '+set fo+=w' %1";
|
||||
description = ''
|
||||
You can use <code>%1</code>, <code>%2</code>, and
|
||||
<code>%3</code> to refer respectively to:
|
||||
<orderedlist numeration="arabic">
|
||||
<listitem><para>file name</para></listitem>
|
||||
<listitem><para>server name</para></listitem>
|
||||
<listitem><para>socket ID</para></listitem>
|
||||
</orderedlist>
|
||||
See <link xlink:href='https://github.com/astroidmail/astroid/wiki/Customizing-editor' />.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
example = { poll.interval = 0; };
|
||||
description = ''
|
||||
JSON config that will override the default Astroid configuration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = config.programs.notmuch.maildir.synchronizeFlags;
|
||||
message = "The astroid module requires"
|
||||
+ " 'programs.notmuch.maildir.synchronizeFlags = true'.";
|
||||
}
|
||||
];
|
||||
|
||||
home.packages = [ pkgs.astroid ];
|
||||
|
||||
xdg.configFile."astroid/config".source =
|
||||
pkgs.runCommand "out.json"
|
||||
{
|
||||
json = configFile astroidAccounts;
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
}
|
||||
''
|
||||
echo -n "$json" | ${pkgs.jq}/bin/jq . > $out
|
||||
'';
|
||||
|
||||
xdg.configFile."astroid/poll.sh" = {
|
||||
executable = true;
|
||||
text = ''
|
||||
# Generated by Home Manager
|
||||
|
||||
${cfg.pollScript}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -6,10 +6,25 @@ let
|
||||
|
||||
cfg = config.programs.autorandr;
|
||||
|
||||
matrixOf = n: m: elemType: mkOptionType rec {
|
||||
name = "matrixOf";
|
||||
description = "${toString n}×${toString m} matrix of ${elemType.description}s";
|
||||
check = xss:
|
||||
let
|
||||
listOfSize = l: xs: isList xs && length xs == l;
|
||||
in
|
||||
listOfSize n xss && all (xs: listOfSize m xs && all elemType.check xs) xss;
|
||||
merge = mergeOneOption;
|
||||
getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["*" "*"]);
|
||||
getSubModules = elemType.getSubModules;
|
||||
substSubModules = mod: matrixOf n m (elemType.substSubModules mod);
|
||||
functor = (defaultFunctor name) // { wrapped = elemType; };
|
||||
};
|
||||
|
||||
profileModule = types.submodule {
|
||||
options = {
|
||||
fingerprint = mkOption {
|
||||
type = types.attrsOf types.string;
|
||||
type = types.attrsOf types.str;
|
||||
description = ''
|
||||
Output name to EDID mapping.
|
||||
Use <code>autorandr --fingerprint</code> to get current setup values.
|
||||
@@ -46,28 +61,28 @@ let
|
||||
};
|
||||
|
||||
position = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
description = "Output position";
|
||||
default = "";
|
||||
example = "5760x0";
|
||||
};
|
||||
|
||||
mode = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
description = "Output resolution.";
|
||||
default = "";
|
||||
example = "3840x2160";
|
||||
};
|
||||
|
||||
rate = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
description = "Output framerate.";
|
||||
default = "";
|
||||
example = "60.00";
|
||||
};
|
||||
|
||||
gamma = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
description = "Output gamma configuration.";
|
||||
default = "";
|
||||
example = "1.0:0.909:0.833";
|
||||
@@ -79,6 +94,26 @@ let
|
||||
default = null;
|
||||
example = "left";
|
||||
};
|
||||
|
||||
transform = mkOption {
|
||||
type = types.nullOr (matrixOf 3 3 types.float);
|
||||
default = null;
|
||||
example = literalExample ''
|
||||
[
|
||||
[ 0.6 0.0 0.0 ]
|
||||
[ 0.0 0.6 0.0 ]
|
||||
[ 0.0 0.0 1.0 ]
|
||||
]
|
||||
'';
|
||||
description = ''
|
||||
Refer to
|
||||
<citerefentry>
|
||||
<refentrytitle>xrandr</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
</citerefentry>
|
||||
for the documentation of the transform matrix.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -150,6 +185,9 @@ let
|
||||
${optionalString (config.mode != "") "mode ${config.mode}"}
|
||||
${optionalString (config.rate != "") "rate ${config.rate}"}
|
||||
${optionalString (config.rotate != null) "rotate ${config.rotate}"}
|
||||
${optionalString (config.transform != null) (
|
||||
"transform " + concatMapStringsSep "," toString (flatten config.transform)
|
||||
)}
|
||||
'' else ''
|
||||
output ${name}
|
||||
off
|
||||
|
||||
@@ -155,7 +155,7 @@ in
|
||||
in mkIf cfg.enable {
|
||||
programs.bash.bashrcExtra = ''
|
||||
# Commands that should be applied only for interactive shells.
|
||||
if [[ -n $PS1 ]]; then
|
||||
if [[ $- == *i* ]]; then
|
||||
${historyControlStr}
|
||||
|
||||
${shoptsStr}
|
||||
|
||||
@@ -13,6 +13,21 @@ in
|
||||
|
||||
options = {
|
||||
programs.beets = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default =
|
||||
if versionAtLeast config.home.stateVersion "19.03"
|
||||
then false
|
||||
else cfg.settings != {};
|
||||
defaultText = "false";
|
||||
description = ''
|
||||
Whether to enable the beets music library manager. This
|
||||
defaults to <literal>false</literal> for state
|
||||
version ≥ 19.03. For earlier versions beets is enabled if
|
||||
<option>programs.beets.settings</option> is non-empty.
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
@@ -24,7 +39,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg.settings != {}) {
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.beets ];
|
||||
|
||||
xdg.configFile."beets/config.yaml".text =
|
||||
|
||||
@@ -31,11 +31,11 @@ in {
|
||||
else ".config/google-chrome/NativeMessagingHosts";
|
||||
in [
|
||||
{
|
||||
target = "${dir}/com.dannyvankooten.browserpass.json";
|
||||
target = "${dir}/com.github.browserpass.native.json";
|
||||
source = "${pkgs.browserpass}/etc/chrome-host.json";
|
||||
}
|
||||
{
|
||||
target = "${dir}/../policies/managed/com.dannyvankooten.browserpass.json";
|
||||
target = "${dir}/../policies/managed/com.github.browserpass.native.json";
|
||||
source = "${pkgs.browserpass}/etc/chrome-policy.json";
|
||||
}
|
||||
]
|
||||
@@ -45,11 +45,11 @@ in {
|
||||
else ".config/chromium/NativeMessagingHosts";
|
||||
in [
|
||||
{
|
||||
target = "${dir}/com.dannyvankooten.browserpass.json";
|
||||
target = "${dir}/com.github.browserpass.native.json";
|
||||
source = "${pkgs.browserpass}/etc/chrome-host.json";
|
||||
}
|
||||
{
|
||||
target = "${dir}/../policies/managed/com.dannyvankooten.browserpass.json";
|
||||
target = "${dir}/../policies/managed/com.github.browserpass.native.json";
|
||||
source = "${pkgs.browserpass}/etc/chrome-policy.json";
|
||||
}
|
||||
]
|
||||
@@ -58,8 +58,8 @@ in {
|
||||
target = (if isDarwin
|
||||
then "Library/Application Support/Mozilla/NativeMessagingHosts"
|
||||
else ".mozilla/native-messaging-hosts")
|
||||
+ "/com.dannyvankooten.browserpass.json";
|
||||
source = "${pkgs.browserpass}/lib/mozilla/native-messaging-hosts/com.dannyvankooten.browserpass.json";
|
||||
+ "/com.github.browserpass.native.json";
|
||||
source = "${pkgs.browserpass}/lib/mozilla/native-messaging-hosts/com.github.browserpass.native.json";
|
||||
} ]
|
||||
else if x == "vivaldi" then
|
||||
let dir = if isDarwin
|
||||
@@ -67,11 +67,11 @@ in {
|
||||
else ".config/vivaldi/NativeMessagingHosts";
|
||||
in [
|
||||
{
|
||||
target = "${dir}/com.dannyvankooten.browserpass.json";
|
||||
target = "${dir}/com.github.browserpass.native.json";
|
||||
source = "${pkgs.browserpass}/etc/chrome-host.json";
|
||||
}
|
||||
{
|
||||
target = "${dir}/../policies/managed/com.dannyvankooten.browserpass.json";
|
||||
target = "${dir}/../policies/managed/com.github.browserpass.native.json";
|
||||
source = "${pkgs.browserpass}/etc/chrome-policy.json";
|
||||
}
|
||||
]
|
||||
|
||||
@@ -5,6 +5,18 @@ with lib;
|
||||
let
|
||||
|
||||
cfg = config.programs.direnv;
|
||||
configFile = config:
|
||||
pkgs.runCommand "config.toml"
|
||||
{
|
||||
buildInputs = [ pkgs.remarshal ];
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
}
|
||||
''
|
||||
remarshal -if json -of toml \
|
||||
< ${pkgs.writeText "config.json" (builtins.toJSON config)} \
|
||||
> $out
|
||||
'';
|
||||
|
||||
in
|
||||
|
||||
@@ -14,6 +26,31 @@ in
|
||||
options.programs.direnv = {
|
||||
enable = mkEnableOption "direnv, the environment switcher";
|
||||
|
||||
config = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
description = ''
|
||||
Configuration written to
|
||||
<filename>~/.config/direnv/config.toml</filename>.
|
||||
</para><para>
|
||||
See
|
||||
<citerefentry>
|
||||
<refentrytitle>direnv.toml</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
</citerefentry>.
|
||||
for the full list of options.
|
||||
'';
|
||||
};
|
||||
|
||||
stdlib = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Custom stdlib written to
|
||||
<filename>~/.config/direnv/direnvrc</filename>.
|
||||
'';
|
||||
};
|
||||
|
||||
enableBashIntegration = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
@@ -42,6 +79,14 @@ in
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.direnv ];
|
||||
|
||||
xdg.configFile."direnv/config.toml" = mkIf (cfg.config != {}) {
|
||||
source = configFile cfg.config;
|
||||
};
|
||||
|
||||
xdg.configFile."direnv/direnvrc" = mkIf (cfg.stdlib != "") {
|
||||
text = cfg.stdlib;
|
||||
};
|
||||
|
||||
programs.bash.initExtra =
|
||||
mkIf cfg.enableBashIntegration (
|
||||
# Using mkAfter to make it more likely to appear after other
|
||||
|
||||
@@ -6,8 +6,13 @@ let
|
||||
|
||||
cfg = config.programs.emacs;
|
||||
|
||||
# Copied from all-packages.nix.
|
||||
emacsPackages = pkgs.emacsPackagesNgGen cfg.package;
|
||||
# Copied from all-packages.nix, with modifications to support
|
||||
# overrides.
|
||||
emacsPackages =
|
||||
let
|
||||
epkgs = pkgs.emacsPackagesNgGen cfg.package;
|
||||
in
|
||||
epkgs.overrideScope' cfg.overrides;
|
||||
emacsWithPackages = emacsPackages.emacsWithPackages;
|
||||
|
||||
in
|
||||
@@ -33,10 +38,34 @@ in
|
||||
example = literalExample "epkgs: [ epkgs.emms epkgs.magit ]";
|
||||
description = "Extra packages available to Emacs.";
|
||||
};
|
||||
|
||||
overrides = mkOption {
|
||||
default = self: super: {};
|
||||
defaultText = "self: super: {}";
|
||||
example = literalExample ''
|
||||
self: super: rec {
|
||||
haskell-mode = self.melpaPackages.haskell-mode;
|
||||
# ...
|
||||
};
|
||||
'';
|
||||
description = ''
|
||||
Allows overriding packages within the Emacs package set.
|
||||
'';
|
||||
};
|
||||
|
||||
finalPackage = mkOption {
|
||||
type = types.package;
|
||||
visible = false;
|
||||
readOnly = true;
|
||||
description = ''
|
||||
The Emacs package including any overrides and extra packages.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ (emacsWithPackages cfg.extraPackages) ];
|
||||
home.packages = [ cfg.finalPackage ];
|
||||
programs.emacs.finalPackage = emacsWithPackages cfg.extraPackages;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ let
|
||||
|
||||
cfg = config.programs.firefox;
|
||||
|
||||
extensionPath = "extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
@@ -22,6 +24,22 @@ in
|
||||
description = "The unwrapped Firefox package to use.";
|
||||
};
|
||||
|
||||
extensions = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = [];
|
||||
example = literalExample ''
|
||||
with pkgs.nur.repos.rycee.firefox-addons; [
|
||||
https-everywhere
|
||||
privacy-badger
|
||||
]
|
||||
'';
|
||||
description = ''
|
||||
List of Firefox add-on packages to install. Note, it is
|
||||
necessary to manually enable these extensions inside Firefox
|
||||
after the first installation.
|
||||
'';
|
||||
};
|
||||
|
||||
enableAdobeFlash = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
@@ -60,5 +78,18 @@ in
|
||||
};
|
||||
in
|
||||
[ (wrapper cfg.package { }) ];
|
||||
|
||||
home.file.".mozilla/${extensionPath}" = mkIf (cfg.extensions != []) (
|
||||
let
|
||||
extensionsEnv = pkgs.buildEnv {
|
||||
name = "hm-firefox-extensions";
|
||||
paths = cfg.extensions;
|
||||
};
|
||||
in
|
||||
{
|
||||
source = "${extensionsEnv}/share/mozilla/${extensionPath}";
|
||||
recursive = true;
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -21,6 +21,15 @@ in
|
||||
programs.fish = {
|
||||
enable = mkEnableOption "fish friendly interactive shell";
|
||||
|
||||
package = mkOption {
|
||||
default = pkgs.fish;
|
||||
defaultText = "pkgs.fish";
|
||||
description = ''
|
||||
The fish package to install. May be used to change the version.
|
||||
'';
|
||||
type = types.package;
|
||||
};
|
||||
|
||||
shellAliases = mkOption {
|
||||
default = {};
|
||||
description = ''
|
||||
@@ -74,7 +83,70 @@ in
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.fish ];
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.dataFile."fish/home-manager_generated_completions".source =
|
||||
let
|
||||
# paths later in the list will overwrite those already linked
|
||||
destructiveSymlinkJoin =
|
||||
args_@{ name
|
||||
, paths
|
||||
, preferLocalBuild ? true
|
||||
, allowSubstitutes ? false
|
||||
, postBuild ? ""
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
args = removeAttrs args_ [ "name" "postBuild" ]
|
||||
// { inherit preferLocalBuild allowSubstitutes; }; # pass the defaults
|
||||
in pkgs.runCommand name args
|
||||
''
|
||||
mkdir -p $out
|
||||
for i in $paths; do
|
||||
if [ -z "$(find $i -prune -empty)" ]; then
|
||||
cp -srf $i/* $out
|
||||
fi
|
||||
done
|
||||
${postBuild}
|
||||
'';
|
||||
generateCompletions = package: pkgs.runCommand
|
||||
"${package.name}-fish-completions"
|
||||
{
|
||||
src = package;
|
||||
nativeBuildInputs = [ pkgs.python2 ];
|
||||
buildInputs = [ cfg.package ];
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
}
|
||||
''
|
||||
mkdir -p $out
|
||||
if [ -d $src/share/man ]; then
|
||||
find $src/share/man -type f \
|
||||
| xargs python ${cfg.package}/share/fish/tools/create_manpage_completions.py --directory $out \
|
||||
> /dev/null
|
||||
fi
|
||||
'';
|
||||
in
|
||||
destructiveSymlinkJoin {
|
||||
name = "${config.home.username}-fish-completions";
|
||||
paths =
|
||||
let
|
||||
cmp = (a: b: (a.meta.priority or 0) > (b.meta.priority or 0));
|
||||
in
|
||||
map generateCompletions (sort cmp config.home.packages);
|
||||
};
|
||||
|
||||
programs.fish.interactiveShellInit = ''
|
||||
# add completions generated by Home Manager to $fish_complete_path
|
||||
begin
|
||||
set -l joined (string join " " $fish_complete_path)
|
||||
set -l prev_joined (string replace --regex "[^\s]*generated_completions.*" "" $joined)
|
||||
set -l post_joined (string replace $prev_joined "" $joined)
|
||||
set -l prev (string split " " (string trim $prev_joined))
|
||||
set -l post (string split " " (string trim $post_joined))
|
||||
set fish_complete_path $prev "${config.xdg.dataHome}/fish/home-manager_generated_completions" $post
|
||||
end
|
||||
'';
|
||||
|
||||
xdg.configFile."fish/config.fish".text = ''
|
||||
# ~/.config/fish/config.fish: DO NOT EDIT -- this file has been generated automatically.
|
||||
|
||||
@@ -122,13 +122,17 @@ in
|
||||
);
|
||||
|
||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
||||
. ${pkgs.fzf}/share/fzf/completion.bash
|
||||
. ${pkgs.fzf}/share/fzf/key-bindings.bash
|
||||
if [[ :$SHELLOPTS: =~ :(vi|emacs): ]]; then
|
||||
. ${pkgs.fzf}/share/fzf/completion.bash
|
||||
. ${pkgs.fzf}/share/fzf/key-bindings.bash
|
||||
fi
|
||||
'';
|
||||
|
||||
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
||||
. ${pkgs.fzf}/share/fzf/completion.zsh
|
||||
. ${pkgs.fzf}/share/fzf/key-bindings.zsh
|
||||
if [[ $options[zle] = on ]]; then
|
||||
. ${pkgs.fzf}/share/fzf/completion.zsh
|
||||
. ${pkgs.fzf}/share/fzf/key-bindings.zsh
|
||||
fi
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,6 +6,12 @@ let
|
||||
|
||||
cfg = config.programs.git;
|
||||
|
||||
gitIniType = with types;
|
||||
let
|
||||
primitiveType = either bool (either int str);
|
||||
in
|
||||
attrsOf (attrsOf primitiveType);
|
||||
|
||||
signModule = types.submodule {
|
||||
options = {
|
||||
key = mkOption {
|
||||
@@ -28,7 +34,7 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
includeModule = types.submodule {
|
||||
includeModule = types.submodule ({ config, ... }: {
|
||||
options = {
|
||||
condition = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
@@ -44,11 +50,23 @@ let
|
||||
};
|
||||
|
||||
path = mkOption {
|
||||
type = types.str;
|
||||
type = with types; either str path;
|
||||
description = "Path of the configuration file to include.";
|
||||
};
|
||||
|
||||
contents = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
description = ''
|
||||
Configuration to include. If empty then a path must be given.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config.path = mkIf (config.contents != {}) (
|
||||
mkDefault (pkgs.writeText "contents" (generators.toINI {} config.contents))
|
||||
);
|
||||
});
|
||||
|
||||
in
|
||||
|
||||
@@ -63,22 +81,28 @@ in
|
||||
type = types.package;
|
||||
default = pkgs.git;
|
||||
defaultText = "pkgs.git";
|
||||
description = "Git package to install.";
|
||||
description = ''
|
||||
Git package to install. Use <varname>pkgs.gitAndTools.gitFull</varname>
|
||||
to gain access to <command>git send-email</command> for instance.
|
||||
'';
|
||||
};
|
||||
|
||||
userName = mkOption {
|
||||
type = types.str;
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Default user name to use.";
|
||||
};
|
||||
|
||||
userEmail = mkOption {
|
||||
type = types.str;
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Default user email to use.";
|
||||
};
|
||||
|
||||
aliases = mkOption {
|
||||
type = types.attrs;
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
example = { co = "checkout"; };
|
||||
description = "Git aliases to define.";
|
||||
};
|
||||
|
||||
@@ -89,13 +113,16 @@ in
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.either types.attrs types.lines;
|
||||
type = types.either types.lines gitIniType;
|
||||
default = {};
|
||||
example = {
|
||||
core = { whitespace = "trailing-space,space-before-tab"; };
|
||||
};
|
||||
description = "Additional configuration to add.";
|
||||
};
|
||||
|
||||
iniContent = mkOption {
|
||||
type = types.attrsOf types.attrs;
|
||||
type = gitIniType;
|
||||
internal = true;
|
||||
};
|
||||
|
||||
@@ -120,6 +147,20 @@ in
|
||||
'';
|
||||
description = "List of configuration files to include.";
|
||||
};
|
||||
|
||||
lfs = {
|
||||
enable = mkEnableOption "Git Large File Storage";
|
||||
|
||||
skipSmudge = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Skip automatic downloading of objects on clone or pull.
|
||||
This requires a manual <command>git lfs pull</command>
|
||||
every time a new commit is checked out on your repository.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -129,8 +170,8 @@ in
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
programs.git.iniContent.user = {
|
||||
name = cfg.userName;
|
||||
email = cfg.userEmail;
|
||||
name = mkIf (cfg.userName != null) cfg.userName;
|
||||
email = mkIf (cfg.userEmail != null) cfg.userEmail;
|
||||
};
|
||||
|
||||
xdg.configFile = {
|
||||
@@ -142,6 +183,26 @@ in
|
||||
};
|
||||
}
|
||||
|
||||
{
|
||||
programs.git.iniContent =
|
||||
let
|
||||
hasSmtp = name: account: account.smtp != null;
|
||||
|
||||
genIdentity = name: account: with account;
|
||||
nameValuePair "sendemail \"${name}\"" ({
|
||||
smtpEncryption = if smtp.tls.enable then "tls" else "";
|
||||
smtpServer = smtp.host;
|
||||
smtpUser = userName;
|
||||
from = address;
|
||||
}
|
||||
// optionalAttrs (smtp.port != null) {
|
||||
smtpServerPort = smtp.port;
|
||||
});
|
||||
in
|
||||
mapAttrs' genIdentity
|
||||
(filterAttrs hasSmtp config.accounts.email.accounts);
|
||||
}
|
||||
|
||||
(mkIf (cfg.signing != null) {
|
||||
programs.git.iniContent = {
|
||||
user.signingKey = cfg.signing.key;
|
||||
@@ -171,6 +232,25 @@ in
|
||||
'')
|
||||
cfg.includes);
|
||||
})
|
||||
|
||||
(mkIf cfg.lfs.enable {
|
||||
home.packages = [ pkgs.git-lfs ];
|
||||
|
||||
programs.git.iniContent."filter \"lfs\"" =
|
||||
let
|
||||
skipArg = optional cfg.lfs.skipSmudge "--skip";
|
||||
in
|
||||
{
|
||||
clean = "git-lfs clean -- %f";
|
||||
process = concatStringsSep " " (
|
||||
[ "git-lfs" "filter-process" ] ++ skipArg
|
||||
);
|
||||
required = true;
|
||||
smudge = concatStringsSep " " (
|
||||
[ "git-lfs" "smudge" ] ++ skipArg ++ [ "--" "%f" ]
|
||||
);
|
||||
};
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,10 @@ let
|
||||
|
||||
cfg = config.programs.gnome-terminal;
|
||||
|
||||
dag = config.lib.dag;
|
||||
vteInitStr = ''
|
||||
# gnome-terminal: Show current directory in the terminal window title.
|
||||
. ${pkgs.gnome3.vte}/etc/profile.d/vte.sh
|
||||
'';
|
||||
|
||||
profileColorsSubModule = types.submodule (
|
||||
{ ... }: {
|
||||
@@ -91,19 +94,6 @@ let
|
||||
}
|
||||
);
|
||||
|
||||
toDconfIni = generators.toINI { mkKeyValue = mkIniKeyValue; };
|
||||
|
||||
mkIniKeyValue = key: value:
|
||||
let
|
||||
tweakVal = v:
|
||||
if isString v then "'${v}'"
|
||||
else if isList v then "[" + concatStringsSep "," (map tweakVal v) + "]"
|
||||
else if isBool v && v then "true"
|
||||
else if isBool v && !v then "false"
|
||||
else toString v;
|
||||
in
|
||||
"${key}=${tweakVal value}";
|
||||
|
||||
buildProfileSet = pcfg:
|
||||
{
|
||||
visible-name = pcfg.visibleName;
|
||||
@@ -136,25 +126,6 @@ let
|
||||
)
|
||||
);
|
||||
|
||||
buildIniSet = cfg:
|
||||
{
|
||||
"/" = {
|
||||
default-show-menubar = cfg.showMenubar;
|
||||
schema-version = 3;
|
||||
};
|
||||
}
|
||||
//
|
||||
{
|
||||
"profiles:" = {
|
||||
default = head (attrNames (filterAttrs (n: v: v.default) cfg.profile));
|
||||
list = attrNames cfg.profile;
|
||||
};
|
||||
}
|
||||
//
|
||||
mapAttrs' (name: value:
|
||||
nameValuePair ("profiles:/:${name}") (buildProfileSet value)
|
||||
) cfg.profile;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
@@ -181,20 +152,26 @@ in
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.gnome3.gnome_terminal ];
|
||||
|
||||
# The dconf service needs to be installed and prepared.
|
||||
home.activation.gnomeTerminal = dag.entryAfter ["installPackages"] (
|
||||
dconf.settings =
|
||||
let
|
||||
iniText = toDconfIni (buildIniSet cfg);
|
||||
iniFile = pkgs.writeText "gnome-terminal.ini" iniText;
|
||||
dconfPath = "/org/gnome/terminal/legacy/";
|
||||
dconfPath = "org/gnome/terminal/legacy";
|
||||
in
|
||||
''
|
||||
if [[ -v DRY_RUN ]]; then
|
||||
echo ${pkgs.gnome3.dconf}/bin/dconf load ${dconfPath} "<" ${iniFile}
|
||||
else
|
||||
${pkgs.gnome3.dconf}/bin/dconf load ${dconfPath} < ${iniFile}
|
||||
fi
|
||||
''
|
||||
);
|
||||
{
|
||||
"${dconfPath}" = {
|
||||
default-show-menubar = cfg.showMenubar;
|
||||
schema-version = 3;
|
||||
};
|
||||
|
||||
"${dconfPath}/profiles:" = {
|
||||
default = head (attrNames (filterAttrs (n: v: v.default) cfg.profile));
|
||||
list = attrNames cfg.profile;
|
||||
};
|
||||
}
|
||||
// mapAttrs' (n: v:
|
||||
nameValuePair ("${dconfPath}/profiles:/:${n}") (buildProfileSet v)
|
||||
) cfg.profile;
|
||||
|
||||
programs.bash.initExtra = mkBefore vteInitStr;
|
||||
programs.zsh.initExtra = vteInitStr;
|
||||
};
|
||||
}
|
||||
|
||||
75
modules/programs/go.nix
Normal file
75
modules/programs/go.nix
Normal file
@@ -0,0 +1,75 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.go;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
meta.maintainers = [ maintainers.rvolosatovs ];
|
||||
|
||||
options = {
|
||||
programs.go = {
|
||||
enable = mkEnableOption "Go";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.go;
|
||||
defaultText = "pkgs.go";
|
||||
description = "The Go package to use.";
|
||||
};
|
||||
|
||||
packages = mkOption {
|
||||
type = with types; attrsOf path;
|
||||
default = {};
|
||||
example = literalExample ''
|
||||
{
|
||||
"golang.org/x/text" = builtins.fetchGit "https://go.googlesource.com/text";
|
||||
"golang.org/x/time" = builtins.fetchGit "https://go.googlesource.com/time";
|
||||
}
|
||||
'';
|
||||
description = "Packages to add to GOPATH.";
|
||||
};
|
||||
|
||||
goPath = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
example = "go";
|
||||
description = "GOPATH relative to HOME";
|
||||
};
|
||||
|
||||
goBin = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
example = ".local/bin.go";
|
||||
description = "GOBIN relative to HOME";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
home.file =
|
||||
let
|
||||
goPath = if cfg.goPath != null then cfg.goPath else "go";
|
||||
|
||||
mkSrc = n: v: {
|
||||
target = "${goPath}/src/${n}";
|
||||
source = v;
|
||||
};
|
||||
in
|
||||
mapAttrsToList mkSrc cfg.packages;
|
||||
}
|
||||
(mkIf (cfg.goPath != null) {
|
||||
home.sessionVariables.GOPATH = builtins.toPath "${config.home.homeDirectory}/${cfg.goPath}";
|
||||
})
|
||||
(mkIf (cfg.goBin != null) {
|
||||
home.sessionVariables.GOBIN = builtins.toPath "${config.home.homeDirectory}/${cfg.goBin}";
|
||||
})
|
||||
]);
|
||||
}
|
||||
@@ -32,24 +32,12 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg.enable && !config.nixosSubmodule) {
|
||||
config = mkIf (cfg.enable && !config.submoduleSupport.enable) {
|
||||
home.packages = [
|
||||
(import ../../home-manager {
|
||||
inherit pkgs;
|
||||
inherit (cfg) path;
|
||||
})
|
||||
];
|
||||
|
||||
# Uninstall manually installed home-manager, if such exists.
|
||||
# Without this a file collision error will be printed.
|
||||
home.activation.uninstallHomeManager =
|
||||
dag.entryBetween [ "installPackages" ] [ "writeBoundary" ] ''
|
||||
if nix-env -q | grep -q "^home-manager$" ; then
|
||||
$DRY_RUN_CMD nix-env -e home-manager
|
||||
|
||||
echo "You can now remove the 'home-manager' packageOverride"
|
||||
echo "or overlay in '~/.config/nixpkgs/', if you want."
|
||||
fi
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
211
modules/programs/irssi.nix
Normal file
211
modules/programs/irssi.nix
Normal file
@@ -0,0 +1,211 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.irssi;
|
||||
|
||||
boolStr = b: if b then "yes" else "no";
|
||||
quoteStr = s: escape ["\""] s;
|
||||
|
||||
assignFormat = set:
|
||||
concatStringsSep "\n"
|
||||
(mapAttrsToList (k: v: " ${k} = \"${quoteStr v}\";") set);
|
||||
|
||||
chatnetString =
|
||||
concatStringsSep "\n"
|
||||
(flip mapAttrsToList cfg.networks
|
||||
(k: v: ''
|
||||
${k} = {
|
||||
type = "${v.type}";
|
||||
nick = "${quoteStr v.nick}";
|
||||
autosendcmd = "${concatMapStringsSep ";" quoteStr v.autoCommands}";
|
||||
};
|
||||
''));
|
||||
|
||||
serversString =
|
||||
concatStringsSep ",\n"
|
||||
(flip mapAttrsToList cfg.networks
|
||||
(k: v: ''
|
||||
{
|
||||
chatnet = "${k}";
|
||||
address = "${v.server.address}";
|
||||
port = "${toString v.server.port}";
|
||||
use_ssl = "${boolStr v.server.ssl.enable}";
|
||||
ssl_verify = "${boolStr v.server.ssl.verify}";
|
||||
autoconnect = "${boolStr v.server.autoConnect}";
|
||||
}
|
||||
''));
|
||||
|
||||
channelString =
|
||||
concatStringsSep ",\n"
|
||||
(flip mapAttrsToList cfg.networks
|
||||
(k: v:
|
||||
concatStringsSep ",\n"
|
||||
(flip mapAttrsToList v.channels
|
||||
(c: cv: ''
|
||||
{
|
||||
chatnet = "${k}";
|
||||
name = "${c}";
|
||||
autojoin = "${boolStr cv.autoJoin}";
|
||||
}
|
||||
''))));
|
||||
|
||||
channelType = types.submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
visible = false;
|
||||
default = null;
|
||||
description = "Name of the channel.";
|
||||
};
|
||||
|
||||
autoJoin = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whether to join this channel on connect.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networkType = types.submodule ({ name, ...}: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
visible = false;
|
||||
default = name;
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
nick = mkOption {
|
||||
type = types.str;
|
||||
description = "Nickname in that network.";
|
||||
};
|
||||
|
||||
type = mkOption {
|
||||
type = types.str;
|
||||
description = "Type of the network.";
|
||||
default = "IRC";
|
||||
};
|
||||
|
||||
autoCommands = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
description = "List of commands to execute on connect.";
|
||||
};
|
||||
|
||||
server = {
|
||||
address = mkOption {
|
||||
type = types.str;
|
||||
description = "Address of the chat server.";
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.int;
|
||||
default = 6667;
|
||||
description = "Port of the chat server.";
|
||||
};
|
||||
|
||||
ssl = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether SSL should be used.";
|
||||
};
|
||||
|
||||
verify = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether the SSL certificate should be verified.";
|
||||
};
|
||||
};
|
||||
|
||||
autoConnect = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whether Irssi connects to the server on launch.";
|
||||
};
|
||||
};
|
||||
|
||||
channels = mkOption {
|
||||
description = "Channels for the given network.";
|
||||
type = types.attrsOf channelType;
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options = {
|
||||
programs.irssi = {
|
||||
enable = mkEnableOption "the Irssi chat client";
|
||||
|
||||
extraConfig = mkOption {
|
||||
default = "";
|
||||
description = "These lines are appended to the Irssi configuration.";
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
aliases = mkOption {
|
||||
default = {};
|
||||
example = { J = "join"; BYE = "quit";};
|
||||
description = "An attribute set that maps aliases to commands.";
|
||||
type = types.attrsOf types.str;
|
||||
};
|
||||
|
||||
networks = mkOption {
|
||||
default = {};
|
||||
example = literalExample ''
|
||||
{
|
||||
freenode = {
|
||||
nick = "hmuser";
|
||||
server = {
|
||||
address = "chat.freenode.net";
|
||||
port = 6697;
|
||||
autoConnect = true;
|
||||
};
|
||||
channels = {
|
||||
nixos.autoJoin = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = "An attribute set of chat networks.";
|
||||
type = types.attrsOf networkType;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.irssi ];
|
||||
|
||||
home.file.".irssi/config".text = ''
|
||||
settings = {
|
||||
core = {
|
||||
settings_autosave = "no";
|
||||
};
|
||||
};
|
||||
|
||||
aliases = {
|
||||
${assignFormat cfg.aliases}
|
||||
};
|
||||
|
||||
chatnets = {
|
||||
${chatnetString}
|
||||
};
|
||||
|
||||
servers = (
|
||||
${serversString}
|
||||
);
|
||||
|
||||
channels = (
|
||||
${channelString}
|
||||
);
|
||||
|
||||
${cfg.extraConfig}
|
||||
'';
|
||||
};
|
||||
}
|
||||
76
modules/programs/jq.nix
Normal file
76
modules/programs/jq.nix
Normal file
@@ -0,0 +1,76 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.jq;
|
||||
|
||||
colorType = mkOption {
|
||||
type = types.str;
|
||||
description = "ANSI color definition";
|
||||
example = "1;31";
|
||||
visible = false;
|
||||
};
|
||||
|
||||
colorsType = types.submodule {
|
||||
options = {
|
||||
null = colorType;
|
||||
false = colorType;
|
||||
true = colorType;
|
||||
numbers = colorType;
|
||||
strings = colorType;
|
||||
arrays = colorType;
|
||||
objects = colorType;
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
options = {
|
||||
programs.jq = {
|
||||
enable = mkEnableOption "the jq command-line JSON processor";
|
||||
|
||||
colors = mkOption {
|
||||
description = ''
|
||||
The colors used in colored JSON output.</para>
|
||||
|
||||
<para>See <link xlink:href="https://stedolan.github.io/jq/manual/#Colors"/>.
|
||||
'';
|
||||
|
||||
example = literalExample ''
|
||||
{
|
||||
null = "1;30";
|
||||
false = "0;31";
|
||||
true = "0;32";
|
||||
numbers = "0;36";
|
||||
strings = "0;33";
|
||||
arrays = "1;35";
|
||||
objects = "1;37";
|
||||
}
|
||||
'';
|
||||
|
||||
default = {
|
||||
null = "1;30";
|
||||
false = "0;39";
|
||||
true = "0;39";
|
||||
numbers = "0;39";
|
||||
strings = "0;32";
|
||||
arrays = "1;39";
|
||||
objects = "1;39";
|
||||
};
|
||||
|
||||
type = colorsType;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.jq ];
|
||||
|
||||
home.sessionVariables = let c = cfg.colors; in {
|
||||
JQ_COLORS = "${c.null}:${c.false}:${c.true}:${c.numbers}:${c.strings}:${c.arrays}:${c.objects}";
|
||||
};
|
||||
};
|
||||
}
|
||||
64
modules/programs/matplotlib.nix
Normal file
64
modules/programs/matplotlib.nix
Normal file
@@ -0,0 +1,64 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.matplotlib;
|
||||
|
||||
formatLine = o: n: v:
|
||||
let
|
||||
formatValue = v:
|
||||
if isBool v then (if v then "True" else "False")
|
||||
else toString v;
|
||||
in
|
||||
if isAttrs v
|
||||
then concatStringsSep "\n" (mapAttrsToList (formatLine "${o}${n}.") v)
|
||||
else (if v == "" then "" else "${o}${n}: ${formatValue v}");
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
meta.maintainers = [ maintainers.rprospero ];
|
||||
|
||||
options.programs.matplotlib = {
|
||||
enable = mkEnableOption "matplotlib, a plotting library for python";
|
||||
|
||||
config = mkOption {
|
||||
default = { };
|
||||
type = types.attrs;
|
||||
description = ''
|
||||
Add terms to the <filename>matplotlibrc</filename> file to
|
||||
control the default matplotlib behavior.
|
||||
'';
|
||||
example = literalExample ''
|
||||
{
|
||||
backend = "Qt5Agg";
|
||||
axes = {
|
||||
grid = true;
|
||||
facecolor = "black";
|
||||
edgecolor = "FF9900";
|
||||
};
|
||||
grid.color = "FF9900";
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Additional commands for matplotlib that will be added to the
|
||||
<filename>matplotlibrc</filename> file.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
xdg.configFile."matplotlib/matplotlibrc".text =
|
||||
concatStringsSep "\n" ([]
|
||||
++ mapAttrsToList (formatLine "") cfg.config
|
||||
++ optional (cfg.extraConfig != "") cfg.extraConfig
|
||||
) + "\n";
|
||||
};
|
||||
}
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
extraConfigType = with lib.types; attrsOf (either (either str int) bool);
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
options.mbsync = {
|
||||
enable = mkEnableOption "synchronization using mbsync";
|
||||
@@ -53,5 +59,49 @@ with lib;
|
||||
Pattern of mailboxes to synchronize.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig.channel = mkOption {
|
||||
type = extraConfigType;
|
||||
default = {};
|
||||
example = literalExample ''
|
||||
{
|
||||
MaxMessages = 10000;
|
||||
MaxSize = "1m";
|
||||
};
|
||||
'';
|
||||
description = ''
|
||||
Per channel extra configuration.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig.local = mkOption {
|
||||
type = extraConfigType;
|
||||
default = {};
|
||||
description = ''
|
||||
Local store extra configuration.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig.remote = mkOption {
|
||||
type = extraConfigType;
|
||||
default = {};
|
||||
description = ''
|
||||
Remote store extra configuration.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig.account = mkOption {
|
||||
type = extraConfigType;
|
||||
default = {};
|
||||
example = literalExample ''
|
||||
{
|
||||
PipelineDepth = 10;
|
||||
Timeout = 60;
|
||||
};
|
||||
'';
|
||||
description = ''
|
||||
Account section extra configuration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -33,36 +33,42 @@ let
|
||||
genSection = header: entries:
|
||||
let
|
||||
escapeValue = escape [ "\"" ];
|
||||
genValue = v:
|
||||
hasSpace = v: builtins.match ".* .*" v != null;
|
||||
genValue = n: v:
|
||||
if isList v
|
||||
then concatMapStringsSep " " genValue v
|
||||
else "\"${escapeValue v}\"";
|
||||
then concatMapStringsSep " " (genValue n) v
|
||||
else if isBool v then (if v then "yes" else "no")
|
||||
else if isInt v then toString v
|
||||
else if isString v && hasSpace v then "\"${escapeValue v}\""
|
||||
else if isString v then v
|
||||
else
|
||||
let prettyV = lib.generators.toPretty {} v;
|
||||
in throw "mbsync: unexpected value for option ${n}: '${prettyV}'";
|
||||
in
|
||||
''
|
||||
${header}
|
||||
${concatStringsSep "\n"
|
||||
(mapAttrsToList (n: v: "${n} ${genValue v}") entries)}
|
||||
(mapAttrsToList (n: v: "${n} ${genValue n v}") entries)}
|
||||
'';
|
||||
|
||||
genAccountConfig = account: with account;
|
||||
if (imap == null || maildir == null)
|
||||
then ""
|
||||
else
|
||||
genSection "IMAPAccount ${name}" (
|
||||
{
|
||||
Host = imap.host;
|
||||
User = userName;
|
||||
PassCmd = toString passwordCommand;
|
||||
}
|
||||
//
|
||||
genTlsConfig imap.tls
|
||||
//
|
||||
optionalAttrs (imap.port != null) { Port = toString imap.port; }
|
||||
// genTlsConfig imap.tls
|
||||
// optionalAttrs (imap.port != null) { Port = toString imap.port; }
|
||||
// mbsync.extraConfig.account
|
||||
)
|
||||
+ "\n"
|
||||
+ genSection "IMAPStore ${name}-remote" {
|
||||
Account = name;
|
||||
}
|
||||
+ genSection "IMAPStore ${name}-remote" (
|
||||
{
|
||||
Account = name;
|
||||
}
|
||||
// mbsync.extraConfig.remote
|
||||
)
|
||||
+ "\n"
|
||||
+ genSection "MaildirStore ${name}-local" (
|
||||
{
|
||||
@@ -70,19 +76,22 @@ let
|
||||
Inbox = "${maildir.absPath}/${folders.inbox}";
|
||||
SubFolders = "Verbatim";
|
||||
}
|
||||
//
|
||||
optionalAttrs (mbsync.flatten != null) { Flatten = mbsync.flatten; }
|
||||
// optionalAttrs (mbsync.flatten != null) { Flatten = mbsync.flatten; }
|
||||
// mbsync.extraConfig.local
|
||||
)
|
||||
+ "\n"
|
||||
+ genSection "Channel ${name}" {
|
||||
Master = ":${name}-remote:";
|
||||
Slave = ":${name}-local:";
|
||||
Patterns = mbsync.patterns;
|
||||
Create = masterSlaveMapping.${mbsync.create};
|
||||
Remove = masterSlaveMapping.${mbsync.remove};
|
||||
Expunge = masterSlaveMapping.${mbsync.expunge};
|
||||
SyncState = "*";
|
||||
}
|
||||
+ genSection "Channel ${name}" (
|
||||
{
|
||||
Master = ":${name}-remote:";
|
||||
Slave = ":${name}-local:";
|
||||
Patterns = mbsync.patterns;
|
||||
Create = masterSlaveMapping.${mbsync.create};
|
||||
Remove = masterSlaveMapping.${mbsync.remove};
|
||||
Expunge = masterSlaveMapping.${mbsync.expunge};
|
||||
SyncState = "*";
|
||||
}
|
||||
// mbsync.extraConfig.channel
|
||||
)
|
||||
+ "\n";
|
||||
|
||||
genGroupConfig = name: channels:
|
||||
@@ -135,29 +144,23 @@ in
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
(
|
||||
let
|
||||
badAccounts = filter (a: a.maildir == null) mbsyncAccounts;
|
||||
in
|
||||
{
|
||||
assertions =
|
||||
let
|
||||
checkAccounts = pred: msg:
|
||||
let
|
||||
badAccounts = filter pred mbsyncAccounts;
|
||||
in {
|
||||
assertion = badAccounts == [];
|
||||
message = "mbsync: Missing maildir configuration for accounts: "
|
||||
message = "mbsync: ${msg} for accounts: "
|
||||
+ concatMapStringsSep ", " (a: a.name) badAccounts;
|
||||
}
|
||||
)
|
||||
|
||||
(
|
||||
let
|
||||
badAccounts = filter (a: a.imap == null) mbsyncAccounts;
|
||||
in
|
||||
{
|
||||
assertion = badAccounts == [];
|
||||
message = "mbsync: Missing IMAP configuration for accounts: "
|
||||
+ concatMapStringsSep ", " (a: a.name) badAccounts;
|
||||
}
|
||||
)
|
||||
];
|
||||
};
|
||||
in
|
||||
[
|
||||
(checkAccounts (a: a.maildir == null) "Missing maildir configuration")
|
||||
(checkAccounts (a: a.imap == null) "Missing IMAP configuration")
|
||||
(checkAccounts (a: a.passwordCommand == null) "Missing passwordCommand")
|
||||
(checkAccounts (a: a.userName == null) "Missing username")
|
||||
];
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
@@ -173,7 +176,7 @@ in
|
||||
++ accountsConfig
|
||||
++ groupsConfig
|
||||
++ optional (cfg.extraConfig != "") cfg.extraConfig
|
||||
);
|
||||
) + "\n";
|
||||
|
||||
home.activation.createMaildir =
|
||||
dag.entryBetween [ "linkGeneration" ] [ "writeBoundary" ] ''
|
||||
|
||||
@@ -11,14 +11,25 @@ with lib;
|
||||
Whether to enable msmtp.
|
||||
</para><para>
|
||||
If enabled then it is possible to use the
|
||||
<option>--account</option> command line option to send a
|
||||
message for a given account using the <command>msmtp</command>
|
||||
or <command>msmtpq</command> tool. For example,
|
||||
<command>msmtp --account=private</command>
|
||||
would send using the account defined in
|
||||
<parameter class="command">--account</parameter> command line
|
||||
option to send a message for a given account using the
|
||||
<command>msmtp</command> or <command>msmtpq</command> tool.
|
||||
For example, <command>msmtp --account=private</command> would
|
||||
send using the account defined in
|
||||
<option>accounts.email.accounts.private</option>. If the
|
||||
<option>--account</option> option is not given then the
|
||||
primary account will be used.
|
||||
<parameter class="command">--account</parameter> option is not
|
||||
given then the primary account will be used.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
example = { auth = "login"; };
|
||||
description = ''
|
||||
Extra configuration options to add to <filename>~/.msmtprc</filename>.
|
||||
See <link xlink:href="https://marlam.de/msmtp/msmtprc.txt"/> for
|
||||
examples.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
@@ -6,8 +6,6 @@ let
|
||||
|
||||
cfg = config.programs.msmtp;
|
||||
|
||||
dag = config.lib.dag;
|
||||
|
||||
msmtpAccounts = filter (a: a.msmtp.enable)
|
||||
(attrValues config.accounts.email.accounts);
|
||||
|
||||
@@ -33,6 +31,7 @@ let
|
||||
# msmtp requires the password to finish with a newline.
|
||||
passwordeval = ''${pkgs.bash}/bin/bash -c "${toString passwordCommand}; echo"'';
|
||||
}
|
||||
// msmtp.extraConfig
|
||||
)
|
||||
++ optional primary "\naccount default : ${name}"
|
||||
);
|
||||
@@ -67,7 +66,7 @@ in
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.msmtp ];
|
||||
|
||||
home.file.".msmtprc".text = configFile msmtpAccounts;
|
||||
xdg.configFile."msmtp/config".text = configFile msmtpAccounts;
|
||||
|
||||
home.sessionVariables = {
|
||||
MSMTP_QUEUE = "${config.xdg.dataHome}/msmtp/queue";
|
||||
|
||||
@@ -6,6 +6,24 @@ let
|
||||
|
||||
cfg = config.programs.neovim;
|
||||
|
||||
extraPythonPackageType = mkOptionType {
|
||||
name = "extra-python-packages";
|
||||
description = "python packages in python.withPackages format";
|
||||
check = with types; (x: if isFunction x
|
||||
then isList (x pkgs.pythonPackages)
|
||||
else false);
|
||||
merge = mergeOneOption;
|
||||
};
|
||||
|
||||
extraPython3PackageType = mkOptionType {
|
||||
name = "extra-python3-packages";
|
||||
description = "python3 packages in python.withPackages format";
|
||||
check = with types; (x: if isFunction x
|
||||
then isList (x pkgs.python3Packages)
|
||||
else false);
|
||||
merge = mergeOneOption;
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
@@ -39,12 +57,13 @@ in
|
||||
};
|
||||
|
||||
extraPythonPackages = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = [ ];
|
||||
example = literalExample "with pkgs.python2Packages; [ pandas jedi ]";
|
||||
type = with types; either extraPythonPackageType (listOf package);
|
||||
default = (_: []);
|
||||
defaultText = "ps: []";
|
||||
example = literalExample "(ps: with ps; [ pandas jedi ])";
|
||||
description = ''
|
||||
List here Python 2 packages required for your plugins to
|
||||
work.
|
||||
A function in python.withPackages format, which returns a
|
||||
list of Python 2 packages required for your plugins to work.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -66,18 +85,26 @@ in
|
||||
};
|
||||
|
||||
extraPython3Packages = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = [ ];
|
||||
example = literalExample
|
||||
"with pkgs.python3Packages; [ python-language-server ]";
|
||||
type = with types; either extraPython3PackageType (listOf package);
|
||||
default = (_: []);
|
||||
defaultText = "ps: []";
|
||||
example = literalExample "(ps: with ps; [ python-language-server ])";
|
||||
description = ''
|
||||
List here Python 3 packages required for your plugins to work.
|
||||
A function in python.withPackages format, which returns a
|
||||
list of Python 3 packages required for your plugins to work.
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.neovim-unwrapped;
|
||||
defaultText = "pkgs.neovim-unwrapped";
|
||||
description = "The package to use for the neovim binary.";
|
||||
};
|
||||
|
||||
configure = mkOption {
|
||||
type = types.nullOr types.attrs;
|
||||
default = null;
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
example = literalExample ''
|
||||
configure = {
|
||||
customRC = $''''
|
||||
@@ -92,7 +119,7 @@ in
|
||||
};
|
||||
'';
|
||||
description = ''
|
||||
Generate your init file from your list of plugins and custom commands,
|
||||
Generate your init file from your list of plugins and custom commands,
|
||||
and loads it from the store via <command>nvim -u /nix/store/hash-vimrc</command>
|
||||
'';
|
||||
};
|
||||
@@ -101,7 +128,7 @@ in
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [
|
||||
(pkgs.neovim.override {
|
||||
(pkgs.wrapNeovim cfg.package {
|
||||
inherit (cfg)
|
||||
extraPython3Packages withPython3
|
||||
extraPythonPackages withPython
|
||||
|
||||
@@ -45,13 +45,13 @@ in
|
||||
};
|
||||
|
||||
browser = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
default = "${pkgs.xdg_utils}/bin/xdg-open";
|
||||
description = "External browser to use.";
|
||||
};
|
||||
|
||||
queries = mkOption {
|
||||
type = types.attrsOf types.string;
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
example = {
|
||||
"foo" = "rssurl =~ \"example.com\"";
|
||||
|
||||
53
modules/programs/noti.nix
Normal file
53
modules/programs/noti.nix
Normal file
@@ -0,0 +1,53 @@
|
||||
{ config, lib, pkgs, ...}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.noti;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
meta.maintainers = [ maintainers.marsam ];
|
||||
|
||||
options.programs.noti = {
|
||||
enable = mkEnableOption "Noti";
|
||||
|
||||
settings = mkOption {
|
||||
type = types.attrsOf (types.attrsOf types.str);
|
||||
default = {};
|
||||
description = ''
|
||||
Configuration written to
|
||||
<filename>~/.config/noti/noti.yaml</filename>.
|
||||
</para><para>
|
||||
See
|
||||
<citerefentry>
|
||||
<refentrytitle>noti.yaml</refentrytitle>
|
||||
<manvolnum>5</manvolnum>
|
||||
</citerefentry>.
|
||||
for the full list of options.
|
||||
'';
|
||||
example = literalExample ''
|
||||
{
|
||||
say = {
|
||||
voice = "Alex";
|
||||
};
|
||||
slack = {
|
||||
token = "1234567890abcdefg";
|
||||
channel = "@jaime";
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.noti ];
|
||||
|
||||
xdg.configFile."noti/noti.yaml" = mkIf (cfg.settings != {}) {
|
||||
text = generators.toYAML {} cfg.settings;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
@@ -4,8 +4,6 @@ with lib;
|
||||
|
||||
let
|
||||
|
||||
dag = config.lib.dag;
|
||||
|
||||
cfg = config.programs.notmuch;
|
||||
|
||||
mkIniKeyValue = key: value:
|
||||
@@ -13,7 +11,7 @@ let
|
||||
tweakVal = v:
|
||||
if isString v then v
|
||||
else if isList v then concatMapStringsSep ";" tweakVal v
|
||||
else if isBool v then toJSON v
|
||||
else if isBool v then (if v then "true" else "false")
|
||||
else toString v;
|
||||
in
|
||||
"${key}=${tweakVal value}";
|
||||
@@ -24,12 +22,16 @@ let
|
||||
database = {
|
||||
path = config.accounts.email.maildirBasePath;
|
||||
};
|
||||
|
||||
|
||||
maildir = {
|
||||
synchronize_flags = cfg.maildir.synchronizeFlags;
|
||||
};
|
||||
|
||||
new = {
|
||||
ignore = cfg.new.ignore;
|
||||
tags = cfg.new.tags;
|
||||
};
|
||||
|
||||
|
||||
user =
|
||||
let
|
||||
accounts =
|
||||
@@ -42,7 +44,7 @@ let
|
||||
primary_email = catAttrs "address" primary;
|
||||
other_email = catAttrs "address" secondaries;
|
||||
};
|
||||
|
||||
|
||||
search = {
|
||||
exclude_tags = [ "deleted" "spam" ];
|
||||
};
|
||||
@@ -88,9 +90,7 @@ in
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.attrsOf (types.attrsOf types.str);
|
||||
default = {
|
||||
maildir = { synchronize_flags = "true"; };
|
||||
};
|
||||
default = {};
|
||||
description = ''
|
||||
Options that should be appended to the notmuch configuration file.
|
||||
'';
|
||||
@@ -128,6 +128,16 @@ in
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
maildir = {
|
||||
synchronizeFlags = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to synchronize Maildir flags.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -168,7 +178,7 @@ in
|
||||
export PATH="${pkgs.notmuch}/bin''${PATH:+:}$PATH"
|
||||
export NOTMUCH_CONFIG="${config.xdg.configHome}/notmuch/notmuchrc"
|
||||
export NMBGIT="${config.xdg.dataHome}/notmuch/nmbug"
|
||||
|
||||
|
||||
${cmds}
|
||||
'';
|
||||
executable = true;
|
||||
|
||||
53
modules/programs/obs-studio.nix
Normal file
53
modules/programs/obs-studio.nix
Normal file
@@ -0,0 +1,53 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.obs-studio;
|
||||
package = pkgs.obs-studio;
|
||||
|
||||
mkPluginEnv = packages:
|
||||
let
|
||||
pluginDirs = map (pkg: "${pkg}/share/obs/obs-plugins") packages;
|
||||
plugins = concatMapStringsSep " " (p: "${p}/*") pluginDirs;
|
||||
in
|
||||
pkgs.runCommand "obs-studio-plugins"
|
||||
{
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
}
|
||||
''
|
||||
mkdir $out
|
||||
[[ '${plugins}' ]] || exit 0
|
||||
for plugin in ${plugins}; do
|
||||
ln -s "$plugin" $out/
|
||||
done
|
||||
'';
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
meta.maintainers = [ maintainers.adisbladis ];
|
||||
|
||||
options = {
|
||||
programs.obs-studio = {
|
||||
enable = mkEnableOption "obs-studio";
|
||||
|
||||
plugins = mkOption {
|
||||
default = [];
|
||||
example = literalExample "[ pkgs.obs-linuxbrowser ]";
|
||||
description = "Optional OBS plugins.";
|
||||
type = types.listOf types.package;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ package ];
|
||||
|
||||
xdg.configFile."obs-studio/plugins" = mkIf (cfg.plugins != []) {
|
||||
source = mkPluginEnv cfg.plugins;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -12,6 +12,17 @@ in
|
||||
options.offlineimap = {
|
||||
enable = mkEnableOption "OfflineIMAP";
|
||||
|
||||
extraConfig.account = mkOption {
|
||||
type = extraConfigType;
|
||||
default = {};
|
||||
example = {
|
||||
autorefresh = 20;
|
||||
};
|
||||
description = ''
|
||||
Extra configuration options to add to the account section.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig.local = mkOption {
|
||||
type = extraConfigType;
|
||||
default = {};
|
||||
|
||||
@@ -88,7 +88,8 @@ let
|
||||
localrepository = "${name}-local";
|
||||
remoterepository = "${name}-remote";
|
||||
}
|
||||
// postSyncHook;
|
||||
// postSyncHook
|
||||
// offlineimap.extraConfig.account;
|
||||
|
||||
"Repository ${name}-local" = {
|
||||
type = localType;
|
||||
|
||||
52
modules/programs/opam.nix
Normal file
52
modules/programs/opam.nix
Normal file
@@ -0,0 +1,52 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.opam;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
meta.maintainers = [ maintainers.marsam ];
|
||||
|
||||
options.programs.opam = {
|
||||
enable = mkEnableOption "Opam";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.opam;
|
||||
defaultText = "pkgs.opam";
|
||||
description = "Opam package to install.";
|
||||
};
|
||||
|
||||
enableBashIntegration = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enable Bash integration.
|
||||
'';
|
||||
};
|
||||
|
||||
enableZshIntegration = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enable Zsh integration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
||||
eval "$(${cfg.package}/bin/opam env --shell=bash)"
|
||||
'';
|
||||
|
||||
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
||||
eval "$(${cfg.package}/bin/opam env --shell=zsh)"
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -8,7 +8,7 @@ let
|
||||
cfg = config.programs.rofi;
|
||||
|
||||
colorOption = description: mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
description = description;
|
||||
};
|
||||
|
||||
@@ -175,7 +175,7 @@ in
|
||||
|
||||
font = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.string;
|
||||
type = types.nullOr types.str;
|
||||
example = "Droid Sans Mono 14";
|
||||
description = "Font to use.";
|
||||
};
|
||||
@@ -188,7 +188,7 @@ in
|
||||
|
||||
terminal = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.string;
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
Path to the terminal which will be used to run console applications
|
||||
'';
|
||||
@@ -280,8 +280,9 @@ in
|
||||
};
|
||||
|
||||
configPath = mkOption {
|
||||
default = ".config/rofi/config";
|
||||
type = types.string;
|
||||
default = "${config.xdg.configHome}/rofi/config";
|
||||
defaultText = "$XDG_CONFIG_HOME/rofi/config";
|
||||
type = types.str;
|
||||
description = "Path where to put generated configuration file.";
|
||||
};
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ let
|
||||
|
||||
yn = flag: if flag then "yes" else "no";
|
||||
|
||||
unwords = builtins.concatStringsSep " ";
|
||||
|
||||
matchBlockModule = types.submodule ({ name, ... }: {
|
||||
options = {
|
||||
host = mkOption {
|
||||
@@ -24,6 +26,15 @@ let
|
||||
description = "Specifies port number to connect on remote host.";
|
||||
};
|
||||
|
||||
forwardAgent = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.bool;
|
||||
description = ''
|
||||
Whether the connection to the authentication agent (if any)
|
||||
will be forwarded to the remote machine.
|
||||
'';
|
||||
};
|
||||
|
||||
forwardX11 = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
@@ -55,10 +66,15 @@ let
|
||||
};
|
||||
|
||||
identityFile = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
type = with types; either (listOf str) (nullOr str);
|
||||
default = [];
|
||||
apply = p:
|
||||
if p == null then []
|
||||
else if isString p then [p]
|
||||
else p;
|
||||
description = ''
|
||||
Specifies a file from which the user identity is read.
|
||||
Specifies files from which the user identity is read.
|
||||
Identities will be tried in the given order.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -81,6 +97,15 @@ let
|
||||
"Set timeout in seconds after which response will be requested.";
|
||||
};
|
||||
|
||||
sendEnv = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
description = ''
|
||||
Environment variables to send from the local host to the
|
||||
server.
|
||||
'';
|
||||
};
|
||||
|
||||
compression = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
@@ -105,6 +130,28 @@ let
|
||||
description = "The command to use to connect to the server.";
|
||||
};
|
||||
|
||||
proxyJump = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "The proxy host to use to connect to the server.";
|
||||
};
|
||||
|
||||
certificateFile = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
description = ''
|
||||
Specifies a file from which the user certificate is read.
|
||||
'';
|
||||
};
|
||||
|
||||
addressFamily = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.enum ["any" "inet" "inet6"]);
|
||||
description = ''
|
||||
Specifies which address family to use when connecting.
|
||||
'';
|
||||
};
|
||||
|
||||
extraOptions = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
@@ -117,18 +164,23 @@ let
|
||||
|
||||
matchBlockStr = cf: concatStringsSep "\n" (
|
||||
["Host ${cf.host}"]
|
||||
++ optional (cf.port != null) " Port ${toString cf.port}"
|
||||
++ optional cf.forwardX11 " ForwardX11 yes"
|
||||
++ optional cf.forwardX11Trusted " ForwardX11Trusted yes"
|
||||
++ optional cf.identitiesOnly " IdentitiesOnly yes"
|
||||
++ optional (cf.user != null) " User ${cf.user}"
|
||||
++ optional (cf.identityFile != null) " IdentityFile ${cf.identityFile}"
|
||||
++ optional (cf.hostname != null) " HostName ${cf.hostname}"
|
||||
++ optional (cf.port != null) " Port ${toString cf.port}"
|
||||
++ optional (cf.forwardAgent != null) " ForwardAgent ${yn cf.forwardAgent}"
|
||||
++ optional cf.forwardX11 " ForwardX11 yes"
|
||||
++ optional cf.forwardX11Trusted " ForwardX11Trusted yes"
|
||||
++ optional cf.identitiesOnly " IdentitiesOnly yes"
|
||||
++ optional (cf.user != null) " User ${cf.user}"
|
||||
++ optional (cf.certificateFile != null) " CertificateFile ${cf.certificateFile}"
|
||||
++ optional (cf.hostname != null) " HostName ${cf.hostname}"
|
||||
++ optional (cf.addressFamily != null) " AddressFamily ${cf.addressFamily}"
|
||||
++ optional (cf.sendEnv != []) " SendEnv ${unwords cf.sendEnv}"
|
||||
++ optional (cf.serverAliveInterval != 0)
|
||||
" ServerAliveInterval ${toString cf.serverAliveInterval}"
|
||||
++ optional (cf.compression != null) " Compression ${yn cf.compression}"
|
||||
++ optional (!cf.checkHostIP) " CheckHostIP no"
|
||||
++ optional (cf.proxyCommand != null) " ProxyCommand ${cf.proxyCommand}"
|
||||
++ optional (cf.compression != null) " Compression ${yn cf.compression}"
|
||||
++ optional (!cf.checkHostIP) " CheckHostIP no"
|
||||
++ optional (cf.proxyCommand != null) " ProxyCommand ${cf.proxyCommand}"
|
||||
++ optional (cf.proxyJump != null) " ProxyJump ${cf.proxyJump}"
|
||||
++ map (file: " IdentityFile ${file}") cf.identityFile
|
||||
++ mapAttrsToList (n: v: " ${n} ${v}") cf.extraOptions
|
||||
);
|
||||
|
||||
@@ -144,8 +196,8 @@ in
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether connection to authentication agent (if any) will be forwarded
|
||||
to remote machine.
|
||||
Whether the connection to the authentication agent (if any)
|
||||
will be forwarded to the remote machine.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -197,7 +249,7 @@ in
|
||||
|
||||
controlPath = mkOption {
|
||||
type = types.str;
|
||||
default = "~/.ssh/master-%r@%h:%p";
|
||||
default = "~/.ssh/master-%r@%n:%p";
|
||||
description = ''
|
||||
Specify path to the control socket used for connection sharing.
|
||||
'';
|
||||
|
||||
112
modules/programs/taskwarrior.nix
Normal file
112
modules/programs/taskwarrior.nix
Normal file
@@ -0,0 +1,112 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.taskwarrior;
|
||||
|
||||
themePath = theme: "${pkgs.taskwarrior}/share/doc/task/rc/${theme}.theme";
|
||||
|
||||
includeTheme = location:
|
||||
if location == null then ""
|
||||
else if isString location then "include ${themePath location}"
|
||||
else "include ${location}";
|
||||
|
||||
formatValue = value:
|
||||
if isBool value then if value then "true" else "false"
|
||||
else if isList value then concatMapStringsSep "," formatValue value
|
||||
else toString value;
|
||||
|
||||
formatLine = key: value:
|
||||
"${key}=${formatValue value}";
|
||||
|
||||
formatSet = key: values:
|
||||
(concatStringsSep "\n"
|
||||
(mapAttrsToList
|
||||
(subKey: subValue: formatPair "${key}.${subKey}" subValue)
|
||||
values));
|
||||
|
||||
formatPair = key: value:
|
||||
if isAttrs value then formatSet key value
|
||||
else formatLine key value;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
options = {
|
||||
programs.taskwarrior = {
|
||||
enable = mkEnableOption "Task Warrior";
|
||||
|
||||
config = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
example = literalExample ''
|
||||
{
|
||||
confirmation = false;
|
||||
report.minimal.filter = "status:pending";
|
||||
report.active.columns = [ "id" "start" "entry.age" "priority" "project" "due" "description" ];
|
||||
report.active.labels = [ "ID" "Started" "Age" "Priority" "Project" "Due" "Description" ];
|
||||
taskd = {
|
||||
certificate = "/path/to/cert";
|
||||
key = "/path/to/key";
|
||||
ca = "/path/to/ca";
|
||||
server = "host.domain:53589";
|
||||
credentials = "Org/First Last/cf31f287-ee9e-43a8-843e-e8bbd5de4294";
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Key-value configuration written to
|
||||
<filename>~/.taskrc</filename>.
|
||||
'';
|
||||
};
|
||||
|
||||
dataLocation = mkOption {
|
||||
type = types.str;
|
||||
default = "${config.xdg.dataHome}/task";
|
||||
defaultText = "$XDG_DATA_HOME/task";
|
||||
description = ''
|
||||
Location where Task Warrior will store its data.
|
||||
</para><para>
|
||||
Home Manager will attempt to create this directory.
|
||||
'';
|
||||
};
|
||||
|
||||
colorTheme = mkOption {
|
||||
type = with types; nullOr (either str path);
|
||||
default = null;
|
||||
example = "dark-blue-256";
|
||||
description = ''
|
||||
Either one of the default provided theme as string, or a
|
||||
path to a theme configuration file.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Additional content written at the end of
|
||||
<filename>~/.taskrc</filename>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.taskwarrior ];
|
||||
|
||||
home.file."${cfg.dataLocation}/.keep".text = "";
|
||||
|
||||
home.file.".taskrc".text = ''
|
||||
data.location=${cfg.dataLocation}
|
||||
${includeTheme cfg.colorTheme}
|
||||
|
||||
${concatStringsSep "\n" (
|
||||
mapAttrsToList formatPair cfg.config)}
|
||||
|
||||
${cfg.extraConfig}
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -6,6 +6,13 @@ let
|
||||
|
||||
cfg = config.programs.termite;
|
||||
|
||||
vteInitStr = ''
|
||||
# See https://github.com/thestinger/termite#id1
|
||||
if [[ $TERM == xterm-termite ]]; then
|
||||
. ${pkgs.gnome3.vte-ng}/etc/profile.d/vte.sh
|
||||
fi
|
||||
'';
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
@@ -363,6 +370,9 @@ in
|
||||
|
||||
${cfg.hintsExtra}
|
||||
'';
|
||||
|
||||
programs.bash.initExtra = vteInitStr;
|
||||
programs.zsh.initExtra = vteInitStr;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ let
|
||||
|
||||
cfg = config.programs.texlive;
|
||||
|
||||
texlivePkgs = cfg.extraPackages pkgs.texlive;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
@@ -16,7 +18,8 @@ in
|
||||
enable = mkEnableOption "Texlive";
|
||||
|
||||
extraPackages = mkOption {
|
||||
default = self: {};
|
||||
default = tpkgs: { inherit (tpkgs) collection-basic; };
|
||||
defaultText = "tpkgs: { inherit (tpkgs) collection-basic; }";
|
||||
example = literalExample ''
|
||||
tpkgs: { inherit (tpkgs) collection-fontsrecommended algorithms; }
|
||||
'';
|
||||
@@ -32,8 +35,16 @@ in
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = texlivePkgs != {};
|
||||
message = "Must provide at least one extra package in"
|
||||
+ " 'programs.texlive.extraPackages'.";
|
||||
}
|
||||
];
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
programs.texlive.package =
|
||||
pkgs.texlive.combine (cfg.extraPackages pkgs.texlive);
|
||||
|
||||
programs.texlive.package = pkgs.texlive.combine texlivePkgs;
|
||||
};
|
||||
}
|
||||
|
||||
148
modules/programs/tmux.nix
Normal file
148
modules/programs/tmux.nix
Normal file
@@ -0,0 +1,148 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.tmux;
|
||||
|
||||
pluginName = p: if types.package.check p then p.name else p.plugin.name;
|
||||
|
||||
pluginModule = types.submodule {
|
||||
options = {
|
||||
plugin = mkOption {
|
||||
type = types.package;
|
||||
description = "Path of the configuration file to include.";
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
description = "Additional configuration for the associated plugin.";
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
options = {
|
||||
programs.tmux = {
|
||||
enable = mkEnableOption "tmux";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.tmux;
|
||||
defaultText = "pkgs.tmux";
|
||||
example = literalExample "pkgs.tmux";
|
||||
description = "The tmux package to install";
|
||||
};
|
||||
|
||||
sensibleOnTop = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Run the sensible plugin at the top of the configuration. It
|
||||
is possible to override the sensible settings using the
|
||||
<option>programs.tmux.extraConfig</option> option.
|
||||
'';
|
||||
};
|
||||
|
||||
tmuxp.enable = mkEnableOption "tmuxp";
|
||||
|
||||
tmuxinator.enable = mkEnableOption "tmuxinator";
|
||||
|
||||
plugins = mkOption {
|
||||
type = with types;
|
||||
listOf (either package pluginModule)
|
||||
// { description = "list of plugin packages or submodules"; };
|
||||
description = ''
|
||||
List of tmux plugins to be included at the end of your tmux
|
||||
configuration. The sensible plugin, however, is defaulted to
|
||||
run at the top of your configuration.
|
||||
'';
|
||||
default = [ ];
|
||||
example = literalExample ''
|
||||
with pkgs; [
|
||||
tmuxPlugins.cpu
|
||||
{
|
||||
plugin = tmuxPlugins.resurrect;
|
||||
extraConfig = "set -g @resurrect-strategy-nvim 'session'";
|
||||
}
|
||||
{
|
||||
plugin = tmuxPlugins.continuum;
|
||||
extraConfig = '''
|
||||
set -g @continuum-restore 'on'
|
||||
set -g @continuum-save-interval '60' # minutes
|
||||
''';
|
||||
}
|
||||
]
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Additional configuration to add to
|
||||
<filename>tmux.conf</filename>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (
|
||||
mkMerge [
|
||||
{
|
||||
home.packages = [ cfg.package ]
|
||||
++ optional cfg.tmuxinator.enable pkgs.tmuxinator
|
||||
++ optional cfg.tmuxp.enable pkgs.tmuxp;
|
||||
|
||||
home.file.".tmux.conf".text = cfg.extraConfig;
|
||||
}
|
||||
|
||||
(mkIf cfg.sensibleOnTop {
|
||||
home.file.".tmux.conf".text = mkBefore ''
|
||||
# ============================================= #
|
||||
# Start with defaults from the Sensible plugin #
|
||||
# --------------------------------------------- #
|
||||
run-shell ${pkgs.tmuxPlugins.sensible.rtp}
|
||||
# ============================================= #
|
||||
'';
|
||||
})
|
||||
|
||||
(mkIf (cfg.plugins != []) {
|
||||
assertions = [(
|
||||
let
|
||||
hasBadPluginName = p: !(hasPrefix "tmuxplugin" (pluginName p));
|
||||
badPlugins = filter hasBadPluginName cfg.plugins;
|
||||
in
|
||||
{
|
||||
assertion = badPlugins == [];
|
||||
message =
|
||||
"Invalid tmux plugin (not prefixed with \"tmuxplugins\"): "
|
||||
+ concatMapStringsSep ", " pluginName badPlugins;
|
||||
}
|
||||
)];
|
||||
|
||||
home.file.".tmux.conf".text = mkAfter ''
|
||||
# ============================================= #
|
||||
# Load plugins with Home Manager #
|
||||
# --------------------------------------------- #
|
||||
|
||||
${(concatMapStringsSep "\n\n" (p: ''
|
||||
# ${pluginName p}
|
||||
# ---------------------
|
||||
${p.extraConfig or ""}
|
||||
run-shell ${
|
||||
if types.package.check p
|
||||
then p.rtp
|
||||
else p.plugin.rtp
|
||||
}
|
||||
'') cfg.plugins)}
|
||||
# ============================================= #
|
||||
'';
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
||||
156
modules/programs/urxvt.nix
Normal file
156
modules/programs/urxvt.nix
Normal file
@@ -0,0 +1,156 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.urxvt;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
options.programs.urxvt = {
|
||||
enable = mkEnableOption "rxvt-unicode terminal emulator";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.rxvt_unicode;
|
||||
defaultText = "pkgs.rxvt_unicode";
|
||||
description = "rxvt-unicode package to install.";
|
||||
};
|
||||
|
||||
fonts = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
description = "List of fonts to be used.";
|
||||
example = [ "xft:Droid Sans Mono Nerd Font:size=9" ];
|
||||
};
|
||||
|
||||
keybindings = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
description = "Mapping of keybindings to actions";
|
||||
example = literalExample ''
|
||||
{
|
||||
"Shift-Control-C" = "eval:selection_to_clipboard";
|
||||
"Shift-Control-V" = "eval:paste_clipboard";
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
iso14755 = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "ISO14755 support for viewing and entering unicode characters.";
|
||||
};
|
||||
|
||||
scroll = {
|
||||
bar = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether to enable the scrollbar";
|
||||
};
|
||||
|
||||
style = mkOption {
|
||||
type = types.enum [ "rxvt" "plain" "next" "xterm" ];
|
||||
default = "plain";
|
||||
description = "Scrollbar style.";
|
||||
};
|
||||
|
||||
align = mkOption {
|
||||
type = types.enum [ "top" "bottom" "center" ];
|
||||
default = "center";
|
||||
description = "Scrollbar alignment.";
|
||||
};
|
||||
|
||||
position = mkOption {
|
||||
type = types.enum [ "left" "right" ];
|
||||
default = "right";
|
||||
description = "Scrollbar position.";
|
||||
};
|
||||
|
||||
floating = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether to display an rxvt scrollbar without a trough.";
|
||||
};
|
||||
};
|
||||
};
|
||||
default = {};
|
||||
description = "Scrollbar settings.";
|
||||
};
|
||||
|
||||
lines = mkOption {
|
||||
type = types.ints.unsigned;
|
||||
default = 10000;
|
||||
description = "Number of lines to save in the scrollback buffer.";
|
||||
};
|
||||
|
||||
keepPosition = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether to keep a scroll position when TTY receives new lines.";
|
||||
};
|
||||
|
||||
scrollOnKeystroke = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether to scroll to bottom on keyboard input.";
|
||||
};
|
||||
|
||||
scrollOnOutput = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whether to scroll to bottom on TTY output.";
|
||||
};
|
||||
};
|
||||
|
||||
transparent = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whether to enable pseudo-transparency.";
|
||||
};
|
||||
|
||||
shading = mkOption {
|
||||
type = types.ints.between 0 200;
|
||||
default = 100;
|
||||
description = "Darken (0 .. 99) or lighten (101 .. 200) the transparent background.";
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
default = {};
|
||||
type = types.attrs;
|
||||
description = "Additional configuration to add.";
|
||||
example = { "shading" = 15; };
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xresources.properties = {
|
||||
"URxvt.scrollBar" = cfg.scroll.bar.enable;
|
||||
"URxvt.scrollstyle" = cfg.scroll.bar.style;
|
||||
"URxvt.scrollBar_align" = cfg.scroll.bar.align;
|
||||
"URxvt.scrollBar_right" = cfg.scroll.bar.position == "right";
|
||||
"URxvt.scrollBar_floating" = cfg.scroll.bar.floating;
|
||||
"URxvt.saveLines" = cfg.scroll.lines;
|
||||
"URxvt.scrollWithBuffer" = cfg.scroll.keepPosition;
|
||||
"URxvt.scrollTtyKeypress" = cfg.scroll.scrollOnKeystroke;
|
||||
"URxvt.scrollTtyOutput" = cfg.scroll.scrollOnOutput;
|
||||
"URxvt.transparent" = cfg.transparent;
|
||||
"URxvt.shading" = cfg.shading;
|
||||
"URxvt.iso14755" = cfg.iso14755;
|
||||
} // flip mapAttrs' cfg.keybindings (kb: action:
|
||||
nameValuePair "URxvt.keysym.${kb}" action
|
||||
) // optionalAttrs (cfg.fonts != []) {
|
||||
"URxvt.font" = concatStringsSep "," cfg.fonts;
|
||||
} // flip mapAttrs' cfg.extraConfig (k: v:
|
||||
nameValuePair "URxvt.${k}" v
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -9,17 +9,25 @@ let
|
||||
|
||||
knownSettings = {
|
||||
background = types.enum [ "dark" "light" ];
|
||||
backupdir = types.listOf types.str;
|
||||
copyindent = types.bool;
|
||||
directory = types.listOf types.str;
|
||||
expandtab = types.bool;
|
||||
hidden = types.bool;
|
||||
history = types.int;
|
||||
ignorecase = types.bool;
|
||||
modeline = types.bool;
|
||||
mouse = types.enum [ "n" "v" "i" "c" "h" "a" "r" ];
|
||||
mousefocus = types.bool;
|
||||
mousehide = types.bool;
|
||||
mousemodel = types.enum [ "extend" "popup" "popup_setpos" ];
|
||||
number = types.bool;
|
||||
relativenumber = types.bool;
|
||||
shiftwidth = types.int;
|
||||
smartcase = types.bool;
|
||||
tabstop = types.int;
|
||||
undodir = types.listOf types.str;
|
||||
undofile = types.bool;
|
||||
};
|
||||
|
||||
vimSettingsType = types.submodule {
|
||||
@@ -38,7 +46,12 @@ let
|
||||
let
|
||||
v =
|
||||
if isBool value then (if value then "" else "no") + name
|
||||
else name + "=" + toString value;
|
||||
else
|
||||
"${name}=${
|
||||
if isList value
|
||||
then concatStringsSep "," value
|
||||
else toString value
|
||||
}";
|
||||
in
|
||||
optionalString (value != null) ("set " + v);
|
||||
|
||||
@@ -49,34 +62,13 @@ in
|
||||
programs.vim = {
|
||||
enable = mkEnableOption "Vim";
|
||||
|
||||
lineNumbers = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
description = ''
|
||||
Whether to show line numbers. DEPRECATED: Use
|
||||
<varname>programs.vim.settings.number</varname>.
|
||||
'';
|
||||
};
|
||||
|
||||
tabSize = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
example = 4;
|
||||
description = ''
|
||||
Set tab size and shift width to a specified number of
|
||||
spaces. DEPRECATED: Use
|
||||
<varname>programs.vim.settings.tabstop</varname> and
|
||||
<varname>programs.vim.settings.shiftwidth</varname>.
|
||||
'';
|
||||
};
|
||||
|
||||
plugins = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = defaultPlugins;
|
||||
example = [ "YankRing" ];
|
||||
description = ''
|
||||
List of vim plugins to install. For supported plugins see:
|
||||
<link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/misc/vim-plugins/vim-plugin-names"/>.
|
||||
List of vim plugins to install. To get a list of supported plugins run:
|
||||
<command>nix-env -f '<nixpkgs>' -qaP -A vimPlugins</command>.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -150,31 +142,9 @@ in
|
||||
];
|
||||
};
|
||||
|
||||
in mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
programs.vim.package = vim;
|
||||
home.packages = [ cfg.package ];
|
||||
}
|
||||
|
||||
(mkIf (cfg.lineNumbers != null) {
|
||||
warnings = [
|
||||
("'programs.vim.lineNumbers' is deprecated, "
|
||||
+ "use 'programs.vim.settings.number'")
|
||||
];
|
||||
|
||||
programs.vim.settings.number = cfg.lineNumbers;
|
||||
})
|
||||
|
||||
(mkIf (cfg.tabSize != null) {
|
||||
warnings = [
|
||||
("'programs.vim.tabSize' is deprecated, use "
|
||||
+ "'programs.vim.settings.tabstop' and "
|
||||
+ "'programs.vim.settings.shiftwidth'")
|
||||
];
|
||||
|
||||
programs.vim.settings.tabstop = cfg.tabSize;
|
||||
programs.vim.settings.shiftwidth = cfg.tabSize;
|
||||
})
|
||||
])
|
||||
in mkIf cfg.enable {
|
||||
programs.vim.package = vim;
|
||||
home.packages = [ cfg.package ];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
52
modules/programs/vscode.nix
Normal file
52
modules/programs/vscode.nix
Normal file
@@ -0,0 +1,52 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.vscode;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
options = {
|
||||
programs.vscode = {
|
||||
enable = mkEnableOption "Visual Studio Code";
|
||||
|
||||
userSettings = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
example = literalExample ''
|
||||
{
|
||||
"update.channel" = "none";
|
||||
"[nix]"."editor.tabSize" = 2;
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Configuration written to
|
||||
<filename>~/.config/Code/User/settings.json</filename>.
|
||||
'';
|
||||
};
|
||||
|
||||
extensions = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = [];
|
||||
description = ''
|
||||
The extensions Visual Studio Code should be started with.
|
||||
These will override but not delete manually installed ones.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [
|
||||
(pkgs.vscode-with-extensions.override {
|
||||
vscodeExtensions = cfg.extensions;
|
||||
})
|
||||
];
|
||||
|
||||
xdg.configFile."Code/User/settings.json".text =
|
||||
builtins.toJSON cfg.userSettings;
|
||||
};
|
||||
}
|
||||
61
modules/programs/zathura.nix
Normal file
61
modules/programs/zathura.nix
Normal file
@@ -0,0 +1,61 @@
|
||||
{ config, lib, pkgs, ...}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.zathura;
|
||||
|
||||
formatLine = n: v:
|
||||
let
|
||||
formatValue = v:
|
||||
if isBool v then (if v then "true" else "false")
|
||||
else toString v;
|
||||
in
|
||||
"set ${n}\t\"${formatValue v}\"";
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
meta.maintainers = [ maintainers.rprospero ];
|
||||
|
||||
options.programs.zathura = {
|
||||
enable = mkEnableOption ''
|
||||
Zathura, a highly customizable and functional document viewer
|
||||
focused on keyboard interaction'';
|
||||
|
||||
options = mkOption {
|
||||
default = {};
|
||||
type = with types; attrsOf (either str (either bool int));
|
||||
description = ''
|
||||
Add <option>:set</option> command options to zathura and make
|
||||
them permanent. See
|
||||
<citerefentry>
|
||||
<refentrytitle>zathurarc</refentrytitle>
|
||||
<manvolnum>5</manvolnum>
|
||||
</citerefentry>
|
||||
for the full list of options.
|
||||
'';
|
||||
example = { default-bg = "#000000"; default-fg = "#FFFFFF"; };
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Additional commands for zathura that will be added to the
|
||||
<filename>zathurarc</filename> file.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.zathura ];
|
||||
|
||||
xdg.configFile."zathura/zathurarc".text =
|
||||
concatStringsSep "\n" ([]
|
||||
++ optional (cfg.extraConfig != "") cfg.extraConfig
|
||||
++ mapAttrsToList formatLine cfg.options
|
||||
) + "\n";
|
||||
};
|
||||
}
|
||||
@@ -11,14 +11,21 @@ let
|
||||
pluginsDir = if cfg.dotDir != null then
|
||||
relToDotDir "plugins" else ".zsh/plugins";
|
||||
|
||||
envVarsStr = config.lib.shell.exportAll cfg.sessionVariables;
|
||||
envVarsStr = config.lib.zsh.exportAll cfg.sessionVariables;
|
||||
localVarsStr = config.lib.zsh.defineAll cfg.localVariables;
|
||||
|
||||
aliasesStr = concatStringsSep "\n" (
|
||||
mapAttrsToList (k: v: "alias ${k}='${v}'") cfg.shellAliases
|
||||
mapAttrsToList (k: v: "alias ${k}=${lib.escapeShellArg v}") cfg.shellAliases
|
||||
);
|
||||
|
||||
zdotdir = "$HOME/" + cfg.dotDir;
|
||||
|
||||
bindkeyCommands = {
|
||||
emacs = "bindkey -e";
|
||||
viins = "bindkey -v";
|
||||
vicmd = "bindkey -a";
|
||||
};
|
||||
|
||||
historyModule = types.submodule ({ config, ... }: {
|
||||
options = {
|
||||
size = mkOption {
|
||||
@@ -167,7 +174,7 @@ in
|
||||
default = true;
|
||||
description = ''
|
||||
Enable zsh completion. Don't forget to add
|
||||
<programlisting>
|
||||
<programlisting language="nix">
|
||||
environment.pathsToLink = [ "/share/zsh" ];
|
||||
</programlisting>
|
||||
to your system configuration to get completion for system packages (e.g. systemd).
|
||||
@@ -186,6 +193,13 @@ in
|
||||
description = "Options related to commands history configuration.";
|
||||
};
|
||||
|
||||
defaultKeymap = mkOption {
|
||||
type = types.nullOr (types.enum (attrNames bindkeyCommands));
|
||||
default = null;
|
||||
example = "emacs";
|
||||
description = "The default base keymap to use.";
|
||||
};
|
||||
|
||||
sessionVariables = mkOption {
|
||||
default = {};
|
||||
type = types.attrs;
|
||||
@@ -252,6 +266,15 @@ in
|
||||
default = {};
|
||||
description = "Options to configure oh-my-zsh.";
|
||||
};
|
||||
|
||||
localVariables = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
example = { POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=["dir" "vcs"]; };
|
||||
description = ''
|
||||
Extra local variables defined at the top of <filename>.zshrc</filename>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -303,6 +326,13 @@ in
|
||||
|
||||
HELPDIR="${pkgs.zsh}/share/zsh/$ZSH_VERSION/help"
|
||||
|
||||
${optionalString (cfg.defaultKeymap != null) ''
|
||||
# Use ${cfg.defaultKeymap} keymap as the default.
|
||||
${getAttr cfg.defaultKeymap bindkeyCommands}
|
||||
''}
|
||||
|
||||
${localVarsStr}
|
||||
|
||||
${concatStrings (map (plugin: ''
|
||||
path+="$HOME/${pluginsDir}/${plugin.name}"
|
||||
fpath+="$HOME/${pluginsDir}/${plugin.name}"
|
||||
|
||||
@@ -24,13 +24,14 @@ let
|
||||
shadow-offset-y = ${toString (elemAt cfg.shadowOffsets 1)};
|
||||
shadow-opacity = ${cfg.shadowOpacity};
|
||||
shadow-exclude = ${toJSON cfg.shadowExclude};
|
||||
no-dock-shadow = ${toJSON cfg.noDockShadow};
|
||||
no-dnd-shadow = ${toJSON cfg.noDNDShadow};
|
||||
'' +
|
||||
optionalString cfg.blur ''
|
||||
|
||||
# blur
|
||||
blur-background = true;
|
||||
blur-background-exclude = ${toJSON cfg.blurExclude};
|
||||
no-dock-blur = ${toJSON cfg.noDockBlur};
|
||||
'' + ''
|
||||
|
||||
# opacity
|
||||
@@ -58,14 +59,6 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
noDockBlur = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Avoid blur on docks.
|
||||
'';
|
||||
};
|
||||
|
||||
blurExclude = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
@@ -174,6 +167,22 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
noDockShadow = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Avoid shadow on docks.
|
||||
'';
|
||||
};
|
||||
|
||||
noDNDShadow = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Avoid shadow on drag-and-drop windows.
|
||||
'';
|
||||
};
|
||||
|
||||
activeOpacity = mkOption {
|
||||
type = types.str;
|
||||
default = "1.0";
|
||||
@@ -275,25 +284,28 @@ in {
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
systemd.user.services.compton = {
|
||||
Unit = {
|
||||
Description = "Compton X11 compositor";
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
Unit = {
|
||||
Description = "Compton X11 compositor";
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
ExecStart = "${cfg.package}/bin/compton --config ${configFile}";
|
||||
Restart = "always";
|
||||
RestartSec = 3;
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${cfg.package}/bin/compton --config ${configFile}";
|
||||
Restart = "always";
|
||||
RestartSec = 3;
|
||||
}
|
||||
// optionalAttrs (cfg.backend == "glx") {
|
||||
# Temporarily fixes corrupt colours with Mesa 18.
|
||||
Environment = [ "allow_rgb10_configs=false" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ with lib;
|
||||
let
|
||||
|
||||
cfg = config.services.dunst;
|
||||
|
||||
eitherStrBoolIntList = with types; either str (either bool (either int (listOf str)));
|
||||
|
||||
toDunstIni = generators.toINI {
|
||||
mkKeyValue = key: value:
|
||||
let
|
||||
@@ -61,7 +64,7 @@ in
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = types.attrsOf types.attrs;
|
||||
type = with types; attrsOf (attrsOf eitherStrBoolIntList);
|
||||
default = {};
|
||||
description = "Configuration written to ~/.config/dunstrc";
|
||||
example = literalExample ''
|
||||
@@ -90,7 +93,7 @@ in
|
||||
xdg.dataFile."dbus-1/services/org.knopwob.dunst.service".source =
|
||||
"${pkgs.dunst}/share/dbus-1/services/org.knopwob.dunst.service";
|
||||
|
||||
services.dunst.settings.global.icon_folders =
|
||||
services.dunst.settings.global.icon_path =
|
||||
let
|
||||
useCustomTheme =
|
||||
cfg.iconTheme.package != hicolorTheme.package
|
||||
@@ -152,7 +155,17 @@ in
|
||||
}
|
||||
|
||||
(mkIf (cfg.settings != {}) {
|
||||
xdg.configFile."dunst/dunstrc".text = toDunstIni cfg.settings;
|
||||
xdg.configFile."dunst/dunstrc" = {
|
||||
text = toDunstIni cfg.settings;
|
||||
onChange = ''
|
||||
pkillVerbose=""
|
||||
if [[ -v VERBOSE ]]; then
|
||||
pkillVerbose="-e"
|
||||
fi
|
||||
$DRY_RUN_CMD ${pkgs.procps}/bin/pkill -u $USER $pkillVerbose dunst || true
|
||||
unset pkillVerbose
|
||||
'';
|
||||
};
|
||||
})
|
||||
]
|
||||
);
|
||||
|
||||
44
modules/services/emacs.nix
Normal file
44
modules/services/emacs.nix
Normal file
@@ -0,0 +1,44 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.services.emacs;
|
||||
emacsCfg = config.programs.emacs;
|
||||
emacsBinPath = "${emacsCfg.finalPackage}/bin";
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
options.services.emacs = {
|
||||
enable = mkEnableOption "the Emacs daemon";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = emacsCfg.enable;
|
||||
message = "The Emacs service module requires"
|
||||
+ " 'programs.emacs.enable = true'.";
|
||||
}
|
||||
];
|
||||
|
||||
systemd.user.services.emacs = {
|
||||
Unit = {
|
||||
Description = "Emacs: the extensible, self-documenting text editor";
|
||||
Documentation = "info:emacs man:emacs(1) https://gnu.org/software/emacs/";
|
||||
};
|
||||
|
||||
Service = {
|
||||
ExecStart = "${pkgs.stdenv.shell} -l -c 'exec ${emacsBinPath}/emacs --fg-daemon'";
|
||||
ExecStop = "${emacsBinPath}/emacsclient --eval '(kill-emacs)'";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ "default.target" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -24,7 +24,12 @@ in
|
||||
systemd.user.services.flameshot = {
|
||||
Unit = {
|
||||
Description = "Powerful yet simple to use screenshot software";
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
After = [
|
||||
"graphical-session-pre.target"
|
||||
"polybar.service"
|
||||
"stalonetray.service"
|
||||
"taffybar.service"
|
||||
];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ in
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.keybase ];
|
||||
|
||||
systemd.user.services.keybase = {
|
||||
Unit = {
|
||||
Description = "Keybase service";
|
||||
|
||||
@@ -87,7 +87,7 @@ in
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "simple";
|
||||
Type = "oneshot";
|
||||
ExecStart = "${cfg.package}/bin/mbsync ${concatStringsSep " " mbsyncOptions}";
|
||||
} // (optionalAttrs (cfg.postExec != null) { ExecStartPost = cfg.postExec; })
|
||||
// (optionalAttrs (cfg.preExec != null) { ExecStartPre = cfg.preExec; });
|
||||
|
||||
30
modules/services/nextcloud-client.nix
Normal file
30
modules/services/nextcloud-client.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options = {
|
||||
services.nextcloud-client = {
|
||||
enable = mkEnableOption "Nextcloud Client";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf config.services.nextcloud-client.enable {
|
||||
systemd.user.services.nextcloud-client = {
|
||||
Unit = {
|
||||
Description = "Nextcloud Client";
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Environment = "PATH=${config.home.profileDirectory}/bin";
|
||||
ExecStart = "${pkgs.nextcloud-client}/bin/nextcloud";
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -24,6 +24,11 @@ with lib;
|
||||
};
|
||||
|
||||
Service = {
|
||||
Environment =
|
||||
let
|
||||
toolPaths = makeBinPath [ pkgs.paprefs pkgs.pavucontrol ];
|
||||
in
|
||||
[ "PATH=${toolPaths}" ];
|
||||
ExecStart = "${pkgs.pasystray}/bin/pasystray";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ let
|
||||
|
||||
cfg = config.services.polybar;
|
||||
|
||||
dag = config.lib.dag;
|
||||
eitherStrBoolIntList = with types; either str (either bool (either int (listOf str)));
|
||||
|
||||
toPolybarIni = generators.toINI {
|
||||
mkKeyValue = key: value:
|
||||
@@ -27,12 +27,6 @@ let
|
||||
configFile = pkgs.writeText "polybar.conf"
|
||||
(toPolybarIni cfg.config + "\n" + cfg.extraConfig);
|
||||
|
||||
script = ''
|
||||
#!${pkgs.stdenv.shell}
|
||||
|
||||
${cfg.script}
|
||||
'';
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
@@ -59,9 +53,9 @@ in
|
||||
type = types.coercedTo
|
||||
types.path
|
||||
(p: { "section/base" = { include-file = "${p}"; }; })
|
||||
(types.attrsOf types.attrs);
|
||||
(types.attrsOf (types.attrsOf eitherStrBoolIntList));
|
||||
description = ''
|
||||
Polybar configuration. Can be either path to a file, or set of attibutes
|
||||
Polybar configuration. Can be either path to a file, or set of attributes
|
||||
that will be used to create the final configuration.
|
||||
'';
|
||||
default = {};
|
||||
@@ -129,8 +123,12 @@ in
|
||||
|
||||
Service = {
|
||||
Type = "forking";
|
||||
Environment = "PATH=${cfg.package}/bin";
|
||||
ExecStart = ''${pkgs.writeScriptBin "polybar-start" script}/bin/polybar-start'';
|
||||
Environment = "PATH=${cfg.package}/bin:/run/wrappers/bin";
|
||||
ExecStart =
|
||||
let
|
||||
scriptPkg = pkgs.writeShellScriptBin "polybar-start" cfg.script;
|
||||
in
|
||||
"${scriptPkg}/bin/polybar-start";
|
||||
};
|
||||
|
||||
Install = {
|
||||
|
||||
@@ -17,22 +17,22 @@ in
|
||||
|
||||
imageDirectory = mkOption {
|
||||
type = types.str;
|
||||
description =
|
||||
''
|
||||
The directory of images from which a background should be
|
||||
chosen. Should be formatted in a way understood by
|
||||
systemd, e.g., '%h' is the home directory.
|
||||
'';
|
||||
example = "%h/backgrounds";
|
||||
description = ''
|
||||
The directory of images from which a background should be
|
||||
chosen. Should be formatted in a way understood by systemd,
|
||||
e.g., '%h' is the home directory.
|
||||
'';
|
||||
};
|
||||
|
||||
interval = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.str;
|
||||
example = "1h";
|
||||
description = ''
|
||||
The duration between changing background image, set to null
|
||||
to only set background when logging in.
|
||||
|
||||
Should be formatted as a duration understood by systemd.
|
||||
to only set background when logging in. Should be formatted
|
||||
as a duration understood by systemd.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
@@ -27,19 +27,20 @@ in
|
||||
|
||||
config = mkIf config.services.taffybar.enable {
|
||||
systemd.user.services.taffybar = {
|
||||
Unit = {
|
||||
Description = "Taffybar desktop bar";
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
Unit = {
|
||||
Description = "Taffybar desktop bar";
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
ExecStart = "${cfg.package}/bin/taffybar";
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${cfg.package}/bin/taffybar";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,11 +6,9 @@ let
|
||||
|
||||
cfg = config.xsession.windowManager.i3;
|
||||
|
||||
dag = config.lib.dag;
|
||||
|
||||
commonOptions = {
|
||||
fonts = mkOption {
|
||||
type = types.listOf types.string;
|
||||
type = types.listOf types.str;
|
||||
default = ["monospace 8"];
|
||||
description = ''
|
||||
Font list used for window titles. Only FreeType fonts are supported.
|
||||
@@ -23,7 +21,7 @@ let
|
||||
startupModule = types.submodule {
|
||||
options = {
|
||||
command = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
description = "Command that will be executed on startup.";
|
||||
};
|
||||
|
||||
@@ -43,7 +41,7 @@ let
|
||||
};
|
||||
|
||||
workspace = mkOption {
|
||||
type = types.nullOr types.string;
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Launch application on a particular workspace. DEPRECATED:
|
||||
@@ -57,17 +55,17 @@ let
|
||||
barColorSetModule = types.submodule {
|
||||
options = {
|
||||
border = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
visible = false;
|
||||
};
|
||||
|
||||
background = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
visible = false;
|
||||
};
|
||||
|
||||
text = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
visible = false;
|
||||
};
|
||||
};
|
||||
@@ -76,27 +74,27 @@ let
|
||||
colorSetModule = types.submodule {
|
||||
options = {
|
||||
border = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
visible = false;
|
||||
};
|
||||
|
||||
childBorder = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
visible = false;
|
||||
};
|
||||
|
||||
background = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
visible = false;
|
||||
};
|
||||
|
||||
text = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
visible = false;
|
||||
};
|
||||
|
||||
indicator = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
visible = false;
|
||||
};
|
||||
};
|
||||
@@ -106,8 +104,14 @@ let
|
||||
options = {
|
||||
inherit (commonOptions) fonts;
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = "Extra configuration lines for this bar.";
|
||||
};
|
||||
|
||||
id = mkOption {
|
||||
type = types.nullOr types.string;
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Specifies the bar ID for the configured bar instance.
|
||||
@@ -147,7 +151,7 @@ let
|
||||
};
|
||||
|
||||
command = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
default = "${cfg.package}/bin/i3bar";
|
||||
defaultText = "i3bar";
|
||||
description = "Command that will be used to start a bar.";
|
||||
@@ -155,7 +159,7 @@ let
|
||||
};
|
||||
|
||||
statusCommand = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
default = "${pkgs.i3status}/bin/i3status";
|
||||
description = "Command that will be used to get status lines.";
|
||||
};
|
||||
@@ -164,19 +168,19 @@ let
|
||||
type = types.submodule {
|
||||
options = {
|
||||
background = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
default = "#000000";
|
||||
description = "Background color of the bar.";
|
||||
};
|
||||
|
||||
statusline = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
default = "#ffffff";
|
||||
description = "Text color to be used for the statusline.";
|
||||
};
|
||||
|
||||
separator = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
default = "#666666";
|
||||
description = "Text color to be used for the separator.";
|
||||
};
|
||||
@@ -232,13 +236,19 @@ let
|
||||
See <link xlink:href="https://i3wm.org/docs/userguide.html#_colors"/>.
|
||||
'';
|
||||
};
|
||||
|
||||
trayOutput = mkOption {
|
||||
type = types.str;
|
||||
default = "primary";
|
||||
description = "Where to output tray.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
windowCommandModule = types.submodule {
|
||||
options = {
|
||||
command = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
description = "i3wm command to execute.";
|
||||
example = "border pixel 1";
|
||||
};
|
||||
@@ -251,7 +261,7 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
criteriaModule = types.attrs;
|
||||
criteriaModule = types.attrsOf types.str;
|
||||
|
||||
configModule = types.submodule {
|
||||
options = {
|
||||
@@ -378,7 +388,7 @@ let
|
||||
type = types.attrsOf (types.listOf criteriaModule);
|
||||
default = {};
|
||||
description = ''
|
||||
An attribute set that assignes applications to workspaces based
|
||||
An attribute set that assigns applications to workspaces based
|
||||
on criteria.
|
||||
'';
|
||||
example = literalExample ''
|
||||
@@ -396,9 +406,19 @@ let
|
||||
example = "Mod4";
|
||||
};
|
||||
|
||||
workspaceLayout = mkOption {
|
||||
type = types.enum [ "default" "stacked" "tabbed" ];
|
||||
default = "default";
|
||||
example = "tabbed";
|
||||
description = ''
|
||||
The mode in which new containers on workspace level will
|
||||
start.
|
||||
'';
|
||||
};
|
||||
|
||||
keybindings = mkOption {
|
||||
type = types.attrs;
|
||||
default = {
|
||||
type = types.attrsOf (types.nullOr types.str);
|
||||
default = mapAttrs (n: mkOptionDefault) {
|
||||
"${cfg.config.modifier}+Return" = "exec i3-sensible-terminal";
|
||||
"${cfg.config.modifier}+Shift+q" = "kill";
|
||||
"${cfg.config.modifier}+d" = "exec ${pkgs.dmenu}/bin/dmenu_run";
|
||||
@@ -408,6 +428,11 @@ let
|
||||
"${cfg.config.modifier}+Up" = "focus up";
|
||||
"${cfg.config.modifier}+Right" = "focus right";
|
||||
|
||||
"${cfg.config.modifier}+Shift+Left" = "move left";
|
||||
"${cfg.config.modifier}+Shift+Down" = "move down";
|
||||
"${cfg.config.modifier}+Shift+Up" = "move up";
|
||||
"${cfg.config.modifier}+Shift+Right" = "move right";
|
||||
|
||||
"${cfg.config.modifier}+h" = "split h";
|
||||
"${cfg.config.modifier}+v" = "split v";
|
||||
"${cfg.config.modifier}+f" = "fullscreen toggle";
|
||||
@@ -417,6 +442,7 @@ let
|
||||
"${cfg.config.modifier}+e" = "layout toggle split";
|
||||
|
||||
"${cfg.config.modifier}+Shift+space" = "floating toggle";
|
||||
"${cfg.config.modifier}+space" = "focus mode_toggle";
|
||||
|
||||
"${cfg.config.modifier}+1" = "workspace 1";
|
||||
"${cfg.config.modifier}+2" = "workspace 2";
|
||||
@@ -466,10 +492,10 @@ let
|
||||
};
|
||||
|
||||
keycodebindings = mkOption {
|
||||
type = types.attrs;
|
||||
type = types.attrsOf (types.nullOr types.str);
|
||||
default = {};
|
||||
description = ''
|
||||
An attribute set that assignes keypress to an action using key code.
|
||||
An attribute set that assigns keypress to an action using key code.
|
||||
See <link xlink:href="https://i3wm.org/docs/userguide.html#keybindings"/>.
|
||||
'';
|
||||
example = { "214" = "exec --no-startup-id /bin/script.sh"; };
|
||||
@@ -479,7 +505,7 @@ let
|
||||
type = types.submodule {
|
||||
options = {
|
||||
background = mkOption {
|
||||
type = types.string;
|
||||
type = types.str;
|
||||
default = "#ffffff";
|
||||
description = ''
|
||||
Background color of the window. Only applications which do not cover
|
||||
@@ -551,7 +577,7 @@ let
|
||||
};
|
||||
|
||||
modes = mkOption {
|
||||
type = types.attrsOf types.attrs;
|
||||
type = types.attrsOf (types.attrsOf types.str);
|
||||
default = {
|
||||
resize = {
|
||||
"Left" = "resize shrink width 10 px or 10 ppt";
|
||||
@@ -667,7 +693,7 @@ let
|
||||
|
||||
barStr = {
|
||||
id, fonts, mode, hiddenState, position, workspaceButtons,
|
||||
workspaceNumbers, command, statusCommand, colors, ...
|
||||
workspaceNumbers, command, statusCommand, colors, trayOutput, extraConfig, ...
|
||||
}: ''
|
||||
bar {
|
||||
${optionalString (id != null) "id ${id}"}
|
||||
@@ -679,6 +705,7 @@ let
|
||||
i3bar_command ${command}
|
||||
workspace_buttons ${if workspaceButtons then "yes" else "no"}
|
||||
strip_workspace_numbers ${if !workspaceNumbers then "yes" else "no"}
|
||||
tray_output ${trayOutput}
|
||||
colors {
|
||||
background ${colors.background}
|
||||
statusline ${colors.statusline}
|
||||
@@ -689,6 +716,7 @@ let
|
||||
urgent_workspace ${barColorSetStr colors.urgentWorkspace}
|
||||
binding_mode ${barColorSetStr colors.bindingMode}
|
||||
}
|
||||
${extraConfig}
|
||||
}
|
||||
'';
|
||||
|
||||
@@ -723,6 +751,7 @@ let
|
||||
focus_follows_mouse ${if focus.followMouse then "yes" else "no"}
|
||||
focus_on_window_activation ${focus.newWindow}
|
||||
mouse_warping ${if focus.mouseWarping then "output" else "none"}
|
||||
workspace_layout ${workspaceLayout}
|
||||
|
||||
client.focused ${colorSetStr colors.focused}
|
||||
client.focused_inactive ${colorSetStr colors.focusedInactive}
|
||||
|
||||
@@ -6,8 +6,6 @@ let
|
||||
|
||||
cfg = config.xsession.windowManager.xmonad;
|
||||
|
||||
dag = config.lib.dag;
|
||||
|
||||
xmonad = pkgs.xmonad-with-packages.override {
|
||||
ghcWithPackages = cfg.haskellPackages.ghcWithPackages;
|
||||
packages = self:
|
||||
|
||||
49
modules/services/xembed-sni-proxy.nix
Normal file
49
modules/services/xembed-sni-proxy.nix
Normal file
@@ -0,0 +1,49 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.services.xembed-sni-proxy;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
meta.maintainers = [ maintainers.rycee ];
|
||||
|
||||
options = {
|
||||
services.xembed-sni-proxy = {
|
||||
enable = mkEnableOption "XEmbed SNI Proxy";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.plasma-workspace;
|
||||
defaultText = "pkgs.plasma-workspace";
|
||||
description = ''
|
||||
Package containing the <command>xembedsniproxy</command>
|
||||
program.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.user.services.xembed-sni-proxy = {
|
||||
Unit = {
|
||||
Description = "XEmbed SNI Proxy";
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Environment = "PATH=${config.home.profileDirectory}/bin";
|
||||
ExecStart = "${cfg.package}/bin/xembedsniproxy";
|
||||
Restart = "on-abort";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -27,11 +27,17 @@ let
|
||||
buildService = style: name: serviceCfg:
|
||||
let
|
||||
filename = "${name}.${style}";
|
||||
pathSafeName = lib.replaceChars ["@" ":" "\\" "[" "]"]
|
||||
["-" "-" "-" "" "" ]
|
||||
filename;
|
||||
|
||||
# Needed because systemd derives unit names from the ultimate
|
||||
# link target.
|
||||
source = pkgs.writeTextDir filename (toSystemdIni serviceCfg)
|
||||
+ "/" + filename;
|
||||
source = pkgs.writeTextFile {
|
||||
name = pathSafeName;
|
||||
text = toSystemdIni serviceCfg;
|
||||
destination = "/${filename}";
|
||||
} + "/${filename}";
|
||||
|
||||
wantedBy = target:
|
||||
{
|
||||
@@ -55,6 +61,30 @@ let
|
||||
merge = loc: foldl' (res: def: recursiveUpdate res def.value) {};
|
||||
};
|
||||
|
||||
unitDescription = type: ''
|
||||
Definition of systemd per-user ${type} units. Attributes are
|
||||
merged recursively.
|
||||
</para><para>
|
||||
Note that the attributes follow the capitalization and naming used
|
||||
by systemd. More details can be found in
|
||||
<citerefentry>
|
||||
<refentrytitle>systemd.${type}</refentrytitle>
|
||||
<manvolnum>5</manvolnum>
|
||||
</citerefentry>.
|
||||
'';
|
||||
|
||||
unitExample = type: literalExample ''
|
||||
{
|
||||
Unit = {
|
||||
Description = "Example description";
|
||||
};
|
||||
|
||||
${type} = {
|
||||
…
|
||||
};
|
||||
}
|
||||
'';
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
@@ -76,46 +106,36 @@ in
|
||||
services = mkOption {
|
||||
default = {};
|
||||
type = attrsRecursivelyMerged;
|
||||
description = ''
|
||||
Definition of systemd per-user service units. Attributes are
|
||||
merged recursively.
|
||||
'';
|
||||
description = unitDescription "service";
|
||||
example = unitExample "Service";
|
||||
};
|
||||
|
||||
sockets = mkOption {
|
||||
default = {};
|
||||
type = attrsRecursivelyMerged;
|
||||
description = ''
|
||||
Definition of systemd per-user sockets. Attributes are
|
||||
merged recursively.
|
||||
'';
|
||||
description = unitDescription "socket";
|
||||
example = unitExample "Socket";
|
||||
};
|
||||
|
||||
targets = mkOption {
|
||||
default = {};
|
||||
type = attrsRecursivelyMerged;
|
||||
description = ''
|
||||
Definition of systemd per-user targets. Attributes are
|
||||
merged recursively.
|
||||
'';
|
||||
description = unitDescription "target";
|
||||
example = unitExample "Target";
|
||||
};
|
||||
|
||||
timers = mkOption {
|
||||
default = {};
|
||||
type = attrsRecursivelyMerged;
|
||||
description = ''
|
||||
Definition of systemd per-user timers. Attributes are merged
|
||||
recursively.
|
||||
'';
|
||||
description = unitDescription "timer";
|
||||
example = unitExample "Timer";
|
||||
};
|
||||
|
||||
paths = mkOption {
|
||||
default = {};
|
||||
type = attrsRecursivelyMerged;
|
||||
description = ''
|
||||
Definition of systemd per-user path units. Attributes are
|
||||
merged recursively.
|
||||
'';
|
||||
description = unitDescription "path";
|
||||
example = unitExample "Path";
|
||||
};
|
||||
|
||||
startServices = mkOption {
|
||||
|
||||
@@ -69,10 +69,17 @@ in
|
||||
};
|
||||
|
||||
config = mkIf (cfg.properties != null || cfg.extraConfig != "") {
|
||||
home.file.".Xresources".text =
|
||||
concatStringsSep "\n" ([]
|
||||
++ (optional (cfg.extraConfig != "") cfg.extraConfig)
|
||||
++ (optionals (cfg.properties != null) (mapAttrsToList formatLine cfg.properties))
|
||||
) + "\n";
|
||||
home.file.".Xresources" = {
|
||||
text =
|
||||
concatStringsSep "\n" ([]
|
||||
++ optional (cfg.extraConfig != "") cfg.extraConfig
|
||||
++ optionals (cfg.properties != null) (mapAttrsToList formatLine cfg.properties)
|
||||
) + "\n";
|
||||
onChange = ''
|
||||
if [[ -v DISPLAY ]] ; then
|
||||
$DRY_RUN_CMD ${pkgs.xorg.xrdb}/bin/xrdb -merge $HOME/.Xresources
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,6 +15,16 @@ in
|
||||
xsession = {
|
||||
enable = mkEnableOption "X Session";
|
||||
|
||||
scriptPath = mkOption {
|
||||
type = types.str;
|
||||
default = ".xsession";
|
||||
example = ".xsession-hm";
|
||||
description = ''
|
||||
Path, relative <envar>HOME</envar>, where Home Manager
|
||||
should write the X session script.
|
||||
'';
|
||||
};
|
||||
|
||||
windowManager.command = mkOption {
|
||||
type = types.str;
|
||||
example = literalExample ''
|
||||
@@ -56,39 +66,43 @@ in
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.user.services.setxkbmap = {
|
||||
Unit = {
|
||||
Description = "Set up keyboard in X";
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
systemd.user = {
|
||||
services = mkIf (config.home.keyboard != null) {
|
||||
setxkbmap = {
|
||||
Unit = {
|
||||
Description = "Set up keyboard in X";
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart =
|
||||
let
|
||||
args = concatStringsSep " " (
|
||||
[
|
||||
"-layout '${config.home.keyboard.layout}'"
|
||||
"-variant '${config.home.keyboard.variant}'"
|
||||
] ++
|
||||
(map (v: "-option '${v}'") config.home.keyboard.options)
|
||||
);
|
||||
in
|
||||
"${pkgs.xorg.setxkbmap}/bin/setxkbmap ${args}";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart =
|
||||
let
|
||||
args = concatStringsSep " " (
|
||||
[
|
||||
"-layout '${config.home.keyboard.layout}'"
|
||||
"-variant '${config.home.keyboard.variant}'"
|
||||
] ++
|
||||
(map (v: "-option '${v}'") config.home.keyboard.options)
|
||||
);
|
||||
in
|
||||
"${pkgs.xorg.setxkbmap}/bin/setxkbmap ${args}";
|
||||
};
|
||||
};
|
||||
|
||||
# A basic graphical session target for Home Manager.
|
||||
systemd.user.targets.hm-graphical-session = {
|
||||
Unit = {
|
||||
Description = "Home Manager X session";
|
||||
Requires = [ "graphical-session-pre.target" ];
|
||||
BindsTo = [ "graphical-session.target" ];
|
||||
# A basic graphical session target for Home Manager.
|
||||
targets.hm-graphical-session = {
|
||||
Unit = {
|
||||
Description = "Home Manager X session";
|
||||
Requires = [ "graphical-session-pre.target" ];
|
||||
BindsTo = [ "graphical-session.target" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -117,7 +131,7 @@ in
|
||||
export HM_XPROFILE_SOURCED=1
|
||||
'';
|
||||
|
||||
home.file.".xsession" = {
|
||||
home.file.${cfg.scriptPath} = {
|
||||
executable = true;
|
||||
text = ''
|
||||
if [[ ! -v HM_XPROFILE_SOURCED ]]; then
|
||||
|
||||
48
nix-darwin/default.nix
Normal file
48
nix-darwin/default.nix
Normal file
@@ -0,0 +1,48 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.home-manager;
|
||||
|
||||
hmModule = types.submodule ({name, ...}: {
|
||||
imports = import ../modules/modules.nix { inherit lib pkgs; };
|
||||
|
||||
config = {
|
||||
submoduleSupport.enable = true;
|
||||
submoduleSupport.externalPackageInstall = cfg.useUserPackages;
|
||||
|
||||
home.username = config.users.users.${name}.name;
|
||||
home.homeDirectory = config.users.users.${name}.home;
|
||||
};
|
||||
});
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
options = {
|
||||
home-manager = {
|
||||
useUserPackages = mkEnableOption ''
|
||||
installation of user packages through the
|
||||
<option>users.users.<name?>.packages</option> option.
|
||||
'';
|
||||
|
||||
users = mkOption {
|
||||
type = types.attrsOf hmModule;
|
||||
default = {};
|
||||
description = ''
|
||||
Per-user Home Manager configuration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg.users != {}) {
|
||||
system.activationScripts.postActivation.text =
|
||||
concatStringsSep "\n" (mapAttrsToList (username: usercfg: ''
|
||||
echo Activating home-manager configuration for ${username}
|
||||
sudo -u ${username} -i ${usercfg.home.activationPackage}/activate
|
||||
'') cfg.users);
|
||||
};
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user