mirror of
https://github.com/nix-community/home-manager.git
synced 2026-01-11 17:39:37 +08:00
Compare commits
264 Commits
release-20
...
release-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5395026bf | ||
|
|
49706878e1 | ||
|
|
c76b158024 | ||
|
|
2aa20ae969 | ||
|
|
a36c4fe973 | ||
|
|
2cfbf16c6d | ||
|
|
f019c1cf16 | ||
|
|
209566c752 | ||
|
|
91bd34620d | ||
|
|
f33be4894c | ||
|
|
0410410e90 | ||
|
|
392c3da3fe | ||
|
|
2c7a2f8084 | ||
|
|
0a5e0868dc | ||
|
|
5aacf64d0e | ||
|
|
a4f41474b0 | ||
|
|
feb7455112 | ||
|
|
b1e0cbad4b | ||
|
|
22f6736e62 | ||
|
|
57e4bf3707 | ||
|
|
e2f7da3a58 | ||
|
|
b183e7f77e | ||
|
|
63f299b334 | ||
|
|
249e31b656 | ||
|
|
0261950395 | ||
|
|
1066e01707 | ||
|
|
61e63c10dc | ||
|
|
5125fc0a47 | ||
|
|
cabf9ddd98 | ||
|
|
612afee126 | ||
|
|
072a6ea333 | ||
|
|
a98ec6ec15 | ||
|
|
c8746fb588 | ||
|
|
99fbae0ec5 | ||
|
|
b5291e995f | ||
|
|
28eb093a1e | ||
|
|
abaebf3b34 | ||
|
|
9bf1f40af1 | ||
|
|
22a3a5651d | ||
|
|
308ee310de | ||
|
|
0778a80ee0 | ||
|
|
10df7a7eee | ||
|
|
9cf5f764e1 | ||
|
|
014d8deb60 | ||
|
|
1c4ced745c | ||
|
|
731959ef0e | ||
|
|
18429f1d1d | ||
|
|
77913ff17e | ||
|
|
dc5239b5ce | ||
|
|
c5e47e25a6 | ||
|
|
e7d5531cfa | ||
|
|
aecd4acfb4 | ||
|
|
18a05a9604 | ||
|
|
7339784e07 | ||
|
|
0e9b6e6dc9 | ||
|
|
fc5619764e | ||
|
|
57518cd0bf | ||
|
|
b584745506 | ||
|
|
473d9acdad | ||
|
|
8537920706 | ||
|
|
7e5fee4268 | ||
|
|
0006da1381 | ||
|
|
9ff2188c5d | ||
|
|
da6077a899 | ||
|
|
41147ae09a | ||
|
|
6fed10a09a | ||
|
|
f0fc2a8702 | ||
|
|
521a808151 | ||
|
|
abfb4cde51 | ||
|
|
43ab2f40b9 | ||
|
|
690d93c22a | ||
|
|
8a160f01ab | ||
|
|
a6a3abb295 | ||
|
|
84bcce3c25 | ||
|
|
96d7de6db1 | ||
|
|
9b1b55ba02 | ||
|
|
b3498cccb3 | ||
|
|
92c682cd10 | ||
|
|
472ca211ca | ||
|
|
812b64d4d3 | ||
|
|
605a8fc92e | ||
|
|
b819d2cc41 | ||
|
|
1f04af74f2 | ||
|
|
249650a07e | ||
|
|
4ebb7d1715 | ||
|
|
1a6d6b8ace | ||
|
|
f146620897 | ||
|
|
41b1af808f | ||
|
|
182454fe6b | ||
|
|
a063b73d5c | ||
|
|
d3aee544b6 | ||
|
|
bd4c2b0651 | ||
|
|
1f34c048b3 | ||
|
|
bfc66df13d | ||
|
|
1ed8e7ef98 | ||
|
|
e6e49ad73c | ||
|
|
0399839271 | ||
|
|
4b702bf6b7 | ||
|
|
4fe5afa755 | ||
|
|
209fb62d49 | ||
|
|
6cf6b587b5 | ||
|
|
a79d31fcfd | ||
|
|
0869e23700 | ||
|
|
625b92cbba | ||
|
|
9854342b9f | ||
|
|
a3dd580adc | ||
|
|
2bcd96928e | ||
|
|
2c6a023744 | ||
|
|
9a473b693a | ||
|
|
f4f9f1a618 | ||
|
|
2a54c353a9 | ||
|
|
96e2f1bdf0 | ||
|
|
3886f8db33 | ||
|
|
baea46c5ac | ||
|
|
fceef469c2 | ||
|
|
ae8f432a75 | ||
|
|
e1fbb74b41 | ||
|
|
d1f4d1514d | ||
|
|
861690ff29 | ||
|
|
223e3c38a1 | ||
|
|
9c0fe3957b | ||
|
|
152769aed9 | ||
|
|
dbf6b2d2ab | ||
|
|
f119d4d142 | ||
|
|
79a2320fd0 | ||
|
|
bb6eb9b13e | ||
|
|
2e7935767f | ||
|
|
89adfc9f01 | ||
|
|
7b73f84071 | ||
|
|
5cd7865c6c | ||
|
|
3f1be69359 | ||
|
|
83301ca787 | ||
|
|
8ad5580021 | ||
|
|
e2e8b7371d | ||
|
|
4bd0ca2cd7 | ||
|
|
5c639ff68a | ||
|
|
a49ce0e9ed | ||
|
|
1a8ab9d9de | ||
|
|
e0fb488e57 | ||
|
|
05565a0145 | ||
|
|
5f189acce4 | ||
|
|
7dc322c1eb | ||
|
|
8736190743 | ||
|
|
7f7348b470 | ||
|
|
58716b7541 | ||
|
|
600f39f966 | ||
|
|
a94c8b072e | ||
|
|
5a15f3833d | ||
|
|
54b69d2ef8 | ||
|
|
8f2342e13a | ||
|
|
8ab1139891 | ||
|
|
1f174f6681 | ||
|
|
bf7297d55c | ||
|
|
ad4f33cfc4 | ||
|
|
ecb93ab9ae | ||
|
|
dc227b579d | ||
|
|
7682eb88c4 | ||
|
|
b0e8a1569e | ||
|
|
1b210e7143 | ||
|
|
bb567e20b3 | ||
|
|
507e446475 | ||
|
|
478022afad | ||
|
|
edc3bede6e | ||
|
|
21fbc5e5ad | ||
|
|
43ef16c3e1 | ||
|
|
561b3d5650 | ||
|
|
a3cb63265d | ||
|
|
4ba9cedd68 | ||
|
|
6f683d9726 | ||
|
|
2209d3cb51 | ||
|
|
3815248786 | ||
|
|
02c1f8d416 | ||
|
|
c378c1cbcd | ||
|
|
89be0943e1 | ||
|
|
abcddfe090 | ||
|
|
5a97bf30d4 | ||
|
|
b33802ca7f | ||
|
|
575cd4b8ba | ||
|
|
68b931aef8 | ||
|
|
2dbe637478 | ||
|
|
479274775f | ||
|
|
ba91ac5948 | ||
|
|
cca5161289 | ||
|
|
354344d971 | ||
|
|
248dc17394 | ||
|
|
410d2febbb | ||
|
|
42fd47b246 | ||
|
|
46cd37abc9 | ||
|
|
b2a7d24770 | ||
|
|
3b33862b04 | ||
|
|
85748171ec | ||
|
|
0ee5c9536b | ||
|
|
ca6fcc92a1 | ||
|
|
8e8210b441 | ||
|
|
a21c97d011 | ||
|
|
dd50dc4c13 | ||
|
|
b567d27394 | ||
|
|
d64fff1fe0 | ||
|
|
c8b73e415a | ||
|
|
728c3eba67 | ||
|
|
a505bb5253 | ||
|
|
8bbefa77f7 | ||
|
|
3a80ece9fa | ||
|
|
fe59b5bbc7 | ||
|
|
8af92f844f | ||
|
|
f36c8a09e6 | ||
|
|
0e2858af94 | ||
|
|
5ba71ef91f | ||
|
|
a957e2dc6b | ||
|
|
99a97c917a | ||
|
|
09304026ae | ||
|
|
b95ad63201 | ||
|
|
2ed978eb79 | ||
|
|
31ed6f1604 | ||
|
|
ac6235e53d | ||
|
|
f90b86b577 | ||
|
|
1c71bd1242 | ||
|
|
a0d9a58616 | ||
|
|
d99f54b51b | ||
|
|
4d49cee194 | ||
|
|
dcbe0f2a31 | ||
|
|
cc48e15f28 | ||
|
|
a43e7112e5 | ||
|
|
6c7a031367 | ||
|
|
645149d77b | ||
|
|
9ec9f004e1 | ||
|
|
0fe984d575 | ||
|
|
69f8e47e9e | ||
|
|
db6e261794 | ||
|
|
5cfc9fed79 | ||
|
|
40b1c5c448 | ||
|
|
e9945ee6ee | ||
|
|
cca024da2b | ||
|
|
1ec45b11ab | ||
|
|
4ae188bfc7 | ||
|
|
7f4053084c | ||
|
|
37202a1b70 | ||
|
|
b886cbea0b | ||
|
|
9f396fddc6 | ||
|
|
2434984336 | ||
|
|
1afa5e257b | ||
|
|
cba7b6ee6e | ||
|
|
03b4f81679 | ||
|
|
1dd226fde7 | ||
|
|
ded327b9fc | ||
|
|
ecc1f2310c | ||
|
|
866d7d5152 | ||
|
|
91551c09d4 | ||
|
|
70f7c9f355 | ||
|
|
10673bff4c | ||
|
|
642d9ffe24 | ||
|
|
8b82f52e75 | ||
|
|
a7cdfaa325 | ||
|
|
a6037a9eb8 | ||
|
|
23220d43f3 | ||
|
|
ad8b644de1 | ||
|
|
95b95b1407 | ||
|
|
cfaf213980 | ||
|
|
5baa0c300f | ||
|
|
2d88cbe496 | ||
|
|
8369624512 | ||
|
|
ee1c40e5c5 | ||
|
|
2f2a4396c6 | ||
|
|
cb17f1ede2 |
73
.github/CODEOWNERS
vendored
73
.github/CODEOWNERS
vendored
@@ -1,5 +1,7 @@
|
||||
* @rycee
|
||||
|
||||
/flake.nix @bqv @kisik21
|
||||
|
||||
/modules/home-environment.nix @rycee
|
||||
|
||||
/modules/misc/dconf.nix @gnidorah @rycee
|
||||
@@ -11,6 +13,9 @@
|
||||
|
||||
/modules/misc/news.nix @rycee
|
||||
|
||||
/modules/misc/numlock.nix @evanjs
|
||||
/tests/modules/misc/numlock @evanjs
|
||||
|
||||
/modules/misc/pam.nix @rycee
|
||||
/tests/modules/misc/pam @rycee
|
||||
|
||||
@@ -18,10 +23,19 @@
|
||||
|
||||
/modules/misc/submodule-support.nix @rycee
|
||||
|
||||
/modules/misc/tmpfiles.nix @dawidsowa
|
||||
|
||||
/modules/misc/vte.nix @rycee
|
||||
|
||||
/modules/misc/xdg-mime-apps.nix @pacien
|
||||
|
||||
/modules/misc/xdg-user-dirs.nix @pacien
|
||||
|
||||
/modules/programs/aria2.nix @JustinLovinger
|
||||
|
||||
/modules/programs/autojump.nix @evanjs
|
||||
/tests/modules/programs/autojump @evanjs
|
||||
|
||||
/modules/programs/autorandr.nix @uvNikita
|
||||
|
||||
/modules/programs/bash.nix @rycee
|
||||
@@ -32,6 +46,8 @@
|
||||
|
||||
/modules/programs/broot.nix @aheaume
|
||||
|
||||
/modules/programs/dircolors.nix @JustinLovinger
|
||||
|
||||
/modules/programs/direnv.nix @rycee
|
||||
|
||||
/modules/programs/eclipse.nix @rycee
|
||||
@@ -40,6 +56,9 @@
|
||||
|
||||
/modules/programs/firefox.nix @rycee
|
||||
|
||||
/modules/programs/gh.nix @Gerschtli
|
||||
/tests/modules/programs/gh @Gerschtli
|
||||
|
||||
/modules/programs/git.nix @rycee
|
||||
|
||||
/modules/programs/gnome-terminal.nix @rycee
|
||||
@@ -48,20 +67,42 @@
|
||||
|
||||
/modules/programs/home-manager.nix @rycee
|
||||
|
||||
/modules/programs/i3status.nix @JustinLovinger
|
||||
|
||||
/modules/programs/keychain.nix @marsam
|
||||
|
||||
/modules/programs/lesspipe.nix @rycee
|
||||
|
||||
/modules/programs/lf.nix @owm111
|
||||
/tests/modules/programs/lf @owm111
|
||||
|
||||
/modules/programs/lieer.nix @tadfisher
|
||||
|
||||
/modules/programs/lsd.nix @marsam
|
||||
|
||||
/modules/programs/matplotlib.nix @rprospero
|
||||
|
||||
/modules/programs/mbsync.nix @KarlJoad
|
||||
/tests/modules/programs/mbsync @KarlJoad
|
||||
|
||||
/modules/programs/mcfly.nix @marsam
|
||||
|
||||
/modules/programs/mpv.nix @tadeokondrak
|
||||
|
||||
/modules/programs/mu.nix @KarlJoad
|
||||
|
||||
/modules/programs/ncmpcpp.nix @olmokramer
|
||||
/tests/modules/programs/ncmpcpp @olmokramer
|
||||
/tests/modules/programs/ncmpcpp-linux @olmokramer
|
||||
|
||||
/modules/programs/ne.nix @cwyc
|
||||
/tests/modules/programs/ne @cwyc
|
||||
|
||||
/modules/programs/noti.nix @marsam
|
||||
|
||||
/modules/programs/nushell.nix @Philipp-M
|
||||
/tests/modules/programs/nushell @Philipp-M
|
||||
|
||||
/modules/programs/obs-studio.nix @adisbladis
|
||||
|
||||
/modules/programs/opam.nix @marsam
|
||||
@@ -74,6 +115,11 @@
|
||||
|
||||
/modules/programs/pidgin.nix @rycee
|
||||
|
||||
/modules/programs/powerline-go.nix @DamienCassou
|
||||
|
||||
/modules/programs/rofi-pass.nix @seylerius
|
||||
/tests/modules/programs/rofi-pass @seylerius
|
||||
|
||||
/modules/programs/rtorrent.nix @marsam
|
||||
|
||||
/modules/programs/ssh.nix @rycee
|
||||
@@ -82,16 +128,36 @@
|
||||
|
||||
/modules/programs/texlive.nix @rycee
|
||||
|
||||
/modules/programs/waybar.nix @berbiche
|
||||
/tests/modules/programs/waybar @berbiche
|
||||
|
||||
/modules/programs/z-lua.nix @marsam
|
||||
|
||||
/modules/programs/zathura.nix @rprospero
|
||||
|
||||
/modules/programs/zoxide.nix @marsam
|
||||
|
||||
/modules/programs/zsh/prezto.nix @NickHu
|
||||
|
||||
/modules/services/caffeine.nix @uvNikita
|
||||
|
||||
/modules/services/cbatticon.nix @pmiddend
|
||||
|
||||
/modules/services/clipmenu.nix @DamienCassou
|
||||
|
||||
/modules/services/dropbox.nix @eyJhb
|
||||
/tests/modules/services/dropbox @eyJhb
|
||||
|
||||
/modules/services/dunst.nix @rycee
|
||||
|
||||
/modules/services/emacs.nix @tadfisher
|
||||
|
||||
/modules/services/flameshot.nix @moredhel
|
||||
|
||||
/modules/services/fluidsynth.nix @Valodim
|
||||
|
||||
/modules/services/gammastep.nix @petabyteboy
|
||||
|
||||
/modules/services/gnome-keyring.nix @rycee
|
||||
|
||||
/modules/services/gpg-agent.nix @rycee
|
||||
@@ -102,6 +168,9 @@
|
||||
|
||||
/modules/services/imapnotify.nix @nickhu
|
||||
|
||||
/modules/services/kanshi.nix @nurelin
|
||||
/tests/modules/services/kanshi @nurelin
|
||||
|
||||
/modules/services/kdeconnect.nix @adisbladis
|
||||
|
||||
/modules/services/keepassx.nix @rycee
|
||||
@@ -126,6 +195,8 @@
|
||||
|
||||
/modules/services/pasystray.nix @pltanton
|
||||
|
||||
/modules/services/pulseeffects.nix @jonringer
|
||||
|
||||
/modules/services/random-background.nix @rycee
|
||||
|
||||
/modules/services/redshift.nix @rycee
|
||||
@@ -144,6 +215,8 @@
|
||||
|
||||
/modules/services/unison.nix @pacien
|
||||
|
||||
/modules/services/window-managers/i3-sway/sway.nix @alexarice
|
||||
|
||||
/modules/services/xcape.nix @nickhu
|
||||
|
||||
/modules/services/xembed-sni-proxy.nix @rycee
|
||||
|
||||
38
.github/ISSUE_TEMPLATE.md
vendored
Normal file
38
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<!--
|
||||
|
||||
If you are encountering the error
|
||||
|
||||
element xref: validity error : IDREF attribute linkend references an unknown ID "opt-home.file._name__.source"
|
||||
|
||||
then it means that you are using an old version of Home Manager, such
|
||||
as the release-20.03 branch, with a recent version of Nixpkgs, such as
|
||||
version 20.09 or master. See https://git.io/JTb6K for more.
|
||||
|
||||
In general, please check if there already exists a relevant issue
|
||||
before creating a new one.
|
||||
|
||||
-->
|
||||
|
||||
### Issue description
|
||||
|
||||
<!--
|
||||
Please describe the issue. For support and help please use the IRC
|
||||
channel #home-manager @ freenode.net instead.
|
||||
-->
|
||||
|
||||
### Meta
|
||||
|
||||
#### Maintainer CC
|
||||
|
||||
<!--
|
||||
Please @ people who are in the `meta.maintainers` list of the
|
||||
offending module. If in doubt, check `git blame` for whoever last
|
||||
touched something.
|
||||
-->
|
||||
|
||||
#### Technical details
|
||||
|
||||
<!--
|
||||
Please run `nix-shell -p nix-info --run "nix-info -m"` and paste the
|
||||
result.
|
||||
-->
|
||||
28
.github/PULL_REQUEST_TEMPLATE.md
vendored
28
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,21 +1,31 @@
|
||||
### Description
|
||||
|
||||
<!--
|
||||
|
||||
Please fill the description and checklist to the best of your
|
||||
ability.
|
||||
Please provide a brief description of your change.
|
||||
|
||||
-->
|
||||
|
||||
### Description
|
||||
|
||||
|
||||
|
||||
### Checklist
|
||||
|
||||
<!--
|
||||
|
||||
Please go through the following checklist before opening a non-WIP
|
||||
pull-request.
|
||||
|
||||
Also make sure to read the guidelines found at
|
||||
|
||||
https://github.com/nix-community/home-manager/blob/master/doc/contributing.adoc#sec-guidelines
|
||||
|
||||
-->
|
||||
|
||||
- [ ] Change is backwards compatible.
|
||||
|
||||
- [ ] Code formatted with `./format`.
|
||||
|
||||
- [ ] Code tested through `nix-shell --pure tests -A run.all`.
|
||||
|
||||
- [ ] Test cases updated/added. See [example](https://github.com/rycee/home-manager/commit/f3fbb50b68df20da47f9b0def5607857fcc0d021#diff-b61a6d542f9036550ba9c401c80f00ef).
|
||||
- [ ] Test cases updated/added. See [example](https://github.com/nix-community/home-manager/commit/f3fbb50b68df20da47f9b0def5607857fcc0d021#diff-b61a6d542f9036550ba9c401c80f00ef).
|
||||
|
||||
- [ ] Commit messages are formatted like
|
||||
|
||||
@@ -25,10 +35,10 @@
|
||||
{long description}
|
||||
```
|
||||
|
||||
See [CONTRIBUTING](https://github.com/rycee/home-manager/blob/master/CONTRIBUTING.md#commits) for more information and [recent commit messages](https://github.com/rycee/home-manager/commits/master) for examples.
|
||||
See [CONTRIBUTING](https://github.com/nix-community/home-manager/blob/master/doc/contributing.adoc#sec-commit-style) for more information and [recent commit messages](https://github.com/nix-community/home-manager/commits/master) for examples.
|
||||
|
||||
- If this PR adds a new module
|
||||
|
||||
- [ ] Added myself as module maintainer. See [example](https://github.com/rycee/home-manager/blob/068ff76a10e95820f886ac46957edcff4e44621d/modules/programs/lesspipe.nix#L6).
|
||||
- [ ] Added myself as module maintainer. See [example](https://github.com/nix-community/home-manager/blob/068ff76a10e95820f886ac46957edcff4e44621d/modules/programs/lesspipe.nix#L6).
|
||||
|
||||
- [ ] Added myself and the module files to `.github/CODEOWNERS`.
|
||||
|
||||
28
.github/workflows/github_pages.yml
vendored
Normal file
28
.github/workflows/github_pages.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
name: GitHub Pages
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
jobs:
|
||||
publish:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: cachix/install-nix-action@v14.1
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
- uses: cachix/cachix-action@v10
|
||||
with:
|
||||
name: nix-community
|
||||
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
|
||||
- run: |
|
||||
nix-build -A docs.html
|
||||
cp -r result/share/doc/home-manager public
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3.8.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./public
|
||||
23
.github/workflows/test.yml
vendored
Normal file
23
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
name: Test
|
||||
on:
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: "30 2 * * *"
|
||||
jobs:
|
||||
tests:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: cachix/install-nix-action@v14.1
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-20.09
|
||||
- uses: cachix/cachix-action@v10
|
||||
with:
|
||||
name: nix-community
|
||||
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
|
||||
- run: ./format -c
|
||||
- run: nix-shell . -A install
|
||||
- run: nix-shell --pure tests -A run.all
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
/flake.lock
|
||||
/result*
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
image: nixos/nix:latest
|
||||
|
||||
variables:
|
||||
# Pinned 2020-01-01.
|
||||
NIX_PATH: "nixpkgs=https://github.com/NixOS/nixpkgs/archive/b0bbacb52134a7e731e549f4c0a7a2a39ca6b481.tar.gz"
|
||||
NIX_PATH: "nixpkgs=channel:nixos-20.09"
|
||||
|
||||
stages:
|
||||
- test
|
||||
@@ -11,7 +10,7 @@ stages:
|
||||
Run tests:
|
||||
stage: test
|
||||
script:
|
||||
- nix-shell tests -A run.files-text
|
||||
- nix-shell --pure tests -A run.files-text
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "master"
|
||||
when: always
|
||||
|
||||
13
.travis.yml
13
.travis.yml
@@ -1,13 +0,0 @@
|
||||
language: nix
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
before_script:
|
||||
- mkdir -m 0755 -p /nix/var/nix/{profiles,gcroots}/per-user/$USER
|
||||
|
||||
script:
|
||||
- ./format -c
|
||||
- nix-shell . -A install
|
||||
- nix-shell --pure --max-jobs 10 tests -A run.all
|
||||
1
CONTRIBUTING.adoc
Symbolic link
1
CONTRIBUTING.adoc
Symbolic link
@@ -0,0 +1 @@
|
||||
doc/contributing.adoc
|
||||
194
CONTRIBUTING.md
194
CONTRIBUTING.md
@@ -1,194 +0,0 @@
|
||||
Contributing
|
||||
============
|
||||
|
||||
Thanks for wanting to contribute to Home Manager! These are some
|
||||
guidelines to make the process as smooth as possible for both you and
|
||||
the Home Manager developers.
|
||||
|
||||
If you are only looking to report a problem then it is sufficient to
|
||||
read through the following section on reporting issues. If you instead
|
||||
want to directly contribute improvements and additions then please
|
||||
have a look at everything here.
|
||||
|
||||
Reporting an issue
|
||||
------------------
|
||||
|
||||
If you notice a problem with Home Manager and want to report it then
|
||||
have a look among the already [open issues][], if you find one
|
||||
matching yours then feel free to comment on it to add any additional
|
||||
information you may have.
|
||||
|
||||
If no matching issue exists then go to the [new issue][] page and
|
||||
write a description of your problem. Include as much information as
|
||||
you can, ideally also include relevant excerpts from your Home Manager
|
||||
configuration.
|
||||
|
||||
Contributing code
|
||||
-----------------
|
||||
|
||||
If you want to contribute code to improve Home Manager then please
|
||||
follow these guidelines.
|
||||
|
||||
### Fork and create a pull request ###
|
||||
|
||||
If you have not previously forked Home Manager then you need to do
|
||||
that first. Have a look at GitHub's "[Fork A Repo][]" for instructions
|
||||
on how to do this.
|
||||
|
||||
Once you have a fork of Home Manager you should create a branch
|
||||
starting at the most recent `master`. Give your branch a reasonably
|
||||
descriptive name. Perform your changes on this branch and when you are
|
||||
happy with the result push the branch to GitHub and
|
||||
[create a pull request][].
|
||||
|
||||
Assuming your clone is at `$HOME/devel/home-manager` then you can make
|
||||
the `home-manager` command use it by either
|
||||
|
||||
1. overriding the default path by using the `-I` command line option:
|
||||
|
||||
home-manager -I home-manager=$HOME/devel/home-manager
|
||||
|
||||
or
|
||||
|
||||
2. changing the default path by ensuring your configuration includes
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
programs.home-manager.path = "$HOME/devel/home-manager";
|
||||
|
||||
and running `home-manager switch` to activate the change.
|
||||
Afterwards, `home-manager build` and `home-manager switch` will
|
||||
use your cloned repository.
|
||||
|
||||
The first option is good if you only temporarily want to use your
|
||||
clone.
|
||||
|
||||
### Commits ###
|
||||
|
||||
The commits in your pull request should be reasonably self-contained,
|
||||
that is, each commit should make sense in isolation. In particular,
|
||||
you will be asked to amend any commit that introduces syntax errors or
|
||||
similar problems even if they are fixed in a later commit.
|
||||
|
||||
The commit messages should follow the format
|
||||
|
||||
{component}: {description}
|
||||
|
||||
{long description}
|
||||
|
||||
where `{component}` refers to the code component (or module) your
|
||||
change affects, `{description}` is a brief description of your change,
|
||||
and `{long description}` is an optional clarifying description. Note,
|
||||
`{description}` should start with a lower case letter. As a rare
|
||||
exception, if there is no clear component, or your change affects many
|
||||
components, then the `{component}` part is optional.
|
||||
|
||||
When adding a new module, say `foo.nix`, we use the fixed commit
|
||||
format `foo: add module`. You can, of course, still include a long
|
||||
description if you wish.
|
||||
|
||||
In addition to the above commit message guidelines, try to follow the
|
||||
[seven rules][] as much as possible.
|
||||
|
||||
### Style guidelines ###
|
||||
|
||||
The code in Home Manager is formatted by the [nixfmt][] tool and the
|
||||
formatting is checked in the pull request tests. Run the `format` tool
|
||||
inside the project repository before submitting your pull request.
|
||||
|
||||
Note, we prefer `lowerCamelCase` for variable and attribute names with
|
||||
the accepted exception of variables directly referencing packages in
|
||||
Nixpkgs which use a hyphenated style. For example, the Home Manager
|
||||
option `services.gpg-agent.enableSshSupport` references the
|
||||
`gpg-agent` package in Nixpkgs.
|
||||
|
||||
### News ###
|
||||
|
||||
Home Manager includes a system for presenting news to the user. When
|
||||
making a change you, therefore, have the option to also include an
|
||||
associated news entry. In general, a news entry should only be added
|
||||
for truly noteworthy news. For example, a bug fix or new option does
|
||||
generally not need a news entry.
|
||||
|
||||
If you do have a change worthy of a news entry then please add one in
|
||||
[`news.nix`][] but you should follow some basic guidelines:
|
||||
|
||||
- The entry timestamp should be in ISO-8601 format having "+00:00" as
|
||||
time zone. For example, "2017-09-13T17:10:14+00:00". A suitable
|
||||
timestamp can be produced by the command
|
||||
|
||||
date --iso-8601=second --universal
|
||||
|
||||
- The entry condition should be as specific as possible. For example,
|
||||
if you are changing or deprecating a specific option then you could
|
||||
restrict the news to those users who actually use this option.
|
||||
|
||||
- Wrap the news message so that it will fit in the typical terminal,
|
||||
that is, at most 80 characters wide. Ideally a bit less.
|
||||
|
||||
- Unlike commit messages, news will be read without any connection to
|
||||
the Home Manager source code. It is therefore important to make the
|
||||
message understandable in isolation and to those who do not have
|
||||
knowledge of the Home Manager internals. To this end it should be
|
||||
written in more descriptive, prose like way.
|
||||
|
||||
- If you refer to an option then write its full attribute path. That
|
||||
is, instead of writing
|
||||
|
||||
> The option 'foo' has been deprecated, please use 'bar' instead.
|
||||
|
||||
it should read
|
||||
|
||||
> The option 'services.myservice.foo' has been deprecated, please
|
||||
> use 'services.myservice.bar' instead.
|
||||
|
||||
- A new module, say `foo.nix`, should always include a news entry
|
||||
that has a message along the lines of
|
||||
|
||||
> A new module is available: 'services.foo'.
|
||||
|
||||
If the module is platform specific, e.g., a service module using
|
||||
systemd, then a condition like
|
||||
|
||||
```
|
||||
condition = hostPlatform.isLinux;
|
||||
```
|
||||
|
||||
should be added. If you contribute a module then you don't need to
|
||||
add this entry, the merger will create an entry for you.
|
||||
|
||||
### Tests ###
|
||||
|
||||
Home Manager includes a basic test suite and it is highly recommended
|
||||
to include at least one test when adding a module. Tests are typically
|
||||
in the form of "golden tests" where, for example, a generated
|
||||
configuration file is compared to a known correct file.
|
||||
|
||||
It is relatively easy to create tests by modeling the existing tests,
|
||||
found in the `tests` project directory.
|
||||
|
||||
The full Home Manager test suite can be run by executing
|
||||
|
||||
```console
|
||||
$ nix-shell --pure tests -A run.all
|
||||
```
|
||||
|
||||
in the project root. List all test cases through
|
||||
|
||||
```console
|
||||
$ nix-shell --pure tests -A list
|
||||
```
|
||||
|
||||
and run an individual test, for example `alacritty-empty-settings`,
|
||||
through
|
||||
|
||||
```console
|
||||
$ nix-shell --pure tests -A run.alacritty-empty-settings
|
||||
```
|
||||
|
||||
[open issues]: https://github.com/rycee/home-manager/issues
|
||||
[new issue]: https://github.com/rycee/home-manager/issues/new
|
||||
[Fork A Repo]: https://help.github.com/articles/fork-a-repo/
|
||||
[create a pull request]: https://help.github.com/articles/creating-a-pull-request/
|
||||
[seven rules]: https://chris.beams.io/posts/git-commit/#seven-rules
|
||||
[`news.nix`]: https://github.com/rycee/home-manager/blob/master/modules/misc/news.nix
|
||||
[nixfmt]: https://github.com/serokell/nixfmt/
|
||||
198
FAQ.md
198
FAQ.md
@@ -1,198 +0,0 @@
|
||||
Frequently Asked Questions (FAQ)
|
||||
================================
|
||||
|
||||
Why is there a collision error when switching generation?
|
||||
---------------------------------------------------------
|
||||
|
||||
Home Manager currently installs packages into the user environment,
|
||||
precisely as if the packages were installed through
|
||||
`nix-env --install`. This means that you will get a collision error if
|
||||
your Home Manager configuration attempts to install a package that you
|
||||
already have installed manually, that is, packages that shows up when
|
||||
you run `nix-env --query`.
|
||||
|
||||
For example, imagine you have the `hello` package installed in your
|
||||
environment
|
||||
|
||||
```console
|
||||
$ nix-env --query
|
||||
hello-2.10
|
||||
```
|
||||
|
||||
and your Home Manager configuration contains
|
||||
|
||||
home.packages = [ pkgs.hello ];
|
||||
|
||||
Then attempting to switch to this configuration will result in an
|
||||
error similar to
|
||||
|
||||
```console
|
||||
$ home-manager switch
|
||||
these derivations will be built:
|
||||
/nix/store/xg69wsnd1rp8xgs9qfsjal017nf0ldhm-home-manager-path.drv
|
||||
[…]
|
||||
Activating installPackages
|
||||
replacing old ‘home-manager-path’
|
||||
installing ‘home-manager-path’
|
||||
building path(s) ‘/nix/store/b5c0asjz9f06l52l9812w6k39ifr49jj-user-environment’
|
||||
Wide character in die at /nix/store/64jc9gd2rkbgdb4yjx3nrgc91bpjj5ky-buildenv.pl line 79.
|
||||
collision between ‘/nix/store/fmwa4axzghz11cnln5absh31nbhs9lq1-home-manager-path/bin/hello’ and ‘/nix/store/c2wyl8b9p4afivpcz8jplc9kis8rj36d-hello-2.10/bin/hello’; use ‘nix-env --set-flag priority NUMBER PKGNAME’ to change the priority of one of the conflicting packages
|
||||
builder for ‘/nix/store/b37x3s7pzxbasfqhaca5dqbf3pjjw0ip-user-environment.drv’ failed with exit code 2
|
||||
error: build of ‘/nix/store/b37x3s7pzxbasfqhaca5dqbf3pjjw0ip-user-environment.drv’ failed
|
||||
```
|
||||
|
||||
The solution is typically to uninstall the package from the
|
||||
environment using `nix-env --uninstall` and reattempt the Home Manager
|
||||
generation switch.
|
||||
|
||||
Why are the session variables not set?
|
||||
--------------------------------------
|
||||
|
||||
Home Manager is only able to set session variables automatically if it
|
||||
manages your Bash or Z shell configuration. If you don't want to let
|
||||
Home Manager manage your shell then you will have to manually source
|
||||
the
|
||||
|
||||
~/.nix-profile/etc/profile.d/hm-session-vars.sh
|
||||
|
||||
file in an appropriate way. In Bash and Z shell this can be done by
|
||||
adding
|
||||
|
||||
```sh
|
||||
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
|
||||
```
|
||||
|
||||
to your `.profile` and `.zshrc` files, respectively. The
|
||||
`hm-session-vars.sh` file should work in most Bourne-like shells.
|
||||
|
||||
How do set up a configuration for multiple users/machines?
|
||||
----------------------------------------------------------
|
||||
|
||||
A typical way to prepare a repository of configurations for multiple
|
||||
logins and machines is to prepare one "top-level" file for each unique
|
||||
combination.
|
||||
|
||||
For example, if you have two machines, called "kronos" and "rhea" on
|
||||
which you want to configure your user "jane" then you could create the
|
||||
files
|
||||
|
||||
- `kronos-jane.nix`,
|
||||
- `rhea-jane.nix`, and
|
||||
- `common.nix`
|
||||
|
||||
in your repository. On the kronos and rhea machines you can then make
|
||||
`~jane/.config/nixpkgs/home.nix` be a symbolic link to the
|
||||
corresponding file in your configuration repository.
|
||||
|
||||
The `kronos-jane.nix` and `rhea-jane.nix` files follow the format
|
||||
|
||||
```nix
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [ ./common.nix ];
|
||||
|
||||
# Various options that are specific for this machine/user.
|
||||
}
|
||||
```
|
||||
|
||||
while the `common.nix` file contains configuration shared across the
|
||||
two logins. Of course, instead of just a single `common.nix` file you
|
||||
can have multiple ones, even one per program or service.
|
||||
|
||||
You can get some inspiration from the [Post your home-manager home.nix
|
||||
file!][1] Reddit thread.
|
||||
|
||||
[1]: https://www.reddit.com/r/NixOS/comments/9bb9h9/post_your_homemanager_homenix_file/
|
||||
|
||||
Why do I get an error message about `ca.desrt.dconf`?
|
||||
-----------------------------------------------------
|
||||
|
||||
You are most likely trying to configure the GTK or Gnome Terminal but
|
||||
the DBus session is not aware of the dconf service. The full error you
|
||||
might get is
|
||||
|
||||
error: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name ca.desrt.dconf was not provided by any .service files
|
||||
|
||||
The solution on NixOS is to add
|
||||
|
||||
services.dbus.packages = with pkgs; [ gnome3.dconf ];
|
||||
|
||||
to your system configuration.
|
||||
|
||||
How do I install packages from Nixpkgs unstable?
|
||||
------------------------------------------------
|
||||
|
||||
If you are using a stable version of Nixpkgs but would like to install
|
||||
some particular packages from Nixpkgs unstable then you can import the
|
||||
unstable Nixpkgs and refer to its packages within your configuration.
|
||||
Something like
|
||||
|
||||
```nix
|
||||
{ pkgs, config, ... }:
|
||||
|
||||
let
|
||||
|
||||
pkgsUnstable = import <nixpkgs-unstable> {};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
home.packages = [
|
||||
pkgsUnstable.foo
|
||||
];
|
||||
|
||||
# …
|
||||
}
|
||||
```
|
||||
|
||||
should work provided you have a Nix channel called `nixpkgs-unstable`.
|
||||
Note, the package will not be affected by any package overrides,
|
||||
overlays, etc.
|
||||
|
||||
How do I override the package used by a module?
|
||||
-----------------------------------------------
|
||||
|
||||
By default Home Manager will install the package provided by your
|
||||
chosen `nixpkgs` channel but occasionally you might end up needing to
|
||||
change this package. This can typically be done in two ways.
|
||||
|
||||
1. If the module provides a `package` option, such as
|
||||
`programs.beets.package`, then this is the recommended way to
|
||||
perform the override. For example,
|
||||
|
||||
```
|
||||
programs.beets.package = pkgs.beets.override { enableCheck = true; };
|
||||
```
|
||||
|
||||
2. If no `package` option is available, then you can typically
|
||||
override the relevant package using an [overlay][nixpkgs-overlays].
|
||||
|
||||
For example, if you want to use the `programs.skim` module but use
|
||||
the `skim` package from Nixpkgs unstable, then a configuration like
|
||||
|
||||
```nix
|
||||
{ pkgs, config, ... }:
|
||||
|
||||
let
|
||||
|
||||
pkgsUnstable = import <nixpkgs-unstable> {};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
programs.skim.enable = true;
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
skim = pkgsUnstable.skim;
|
||||
})
|
||||
];
|
||||
|
||||
# …
|
||||
}
|
||||
```
|
||||
|
||||
should work OK.
|
||||
|
||||
[nixpkgs-overlays]: https://nixos.org/nixpkgs/manual/#chap-overlays
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017-2020 Robert Helgesson and Home Manager contributors
|
||||
Copyright (c) 2017-2020 Home Manager contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
117
README.md
117
README.md
@@ -3,8 +3,10 @@ Home Manager using Nix
|
||||
|
||||
This project provides a basic system for managing a user environment
|
||||
using the [Nix][] package manager together with the Nix libraries
|
||||
found in [Nixpkgs][]. Before attempting to use Home Manager please
|
||||
read the warning below.
|
||||
found in [Nixpkgs][]. It allows declarative configuration of user
|
||||
specific (non global) packages and dotfiles.
|
||||
|
||||
Before attempting to use Home Manager please read the warning below.
|
||||
|
||||
For a more systematic overview of Home Manager and its available
|
||||
options, please see the [Home Manager manual][manual].
|
||||
@@ -12,9 +14,17 @@ options, please see the [Home Manager manual][manual].
|
||||
Words of warning
|
||||
----------------
|
||||
|
||||
This project is under development. I personally use it to manage
|
||||
several user configurations but it may fail catastrophically for you.
|
||||
So beware!
|
||||
Unfortunately, it is quite possible to get difficult to understand
|
||||
errors when working with Home Manager, such as infinite loops with no
|
||||
clear source reference. You should therefore be comfortable using the
|
||||
Nix language and the various tools in the Nix ecosystem. Reading
|
||||
through the [Nix Pills][] document is a good way to familiarize
|
||||
yourself with them.
|
||||
|
||||
If you are not very familiar with Nix but still want to use Home
|
||||
Manager then you are strongly encouraged to start with a small and
|
||||
very simple configuration and gradually make it more elaborate as you
|
||||
learn.
|
||||
|
||||
In some cases Home Manager cannot detect whether it will overwrite a
|
||||
previous manual configuration. For example, the Gnome Terminal module
|
||||
@@ -22,7 +32,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 20.03 (the
|
||||
Home Manager targets [NixOS][] unstable and NixOS version 20.09 (the
|
||||
current stable version), it may or may not work on other Linux
|
||||
distributions and NixOS versions.
|
||||
|
||||
@@ -38,48 +48,40 @@ Contact
|
||||
-------
|
||||
|
||||
You can chat with us on IRC in the channel [#home-manager][] on
|
||||
[freenode][]. The [channel logs][] are hosted courtesy of
|
||||
[samueldr][].
|
||||
[OFTC][].
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Currently the easiest way to install Home Manager is as follows:
|
||||
|
||||
1. Make sure you have a working Nix installation. If you are not
|
||||
using NixOS then you may here have to run
|
||||
|
||||
```console
|
||||
$ mkdir -m 0755 -p /nix/var/nix/{profiles,gcroots}/per-user/$USER
|
||||
```
|
||||
|
||||
since Home Manager uses these directories to manage your profile
|
||||
generations. On NixOS these should already be available.
|
||||
|
||||
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` 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
|
||||
1. Make sure you have a working Nix installation. Specifically, make
|
||||
sure that your user is able to build and install Nix packages. For
|
||||
example, you should be able to successfully run a command like
|
||||
`nix-instantiate '<nixpkgs>' -A hello` without having to switch to
|
||||
the root user. For a multi-user install of Nix this means that
|
||||
your user must be covered by the
|
||||
[`allowed-users`][nixAllowedUsers] Nix option. On NixOS you can
|
||||
control this option using the
|
||||
[`nix.allowedUsers`][nixosAllowedUsers] system option.
|
||||
|
||||
Note that Nix 2.4 (`nixUnstable`) is not yet supported.
|
||||
|
||||
2. Add the appropriate Home Manager channel. Typically this is
|
||||
|
||||
```console
|
||||
$ nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager
|
||||
$ nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
|
||||
$ nix-channel --update
|
||||
```
|
||||
|
||||
if you are following Nixpkgs master or an unstable channel and
|
||||
|
||||
```console
|
||||
$ nix-channel --add https://github.com/rycee/home-manager/archive/release-20.03.tar.gz home-manager
|
||||
$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-20.09.tar.gz home-manager
|
||||
$ nix-channel --update
|
||||
```
|
||||
|
||||
if you follow a Nixpkgs version 20.03 channel.
|
||||
if you follow a Nixpkgs version 20.09 channel.
|
||||
|
||||
On NixOS you may need to log out and back in for the channel to
|
||||
become available. On non-NixOS you may have to add
|
||||
@@ -133,8 +135,8 @@ configuration generations.
|
||||
|
||||
As an example, let us expand the initial configuration file from the
|
||||
installation above to install the htop and fortune packages, install
|
||||
Emacs with a few extra packages enabled, install Firefox with the
|
||||
IcedTea plugin enabled, and enable the user gpg-agent service.
|
||||
Emacs with a few extra packages enabled, install Firefox with
|
||||
smooth scrolling enabled, and enable the user gpg-agent service.
|
||||
|
||||
To satisfy the above setup we should elaborate the
|
||||
`~/.config/nixpkgs/home.nix` file as follows:
|
||||
@@ -158,7 +160,13 @@ To satisfy the above setup we should elaborate the
|
||||
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
enableIcedTea = true;
|
||||
profiles = {
|
||||
myprofile = {
|
||||
settings = {
|
||||
"general.smoothScroll" = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.gpg-agent = {
|
||||
@@ -303,6 +311,44 @@ in your system configuration and
|
||||
|
||||
in your Home Manager configuration.
|
||||
|
||||
Nix Flakes
|
||||
----------
|
||||
|
||||
Home Manager includes a `flake.nix` file for compatibility with [Nix Flakes][]
|
||||
for those that wish to use it as a module. A bare-minimum `flake.nix` would be
|
||||
as follows:
|
||||
|
||||
```nix
|
||||
{
|
||||
description = "NixOS configuration";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
};
|
||||
|
||||
outputs = { home-manager, nixpkgs, ... }: {
|
||||
nixosConfigurations = {
|
||||
hostname = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./configuration.nix
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.jdoe = import ./home.nix;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Note, the Home Manager library is exported by the flake under
|
||||
`lib.hm`.
|
||||
|
||||
Releases
|
||||
--------
|
||||
|
||||
@@ -310,7 +356,7 @@ Home Manager is developed against `nixpkgs-unstable` branch, which
|
||||
often causes it to contain tweaks for changes/packages not yet
|
||||
released in stable NixOS. To avoid breaking users' configurations,
|
||||
Home Manager is released in branches corresponding to NixOS releases
|
||||
(e.g. `release-20.03`). These branches get fixes, but usually not new
|
||||
(e.g. `release-20.09`). These branches get fixes, but usually not new
|
||||
modules. If you need a module to be backported, then feel free to open
|
||||
an issue.
|
||||
|
||||
@@ -321,9 +367,10 @@ an issue.
|
||||
[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/
|
||||
[manual]: https://rycee.gitlab.io/home-manager/
|
||||
[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/
|
||||
[manual]: https://nix-community.github.io/home-manager/
|
||||
[configuration options]: https://nix-community.github.io/home-manager/options.html
|
||||
[#home-manager]: https://webchat.oftc.net/?channels=home-manager
|
||||
[OFTC]: https://oftc.net/
|
||||
[samueldr]: https://github.com/samueldr/
|
||||
[Nix Pills]: https://nixos.org/nixos/nix-pills/
|
||||
[Nix Flakes]: https://nixos.wiki/wiki/Flakes
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
{ pkgs ? import <nixpkgs> { } }:
|
||||
|
||||
rec {
|
||||
docs = with import ./doc { inherit pkgs; }; {
|
||||
html = manual.html;
|
||||
manPages = manPages;
|
||||
json = options.json;
|
||||
};
|
||||
|
||||
home-manager = pkgs.callPackage ./home-manager { path = toString ./.; };
|
||||
|
||||
install =
|
||||
pkgs.callPackage ./home-manager/install.nix { inherit home-manager; };
|
||||
|
||||
nixos = import ./nixos;
|
||||
|
||||
path = ./.;
|
||||
}
|
||||
|
||||
258
doc/contributing.adoc
Normal file
258
doc/contributing.adoc
Normal file
@@ -0,0 +1,258 @@
|
||||
[[ch-contributing]]
|
||||
== Contributing
|
||||
|
||||
:open-issues: https://github.com/nix-community/home-manager/issues
|
||||
:new-issue: https://github.com/nix-community/home-manager/issues/new
|
||||
:fork-a-repo: https://help.github.com/articles/fork-a-repo/
|
||||
:create-a-pull-request: https://help.github.com/articles/creating-a-pull-request/
|
||||
:seven-rules: https://chris.beams.io/posts/git-commit/#seven-rules
|
||||
:news-nix: https://github.com/nix-community/home-manager/blob/master/modules/misc/news.nix
|
||||
:nixfmt: https://github.com/serokell/nixfmt/
|
||||
:example-commit-message: https://github.com/nix-community/home-manager/commit/69f8e47e9e74c8d3d060ca22e18246b7f7d988ef
|
||||
|
||||
Contributions to Home Manager are very welcome. To make the process as smooth as possible for both you and the Home Manager maintainers we provide some guidelines that we ask you to follow. See <<sec-contrib-getting-started>> for information on how to set up a suitable development environment and <<sec-guidelines>> for the actual guidelines.
|
||||
|
||||
This text is mainly directed at those who would like to make code contributions to Home Manager. If you just want to report a bug then first look among the already {open-issues}[open issues], if you find one matching yours then feel free to comment on it to add any additional information you may have. If no matching issue exists then go to the {new-issue}[new issue] page and write a description of your problem. Include as much information as you can, ideally also include relevant excerpts from your Home Manager configuration.
|
||||
|
||||
[[sec-contrib-getting-started]]
|
||||
=== Getting started
|
||||
|
||||
If you have not previously forked Home Manager then you need to do that first. Have a look at GitHub's {fork-a-repo}[Fork a repo] for instructions on how to do this.
|
||||
|
||||
Once you have a fork of Home Manager you should create a branch starting at the most recent `master` branch. Give your branch a reasonably descriptive name. Commit your changes to this branch and when you are happy with the result and it fulfills <<sec-guidelines>> then push the branch to GitHub and {create-a-pull-request}[create a pull request].
|
||||
|
||||
Assuming your clone is at `$HOME/devel/home-manager` then you can make the `home-manager` command use it by either
|
||||
|
||||
1. overriding the default path by using the `-I` command line option:
|
||||
+
|
||||
[source,console]
|
||||
$ home-manager -I home-manager=$HOME/devel/home-manager
|
||||
+
|
||||
or
|
||||
|
||||
2. changing the default path by ensuring your configuration includes
|
||||
+
|
||||
[source,nix]
|
||||
----
|
||||
programs.home-manager.enable = true;
|
||||
programs.home-manager.path = "$HOME/devel/home-manager";
|
||||
----
|
||||
+
|
||||
and running `home-manager switch` to activate the change. Afterwards, `home-manager build` and `home-manager switch` will use your cloned repository.
|
||||
|
||||
The first option is good if you only temporarily want to use your clone.
|
||||
|
||||
[[sec-guidelines]]
|
||||
=== Guidelines
|
||||
:irc-home-manager: https://webchat.oftc.net/?channels=home-manager
|
||||
:valuable-options: https://github.com/Infinisil/rfcs/blob/config-option/rfcs/0042-config-option.md#valuable-options
|
||||
:rfc-42: https://github.com/Infinisil/rfcs/blob/config-option/rfcs/0042-config-option.md
|
||||
:assertions: https://nixos.org/manual/nixos/stable/index.html#sec-assertions
|
||||
|
||||
If your contribution satisfy the following rules then there is a good chance it will be merged without too much trouble. The rules are enforced by the Home Manager maintainers and to a lesser extent the Home Manager CI system.
|
||||
|
||||
If you are uncertain how these rules affect the change you would like to make then feel free to start a discussion in the {irc-home-manager}[#home-manager] IRC channel, ideally before you start developing.
|
||||
|
||||
[[sec-guidelines-back-compat]]
|
||||
==== Maintain backward compatibility
|
||||
|
||||
Your contribution should not cause another user's existing configuration to break unless there is a very good reason and the change should be announced to the user through an {assertions}[assertion] or similar.
|
||||
|
||||
Remember that Home Manager is used in many different environments and you should consider how your change may effect others. For example,
|
||||
|
||||
- Does your change work for people that do not use NixOS? Consider other GNU/Linux distributions and macOS.
|
||||
- Does your change work for people whose configuration is built on one system and deployed on another system?
|
||||
|
||||
[[sec-guidelines-forward-compat]]
|
||||
==== Keep forward compatibility in mind
|
||||
|
||||
The master branch of Home Manager tracks the unstable channel of Nixpkgs, which may update package versions at any time. It is therefore important to consider how a package update may affect your code and try to reduce the risk of breakage.
|
||||
|
||||
The most effective way to reduce this risk is to follow the advice in <<sec-guidelines-valuable-options>>.
|
||||
|
||||
[[sec-guidelines-valuable-options]]
|
||||
==== Add only valuable options
|
||||
|
||||
When creating a new module it is tempting to include every option supported by the software. This is _strongly_ discouraged. Providing many options increases maintenance burden and risk of breakage considerably. This is why only the most {valuable-options}[important software options] should be modeled explicitly. Less important options should be expressible through an `extraConfig` escape hatch.
|
||||
|
||||
A good rule of thumb for the first implementation of a module is to only add explicit options for those settings that absolutely must be set for the software to function correctly. It follows that a module for software that provides sensible default values for all settings would require no explicit options at all.
|
||||
|
||||
If the software uses a structured configuration format like a JSON, YAML, INI, TOML, or even a plain list of key/value pairs then consider using a `settings` option as described in {rfc-42}[Nix RFC 42].
|
||||
|
||||
[[sec-guidelines-add-tests]]
|
||||
==== Add relevant tests
|
||||
|
||||
If at all possible, make sure to add new tests and expand existing tests so that your change will keep working in the future. See <<sec-tests>> for more information about the Home Manager test suite.
|
||||
|
||||
All contributed code _must_ pass the test suite.
|
||||
|
||||
[[sec-guidelines-module-maintainer]]
|
||||
|
||||
==== Add relevant documentation
|
||||
:docbook: https://tdg.docbook.org/
|
||||
:asciidoc: https://asciidoc.org/
|
||||
:docbook-rocks: https://docbook.rocks/
|
||||
|
||||
Many code changes require changing the documentation as well. Module options should be documented with DocBook. See {docbook-rocks}[DocBook rocks!] for a quick introduction and {docbook}[DocBook 5: The Definitive Guide] for in-depth information of DocBook. Home Manager is itself documented using a combination of DocBook and {asciidoc}[AsciiDoc]. All text is hosted in Home Manager's Git repository.
|
||||
|
||||
The HTML version of the manual containing both the module option descriptions and the documentation of Home Manager can be generated and opened by typing the following in a shell within a clone of the Home Manager Git repository:
|
||||
|
||||
[source,console]
|
||||
$ nix-build -A docs.html
|
||||
$ xdg-open ./result/share/doc/home-manager/index.html
|
||||
|
||||
When you have made changes to a module, it is a good idea to check that the man page version of the module options looks good:
|
||||
|
||||
[source,console]
|
||||
$ nix-build -A docs.manPages
|
||||
$ man ./result/share/man/man5/home-configuration.nix.5
|
||||
|
||||
==== Add yourself as a module maintainer
|
||||
|
||||
Every new module _must_ include a named maintainer using the `meta.maintainers` attribute. If you are a user of a module that currently lacks a maintainer then please consider adopting it.
|
||||
|
||||
If you are present in the NixOS maintainer list then you can use that entry. If you are not then you can add yourself to `modules/lib/maintainers.nix` in the Home Manager project.
|
||||
|
||||
Also add yourself to `.github/CODEOWNERS` as owner of the associated module files, including the test files. You will then be automatically added as a reviewer on any new pull request that touches your files.
|
||||
|
||||
Maintainers are encouraged to join the IRC channel and participate when they have opportunity.
|
||||
|
||||
[[sec-guidelines-code-style]]
|
||||
==== Format your code
|
||||
|
||||
Make sure your code is formatted as described in <<sec-code-style>>. To maintain consistency throughout the project you are encouraged to browse through existing code and adopt its style also in new code.
|
||||
|
||||
[[sec-guidelines-commit-message-style]]
|
||||
==== Format your commit messages
|
||||
|
||||
Similar to <<sec-guidelines-code-style>> we encourage a consistent commit message format as described in <<sec-commit-style>>.
|
||||
|
||||
[[sec-guidelines-news-style]]
|
||||
==== Format your news entries
|
||||
|
||||
If your contribution includes a change that should be communicated to users of Home Manager then you can add a news entry. The entry must be formatted as described in <<sec-news>>.
|
||||
|
||||
When new modules are added a news entry should be included but you do not need to create this entry manually. The merging maintainer will create the entry for you. This is to reduce the risk of merge conflicts.
|
||||
|
||||
[[sec-guidelines-conditional-modules]]
|
||||
==== Use conditional modules and news
|
||||
|
||||
Home Manager includes a number of modules that are only usable on some of the supported platforms. The most common example of platform specific modules are those that define systemd user services, which only works on Linux systems.
|
||||
|
||||
If you add a module that is platform specific then make sure to include a condition in the `loadModule` function call. This will make the module accessible only on systems where the condition evaluates to `true`.
|
||||
|
||||
Similarly, if you are adding a news entry then it should be shown only to users that may find it relevant, see <<sec-news>> for a description of conditional news.
|
||||
|
||||
[[sec-guidelines-licensing]]
|
||||
==== Mind the license
|
||||
|
||||
The Home Manager project is covered by the MIT license and we can only accept contributions that fall under this license, or are licensed in a compatible way. When you contribute self written code and documentation it is assumed that you are doing so under the MIT license.
|
||||
|
||||
A potential gotcha with respect to licensing are option descriptions. Often it is convenient to copy from the upstream software documentation. When this is done it is important to verify that the license of the upstream documentation allows redistribution under the terms of the MIT license.
|
||||
|
||||
[[sec-commit-style]]
|
||||
=== Commits
|
||||
|
||||
The commits in your pull request should be reasonably self-contained, that is, each commit should make sense in isolation. In particular, you will be asked to amend any commit that introduces syntax errors or similar problems even if they are fixed in a later commit.
|
||||
|
||||
The commit messages should follow the {seven-rules}[seven rules]. We also ask you to include the affected code component or module in the first line. That is, a commit message should follow the template
|
||||
|
||||
----
|
||||
{component}: {description}
|
||||
|
||||
{long description}
|
||||
----
|
||||
|
||||
where `{component}` refers to the code component (or module) your change affects, `{description}` is a very brief description of your change, and `{long description}` is an optional clarifying description. Note, `{description}` should start with a lower case letter. As a rare exception, if there is no clear component, or your change affects many components, then the `{component}` part is optional. See <<ex-commit-message>> for a commit message that fulfills these requirements.
|
||||
|
||||
[[ex-commit-message]]
|
||||
.Compliant commit message
|
||||
===============================================================================
|
||||
The commit {example-commit-message}[69f8e47e9e74c8d3d060ca22e18246b7f7d988ef] contains the commit message
|
||||
|
||||
----
|
||||
starship: allow running in Emacs if vterm is used
|
||||
|
||||
The vterm buffer is backed by libvterm and can handle Starship prompts
|
||||
without issues.
|
||||
----
|
||||
|
||||
which ticks all the boxes necessary to be accepted in Home Manager.
|
||||
===============================================================================
|
||||
|
||||
Finally, when adding a new module, say `programs/foo.nix`, we use the fixed commit format `foo: add module`. You can, of course, still include a long description if you wish.
|
||||
|
||||
[[sec-code-style]]
|
||||
=== Code Style
|
||||
|
||||
The code in Home Manager is formatted by the {nixfmt}[nixfmt] tool and the formatting is checked in the pull request tests. Run the `format` tool inside the project repository before submitting your pull request.
|
||||
|
||||
Keep lines at a reasonable width, ideally 80 characters or less. This also applies to string literals.
|
||||
|
||||
We prefer `lowerCamelCase` for variable and attribute names with the accepted exception of variables directly referencing packages in Nixpkgs which use a hyphenated style. For example, the Home Manager option `services.gpg-agent.enableSshSupport` references the `gpg-agent` package in Nixpkgs.
|
||||
|
||||
[[sec-news]]
|
||||
=== News
|
||||
|
||||
Home Manager includes a system for presenting news to the user. When making a change you, therefore, have the option to also include an associated news entry. In general, a news entry should only be added for truly noteworthy news. For example, a bug fix or new option does generally not need a news entry.
|
||||
|
||||
If you do have a change worthy of a news entry then please add one in {news-nix}[`news.nix`] but you should follow some basic guidelines:
|
||||
|
||||
- The entry timestamp should be in ISO-8601 format having "+00:00" as time zone. For example, "2017-09-13T17:10:14+00:00". A suitable timestamp can be produced by the command
|
||||
+
|
||||
[source,console]
|
||||
$ date --iso-8601=second --universal
|
||||
|
||||
- The entry condition should be as specific as possible. For example, if you are changing or deprecating a specific option then you could restrict the news to those users who actually use this option.
|
||||
|
||||
- Wrap the news message so that it will fit in the typical terminal, that is, at most 80 characters wide. Ideally a bit less.
|
||||
|
||||
- Unlike commit messages, news will be read without any connection to the Home Manager source code. It is therefore important to make the message understandable in isolation and to those who do not have knowledge of the Home Manager internals. To this end it should be written in more descriptive, prose like way.
|
||||
|
||||
- If you refer to an option then write its full attribute path. That is, instead of writing
|
||||
+
|
||||
----
|
||||
The option 'foo' has been deprecated, please use 'bar' instead.
|
||||
----
|
||||
+
|
||||
it should read
|
||||
+
|
||||
----
|
||||
The option 'services.myservice.foo' has been deprecated, please
|
||||
use 'services.myservice.bar' instead.
|
||||
----
|
||||
|
||||
- A new module, say `foo.nix`, should always include a news entry that has a message along the lines of
|
||||
+
|
||||
----
|
||||
A new module is available: 'services.foo'.
|
||||
----
|
||||
+
|
||||
If the module is platform specific, e.g., a service module using systemd, then a condition like
|
||||
+
|
||||
[source,nix]
|
||||
condition = hostPlatform.isLinux;
|
||||
+
|
||||
should be added. If you contribute a module then you don't need to add this entry, the merger will create an entry for you.
|
||||
|
||||
[[sec-tests]]
|
||||
=== Tests
|
||||
|
||||
Home Manager includes a basic test suite and it is highly recommended to include at least one test when adding a module. Tests are typically in the form of "golden tests" where, for example, a generated configuration file is compared to a known correct file.
|
||||
|
||||
It is relatively easy to create tests by modeling the existing tests, found in the `tests` project directory.
|
||||
|
||||
The full Home Manager test suite can be run by executing
|
||||
|
||||
[source,console]
|
||||
$ nix-shell --pure tests -A run.all
|
||||
|
||||
in the project root. List all test cases through
|
||||
|
||||
[source,console]
|
||||
$ nix-shell --pure tests -A list
|
||||
|
||||
and run an individual test, for example `alacritty-empty-settings`, through
|
||||
|
||||
[source,console]
|
||||
$ nix-shell --pure tests -A run.alacritty-empty-settings
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
{ pkgs
|
||||
|
||||
# Note, this should be "the standard library" + HM extensions.
|
||||
lib, pkgs }:
|
||||
, lib ? import ../modules/lib/stdlib-extended.nix pkgs.lib }:
|
||||
|
||||
let
|
||||
|
||||
@@ -8,8 +9,8 @@ let
|
||||
name = "nmd";
|
||||
owner = "rycee";
|
||||
repo = "nmd";
|
||||
rev = "49567e3ff2824ac8ba457f439f384eafc1eb4547";
|
||||
sha256 = "0x2lwcryvmnr128r497bzrawi4x1yyxb4riicppdaib95iwn8jck";
|
||||
rev = "2398aa79ab12aa7aba14bc3b08a6efd38ebabdc5";
|
||||
sha256 = "0yxb48afvccn8vvpkykzcr4q1rgv8jsijqncia7a5ffzshcrwrnh";
|
||||
};
|
||||
|
||||
nmd = import nmdSrc { inherit lib pkgs; };
|
||||
@@ -32,7 +33,7 @@ let
|
||||
} ++ [ scrubbedPkgsModule ];
|
||||
moduleRootPaths = [ ./.. ];
|
||||
mkModuleUrl = path:
|
||||
"https://github.com/rycee/home-manager/blob/master/${path}#blob-path";
|
||||
"https://github.com/nix-community/home-manager/blob/master/${path}#blob-path";
|
||||
channelName = "home-manager";
|
||||
docBook.id = "home-manager-options";
|
||||
};
|
||||
|
||||
171
doc/faq.adoc
Normal file
171
doc/faq.adoc
Normal file
@@ -0,0 +1,171 @@
|
||||
[[ch-faq]]
|
||||
== Frequently Asked Questions (FAQ)
|
||||
|
||||
=== Why is there a collision error when switching generation?
|
||||
|
||||
Home Manager currently installs packages into the user environment, precisely as if the packages were installed through `nix-env --install`. This means that you will get a collision error if your Home Manager configuration attempts to install a package that you already have installed manually, that is, packages that shows up when you run `nix-env --query`.
|
||||
|
||||
For example, imagine you have the `hello` package installed in your environment
|
||||
|
||||
[source,console]
|
||||
----
|
||||
$ nix-env --query
|
||||
hello-2.10
|
||||
----
|
||||
|
||||
and your Home Manager configuration contains
|
||||
|
||||
[source,nix]
|
||||
----
|
||||
home.packages = [ pkgs.hello ];
|
||||
----
|
||||
|
||||
Then attempting to switch to this configuration will result in an error similar to
|
||||
|
||||
[source,console]
|
||||
----
|
||||
$ home-manager switch
|
||||
these derivations will be built:
|
||||
/nix/store/xg69wsnd1rp8xgs9qfsjal017nf0ldhm-home-manager-path.drv
|
||||
[…]
|
||||
Activating installPackages
|
||||
replacing old ‘home-manager-path’
|
||||
installing ‘home-manager-path’
|
||||
building path(s) ‘/nix/store/b5c0asjz9f06l52l9812w6k39ifr49jj-user-environment’
|
||||
Wide character in die at /nix/store/64jc9gd2rkbgdb4yjx3nrgc91bpjj5ky-buildenv.pl line 79.
|
||||
collision between ‘/nix/store/fmwa4axzghz11cnln5absh31nbhs9lq1-home-manager-path/bin/hello’ and ‘/nix/store/c2wyl8b9p4afivpcz8jplc9kis8rj36d-hello-2.10/bin/hello’; use ‘nix-env --set-flag priority NUMBER PKGNAME’ to change the priority of one of the conflicting packages
|
||||
builder for ‘/nix/store/b37x3s7pzxbasfqhaca5dqbf3pjjw0ip-user-environment.drv’ failed with exit code 2
|
||||
error: build of ‘/nix/store/b37x3s7pzxbasfqhaca5dqbf3pjjw0ip-user-environment.drv’ failed
|
||||
----
|
||||
|
||||
The solution is typically to uninstall the package from the environment using `nix-env --uninstall` and reattempt the Home Manager generation switch.
|
||||
|
||||
=== Why are the session variables not set?
|
||||
|
||||
Home Manager is only able to set session variables automatically if it manages your Bash or Z shell configuration. If you don't want to let Home Manager manage your shell then you will have to manually source the `~/.nix-profile/etc/profile.d/hm-session-vars.sh` file in an appropriate way. In Bash and Z shell this can be done by adding
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
|
||||
----
|
||||
|
||||
to your `.profile` and `.zshrc` files, respectively. The `hm-session-vars.sh` file should work in most Bourne-like shells.
|
||||
|
||||
=== How do set up a configuration for multiple users/machines?
|
||||
:post-your-homenix: https://www.reddit.com/r/NixOS/comments/9bb9h9/post_your_homemanager_homenix_file/
|
||||
|
||||
A typical way to prepare a repository of configurations for multiple logins and machines is to prepare one "top-level" file for each unique combination.
|
||||
|
||||
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
|
||||
|
||||
[source,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-homenix}[Post your home-manager home.nix file!] Reddit thread.
|
||||
|
||||
=== 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
|
||||
|
||||
[source,nix]
|
||||
services.dbus.packages = with pkgs; [ gnome3.dconf ];
|
||||
|
||||
to your system configuration.
|
||||
|
||||
=== How do I install packages from Nixpkgs unstable?
|
||||
|
||||
If you are using a stable version of Nixpkgs but would like to install some particular packages from Nixpkgs unstable – or some other channel – then you can import the unstable Nixpkgs and refer to its packages within your configuration. Something like
|
||||
|
||||
[source,nix]
|
||||
----
|
||||
{ pkgs, config, ... }:
|
||||
|
||||
let
|
||||
|
||||
pkgsUnstable = import <nixpkgs-unstable> {};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
home.packages = [
|
||||
pkgsUnstable.foo
|
||||
];
|
||||
|
||||
# …
|
||||
}
|
||||
----
|
||||
|
||||
should work provided you have a Nix channel called `nixpkgs-unstable`.
|
||||
|
||||
You can add the `nixpkgs-unstable` channel by running
|
||||
|
||||
[source,console]
|
||||
----
|
||||
# nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs-unstable
|
||||
# nix-channel --update
|
||||
----
|
||||
|
||||
Note, the package will not be affected by any package overrides, overlays, etc.
|
||||
|
||||
=== How do I override the package used by a module?
|
||||
:nixpkgs-overlays: https://nixos.org/nixpkgs/manual/#chap-overlays
|
||||
|
||||
By default Home Manager will install the package provided by your chosen `nixpkgs` channel but occasionally you might end up needing to change this package. This can typically be done in two ways.
|
||||
|
||||
1. If the module provides a `package` option, such as `programs.beets.package`, then this is the recommended way to perform the override. For example,
|
||||
+
|
||||
[source,nix]
|
||||
programs.beets.package = pkgs.beets.override { enableCheck = true; };
|
||||
|
||||
2. If no `package` option is available then you can typically override the relevant package using an {nixpkgs-overlays}[overlay].
|
||||
+
|
||||
For example, if you want to use the `programs.skim` module but use the `skim` package from Nixpkgs unstable, then a configuration like
|
||||
+
|
||||
[source,nix]
|
||||
----
|
||||
{ pkgs, config, ... }:
|
||||
|
||||
let
|
||||
|
||||
pkgsUnstable = import <nixpkgs-unstable> {};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
programs.skim.enable = true;
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
skim = pkgsUnstable.skim;
|
||||
})
|
||||
];
|
||||
|
||||
# …
|
||||
}
|
||||
----
|
||||
+
|
||||
should work OK.
|
||||
@@ -44,22 +44,12 @@
|
||||
<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
|
||||
Make sure you have a working Nix installation. Specifically, make
|
||||
sure that your user is able to build and install Nix packages.
|
||||
For example, you should be able to successfully run a command
|
||||
like <literal>nix-instantiate '<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>
|
||||
@@ -72,18 +62,18 @@
|
||||
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 --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager</userinput>
|
||||
<prompt>$</prompt> <userinput>nix-channel --update</userinput>
|
||||
</screen>
|
||||
<para>
|
||||
if you are following Nixpkgs master or an unstable channel and
|
||||
</para>
|
||||
<screen>
|
||||
<prompt>$</prompt> <userinput>nix-channel --add https://github.com/rycee/home-manager/archive/release-20.03.tar.gz home-manager</userinput>
|
||||
<prompt>$</prompt> <userinput>nix-channel --add https://github.com/nix-community/home-manager/archive/release-20.09.tar.gz home-manager</userinput>
|
||||
<prompt>$</prompt> <userinput>nix-channel --update</userinput>
|
||||
</screen>
|
||||
<para>
|
||||
if you follow a Nixpkgs version 20.03 channel.
|
||||
if you follow a Nixpkgs version 20.09 channel.
|
||||
</para>
|
||||
<para>
|
||||
On NixOS you may need to log out and back in for the channel to become
|
||||
@@ -159,8 +149,8 @@ $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
|
||||
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>
|
||||
<screen language="console">
|
||||
<prompt>#</prompt> <userinput>nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager</userinput>
|
||||
<prompt>#</prompt> <userinput>nix-channel --update</userinput>
|
||||
</screen>
|
||||
|
||||
@@ -168,13 +158,13 @@ $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
|
||||
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-20.03.tar.gz home-manager</userinput>
|
||||
<screen language="console">
|
||||
<prompt>#</prompt> <userinput>nix-channel --add https://github.com/nix-community/home-manager/archive/release-20.09.tar.gz home-manager</userinput>
|
||||
<prompt>#</prompt> <userinput>nix-channel --update</userinput>
|
||||
</screen>
|
||||
|
||||
<para>
|
||||
if you follow a Nixpkgs version 20.03 channel.
|
||||
if you follow a Nixpkgs version 20.09 channel.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -258,8 +248,8 @@ home-manager.useGlobalPkgs = true;
|
||||
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>
|
||||
<screen language="console">
|
||||
<prompt>#</prompt> <userinput>nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager</userinput>
|
||||
<prompt>#</prompt> <userinput>nix-channel --update</userinput>
|
||||
</screen>
|
||||
|
||||
@@ -267,13 +257,13 @@ home-manager.useGlobalPkgs = true;
|
||||
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-20.03.tar.gz home-manager</userinput>
|
||||
<screen language="console">
|
||||
<prompt>#</prompt> <userinput>nix-channel --add https://github.com/nix-community/home-manager/archive/release-20.09.tar.gz home-manager</userinput>
|
||||
<prompt>#</prompt> <userinput>nix-channel --update</userinput>
|
||||
</screen>
|
||||
|
||||
<para>
|
||||
if you follow a Nixpkgs version 20.03 channel.
|
||||
if you follow a Nixpkgs version 20.09 channel.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -323,5 +313,22 @@ home-manager.useUserPackages = true;
|
||||
value in the future.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
By default, Home Manager uses a private <literal>pkgs</literal> instance
|
||||
that is configured via the <option>home-manager.users.<name>.nixpkgs</option> options.
|
||||
To instead use the global <literal>pkgs</literal> that is configured via
|
||||
the system level <option>nixpkgs</option> options, set
|
||||
</para>
|
||||
<programlisting language="nix">
|
||||
home-manager.useGlobalPkgs = true;
|
||||
</programlisting>
|
||||
<para>
|
||||
This saves an extra Nixpkgs evaluation, adds consistency, and removes the
|
||||
dependency on <envar>NIX_PATH</envar>, which is otherwise used for
|
||||
importing Nixpkgs.
|
||||
</para>
|
||||
</note>
|
||||
</section>
|
||||
</chapter>
|
||||
|
||||
@@ -512,7 +512,7 @@
|
||||
<para>
|
||||
Please report any bugs on the
|
||||
<link
|
||||
xlink:href="https://github.com/rycee/home-manager/issues">project
|
||||
xlink:href="https://github.com/nix-community/home-manager/issues">project
|
||||
issue tracker</link>.
|
||||
</para>
|
||||
</refsection>
|
||||
|
||||
@@ -13,9 +13,12 @@
|
||||
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>.
|
||||
If you encounter problems then please reach out on the IRC channel
|
||||
<link xlink:href="https://webchat.oftc.net/?channels=home-manager">#home-manager</link>
|
||||
hosted by <link xlink:href="https://oftc.net/">OFTC</link>.
|
||||
If your problem is caused by a bug in Home Manager then it should
|
||||
be reported on the
|
||||
<link xlink:href="https://github.com/nix-community/home-manager/issues">Home Manager issue tracker</link>.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
@@ -27,6 +30,8 @@
|
||||
</preface>
|
||||
<xi:include href="installation.xml" />
|
||||
<xi:include href="writing-modules.xml" />
|
||||
<xi:include href="contributing.xml" />
|
||||
<xi:include href="faq.xml" />
|
||||
<appendix xml:id="ch-options">
|
||||
<title>Configuration Options</title>
|
||||
<xi:include href="./nmd-result/home-manager-options.xml" />
|
||||
|
||||
@@ -6,6 +6,10 @@ This section lists the release notes for stable versions of Home Manager and the
|
||||
|
||||
:leveloffset: 1
|
||||
|
||||
include::rl-2103.adoc[]
|
||||
|
||||
include::rl-2009.adoc[]
|
||||
|
||||
include::rl-2003.adoc[]
|
||||
|
||||
include::rl-1909.adoc[]
|
||||
|
||||
@@ -5,7 +5,7 @@ The 19.03 release branch became the stable branch in April, 2019.
|
||||
|
||||
[[sec-release-19.03-highlights]]
|
||||
=== Highlights
|
||||
:opt-home-file-source: opt-home.file._name__.source
|
||||
:opt-home-file-source: opt-home.file._name_.source
|
||||
|
||||
This release has the following notable changes:
|
||||
|
||||
|
||||
96
doc/release-notes/rl-2009.adoc
Normal file
96
doc/release-notes/rl-2009.adoc
Normal file
@@ -0,0 +1,96 @@
|
||||
[[sec-release-20.09]]
|
||||
== Release 20.09
|
||||
|
||||
The 20.09 release branch became the stable branch in late September, 2020.
|
||||
|
||||
[[sec-release-20.09-highlights]]
|
||||
=== Highlights
|
||||
|
||||
This release has the following notable changes:
|
||||
|
||||
* Nothing has happened.
|
||||
|
||||
[[sec-release-20.09-state-version-changes]]
|
||||
=== State Version Changes
|
||||
|
||||
The state version in this release includes the changes below. These
|
||||
changes are only active if the `home.stateVersion` option is set to
|
||||
"20.09" or later.
|
||||
|
||||
* The options <<opt-home.homeDirectory>> and <<opt-home.username>> no
|
||||
longer have default values and must therefore be provided in your
|
||||
configuration. Previously their values would default to the content of
|
||||
the environment variables `HOME` and `USER`, respectively.
|
||||
+
|
||||
--
|
||||
Further, the options <<opt-xdg.cacheHome>>, <<opt-xdg.configHome>>,
|
||||
and <<opt-xdg.dataHome>> will no longer be affected by the
|
||||
`XDG_CACHE_HOME`, `XDG_CONFIG_HOME`, and `XDG_DATA_HOME` environment
|
||||
variables. They now unconditionally default to
|
||||
|
||||
- `"${config.home.homeDirectory}/.cache"`,
|
||||
- `"${config.home.homeDirectory}/.config"`, and
|
||||
- `"${config.home.homeDirectory}/.local/share"`.
|
||||
|
||||
If you choose to switch to state version 20.09 then you must set these
|
||||
options if you use non-default XDG base directory paths.
|
||||
|
||||
The initial configuration generated by
|
||||
|
||||
[source,console]
|
||||
$ nix-shell '<home-manager>' -A install
|
||||
|
||||
will automatically include these options, when necessary.
|
||||
--
|
||||
|
||||
* Git's `smtpEncryption` option is now set to `tls` only if both <<opt-accounts.email.accounts.\_name_.smtp.tls.enable>> and <<opt-accounts.email.accounts.\_name_.smtp.tls.useStartTls>> are `true`. If only <<opt-accounts.email.accounts.\_name_.smtp.tls.enable>> is `true`, `ssl` is used instead.
|
||||
|
||||
* The `nixpkgs` module no longer references `<nixpkgs>`. Before it would do so when building the `pkgs` module argument. Starting with state version 20.09, the `pkgs` argument is instead built from the same Nixpkgs that was used to initialize the Home Manager modules. This is useful, for example, when using Home Manager within a Nix Flake. If you want to keep using `<nixpkgs>` with state version ≥ 20.09 then add
|
||||
+
|
||||
[source,nix]
|
||||
_module.args.pkgsPath = <nixpkgs>;
|
||||
+
|
||||
to your Home Manager configuration.
|
||||
|
||||
* The options `wayland.windowManager.sway.config.bars` and `opt-xsession.windowManager.i3.config.bars` have been changed so that most of the suboptions are now nullable and default to `null`. The default for these two options has been changed to manually set the old defaults for each suboption. The overall effect is that if the `bars` options is not set, then the default remains the same. On the other hand, something like:
|
||||
+
|
||||
--
|
||||
[source,nix]
|
||||
----
|
||||
bars = [ {
|
||||
command = "waybar";
|
||||
} ];
|
||||
----
|
||||
will now create the config:
|
||||
....
|
||||
bar {
|
||||
swaybar_command waybar
|
||||
}
|
||||
....
|
||||
instead of
|
||||
....
|
||||
bar {
|
||||
|
||||
font pango:monospace 8
|
||||
mode dock
|
||||
hidden_state hide
|
||||
position bottom
|
||||
status_command /nix/store/h7s6i9q1z5fxrlyyw5ls8vqxhf5bcs5a-i3status-2.13/bin/i3status
|
||||
swaybar_command waybar
|
||||
workspace_buttons yes
|
||||
strip_workspace_numbers no
|
||||
tray_output primary
|
||||
colors {
|
||||
background #000000
|
||||
statusline #ffffff
|
||||
separator #666666
|
||||
focused_workspace #4c7899 #285577 #ffffff
|
||||
active_workspace #333333 #5f676a #ffffff
|
||||
inactive_workspace #333333 #222222 #888888
|
||||
urgent_workspace #2f343a #900000 #ffffff
|
||||
binding_mode #2f343a #900000 #ffffff
|
||||
}
|
||||
|
||||
}
|
||||
....
|
||||
--
|
||||
21
doc/release-notes/rl-2103.adoc
Normal file
21
doc/release-notes/rl-2103.adoc
Normal file
@@ -0,0 +1,21 @@
|
||||
[[sec-release-21.03]]
|
||||
== Release 21.03
|
||||
|
||||
This is the current unstable branch and the information in this
|
||||
section is therefore not final.
|
||||
|
||||
[[sec-release-21.03-highlights]]
|
||||
=== Highlights
|
||||
|
||||
This release has the following notable changes:
|
||||
|
||||
* Nothing has happened.
|
||||
|
||||
[[sec-release-21.03-state-version-changes]]
|
||||
=== State Version Changes
|
||||
|
||||
The state version in this release includes the changes below. These
|
||||
changes are only active if the `home.stateVersion` option is set to
|
||||
"21.03" or later.
|
||||
|
||||
* Nothing has happened.
|
||||
@@ -168,13 +168,20 @@ Builds a GVariant array containing the given list of elements, where each elemen
|
||||
- `hm.gvariant.type.uint64`
|
||||
- `hm.gvariant.type.double`
|
||||
- `hm.gvariant.type.arrayOf type`
|
||||
- `hm.gvariant.type.maybeOf type`
|
||||
- `hm.gvariant.type.tupleOf types`
|
||||
--
|
||||
+
|
||||
where `type` and `types` are themselve a type and list of types, respectively.
|
||||
where `type` and `types` are themselves a type and list of types, respectively.
|
||||
+
|
||||
`hm.gvariant.mkEmptyArray type`:::
|
||||
An alias of `hm.gvariant.mkArray type []`.
|
||||
+
|
||||
`hm.gvariant.mkNothing type`:::
|
||||
Builds a GVariant maybe value whose (non-existent) element is of the given type. The `type` value is constructed as described for the `mkArray` function above.
|
||||
+
|
||||
`hm.gvariant.mkJust element`:::
|
||||
Builds a GVariant maybe value containing the given GVariant element.
|
||||
+
|
||||
`hm.gvariant.mkTuple elements`:::
|
||||
Builds a GVariant tuple containing the given list of elements, where each element is a GVariant value.
|
||||
|
||||
24
flake.nix
Normal file
24
flake.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
description = "Home Manager for Nix";
|
||||
|
||||
outputs = { self, nixpkgs }: rec {
|
||||
nixosModules.home-manager = import ./nixos;
|
||||
|
||||
darwinModules.home-manager = import ./nix-darwin;
|
||||
|
||||
lib = {
|
||||
hm = import ./modules/lib { lib = nixpkgs.lib; };
|
||||
homeManagerConfiguration = { configuration, system, homeDirectory
|
||||
, username, extraSpecialArgs ? { }
|
||||
, pkgs ? builtins.getAttr system nixpkgs.outputs.legacyPackages
|
||||
, check ? true }@args:
|
||||
import ./modules {
|
||||
inherit pkgs check extraSpecialArgs;
|
||||
configuration = { ... }: {
|
||||
imports = [ configuration ];
|
||||
home = { inherit homeDirectory username; };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
format
6
format
@@ -27,22 +27,17 @@ find . -name '*.nix' \
|
||||
! -path ./modules/lib/file-type.nix \
|
||||
! -path ./modules/manual.nix \
|
||||
! -path ./modules/misc/dconf.nix \
|
||||
! -path ./modules/misc/gtk.nix \
|
||||
! -path ./modules/misc/news.nix \
|
||||
! -path ./modules/misc/nixpkgs.nix \
|
||||
! -path ./modules/misc/xdg.nix \
|
||||
! -path ./modules/modules.nix \
|
||||
! -path ./modules/programs/afew.nix \
|
||||
! -path ./modules/programs/alot.nix \
|
||||
! -path ./modules/programs/bash.nix \
|
||||
! -path ./modules/programs/emacs.nix \
|
||||
! -path ./modules/programs/firefox.nix \
|
||||
! -path ./modules/programs/gpg.nix \
|
||||
! -path ./modules/programs/lesspipe.nix \
|
||||
! -path ./modules/programs/neovim.nix \
|
||||
! -path ./modules/programs/ssh.nix \
|
||||
! -path ./modules/programs/tmux.nix \
|
||||
! -path ./modules/programs/vscode.nix \
|
||||
! -path ./modules/programs/zsh.nix \
|
||||
! -path ./modules/services/gpg-agent.nix \
|
||||
! -path ./modules/services/kbfs.nix \
|
||||
@@ -59,7 +54,6 @@ find . -name '*.nix' \
|
||||
! -path ./tests/modules/programs/tmux/default.nix \
|
||||
! -path ./tests/modules/programs/zsh/session-variables.nix \
|
||||
! -path ./tests/modules/services/sxhkd/service.nix \
|
||||
! -path ./tests/modules/systemd/default.nix \
|
||||
! -path ./tests/modules/systemd/services.nix \
|
||||
! -path ./tests/modules/systemd/session-variables.nix \
|
||||
-exec nixfmt $CHECK_ARG {} +
|
||||
|
||||
@@ -165,7 +165,11 @@ function doEdit() {
|
||||
|
||||
setConfigFile
|
||||
|
||||
exec "$EDITOR" "$HOME_MANAGER_CONFIG"
|
||||
# Don't quote $EDITOR in order to support values including options, e.g.,
|
||||
# "code --wait".
|
||||
#
|
||||
# shellcheck disable=2086
|
||||
exec $EDITOR "$HOME_MANAGER_CONFIG"
|
||||
}
|
||||
|
||||
function doBuild() {
|
||||
@@ -221,7 +225,7 @@ function doListGens() {
|
||||
color="always"
|
||||
fi
|
||||
|
||||
pushd "/nix/var/nix/profiles/per-user/$USER" > /dev/null
|
||||
pushd "$NIX_STATE_DIR/profiles/per-user/$USER" > /dev/null
|
||||
# shellcheck disable=2012
|
||||
ls --color=$color -gG --time-style=long-iso --sort time home-manager-*-link \
|
||||
| cut -d' ' -f 4- \
|
||||
@@ -234,7 +238,7 @@ function doListGens() {
|
||||
function doRmGenerations() {
|
||||
setVerboseAndDryRun
|
||||
|
||||
pushd "/nix/var/nix/profiles/per-user/$USER" > /dev/null
|
||||
pushd "$NIX_STATE_DIR/profiles/per-user/$USER" > /dev/null
|
||||
|
||||
for generationId in "$@"; do
|
||||
local linkName="home-manager-$generationId-link"
|
||||
@@ -254,11 +258,11 @@ function doRmGenerations() {
|
||||
|
||||
function doRmAllGenerations() {
|
||||
$DRY_RUN_CMD rm $VERBOSE_ARG \
|
||||
"/nix/var/nix/profiles/per-user/$USER/home-manager"*
|
||||
"$NIX_STATE_DIR/profiles/per-user/$USER/home-manager"*
|
||||
}
|
||||
|
||||
function doExpireGenerations() {
|
||||
local profileDir="/nix/var/nix/profiles/per-user/$USER"
|
||||
local profileDir="$NIX_STATE_DIR/profiles/per-user/$USER"
|
||||
|
||||
local generations
|
||||
generations="$( \
|
||||
@@ -368,11 +372,12 @@ function doUninstall() {
|
||||
HOME_MANAGER_CONFIG="$(mktemp --tmpdir home-manager.XXXXXXXXXX)"
|
||||
echo "{ lib, ... }: { home.file = lib.mkForce {}; }" > "$HOME_MANAGER_CONFIG"
|
||||
doSwitch
|
||||
$DRY_RUN_CMD nix-env -e home-manager-path || true
|
||||
rm "$HOME_MANAGER_CONFIG"
|
||||
$DRY_RUN_CMD rm $VERBOSE_ARG -r \
|
||||
"${XDG_DATA_HOME:-$HOME/.local/share}/home-manager"
|
||||
$DRY_RUN_CMD rm $VERBOSE_ARG \
|
||||
"/nix/var/nix/gcroots/per-user/$USER/current-home"
|
||||
"$NIX_STATE_DIR/gcroots/per-user/$USER/current-home"
|
||||
;;
|
||||
*)
|
||||
echo "Yay!"
|
||||
@@ -454,6 +459,8 @@ function doHelp() {
|
||||
echo " uninstall Remove Home Manager"
|
||||
}
|
||||
|
||||
readonly NIX_STATE_DIR="${NIX_STATE_DIR:-/nix/var/nix}"
|
||||
|
||||
EXTRA_NIX_PATH=()
|
||||
HOME_MANAGER_CONFIG_ATTRIBUTE=""
|
||||
PASSTHROUGH_OPTS=()
|
||||
@@ -505,6 +512,10 @@ while [[ $# -gt 0 ]]; do
|
||||
-v|--verbose)
|
||||
export VERBOSE=1
|
||||
;;
|
||||
--version)
|
||||
echo 20.09
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
case $COMMAND in
|
||||
expire-generations|remove-generations)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ pkgs ? import <nixpkgs> {}
|
||||
, confPath
|
||||
, confAttr
|
||||
, confAttr ? null
|
||||
, check ? true
|
||||
, newsReadIdsFile ? null
|
||||
}:
|
||||
@@ -11,7 +11,7 @@ let
|
||||
|
||||
env = import ../modules {
|
||||
configuration =
|
||||
if confAttr == ""
|
||||
if confAttr == "" || confAttr == null
|
||||
then confPath
|
||||
else (import confPath).${confAttr};
|
||||
pkgs = pkgs;
|
||||
|
||||
@@ -12,6 +12,18 @@ runCommand "home-manager-install" {
|
||||
echo
|
||||
echo "Creating initial Home Manager configuration..."
|
||||
|
||||
nl=$'\n'
|
||||
xdgVars=""
|
||||
if [[ -v XDG_CACHE_HOME && $XDG_CACHE_HOME != "$HOME/.cache" ]]; then
|
||||
xdgVars="$xdgVars xdg.cacheHome = \"$XDG_CACHE_HOME\";$nl"
|
||||
fi
|
||||
if [[ -v XDG_CONFIG_HOME && $XDG_CONFIG_HOME != "$HOME/.config" ]]; then
|
||||
xdgVars="$xdgVars xdg.configHome = \"$XDG_CONFIG_HOME\";$nl"
|
||||
fi
|
||||
if [[ -v XDG_DATA_HOME && $XDG_DATA_HOME != "$HOME/.local/share" ]]; then
|
||||
xdgVars="$xdgVars xdg.dataHome = \"$XDG_DATA_HOME\";$nl"
|
||||
fi
|
||||
|
||||
mkdir -p "$(dirname "$confFile")"
|
||||
cat > $confFile <<EOF
|
||||
{ config, pkgs, ... }:
|
||||
@@ -20,6 +32,11 @@ runCommand "home-manager-install" {
|
||||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
# Home Manager needs a bit of information about you and the
|
||||
# paths it should manage.
|
||||
home.username = "$USER";
|
||||
home.homeDirectory = "$HOME";
|
||||
$xdgVars
|
||||
# This value determines the Home Manager release that your
|
||||
# configuration is compatible with. This helps avoid breakage
|
||||
# when a new Home Manager release introduces backwards
|
||||
@@ -28,7 +45,7 @@ runCommand "home-manager-install" {
|
||||
# You can update Home Manager without changing this value. See
|
||||
# the Home Manager release notes for a list of state version
|
||||
# changes in each release.
|
||||
home.stateVersion = "20.03";
|
||||
home.stateVersion = "21.03";
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
@@ -54,7 +71,7 @@ runCommand "home-manager-install" {
|
||||
|
||||
Uh oh, the installation failed! Please create an issue at
|
||||
|
||||
https://github.com/rycee/home-manager/issues
|
||||
https://github.com/nix-community/home-manager/issues
|
||||
|
||||
if the error seems to be the fault of Home Manager.
|
||||
EOF
|
||||
|
||||
@@ -374,19 +374,7 @@ in {
|
||||
};
|
||||
|
||||
accounts = mkOption {
|
||||
type = types.attrsOf (types.submodule ([
|
||||
mailAccountOpts
|
||||
(import ../programs/alot-accounts.nix pkgs)
|
||||
(import ../programs/astroid-accounts.nix)
|
||||
(import ../programs/getmail-accounts.nix)
|
||||
(import ../programs/lieer-accounts.nix)
|
||||
(import ../programs/mbsync-accounts.nix)
|
||||
(import ../programs/msmtp-accounts.nix)
|
||||
(import ../programs/neomutt-accounts.nix)
|
||||
(import ../programs/notmuch-accounts.nix)
|
||||
(import ../programs/offlineimap-accounts.nix)
|
||||
] ++ optionals pkgs.stdenv.hostPlatform.isLinux
|
||||
[ (import ../services/lieer-accounts.nix) ]));
|
||||
type = types.attrsOf (types.submodule mailAccountOpts);
|
||||
default = { };
|
||||
description = "List of email accounts.";
|
||||
};
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
# Whether to check that each option has a matching declaration.
|
||||
, check ? true
|
||||
# Extra arguments passed to specialArgs.
|
||||
, extraSpecialArgs ? { }
|
||||
}:
|
||||
|
||||
with lib;
|
||||
@@ -31,7 +33,7 @@ let
|
||||
modules = [ configuration ] ++ hmModules;
|
||||
specialArgs = {
|
||||
modulesPath = builtins.toString ./.;
|
||||
};
|
||||
} // extraSpecialArgs;
|
||||
};
|
||||
|
||||
module = showWarnings (
|
||||
|
||||
@@ -39,6 +39,13 @@ in
|
||||
};
|
||||
|
||||
config = {
|
||||
lib.file.mkOutOfStoreSymlink = path:
|
||||
let
|
||||
pathStr = toString path;
|
||||
name = hm.strings.storeFileName (baseNameOf pathStr);
|
||||
in
|
||||
pkgs.runCommandLocal name {} ''ln -s ${escapeShellArg pathStr} $out'';
|
||||
|
||||
# This verifies that the links we are about to create will not
|
||||
# overwrite an existing file.
|
||||
home.activation.checkLinkTargets = hm.dag.entryBefore ["writeBoundary"] (
|
||||
@@ -83,10 +90,10 @@ in
|
||||
errorEcho "Existing file '$backup' would be clobbered by backing up '$targetPath'"
|
||||
collision=1
|
||||
else
|
||||
warnEcho "Existing file '$targetPath' is in the way, will be moved to '$backup'"
|
||||
warnEcho "Existing file '$targetPath' is in the way of '$sourcePath', will be moved to '$backup'"
|
||||
fi
|
||||
else
|
||||
errorEcho "Existing file '$targetPath' is in the way"
|
||||
errorEcho "Existing file '$targetPath' is in the way of '$sourcePath'"
|
||||
collision=1
|
||||
fi
|
||||
fi
|
||||
@@ -162,7 +169,7 @@ in
|
||||
if [[ -e "$newGenFiles/$relativePath" ]] ; then
|
||||
$VERBOSE_ECHO "Checking $targetPath: exists"
|
||||
elif [[ ! "$(readlink "$targetPath")" == $homeFilePattern ]] ; then
|
||||
warnEcho "Path '$targetPath' not link into Home Manager generation. Skipping delete."
|
||||
warnEcho "Path '$targetPath' does not link into a Home Manager generation. Skipping delete."
|
||||
else
|
||||
$VERBOSE_ECHO "Checking $targetPath: gone (deleting)"
|
||||
$DRY_RUN_CMD rm $VERBOSE_ARG "$targetPath"
|
||||
@@ -250,7 +257,7 @@ in
|
||||
home-files = pkgs.runCommand
|
||||
"home-manager-files"
|
||||
{
|
||||
nativeBuildInputs = [ pkgs.xlibs.lndir ];
|
||||
nativeBuildInputs = [ pkgs.xorg.lndir ];
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
}
|
||||
@@ -309,12 +316,15 @@ in
|
||||
}
|
||||
'' + concatStrings (
|
||||
mapAttrsToList (n: v: ''
|
||||
insertFile "${sourceStorePath v}" \
|
||||
"${v.target}" \
|
||||
"${if v.executable == null
|
||||
then "inherit"
|
||||
else builtins.toString v.executable}" \
|
||||
"${builtins.toString v.recursive}"
|
||||
insertFile ${
|
||||
escapeShellArgs [
|
||||
(sourceStorePath v)
|
||||
v.target
|
||||
(if v.executable == null
|
||||
then "inherit"
|
||||
else toString v.executable)
|
||||
(toString v.recursive)
|
||||
]}
|
||||
'') cfg
|
||||
));
|
||||
};
|
||||
|
||||
@@ -16,11 +16,35 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
address = mkOption {
|
||||
ctype = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
The language to use for addresses.
|
||||
Character classification category.
|
||||
'';
|
||||
};
|
||||
|
||||
numeric = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
The language to use for numerical values.
|
||||
'';
|
||||
};
|
||||
|
||||
time = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
The language to use for formatting times.
|
||||
'';
|
||||
};
|
||||
|
||||
collate = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
The language to use for collation (alphabetical ordering).
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -32,6 +56,14 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
messages = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
The language to use for messages, application UI languages, etc.
|
||||
'';
|
||||
};
|
||||
|
||||
paper = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.str;
|
||||
@@ -40,13 +72,38 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
time = mkOption {
|
||||
name = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
The language to use for formatting times.
|
||||
The language to use for personal names.
|
||||
'';
|
||||
};
|
||||
|
||||
address = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
The language to use for addresses.
|
||||
'';
|
||||
};
|
||||
|
||||
telephone = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
The language to use for telephone numbers.
|
||||
'';
|
||||
};
|
||||
|
||||
measurement = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
The language to use for measurement values.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
@@ -125,14 +182,23 @@ in
|
||||
options = {
|
||||
home.username = mkOption {
|
||||
type = types.str;
|
||||
defaultText = "$USER";
|
||||
defaultText = literalExample ''
|
||||
"$USER" for state version < 20.09,
|
||||
undefined for state version ≥ 20.09
|
||||
'';
|
||||
example = "jane.doe";
|
||||
description = "The user's username.";
|
||||
};
|
||||
|
||||
home.homeDirectory = mkOption {
|
||||
type = types.path;
|
||||
defaultText = "$HOME";
|
||||
description = "The user's home directory.";
|
||||
defaultText = literalExample ''
|
||||
"$HOME" for state version < 20.09,
|
||||
undefined for state version ≥ 20.09
|
||||
'';
|
||||
apply = toString;
|
||||
example = "/home/jane.doe";
|
||||
description = "The user's home directory. Must be an absolute path.";
|
||||
};
|
||||
|
||||
home.profileDirectory = mkOption {
|
||||
@@ -198,6 +264,17 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
home.sessionPath = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
example = [
|
||||
".git/safe/../../bin"
|
||||
"\${xdg.configHome}/emacs/bin"
|
||||
"~/.local/bin"
|
||||
];
|
||||
description = "Extra directories to add to <envar>PATH</envar>.";
|
||||
};
|
||||
|
||||
home.sessionVariablesExtra = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
@@ -327,13 +404,17 @@ in
|
||||
}
|
||||
];
|
||||
|
||||
home.username = mkDefault (builtins.getEnv "USER");
|
||||
home.homeDirectory = mkDefault (builtins.getEnv "HOME");
|
||||
home.username =
|
||||
mkIf (versionOlder config.home.stateVersion "20.09")
|
||||
(mkDefault (builtins.getEnv "USER"));
|
||||
home.homeDirectory =
|
||||
mkIf (versionOlder config.home.stateVersion "20.09")
|
||||
(mkDefault (builtins.getEnv "HOME"));
|
||||
|
||||
home.profileDirectory =
|
||||
if config.submoduleSupport.enable
|
||||
&& config.submoduleSupport.externalPackageInstall
|
||||
then config.home.path
|
||||
then "/etc/profiles/per-user/${cfg.username}"
|
||||
else cfg.homeDirectory + "/.nix-profile";
|
||||
|
||||
home.sessionVariables =
|
||||
@@ -342,13 +423,27 @@ in
|
||||
in
|
||||
(maybeSet "LANG" cfg.language.base)
|
||||
//
|
||||
(maybeSet "LC_ADDRESS" cfg.language.address)
|
||||
(maybeSet "LC_CTYPE" cfg.language.ctype)
|
||||
//
|
||||
(maybeSet "LC_NUMERIC" cfg.language.numeric)
|
||||
//
|
||||
(maybeSet "LC_TIME" cfg.language.time)
|
||||
//
|
||||
(maybeSet "LC_COLLATE" cfg.language.collate)
|
||||
//
|
||||
(maybeSet "LC_MONETARY" cfg.language.monetary)
|
||||
//
|
||||
(maybeSet "LC_MESSAGES" cfg.language.messages)
|
||||
//
|
||||
(maybeSet "LC_PAPER" cfg.language.paper)
|
||||
//
|
||||
(maybeSet "LC_TIME" cfg.language.time);
|
||||
(maybeSet "LC_NAME" cfg.language.name)
|
||||
//
|
||||
(maybeSet "LC_ADDRESS" cfg.language.address)
|
||||
//
|
||||
(maybeSet "LC_TELEPHONE" cfg.language.telephone)
|
||||
//
|
||||
(maybeSet "LC_MEASUREMENT" cfg.language.measurement);
|
||||
|
||||
home.packages = [
|
||||
# Provide a file holding all session variables.
|
||||
@@ -362,6 +457,8 @@ in
|
||||
export __HM_SESS_VARS_SOURCED=1
|
||||
|
||||
${config.lib.shell.exportAll cfg.sessionVariables}
|
||||
'' + lib.optionalString (cfg.sessionPath != [ ]) ''
|
||||
export PATH="$PATH''${PATH:+:}${concatStringsSep ":" cfg.sessionPath}"
|
||||
'' + cfg.sessionVariablesExtra;
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function setupVars() {
|
||||
local profilesPath="/nix/var/nix/profiles/per-user/$USER"
|
||||
local gcPath="/nix/var/nix/gcroots/per-user/$USER"
|
||||
local greatestGenNum
|
||||
local nixStateDir="${NIX_STATE_DIR:-/nix/var/nix}"
|
||||
local profilesPath="$nixStateDir/profiles/per-user/$USER"
|
||||
local gcPath="$nixStateDir/gcroots/per-user/$USER"
|
||||
|
||||
genProfilePath="$profilesPath/home-manager"
|
||||
newGenPath="@GENERATION_DIR@";
|
||||
newGenGcPath="$gcPath/current-home"
|
||||
|
||||
local greatestGenNum
|
||||
greatestGenNum=$( \
|
||||
find "$profilesPath" -name 'home-manager-*-link' \
|
||||
| sed 's/^.*-\([0-9]*\)-link$/\1/' \
|
||||
| sort -rn \
|
||||
| head -1)
|
||||
nix-env --list-generations --profile "$genProfilePath" \
|
||||
| tail -1 \
|
||||
| sed -E 's/ *([[:digit:]]+) .*/\1/')
|
||||
|
||||
if [[ -n $greatestGenNum ]] ; then
|
||||
oldGenNum=$greatestGenNum
|
||||
@@ -18,15 +22,15 @@ function setupVars() {
|
||||
newGenNum=1
|
||||
fi
|
||||
|
||||
if [[ -e $gcPath/current-home ]] ; then
|
||||
oldGenPath="$(readlink -e "$gcPath/current-home")"
|
||||
if [[ -e $profilesPath/home-manager ]] ; then
|
||||
oldGenPath="$(readlink -e "$profilesPath/home-manager")"
|
||||
fi
|
||||
|
||||
$VERBOSE_ECHO "Sanity checking oldGenNum and oldGenPath"
|
||||
if [[ -v oldGenNum && ! -v oldGenPath
|
||||
|| ! -v oldGenNum && -v oldGenPath ]]; then
|
||||
errorEcho "Invalid profile number and GC root values! These must be"
|
||||
errorEcho "either both empty or both set but are now set to"
|
||||
errorEcho "Invalid profile number and current profile values! These"
|
||||
errorEcho "must be either both empty or both set but are now set to"
|
||||
errorEcho " '${oldGenNum:-}' and '${oldGenPath:-}'"
|
||||
errorEcho "If you don't mind losing previous profile generations then"
|
||||
errorEcho "the easiest solution is probably to run"
|
||||
@@ -35,12 +39,6 @@ function setupVars() {
|
||||
errorEcho "and trying home-manager switch again. Good luck!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
genProfilePath="$profilesPath/home-manager"
|
||||
newGenPath="@GENERATION_DIR@";
|
||||
newGenProfilePath="$profilesPath/home-manager-$newGenNum-link"
|
||||
newGenGcPath="$gcPath/current-home"
|
||||
}
|
||||
|
||||
if [[ -v VERBOSE ]]; then
|
||||
@@ -53,6 +51,11 @@ fi
|
||||
|
||||
echo "Starting home manager activation"
|
||||
|
||||
# Verify that we can connect to the Nix store and/or daemon. This will
|
||||
# also create the necessary directories in profiles and gcroots.
|
||||
$VERBOSE_ECHO "Sanity checking Nix"
|
||||
nix-build --expr '{}' --no-out-link
|
||||
|
||||
setupVars
|
||||
|
||||
if [[ -v DRY_RUN ]] ; then
|
||||
@@ -78,6 +81,5 @@ else
|
||||
fi
|
||||
$VERBOSE_ECHO " newGenPath=$newGenPath"
|
||||
$VERBOSE_ECHO " newGenNum=$newGenNum"
|
||||
$VERBOSE_ECHO " newGenProfilePath=$newGenProfilePath"
|
||||
$VERBOSE_ECHO " newGenGcPath=$newGenGcPath"
|
||||
$VERBOSE_ECHO " genProfilePath=$genProfilePath"
|
||||
|
||||
@@ -17,7 +17,7 @@ rec {
|
||||
};
|
||||
|
||||
gvariant = import ./gvariant.nix { inherit lib; };
|
||||
|
||||
maintainers = import ./maintainers.nix;
|
||||
strings = import ./strings.nix { inherit lib; };
|
||||
types = import ./types.nix { inherit dag gvariant lib; };
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ with lib;
|
||||
# Arguments:
|
||||
# - basePathDesc docbook compatible description of the base path
|
||||
# - basePath the file base path
|
||||
fileType = basePathDesc: basePath: types.loaOf (types.submodule (
|
||||
fileType = basePathDesc: basePath: types.attrsOf (types.submodule (
|
||||
{ name, config, ... }: {
|
||||
options = {
|
||||
target = mkOption {
|
||||
@@ -21,6 +21,7 @@ with lib;
|
||||
absPath = if hasPrefix "/" p then p else "${basePath}/${p}";
|
||||
in
|
||||
removePrefix (homeDirectory + "/") absPath;
|
||||
defaultText = literalExample "<name>";
|
||||
description = ''
|
||||
Path to target file relative to ${basePathDesc}.
|
||||
'';
|
||||
@@ -29,17 +30,20 @@ with lib;
|
||||
text = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.lines;
|
||||
description = "Text of the file.";
|
||||
description = ''
|
||||
Text of the file. If this option is null then
|
||||
<link linkend="opt-home.file._name_.source">home.file.<name?>.source</link>
|
||||
must be set.
|
||||
'';
|
||||
};
|
||||
|
||||
source = mkOption {
|
||||
type = types.path;
|
||||
description = ''
|
||||
Path of the source file. The file name must not start
|
||||
with a period since Nix will not allow such names in
|
||||
the Nix store.
|
||||
</para><para>
|
||||
This may refer to a directory.
|
||||
Path of the source file or directory. If
|
||||
<link linkend="opt-home.file._name_.text">home.file.<name?>.text</link>
|
||||
is non-null then this option will automatically point to a file
|
||||
containing that text.
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ let
|
||||
|
||||
type = {
|
||||
arrayOf = t: "a${t}";
|
||||
maybeOf = t: "m${t}";
|
||||
tupleOf = ts: "(${concatStrings ts})";
|
||||
string = "s";
|
||||
boolean = "b";
|
||||
@@ -57,11 +58,21 @@ let
|
||||
else
|
||||
"";
|
||||
|
||||
mkMaybe = elemType: elem:
|
||||
mkPrimitive (type.maybeOf elemType) elem // {
|
||||
__toString = self:
|
||||
if self.value == null then
|
||||
"@${self.type} nothing"
|
||||
else
|
||||
"just ${toString self.value}";
|
||||
};
|
||||
|
||||
in rec {
|
||||
|
||||
inherit type typeOf;
|
||||
|
||||
isArray = hasPrefix "a";
|
||||
isMaybe = hasPrefix "m";
|
||||
isTuple = hasPrefix "(";
|
||||
|
||||
# Returns the GVariant value that most closely matches the given Nix
|
||||
@@ -92,6 +103,10 @@ in rec {
|
||||
|
||||
mkEmptyArray = elemType: mkArray elemType [ ];
|
||||
|
||||
mkNothing = elemType: mkMaybe elemType null;
|
||||
|
||||
mkJust = elem: let gvarElem = mkValue elem; in mkMaybe gvarElem.type gvarElem;
|
||||
|
||||
mkTuple = elems:
|
||||
let
|
||||
gvarElems = map mkValue elems;
|
||||
@@ -108,7 +123,7 @@ in rec {
|
||||
|
||||
mkString = v:
|
||||
mkPrimitive type.string v // {
|
||||
__toString = self: "'${escape [ "'" ] self.value}'";
|
||||
__toString = self: "'${escape [ "'" "\\" ] self.value}'";
|
||||
};
|
||||
|
||||
mkObjectpath = v:
|
||||
|
||||
44
modules/lib/maintainers.nix
Normal file
44
modules/lib/maintainers.nix
Normal file
@@ -0,0 +1,44 @@
|
||||
# Home Manager maintainers.
|
||||
#
|
||||
# This attribute set contains Home Manager module maintainers that do
|
||||
# not have an entry in the Nixpkgs maintainer list [1]. Entries here
|
||||
# are expected to be follow the same format as described in [1].
|
||||
#
|
||||
# [1] https://github.com/NixOS/nixpkgs/blob/fca0d6e093c82b31103dc0dacc48da2a9b06e24b/maintainers/maintainer-list.nix#LC1
|
||||
|
||||
{
|
||||
justinlovinger = {
|
||||
name = "Justin Lovinger";
|
||||
email = "git@justinlovinger.com";
|
||||
github = "JustinLovinger";
|
||||
githubId = 7183441;
|
||||
};
|
||||
owm111 = {
|
||||
email = "7798336+owm111@users.noreply.github.com";
|
||||
name = "Owen McGrath";
|
||||
github = "owm111";
|
||||
githubId = 7798336;
|
||||
};
|
||||
cwyc = {
|
||||
email = "cwyc@users.noreply.github.com";
|
||||
name = "cwyc";
|
||||
github = "cwyc";
|
||||
githubId = 16950437;
|
||||
};
|
||||
olmokramer = {
|
||||
name = "Olmo Kramer";
|
||||
email = "olmokramer@users.noreply.github.com";
|
||||
github = "olmokramer";
|
||||
githubId = 3612514;
|
||||
};
|
||||
seylerius = {
|
||||
email = "sable@seyleri.us";
|
||||
name = "Sable Seyler";
|
||||
github = "seylerius";
|
||||
githubId = 1145981;
|
||||
keys = [{
|
||||
logkeyid = "rsa4096/0x68BF2EAE6D91CAFF";
|
||||
fingerprint = "F0E0 0311 126A CD72 4392 25E6 68BF 2EAE 6D91 CAFF";
|
||||
}];
|
||||
};
|
||||
}
|
||||
@@ -77,6 +77,8 @@ in rec {
|
||||
(map (d: d // { value = d.value.value; }) vdefs)
|
||||
else if gvar.isTuple sharedDefType && allChecked then
|
||||
mergeOneOption loc defs
|
||||
else if gvar.isMaybe sharedDefType && allChecked then
|
||||
mergeOneOption loc defs
|
||||
else if gvar.type.string == sharedDefType && allChecked then
|
||||
types.str.merge loc defs
|
||||
else if gvar.type.double == sharedDefType && allChecked then
|
||||
|
||||
@@ -61,9 +61,9 @@ in
|
||||
fi
|
||||
|
||||
if [[ -v DRY_RUN ]]; then
|
||||
echo $DCONF_DBUS_RUN_SESSION ${pkgs.gnome3.dconf}/bin/dconf load / "<" ${iniFile}
|
||||
echo $DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / "<" ${iniFile}
|
||||
else
|
||||
$DCONF_DBUS_RUN_SESSION ${pkgs.gnome3.dconf}/bin/dconf load / < ${iniFile}
|
||||
$DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / < ${iniFile}
|
||||
fi
|
||||
|
||||
unset DCONF_DBUS_RUN_SESSION
|
||||
|
||||
@@ -11,21 +11,22 @@ let
|
||||
toGtk3Ini = generators.toINI {
|
||||
mkKeyValue = key: value:
|
||||
let
|
||||
value' =
|
||||
if isBool value then (if value then "true" else "false")
|
||||
else toString value;
|
||||
in
|
||||
"${key}=${value'}";
|
||||
value' = if isBool value then
|
||||
(if value then "true" else "false")
|
||||
else
|
||||
toString value;
|
||||
in "${key}=${value'}";
|
||||
};
|
||||
|
||||
formatGtk2Option = n: v:
|
||||
let
|
||||
v' =
|
||||
if isBool v then (if v then "true" else "false")
|
||||
else if isString v then "\"${v}\""
|
||||
else toString v;
|
||||
in
|
||||
"${n} = ${v'}";
|
||||
v' = if isBool v then
|
||||
(if v then "true" else "false")
|
||||
else if isString v then
|
||||
''"${v}"''
|
||||
else
|
||||
toString v;
|
||||
in "${n} = ${v'}";
|
||||
|
||||
themeType = types.submodule {
|
||||
options = {
|
||||
@@ -48,13 +49,11 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
in {
|
||||
meta.maintainers = [ maintainers.rycee ];
|
||||
|
||||
imports = [
|
||||
(mkRemovedOptionModule ["gtk" "gtk3" "waylandSupport"] ''
|
||||
(mkRemovedOptionModule [ "gtk" "gtk3" "waylandSupport" ] ''
|
||||
This options is not longer needed and can be removed.
|
||||
'')
|
||||
];
|
||||
@@ -105,8 +104,11 @@ in
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = with types; attrsOf (either bool (either int str));
|
||||
default = {};
|
||||
example = { gtk-cursor-blink = false; gtk-recent-files-limit = 20; };
|
||||
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>.
|
||||
@@ -125,52 +127,38 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (
|
||||
let
|
||||
ini =
|
||||
optionalAttrs (cfg.font != null)
|
||||
{ gtk-font-name = cfg.font.name; }
|
||||
//
|
||||
optionalAttrs (cfg.theme != null)
|
||||
{ gtk-theme-name = cfg.theme.name; }
|
||||
//
|
||||
optionalAttrs (cfg.iconTheme != null)
|
||||
{ gtk-icon-theme-name = cfg.iconTheme.name; };
|
||||
config = mkIf cfg.enable (let
|
||||
ini = optionalAttrs (cfg.font != null) { gtk-font-name = cfg.font.name; }
|
||||
// optionalAttrs (cfg.theme != null) { gtk-theme-name = cfg.theme.name; }
|
||||
// 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; };
|
||||
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
|
||||
++ optionalPackage cfg.iconTheme;
|
||||
optionalPackage = opt:
|
||||
optional (opt != null && opt.package != null) opt.package;
|
||||
in {
|
||||
home.packages = optionalPackage cfg.font ++ optionalPackage cfg.theme
|
||||
++ optionalPackage cfg.iconTheme;
|
||||
|
||||
home.file.".gtkrc-2.0".text =
|
||||
concatStringsSep "\n" (
|
||||
mapAttrsToList formatGtk2Option ini
|
||||
) + "\n" + cfg2.extraConfig;
|
||||
home.file.".gtkrc-2.0".text =
|
||||
concatStringsSep "\n" (mapAttrsToList formatGtk2Option ini) + "\n"
|
||||
+ cfg2.extraConfig;
|
||||
|
||||
xdg.configFile."gtk-3.0/settings.ini".text =
|
||||
toGtk3Ini { Settings = ini // cfg3.extraConfig; };
|
||||
xdg.configFile."gtk-3.0/settings.ini".text =
|
||||
toGtk3Ini { Settings = ini // cfg3.extraConfig; };
|
||||
|
||||
xdg.configFile."gtk-3.0/gtk.css".text = cfg3.extraCss;
|
||||
xdg.configFile."gtk-3.0/gtk.css".text = cfg3.extraCss;
|
||||
|
||||
xdg.configFile."gtk-3.0/bookmarks" = mkIf (cfg3.bookmarks != []) {
|
||||
text = concatStringsSep "\n" cfg3.bookmarks;
|
||||
};
|
||||
xdg.configFile."gtk-3.0/bookmarks" = mkIf (cfg3.bookmarks != [ ]) {
|
||||
text = concatStringsSep "\n" cfg3.bookmarks;
|
||||
};
|
||||
|
||||
dconf.settings."org/gnome/desktop/interface" = dconfIni;
|
||||
}
|
||||
);
|
||||
dconf.settings."org/gnome/desktop/interface" = dconfIni;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -452,7 +452,7 @@ in
|
||||
|
||||
{
|
||||
time = "2017-12-11T17:23:12+00:00";
|
||||
condition = config.home.activation ? reloadSystemD;
|
||||
condition = config.home.activation ? reloadSystemd;
|
||||
message = ''
|
||||
The Boolean option 'systemd.user.startServices' is now
|
||||
available. When enabled the current naive systemd unit
|
||||
@@ -508,7 +508,7 @@ in
|
||||
configuration you can add
|
||||
|
||||
imports = [
|
||||
"''${builtins.fetchTarball https://github.com/rycee/home-manager/archive/master.tar.gz}/nixos"
|
||||
"''${builtins.fetchTarball https://github.com/nix-community/home-manager/archive/master.tar.gz}/nixos"
|
||||
];
|
||||
|
||||
to your 'configuration.nix' file. This will introduce a new
|
||||
@@ -1363,7 +1363,7 @@ in
|
||||
|
||||
To learn more, see the installation section of the manual
|
||||
|
||||
https://rycee.gitlab.io/home-manager/#sec-install-nixos-module
|
||||
https://nix-community.github.io/home-manager/#sec-install-nixos-module
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -1474,6 +1474,267 @@ in
|
||||
A new module is available: 'services.mako'
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-04-23T19:45:26+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.lf'
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-04-26T13:46:28+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'services.pulseeffects'
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-05-03T11:13:07+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.i3status'
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-05-03T11:21:42+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.aria2'
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-05-04T21:19:43+00:00";
|
||||
condition = config.programs.git.enable;
|
||||
message = ''
|
||||
The Git module now supports the 'delta' syntax highlighter.
|
||||
|
||||
It can be enabled through the option 'programs.git.delta.enable'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-05-12T20:09:54+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.dircolors'
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-05-26T17:13:58+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.zoxide'
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-06-03T17:46:11+00:00";
|
||||
condition = config.programs.ssh.enable;
|
||||
message = ''
|
||||
The ssh module now supports the 'ServerAliveCountMax' option
|
||||
both globally through
|
||||
|
||||
programs.ssh.serverAliveCountMax
|
||||
|
||||
and per match blocks
|
||||
|
||||
programs.ssh.matchBlocks.<name>.serverAliveCountMax
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-06-11T18:06:37+00:00";
|
||||
condition = hostPlatform.isLinux && config.services.emacs.enable;
|
||||
message = ''
|
||||
The Emacs service now supports systemd socket activation.
|
||||
|
||||
It can be enabled through the option 'services.emacs.socketActivation.enable'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-06-12T17:48:01+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'services.clipmenu'
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-06-12T07:08:09+00:00";
|
||||
condition = config.programs.bash.enable;
|
||||
message = ''
|
||||
A new module is available: 'programs.powerline-go'
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-06-14T13:30:19+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'service.fluidsynth'
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-06-17T22:17:52+00:00";
|
||||
condition = config.programs.git.enable;
|
||||
message = ''
|
||||
Since May 1, 2020 string values in Git configurations are
|
||||
automatically escaped. If you have any manually escaped characters,
|
||||
then you may need to restore them to their unescaped form to avoid
|
||||
double escaping.
|
||||
|
||||
In other words, if you now have something along the lines of
|
||||
|
||||
programs.git.aliases.hello = '''"!echo $'Hello\\nWorld'"''';
|
||||
|
||||
you must replace it by the unescaped form
|
||||
|
||||
programs.git.aliases.hello = "!echo $'Hello\nWorld'";
|
||||
|
||||
Apologies for the belated notification!
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-06-23T20:06:39+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.ne'
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-07-24T15:03:11+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.nushell'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-07-25T21:04:59+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'services.dropbox'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-08-13T22:15:27+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'programs.waybar'
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-08-14T22:44:20+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'services.kanshi'
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-08-25T22:14:01+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.mcfly'
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-09-01T18:38:18+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.ncmpcpp'
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-09-11T10:06:47+00:00";
|
||||
condition = hostPlatform.isLinux && config.targets.genericLinux.enable;
|
||||
message = ''
|
||||
A new option 'targets.genericLinux.extraXdgDataDirs' is available
|
||||
to setup the user environment with the OS's data files.
|
||||
|
||||
This is useful for example to get Bash completion for
|
||||
'systemctl' which shouldn't be installed through Home Manager.
|
||||
|
||||
This is also useful to have non Home Manager applications
|
||||
available in menus.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-09-09T06:54:59+00:00";
|
||||
condition = config.programs.man.enable;
|
||||
message = ''
|
||||
A new option 'programs.man.generateCaches' was added to
|
||||
support the apropos command.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-09-22T21:03:28+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.pet'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-09-29T21:21:44+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.mu'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-10-08T21:28:16+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.autojump'
|
||||
|
||||
The option `programs.bash.enableAutojump` is deprecated and this new
|
||||
module should be used instead.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-10-12T00:12:23+00:00";
|
||||
condition = config.programs.zsh.enable;
|
||||
message = ''
|
||||
A new zsh submodule is available: 'programs.zsh.prezto'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-10-22T21:10:38+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'services.gammastep'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-10-22T21:30:42+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.gh'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-11-01T11:17:02+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'services.caffeine'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2020-12-18T22:22:25+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.rofi.pass'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Adapted from Nixpkgs.
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, pkgs, pkgsPath, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
@@ -49,7 +49,7 @@ let
|
||||
merge = lib.mergeOneOption;
|
||||
};
|
||||
|
||||
_pkgs = import <nixpkgs> (
|
||||
_pkgs = import pkgsPath (
|
||||
filterAttrs (n: v: v != null) config.nixpkgs
|
||||
);
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ let
|
||||
cfg = config.xsession.numlock;
|
||||
|
||||
in {
|
||||
meta.maintainers = [ maintainers.evanjs ];
|
||||
|
||||
options = { xsession.numlock.enable = mkEnableOption "Num Lock"; };
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
49
modules/misc/tmpfiles.nix
Normal file
49
modules/misc/tmpfiles.nix
Normal file
@@ -0,0 +1,49 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.systemd.user.tmpfiles;
|
||||
|
||||
in {
|
||||
meta.maintainers = [ maintainers.dawidsowa ];
|
||||
|
||||
options.systemd.user.tmpfiles.rules = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "L /home/user/Documents - - - - /mnt/data/Documents" ];
|
||||
description = ''
|
||||
Rules for creating and cleaning up temporary files
|
||||
automatically. See
|
||||
<citerefentry>
|
||||
<refentrytitle>tmpfiles.d</refentrytitle>
|
||||
<manvolnum>5</manvolnum>
|
||||
</citerefentry>
|
||||
for the exact format.
|
||||
'';
|
||||
};
|
||||
|
||||
config = mkIf (cfg.rules != [ ]) {
|
||||
xdg = {
|
||||
dataFile."user-tmpfiles.d/home-manager.conf" = {
|
||||
text = ''
|
||||
# This file is created automatically and should not be modified.
|
||||
# Please change the option ‘systemd.user.tmpfiles.rules’ instead.
|
||||
${concatStringsSep "\n" cfg.rules}
|
||||
'';
|
||||
onChange = "${pkgs.systemd}/bin/systemd-tmpfiles --user --create";
|
||||
};
|
||||
configFile = {
|
||||
"systemd/user/basic.target.wants/systemd-tmpfiles-setup.service".source =
|
||||
"${pkgs.systemd}/example/systemd/user/systemd-tmpfiles-setup.service";
|
||||
"systemd/user/systemd-tmpfiles-setup.service".source =
|
||||
"${pkgs.systemd}/example/systemd/user/systemd-tmpfiles-setup.service";
|
||||
"systemd/user/timers.target.wants/systemd-tmpfiles-clean.timer".source =
|
||||
"${pkgs.systemd}/example/systemd/user/systemd-tmpfiles-clean.timer";
|
||||
"systemd/user/systemd-tmpfiles-clean.service".source =
|
||||
"${pkgs.systemd}/example/systemd/user/systemd-tmpfiles-clean.service";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -5,7 +5,7 @@ with lib;
|
||||
{
|
||||
options = {
|
||||
home.stateVersion = mkOption {
|
||||
type = types.enum [ "18.09" "19.03" "19.09" "20.03" "20.09" ];
|
||||
type = types.enum [ "18.09" "19.03" "19.09" "20.03" "20.09" "21.03" ];
|
||||
default = "18.09";
|
||||
description = ''
|
||||
It is occasionally necessary for Home Manager to change
|
||||
|
||||
51
modules/misc/vte.nix
Normal file
51
modules/misc/vte.nix
Normal file
@@ -0,0 +1,51 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
meta.maintainers = [ maintainers.rycee ];
|
||||
|
||||
options.programs = let
|
||||
description = ''
|
||||
Whether to enable integration with terminals using the VTE
|
||||
library. This will let the terminal track the current working
|
||||
directory.
|
||||
'';
|
||||
in {
|
||||
bash.enableVteIntegration = mkEnableOption "" // { inherit description; };
|
||||
|
||||
zsh.enableVteIntegration = mkEnableOption "" // { inherit description; };
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
(mkIf config.programs.bash.enableVteIntegration {
|
||||
# Unfortunately we have to do a little dance here to fix two
|
||||
# problems with the upstream vte.sh file:
|
||||
#
|
||||
# - It does `PROMPT_COMMAND="__vte_prompt_command"` which
|
||||
# clobbers any previously assigned prompt command.
|
||||
#
|
||||
# - Its `__vte_prompt_command` function runs commands that will
|
||||
# overwrite the exit status of the command the user ran.
|
||||
programs.bash.initExtra = ''
|
||||
__HM_PROMPT_COMMAND="''${PROMPT_COMMAND:+''${PROMPT_COMMAND%;};}__hm_vte_prompt_command"
|
||||
. ${pkgs.vte}/etc/profile.d/vte.sh
|
||||
if [[ $(type -t __vte_prompt_command) = function ]]; then
|
||||
__hm_vte_prompt_command() {
|
||||
local old_exit_status=$?
|
||||
__vte_prompt_command
|
||||
return $old_exit_status
|
||||
}
|
||||
PROMPT_COMMAND="$__HM_PROMPT_COMMAND"
|
||||
fi
|
||||
unset __HM_PROMPT_COMMAND
|
||||
'';
|
||||
})
|
||||
|
||||
(mkIf config.programs.zsh.enableVteIntegration {
|
||||
programs.zsh.initExtra = ''
|
||||
. ${pkgs.vte}/etc/profile.d/vte.sh
|
||||
'';
|
||||
})
|
||||
];
|
||||
}
|
||||
@@ -74,7 +74,7 @@ in {
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# Deprecated but still used by some applications.
|
||||
home.file.".local/share/applications/mimeapps.list".source =
|
||||
xdg.dataFile."applications/mimeapps.list".source =
|
||||
config.xdg.configFile."mimeapps.list".source;
|
||||
|
||||
xdg.configFile."mimeapps.list".text =
|
||||
|
||||
@@ -27,10 +27,18 @@ in {
|
||||
home.packages = [
|
||||
# Explicitly install package to provide basic mime types.
|
||||
pkgs.shared-mime-info
|
||||
|
||||
# Make sure the target directories will be real directories.
|
||||
(pkgs.runCommandLocal "dummy-xdg-mime-dirs1" { } ''
|
||||
mkdir -p $out/share/{applications,mime/packages}
|
||||
'')
|
||||
(pkgs.runCommandLocal "dummy-xdg-mime-dirs2" { } ''
|
||||
mkdir -p $out/share/{applications,mime/packages}
|
||||
'')
|
||||
];
|
||||
|
||||
home.extraProfileCommands = ''
|
||||
if [[ -w $out/share/mime && -d $out/share/mime/packages ]]; then
|
||||
if [[ -w $out/share/mime && -w $out/share/mime/packages && -d $out/share/mime/packages ]]; then
|
||||
XDG_DATA_DIRS=$out/share \
|
||||
PKGSYSTEM_ENABLE_FSYNC=0 \
|
||||
${pkgs.buildPackages.shared-mime-info}/bin/update-mime-database \
|
||||
|
||||
@@ -89,16 +89,21 @@ in {
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
xdg.configFile."user-dirs.dirs".text = generators.toKeyValue { } ({
|
||||
XDG_DESKTOP_DIR = cfg.desktop;
|
||||
XDG_DOCUMENTS_DIR = cfg.documents;
|
||||
XDG_DOWNLOAD_DIR = cfg.download;
|
||||
XDG_MUSIC_DIR = cfg.music;
|
||||
XDG_PICTURES_DIR = cfg.pictures;
|
||||
XDG_PUBLICSHARE_DIR = cfg.publicShare;
|
||||
XDG_TEMPLATES_DIR = cfg.templates;
|
||||
XDG_VIDEOS_DIR = cfg.videos;
|
||||
} // cfg.extraConfig);
|
||||
xdg.configFile."user-dirs.dirs".text = let
|
||||
options = {
|
||||
XDG_DESKTOP_DIR = cfg.desktop;
|
||||
XDG_DOCUMENTS_DIR = cfg.documents;
|
||||
XDG_DOWNLOAD_DIR = cfg.download;
|
||||
XDG_MUSIC_DIR = cfg.music;
|
||||
XDG_PICTURES_DIR = cfg.pictures;
|
||||
XDG_PUBLICSHARE_DIR = cfg.publicShare;
|
||||
XDG_TEMPLATES_DIR = cfg.templates;
|
||||
XDG_VIDEOS_DIR = cfg.videos;
|
||||
} // cfg.extraConfig;
|
||||
|
||||
# For some reason, these need to be wrapped with quotes to be valid.
|
||||
wrapped = mapAttrs (_: value: ''"${value}"'') options;
|
||||
in generators.toKeyValue { } wrapped;
|
||||
|
||||
xdg.configFile."user-dirs.conf".text = "enabled=False";
|
||||
};
|
||||
|
||||
@@ -85,19 +85,29 @@ in
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf (!cfg.enable) {
|
||||
# Legacy non-deterministic setup.
|
||||
(mkIf (!cfg.enable && versionOlder config.home.stateVersion "20.09") {
|
||||
xdg.cacheHome = getXdgDir "XDG_CACHE_HOME" defaultCacheHome;
|
||||
xdg.configHome = getXdgDir "XDG_CONFIG_HOME" defaultConfigHome;
|
||||
xdg.dataHome = getXdgDir "XDG_DATA_HOME" defaultDataHome;
|
||||
})
|
||||
|
||||
# "Modern" deterministic setup.
|
||||
(mkIf (!cfg.enable && versionAtLeast config.home.stateVersion "20.09") {
|
||||
xdg.cacheHome = mkDefault defaultCacheHome;
|
||||
xdg.configHome = mkDefault defaultConfigHome;
|
||||
xdg.dataHome = mkDefault defaultDataHome;
|
||||
})
|
||||
|
||||
{
|
||||
home.file = mkMerge [
|
||||
cfg.configFile
|
||||
cfg.dataFile
|
||||
{
|
||||
"${config.xdg.cacheHome}/.keep".text = "";
|
||||
}
|
||||
(mapAttrs'
|
||||
(name: file: nameValuePair "${config.xdg.configHome}/${name}" file)
|
||||
cfg.configFile)
|
||||
(mapAttrs'
|
||||
(name: file: nameValuePair "${config.xdg.dataHome}/${name}" file)
|
||||
cfg.dataFile)
|
||||
{ "${config.xdg.cacheHome}/.keep".text = ""; }
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
@@ -36,7 +36,9 @@ let
|
||||
(loadModule ./misc/pam.nix { })
|
||||
(loadModule ./misc/qt.nix { })
|
||||
(loadModule ./misc/submodule-support.nix { })
|
||||
(loadModule ./misc/tmpfiles.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./misc/version.nix { })
|
||||
(loadModule ./misc/vte.nix { })
|
||||
(loadModule ./misc/xdg-mime.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./misc/xdg-mime-apps.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./misc/xdg-user-dirs.nix { condition = hostPlatform.isLinux; })
|
||||
@@ -45,15 +47,18 @@ let
|
||||
(loadModule ./programs/afew.nix { })
|
||||
(loadModule ./programs/alacritty.nix { })
|
||||
(loadModule ./programs/alot.nix { })
|
||||
(loadModule ./programs/aria2.nix { })
|
||||
(loadModule ./programs/astroid.nix { })
|
||||
(loadModule ./programs/autojump.nix { })
|
||||
(loadModule ./programs/autorandr.nix { })
|
||||
(loadModule ./programs/bash.nix { })
|
||||
(loadModule ./programs/bat.nix { })
|
||||
(loadModule ./programs/beets.nix { })
|
||||
(loadModule ./programs/broot.nix { })
|
||||
(loadModule ./programs/browserpass.nix { })
|
||||
(loadModule ./programs/chromium.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./programs/chromium.nix { })
|
||||
(loadModule ./programs/command-not-found/command-not-found.nix { })
|
||||
(loadModule ./programs/dircolors.nix { })
|
||||
(loadModule ./programs/direnv.nix { })
|
||||
(loadModule ./programs/eclipse.nix { })
|
||||
(loadModule ./programs/emacs.nix { })
|
||||
@@ -62,12 +67,14 @@ let
|
||||
(loadModule ./programs/fish.nix { })
|
||||
(loadModule ./programs/fzf.nix { })
|
||||
(loadModule ./programs/getmail.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./programs/gh.nix { })
|
||||
(loadModule ./programs/git.nix { })
|
||||
(loadModule ./programs/gnome-terminal.nix { })
|
||||
(loadModule ./programs/go.nix { })
|
||||
(loadModule ./programs/gpg.nix { })
|
||||
(loadModule ./programs/home-manager.nix { })
|
||||
(loadModule ./programs/htop.nix { })
|
||||
(loadModule ./programs/i3status.nix { })
|
||||
(loadModule ./programs/info.nix { })
|
||||
(loadModule ./programs/irssi.nix { })
|
||||
(loadModule ./programs/lieer.nix { })
|
||||
@@ -76,27 +83,36 @@ let
|
||||
(loadModule ./programs/keychain.nix { })
|
||||
(loadModule ./programs/kitty.nix { })
|
||||
(loadModule ./programs/lesspipe.nix { })
|
||||
(loadModule ./programs/lf.nix { })
|
||||
(loadModule ./programs/lsd.nix { })
|
||||
(loadModule ./programs/man.nix { })
|
||||
(loadModule ./programs/matplotlib.nix { })
|
||||
(loadModule ./programs/mbsync.nix { })
|
||||
(loadModule ./programs/mcfly.nix { })
|
||||
(loadModule ./programs/mercurial.nix { })
|
||||
(loadModule ./programs/mpv.nix { })
|
||||
(loadModule ./programs/msmtp.nix { })
|
||||
(loadModule ./programs/mu.nix { })
|
||||
(loadModule ./programs/ncmpcpp.nix { })
|
||||
(loadModule ./programs/ne.nix { })
|
||||
(loadModule ./programs/neomutt.nix { })
|
||||
(loadModule ./programs/neovim.nix { })
|
||||
(loadModule ./programs/newsboat.nix { })
|
||||
(loadModule ./programs/noti.nix { })
|
||||
(loadModule ./programs/notmuch.nix { })
|
||||
(loadModule ./programs/nushell.nix { })
|
||||
(loadModule ./programs/obs-studio.nix { })
|
||||
(loadModule ./programs/offlineimap.nix { })
|
||||
(loadModule ./programs/opam.nix { })
|
||||
(loadModule ./programs/password-store.nix { })
|
||||
(loadModule ./programs/pazi.nix { })
|
||||
(loadModule ./programs/pet.nix { })
|
||||
(loadModule ./programs/pidgin.nix { })
|
||||
(loadModule ./programs/powerline-go.nix { })
|
||||
(loadModule ./programs/qutebrowser.nix { })
|
||||
(loadModule ./programs/readline.nix { })
|
||||
(loadModule ./programs/rofi.nix { })
|
||||
(loadModule ./programs/rofi-pass.nix { })
|
||||
(loadModule ./programs/rtorrent.nix { })
|
||||
(loadModule ./programs/skim.nix { })
|
||||
(loadModule ./programs/starship.nix { })
|
||||
@@ -109,22 +125,32 @@ let
|
||||
(loadModule ./programs/vim.nix { })
|
||||
(loadModule ./programs/vscode.nix { })
|
||||
(loadModule ./programs/vscode/haskell.nix { })
|
||||
(loadModule ./programs/waybar.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./programs/z-lua.nix { })
|
||||
(loadModule ./programs/zathura.nix { })
|
||||
(loadModule ./programs/zoxide.nix { })
|
||||
(loadModule ./programs/zplug.nix { })
|
||||
(loadModule ./programs/zsh.nix { })
|
||||
(loadModule ./programs/zsh/prezto.nix { })
|
||||
(loadModule ./services/blueman-applet.nix { })
|
||||
(loadModule ./services/caffeine.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./services/cbatticon.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./services/clipmenu.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./services/compton.nix { })
|
||||
(loadModule ./services/dropbox.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./services/dunst.nix { })
|
||||
(loadModule ./services/dwm-status.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./services/emacs.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./services/flameshot.nix { })
|
||||
(loadModule ./services/fluidsynth.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./services/gammastep.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./services/getmail.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./services/gnome-keyring.nix { })
|
||||
(loadModule ./services/gpg-agent.nix { })
|
||||
(loadModule ./services/grobi.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./services/hound.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./services/imapnotify.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./services/kanshi.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./services/kbfs.nix { })
|
||||
(loadModule ./services/kdeconnect.nix { })
|
||||
(loadModule ./services/keepassx.nix { })
|
||||
@@ -145,6 +171,7 @@ let
|
||||
(loadModule ./services/pasystray.nix { })
|
||||
(loadModule ./services/picom.nix { })
|
||||
(loadModule ./services/polybar.nix { })
|
||||
(loadModule ./services/pulseeffects.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./services/random-background.nix { })
|
||||
(loadModule ./services/redshift.nix { })
|
||||
(loadModule ./services/rsibreak.nix { condition = hostPlatform.isLinux; })
|
||||
@@ -170,6 +197,7 @@ let
|
||||
(loadModule ./services/xscreensaver.nix { })
|
||||
(loadModule ./services/xsuspender.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./systemd.nix { })
|
||||
(loadModule ./targets/darwin.nix { condition = hostPlatform.isDarwin; })
|
||||
(loadModule ./targets/generic-linux.nix { condition = hostPlatform.isLinux; })
|
||||
(loadModule ./xcursor.nix { })
|
||||
(loadModule ./xresources.nix { })
|
||||
@@ -180,9 +208,14 @@ let
|
||||
|
||||
modules = map (getAttr "file") (filter (getAttr "condition") allModules);
|
||||
|
||||
pkgsModule = {
|
||||
pkgsModule = { config, ... }: {
|
||||
config = {
|
||||
_module.args.baseModules = modules;
|
||||
_module.args.pkgsPath = lib.mkDefault (
|
||||
if versionAtLeast config.home.stateVersion "20.09" then
|
||||
pkgs.path
|
||||
else
|
||||
<nixpkgs>);
|
||||
_module.args.pkgs = lib.mkDefault pkgs;
|
||||
_module.check = check;
|
||||
lib = lib.hm;
|
||||
|
||||
@@ -11,6 +11,13 @@ in {
|
||||
programs.alacritty = {
|
||||
enable = mkEnableOption "Alacritty";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.alacritty;
|
||||
defaultText = literalExample "pkgs.alacritty";
|
||||
description = "The Alacritty package to install.";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
@@ -41,7 +48,7 @@ in {
|
||||
|
||||
config = mkMerge [
|
||||
(mkIf cfg.enable {
|
||||
home.packages = [ pkgs.alacritty ];
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile."alacritty/alacritty.yml" = mkIf (cfg.settings != { }) {
|
||||
text =
|
||||
|
||||
@@ -7,167 +7,231 @@ let
|
||||
|
||||
cfg = config.programs.alot;
|
||||
|
||||
alotAccounts = filter (a: a.notmuch.enable)
|
||||
(attrValues config.accounts.email.accounts);
|
||||
alotAccounts =
|
||||
filter (a: a.notmuch.enable) (attrValues config.accounts.email.accounts);
|
||||
|
||||
boolStr = v: if v then "True" else "False";
|
||||
|
||||
accountStr = account: with account;
|
||||
concatStringsSep "\n" (
|
||||
[ "[[${name}]]" ]
|
||||
++ mapAttrsToList (n: v: n + "=" + v) (
|
||||
{
|
||||
address = address;
|
||||
realname = realName;
|
||||
sendmail_command =
|
||||
optionalString (alot.sendMailCommand != null) alot.sendMailCommand;
|
||||
sent_box = "maildir" + "://" + maildir.absPath + "/" + folders.sent;
|
||||
draft_box = "maildir" + "://"+ maildir.absPath + "/" + folders.drafts;
|
||||
}
|
||||
// optionalAttrs (aliases != []) {
|
||||
aliases = concatStringsSep "," aliases;
|
||||
}
|
||||
// optionalAttrs (gpg != null) {
|
||||
gpg_key = gpg.key;
|
||||
encrypt_by_default = if gpg.encryptByDefault then "all" else "none";
|
||||
sign_by_default = boolStr gpg.signByDefault;
|
||||
}
|
||||
// optionalAttrs (signature.showSignature != "none") {
|
||||
signature = pkgs.writeText "signature.txt" signature.text;
|
||||
signature_as_attachment =
|
||||
boolStr (signature.showSignature == "attach");
|
||||
}
|
||||
)
|
||||
++ [ alot.extraConfig ]
|
||||
++ [ "[[[abook]]]" ]
|
||||
++ mapAttrsToList (n: v: n + "=" + v) alot.contactCompletion
|
||||
);
|
||||
mkKeyValue = key: value:
|
||||
let value' = if isBool value then boolStr value else toString value;
|
||||
in "${key} = ${value'}";
|
||||
|
||||
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
|
||||
mk2ndLevelSectionName = name: "[" + name + "]";
|
||||
|
||||
${cfg.extraConfig}
|
||||
tagSubmodule = types.submodule {
|
||||
options = {
|
||||
translated = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
Fixed string representation for this tag. The tag can be
|
||||
hidden from view, if the key translated is set to
|
||||
<literal>""</literal>, the empty string.
|
||||
'';
|
||||
};
|
||||
|
||||
[bindings]
|
||||
${bindingsToStr cfg.bindings.global}
|
||||
translation = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
A pair of strings that define a regular substitution to
|
||||
compute the string representation on the fly using
|
||||
<literal>re.sub</literal>.
|
||||
'';
|
||||
};
|
||||
|
||||
[[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}
|
||||
normal = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "'','', 'white','light red', 'white','#d66'";
|
||||
description = ''
|
||||
How to display the tag when unfocused.
|
||||
See <link xlink:href="https://alot.readthedocs.io/en/latest/configuration/theming.html#tagstring-formatting"/>.
|
||||
'';
|
||||
};
|
||||
|
||||
[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.
|
||||
'';
|
||||
focus = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "How to display the tag when focused.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
hooks = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Content of the hooks file.
|
||||
'';
|
||||
};
|
||||
accountStr = account:
|
||||
with account;
|
||||
concatStringsSep "\n" ([ "[[${name}]]" ]
|
||||
++ mapAttrsToList (n: v: n + "=" + v) ({
|
||||
address = address;
|
||||
realname = realName;
|
||||
sendmail_command =
|
||||
optionalString (alot.sendMailCommand != null) alot.sendMailCommand;
|
||||
sent_box = "maildir" + "://" + maildir.absPath + "/" + folders.sent;
|
||||
draft_box = "maildir" + "://" + maildir.absPath + "/" + folders.drafts;
|
||||
} // optionalAttrs (aliases != [ ]) {
|
||||
aliases = concatStringsSep "," aliases;
|
||||
} // optionalAttrs (gpg != null) {
|
||||
gpg_key = gpg.key;
|
||||
encrypt_by_default = if gpg.encryptByDefault then "all" else "none";
|
||||
sign_by_default = boolStr gpg.signByDefault;
|
||||
} // optionalAttrs (signature.showSignature != "none") {
|
||||
signature = pkgs.writeText "signature.txt" signature.text;
|
||||
signature_as_attachment = boolStr (signature.showSignature == "attach");
|
||||
}) ++ [ alot.extraConfig ] ++ [ "[[[abook]]]" ]
|
||||
++ mapAttrsToList (n: v: n + "=" + v) alot.contactCompletion);
|
||||
|
||||
bindings = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
global = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
description = "Global keybindings.";
|
||||
};
|
||||
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
|
||||
|
||||
bufferlist = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
description = "Bufferlist mode keybindings.";
|
||||
};
|
||||
${generators.toKeyValue { inherit mkKeyValue; } cfg.settings}
|
||||
${cfg.extraConfig}
|
||||
[tags]
|
||||
'' + (let
|
||||
submoduleToAttrs = m:
|
||||
filterAttrs (name: v: name != "_module" && v != null) m;
|
||||
in generators.toINI { mkSectionName = mk2ndLevelSectionName; }
|
||||
(mapAttrs (name: x: submoduleToAttrs x) cfg.tags)) + ''
|
||||
[bindings]
|
||||
${bindingsToStr cfg.bindings.global}
|
||||
|
||||
search = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
description = "Search mode keybindings.";
|
||||
};
|
||||
[[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}
|
||||
|
||||
envelope = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
description = "Envelope mode keybindings.";
|
||||
};
|
||||
[accounts]
|
||||
|
||||
taglist = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
description = "Taglist mode keybindings.";
|
||||
};
|
||||
${concatStringsSep "\n\n" (map accountStr alotAccounts)}
|
||||
'';
|
||||
|
||||
thread = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
description = "Thread mode keybindings.";
|
||||
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.
|
||||
'';
|
||||
};
|
||||
|
||||
tags = mkOption {
|
||||
type = types.attrsOf tagSubmodule;
|
||||
default = { };
|
||||
description = "How to display the tags.";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = with types;
|
||||
let primitive = either (either (either str int) bool) float;
|
||||
in attrsOf primitive;
|
||||
default = {
|
||||
initial_command = "search tag:inbox AND NOT tag:killed";
|
||||
auto_remove_unread = true;
|
||||
handle_mouse = true;
|
||||
prefer_plaintext = true;
|
||||
};
|
||||
example = literalExample ''
|
||||
{
|
||||
auto_remove_unread = true;
|
||||
ask_subject = false;
|
||||
thread_indent_replies = 2;
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Configuration options added to alot configuration file.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Extra lines added to alot configuration file.
|
||||
'';
|
||||
};
|
||||
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.
|
||||
'';
|
||||
accounts.email.accounts = mkOption {
|
||||
type = with types; attrsOf (submodule (import ./alot-accounts.nix pkgs));
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.alot ];
|
||||
home.packages = [ pkgs.alot ];
|
||||
|
||||
xdg.configFile."alot/config".text = configFile;
|
||||
|
||||
xdg.configFile."alot/hooks.py".text =
|
||||
''
|
||||
xdg.configFile."alot/hooks.py" = mkIf (cfg.hooks != "") {
|
||||
text = ''
|
||||
# Generated by Home Manager.
|
||||
''
|
||||
+ cfg.hooks;
|
||||
'' + cfg.hooks;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
61
modules/programs/aria2.nix
Normal file
61
modules/programs/aria2.nix
Normal file
@@ -0,0 +1,61 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.programs.aria2;
|
||||
|
||||
formatLine = n: v:
|
||||
let
|
||||
formatValue = v:
|
||||
if builtins.isBool v then
|
||||
(if v then "true" else "false")
|
||||
else
|
||||
toString v;
|
||||
in "${n}=${formatValue v}";
|
||||
in {
|
||||
meta.maintainers = [ hm.maintainers.justinlovinger ];
|
||||
|
||||
options.programs.aria2 = {
|
||||
enable = mkEnableOption "aria2";
|
||||
|
||||
settings = mkOption {
|
||||
type = with types; attrsOf (oneOf [ bool float int str ]);
|
||||
default = { };
|
||||
description = ''
|
||||
Options to add to <filename>aria2.conf</filename> file.
|
||||
See
|
||||
<citerefentry>
|
||||
<refentrytitle>aria2c</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
</citerefentry>
|
||||
for options.
|
||||
'';
|
||||
example = literalExample ''
|
||||
{
|
||||
listen-port = 60000;
|
||||
dht-listen-port = 60000;
|
||||
seed-ratio = 1.0;
|
||||
max-upload-limit = "50K";
|
||||
ftp-pasv = true;
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Extra lines added to <filename>aria2.conf</filename> file.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.aria2 ];
|
||||
|
||||
xdg.configFile."aria2/aria2.conf".text = concatStringsSep "\n" ([ ]
|
||||
++ mapAttrsToList formatLine cfg.settings
|
||||
++ optional (cfg.extraConfig != "") cfg.extraConfig);
|
||||
};
|
||||
}
|
||||
@@ -98,6 +98,10 @@ in {
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
accounts.email.accounts = mkOption {
|
||||
type = with types; attrsOf (submodule (import ./astroid-accounts.nix));
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
56
modules/programs/autojump.nix
Normal file
56
modules/programs/autojump.nix
Normal file
@@ -0,0 +1,56 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.autojump;
|
||||
package = pkgs.autojump;
|
||||
|
||||
in {
|
||||
meta.maintainers = [ maintainers.evanjs ];
|
||||
|
||||
options.programs.autojump = {
|
||||
enable = mkEnableOption "autojump";
|
||||
|
||||
enableBashIntegration = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enable Bash integration.
|
||||
'';
|
||||
};
|
||||
|
||||
enableZshIntegration = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enable Zsh integration.
|
||||
'';
|
||||
};
|
||||
|
||||
enableFishIntegration = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enable Fish integration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ package ];
|
||||
|
||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration (mkBefore ''
|
||||
. ${package}/share/autojump/autojump.bash
|
||||
'');
|
||||
|
||||
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
||||
. ${package}/share/autojump/autojump.zsh
|
||||
'';
|
||||
|
||||
programs.fish.promptInit = mkIf cfg.enableFishIntegration ''
|
||||
. ${package}/share/autojump/autojump.fish
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -55,6 +55,13 @@ let
|
||||
default = true;
|
||||
};
|
||||
|
||||
crtc = mkOption {
|
||||
type = types.nullOr types.ints.unsigned;
|
||||
description = "Output video display controller.";
|
||||
default = null;
|
||||
example = 0;
|
||||
};
|
||||
|
||||
primary = mkOption {
|
||||
type = types.bool;
|
||||
description = "Whether output should be marked as primary";
|
||||
@@ -244,21 +251,22 @@ let
|
||||
]);
|
||||
fingerprintToString = name: edid: "${name} ${edid}";
|
||||
configToString = name: config:
|
||||
if config.enable then ''
|
||||
output ${name}
|
||||
${optionalString (config.position != "") "pos ${config.position}"}
|
||||
${optionalString config.primary "primary"}
|
||||
${optionalString (config.dpi != null) "dpi ${toString config.dpi}"}
|
||||
${optionalString (config.gamma != "") "gamma ${config.gamma}"}
|
||||
${optionalString (config.mode != "") "mode ${config.mode}"}
|
||||
${optionalString (config.rate != "") "rate ${config.rate}"}
|
||||
${optionalString (config.rotate != null) "rotate ${config.rotate}"}
|
||||
${optionalString (config.scale != null)
|
||||
((if config.scale.method == "factor" then "scale" else "scale-from")
|
||||
+ " ${toString config.scale.x}x${toString config.scale.y}")}
|
||||
${optionalString (config.transform != null) ("transform "
|
||||
+ concatMapStringsSep "," toString (flatten config.transform))}
|
||||
'' else ''
|
||||
if config.enable then
|
||||
concatStringsSep "\n" ([ "output ${name}" ]
|
||||
++ optional (config.position != "") "pos ${config.position}"
|
||||
++ optional (config.crtc != null) "crtc ${toString config.crtc}"
|
||||
++ optional config.primary "primary"
|
||||
++ optional (config.dpi != null) "dpi ${toString config.dpi}"
|
||||
++ optional (config.gamma != "") "gamma ${config.gamma}"
|
||||
++ optional (config.mode != "") "mode ${config.mode}"
|
||||
++ optional (config.rate != "") "rate ${config.rate}"
|
||||
++ optional (config.rotate != null) "rotate ${config.rotate}"
|
||||
++ optional (config.transform != null) ("transform "
|
||||
+ concatMapStringsSep "," toString (flatten config.transform))
|
||||
++ optional (config.scale != null)
|
||||
((if config.scale.method == "factor" then "scale" else "scale-from")
|
||||
+ " ${toString config.scale.x}x${toString config.scale.y}"))
|
||||
else ''
|
||||
output ${name}
|
||||
off
|
||||
'';
|
||||
@@ -315,6 +323,7 @@ in {
|
||||
eDP1.enable = false;
|
||||
DP1 = {
|
||||
enable = true;
|
||||
crtc = 0;
|
||||
primary = true;
|
||||
position = "0x0";
|
||||
mode = "3840x2160";
|
||||
|
||||
@@ -11,6 +11,14 @@ in
|
||||
{
|
||||
meta.maintainers = [ maintainers.rycee ];
|
||||
|
||||
imports = [
|
||||
(mkRenamedOptionModule [ "programs" "bash" "enableAutojump" ] [
|
||||
"programs"
|
||||
"autojump"
|
||||
"enable"
|
||||
])
|
||||
];
|
||||
|
||||
options = {
|
||||
programs.bash = {
|
||||
enable = mkEnableOption "GNU Bourne-Again SHell";
|
||||
@@ -94,12 +102,6 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
enableAutojump = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Enable the autojump navigation tool.";
|
||||
};
|
||||
|
||||
profileExtra = mkOption {
|
||||
default = "";
|
||||
type = types.lines;
|
||||
@@ -177,9 +179,6 @@ in
|
||||
${aliasesStr}
|
||||
|
||||
${cfg.initExtra}
|
||||
|
||||
${optionalString cfg.enableAutojump
|
||||
". ${pkgs.autojump}/share/autojump/autojump.bash"}
|
||||
fi
|
||||
'';
|
||||
|
||||
@@ -216,9 +215,6 @@ in
|
||||
${cfg.logoutExtra}
|
||||
'';
|
||||
};
|
||||
|
||||
home.packages =
|
||||
optional (cfg.enableAutojump) pkgs.autojump;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ in {
|
||||
xdg.configFile."broot/conf.toml".source = configFile brootConf;
|
||||
|
||||
# Dummy file to prevent broot from trying to reinstall itself
|
||||
xdg.configFile."broot/launcher/installed".text = "";
|
||||
xdg.configFile."broot/launcher/installed-v1".text = "";
|
||||
|
||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration (
|
||||
# Using mkAfter to make it more likely to appear after other
|
||||
|
||||
@@ -53,6 +53,7 @@ let
|
||||
google-chrome = "Google/Chrome";
|
||||
google-chrome-beta = "Google/Chrome Beta";
|
||||
google-chrome-dev = "Google/Chrome Dev";
|
||||
brave = "BraveSoftware/Brave-Browser";
|
||||
};
|
||||
|
||||
configDir = if pkgs.stdenv.isDarwin then
|
||||
@@ -81,6 +82,7 @@ in {
|
||||
browserModule pkgs.google-chrome-beta "Google Chrome Beta" false;
|
||||
google-chrome-dev =
|
||||
browserModule pkgs.google-chrome-dev "Google Chrome Dev" false;
|
||||
brave = browserModule pkgs.brave "Brave Browser" false;
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
@@ -88,5 +90,6 @@ in {
|
||||
(browserConfig config.programs.google-chrome)
|
||||
(browserConfig config.programs.google-chrome-beta)
|
||||
(browserConfig config.programs.google-chrome-dev)
|
||||
(browserConfig config.programs.brave)
|
||||
];
|
||||
}
|
||||
|
||||
223
modules/programs/dircolors.nix
Normal file
223
modules/programs/dircolors.nix
Normal file
@@ -0,0 +1,223 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.programs.dircolors;
|
||||
|
||||
formatLine = n: v: "${n} ${toString v}";
|
||||
in {
|
||||
meta.maintainers = [ hm.maintainers.justinlovinger ];
|
||||
|
||||
options.programs.dircolors = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to manage <filename>.dir_colors</filename>
|
||||
and set <code>LS_COLORS</code>.
|
||||
'';
|
||||
};
|
||||
|
||||
enableBashIntegration = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable Bash integration.
|
||||
'';
|
||||
};
|
||||
|
||||
enableFishIntegration = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable Fish integration.
|
||||
'';
|
||||
};
|
||||
|
||||
enableZshIntegration = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable Zsh integration.
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = with types; attrsOf str;
|
||||
default = { };
|
||||
description = ''
|
||||
Options to add to <filename>.dir_colors</filename> file.
|
||||
See <command>dircolors --print-database</command>
|
||||
for options.
|
||||
'';
|
||||
example = literalExample ''
|
||||
{
|
||||
OTHER_WRITABLE = "30;46";
|
||||
".sh" = "01;32";
|
||||
".csh" = "01;32";
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Extra lines added to <filename>.dir_colors</filename> file.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# Add default settings from `dircolors --print-database`.
|
||||
programs.dircolors.settings = {
|
||||
RESET = mkDefault "0";
|
||||
DIR = mkDefault "01;34";
|
||||
LINK = mkDefault "01;36";
|
||||
MULTIHARDLINK = mkDefault "00";
|
||||
FIFO = mkDefault "40;33";
|
||||
SOCK = mkDefault "01;35";
|
||||
DOOR = mkDefault "01;35";
|
||||
BLK = mkDefault "40;33;01";
|
||||
CHR = mkDefault "40;33;01";
|
||||
ORPHAN = mkDefault "40;31;01";
|
||||
MISSING = mkDefault "00";
|
||||
SETUID = mkDefault "37;41";
|
||||
SETGID = mkDefault "30;43";
|
||||
CAPABILITY = mkDefault "30;41";
|
||||
STICKY_OTHER_WRITABLE = mkDefault "30;42";
|
||||
OTHER_WRITABLE = mkDefault "34;42";
|
||||
STICKY = mkDefault "37;44";
|
||||
EXEC = mkDefault "01;32";
|
||||
".tar" = mkDefault "01;31";
|
||||
".tgz" = mkDefault "01;31";
|
||||
".arc" = mkDefault "01;31";
|
||||
".arj" = mkDefault "01;31";
|
||||
".taz" = mkDefault "01;31";
|
||||
".lha" = mkDefault "01;31";
|
||||
".lz4" = mkDefault "01;31";
|
||||
".lzh" = mkDefault "01;31";
|
||||
".lzma" = mkDefault "01;31";
|
||||
".tlz" = mkDefault "01;31";
|
||||
".txz" = mkDefault "01;31";
|
||||
".tzo" = mkDefault "01;31";
|
||||
".t7z" = mkDefault "01;31";
|
||||
".zip" = mkDefault "01;31";
|
||||
".z" = mkDefault "01;31";
|
||||
".dz" = mkDefault "01;31";
|
||||
".gz" = mkDefault "01;31";
|
||||
".lrz" = mkDefault "01;31";
|
||||
".lz" = mkDefault "01;31";
|
||||
".lzo" = mkDefault "01;31";
|
||||
".xz" = mkDefault "01;31";
|
||||
".zst" = mkDefault "01;31";
|
||||
".tzst" = mkDefault "01;31";
|
||||
".bz2" = mkDefault "01;31";
|
||||
".bz" = mkDefault "01;31";
|
||||
".tbz" = mkDefault "01;31";
|
||||
".tbz2" = mkDefault "01;31";
|
||||
".tz" = mkDefault "01;31";
|
||||
".deb" = mkDefault "01;31";
|
||||
".rpm" = mkDefault "01;31";
|
||||
".jar" = mkDefault "01;31";
|
||||
".war" = mkDefault "01;31";
|
||||
".ear" = mkDefault "01;31";
|
||||
".sar" = mkDefault "01;31";
|
||||
".rar" = mkDefault "01;31";
|
||||
".alz" = mkDefault "01;31";
|
||||
".ace" = mkDefault "01;31";
|
||||
".zoo" = mkDefault "01;31";
|
||||
".cpio" = mkDefault "01;31";
|
||||
".7z" = mkDefault "01;31";
|
||||
".rz" = mkDefault "01;31";
|
||||
".cab" = mkDefault "01;31";
|
||||
".wim" = mkDefault "01;31";
|
||||
".swm" = mkDefault "01;31";
|
||||
".dwm" = mkDefault "01;31";
|
||||
".esd" = mkDefault "01;31";
|
||||
".jpg" = mkDefault "01;35";
|
||||
".jpeg" = mkDefault "01;35";
|
||||
".mjpg" = mkDefault "01;35";
|
||||
".mjpeg" = mkDefault "01;35";
|
||||
".gif" = mkDefault "01;35";
|
||||
".bmp" = mkDefault "01;35";
|
||||
".pbm" = mkDefault "01;35";
|
||||
".pgm" = mkDefault "01;35";
|
||||
".ppm" = mkDefault "01;35";
|
||||
".tga" = mkDefault "01;35";
|
||||
".xbm" = mkDefault "01;35";
|
||||
".xpm" = mkDefault "01;35";
|
||||
".tif" = mkDefault "01;35";
|
||||
".tiff" = mkDefault "01;35";
|
||||
".png" = mkDefault "01;35";
|
||||
".svg" = mkDefault "01;35";
|
||||
".svgz" = mkDefault "01;35";
|
||||
".mng" = mkDefault "01;35";
|
||||
".pcx" = mkDefault "01;35";
|
||||
".mov" = mkDefault "01;35";
|
||||
".mpg" = mkDefault "01;35";
|
||||
".mpeg" = mkDefault "01;35";
|
||||
".m2v" = mkDefault "01;35";
|
||||
".mkv" = mkDefault "01;35";
|
||||
".webm" = mkDefault "01;35";
|
||||
".ogm" = mkDefault "01;35";
|
||||
".mp4" = mkDefault "01;35";
|
||||
".m4v" = mkDefault "01;35";
|
||||
".mp4v" = mkDefault "01;35";
|
||||
".vob" = mkDefault "01;35";
|
||||
".qt" = mkDefault "01;35";
|
||||
".nuv" = mkDefault "01;35";
|
||||
".wmv" = mkDefault "01;35";
|
||||
".asf" = mkDefault "01;35";
|
||||
".rm" = mkDefault "01;35";
|
||||
".rmvb" = mkDefault "01;35";
|
||||
".flc" = mkDefault "01;35";
|
||||
".avi" = mkDefault "01;35";
|
||||
".fli" = mkDefault "01;35";
|
||||
".flv" = mkDefault "01;35";
|
||||
".gl" = mkDefault "01;35";
|
||||
".dl" = mkDefault "01;35";
|
||||
".xcf" = mkDefault "01;35";
|
||||
".xwd" = mkDefault "01;35";
|
||||
".yuv" = mkDefault "01;35";
|
||||
".cgm" = mkDefault "01;35";
|
||||
".emf" = mkDefault "01;35";
|
||||
".ogv" = mkDefault "01;35";
|
||||
".ogx" = mkDefault "01;35";
|
||||
".aac" = mkDefault "00;36";
|
||||
".au" = mkDefault "00;36";
|
||||
".flac" = mkDefault "00;36";
|
||||
".m4a" = mkDefault "00;36";
|
||||
".mid" = mkDefault "00;36";
|
||||
".midi" = mkDefault "00;36";
|
||||
".mka" = mkDefault "00;36";
|
||||
".mp3" = mkDefault "00;36";
|
||||
".mpc" = mkDefault "00;36";
|
||||
".ogg" = mkDefault "00;36";
|
||||
".ra" = mkDefault "00;36";
|
||||
".wav" = mkDefault "00;36";
|
||||
".oga" = mkDefault "00;36";
|
||||
".opus" = mkDefault "00;36";
|
||||
".spx" = mkDefault "00;36";
|
||||
".xspf" = mkDefault "00;36";
|
||||
};
|
||||
|
||||
home.file.".dir_colors".text = concatStringsSep "\n" ([ ]
|
||||
++ optional (cfg.extraConfig != "") cfg.extraConfig
|
||||
++ mapAttrsToList formatLine cfg.settings) + "\n";
|
||||
|
||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
||||
eval $(${pkgs.coreutils}/bin/dircolors -b ~/.dir_colors)
|
||||
'';
|
||||
|
||||
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
|
||||
eval (${pkgs.coreutils}/bin/dircolors -c ~/.dir_colors)
|
||||
'';
|
||||
|
||||
# Set `LS_COLORS` before Oh My Zsh and `initExtra`.
|
||||
programs.zsh.initExtraBeforeCompInit = mkIf cfg.enableZshIntegration ''
|
||||
eval $(${pkgs.coreutils}/bin/dircolors -b ~/.dir_colors)
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -70,6 +70,11 @@ in {
|
||||
Whether to enable Fish integration.
|
||||
'';
|
||||
};
|
||||
|
||||
enableNixDirenvIntegration = mkEnableOption ''
|
||||
<link
|
||||
xlink:href="https://github.com/nix-community/nix-direnv">nix-direnv</link>,
|
||||
a fast, persistent use_nix implementation for direnv'';
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
@@ -78,8 +83,11 @@ in {
|
||||
xdg.configFile."direnv/config.toml" =
|
||||
mkIf (cfg.config != { }) { source = configFile cfg.config; };
|
||||
|
||||
xdg.configFile."direnv/direnvrc" =
|
||||
mkIf (cfg.stdlib != "") { text = cfg.stdlib; };
|
||||
xdg.configFile."direnv/direnvrc" = let
|
||||
text = concatStringsSep "\n" (optional (cfg.stdlib != "") cfg.stdlib
|
||||
++ optional cfg.enableNixDirenvIntegration
|
||||
"source ${pkgs.nix-direnv}/share/nix-direnv/direnvrc");
|
||||
in mkIf (text != "") { inherit text; };
|
||||
|
||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration (
|
||||
# Using mkAfter to make it more likely to appear after other
|
||||
|
||||
@@ -13,6 +13,16 @@ in {
|
||||
programs.eclipse = {
|
||||
enable = mkEnableOption "Eclipse";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.eclipses.eclipse-platform;
|
||||
defaultText = literalExample "pkgs.eclipses.eclipse-platform";
|
||||
example = literalExample "pkgs.eclipses.eclipse-java";
|
||||
description = ''
|
||||
The Eclipse package to install.
|
||||
'';
|
||||
};
|
||||
|
||||
enableLombok = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
@@ -40,7 +50,7 @@ in {
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [
|
||||
(pkgs.eclipses.eclipseWithPlugins {
|
||||
eclipse = pkgs.eclipses.eclipse-platform;
|
||||
eclipse = cfg.package;
|
||||
jvmArgs = cfg.jvmArgs ++ optional cfg.enableLombok
|
||||
"-javaagent:${pkgs.lombok}/share/java/lombok.jar";
|
||||
plugins = cfg.plugins;
|
||||
|
||||
@@ -8,16 +8,12 @@ let
|
||||
|
||||
# Copied from all-packages.nix, with modifications to support
|
||||
# overrides.
|
||||
emacsPackages =
|
||||
let
|
||||
epkgs = pkgs.emacsPackagesGen cfg.package;
|
||||
in
|
||||
epkgs.overrideScope' cfg.overrides;
|
||||
emacsPackages = let epkgs = pkgs.emacsPackagesFor cfg.package;
|
||||
in epkgs.overrideScope' cfg.overrides;
|
||||
|
||||
emacsWithPackages = emacsPackages.emacsWithPackages;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
in {
|
||||
meta.maintainers = [ maintainers.rycee ];
|
||||
|
||||
options = {
|
||||
@@ -33,7 +29,7 @@ in
|
||||
};
|
||||
|
||||
extraPackages = mkOption {
|
||||
default = self: [];
|
||||
default = self: [ ];
|
||||
type = hm.types.selectorFunction;
|
||||
defaultText = "epkgs: []";
|
||||
example = literalExample "epkgs: [ epkgs.emms epkgs.magit ]";
|
||||
@@ -45,7 +41,7 @@ in
|
||||
};
|
||||
|
||||
overrides = mkOption {
|
||||
default = self: super: {};
|
||||
default = self: super: { };
|
||||
type = hm.types.overlayFunction;
|
||||
defaultText = "self: super: {}";
|
||||
example = literalExample ''
|
||||
|
||||
@@ -6,8 +6,22 @@ let
|
||||
|
||||
cfg = config.programs.feh;
|
||||
|
||||
disableBinding = func: key: func;
|
||||
enableBinding = func: key: "${func} ${toString key}";
|
||||
bindingsOf = t: with types; attrsOf (nullOr (either t (listOf t)));
|
||||
|
||||
renderBindings = bindings:
|
||||
let
|
||||
enabled = filterAttrs (n: v: v != null) bindings;
|
||||
disabled = filterAttrs (n: v: v == null) bindings;
|
||||
render = mapAttrsToList renderBinding;
|
||||
in concatStringsSep "\n" (render disabled ++ render enabled);
|
||||
|
||||
renderBinding = func: key:
|
||||
if key == null then
|
||||
func
|
||||
else if isList key then
|
||||
concatStringsSep " " ([ func ] ++ map toString key)
|
||||
else
|
||||
"${func} ${toString key}";
|
||||
|
||||
in {
|
||||
options.programs.feh = {
|
||||
@@ -15,14 +29,16 @@ in {
|
||||
|
||||
buttons = mkOption {
|
||||
default = { };
|
||||
type = with types; attrsOf (nullOr (either str int));
|
||||
type = with types; bindingsOf (either str int);
|
||||
example = {
|
||||
zoom_in = 4;
|
||||
zoom_out = "C-4";
|
||||
prev_img = [ 3 "C-3" ];
|
||||
};
|
||||
description = ''
|
||||
Override feh's default mouse button mapping. If you want to disable an
|
||||
action, set its value to null.
|
||||
action, set its value to null. If you want to bind multiple buttons to
|
||||
an action, set its value to a list.
|
||||
See <link xlink:href="https://man.finalrewind.org/1/feh/#x425554544f4e53"/> for
|
||||
default bindings and available commands.
|
||||
'';
|
||||
@@ -30,14 +46,16 @@ in {
|
||||
|
||||
keybindings = mkOption {
|
||||
default = { };
|
||||
type = types.attrsOf (types.nullOr types.str);
|
||||
type = bindingsOf types.str;
|
||||
example = {
|
||||
zoom_in = "plus";
|
||||
zoom_out = "minus";
|
||||
prev_img = [ "h" "Left" ];
|
||||
};
|
||||
description = ''
|
||||
Override feh's default keybindings. If you want to disable a keybinding
|
||||
set its value to null.
|
||||
set its value to null. If you want to bind multiple keys to an action,
|
||||
set its value to a list.
|
||||
See <link xlink:href="https://man.finalrewind.org/1/feh/#x4b455953"/> for
|
||||
default bindings and available commands.
|
||||
'';
|
||||
@@ -53,18 +71,11 @@ in {
|
||||
|
||||
home.packages = [ pkgs.feh ];
|
||||
|
||||
xdg.configFile."feh/buttons".text = ''
|
||||
${concatStringsSep "\n" (mapAttrsToList disableBinding
|
||||
(filterAttrs (n: v: v == null) cfg.buttons))}
|
||||
${concatStringsSep "\n" (mapAttrsToList enableBinding
|
||||
(filterAttrs (n: v: v != null) cfg.buttons))}
|
||||
'';
|
||||
xdg.configFile."feh/buttons" =
|
||||
mkIf (cfg.buttons != { }) { text = renderBindings cfg.buttons + "\n"; };
|
||||
|
||||
xdg.configFile."feh/keys".text = ''
|
||||
${concatStringsSep "\n" (mapAttrsToList disableBinding
|
||||
(filterAttrs (n: v: v == null) cfg.keybindings))}
|
||||
${concatStringsSep "\n" (mapAttrsToList enableBinding
|
||||
(filterAttrs (n: v: v != null) cfg.keybindings))}
|
||||
'';
|
||||
xdg.configFile."feh/keys" = mkIf (cfg.keybindings != { }) {
|
||||
text = renderBindings cfg.keybindings + "\n";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -101,9 +101,29 @@ in
|
||||
]
|
||||
'';
|
||||
description = ''
|
||||
List of Firefox add-on packages to install. Note, it is
|
||||
necessary to manually enable these extensions inside Firefox
|
||||
after the first installation.
|
||||
List of Firefox add-on packages to install. Some
|
||||
pre-packaged add-ons are accessible from NUR,
|
||||
<link xlink:href="https://github.com/nix-community/NUR"/>.
|
||||
Once you have NUR installed run
|
||||
|
||||
<screen language="console">
|
||||
<prompt>$</prompt> <userinput>nix-env -f '<nixpkgs>' -qaP -A nur.repos.rycee.firefox-addons</userinput>
|
||||
</screen>
|
||||
|
||||
to list the available Firefox add-ons.
|
||||
|
||||
</para><para>
|
||||
|
||||
Note that it is necessary to manually enable these
|
||||
extensions inside Firefox after the first installation.
|
||||
|
||||
</para><para>
|
||||
|
||||
Extensions listed here will only be available in Firefox
|
||||
profiles managed through the
|
||||
<link linkend="opt-programs.firefox.profiles">programs.firefox.profiles</link>
|
||||
option. This is due to recent changes in the way Firefox
|
||||
handles extension side-loading.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -200,6 +220,17 @@ in
|
||||
default = false;
|
||||
description = "Whether to enable the unfree Adobe Flash plugin.";
|
||||
};
|
||||
|
||||
enableGnomeExtensions = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to enable the GNOME Shell native host connector. Note, you
|
||||
also need to set the NixOS option
|
||||
<literal>services.gnome3.chrome-gnome-shell.enable</literal> to
|
||||
<literal>true</literal>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -242,6 +273,7 @@ in
|
||||
# The configuration expected by the Firefox wrapper.
|
||||
fcfg = {
|
||||
enableAdobeFlash = cfg.enableAdobeFlash;
|
||||
enableGnomeExtensions = cfg.enableGnomeExtensions;
|
||||
};
|
||||
|
||||
# A bit of hackery to force a config into the wrapper.
|
||||
|
||||
@@ -441,7 +441,9 @@ in {
|
||||
|
||||
# Source initialization code if it exists.
|
||||
if test -d $plugin_dir/conf.d
|
||||
source $plugin_dir/conf.d/*.fish
|
||||
for f in $plugin_dir/conf.d/*.fish
|
||||
source $f
|
||||
end
|
||||
end
|
||||
|
||||
if test -f $plugin_dir/key_bindings.fish
|
||||
|
||||
@@ -49,6 +49,12 @@ let
|
||||
".getmail/getmail${if a.primary then "rc" else a.name}";
|
||||
|
||||
in {
|
||||
options = {
|
||||
accounts.email.accounts = mkOption {
|
||||
type = with types; attrsOf (submodule (import ./getmail-accounts.nix));
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf getmailEnabled {
|
||||
home.file = foldl' (a: b: a // b) { }
|
||||
(map (a: { "${renderConfigFilepath a}".text = renderAccountConfig a; })
|
||||
|
||||
53
modules/programs/gh.nix
Normal file
53
modules/programs/gh.nix
Normal file
@@ -0,0 +1,53 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.gh;
|
||||
|
||||
in {
|
||||
meta.maintainers = [ maintainers.gerschtli ];
|
||||
|
||||
options.programs.gh = {
|
||||
enable = mkEnableOption "GitHub CLI tool";
|
||||
|
||||
aliases = mkOption {
|
||||
type = with types; attrsOf str;
|
||||
default = { };
|
||||
example = literalExample ''
|
||||
{
|
||||
co = "pr checkout";
|
||||
pv = "pr view";
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Aliases that allow you to create nicknames for gh commands.
|
||||
'';
|
||||
};
|
||||
|
||||
editor = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
description = ''
|
||||
The editor that gh should run when creating issues, pull requests, etc.
|
||||
If blank, will refer to environment.
|
||||
'';
|
||||
};
|
||||
|
||||
gitProtocol = mkOption {
|
||||
type = types.enum [ "https" "ssh" ];
|
||||
default = "https";
|
||||
description = ''
|
||||
The protocol to use when performing Git operations.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.gitAndTools.gh ];
|
||||
|
||||
xdg.configFile."gh/config.yml".text =
|
||||
builtins.toJSON { inherit (cfg) aliases editor gitProtocol; };
|
||||
};
|
||||
}
|
||||
@@ -19,9 +19,19 @@ let
|
||||
else
|
||||
''${section} "${subsection}"'';
|
||||
|
||||
mkValueString = v:
|
||||
let
|
||||
escapedV = ''
|
||||
"${
|
||||
replaceStrings [ "\n" " " ''"'' "\\" ] [ "\\n" "\\t" ''\"'' "\\\\" ] v
|
||||
}"'';
|
||||
in generators.mkValueStringDefault { } (if isString v then escapedV else v);
|
||||
|
||||
# generation for multiple ini values
|
||||
mkKeyValue = k: v:
|
||||
let mkKeyValue = generators.mkKeyValueDefault { } " = " k;
|
||||
let
|
||||
mkKeyValue =
|
||||
generators.mkKeyValueDefault { inherit mkValueString; } " = " k;
|
||||
in concatStringsSep "\n" (map (kv: " " + mkKeyValue kv) (toList v));
|
||||
|
||||
# converts { a.b.c = 5; } to { "a.b".c = 5; } for toINI
|
||||
@@ -51,8 +61,13 @@ let
|
||||
signModule = types.submodule {
|
||||
options = {
|
||||
key = mkOption {
|
||||
type = types.str;
|
||||
description = "The default GPG signing key fingerprint.";
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
The default GPG signing key fingerprint.
|
||||
</para><para>
|
||||
Set to <literal>null</literal> to let GnuPG decide what signing key
|
||||
to use depending on commit’s author.
|
||||
'';
|
||||
};
|
||||
|
||||
signByDefault = mkOption {
|
||||
@@ -205,6 +220,36 @@ in {
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
delta = {
|
||||
enable = mkEnableOption "" // {
|
||||
description = ''
|
||||
Whether to enable the <command>delta</command> syntax highlighter.
|
||||
See <link xlink:href="https://github.com/dandavison/delta" />.
|
||||
'';
|
||||
};
|
||||
|
||||
options = mkOption {
|
||||
type = with types;
|
||||
let
|
||||
primitiveType = either str (either bool int);
|
||||
sectionType = attrsOf primitiveType;
|
||||
in attrsOf (either primitiveType sectionType);
|
||||
default = { };
|
||||
example = {
|
||||
features = "decorations";
|
||||
whitespace-error-style = "22 reverse";
|
||||
decorations = {
|
||||
commit-decoration-style = "bold yellow box ul";
|
||||
file-style = "bold yellow ul";
|
||||
file-decoration-style = "none";
|
||||
};
|
||||
};
|
||||
description = ''
|
||||
Options to configure delta.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -237,7 +282,14 @@ in {
|
||||
genIdentity = name: account:
|
||||
with account;
|
||||
nameValuePair "sendemail.${name}" ({
|
||||
smtpEncryption = if smtp.tls.enable then "tls" else "";
|
||||
smtpEncryption = if smtp.tls.enable then
|
||||
(if smtp.tls.useStartTls
|
||||
|| versionOlder config.home.stateVersion "20.09" then
|
||||
"tls"
|
||||
else
|
||||
"ssl")
|
||||
else
|
||||
"";
|
||||
smtpServer = smtp.host;
|
||||
smtpUser = userName;
|
||||
from = address;
|
||||
@@ -250,7 +302,7 @@ in {
|
||||
|
||||
(mkIf (cfg.signing != null) {
|
||||
programs.git.iniContent = {
|
||||
user.signingKey = cfg.signing.key;
|
||||
user.signingKey = mkIf (cfg.signing.key != null) cfg.signing.key;
|
||||
commit.gpgSign = cfg.signing.signByDefault;
|
||||
gpg.program = cfg.signing.gpgPath;
|
||||
};
|
||||
@@ -299,5 +351,15 @@ in {
|
||||
([ "git-lfs" "smudge" ] ++ skipArg ++ [ "--" "%f" ]);
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.delta.enable {
|
||||
programs.git.iniContent =
|
||||
let deltaCommand = "${pkgs.gitAndTools.delta}/bin/delta";
|
||||
in {
|
||||
core.pager = deltaCommand;
|
||||
interactive.diffFilter = "${deltaCommand} --color-only";
|
||||
delta = cfg.delta.options;
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -6,10 +6,13 @@ let
|
||||
|
||||
cfg = config.programs.gnome-terminal;
|
||||
|
||||
vteInitStr = ''
|
||||
# gnome-terminal: Show current directory in the terminal window title.
|
||||
. ${pkgs.gnome3.vte}/etc/profile.d/vte.sh
|
||||
'';
|
||||
eraseBinding = types.enum [
|
||||
"auto"
|
||||
"ascii-backspace"
|
||||
"ascii-delete"
|
||||
"delete-sequence"
|
||||
"tty"
|
||||
];
|
||||
|
||||
backForeSubModule = types.submodule ({ ... }: {
|
||||
options = {
|
||||
@@ -127,6 +130,104 @@ let
|
||||
The number of scrollback lines to keep, null for infinite.
|
||||
'';
|
||||
};
|
||||
|
||||
customCommand = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
The command to use to start the shell, or null for default shell.
|
||||
'';
|
||||
};
|
||||
|
||||
loginShell = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = "Run command as a login shell.";
|
||||
};
|
||||
|
||||
backspaceBinding = mkOption {
|
||||
default = "ascii-delete";
|
||||
type = eraseBinding;
|
||||
description = ''
|
||||
Which string the terminal should send to an application when the user
|
||||
presses the <emphasis>Backspace</emphasis> key.
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><literal>auto</literal></term>
|
||||
<listitem><para>
|
||||
Attempt to determine the right value from the terminal's IO settings.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>ascii-backspace</literal></term>
|
||||
<listitem><para>
|
||||
Send an ASCII backspace character (0x08).
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>ascii-delete</literal></term>
|
||||
<listitem><para>
|
||||
Send an ASCII delete character (0x7F).
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>delete-sequence</literal></term>
|
||||
<listitem><para>
|
||||
Send the <quote>@7</quote> control sequence.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>tty</literal></term>
|
||||
<listitem><para>
|
||||
Send terminal’s <quote>erase</quote> setting.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
'';
|
||||
};
|
||||
|
||||
deleteBinding = mkOption {
|
||||
default = "delete-sequence";
|
||||
type = eraseBinding;
|
||||
description = ''
|
||||
Which string the terminal should send to an application when the user
|
||||
presses the <emphasis>Delete</emphasis> key.
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><literal>auto</literal></term>
|
||||
<listitem><para>
|
||||
Send the <quote>@7</quote> control sequence.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>ascii-backspace</literal></term>
|
||||
<listitem><para>
|
||||
Send an ASCII backspace character (0x08).
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>ascii-delete</literal></term>
|
||||
<listitem><para>
|
||||
Send an ASCII delete character (0x7F).
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>delete-sequence</literal></term>
|
||||
<listitem><para>
|
||||
Send the <quote>@7</quote> control sequence.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>tty</literal></term>
|
||||
<listitem><para>
|
||||
Send terminal’s <quote>erase</quote> setting.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
'';
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
@@ -137,7 +238,15 @@ let
|
||||
scrollback-lines = pcfg.scrollbackLines;
|
||||
cursor-shape = pcfg.cursorShape;
|
||||
cursor-blink-mode = pcfg.cursorBlinkMode;
|
||||
} // (if (pcfg.font == null) then {
|
||||
login-shell = pcfg.loginShell;
|
||||
backspace-binding = pcfg.backspaceBinding;
|
||||
delete-binding = pcfg.deleteBinding;
|
||||
} // (if (pcfg.customCommand != null) then {
|
||||
use-custom-command = true;
|
||||
custom-command = pcfg.customCommand;
|
||||
} else {
|
||||
use-custom-command = false;
|
||||
}) // (if (pcfg.font == null) then {
|
||||
use-system-font = true;
|
||||
} else {
|
||||
use-system-font = false;
|
||||
@@ -186,7 +295,7 @@ in {
|
||||
|
||||
themeVariant = mkOption {
|
||||
default = "default";
|
||||
type = types.enum [ "default" "light" "dark" ];
|
||||
type = types.enum [ "default" "light" "dark" "system" ];
|
||||
description = "The theme variation to request";
|
||||
};
|
||||
|
||||
@@ -199,7 +308,7 @@ in {
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.gnome3.gnome_terminal ];
|
||||
home.packages = [ pkgs.gnome3.gnome-terminal ];
|
||||
|
||||
dconf.settings = let dconfPath = "org/gnome/terminal/legacy";
|
||||
in {
|
||||
@@ -217,7 +326,7 @@ in {
|
||||
(n: v: nameValuePair ("${dconfPath}/profiles:/:${n}") (buildProfileSet v))
|
||||
cfg.profile;
|
||||
|
||||
programs.bash.initExtra = mkBefore vteInitStr;
|
||||
programs.zsh.initExtra = vteInitStr;
|
||||
programs.bash.enableVteIntegration = true;
|
||||
programs.zsh.enableVteIntegration = true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -61,6 +61,9 @@ let
|
||||
CGROUP = 112;
|
||||
OOM = 113;
|
||||
IO_PRIORITY = 114;
|
||||
M_PSS = 118;
|
||||
M_SWAP = 119;
|
||||
M_PSSWP = 120;
|
||||
};
|
||||
|
||||
# Mapping from names to defaults
|
||||
@@ -76,16 +79,32 @@ let
|
||||
Hostname = 2;
|
||||
AllCPUs = 1;
|
||||
AllCPUs2 = 1;
|
||||
AllCPUs4 = 1;
|
||||
LeftCPUs = 1;
|
||||
RightCPUs = 1;
|
||||
Right = 1;
|
||||
CPUs = 1;
|
||||
LeftCPUs2 = 1;
|
||||
RightCPUs2 = 1;
|
||||
LeftCPUs4 = 1;
|
||||
RightCPUs4 = 1;
|
||||
Blank = 2;
|
||||
PressureStallCPUSome = 2;
|
||||
PressureStallIOSome = 2;
|
||||
PressureStallIOFull = 2;
|
||||
PressureStallMemorySome = 2;
|
||||
PressureStallMemoryFull = 2;
|
||||
ZFSARC = 2;
|
||||
ZFSCARC = 2;
|
||||
CPU = 1;
|
||||
"CPU(1)" = 1;
|
||||
"CPU(2)" = 1;
|
||||
"CPU(3)" = 1;
|
||||
"CPU(4)" = 1;
|
||||
"CPU(5)" = 1;
|
||||
"CPU(6)" = 1;
|
||||
"CPU(7)" = 1;
|
||||
"CPU(8)" = 1;
|
||||
};
|
||||
|
||||
singleMeterType = let
|
||||
@@ -268,6 +287,18 @@ in {
|
||||
description = "Count CPUs from 0 instead of 1.";
|
||||
};
|
||||
|
||||
showCpuUsage = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Show CPU usage frequency.";
|
||||
};
|
||||
|
||||
showCpuFrequency = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Show CPU frequency.";
|
||||
};
|
||||
|
||||
updateProcessNames = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
@@ -287,6 +318,12 @@ in {
|
||||
description = "Which color scheme to use.";
|
||||
};
|
||||
|
||||
enableMouse = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable mouse support.";
|
||||
};
|
||||
|
||||
delay = mkOption {
|
||||
type = types.int;
|
||||
default = 15;
|
||||
@@ -328,6 +365,11 @@ in {
|
||||
type = meterType;
|
||||
};
|
||||
|
||||
vimMode = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Vim key bindings.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
@@ -357,14 +399,18 @@ in {
|
||||
header_margin=${bool cfg.headerMargin}
|
||||
detailed_cpu_time=${bool cfg.detailedCpuTime}
|
||||
cpu_count_from_zero=${bool cfg.cpuCountFromZero}
|
||||
show_cpu_usage=${bool cfg.showCpuUsage}
|
||||
show_cpu_frequency=${bool cfg.showCpuFrequency}
|
||||
update_process_names=${bool cfg.updateProcessNames}
|
||||
account_guest_in_cpu_meter=${bool cfg.accountGuestInCpuMeter}
|
||||
color_scheme=${toString cfg.colorScheme}
|
||||
enable_mouse=${bool cfg.enableMouse}
|
||||
delay=${toString cfg.delay}
|
||||
left_meters=${list leftMeters}
|
||||
left_meter_modes=${list leftModes}
|
||||
right_meters=${list rightMeters}
|
||||
right_meter_modes=${list rightModes}
|
||||
vim_mode=${bool cfg.vimMode}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
208
modules/programs/i3status.nix
Normal file
208
modules/programs/i3status.nix
Normal file
@@ -0,0 +1,208 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.programs.i3status;
|
||||
|
||||
enabledModules = filterAttrs (n: v: v.enable) cfg.modules;
|
||||
|
||||
formatOrder = n: ''order += "${n}"'';
|
||||
|
||||
formatModule = n: v:
|
||||
let
|
||||
formatLine = n: v:
|
||||
let
|
||||
formatValue = v:
|
||||
if isBool v then
|
||||
(if v then "true" else "false")
|
||||
else if isString v then
|
||||
''"${v}"''
|
||||
else
|
||||
toString v;
|
||||
in "${n} = ${formatValue v}";
|
||||
in ''
|
||||
${n} {
|
||||
${concatStringsSep "\n " (mapAttrsToList formatLine v)}
|
||||
}
|
||||
'';
|
||||
|
||||
settingsType = with types; attrsOf (oneOf [ bool int str ]);
|
||||
|
||||
sortAttrNamesByPosition = comparator: set:
|
||||
let pos = n: set."${n}".position;
|
||||
in sort (a: b: comparator (pos a) (pos b)) (attrNames set);
|
||||
in {
|
||||
meta.maintainers = [ hm.maintainers.justinlovinger ];
|
||||
|
||||
options.programs.i3status = {
|
||||
enable = mkEnableOption "i3status";
|
||||
|
||||
enableDefault = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether or not to enable
|
||||
the default configuration.
|
||||
'';
|
||||
};
|
||||
|
||||
general = mkOption {
|
||||
type = settingsType;
|
||||
default = { };
|
||||
description = ''
|
||||
Configuration to add to i3status <filename>config</filename>
|
||||
<code>general</code> section.
|
||||
See
|
||||
<citerefentry>
|
||||
<refentrytitle>i3status</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
</citerefentry>
|
||||
for options.
|
||||
'';
|
||||
example = literalExample ''
|
||||
{
|
||||
colors = true;
|
||||
color_good = "#e0e0e0";
|
||||
color_degraded = "#d7ae00";
|
||||
color_bad = "#f69d6a";
|
||||
interval = 1;
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
modules = mkOption {
|
||||
type = types.attrsOf (types.submodule {
|
||||
options = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether or not to enable this module.
|
||||
'';
|
||||
};
|
||||
position = mkOption {
|
||||
type = with types; either int float;
|
||||
description = ''
|
||||
Position of this module in i3status <code>order</code>.
|
||||
'';
|
||||
};
|
||||
settings = mkOption {
|
||||
type = settingsType;
|
||||
default = { };
|
||||
description = ''
|
||||
Configuration to add to this i3status module.
|
||||
See
|
||||
<citerefentry>
|
||||
<refentrytitle>i3status</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
</citerefentry>
|
||||
for options.
|
||||
'';
|
||||
example = literalExample ''
|
||||
{
|
||||
format = "♪ %volume";
|
||||
format_muted = "♪ muted (%volume)";
|
||||
device = "pulse:1";
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
});
|
||||
default = { };
|
||||
description = ''
|
||||
Modules to add to i3status <filename>config</filename> file.
|
||||
See
|
||||
<citerefentry>
|
||||
<refentrytitle>i3status</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
</citerefentry>
|
||||
for options.
|
||||
'';
|
||||
example = literalExample ''
|
||||
{
|
||||
"volume master" = {
|
||||
position = 1;
|
||||
settings = {
|
||||
format = "♪ %volume";
|
||||
format_muted = "♪ muted (%volume)";
|
||||
device = "pulse:1";
|
||||
};
|
||||
};
|
||||
"disk /" = {
|
||||
position = 2;
|
||||
settings = {
|
||||
format = "/ %avail";
|
||||
};
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.i3status = mkIf cfg.enableDefault {
|
||||
general = {
|
||||
colors = mkDefault true;
|
||||
interval = mkDefault 5;
|
||||
};
|
||||
|
||||
modules = {
|
||||
ipv6 = { position = mkDefault 1; };
|
||||
|
||||
"wireless _first_" = {
|
||||
position = mkDefault 2;
|
||||
settings = {
|
||||
format_up = mkDefault "W: (%quality at %essid) %ip";
|
||||
format_down = mkDefault "W: down";
|
||||
};
|
||||
};
|
||||
|
||||
"ethernet _first_" = {
|
||||
position = mkDefault 3;
|
||||
settings = {
|
||||
format_up = mkDefault "E: %ip (%speed)";
|
||||
format_down = mkDefault "E: down";
|
||||
};
|
||||
};
|
||||
|
||||
"battery all" = {
|
||||
position = mkDefault 4;
|
||||
settings = { format = mkDefault "%status %percentage %remaining"; };
|
||||
};
|
||||
|
||||
"disk /" = {
|
||||
position = mkDefault 5;
|
||||
settings = { format = mkDefault "%avail"; };
|
||||
};
|
||||
|
||||
load = {
|
||||
position = mkDefault 6;
|
||||
settings = { format = mkDefault "%1min"; };
|
||||
};
|
||||
|
||||
memory = {
|
||||
position = mkDefault 7;
|
||||
settings = {
|
||||
format = mkDefault "%used | %available";
|
||||
threshold_degraded = mkDefault "1G";
|
||||
format_degraded = mkDefault "MEMORY < %available";
|
||||
};
|
||||
};
|
||||
|
||||
"tztime local" = {
|
||||
position = mkDefault 8;
|
||||
settings = { format = mkDefault "%Y-%m-%d %H:%M:%S"; };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = [ pkgs.i3status ];
|
||||
|
||||
xdg.configFile."i3status/config".text = concatStringsSep "\n" ([ ]
|
||||
++ optional (cfg.general != { }) (formatModule "general" cfg.general)
|
||||
++ map formatOrder (sortAttrNamesByPosition lessThan enabledModules)
|
||||
++ mapAttrsToList formatModule
|
||||
(mapAttrs (n: v: v.settings) enabledModules));
|
||||
};
|
||||
}
|
||||
@@ -1,22 +1,21 @@
|
||||
# info.nix -- install texinfo, set INFOPATH, create `dir` file
|
||||
# info.nix -- install texinfo and create `dir` file
|
||||
|
||||
# This is a helper for the GNU info documentation system. By default,
|
||||
# the `info` command (and the Info subsystem within Emacs) gives easy
|
||||
# access to the info files stored system-wide, but not info files in
|
||||
# your ~/.nix-profile.
|
||||
|
||||
# We set $INFOPATH to include `/run/current-system/sw/share/info` and
|
||||
# `~/.nix-profile/share/info` but it's not enough. Although info can
|
||||
# then find files when you explicitly ask for them, it doesn't show
|
||||
# them to you in the table of contents on startup. To do that requires
|
||||
# a `dir` file. NixOS keeps the system-wide `dir` file up to date, but
|
||||
# ignores home-installed packages.
|
||||
# Specifically, although info can then find files when you explicitly
|
||||
# ask for them, it doesn't show them to you in the table of contents
|
||||
# on startup. To do that requires a `dir` file. NixOS keeps the
|
||||
# system-wide `dir` file up to date, but ignores files installed in
|
||||
# user profiles.
|
||||
|
||||
# So this module contains an activation script that generates the
|
||||
# `dir` for your home profile. Then when you start info (and both
|
||||
# `dir` files are in your $INFOPATH), it will *merge* the contents of
|
||||
# the two files, showing you a unified table of contents for all
|
||||
# packages. This is really nice.
|
||||
# This module contains extra profile commands that generate the `dir`
|
||||
# for your home profile. Then when you start info (and both `dir`
|
||||
# files are in your $INFOPATH), it will *merge* the contents of the
|
||||
# two files, showing you a unified table of contents for all packages.
|
||||
# This is really nice.
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
@@ -26,50 +25,39 @@ let
|
||||
|
||||
cfg = config.programs.info;
|
||||
|
||||
# Indexes info files found in this location
|
||||
homeInfoPath = "${config.home.profileDirectory}/share/info";
|
||||
|
||||
# Installs this package -- the interactive just means that it
|
||||
# includes the curses `info` program. We also use `install-info`
|
||||
# from this package in the activation script.
|
||||
infoPkg = pkgs.texinfoInteractive;
|
||||
|
||||
in {
|
||||
options = {
|
||||
programs.info = {
|
||||
enable = mkEnableOption "GNU Info";
|
||||
imports = [
|
||||
(mkRemovedOptionModule [ "programs" "info" "homeInfoDirLocation" ] ''
|
||||
The `dir` file is now generated as part of the Home Manager profile and
|
||||
will no longer be placed in your home directory.
|
||||
'')
|
||||
];
|
||||
|
||||
homeInfoDirLocation = mkOption {
|
||||
default = "\${XDG_CACHE_HOME:-$HOME/.cache}/info";
|
||||
description = ''
|
||||
Directory in which to store the info <filename>dir</filename>
|
||||
file within your home.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
options.programs.info.enable = mkEnableOption "GNU Info";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.sessionVariables.INFOPATH =
|
||||
"${cfg.homeInfoDirLocation}\${INFOPATH:+:}\${INFOPATH}";
|
||||
home.packages = [
|
||||
infoPkg
|
||||
|
||||
home.activation.createHomeInfoDir =
|
||||
hm.dag.entryAfter [ "installPackages" ] ''
|
||||
oPATH=$PATH
|
||||
export PATH="${lib.makeBinPath [ pkgs.gzip ]}''${PATH:+:}$PATH"
|
||||
$DRY_RUN_CMD mkdir -p "${cfg.homeInfoDirLocation}"
|
||||
$DRY_RUN_CMD rm -f "${cfg.homeInfoDirLocation}/dir"
|
||||
if [[ -d "${homeInfoPath}" ]]; then
|
||||
find -L "${homeInfoPath}" \( -name '*.info' -o -name '*.info.gz' \) \
|
||||
-exec $DRY_RUN_CMD ${infoPkg}/bin/install-info '{}' \
|
||||
"${cfg.homeInfoDirLocation}/dir" \;
|
||||
fi
|
||||
export PATH="$oPATH"
|
||||
unset oPATH
|
||||
'';
|
||||
|
||||
home.packages = [ infoPkg ];
|
||||
# Make sure the target directory is a real directory.
|
||||
(pkgs.runCommandLocal "dummy-info-dir1" { } "mkdir -p $out/share/info")
|
||||
(pkgs.runCommandLocal "dummy-info-dir2" { } "mkdir -p $out/share/info")
|
||||
];
|
||||
|
||||
home.extraOutputsToInstall = [ "info" ];
|
||||
|
||||
home.extraProfileCommands = let infoPath = "$out/share/info";
|
||||
in ''
|
||||
if [[ -w "${infoPath}" && ! -e "${infoPath}/dir" ]]; then
|
||||
PATH="${lib.makeBinPath [ pkgs.gzip infoPkg ]}''${PATH:+:}$PATH" \
|
||||
find -L "${infoPath}" \( -name '*.info' -o -name '*.info.gz' \) \
|
||||
-exec install-info '{}' "${infoPath}/dir" ';'
|
||||
fi
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
@@ -97,16 +97,7 @@ let
|
||||
keyMapping = types.submodule {
|
||||
options = {
|
||||
mode = mkOption {
|
||||
type = types.enum [
|
||||
"insert"
|
||||
"normal"
|
||||
"prompt"
|
||||
"menu"
|
||||
"user"
|
||||
"goto"
|
||||
"view"
|
||||
"object"
|
||||
];
|
||||
type = types.str;
|
||||
example = "user";
|
||||
description = ''
|
||||
The mode in which the mapping takes effect.
|
||||
@@ -498,6 +489,10 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
kakouneWithPlugins = pkgs.wrapKakoune pkgs.kakoune-unwrapped {
|
||||
configure = { plugins = cfg.plugins; };
|
||||
};
|
||||
|
||||
configFile = let
|
||||
wrapOptions = with cfg.config.wrapLines;
|
||||
concatStrings [
|
||||
@@ -515,12 +510,22 @@ let
|
||||
];
|
||||
|
||||
showWhitespaceOptions = with cfg.config.showWhitespace;
|
||||
concatStrings [
|
||||
(optionalString (tab != null) " -tab ${tab}")
|
||||
(optionalString (tabStop != null) " -tabpad ${tabStop}")
|
||||
(optionalString (space != null) " -spc ${space}")
|
||||
(optionalString (nonBreakingSpace != null) " -nbsp ${nonBreakingSpace}")
|
||||
(optionalString (lineFeed != null) " -lf ${lineFeed}")
|
||||
let
|
||||
quoteSep = sep:
|
||||
if sep == "'" then
|
||||
''"'"''
|
||||
else if lib.strings.stringLength sep == 1 then
|
||||
"'${sep}'"
|
||||
else
|
||||
sep; # backwards compat, in case sep == "' '", etc.
|
||||
|
||||
in concatStrings [
|
||||
(optionalString (tab != null) " -tab ${quoteSep tab}")
|
||||
(optionalString (tabStop != null) " -tabpad ${quoteSep tabStop}")
|
||||
(optionalString (space != null) " -spc ${quoteSep space}")
|
||||
(optionalString (nonBreakingSpace != null)
|
||||
" -nbsp ${quoteSep nonBreakingSpace}")
|
||||
(optionalString (lineFeed != null) " -lf ${quoteSep lineFeed}")
|
||||
];
|
||||
|
||||
uiOptions = with cfg.config.ui;
|
||||
@@ -543,6 +548,21 @@ let
|
||||
}"
|
||||
];
|
||||
|
||||
userModeString = mode:
|
||||
optionalString (!builtins.elem mode [
|
||||
"insert"
|
||||
"normal"
|
||||
"prompt"
|
||||
"menu"
|
||||
"user"
|
||||
"goto"
|
||||
"view"
|
||||
"object"
|
||||
]) "try %{declare-user-mode ${mode}}";
|
||||
|
||||
userModeStrings = map userModeString
|
||||
(lists.unique (map (km: km.mode) cfg.config.keyMappings));
|
||||
|
||||
keyMappingString = km:
|
||||
concatStringsSep " " [
|
||||
"map global"
|
||||
@@ -592,7 +612,8 @@ let
|
||||
++ [ "# UI options" ]
|
||||
++ optional (ui != null) "set-option global ui_options ${uiOptions}"
|
||||
|
||||
++ [ "# Key mappings" ] ++ map keyMappingString keyMappings
|
||||
++ [ "# User modes" ] ++ userModeStrings ++ [ "# Key mappings" ]
|
||||
++ map keyMappingString keyMappings
|
||||
|
||||
++ [ "# Hooks" ] ++ map hookString hooks);
|
||||
in pkgs.writeText "kakrc"
|
||||
@@ -617,11 +638,22 @@ in {
|
||||
<filename>~/.config/kak/kakrc</filename>.
|
||||
'';
|
||||
};
|
||||
|
||||
plugins = mkOption {
|
||||
type = with types; listOf package;
|
||||
default = [ ];
|
||||
example = literalExample "[ pkgs.kakounePlugins.kak-fzf ]";
|
||||
description = ''
|
||||
List of kakoune plugins to install. To get a list of
|
||||
supported plugins run:
|
||||
<command>nix-env -f '<nixpkgs>' -qaP -A kakounePlugins</command>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.kakoune ];
|
||||
home.packages = [ kakouneWithPlugins ];
|
||||
xdg.configFile."kak/kakrc".source = configFile;
|
||||
};
|
||||
}
|
||||
|
||||
219
modules/programs/lf.nix
Normal file
219
modules/programs/lf.nix
Normal file
@@ -0,0 +1,219 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.programs.lf;
|
||||
|
||||
knownSettings = {
|
||||
anchorfind = types.bool;
|
||||
color256 = types.bool;
|
||||
dircounts = types.bool;
|
||||
dirfirst = types.bool;
|
||||
drawbox = types.bool;
|
||||
globsearch = types.bool;
|
||||
icons = types.bool;
|
||||
hidden = types.bool;
|
||||
ignorecase = types.bool;
|
||||
ignoredia = types.bool;
|
||||
incsearch = types.bool;
|
||||
preview = types.bool;
|
||||
reverse = types.bool;
|
||||
smartcase = types.bool;
|
||||
smartdia = types.bool;
|
||||
wrapscan = types.bool;
|
||||
wrapscroll = types.bool;
|
||||
number = types.bool;
|
||||
relativenumber = types.bool;
|
||||
findlen = types.int;
|
||||
period = types.int;
|
||||
scrolloff = types.int;
|
||||
tabstop = types.int;
|
||||
errorfmt = types.str;
|
||||
filesep = types.str;
|
||||
ifs = types.str;
|
||||
promptfmt = types.str;
|
||||
shell = types.str;
|
||||
sortby = types.str;
|
||||
timefmt = types.str;
|
||||
ratios = types.str;
|
||||
info = types.str;
|
||||
shellopts = types.str;
|
||||
};
|
||||
|
||||
lfSettingsType = types.submodule {
|
||||
options = let
|
||||
opt = name: type:
|
||||
mkOption {
|
||||
type = types.nullOr type;
|
||||
default = null;
|
||||
visible = false;
|
||||
};
|
||||
in mapAttrs opt knownSettings;
|
||||
};
|
||||
in {
|
||||
meta.maintainers = [ hm.maintainers.owm111 ];
|
||||
|
||||
options = {
|
||||
programs.lf = {
|
||||
enable = mkEnableOption "lf";
|
||||
|
||||
settings = mkOption {
|
||||
type = lfSettingsType;
|
||||
default = { };
|
||||
example = {
|
||||
tabstop = 4;
|
||||
number = true;
|
||||
ratios = "1:1:2";
|
||||
};
|
||||
description = ''
|
||||
An attribute set of lf settings. The attribute names and corresponding
|
||||
values must be among the following supported options.
|
||||
|
||||
<informaltable frame="none"><tgroup cols="1"><tbody>
|
||||
${concatStringsSep "\n" (mapAttrsToList (n: v: ''
|
||||
<row>
|
||||
<entry><varname>${n}</varname></entry>
|
||||
<entry>${v.description}</entry>
|
||||
</row>
|
||||
'') knownSettings)}
|
||||
</tbody></tgroup></informaltable>
|
||||
|
||||
See the lf documentation for detailed descriptions of these options.
|
||||
Note, use <varname>previewer</varname> to set lf's
|
||||
<varname>previewer</varname> option, and
|
||||
<varname>extraConfig</varname> for any other option not listed above.
|
||||
All string options are quoted with double quotes.
|
||||
'';
|
||||
};
|
||||
|
||||
commands = mkOption {
|
||||
type = with types; attrsOf (nullOr str);
|
||||
default = { };
|
||||
example = {
|
||||
get-mime-type = ''%xdg-mime query filetype "$f"'';
|
||||
open = "$$OPENER $f";
|
||||
};
|
||||
description = ''
|
||||
Commands to declare. Commands set to null or an empty string are
|
||||
deleted.
|
||||
'';
|
||||
};
|
||||
|
||||
keybindings = mkOption {
|
||||
type = with types; attrsOf (nullOr str);
|
||||
default = { };
|
||||
example = {
|
||||
gh = "cd ~";
|
||||
D = "trash";
|
||||
i = "$less $f";
|
||||
U = "!du -sh";
|
||||
gg = null;
|
||||
};
|
||||
description =
|
||||
"Keys to bind. Keys set to null or an empty string are deleted.";
|
||||
};
|
||||
|
||||
cmdKeybindings = mkOption {
|
||||
type = with types; attrsOf (nullOr str);
|
||||
default = { };
|
||||
example = literalExample ''{ "<c-g>" = "cmd-escape"; }'';
|
||||
description = ''
|
||||
Keys to bind to command line commands which can only be one of the
|
||||
builtin commands. Keys set to null or an empty string are deleted.
|
||||
'';
|
||||
};
|
||||
|
||||
previewer.source = mkOption {
|
||||
type = with types; nullOr path;
|
||||
default = null;
|
||||
example = literalExample ''
|
||||
pkgs.writeShellScript "pv.sh" '''
|
||||
#!/bin/sh
|
||||
|
||||
case "$1" in
|
||||
*.tar*) tar tf "$1";;
|
||||
*.zip) unzip -l "$1";;
|
||||
*.rar) unrar l "$1";;
|
||||
*.7z) 7z l "$1";;
|
||||
*.pdf) pdftotext "$1" -;;
|
||||
*) highlight -O ansi "$1" || cat "$1";;
|
||||
esac
|
||||
'''
|
||||
'';
|
||||
description = ''
|
||||
Script or executable to use to preview files. Sets lf's
|
||||
<varname>previewer</varname> option.
|
||||
'';
|
||||
};
|
||||
|
||||
previewer.keybinding = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
example = "i";
|
||||
description = ''
|
||||
Key to bind to the script at <varname>previewer.source</varname> and
|
||||
pipe through less. Setting to null will not bind any key.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = ''
|
||||
$mkdir -p ~/.trash
|
||||
'';
|
||||
description = "Custom lfrc lines.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.lf ];
|
||||
|
||||
xdg.configFile."lf/lfrc".text = let
|
||||
fmtSetting = k: v:
|
||||
optionalString (v != null) "set ${
|
||||
if isBool v then
|
||||
"${optionalString (!v) "no"}${k}"
|
||||
else
|
||||
"${k} ${if isInt v then toString v else ''"${v}"''}"
|
||||
}";
|
||||
|
||||
settingsStr = concatStringsSep "\n" (filter (x: x != "")
|
||||
(mapAttrsToList fmtSetting
|
||||
(builtins.intersectAttrs knownSettings cfg.settings)));
|
||||
|
||||
fmtCmdMap = before: k: v:
|
||||
"${before} ${k}${optionalString (v != null && v != "") " ${v}"}";
|
||||
fmtCmd = fmtCmdMap "cmd";
|
||||
fmtMap = fmtCmdMap "map";
|
||||
fmtCmap = fmtCmdMap "cmap";
|
||||
|
||||
commandsStr = concatStringsSep "\n" (mapAttrsToList fmtCmd cfg.commands);
|
||||
keybindingsStr =
|
||||
concatStringsSep "\n" (mapAttrsToList fmtMap cfg.keybindings);
|
||||
cmdKeybindingsStr =
|
||||
concatStringsSep "\n" (mapAttrsToList fmtCmap cfg.cmdKeybindings);
|
||||
|
||||
previewerStr = optionalString (cfg.previewer.source != null) ''
|
||||
set previewer ${cfg.previewer.source}
|
||||
${optionalString (cfg.previewer.keybinding != null) ''
|
||||
map ${cfg.previewer.keybinding} ''$${cfg.previewer.source} "$f" | less -R
|
||||
''}
|
||||
'';
|
||||
in ''
|
||||
${settingsStr}
|
||||
|
||||
${commandsStr}
|
||||
|
||||
${keybindingsStr}
|
||||
|
||||
${cmdKeybindingsStr}
|
||||
|
||||
${previewerStr}
|
||||
|
||||
${cfg.extraConfig}
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -43,6 +43,10 @@ in {
|
||||
options = {
|
||||
programs.lieer.enable =
|
||||
mkEnableOption "lieer Gmail synchronization for notmuch";
|
||||
|
||||
accounts.email.accounts = mkOption {
|
||||
type = with types; attrsOf (submodule (import ./lieer-accounts.nix));
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
|
||||
@@ -4,19 +4,69 @@ with lib;
|
||||
|
||||
{
|
||||
options = {
|
||||
programs.man.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable manual pages and the <command>man</command>
|
||||
command. This also includes "man" outputs of all
|
||||
<literal>home.packages</literal>.
|
||||
'';
|
||||
programs.man = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable manual pages and the <command>man</command>
|
||||
command. This also includes "man" outputs of all
|
||||
<literal>home.packages</literal>.
|
||||
'';
|
||||
};
|
||||
|
||||
generateCaches = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to generate the manual page index caches using
|
||||
<citerefentry>
|
||||
<refentrytitle>mandb</refentrytitle>
|
||||
<manvolnum>8</manvolnum>
|
||||
</citerefentry>. This allows searching for a page or
|
||||
keyword using utilities like <citerefentry>
|
||||
<refentrytitle>apropos</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
</citerefentry>.
|
||||
</para><para>
|
||||
This feature is disabled by default because it slows down
|
||||
building. If you don't mind waiting a few more seconds when
|
||||
Home Manager builds a new generation, you may safely enable
|
||||
this option.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf config.programs.man.enable {
|
||||
home.packages = [ pkgs.man ];
|
||||
home.extraOutputsToInstall = [ "man" ];
|
||||
|
||||
# This is mostly copy/pasted/adapted from NixOS' documentation.nix.
|
||||
home.file = mkIf config.programs.man.generateCaches {
|
||||
".manpath".text = let
|
||||
# Generate a directory containing installed packages' manpages.
|
||||
manualPages = pkgs.buildEnv {
|
||||
name = "man-paths";
|
||||
paths = config.home.packages;
|
||||
pathsToLink = [ "/share/man" ];
|
||||
extraOutputsToInstall = [ "man" ];
|
||||
ignoreCollisions = true;
|
||||
};
|
||||
|
||||
# Generate a database of all manpages in ${manualPages}.
|
||||
manualCache = pkgs.runCommandLocal "man-cache" { } ''
|
||||
# Generate a temporary man.conf so mandb knows where to
|
||||
# write cache files.
|
||||
echo "MANDB_MAP ${manualPages}/share/man $out" > man.conf
|
||||
|
||||
# Run mandb to generate cache files:
|
||||
${pkgs.man-db}/bin/mandb -C man.conf --no-straycats --create \
|
||||
${manualPages}/share/man
|
||||
'';
|
||||
in ''
|
||||
MANDB_MAP ${config.home.profileDirectory}/share/man ${manualCache}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ lib, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
@@ -6,6 +6,110 @@ let
|
||||
|
||||
extraConfigType = with lib.types; attrsOf (either (either str int) bool);
|
||||
|
||||
perAccountGroups = { name, config, ... }: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
# Make value of name the same as the name used with the dot prefix
|
||||
default = name;
|
||||
readOnly = true;
|
||||
description = ''
|
||||
The name of this group for this account. These names are different than
|
||||
some others, because they will hide channel names that are the same.
|
||||
'';
|
||||
};
|
||||
|
||||
channels = mkOption {
|
||||
type = types.attrsOf (types.submodule channel);
|
||||
default = { };
|
||||
description = ''
|
||||
List of channels that should be grouped together into this group. When
|
||||
performing a synchronization, the groups are synchronized, rather than
|
||||
the individual channels.
|
||||
</para><para>
|
||||
Using these channels and then grouping them together allows for you to
|
||||
define the maildir hierarchy as you see fit.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Options for configuring channel(s) that will be composed together into a group.
|
||||
channel = { name, config, ... }: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = name;
|
||||
readOnly = true;
|
||||
description = ''
|
||||
The unique name for THIS channel in THIS group. The group will refer to
|
||||
this channel by this name.
|
||||
</para><para>
|
||||
In addition, you can manually sync just this channel by specifying this
|
||||
name to mbsync on the command line.
|
||||
'';
|
||||
};
|
||||
|
||||
masterPattern = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
example = "[Gmail]/Sent Mail";
|
||||
description = ''
|
||||
IMAP4 patterns for which mailboxes on the remote mail server to sync.
|
||||
If <literal>Patterns</literal> are specified, <literal>masterPattern</literal>
|
||||
is interpreted as a prefix which is not matched against the patterns,
|
||||
and is not affected by mailbox list overrides.
|
||||
</para><para>
|
||||
If this is left as the default, then mbsync will default to the pattern
|
||||
<literal>INBOX</literal>.
|
||||
'';
|
||||
};
|
||||
|
||||
slavePattern = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
example = "Sent";
|
||||
description = ''
|
||||
Name for where mail coming from the master mail server will end up
|
||||
locally. The mailbox specified by the master's pattern will be placed
|
||||
in this directory.
|
||||
</para><para>
|
||||
If this is left as the default, then mbsync will default to the pattern
|
||||
<literal>INBOX</literal>.
|
||||
'';
|
||||
};
|
||||
|
||||
patterns = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "INBOX" ];
|
||||
description = ''
|
||||
Instead of synchronizing <emphasis>just</emphasis> the mailboxes that
|
||||
match the <literal>masterPattern</literal>, use it as a prefix which is
|
||||
not matched against the patterns, and is not affected by mailbox list
|
||||
overrides.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = extraConfigType;
|
||||
default = { };
|
||||
example = ''
|
||||
{
|
||||
Create = "both";
|
||||
CopyArrivalDate = "yes";
|
||||
MaxMessages = 10000;
|
||||
MaxSize = "1m";
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Extra configuration lines to add to <emphasis>THIS</emphasis> channel's
|
||||
configuration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
in {
|
||||
options.mbsync = {
|
||||
enable = mkEnableOption "synchronization using mbsync";
|
||||
@@ -58,6 +162,23 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
groups = mkOption {
|
||||
type = types.attrsOf (types.submodule perAccountGroups);
|
||||
default = { };
|
||||
# The default cannot actually be empty, but contains an attribute set where
|
||||
# the channels set is empty. If a group is specified, then a name is given,
|
||||
# creating the attribute set.
|
||||
description = ''
|
||||
Some email providers (Gmail) have a different directory hierarchy for
|
||||
synchronized email messages. Namely, when using mbsync without specifying
|
||||
a set of channels into a group, all synchronized directories end up beneath
|
||||
the <literal>[Gmail]/</literal> directory.
|
||||
</para><para>
|
||||
This option allows you to specify a group, and subsequently channels that
|
||||
will allow you to sync your mail into an arbitrary hierarchy.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig.channel = mkOption {
|
||||
type = extraConfigType;
|
||||
default = { };
|
||||
|
||||
@@ -69,23 +69,98 @@ let
|
||||
Inbox = "${maildir.absPath}/${folders.inbox}";
|
||||
SubFolders = "Verbatim";
|
||||
} // 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 = "*";
|
||||
} // mbsync.extraConfig.channel) + "\n";
|
||||
// mbsync.extraConfig.local) + "\n" + genChannels account;
|
||||
|
||||
genChannels = account:
|
||||
with account;
|
||||
if mbsync.groups == { } then
|
||||
genAccountWideChannel account
|
||||
else
|
||||
genGroupChannelConfig name mbsync.groups + "\n"
|
||||
+ genAccountGroups mbsync.groups;
|
||||
|
||||
# Used when no channels are specified for this account. This will create a
|
||||
# single channel for the entire account that is then further refined within
|
||||
# the Group for synchronization.
|
||||
genAccountWideChannel = account:
|
||||
with account;
|
||||
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";
|
||||
|
||||
# Given the attr set of groups, return a string of channels that will direct
|
||||
# mail to the proper directories, according to the pattern used in channel's
|
||||
# master pattern definition.
|
||||
genGroupChannelConfig = storeName: groups:
|
||||
let
|
||||
# Given the name of the group this channel is part of and the channel
|
||||
# itself, generate the string for the desired configuration.
|
||||
genChannelString = groupName: channel:
|
||||
let
|
||||
escapeValue = escape [ ''\"'' ];
|
||||
hasSpace = v: builtins.match ".* .*" v != null;
|
||||
# Given a list of patterns, will return the string requested.
|
||||
# Only prints if the pattern is NOT the empty list, the default.
|
||||
genChannelPatterns = patterns:
|
||||
if (length patterns) != 0 then
|
||||
"Pattern " + concatStringsSep " "
|
||||
(map (pat: if hasSpace pat then escapeValue pat else pat)
|
||||
patterns) + "\n"
|
||||
else
|
||||
"";
|
||||
in genSection "Channel ${groupName}-${channel.name}" ({
|
||||
Master = ":${storeName}-remote:${channel.masterPattern}";
|
||||
Slave = ":${storeName}-local:${channel.slavePattern}";
|
||||
} // channel.extraConfig) + genChannelPatterns channel.patterns;
|
||||
# Given the group name, and a attr set of channels within that group,
|
||||
# Generate a list of strings for each channels' configuration.
|
||||
genChannelStrings = groupName: channels:
|
||||
optionals (channels != { })
|
||||
(mapAttrsToList (channelName: info: genChannelString groupName info)
|
||||
channels);
|
||||
# Given a group, return a string that configures all the channels within
|
||||
# the group.
|
||||
genGroupsChannels = group:
|
||||
concatStringsSep "\n" (genChannelStrings group.name group.channels);
|
||||
# Generate all channel configurations for all groups for this account.
|
||||
in concatStringsSep "\n" (filter (s: s != "")
|
||||
(mapAttrsToList (name: group: genGroupsChannels group) groups));
|
||||
|
||||
# Given the attr set of groups, return a string which maps channels to groups
|
||||
genAccountGroups = groups:
|
||||
let
|
||||
# Given the name of the group and the attribute set of channels, make
|
||||
# make "Channel <grpName>-<chnName>" for each channel to list os strings
|
||||
genChannelStrings = groupName: channels:
|
||||
mapAttrsToList (name: info: "Channel ${groupName}-${name}") channels;
|
||||
# Take in 1 group, if the group has channels specified, construct the
|
||||
# "Group <grpName>" header and each of the channels.
|
||||
genGroupChannelString = group:
|
||||
flatten (optionals (group.channels != { }) ([ "Group ${group.name}" ]
|
||||
++ (genChannelStrings group.name group.channels)));
|
||||
# Given set of groups, generates list of strings, where each string is one
|
||||
# of the groups and its consituent channels.
|
||||
genGroupsStrings = mapAttrsToList (name: info:
|
||||
concatStringsSep "\n" (genGroupChannelString groups.${name})) groups;
|
||||
in concatStringsSep "\n\n" (filter (s: s != "")
|
||||
genGroupsStrings) # filter for the cases of empty groups
|
||||
+ "\n"; # Put all strings together.
|
||||
|
||||
genGroupConfig = name: channels:
|
||||
let
|
||||
genGroupChannel = n: boxes: "Channel ${n}:${concatStringsSep "," boxes}";
|
||||
in concatStringsSep "\n"
|
||||
in "\n" + concatStringsSep "\n"
|
||||
([ "Group ${name}" ] ++ mapAttrsToList genGroupChannel channels);
|
||||
|
||||
in {
|
||||
meta.maintainers = [ maintainers.KarlJoad ];
|
||||
|
||||
options = {
|
||||
programs.mbsync = {
|
||||
enable = mkEnableOption "mbsync IMAP4 and Maildir mailbox synchronizer";
|
||||
@@ -122,6 +197,10 @@ in {
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
accounts.email.accounts = mkOption {
|
||||
type = with types; attrsOf (submodule (import ./mbsync-accounts.nix));
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
@@ -146,11 +225,20 @@ in {
|
||||
|
||||
home.file.".mbsyncrc".text = let
|
||||
accountsConfig = map genAccountConfig mbsyncAccounts;
|
||||
groupsConfig = mapAttrsToList genGroupConfig cfg.groups;
|
||||
in concatStringsSep "\n" ([''
|
||||
# Only generate this kind of Group configuration if there are ANY accounts
|
||||
# that do NOT have a per-account groups/channels option(s) specified.
|
||||
groupsConfig =
|
||||
if any (account: account.mbsync.groups == { }) mbsyncAccounts then
|
||||
mapAttrsToList genGroupConfig cfg.groups
|
||||
else
|
||||
[ ];
|
||||
in ''
|
||||
# Generated by Home Manager.
|
||||
''] ++ optional (cfg.extraConfig != "") cfg.extraConfig ++ accountsConfig
|
||||
++ groupsConfig) + "\n";
|
||||
|
||||
''
|
||||
+ concatStringsSep "\n" (optional (cfg.extraConfig != "") cfg.extraConfig)
|
||||
+ concatStringsSep "\n\n" accountsConfig
|
||||
+ concatStringsSep "\n" groupsConfig;
|
||||
|
||||
home.activation = mkIf (mbsyncAccounts != [ ]) {
|
||||
createMaildir =
|
||||
|
||||
79
modules/programs/mcfly.nix
Normal file
79
modules/programs/mcfly.nix
Normal file
@@ -0,0 +1,79 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
|
||||
cfg = config.programs.mcfly;
|
||||
|
||||
in {
|
||||
meta.maintainers = [ maintainers.marsam ];
|
||||
|
||||
options.programs.mcfly = {
|
||||
enable = mkEnableOption "mcfly";
|
||||
|
||||
keyScheme = mkOption {
|
||||
type = types.enum [ "emacs" "vim" ];
|
||||
default = "emacs";
|
||||
description = ''
|
||||
Key scheme to use.
|
||||
'';
|
||||
};
|
||||
|
||||
enableLightTheme = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enable light mode theme.
|
||||
'';
|
||||
};
|
||||
|
||||
enableBashIntegration = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enable Bash integration.
|
||||
'';
|
||||
};
|
||||
|
||||
enableZshIntegration = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enable Zsh integration.
|
||||
'';
|
||||
};
|
||||
|
||||
enableFishIntegration = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enable Fish integration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
home.packages = [ pkgs.mcfly ];
|
||||
|
||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
||||
source "${pkgs.mcfly}/share/mcfly/mcfly.bash"
|
||||
'';
|
||||
|
||||
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
||||
source "${pkgs.mcfly}/share/mcfly/mcfly.zsh"
|
||||
'';
|
||||
|
||||
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
|
||||
source "${pkgs.mcfly}/share/mcfly/mcfly.fish"
|
||||
if status is-interactive
|
||||
mcfly_key_bindings
|
||||
end
|
||||
'';
|
||||
|
||||
home.sessionVariables.MCFLY_KEY_SCHEME = cfg.keyScheme;
|
||||
}
|
||||
|
||||
(mkIf cfg.enableLightTheme { home.sessionVariables.MCFLY_LIGHT = "TRUE"; })
|
||||
]);
|
||||
}
|
||||
@@ -8,7 +8,8 @@ let
|
||||
cfg = config.programs.mpv;
|
||||
|
||||
mpvOption = with types; either str (either int (either bool float));
|
||||
mpvOptions = with types; attrsOf mpvOption;
|
||||
mpvOptionDup = with types; either mpvOption (listOf mpvOption);
|
||||
mpvOptions = with types; attrsOf mpvOptionDup;
|
||||
mpvProfiles = with types; attrsOf mpvOptions;
|
||||
mpvBindings = with types; attrsOf str;
|
||||
|
||||
@@ -22,28 +23,46 @@ let
|
||||
string = option;
|
||||
}.${typeOf option};
|
||||
|
||||
renderOptions = options:
|
||||
concatStringsSep "\n" (mapAttrsToList (name: value:
|
||||
let
|
||||
rendered = renderOption value;
|
||||
length = toString (stringLength rendered);
|
||||
in "${name}=%${length}%${rendered}") options);
|
||||
renderOptionValue = value:
|
||||
let
|
||||
rendered = renderOption value;
|
||||
length = toString (stringLength rendered);
|
||||
in "%${length}%${rendered}";
|
||||
|
||||
renderProfiles = profiles:
|
||||
concatStringsSep "\n" (mapAttrsToList (name: value: ''
|
||||
[${name}]
|
||||
${renderOptions value}
|
||||
'') profiles);
|
||||
renderOptions = generators.toKeyValue {
|
||||
mkKeyValue =
|
||||
generators.mkKeyValueDefault { mkValueString = renderOptionValue; } "=";
|
||||
listsAsDuplicateKeys = true;
|
||||
};
|
||||
|
||||
renderProfiles = generators.toINI {
|
||||
mkKeyValue =
|
||||
generators.mkKeyValueDefault { mkValueString = renderOptionValue; } "=";
|
||||
listsAsDuplicateKeys = true;
|
||||
};
|
||||
|
||||
renderBindings = bindings:
|
||||
concatStringsSep "\n"
|
||||
(mapAttrsToList (name: value: "${name} ${value}") bindings);
|
||||
|
||||
mpvPackage = if cfg.scripts == [ ] then
|
||||
pkgs.mpv
|
||||
else
|
||||
pkgs.wrapMpv pkgs.mpv-unwrapped { scripts = cfg.scripts; };
|
||||
|
||||
in {
|
||||
options = {
|
||||
programs.mpv = {
|
||||
enable = mkEnableOption "mpv";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
readOnly = true;
|
||||
description = ''
|
||||
Resulting mpv package.
|
||||
'';
|
||||
};
|
||||
|
||||
scripts = mkOption {
|
||||
type = with types; listOf (either package str);
|
||||
default = [ ];
|
||||
@@ -121,12 +140,8 @@ in {
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
home.packages = [
|
||||
(if cfg.scripts == [ ] then
|
||||
pkgs.mpv
|
||||
else
|
||||
pkgs.mpv-with-scripts.override { scripts = cfg.scripts; })
|
||||
];
|
||||
home.packages = [ mpvPackage ];
|
||||
programs.mpv.package = mpvPackage;
|
||||
}
|
||||
(mkIf (cfg.config != { } || cfg.profiles != { }) {
|
||||
xdg.configFile."mpv/mpv.conf".text = ''
|
||||
|
||||
@@ -56,6 +56,10 @@ in {
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
accounts.email.accounts = mkOption {
|
||||
type = with types; attrsOf (submodule (import ./msmtp-accounts.nix));
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
57
modules/programs/mu.nix
Normal file
57
modules/programs/mu.nix
Normal file
@@ -0,0 +1,57 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.mu;
|
||||
|
||||
# Used to generate command line arguments that mu can operate with.
|
||||
genCmdMaildir = path: "--maildir=" + path;
|
||||
|
||||
# Takes the list of accounts with mu.enable = true, and generates a
|
||||
# command-line flag for initializing the mu database.
|
||||
myAddresses = let
|
||||
# List of account sets where mu.enable = true.
|
||||
muAccounts =
|
||||
filter (a: a.mu.enable) (attrValues config.accounts.email.accounts);
|
||||
addrs = map (a: a.address) muAccounts;
|
||||
# Prefix --my-address= to each account's address with mu.enable.
|
||||
addMyAddress = map (addr: "--my-address=" + addr) addrs;
|
||||
in concatStringsSep " " addMyAddress;
|
||||
|
||||
in {
|
||||
meta.maintainers = [ maintainers.KarlJoad ];
|
||||
|
||||
options = {
|
||||
programs.mu = {
|
||||
enable = mkEnableOption "mu, a maildir indexer and searcher";
|
||||
|
||||
# No options/config file present for mu, and program author will not be
|
||||
# adding one soon. See https://github.com/djcb/mu/issues/882 for more
|
||||
# information about this.
|
||||
};
|
||||
|
||||
accounts.email.accounts = mkOption {
|
||||
type = with types;
|
||||
attrsOf
|
||||
(submodule { options.mu.enable = mkEnableOption "mu indexing"; });
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.mu ];
|
||||
|
||||
home.activation.runMuInit = let
|
||||
maildirOption = genCmdMaildir config.accounts.email.maildirBasePath;
|
||||
dbLocation = config.xdg.cacheHome + "/mu";
|
||||
in hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
# If the database directory exists, then `mu init` should NOT be run.
|
||||
# In theory, mu is the only thing that creates that directory, and it is
|
||||
# only created during the initial index.
|
||||
if [[ ! -d "${dbLocation}" ]]; then
|
||||
$DRY_RUN_CMD mu init ${maildirOption} $VERBOSE_ARG;
|
||||
fi
|
||||
'';
|
||||
};
|
||||
}
|
||||
135
modules/programs/ncmpcpp.nix
Normal file
135
modules/programs/ncmpcpp.nix
Normal file
@@ -0,0 +1,135 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.ncmpcpp;
|
||||
|
||||
renderSettings = settings:
|
||||
concatStringsSep "\n" (mapAttrsToList renderSetting settings);
|
||||
|
||||
renderSetting = name: value: "${name}=${renderValue value}";
|
||||
|
||||
renderValue = option:
|
||||
{
|
||||
int = toString option;
|
||||
bool = if option then "yes" else "no";
|
||||
string = option;
|
||||
}.${builtins.typeOf option};
|
||||
|
||||
renderBindings = bindings: concatStringsSep "\n" (map renderBinding bindings);
|
||||
|
||||
renderBinding = { key, command }:
|
||||
concatStringsSep "\n " ([ ''def_key "${key}"'' ] ++ maybeWrapList command);
|
||||
|
||||
maybeWrapList = xs: if isList xs then xs else [ xs ];
|
||||
|
||||
valueType = with types; oneOf [ bool int str ];
|
||||
|
||||
bindingType = types.submodule ({ name, config, ... }: {
|
||||
options = {
|
||||
key = mkOption {
|
||||
type = types.str;
|
||||
description = "Key to bind.";
|
||||
example = "j";
|
||||
};
|
||||
|
||||
command = mkOption {
|
||||
type = with types; either str (listOf str);
|
||||
description = "Command or sequence of commands to be executed.";
|
||||
example = "scroll_down";
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
in {
|
||||
meta.maintainers = with maintainers; [ olmokramer ];
|
||||
|
||||
options.programs.ncmpcpp = {
|
||||
enable =
|
||||
mkEnableOption "ncmpcpp - an ncurses Music Player Daemon (MPD) client";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.ncmpcpp;
|
||||
defaultText = literalExample "pkgs.ncmpcpp";
|
||||
description = ''
|
||||
Package providing the <code>ncmpcpp</code> command.
|
||||
'';
|
||||
example =
|
||||
literalExample "pkgs.ncmpcpp.override { visualizerSupport = true; }";
|
||||
};
|
||||
|
||||
mpdMusicDir = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = let mpdCfg = config.services.mpd;
|
||||
in if pkgs.stdenv.hostPlatform.isLinux && mpdCfg.enable then
|
||||
mpdCfg.musicDirectory
|
||||
else
|
||||
null;
|
||||
defaultText = literalExample ''
|
||||
if pkgs.stdenv.hostPlatform.isLinux && config.services.mpd.enable then
|
||||
config.services.mpd.musicDirectory
|
||||
else
|
||||
null
|
||||
'';
|
||||
description = ''
|
||||
Value of the <code>mpd_music_dir</code> setting. On Linux platforms the
|
||||
value of <varname>services.mpd.musicDirectory</varname> is used as the
|
||||
default if <varname>services.mpd.enable</varname> is
|
||||
<literal>true</literal>.
|
||||
'';
|
||||
example = "~/music";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = types.attrsOf valueType;
|
||||
default = { };
|
||||
description = ''
|
||||
Attribute set from name of a setting to its value. For available options
|
||||
see
|
||||
<citerefentry>
|
||||
<refentrytitle>ncmpcpp</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
</citerefentry>.
|
||||
'';
|
||||
example = { ncmpcpp_directory = "~/.local/share/ncmpcpp"; };
|
||||
};
|
||||
|
||||
bindings = mkOption {
|
||||
type = types.listOf bindingType;
|
||||
default = [ ];
|
||||
description = "List of keybindings.";
|
||||
example = literalExample ''
|
||||
[
|
||||
{ key = "j"; command = "scroll_down"; }
|
||||
{ key = "k"; command = "scroll_up"; }
|
||||
{ key = "J"; command = [ "select_item" "scroll_down" ]; }
|
||||
{ key = "K"; command = [ "select_item" "scroll_up" ]; }
|
||||
]
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
warnings = mkIf (cfg.settings ? mpd_music_dir && cfg.mpdMusicDir != null) [
|
||||
("programs.ncmpcpp.settings.mpd_music_dir will be overridden by"
|
||||
+ " programs.ncmpcpp.mpdMusicDir.")
|
||||
];
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile = {
|
||||
"ncmpcpp/config" = let
|
||||
settings = cfg.settings // optionalAttrs (cfg.mpdMusicDir != null) {
|
||||
mpd_music_dir = toString cfg.mpdMusicDir;
|
||||
};
|
||||
in mkIf (settings != { }) { text = renderSettings settings + "\n"; };
|
||||
|
||||
"ncmpcpp/bindings" = mkIf (cfg.bindings != [ ]) {
|
||||
text = renderBindings cfg.bindings + "\n";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
95
modules/programs/ne.nix
Normal file
95
modules/programs/ne.nix
Normal file
@@ -0,0 +1,95 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.ne;
|
||||
|
||||
autoPrefFiles = let
|
||||
autoprefs = cfg.automaticPreferences
|
||||
// optionalAttrs (cfg.defaultPreferences != "") {
|
||||
".default" = cfg.defaultPreferences;
|
||||
};
|
||||
|
||||
gen = fileExtension: configText:
|
||||
nameValuePair ".ne/${fileExtension}#ap" {
|
||||
text = configText;
|
||||
}; # Generates [path].text format expected by home.file.
|
||||
in mapAttrs' gen autoprefs;
|
||||
|
||||
in {
|
||||
meta.maintainers = [ hm.maintainers.cwyc ];
|
||||
|
||||
options.programs.ne = {
|
||||
enable = mkEnableOption "ne";
|
||||
|
||||
keybindings = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = ''
|
||||
KEY 7f BS
|
||||
SEQ "\x1b[1;5D" 7f
|
||||
'';
|
||||
description = ''
|
||||
Keybinding file for ne.
|
||||
'';
|
||||
};
|
||||
|
||||
defaultPreferences = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Default preferences for ne.
|
||||
</para><para>
|
||||
Equivalent to <literal>programs.ne.automaticPreferences.".default"</literal>.
|
||||
'';
|
||||
};
|
||||
|
||||
automaticPreferences = mkOption {
|
||||
type = types.attrsOf types.lines;
|
||||
default = { };
|
||||
example = literalExample ''
|
||||
{
|
||||
nix = '''
|
||||
TAB 0
|
||||
TS 2
|
||||
''';
|
||||
js = '''
|
||||
TS 4
|
||||
''';
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Automatic preferences files for ne.
|
||||
'';
|
||||
};
|
||||
|
||||
menus = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = "Menu configuration file for ne.";
|
||||
};
|
||||
|
||||
virtualExtensions = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = ''
|
||||
sh 1 ^#!\s*/.*\b(bash|sh|ksh|zsh)\s*
|
||||
csh 1 ^#!\s*/.*\b(csh|tcsh)\s*
|
||||
'';
|
||||
description = "Virtual extensions configuration file for ne.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.ne ];
|
||||
|
||||
home.file = {
|
||||
".ne/.keys" = mkIf (cfg.keybindings != "") { text = cfg.keybindings; };
|
||||
".ne/.extensions" =
|
||||
mkIf (cfg.virtualExtensions != "") { text = cfg.virtualExtensions; };
|
||||
".ne/.menus" = mkIf (cfg.menus != "") { text = cfg.menus; };
|
||||
} // autoPrefFiles;
|
||||
};
|
||||
}
|
||||
@@ -111,7 +111,9 @@ let
|
||||
} else
|
||||
let
|
||||
smtpProto = if smtp.tls.enable then "smtps" else "smtp";
|
||||
smtpBaseUrl = "${smtpProto}://${escape userName}@${smtp.host}";
|
||||
smtpPort = if smtp.port != null then ":${toString smtp.port}" else "";
|
||||
smtpBaseUrl =
|
||||
"${smtpProto}://${escape userName}@${smtp.host}${smtpPort}";
|
||||
in {
|
||||
smtp_url = "'${smtpBaseUrl}'";
|
||||
smtp_pass = "'`${passCmd}`'";
|
||||
@@ -122,7 +124,7 @@ let
|
||||
let
|
||||
folderHook = mapAttrsToList setOption (genCommonFolderHooks account // {
|
||||
folder = "'${account.maildir.absPath}'";
|
||||
}) ++ optional (neomutt.extraConfig != "") neomutt.extraConfig;
|
||||
});
|
||||
in ''
|
||||
${concatStringsSep "\n" folderHook}
|
||||
'';
|
||||
@@ -262,6 +264,10 @@ in {
|
||||
description = "Extra configuration appended to the end.";
|
||||
};
|
||||
};
|
||||
|
||||
accounts.email.accounts = mkOption {
|
||||
type = with types; attrsOf (submodule (import ./neomutt-accounts.nix));
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
@@ -9,32 +9,53 @@ let
|
||||
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);
|
||||
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);
|
||||
check = with types;
|
||||
(x: if isFunction x then isList (x pkgs.python3Packages) else false);
|
||||
merge = mergeOneOption;
|
||||
};
|
||||
|
||||
moduleConfigure =
|
||||
optionalAttrs (cfg.extraConfig != "") {
|
||||
customRC = cfg.extraConfig;
|
||||
}
|
||||
// optionalAttrs (cfg.plugins != []) {
|
||||
packages.home-manager.start = cfg.plugins;
|
||||
pluginWithConfigType = types.submodule {
|
||||
options = {
|
||||
plugin = mkOption {
|
||||
type = types.package;
|
||||
description = "vim plugin";
|
||||
};
|
||||
config = mkOption {
|
||||
type = types.lines;
|
||||
description = "vimscript for this plugin to be placed in init.vim";
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
# A function to get the configuration string (if any) from an element of 'plugins'
|
||||
pluginConfig = p:
|
||||
if builtins.hasAttr "plugin" p && builtins.hasAttr "config" p then ''
|
||||
" ${p.plugin.pname} {{{
|
||||
${p.config}
|
||||
" }}}
|
||||
'' else
|
||||
"";
|
||||
|
||||
{
|
||||
moduleConfigure = optionalAttrs (cfg.extraConfig != ""
|
||||
|| (lib.filter (hasAttr "config") cfg.plugins) != [ ]) {
|
||||
customRC = cfg.extraConfig
|
||||
+ pkgs.lib.concatMapStrings pluginConfig cfg.plugins;
|
||||
} // optionalAttrs (cfg.plugins != [ ]) {
|
||||
packages.home-manager.start = map (x: x.plugin or x) cfg.plugins;
|
||||
};
|
||||
extraMakeWrapperArgs = lib.optionalString (cfg.extraPackages != [ ])
|
||||
''--prefix PATH : "${lib.makeBinPath cfg.extraPackages}"'';
|
||||
|
||||
in {
|
||||
options = {
|
||||
programs.neovim = {
|
||||
enable = mkEnableOption "Neovim";
|
||||
@@ -83,7 +104,7 @@ in
|
||||
|
||||
extraPythonPackages = mkOption {
|
||||
type = with types; either extraPythonPackageType (listOf package);
|
||||
default = (_: []);
|
||||
default = (_: [ ]);
|
||||
defaultText = "ps: []";
|
||||
example = literalExample "(ps: with ps; [ pandas jedi ])";
|
||||
description = ''
|
||||
@@ -111,7 +132,7 @@ in
|
||||
|
||||
extraPython3Packages = mkOption {
|
||||
type = with types; either extraPython3PackageType (listOf package);
|
||||
default = (_: []);
|
||||
default = (_: [ ]);
|
||||
defaultText = "ps: []";
|
||||
example = literalExample "(ps: with ps; [ python-language-server ])";
|
||||
description = ''
|
||||
@@ -136,7 +157,7 @@ in
|
||||
|
||||
configure = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
default = { };
|
||||
example = literalExample ''
|
||||
configure = {
|
||||
customRC = $''''
|
||||
@@ -177,12 +198,28 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
plugins = mkOption {
|
||||
extraPackages = mkOption {
|
||||
type = with types; listOf package;
|
||||
default = [ ];
|
||||
example = literalExample "[ pkgs.vimPlugins.yankring ]";
|
||||
example = "[ pkgs.shfmt ]";
|
||||
description = "Extra packages available to nvim.";
|
||||
};
|
||||
|
||||
plugins = mkOption {
|
||||
type = with types; listOf (either package pluginWithConfigType);
|
||||
default = [ ];
|
||||
example = literalExample ''
|
||||
with pkgs.vimPlugins; [
|
||||
yankring
|
||||
vim-nix
|
||||
{ plugin = vim-startify;
|
||||
config = "let g:startify_change_to_vcs_root = 0";
|
||||
}
|
||||
]
|
||||
'';
|
||||
description = ''
|
||||
List of vim plugins to install.
|
||||
List of vim plugins to install optionally associated with
|
||||
configuration to be placed in init.vim.
|
||||
|
||||
</para><para>
|
||||
|
||||
@@ -193,27 +230,25 @@ in
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.configure == { } || moduleConfigure == { };
|
||||
message = "The programs.neovim option configure is mutually exclusive"
|
||||
+ " with extraConfig and plugins.";
|
||||
}
|
||||
];
|
||||
assertions = [{
|
||||
assertion = cfg.configure == { } || moduleConfigure == { };
|
||||
message = "The programs.neovim option configure is mutually exclusive"
|
||||
+ " with extraConfig and plugins.";
|
||||
}];
|
||||
|
||||
home.packages = [ cfg.finalPackage ];
|
||||
|
||||
programs.neovim.finalPackage = pkgs.wrapNeovim cfg.package {
|
||||
inherit (cfg)
|
||||
extraPython3Packages withPython3
|
||||
extraPythonPackages withPython
|
||||
extraPython3Packages withPython3 extraPythonPackages withPython
|
||||
withNodeJs withRuby viAlias vimAlias;
|
||||
|
||||
extraMakeWrapperArgs = extraMakeWrapperArgs;
|
||||
configure = cfg.configure // moduleConfigure;
|
||||
};
|
||||
|
||||
programs.bash.shellAliases = mkIf cfg.vimdiffAlias { vimdiff = "nvim -d"; };
|
||||
programs.fish.shellAliases = mkIf cfg.vimdiffAlias { vimdiff = "nvim -d"; };
|
||||
programs.zsh.shellAliases = mkIf cfg.vimdiffAlias { vimdiff = "nvim -d"; };
|
||||
programs.zsh.shellAliases = mkIf cfg.vimdiffAlias { vimdiff = "nvim -d"; };
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
options.notmuch = { enable = lib.mkEnableOption "notmuch indexing"; };
|
||||
}
|
||||
@@ -143,6 +143,13 @@ in {
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
accounts.email.accounts = mkOption {
|
||||
type = with types;
|
||||
attrsOf (submodule {
|
||||
options.notmuch.enable = mkEnableOption "notmuch indexing";
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
68
modules/programs/nushell.nix
Normal file
68
modules/programs/nushell.nix
Normal file
@@ -0,0 +1,68 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.nushell;
|
||||
|
||||
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 {
|
||||
meta.maintainers = [ maintainers.Philipp-M ];
|
||||
|
||||
options.programs.nushell = {
|
||||
enable = mkEnableOption "nushell";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.nushell;
|
||||
defaultText = literalExample "pkgs.nushell";
|
||||
description = "The package to use for nushell.";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = with types;
|
||||
let
|
||||
prim = oneOf [ bool int str ];
|
||||
primOrPrimAttrs = either prim (attrsOf prim);
|
||||
entry = either prim (listOf primOrPrimAttrs);
|
||||
entryOrAttrsOf = t: either entry (attrsOf t);
|
||||
entries = entryOrAttrsOf (entryOrAttrsOf entry);
|
||||
in attrsOf entries // { description = "Nushell configuration"; };
|
||||
default = { };
|
||||
example = literalExample ''
|
||||
{
|
||||
edit_mode = "vi";
|
||||
startup = [ "alias la [] { ls -a }" "alias e [msg] { echo $msg }" ];
|
||||
key_timeout = 10;
|
||||
completion_mode = "circular";
|
||||
no_auto_pivot = true;
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Configuration written to
|
||||
<filename>~/.config/nushell/config.toml</filename>.
|
||||
</para><para>
|
||||
See <link xlink:href="https://www.nushell.sh/book/en/configuration.html" /> for the full list
|
||||
of options.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile."nu/config.toml" =
|
||||
mkIf (cfg.settings != { }) { source = configFile cfg.settings; };
|
||||
};
|
||||
}
|
||||
@@ -147,6 +147,11 @@ in {
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
accounts.email.accounts = mkOption {
|
||||
type = with types;
|
||||
attrsOf (submodule (import ./offlineimap-accounts.nix));
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
88
modules/programs/pet.nix
Normal file
88
modules/programs/pet.nix
Normal file
@@ -0,0 +1,88 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.pet;
|
||||
|
||||
format = pkgs.formats.toml { };
|
||||
|
||||
snippetType = types.submodule {
|
||||
options = {
|
||||
description = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
example = "Count the number of commits in the current branch";
|
||||
description = ''
|
||||
Description of the snippet.
|
||||
'';
|
||||
};
|
||||
|
||||
command = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
example = "git rev-list --count HEAD";
|
||||
description = ''
|
||||
The command.
|
||||
'';
|
||||
};
|
||||
|
||||
output = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
example = "473";
|
||||
description = ''
|
||||
Example output of the command.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
in {
|
||||
options.programs.pet = {
|
||||
enable = mkEnableOption "pet";
|
||||
|
||||
settings = mkOption {
|
||||
type = format.type;
|
||||
default = { };
|
||||
description = ''
|
||||
Settings written to <filename>config.toml</filename>. See the pet
|
||||
documentation for details.
|
||||
'';
|
||||
};
|
||||
|
||||
selectcmdPackage = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.fzf;
|
||||
defaultText = literalExample "pkgs.fzf";
|
||||
description = ''
|
||||
The package needed for the <varname>settings.selectcmd</varname>.
|
||||
'';
|
||||
};
|
||||
|
||||
snippets = mkOption {
|
||||
type = types.listOf snippetType;
|
||||
default = [ ];
|
||||
description = ''
|
||||
The snippets.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.pet.settings = {
|
||||
selectcmd = mkDefault "fzf";
|
||||
snippetfile = config.xdg.configHome + "/pet/snippet.toml";
|
||||
};
|
||||
|
||||
home.packages = [ pkgs.pet cfg.selectcmdPackage ];
|
||||
|
||||
xdg.configFile = {
|
||||
"pet/config.toml".source =
|
||||
format.generate "config.toml" { General = cfg.settings; };
|
||||
"pet/snippet.toml".source =
|
||||
format.generate "snippet.toml" { snippets = cfg.snippets; };
|
||||
};
|
||||
};
|
||||
}
|
||||
123
modules/programs/powerline-go.nix
Normal file
123
modules/programs/powerline-go.nix
Normal file
@@ -0,0 +1,123 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.powerline-go;
|
||||
|
||||
# Convert an option value to a string to be passed as argument to
|
||||
# powerline-go:
|
||||
valueToString = value:
|
||||
if builtins.isList value then
|
||||
builtins.concatStringsSep "," (builtins.map valueToString value)
|
||||
else if builtins.isAttrs value then
|
||||
valueToString
|
||||
(mapAttrsToList (key: val: "${valueToString key}=${valueToString val}")
|
||||
value)
|
||||
else
|
||||
builtins.toString value;
|
||||
|
||||
modulesArgument = optionalString (cfg.modules != null)
|
||||
"-modules ${valueToString cfg.modules}";
|
||||
|
||||
newlineArgument = optionalString cfg.newline "-newline";
|
||||
|
||||
pathAliasesArgument = optionalString (cfg.pathAliases != null)
|
||||
"-path-aliases ${valueToString cfg.pathAliases}";
|
||||
|
||||
otherSettingPairArgument = name: value:
|
||||
if value == true then "-${name}" else "-${name} ${valueToString value}";
|
||||
|
||||
otherSettingsArgument = optionalString (cfg.settings != { })
|
||||
(concatStringsSep " "
|
||||
(mapAttrsToList otherSettingPairArgument cfg.settings));
|
||||
|
||||
commandLineArguments = ''
|
||||
${modulesArgument} ${newlineArgument} ${pathAliasesArgument} ${otherSettingsArgument}
|
||||
'';
|
||||
|
||||
in {
|
||||
meta.maintainers = [ maintainers.DamienCassou ];
|
||||
|
||||
options = {
|
||||
programs.powerline-go = {
|
||||
enable = mkEnableOption
|
||||
"Powerline-go, a beautiful and useful low-latency prompt for your shell";
|
||||
|
||||
modules = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.listOf types.str);
|
||||
description = ''
|
||||
List of module names to load. The list of all available
|
||||
modules as well as the choice of default ones are at
|
||||
<link xlink:href="https://github.com/justjanne/powerline-go"/>.
|
||||
'';
|
||||
example = [ "host" "ssh" "cwd" "gitlite" "jobs" "exit" ];
|
||||
};
|
||||
|
||||
newline = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Set to true if the prompt should be on a line of its own.
|
||||
'';
|
||||
example = true;
|
||||
};
|
||||
|
||||
pathAliases = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.attrsOf types.str);
|
||||
description = ''
|
||||
Pairs of full-path and corresponding desired short name. You
|
||||
may use '~' to represent your home directory but you should
|
||||
protect it to avoid shell substitution.
|
||||
'';
|
||||
example = literalExample ''
|
||||
{ "\\~/projects/home-manager" = "prj:home-manager"; }
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
default = { };
|
||||
type = with types; attrsOf (oneOf [ bool int str (listOf str) ]);
|
||||
description = ''
|
||||
This can be any key/value pair as described in
|
||||
<link xlink:href="https://github.com/justjanne/powerline-go"/>.
|
||||
'';
|
||||
example = literalExample ''
|
||||
{
|
||||
hostname-only-if-ssh = true;
|
||||
numeric-exit-codes = true;
|
||||
cwd-max-depth = 7;
|
||||
ignore-repos = [ "/home/me/big-project" "/home/me/huge-project" ];
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
extraUpdatePS1 = mkOption {
|
||||
default = "";
|
||||
description = "Shell code to execute after the prompt is set.";
|
||||
example = ''
|
||||
PS1=$PS1"NixOS> ";
|
||||
'';
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg.enable && config.programs.bash.enable) {
|
||||
programs.bash.initExtra = ''
|
||||
function _update_ps1() {
|
||||
local old_exit_status=$?
|
||||
PS1="$(${pkgs.powerline-go}/bin/powerline-go -error $old_exit_status ${commandLineArguments})"
|
||||
${cfg.extraUpdatePS1}
|
||||
return $old_exit_status
|
||||
}
|
||||
|
||||
if [ "$TERM" != "linux" ]; then
|
||||
PROMPT_COMMAND="_update_ps1;$PROMPT_COMMAND"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -24,10 +24,59 @@ let
|
||||
else
|
||||
"${o}${n} = ${formatValue v}";
|
||||
|
||||
formatDictLine = o: n: v: ''${o}['${n}'] = "${v}"'';
|
||||
|
||||
formatKeyBindings = m: b:
|
||||
let
|
||||
formatKeyBinding = m: k: c:
|
||||
''config.bind("${k}", "${escape [ ''"'' ] c}", mode="${m}")'';
|
||||
in concatStringsSep "\n" (mapAttrsToList (formatKeyBinding m) b);
|
||||
|
||||
in {
|
||||
options.programs.qutebrowser = {
|
||||
enable = mkEnableOption "qutebrowser";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.qutebrowser;
|
||||
defaultText = literalExample "pkgs.qutebrowser";
|
||||
description = "Qutebrowser package to install.";
|
||||
};
|
||||
|
||||
aliases = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
description = ''
|
||||
Aliases for commands.
|
||||
'';
|
||||
};
|
||||
|
||||
searchEngines = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
description = ''
|
||||
Search engines that can be used via the address bar. Maps a search
|
||||
engine name (such as <literal>DEFAULT</literal>, or
|
||||
<literal>ddg</literal>) to a URL with a <literal>{}</literal>
|
||||
placeholder. The placeholder will be replaced by the search term, use
|
||||
<literal>{{</literal> and <literal>}}</literal> for literal
|
||||
<literal>{/}</literal> signs. The search engine named
|
||||
<literal>DEFAULT</literal> is used when
|
||||
<literal>url.auto_search</literal> is turned on and something else than
|
||||
a URL was entered to be opened. Other search engines can be used by
|
||||
prepending the search engine name to the search term, for example
|
||||
<literal>:open google qutebrowser</literal>.
|
||||
'';
|
||||
example = literalExample ''
|
||||
{
|
||||
w = "https://en.wikipedia.org/wiki/Special:Search?search={}&go=Go&ns0=1";
|
||||
aw = "https://wiki.archlinux.org/?search={}";
|
||||
nw = "https://nixos.wiki/index.php?search={}";
|
||||
g = "https://www.google.com/search?hl=en&q={}";
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
@@ -50,6 +99,150 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
keyMappings = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
description = ''
|
||||
This setting can be used to map keys to other keys. When the key used
|
||||
as dictionary-key is pressed, the binding for the key used as
|
||||
dictionary-value is invoked instead. This is useful for global
|
||||
remappings of keys, for example to map Ctrl-[ to Escape. Note that when
|
||||
a key is bound (via <literal>bindings.default</literal> or
|
||||
<literal>bindings.commands</literal>), the mapping is ignored.
|
||||
'';
|
||||
};
|
||||
|
||||
enableDefaultBindings = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Disable to prevent loading default key bindings.
|
||||
'';
|
||||
};
|
||||
|
||||
keyBindings = mkOption {
|
||||
type = types.attrsOf (types.attrsOf types.str);
|
||||
default = { };
|
||||
description = ''
|
||||
Key bindings mapping keys to commands in different modes. This setting
|
||||
is a dictionary containing mode names and dictionaries mapping keys to
|
||||
commands: <literal>{mode: {key: command}}</literal> If you want to map
|
||||
a key to another key, check the <literal>keyMappings</literal> setting
|
||||
instead. For modifiers, you can use either <literal>-</literal> or
|
||||
<literal>+</literal> as delimiters, and these names:
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
Control: <literal>Control</literal>, <literal>Ctrl</literal>
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Meta: <literal>Meta</literal>, <literal>Windows</literal>,
|
||||
<literal>Mod4</literal>
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Alt: <literal>Alt</literal>, <literal>Mod1</literal>
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Shift: <literal>Shift</literal>
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
|
||||
For simple keys (no <literal><></literal>-signs), a capital
|
||||
letter means the key is pressed with Shift. For special keys (with
|
||||
<literal><></literal>-signs), you need to explicitly add
|
||||
<literal>Shift-</literal> to match a key pressed with shift. If you
|
||||
want a binding to do nothing, bind it to the <literal>nop</literal>
|
||||
command. If you want a default binding to be passed through to the
|
||||
website, bind it to null. Note that some commands which are only useful
|
||||
for bindings (but not used interactively) are hidden from the command
|
||||
completion. See <literal>:</literal>help for a full list of available
|
||||
commands. The following modes are available:
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><literal>normal</literal></term>
|
||||
<listitem><para>
|
||||
Default mode, where most commands are invoked.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>insert</literal></term>
|
||||
<listitem><para>
|
||||
Entered when an input field is focused on a website, or by
|
||||
pressing i in normal mode. Passes through almost all keypresses
|
||||
to the website, but has some bindings like
|
||||
<literal><Ctrl-e></literal> to open an external editor.
|
||||
Note that single keys can’t be bound in this mode.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>hint</literal></term>
|
||||
<listitem><para>
|
||||
Entered when f is pressed to select links with the keyboard. Note
|
||||
that single keys can’t be bound in this mode.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>passthrough</literal></term>
|
||||
<listitem><para>
|
||||
Similar to insert mode, but passes through all keypresses except
|
||||
<literal><Escape></literal> to leave the mode. It might be
|
||||
useful to bind <literal><Escape></literal> to some other
|
||||
key in this mode if you want to be able to send an Escape key to
|
||||
the website as well. Note that single keys can’t be bound in this
|
||||
mode.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>command</literal></term>
|
||||
<listitem><para>
|
||||
Entered when pressing the : key in order to enter a command. Note
|
||||
that single keys can’t be bound in this mode.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>prompt</literal></term>
|
||||
<listitem><para>
|
||||
Entered when there’s a prompt to display, like for download
|
||||
locations or when invoked from JavaScript.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>yesno</literal></term>
|
||||
<listitem><para>
|
||||
Entered when there’s a yes/no prompt displayed.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>caret</literal></term>
|
||||
<listitem><para>
|
||||
Entered when pressing the v mode, used to select text using the
|
||||
keyboard.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>register</literal></term>
|
||||
<listitem><para>
|
||||
Entered when qutebrowser is waiting for a register name/key for
|
||||
commands like <literal>:set-mark</literal>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
'';
|
||||
example = literalExample ''
|
||||
{
|
||||
normal = {
|
||||
"<Ctrl-v>" = "spawn mpv {url}";
|
||||
",p" = "spawn --userscript qute-pass";
|
||||
",l" = '''config-cycle spellcheck.languages ["en-GB"] ["en-US"]''';
|
||||
};
|
||||
prompt = {
|
||||
"<Ctrl-y>" = "prompt-yes";
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
@@ -60,10 +253,16 @@ in {
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.qutebrowser ];
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile."qutebrowser/config.py".text = concatStringsSep "\n" ([ ]
|
||||
++ mapAttrsToList (formatLine "c.") cfg.settings
|
||||
++ mapAttrsToList (formatDictLine "c.aliases") cfg.aliases
|
||||
++ mapAttrsToList (formatDictLine "c.url.searchengines") cfg.searchEngines
|
||||
++ mapAttrsToList (formatDictLine "c.bindings.key_mappings")
|
||||
cfg.keyMappings
|
||||
++ optional (!cfg.enableDefaultBindings) "c.bindings.default = {}"
|
||||
++ mapAttrsToList formatKeyBindings cfg.keyBindings
|
||||
++ optional (cfg.extraConfig != "") cfg.extraConfig);
|
||||
};
|
||||
}
|
||||
|
||||
46
modules/programs/rofi-pass.nix
Normal file
46
modules/programs/rofi-pass.nix
Normal file
@@ -0,0 +1,46 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.rofi.pass;
|
||||
|
||||
in {
|
||||
meta.maintainers = [ maintainers.seylerius ];
|
||||
|
||||
options.programs.rofi.pass = {
|
||||
enable = mkEnableOption "rofi integration with password-store";
|
||||
|
||||
stores = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Directory roots of your password-stores.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = ''
|
||||
URL_field='url'
|
||||
USERNAME_field='user'
|
||||
AUTOTYPE_field='autotype'
|
||||
'';
|
||||
description = ''
|
||||
Extra configuration to be added at to the rofi-pass config file.
|
||||
Additional examples can be found at
|
||||
<link xlink:href="https://github.com/carnager/rofi-pass/blob/master/config.example"/>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.rofi-pass ];
|
||||
|
||||
xdg.configFile."rofi-pass/config".text = optionalString (cfg.stores != [ ])
|
||||
("root=" + (concatStringsSep ":" cfg.stores) + "\n") + cfg.extraConfig
|
||||
+ optionalString (cfg.extraConfig != "") "\n";
|
||||
};
|
||||
}
|
||||
@@ -131,6 +131,17 @@ in {
|
||||
enable = mkEnableOption
|
||||
"Rofi: A window switcher, application launcher and dmenu replacement";
|
||||
|
||||
package = mkOption {
|
||||
default = pkgs.rofi;
|
||||
type = types.package;
|
||||
description = ''
|
||||
Package providing the <command>rofi</command> binary.
|
||||
'';
|
||||
example = literalExample ''
|
||||
pkgs.rofi.override { plugins = [ pkgs.rofi-emoji ]; };
|
||||
'';
|
||||
};
|
||||
|
||||
width = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.int;
|
||||
@@ -295,7 +306,7 @@ in {
|
||||
'';
|
||||
}];
|
||||
|
||||
home.packages = [ pkgs.rofi ];
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
home.file."${cfg.configPath}".text = ''
|
||||
${setOption "width" cfg.width}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user