Project import generated by Copybara.
GitOrigin-RevId: 781d25b315def05cd7ede3765226c54216f0b1fe
This commit is contained in:
parent
ce641f4048
commit
b9675abb90
98 changed files with 1695 additions and 731 deletions
8
third_party/home-manager/.github/CODEOWNERS
vendored
8
third_party/home-manager/.github/CODEOWNERS
vendored
|
@ -113,6 +113,9 @@
|
|||
|
||||
/modules/programs/lazygit.nix @kalhauge
|
||||
|
||||
/modules/programs/less.nix @pamplemousse
|
||||
/tests/modules/programs/less @pamplemousse
|
||||
|
||||
/modules/programs/lesspipe.nix @rycee
|
||||
|
||||
/modules/programs/lf.nix @owm111
|
||||
|
@ -353,6 +356,8 @@
|
|||
/modules/services/window-managers/i3-sway/sway.nix @alexarice @sumnerevans
|
||||
/tests/modules/services/window-managers/sway @sumnerevans
|
||||
|
||||
/modules/services/window-managers/i3-sway/swaynag.nix @polykernel
|
||||
|
||||
/modules/services/wlsunset.nix @matrss
|
||||
/tests/modules/services/wlsunset @matrss
|
||||
|
||||
|
@ -376,4 +381,7 @@
|
|||
|
||||
/modules/services/volnoti.nix @IvanMalison
|
||||
|
||||
/modules/targets/darwin @midchildan
|
||||
/tests/modules/targets-darwin @midchildan
|
||||
|
||||
Makefile @thiagokokada
|
||||
|
|
|
@ -11,7 +11,7 @@ jobs:
|
|||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: cachix/install-nix-action@v14
|
||||
- uses: cachix/install-nix-action@v16
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
- uses: cachix/cachix-action@v10
|
||||
|
|
|
@ -12,13 +12,18 @@ jobs:
|
|||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: cachix/install-nix-action@v14.1
|
||||
- uses: cachix/install-nix-action@v16
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
- uses: cachix/cachix-action@v10
|
||||
with:
|
||||
name: nix-community
|
||||
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
|
||||
- run: |
|
||||
if grep -R --exclude stdlib-extended.nix literalExample modules ; then
|
||||
echo "Error: literalExample should be replaced by literalExpression" > /dev/stderr
|
||||
exit 1
|
||||
fi
|
||||
- run: ./format -c
|
||||
- run: nix-shell . -A install
|
||||
- run: nix-shell --arg enableBig false --pure tests -A run.all
|
||||
|
|
2
third_party/home-manager/.release
vendored
2
third_party/home-manager/.release
vendored
|
@ -1 +1 @@
|
|||
21.11
|
||||
22.05
|
||||
|
|
335
third_party/home-manager/README.md
vendored
335
third_party/home-manager/README.md
vendored
|
@ -32,7 +32,7 @@ will write to your dconf store and cannot tell whether a configuration
|
|||
that it is about to be overwritten was from a previous Home Manager
|
||||
generation or from manual configuration.
|
||||
|
||||
Home Manager targets [NixOS][] unstable and NixOS version 21.05 (the
|
||||
Home Manager targets [NixOS][] unstable and NixOS version 21.11 (the
|
||||
current stable version), it may or may not work on other Linux
|
||||
distributions and NixOS versions.
|
||||
|
||||
|
@ -53,270 +53,25 @@ You can chat with us on IRC in the channel [#home-manager][] on
|
|||
Installation
|
||||
------------
|
||||
|
||||
Currently the easiest way to install Home Manager is as follows:
|
||||
|
||||
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. If you are following
|
||||
Nixpkgs master or an unstable channel you can run
|
||||
|
||||
```shell
|
||||
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
|
||||
nix-channel --update
|
||||
```
|
||||
|
||||
and if you follow a Nixpkgs version 21.05 channel you can run
|
||||
|
||||
```shell
|
||||
nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.05.tar.gz home-manager
|
||||
nix-channel --update
|
||||
```
|
||||
|
||||
On NixOS you may need to log out and back in for the channel to
|
||||
become available. On non-NixOS you may have to add
|
||||
|
||||
```shell
|
||||
export NIX_PATH=$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH
|
||||
```
|
||||
|
||||
to your shell (see [nix#2033](https://github.com/NixOS/nix/issues/2033)).
|
||||
|
||||
3. Install Home Manager and create the first Home Manager generation:
|
||||
|
||||
```shell
|
||||
nix-shell '<home-manager>' -A install
|
||||
```
|
||||
|
||||
Once finished, Home Manager should be active and available in your
|
||||
user environment.
|
||||
|
||||
3. If you do not plan on having Home Manager manage your shell
|
||||
configuration then you must source the
|
||||
|
||||
```shell
|
||||
$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
|
||||
```
|
||||
|
||||
file in your shell configuration. This file can be sourced
|
||||
directly by POSIX.2-like shells such as [Bash][] or [Z shell][].
|
||||
[Fish][] users can use utilities such as [foreign-env][] or
|
||||
[babelfish][].
|
||||
|
||||
For example, if you use Bash then add
|
||||
|
||||
```bash
|
||||
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
|
||||
```
|
||||
|
||||
or this when managing home configuration together with system
|
||||
configuration
|
||||
|
||||
```bash
|
||||
. "/etc/profiles/per-user/$USER/etc/profile.d/hm-session-vars.sh"
|
||||
```
|
||||
|
||||
to your `~/.profile` file.
|
||||
|
||||
If instead of using channels you want to run Home Manager from a Git
|
||||
checkout of the repository then you can use the
|
||||
`programs.home-manager.path` option to specify the absolute path to
|
||||
the repository.
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Home Manager is typically managed through the `home-manager` tool.
|
||||
This tool can, for example, apply configurations to your home
|
||||
directory, list user packages installed by the tool, and list the
|
||||
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
|
||||
smooth scrolling disabled, and enable the user gpg-agent service.
|
||||
|
||||
To satisfy the above setup we should elaborate the
|
||||
`~/.config/nixpkgs/home.nix` file as follows:
|
||||
|
||||
```nix
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
home.packages = [
|
||||
pkgs.htop
|
||||
pkgs.fortune
|
||||
];
|
||||
|
||||
programs.emacs = {
|
||||
enable = true;
|
||||
extraPackages = epkgs: [
|
||||
epkgs.nix-mode
|
||||
epkgs.magit
|
||||
];
|
||||
};
|
||||
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
profiles = {
|
||||
myprofile = {
|
||||
settings = {
|
||||
"general.smoothScroll" = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.gpg-agent = {
|
||||
enable = true;
|
||||
defaultCacheTtl = 1800;
|
||||
enableSshSupport = true;
|
||||
};
|
||||
|
||||
programs.home-manager = {
|
||||
enable = true;
|
||||
path = "…";
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
To activate this configuration you can then run
|
||||
|
||||
```shell
|
||||
home-manager switch
|
||||
```
|
||||
|
||||
or if you are not feeling so lucky,
|
||||
|
||||
```shell
|
||||
home-manager build
|
||||
```
|
||||
|
||||
which will create a `result` link to a directory containing an
|
||||
activation script and the generated home directory files.
|
||||
|
||||
Documentation of available configuration options, including
|
||||
descriptions and usage examples, is available in the [Home Manager
|
||||
manual][configuration options] or offline by running
|
||||
|
||||
```shell
|
||||
man home-configuration.nix
|
||||
```
|
||||
|
||||
Rollbacks
|
||||
---------
|
||||
|
||||
While the `home-manager` tool does not explicitly support rollbacks at
|
||||
the moment it is relatively easy to perform one manually. The steps to
|
||||
do so are
|
||||
|
||||
1. Run `home-manager generations` to determine which generation you
|
||||
wish to rollback to:
|
||||
|
||||
```console
|
||||
$ home-manager generations
|
||||
2018-01-04 11:56 : id 765 -> /nix/store/kahm1rxk77mnvd2l8pfvd4jkkffk5ijk-home-manager-generation
|
||||
2018-01-03 10:29 : id 764 -> /nix/store/2wsmsliqr5yynqkdyjzb1y57pr5q2lsj-home-manager-generation
|
||||
2018-01-01 12:21 : id 763 -> /nix/store/mv960kl9chn2lal5q8lnqdp1ygxngcd1-home-manager-generation
|
||||
2017-12-29 21:03 : id 762 -> /nix/store/6c0k1r03fxckql4vgqcn9ccb616ynb94-home-manager-generation
|
||||
2017-12-25 18:51 : id 761 -> /nix/store/czc5y6vi1rvnkfv83cs3rn84jarcgsgh-home-manager-generation
|
||||
…
|
||||
```
|
||||
|
||||
2. Copy the Nix store path of the generation you chose, e.g.,
|
||||
|
||||
/nix/store/mv960kl9chn2lal5q8lnqdp1ygxngcd1-home-manager-generation
|
||||
|
||||
for generation 763.
|
||||
|
||||
3. Run the `activate` script inside the copied store path:
|
||||
|
||||
```console
|
||||
$ /nix/store/mv960kl9chn2lal5q8lnqdp1ygxngcd1-home-manager-generation/activate
|
||||
Starting home manager activation
|
||||
…
|
||||
```
|
||||
|
||||
Keeping your ~ safe from harm
|
||||
-----------------------------
|
||||
|
||||
To configure programs and services Home Manager must write various
|
||||
things to your home directory. To prevent overwriting any existing
|
||||
files when switching to a new generation, Home Manager will attempt to
|
||||
detect collisions between existing files and generated files. If any
|
||||
such collision is detected the activation will terminate before
|
||||
changing anything on your computer.
|
||||
|
||||
For example, suppose you have a wonderful, painstakingly created
|
||||
`~/.config/git/config` and add
|
||||
|
||||
```nix
|
||||
{
|
||||
# …
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "Jane Doe";
|
||||
userEmail = "jane.doe@example.org";
|
||||
};
|
||||
|
||||
# …
|
||||
}
|
||||
```
|
||||
|
||||
to your configuration. Attempting to switch to the generation will
|
||||
then result in
|
||||
|
||||
```console
|
||||
$ home-manager switch
|
||||
…
|
||||
Activating checkLinkTargets
|
||||
Existing file '/home/jdoe/.config/git/config' is in the way
|
||||
Please move the above files and try again
|
||||
```
|
||||
|
||||
Graphical services
|
||||
------------------
|
||||
|
||||
Home Manager includes a number of services intended to run in a
|
||||
graphical session, for example `xscreensaver` and `dunst`.
|
||||
Unfortunately, such services will not be started automatically unless
|
||||
you let Home Manager start your X session. That is, you have something
|
||||
like
|
||||
|
||||
```nix
|
||||
{
|
||||
# …
|
||||
|
||||
services.xserver.enable = true;
|
||||
|
||||
# …
|
||||
}
|
||||
```
|
||||
|
||||
in your system configuration and
|
||||
|
||||
```nix
|
||||
{
|
||||
# …
|
||||
|
||||
xsession.enable = true;
|
||||
xsession.windowManager.command = "…";
|
||||
|
||||
# …
|
||||
}
|
||||
```
|
||||
|
||||
in your Home Manager configuration.
|
||||
Home Manager can be used in three primary ways:
|
||||
|
||||
1. Using the standalone `home-manager` tool. For platforms other than
|
||||
NixOS and Darwin, this is the only available choice. It is also
|
||||
recommended for people on NixOS or Darwin that want to manage their
|
||||
home directory independently of the system as a whole. See
|
||||
[Standalone installation][manual standalone install] in the manual
|
||||
for instructions on how to perform this installation.
|
||||
|
||||
2. As a module within a NixOS system configuration. This allows the
|
||||
user profiles to be built together with the system when running
|
||||
`nixos-rebuild`. See [NixOS module installation][manual nixos
|
||||
install] in the manual for a description of this setup.
|
||||
|
||||
3. As a module within a [nix-darwin][] system configuration. This
|
||||
allows the user profiles to be built together with the system when
|
||||
running `darwin-rebuild`. See [nix-darwin module
|
||||
installation][manual nix-darwin install] in the manual for a
|
||||
description of this setup.
|
||||
|
||||
Nix Flakes
|
||||
----------
|
||||
|
@ -345,6 +100,9 @@ as follows:
|
|||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.jdoe = import ./home.nix;
|
||||
|
||||
# Optionally, use home-manager.extraSpecialArgs to pass
|
||||
# arguments to home.nix
|
||||
}
|
||||
];
|
||||
};
|
||||
|
@ -353,6 +111,33 @@ as follows:
|
|||
}
|
||||
```
|
||||
|
||||
If you are not using NixOS you can place the following flake in
|
||||
`~/.config/nixpkgs/flake.nix` to load your standard Home Manager
|
||||
configuration:
|
||||
|
||||
```nix
|
||||
{
|
||||
description = "A Home Manager flake";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = inputs: {
|
||||
homeConfigurations = {
|
||||
jdoe = inputs.home-manager.lib.homeManagerConfiguration {
|
||||
system = "x86_64-linux";
|
||||
homeDirectory = "/home/jdoe";
|
||||
username = "jdoe";
|
||||
configuration.imports = [ ./home.nix ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Note, the Home Manager library is exported by the flake under
|
||||
`lib.hm`.
|
||||
|
||||
|
@ -367,24 +152,26 @@ 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-21.05`). These branches get fixes, but usually not new
|
||||
(e.g. `release-21.11`). These branches get fixes, but usually not new
|
||||
modules. If you need a module to be backported, then feel free to open
|
||||
an issue.
|
||||
|
||||
[Bash]: https://www.gnu.org/software/bash/
|
||||
License
|
||||
-------
|
||||
|
||||
This project is licensed under the terms of the [MIT license](LICENSE).
|
||||
|
||||
[Nix]: https://nixos.org/nix/
|
||||
[NixOS]: https://nixos.org/
|
||||
[Nixpkgs]: https://nixos.org/nixpkgs/
|
||||
[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://nix-community.github.io/home-manager/
|
||||
[manual usage]: https://nix-community.github.io/home-manager/#ch-usage
|
||||
[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
|
||||
[Fish]: https://fishshell.com
|
||||
[foreign-env]: https://github.com/oh-my-fish/plugin-foreign-env
|
||||
[babelfish]: https://github.com/bouk/babelfish
|
||||
[nix-darwin]: https://github.com/LnL7/nix-darwin/
|
||||
[manual standalone install]: https://nix-community.github.io/home-manager/index.html#sec-install-standalone
|
||||
[manual nixos install]: https://nix-community.github.io/home-manager/index.html#sec-install-nixos-module
|
||||
[manual nix-darwin install]: https://nix-community.github.io/home-manager/index.html#sec-install-nix-darwin-module
|
||||
|
|
4
third_party/home-manager/docs/default.nix
vendored
4
third_party/home-manager/docs/default.nix
vendored
|
@ -9,8 +9,8 @@ let
|
|||
name = "nmd";
|
||||
owner = "rycee";
|
||||
repo = "nmd";
|
||||
rev = "12bc57594e12525d2e4422fa7034b2d54e9ea09a";
|
||||
sha256 = "0fpankfx2c99x4n1mhdy730yxy2b03qcw4zvjxyk4b1v60h8057n";
|
||||
rev = "527245ff605bde88c2dd2ddae21c6479bb7cf8aa";
|
||||
sha256 = "1zi0f9y3wq4bpslx1py3sfgrgd9av41ahpandvs6rvkpisfsqqlp";
|
||||
};
|
||||
|
||||
nmd = import nmdSrc { inherit lib pkgs; };
|
||||
|
|
85
third_party/home-manager/docs/installation.adoc
vendored
85
third_party/home-manager/docs/installation.adoc
vendored
|
@ -8,7 +8,7 @@ Home Manager can be used in three primary ways:
|
|||
1. Using the standalone `home-manager` tool. For platforms other than
|
||||
NixOS and Darwin, this is the only available choice. It is also
|
||||
recommended for people on NixOS or Darwin that want to manage their
|
||||
home directory independent of the system as a whole. See
|
||||
home directory independently of the system as a whole. See
|
||||
<<sec-install-standalone>> for instructions on how to perform this
|
||||
installation.
|
||||
|
||||
|
@ -27,6 +27,11 @@ for a description of this setup.
|
|||
|
||||
:nix-allowed-users: https://nixos.org/nix/manual/#conf-allowed-users
|
||||
:nixos-allowed-users: https://nixos.org/nixos/manual/options.html#opt-nix.allowedUsers
|
||||
:bash: https://www.gnu.org/software/bash/
|
||||
:zsh: http://zsh.sourceforge.net/
|
||||
:fish: https://fishshell.com
|
||||
:plugin-foreign-env: https://github.com/oh-my-fish/plugin-foreign-env
|
||||
:babelfish: https://github.com/bouk/babelfish
|
||||
|
||||
1. Make sure you have a working Nix installation. Specifically, make
|
||||
sure that your user is able to build and install Nix packages. For
|
||||
|
@ -36,10 +41,12 @@ root user. For a multi-user install of Nix this means that your user
|
|||
must be covered by the {nix-allowed-users}[`allowed-users`] Nix
|
||||
option. On NixOS you can control this option using the
|
||||
{nixos-allowed-users}[`nix.allowedUsers`] system option.
|
||||
+
|
||||
Note that Nix 2.4 is not yet fully supported. Most significantly, Home
|
||||
Manager is incompatible with the new `nix profile`.
|
||||
|
||||
2. Add the Home Manager channel that you wish to follow. If you are
|
||||
following Nixpkgs master or an unstable channel then this is done by
|
||||
running
|
||||
2. Add the appropriate Home Manager channel. If you are following
|
||||
Nixpkgs master or an unstable channel you can run
|
||||
+
|
||||
[source,console]
|
||||
----
|
||||
|
@ -47,11 +54,11 @@ $ nix-channel --add https://github.com/nix-community/home-manager/archive/master
|
|||
$ nix-channel --update
|
||||
----
|
||||
+
|
||||
and if you follow a Nixpkgs version 21.05 channel, you can run
|
||||
and if you follow a Nixpkgs version 21.11 channel you can run
|
||||
+
|
||||
[source,console]
|
||||
----
|
||||
$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.05.tar.gz home-manager
|
||||
$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.11.tar.gz home-manager
|
||||
$ nix-channel --update
|
||||
----
|
||||
+
|
||||
|
@ -87,11 +94,8 @@ file in your shell configuration. Alternatively source
|
|||
when managing home configuration together with system configuration.
|
||||
+
|
||||
This file can be sourced directly by POSIX.2-like shells such as
|
||||
https://www.gnu.org/software/bash/[Bash] or
|
||||
http://zsh.sourceforge.net/[Z shell]. https://fishshell.com[Fish]
|
||||
users can use utilities such as
|
||||
https://github.com/oh-my-fish/plugin-foreign-env[foreign-env] or
|
||||
https://github.com/bouk/babelfish[babelfish].
|
||||
{bash}[Bash] or {zsh}[Z shell]. {fish}[Fish] users can use utilities
|
||||
such as {plugin-foreign-env}[foreign-env] or {babelfish}[babelfish].
|
||||
+
|
||||
For example, if you use Bash then add
|
||||
+
|
||||
|
@ -107,6 +111,9 @@ checkout of the repository then you can use the
|
|||
<<opt-programs.home-manager.path>> option to specify the absolute path
|
||||
to the repository.
|
||||
|
||||
Once installed you can see <<ch-usage>> for a more detailed
|
||||
description of Home Manager and how to use it.
|
||||
|
||||
[[sec-install-nixos-module]]
|
||||
=== NixOS module
|
||||
|
||||
|
@ -128,11 +135,11 @@ or an unstable channel, you can run
|
|||
# nix-channel --update
|
||||
----
|
||||
|
||||
and if you follow a Nixpkgs version 21.05 channel, you can run
|
||||
and if you follow a Nixpkgs version 21.11 channel, you can run
|
||||
|
||||
[source,console]
|
||||
----
|
||||
# nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.05.tar.gz home-manager
|
||||
# nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.11.tar.gz home-manager
|
||||
# nix-channel --update
|
||||
----
|
||||
|
||||
|
@ -159,6 +166,27 @@ home-manager.users.eve = { pkgs, ... }: {
|
|||
and after a `nixos-rebuild switch` the user eve's environment should
|
||||
include a basic Bash configuration and the packages atool and httpie.
|
||||
|
||||
If you do not plan on having Home Manager manage your shell
|
||||
configuration then you must add either
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
|
||||
----
|
||||
|
||||
or
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
. "/etc/profiles/per-user/$USER/etc/profile.d/hm-session-vars.sh"
|
||||
----
|
||||
|
||||
to your shell configuration, depending on whether
|
||||
<<nixos-opt-home-manager.useUserPackages>> is enabled. This file can
|
||||
be sourced directly by POSIX.2-like shells such as {bash}[Bash] or
|
||||
{zsh}[Z shell]. {fish}[Fish] users can use utilities such as
|
||||
{plugin-foreign-env}[foreign-env] or {babelfish}[babelfish].
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
By default packages will be installed to `$HOME/.nix-profile` but they
|
||||
|
@ -187,6 +215,9 @@ the dependency on `NIX_PATH`, which is otherwise used for importing
|
|||
Nixpkgs.
|
||||
====
|
||||
|
||||
Once installed you can see <<ch-usage>> for a more detailed
|
||||
description of Home Manager and how to use it.
|
||||
|
||||
[[sec-install-nix-darwin-module]]
|
||||
=== nix-darwin module
|
||||
|
||||
|
@ -206,11 +237,11 @@ or an unstable channel, you can run
|
|||
# nix-channel --update
|
||||
----
|
||||
|
||||
and if you follow a Nixpkgs version 21.05 channel, you can run
|
||||
and if you follow a Nixpkgs version 21.11 channel, you can run
|
||||
|
||||
[source,console]
|
||||
----
|
||||
# nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.05.tar.gz home-manager
|
||||
# nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.11.tar.gz home-manager
|
||||
# nix-channel --update
|
||||
----
|
||||
|
||||
|
@ -241,6 +272,27 @@ and after a `darwin-rebuild switch` the user eve's environment
|
|||
should include a basic Bash configuration and the packages atool and
|
||||
httpie.
|
||||
|
||||
If you do not plan on having Home Manager manage your shell
|
||||
configuration then you must add either
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
|
||||
----
|
||||
|
||||
or
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
. "/etc/profiles/per-user/$USER/etc/profile.d/hm-session-vars.sh"
|
||||
----
|
||||
|
||||
to your shell configuration, depending on whether
|
||||
<<nix-darwin-opt-home-manager.useUserPackages>> is enabled. This file
|
||||
can be sourced directly by POSIX.2-like shells such as {bash}[Bash] or
|
||||
{zsh}[Z shell]. {fish}[Fish] users can use utilities such as
|
||||
{plugin-foreign-env}[foreign-env] or {babelfish}[babelfish].
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
By default user packages will not be ignored in favor of
|
||||
|
@ -268,3 +320,6 @@ This saves an extra Nixpkgs evaluation, adds consistency, and removes
|
|||
the dependency on `NIX_PATH`, which is otherwise used for importing
|
||||
Nixpkgs.
|
||||
====
|
||||
|
||||
Once installed you can see <<ch-usage>> for a more detailed
|
||||
description of Home Manager and how to use it.
|
||||
|
|
1
third_party/home-manager/docs/manual.xml
vendored
1
third_party/home-manager/docs/manual.xml
vendored
|
@ -29,6 +29,7 @@
|
|||
</note>
|
||||
</preface>
|
||||
<xi:include href="installation.xml" />
|
||||
<xi:include href="usage.xml" />
|
||||
<xi:include href="writing-modules.xml" />
|
||||
<xi:include href="contributing.xml" />
|
||||
<xi:include href="faq.xml" />
|
||||
|
|
|
@ -6,6 +6,8 @@ This section lists the release notes for stable versions of Home Manager and the
|
|||
|
||||
:leveloffset: 1
|
||||
|
||||
include::rl-2205.adoc[]
|
||||
|
||||
include::rl-2111.adoc[]
|
||||
|
||||
include::rl-2105.adoc[]
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
[[sec-release-21.11]]
|
||||
== Release 21.11
|
||||
|
||||
This is the current unstable branch and the information in this
|
||||
section is therefore not final.
|
||||
The 21.11 release branch became the stable branch in November, 2021.
|
||||
|
||||
[[sec-release-21.11-highlights]]
|
||||
=== Highlights
|
||||
|
@ -37,6 +36,10 @@ https://github.com/nix-community/home-manager/issues/1906[issue #1906].
|
|||
+
|
||||
You can replicate your old configuration by moving those options to <<opt-programs.rofi.theme>>. Keep in mind that the syntax is different so you may need to do some changes.
|
||||
|
||||
* Taskwarrior version 2.6.0 respects XDG Specification for the config file now.
|
||||
Option <<opt-programs.taskwarrior.config>> and friends now generate the config file at
|
||||
`$XDG_CONFIG_HOME/task/taskrc` instead of `~/.taskrc`.
|
||||
|
||||
[[sec-release-21.11-state-version-changes]]
|
||||
=== State Version Changes
|
||||
|
||||
|
@ -45,3 +48,26 @@ changes are only active if the `home.stateVersion` option is set to
|
|||
"21.11" or later.
|
||||
|
||||
* The <<opt-home.keyboard>> option now defaults to `null`, meaning that Home Manager won't do any keyboard layout management. For example, `setxkbmap` won't be run in X sessions.
|
||||
|
||||
* The <<opt-programs.pet.settings>> option no longer place its value inside a `General` attribute.
|
||||
For example,
|
||||
+
|
||||
[source,nix]
|
||||
programs.pet.settings.editor = "nvim";
|
||||
+
|
||||
becomes
|
||||
+
|
||||
[source,nix]
|
||||
programs.pet.settings.General.editor = "nvim";
|
||||
|
||||
* The <<opt-programs.waybar.settings>> option now allows defining modules directly under <<opt-programs.waybar.settings>>.
|
||||
For example,
|
||||
+
|
||||
[source,nix]
|
||||
programs.waybar.settings.modules."custom/my-module" = { };
|
||||
+
|
||||
becomes
|
||||
+
|
||||
[source,nix]
|
||||
programs.waybar.settings."custom/my-module" = { };
|
||||
|
||||
|
|
31
third_party/home-manager/docs/release-notes/rl-2205.adoc
vendored
Normal file
31
third_party/home-manager/docs/release-notes/rl-2205.adoc
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
[[sec-release-22.05]]
|
||||
== Release 22.05
|
||||
|
||||
This is the current unstable branch and the information in this section is therefore not final.
|
||||
|
||||
[[sec-release-22.05-highlights]]
|
||||
=== Highlights
|
||||
|
||||
This release has the following notable changes:
|
||||
|
||||
* The `programs.waybar.settings.modules` option was removed.
|
||||
Waybar modules should now be declared directly under `programs.waybar.settings`.
|
||||
|
||||
[[sec-release-22.05-state-version-changes]]
|
||||
=== State Version Changes
|
||||
|
||||
The state version in this release includes the changes below.
|
||||
These changes are only active if the `home.stateVersion` option is set to "22.05" or later.
|
||||
|
||||
* The <<opt-programs.waybar.settings>> option now allows defining modules directly under <<opt-programs.waybar.settings>>.
|
||||
Defining modules under `programs.waybar.settings.modules` will now be an error.
|
||||
For example,
|
||||
+
|
||||
[source,nix]
|
||||
programs.waybar.settings.modules."custom/my-module" = { };
|
||||
+
|
||||
becomes
|
||||
+
|
||||
[source,nix]
|
||||
programs.waybar.settings."custom/my-module" = { };
|
||||
|
226
third_party/home-manager/docs/usage.adoc
vendored
Normal file
226
third_party/home-manager/docs/usage.adoc
vendored
Normal file
|
@ -0,0 +1,226 @@
|
|||
[[ch-usage]]
|
||||
== Using Home Manager
|
||||
|
||||
Your use of Home Manager is centered around the configuration file, which is typically found at `~/.config/nixpkgs/home.nix`.
|
||||
|
||||
This configuration file can be _built_ and _activated_.
|
||||
|
||||
Building a configuration produces a directory in the Nix store that contains all files and programs that should be available in your home directory and Nix user profile, respectively. The build step also checks that the configuration is valid and it will fail with an error if you, for example, assign a value to an option that does not exist or assign a value of the wrong type. Some modules also have custom assertions that perform more detailed, module specific, checks.
|
||||
|
||||
Concretely, if your configuration contains
|
||||
|
||||
[source,nix]
|
||||
programs.emacs.enable = "yes";
|
||||
|
||||
then building it, for example using `home-manager build`, will result in an error message saying something like
|
||||
|
||||
[source,console]
|
||||
----
|
||||
$ home-manager build
|
||||
error: A definition for option `programs.emacs.enable' is not of type `boolean'. Definition values:
|
||||
- In `/home/jdoe/.config/nixpkgs/home.nix': "yes"
|
||||
(use '--show-trace' to show detailed location information)
|
||||
----
|
||||
|
||||
The message indicates that you must provide a Boolean value for this option, that is, either `true` or `false`. The documentation of each option will state the expected type, for <<opt-programs.emacs.enable>> you will see ``Type: boolean''. You there also find information about the default value and a description of the option. You can find the complete option documentation in <<ch-options>> or directly in the terminal by running
|
||||
|
||||
[source,console]
|
||||
man home-configuration.nix
|
||||
|
||||
Once a configuration is successfully built, it can be activated. The activation performs the steps necessary to make the files, programs, and services available in your user environment. The `home-manager switch` command performs a combined build and activation.
|
||||
|
||||
=== Configuration Example
|
||||
|
||||
A fresh install of Home Manager will generate a minimal `~/.config/nixpkgs/home.nix` file containing something like
|
||||
|
||||
[source,nix]
|
||||
----
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Home Manager needs a bit of information about you and the
|
||||
# paths it should manage.
|
||||
home.username = "jdoe";
|
||||
home.homeDirectory = "/home/jdoe";
|
||||
|
||||
# This value determines the Home Manager release that your
|
||||
# configuration is compatible with. This helps avoid breakage
|
||||
# when a new Home Manager release introduces backwards
|
||||
# incompatible changes.
|
||||
#
|
||||
# You can update Home Manager without changing this value. See
|
||||
# the Home Manager release notes for a list of state version
|
||||
# changes in each release.
|
||||
home.stateVersion = "22.05";
|
||||
|
||||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
}
|
||||
----
|
||||
|
||||
You can use this as a base for your further configurations.
|
||||
|
||||
[NOTE]
|
||||
If you are not very familiar with the Nix language and NixOS modules then it is encouraged to start with small and simple changes. As you learn you can gradually grow the configuration with confidence.
|
||||
|
||||
As an example, let us expand the initial configuration file to also install the htop and fortune packages, install Emacs with a few extra packages available, and enable the user gpg-agent service.
|
||||
|
||||
To satisfy the above setup we should elaborate the `home.nix` file as follows:
|
||||
|
||||
[source,nix]
|
||||
----
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Home Manager needs a bit of information about you and the
|
||||
# paths it should manage.
|
||||
home.username = "jdoe";
|
||||
home.homeDirectory = "/home/jdoe";
|
||||
|
||||
# Packages that should be installed to the user profile.
|
||||
home.packages = [ <1>
|
||||
pkgs.htop
|
||||
pkgs.fortune
|
||||
];
|
||||
|
||||
# This value determines the Home Manager release that your
|
||||
# configuration is compatible with. This helps avoid breakage
|
||||
# when a new Home Manager release introduces backwards
|
||||
# incompatible changes.
|
||||
#
|
||||
# You can update Home Manager without changing this value. See
|
||||
# the Home Manager release notes for a list of state version
|
||||
# changes in each release.
|
||||
home.stateVersion = "22.05";
|
||||
|
||||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
programs.emacs = { <2>
|
||||
enable = true;
|
||||
extraPackages = epkgs: [
|
||||
epkgs.nix-mode
|
||||
epkgs.magit
|
||||
];
|
||||
};
|
||||
|
||||
services.gpg-agent = { <3>
|
||||
enable = true;
|
||||
defaultCacheTtl = 1800;
|
||||
enableSshSupport = true;
|
||||
};
|
||||
}
|
||||
----
|
||||
<1> Nixpkgs packages can be installed to the user profile using <<opt-home.packages>>.
|
||||
<2> The option names of a program module typically start with `programs.<package name>`.
|
||||
<3> Similarly, for a service module, the names start with `services.<package name>`. Note in some cases a package has both programs _and_ service options – Emacs is such an example.
|
||||
|
||||
To activate this configuration you can run
|
||||
|
||||
[source,console]
|
||||
home-manager switch
|
||||
|
||||
or if you are not feeling so lucky,
|
||||
|
||||
[source,console]
|
||||
home-manager build
|
||||
|
||||
which will create a `result` link to a directory containing an
|
||||
activation script and the generated home directory files.
|
||||
|
||||
=== Rollbacks
|
||||
|
||||
While the `home-manager` tool does not explicitly support rollbacks at the moment it is relatively easy to perform one manually. The steps to do so are
|
||||
|
||||
1. Run `home-manager generations` to determine which generation you wish to rollback to:
|
||||
+
|
||||
[source,console]
|
||||
----
|
||||
$ home-manager generations
|
||||
2018-01-04 11:56 : id 765 -> /nix/store/kahm1rxk77mnvd2l8pfvd4jkkffk5ijk-home-manager-generation
|
||||
2018-01-03 10:29 : id 764 -> /nix/store/2wsmsliqr5yynqkdyjzb1y57pr5q2lsj-home-manager-generation
|
||||
2018-01-01 12:21 : id 763 -> /nix/store/mv960kl9chn2lal5q8lnqdp1ygxngcd1-home-manager-generation
|
||||
2017-12-29 21:03 : id 762 -> /nix/store/6c0k1r03fxckql4vgqcn9ccb616ynb94-home-manager-generation
|
||||
2017-12-25 18:51 : id 761 -> /nix/store/czc5y6vi1rvnkfv83cs3rn84jarcgsgh-home-manager-generation
|
||||
…
|
||||
----
|
||||
|
||||
2. Copy the Nix store path of the generation you chose, e.g.,
|
||||
+
|
||||
----
|
||||
/nix/store/mv960kl9chn2lal5q8lnqdp1ygxngcd1-home-manager-generation
|
||||
----
|
||||
+
|
||||
for generation 763.
|
||||
|
||||
3. Run the `activate` script inside the copied store path:
|
||||
+
|
||||
[source,console]
|
||||
----
|
||||
$ /nix/store/mv960kl9chn2lal5q8lnqdp1ygxngcd1-home-manager-generation/activate
|
||||
Starting home manager activation
|
||||
…
|
||||
----
|
||||
|
||||
=== Keeping your ~ safe from harm
|
||||
|
||||
To configure programs and services Home Manager must write various things to your home directory. To prevent overwriting any existing files when switching to a new generation, Home Manager will attempt to detect collisions between existing files and generated files. If any such collision is detected the activation will terminate before changing anything on your computer.
|
||||
|
||||
For example, suppose you have a wonderful, painstakingly created `~/.config/git/config` and add
|
||||
|
||||
[source,nix]
|
||||
----
|
||||
{
|
||||
# …
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "Jane Doe";
|
||||
userEmail = "jane.doe@example.org";
|
||||
};
|
||||
|
||||
# …
|
||||
}
|
||||
----
|
||||
|
||||
to your configuration. Attempting to switch to the generation will then result in
|
||||
|
||||
[source,console]
|
||||
----
|
||||
$ home-manager switch
|
||||
…
|
||||
Activating checkLinkTargets
|
||||
Existing file '/home/jdoe/.config/git/config' is in the way
|
||||
Please move the above files and try again
|
||||
----
|
||||
|
||||
=== Graphical services
|
||||
|
||||
Home Manager includes a number of services intended to run in a graphical session, for example `xscreensaver` and `dunst`. Unfortunately, such services will not be started automatically unless you let Home Manager start your X session. That is, you have something like
|
||||
|
||||
[source,nix]
|
||||
----
|
||||
{
|
||||
# …
|
||||
|
||||
services.xserver.enable = true;
|
||||
|
||||
# …
|
||||
}
|
||||
----
|
||||
|
||||
in your system configuration and
|
||||
|
||||
[source,nix]
|
||||
----
|
||||
{
|
||||
# …
|
||||
|
||||
xsession.enable = true;
|
||||
xsession.windowManager.command = "…";
|
||||
|
||||
# …
|
||||
}
|
||||
----
|
||||
|
||||
in your Home Manager configuration.
|
9
third_party/home-manager/flake.nix
vendored
9
third_party/home-manager/flake.nix
vendored
|
@ -30,6 +30,15 @@
|
|||
defaultPackage =
|
||||
forAllSystems (system: self.packages.${system}.home-manager);
|
||||
|
||||
apps = forAllSystems (system: {
|
||||
home-manager = {
|
||||
type = "app";
|
||||
program = "${defaultPackage.${system}}/bin/home-manager";
|
||||
};
|
||||
});
|
||||
|
||||
defaultApp = forAllSystems (system: apps.${system}.home-manager);
|
||||
|
||||
lib = {
|
||||
hm = import ./modules/lib { lib = nixpkgs.lib; };
|
||||
homeManagerConfiguration = { configuration, system, homeDirectory
|
||||
|
|
|
@ -16,7 +16,6 @@ let
|
|||
|
||||
in runCommand "home-manager" {
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
meta = with lib; {
|
||||
description = "A user environment configurator";
|
||||
maintainers = [ maintainers.rycee ];
|
||||
|
|
102
third_party/home-manager/home-manager/home-manager
vendored
102
third_party/home-manager/home-manager/home-manager
vendored
|
@ -186,6 +186,18 @@ function doBuildAttr() {
|
|||
--argstr confAttr "$HOME_MANAGER_CONFIG_ATTRIBUTE"
|
||||
}
|
||||
|
||||
function doBuildFlake() {
|
||||
local extraArgs=("$@")
|
||||
|
||||
if [[ -v VERBOSE ]]; then
|
||||
extraArgs=("${extraArgs[@]}" "--verbose")
|
||||
fi
|
||||
|
||||
nix build \
|
||||
"${extraArgs[@]}" \
|
||||
"${PASSTHROUGH_OPTS[@]}"
|
||||
}
|
||||
|
||||
# Presents news to the user. Takes as argument the path to a "news
|
||||
# info" file as generated by `buildNews`.
|
||||
function presentNews() {
|
||||
|
@ -246,52 +258,32 @@ function doBuild() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
setFlakeAttribute
|
||||
if [[ -v FLAKE_CONFIG_URI ]]; then
|
||||
local exitCode=0
|
||||
nix build \
|
||||
"${PASSTHROUGH_OPTS[@]}" \
|
||||
${DRY_RUN+--dry-run} \
|
||||
${NO_OUT_LINK+--no-link} \
|
||||
"$FLAKE_CONFIG_URI.activationPackage" \
|
||||
|| exitCode=1
|
||||
return $exitCode
|
||||
fi
|
||||
|
||||
setWorkDir
|
||||
|
||||
local newsInfo
|
||||
newsInfo=$(buildNews)
|
||||
setFlakeAttribute
|
||||
if [[ -v FLAKE_CONFIG_URI ]]; then
|
||||
doBuildFlake \
|
||||
"$FLAKE_CONFIG_URI.activationPackage" \
|
||||
${DRY_RUN+--dry-run} \
|
||||
${NO_OUT_LINK+--no-link} \
|
||||
|| return
|
||||
else
|
||||
doBuildAttr \
|
||||
${NO_OUT_LINK+--no-out-link} \
|
||||
--attr activationPackage \
|
||||
|| return
|
||||
|
||||
local exitCode
|
||||
doBuildAttr \
|
||||
${NO_OUT_LINK+--no-out-link} \
|
||||
--attr activationPackage \
|
||||
&& exitCode=0 || exitCode=1
|
||||
local newsInfo
|
||||
newsInfo=$(buildNews)
|
||||
|
||||
presentNews "$newsInfo"
|
||||
|
||||
return $exitCode
|
||||
presentNews "$newsInfo"
|
||||
fi
|
||||
}
|
||||
|
||||
function doSwitch() {
|
||||
setFlakeAttribute
|
||||
if [[ -v FLAKE_CONFIG_URI ]]; then
|
||||
local exitCode=0
|
||||
nix run \
|
||||
"${PASSTHROUGH_OPTS[@]}" \
|
||||
"$FLAKE_CONFIG_URI.activationPackage" \
|
||||
|| exitCode=1
|
||||
return $exitCode
|
||||
fi
|
||||
|
||||
setWorkDir
|
||||
|
||||
local newsInfo
|
||||
newsInfo=$(buildNews)
|
||||
|
||||
local generation
|
||||
local exitCode=0
|
||||
|
||||
# Build the generation and run the activate script. Note, we
|
||||
# specify an output link so that it is treated as a GC root. This
|
||||
|
@ -299,14 +291,23 @@ function doSwitch() {
|
|||
# before activation completes.
|
||||
generation="$WORK_DIR/generation"
|
||||
|
||||
doBuildAttr \
|
||||
--out-link "$generation" \
|
||||
--attr activationPackage \
|
||||
&& "$generation/activate" || exitCode=1
|
||||
setFlakeAttribute
|
||||
if [[ -v FLAKE_CONFIG_URI ]]; then
|
||||
doBuildFlake \
|
||||
"$FLAKE_CONFIG_URI.activationPackage" \
|
||||
--out-link "$generation" \
|
||||
&& "$generation/activate" || return
|
||||
else
|
||||
doBuildAttr \
|
||||
--out-link "$generation" \
|
||||
--attr activationPackage \
|
||||
&& "$generation/activate" || return
|
||||
|
||||
presentNews "$newsInfo"
|
||||
local newsInfo
|
||||
newsInfo=$(buildNews)
|
||||
|
||||
return $exitCode
|
||||
presentNews "$newsInfo"
|
||||
fi
|
||||
}
|
||||
|
||||
function doListGens() {
|
||||
|
@ -403,13 +404,13 @@ function buildNews() {
|
|||
output="$WORK_DIR/news-info.sh"
|
||||
|
||||
doBuildAttr \
|
||||
--out-link "$output" \
|
||||
--no-build-output \
|
||||
--quiet \
|
||||
--arg check false \
|
||||
--argstr newsReadIdsFile "$(newsReadIdsFile)" \
|
||||
--attr newsInfo \
|
||||
> /dev/null
|
||||
--out-link "$output" \
|
||||
--no-build-output \
|
||||
--quiet \
|
||||
--arg check false \
|
||||
--argstr newsReadIdsFile "$(newsReadIdsFile)" \
|
||||
--attr newsInfo \
|
||||
> /dev/null
|
||||
|
||||
echo "$output"
|
||||
}
|
||||
|
@ -524,6 +525,7 @@ function doHelp() {
|
|||
echo " --show-trace"
|
||||
echo " --(no-)substitute"
|
||||
echo " --no-out-link Do not create a symlink to the output path"
|
||||
echo " --no-write-lock-file"
|
||||
echo " --builders VALUE"
|
||||
echo
|
||||
echo "Commands"
|
||||
|
@ -632,7 +634,7 @@ while [[ $# -gt 0 ]]; do
|
|||
export VERBOSE=1
|
||||
;;
|
||||
--version)
|
||||
echo 21.11
|
||||
echo 22.05
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
runCommand "home-manager-install" {
|
||||
propagatedBuildInputs = [ home-manager ];
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
shellHookOnly = true;
|
||||
shellHook = ''
|
||||
confFile="''${XDG_CONFIG_HOME:-$HOME/.config}/nixpkgs/home.nix"
|
||||
|
@ -32,9 +31,6 @@ runCommand "home-manager-install" {
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# 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";
|
||||
|
@ -48,7 +44,10 @@ 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 = "21.11";
|
||||
home.stateVersion = "22.05";
|
||||
|
||||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
|
|
@ -188,7 +188,7 @@ let
|
|||
};
|
||||
|
||||
flavor = mkOption {
|
||||
type = types.enum [ "plain" "gmail.com" "runbox.com" ];
|
||||
type = types.enum [ "plain" "gmail.com" "runbox.com" "fastmail.com" ];
|
||||
default = "plain";
|
||||
description = ''
|
||||
Some email providers have peculiar behavior that require
|
||||
|
@ -328,7 +328,17 @@ let
|
|||
name = name;
|
||||
maildir = mkOptionDefault { path = "${name}"; };
|
||||
}
|
||||
|
||||
(mkIf (config.flavor == "fastmail.com") {
|
||||
userName = mkDefault config.address;
|
||||
smtp = {
|
||||
host = "smtp.fastmail.com";
|
||||
port = if config.smtp.tls.useStartTls then 587 else 465;
|
||||
};
|
||||
imap = {
|
||||
host = "imap.fastmail.com";
|
||||
port = 993;
|
||||
};
|
||||
})
|
||||
(mkIf (config.flavor == "gmail.com") {
|
||||
userName = mkDefault config.address;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ let
|
|||
in {
|
||||
meta.maintainers = with maintainers; [ midchildan ];
|
||||
|
||||
config = mkIf pkgs.hostPlatform.isLinux {
|
||||
config = mkIf pkgs.stdenv.hostPlatform.isLinux {
|
||||
# For shell sessions.
|
||||
home.sessionVariables = localeVars;
|
||||
|
||||
|
|
|
@ -205,12 +205,13 @@ in
|
|||
|
||||
home.profileDirectory = mkOption {
|
||||
type = types.path;
|
||||
defaultText = "~/.nix-profile";
|
||||
internal = true;
|
||||
defaultText = literalExpression ''
|
||||
"''${home.homeDirectory}/.nix-profile" or
|
||||
"/etc/profiles/per-user/''${home.username}"
|
||||
'';
|
||||
readOnly = true;
|
||||
description = ''
|
||||
The profile directory where Home Manager generations are
|
||||
installed.
|
||||
The profile directory where Home Manager generations are installed.
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -233,6 +234,26 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
home.shellAliases = mkOption {
|
||||
type = with types; attrsOf str;
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
g = "git";
|
||||
"..." = "cd ../..";
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
An attribute set that maps aliases (the top level attribute names
|
||||
in this option) to command strings or directly to build outputs.
|
||||
</para><para>
|
||||
This option should only be used to manage simple aliases that are
|
||||
compatible across all shells. If you need to use a shell specific
|
||||
feature then make sure to use a shell specific option, for example
|
||||
<xref linkend="opt-programs.bash.shellAliases"/> for Bash.
|
||||
'';
|
||||
};
|
||||
|
||||
home.sessionVariables = mkOption {
|
||||
default = {};
|
||||
type = types.attrs;
|
||||
|
@ -419,7 +440,7 @@ in
|
|||
|
||||
home.enableNixpkgsReleaseCheck = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
default = false; # Temporarily disabled until release stabilizes.
|
||||
description = ''
|
||||
Determines whether to check for release version mismatch between Home
|
||||
Manager and Nixpkgs. Using mismatched versions is likely to cause errors
|
||||
|
@ -483,6 +504,10 @@ in
|
|||
then "/etc/profiles/per-user/${cfg.username}"
|
||||
else cfg.homeDirectory + "/.nix-profile";
|
||||
|
||||
programs.bash.shellAliases = cfg.shellAliases;
|
||||
programs.zsh.shellAliases = cfg.shellAliases;
|
||||
programs.fish.shellAliases = cfg.shellAliases;
|
||||
|
||||
home.sessionVariables =
|
||||
let
|
||||
maybeSet = n: v: optionalAttrs (v != null) { ${n} = v; };
|
||||
|
@ -628,7 +653,6 @@ in
|
|||
"home-manager-generation"
|
||||
{
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
}
|
||||
''
|
||||
mkdir -p $out
|
||||
|
|
|
@ -133,4 +133,11 @@
|
|||
github = "hawkw";
|
||||
githubId = 2796466;
|
||||
};
|
||||
|
||||
pamplemousse = {
|
||||
name = "Xavier Maso";
|
||||
email = "xav.maso@gmail.com";
|
||||
github = "pamplemousse";
|
||||
githubId = 2647236;
|
||||
};
|
||||
}
|
||||
|
|
47
third_party/home-manager/modules/misc/news.nix
vendored
47
third_party/home-manager/modules/misc/news.nix
vendored
|
@ -2233,6 +2233,53 @@ in
|
|||
A new module is available: 'programs.hexchat'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2021-11-21T17:21:04+00:00";
|
||||
condition = config.wayland.windowManager.sway.enable;
|
||||
message = ''
|
||||
A new module is available: 'wayland.windowManager.sway.swaynag'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2021-11-23T20:26:37+00:00";
|
||||
condition = config.programs.taskwarrior.enable;
|
||||
message = ''
|
||||
Taskwarrior version 2.6.0 respects XDG Specification for the config
|
||||
file now. Option 'programs.taskwarrior.config' and friends now
|
||||
generate the config file at '$XDG_CONFIG_HOME/task/taskrc' instead of
|
||||
'~/.taskrc'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2021-11-30T22:28:12+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.less'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2021-11-29T15:15:59+00:00";
|
||||
condition = hostPlatform.isDarwin;
|
||||
message = ''
|
||||
The option 'targets.darwin.defaults."com.apple.menuextra.battery".ShowPercent'
|
||||
has been deprecated since it no longer works on the latest version of
|
||||
macOS.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2021-12-02T02:59:59+00:00";
|
||||
condition = config.programs.waybar.enable;
|
||||
message = ''
|
||||
The Waybar module now allows defining modules directly under the 'settings'
|
||||
option instead of nesting the modules under 'settings.modules'.
|
||||
The Waybar module will also stop reporting errors about unused or misnamed
|
||||
modules.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ with lib;
|
|||
"21.03"
|
||||
"21.05"
|
||||
"21.11"
|
||||
"22.05"
|
||||
];
|
||||
default = "18.09";
|
||||
description = ''
|
||||
|
|
|
@ -10,7 +10,7 @@ in {
|
|||
options = {
|
||||
xdg.mime.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = pkgs.hostPlatform.isLinux;
|
||||
default = pkgs.stdenv.hostPlatform.isLinux;
|
||||
defaultText =
|
||||
literalExpression "true if host platform is Linux, false otherwise";
|
||||
description = ''
|
||||
|
|
|
@ -108,7 +108,7 @@ in {
|
|||
xdg.cacheHome = mkDefault defaultCacheHome;
|
||||
xdg.configHome = mkDefault defaultConfigHome;
|
||||
xdg.dataHome = mkDefault defaultDataHome;
|
||||
xdg.stateHome = mkDefault stateHome;
|
||||
xdg.stateHome = mkDefault defaultStateHome;
|
||||
})
|
||||
|
||||
{
|
||||
|
|
2
third_party/home-manager/modules/modules.nix
vendored
2
third_party/home-manager/modules/modules.nix
vendored
|
@ -86,6 +86,7 @@ let
|
|||
./programs/keychain.nix
|
||||
./programs/kitty.nix
|
||||
./programs/lazygit.nix
|
||||
./programs/less.nix
|
||||
./programs/lesspipe.nix
|
||||
./programs/lf.nix
|
||||
./programs/lieer.nix
|
||||
|
@ -227,6 +228,7 @@ let
|
|||
./services/window-managers/bspwm/default.nix
|
||||
./services/window-managers/i3-sway/i3.nix
|
||||
./services/window-managers/i3-sway/sway.nix
|
||||
./services/window-managers/i3-sway/swaynag.nix
|
||||
./services/window-managers/xmonad.nix
|
||||
./services/wlsunset.nix
|
||||
./services/xcape.nix
|
||||
|
|
|
@ -15,6 +15,8 @@ in {
|
|||
"direnv"
|
||||
"enableNixDirenvIntegration"
|
||||
] [ "programs" "direnv" "nix-direnv" "enable" ])
|
||||
(mkRemovedOptionModule [ "programs" "direnv" "nix-direnv" "enableFlakes" ]
|
||||
"Flake support is now always enabled.")
|
||||
];
|
||||
|
||||
meta.maintainers = [ maintainers.rycee ];
|
||||
|
@ -79,7 +81,6 @@ in {
|
|||
<link
|
||||
xlink:href="https://github.com/nix-community/nix-direnv">nix-direnv</link>,
|
||||
a fast, persistent use_nix implementation for direnv'';
|
||||
enableFlakes = mkEnableOption "Flake support in nix-direnv";
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -92,11 +93,9 @@ in {
|
|||
};
|
||||
|
||||
xdg.configFile."direnv/direnvrc" = let
|
||||
package =
|
||||
pkgs.nix-direnv.override { inherit (cfg.nix-direnv) enableFlakes; };
|
||||
text = concatStringsSep "\n" (optional (cfg.stdlib != "") cfg.stdlib
|
||||
++ optional cfg.nix-direnv.enable
|
||||
"source ${package}/share/nix-direnv/direnvrc");
|
||||
"source ${pkgs.nix-direnv}/share/nix-direnv/direnvrc");
|
||||
in mkIf (text != "") { inherit text; };
|
||||
|
||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration (
|
||||
|
|
|
@ -370,8 +370,8 @@ in {
|
|||
"${profilesPath}/${profile.path}/chrome/userContent.css" =
|
||||
mkIf (profile.userContent != "") { text = profile.userContent; };
|
||||
|
||||
"${profilesPath}/${profile.path}/user.js" =
|
||||
mkIf (profile.settings != { } || profile.extraConfig != "") {
|
||||
"${profilesPath}/${profile.path}/user.js" = mkIf (profile.settings != { }
|
||||
|| profile.extraConfig != "" || profile.bookmarks != { }) {
|
||||
text =
|
||||
mkUserJs profile.settings profile.extraConfig profile.bookmarks;
|
||||
};
|
||||
|
|
|
@ -310,7 +310,6 @@ in {
|
|||
nativeBuildInputs = [ pkgs.python2 ];
|
||||
buildInputs = [ cfg.package ];
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
} ''
|
||||
mkdir -p $out
|
||||
if [ -d $src/share/man ]; then
|
||||
|
|
189
third_party/home-manager/modules/programs/gpg.nix
vendored
189
third_party/home-manager/modules/programs/gpg.nix
vendored
|
@ -21,6 +21,110 @@ let
|
|||
} cfg.scdaemonSettings;
|
||||
|
||||
primitiveType = types.oneOf [ types.str types.bool ];
|
||||
|
||||
publicKeyOpts = { config, ...}: {
|
||||
options = {
|
||||
text = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Text of an OpenPGP public key.
|
||||
'';
|
||||
};
|
||||
|
||||
source = mkOption {
|
||||
type = types.path;
|
||||
description = ''
|
||||
Path of an OpenPGP public key file.
|
||||
'';
|
||||
};
|
||||
|
||||
trust = mkOption {
|
||||
type = types.nullOr (types.enum [ 1 2 3 4 5 ]);
|
||||
default = null;
|
||||
description = ''
|
||||
The amount of trust you have in the key ownership and the care the
|
||||
owner puts into signing other keys. The available levels are
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><literal>1</literal></term>
|
||||
<listitem><para>I don't know or won't say.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>2</literal></term>
|
||||
<listitem><para>I do NOT trust.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>3</literal></term>
|
||||
<listitem><para>I trust marginally.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>4</literal></term>
|
||||
<listitem><para>I trust fully.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>5</literal></term>
|
||||
<listitem><para>I trust ultimately.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para><para>
|
||||
See <link xlink:href="https://www.gnupg.org/gph/en/manual/x334.html"/>
|
||||
for more.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
source = mkIf (config.text != null)
|
||||
(pkgs.writeText "gpg-pubkey" config.text);
|
||||
};
|
||||
};
|
||||
|
||||
importTrustBashFunctions =
|
||||
let gpg = "${cfg.package}/bin/gpg";
|
||||
in ''
|
||||
function gpgKeyId() {
|
||||
${gpg} --show-key --with-colons "$1" \
|
||||
| grep ^pub: \
|
||||
| cut -d: -f5
|
||||
}
|
||||
|
||||
function importTrust() {
|
||||
local keyId trust
|
||||
keyId="$(gpgKeyId "$1")"
|
||||
trust="$2"
|
||||
if [[ -n $keyId ]] ; then
|
||||
echo -e "trust\n$trust\ny\nquit" \
|
||||
| ${gpg} --no-tty --command-fd 0 --edit-key "$keyId"
|
||||
fi
|
||||
}
|
||||
'';
|
||||
|
||||
keyringFiles =
|
||||
let
|
||||
gpg = "${cfg.package}/bin/gpg";
|
||||
|
||||
importKey = { source, trust, ... }: ''
|
||||
${gpg} --import ${source}
|
||||
${optionalString (trust != null) ''
|
||||
importTrust "${source}" ${toString trust}''}
|
||||
'';
|
||||
|
||||
importKeys = concatMapStringsSep "\n" importKey cfg.publicKeys;
|
||||
in pkgs.runCommand "gpg-pubring" { buildInputs = [ cfg.package ]; } ''
|
||||
export GNUPGHOME
|
||||
GNUPGHOME=$(mktemp -d)
|
||||
|
||||
${importTrustBashFunctions}
|
||||
${importKeys}
|
||||
|
||||
mkdir $out
|
||||
cp $GNUPGHOME/pubring.kbx $out/pubring.kbx
|
||||
if [[ -e $GNUPGHOME/trustdb.gpg ]] ; then
|
||||
cp $GNUPGHOME/trustdb.gpg $out/trustdb.gpg
|
||||
fi
|
||||
'';
|
||||
|
||||
in
|
||||
{
|
||||
options.programs.gpg = {
|
||||
|
@ -73,6 +177,48 @@ in
|
|||
defaultText = literalExpression "\"\${config.home.homeDirectory}/.gnupg\"";
|
||||
description = "Directory to store keychains and configuration.";
|
||||
};
|
||||
|
||||
mutableKeys = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
If set to <literal>true</literal>, you may manage your keyring as a user
|
||||
using the <literal>gpg</literal> command. Upon activation, the keyring
|
||||
will have managed keys added without overwriting unmanaged keys.
|
||||
</para><para>
|
||||
If set to <literal>false</literal>, the path
|
||||
<filename>$GNUPGHOME/pubring.kbx</filename> will become an immutable
|
||||
link to the Nix store, denying modifications.
|
||||
'';
|
||||
};
|
||||
|
||||
mutableTrust = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
If set to <literal>true</literal>, you may manage trust as a user using
|
||||
the <command>gpg</command> command. Upon activation, trusted keys have
|
||||
their trust set without overwriting unmanaged keys.
|
||||
</para><para>
|
||||
If set to <literal>false</literal>, the path
|
||||
<filename>$GNUPGHOME/trustdb.gpg</filename> will be
|
||||
<emphasis>overwritten</emphasis> on each activation, removing trust for
|
||||
any unmanaged keys. Be careful to make a backup of your old
|
||||
<filename>trustdb.gpg</filename> before switching to immutable trust!
|
||||
'';
|
||||
};
|
||||
|
||||
publicKeys = mkOption {
|
||||
type = types.listOf (types.submodule publicKeyOpts);
|
||||
example = literalExpression ''
|
||||
[ { source = ./pubkeys.txt; } ]
|
||||
'';
|
||||
default = [ ];
|
||||
description = ''
|
||||
A list of public keys to be imported into GnuPG. Note, these key files
|
||||
will be copied into the world-readable Nix store.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
@ -109,5 +255,48 @@ in
|
|||
home.file."${cfg.homedir}/gpg.conf".text = cfgText;
|
||||
|
||||
home.file."${cfg.homedir}/scdaemon.conf".text = scdaemonCfgText;
|
||||
|
||||
# Link keyring if keys are not mutable
|
||||
home.file."${cfg.homedir}/pubring.kbx" =
|
||||
mkIf (!cfg.mutableKeys && cfg.publicKeys != []) {
|
||||
source = "${keyringFiles}/pubring.kbx";
|
||||
};
|
||||
|
||||
home.activation = mkIf (cfg.publicKeys != []) {
|
||||
importGpgKeys =
|
||||
let
|
||||
gpg = "${cfg.package}/bin/gpg";
|
||||
|
||||
importKey = { source, trust, ... }:
|
||||
# Import mutable keys
|
||||
optional cfg.mutableKeys ''
|
||||
$DRY_RUN_CMD ${gpg} $QUIET_ARG --import ${source}''
|
||||
|
||||
# Import mutable trust
|
||||
++ optional (trust != null && cfg.mutableTrust) ''
|
||||
$DRY_RUN_CMD importTrust "${source}" ${toString trust}'';
|
||||
|
||||
anyTrust = any (k: k.trust != null) cfg.publicKeys;
|
||||
|
||||
importKeys = concatStringsSep "\n" (concatMap importKey cfg.publicKeys);
|
||||
|
||||
# If any key/trust should be imported then create the block. Otherwise
|
||||
# leave it empty.
|
||||
block = concatStringsSep "\n" (
|
||||
optional (importKeys != "") ''
|
||||
export GNUPGHOME=${escapeShellArg cfg.homedir}
|
||||
if [[ ! -v VERBOSE ]]; then
|
||||
QUIET_ARG="--quiet"
|
||||
else
|
||||
QUIET_ARG=""
|
||||
fi
|
||||
${importTrustBashFunctions}
|
||||
${importKeys}
|
||||
unset GNUPGHOME QUIET_ARG keyId importTrust
|
||||
'' ++ optional (!cfg.mutableTrust && anyTrust) ''
|
||||
install -m 0700 ${keyringFiles}/trustdb.gpg "${cfg.homedir}/trustdb.gpg"''
|
||||
);
|
||||
in lib.hm.dag.entryAfter ["linkGeneration"] block;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
32
third_party/home-manager/modules/programs/less.nix
vendored
Normal file
32
third_party/home-manager/modules/programs/less.nix
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let cfg = config.programs.less;
|
||||
in {
|
||||
meta.maintainers = [ maintainers.pamplemousse ];
|
||||
|
||||
options = {
|
||||
programs.less = {
|
||||
enable = mkEnableOption "less, opposite of more";
|
||||
|
||||
keys = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = ''
|
||||
s back-line
|
||||
t forw-line
|
||||
'';
|
||||
description = ''
|
||||
Extra configuration for <command>less</command> written to
|
||||
<filename>$HOME/.lesskey</filename>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.less ];
|
||||
home.file.".lesskey".text = cfg.keys;
|
||||
};
|
||||
}
|
|
@ -65,7 +65,7 @@ let
|
|||
remotePassEval =
|
||||
let arglist = concatMapStringsSep "," (x: "'${x}'") passwordCommand;
|
||||
in optionalAttrs (passwordCommand != null) {
|
||||
remotepasseval = ''get_pass("${name}", [${arglist}]).strip("\n")'';
|
||||
remotepasseval = ''get_pass("${name}", [${arglist}]).strip(b"\n")'';
|
||||
};
|
||||
in toIni {
|
||||
"Account ${name}" = {
|
||||
|
|
|
@ -80,16 +80,25 @@ in {
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.pet.settings = {
|
||||
selectcmd = mkDefault "fzf";
|
||||
snippetfile = config.xdg.configHome + "/pet/snippet.toml";
|
||||
};
|
||||
programs.pet.settings = let
|
||||
defaultGeneral = {
|
||||
selectcmd = mkDefault "fzf";
|
||||
snippetfile = config.xdg.configHome + "/pet/snippet.toml";
|
||||
};
|
||||
in if versionAtLeast config.home.stateVersion "21.11" then {
|
||||
General = defaultGeneral;
|
||||
} else
|
||||
defaultGeneral;
|
||||
|
||||
home.packages = [ pkgs.pet cfg.selectcmdPackage ];
|
||||
|
||||
xdg.configFile = {
|
||||
"pet/config.toml".source =
|
||||
format.generate "config.toml" { General = cfg.settings; };
|
||||
"pet/config.toml".source = format.generate "config.toml"
|
||||
(if versionAtLeast config.home.stateVersion "21.11" then
|
||||
cfg.settings
|
||||
else {
|
||||
General = cfg.settings;
|
||||
});
|
||||
"pet/snippet.toml".source =
|
||||
format.generate "snippet.toml" { snippets = cfg.snippets; };
|
||||
};
|
||||
|
|
|
@ -19,22 +19,29 @@ let
|
|||
builtins.toString value;
|
||||
|
||||
modulesArgument = optionalString (cfg.modules != null)
|
||||
"-modules ${valueToString cfg.modules}";
|
||||
" -modules ${valueToString cfg.modules}";
|
||||
|
||||
newlineArgument = optionalString cfg.newline "-newline";
|
||||
modulesRightArgument = optionalString (cfg.modulesRight != null)
|
||||
" -modules-right ${valueToString cfg.modulesRight}";
|
||||
|
||||
evalMode = cfg.modulesRight != null;
|
||||
|
||||
evalArgument = optionalString (evalMode) " -eval";
|
||||
|
||||
newlineArgument = optionalString cfg.newline " -newline";
|
||||
|
||||
pathAliasesArgument = optionalString (cfg.pathAliases != null)
|
||||
"-path-aliases ${valueToString cfg.pathAliases}";
|
||||
" -path-aliases ${valueToString cfg.pathAliases}";
|
||||
|
||||
otherSettingPairArgument = name: value:
|
||||
if value == true then "-${name}" else "-${name} ${valueToString value}";
|
||||
if value == true then " -${name}" else " -${name} ${valueToString value}";
|
||||
|
||||
otherSettingsArgument = optionalString (cfg.settings != { })
|
||||
(concatStringsSep " "
|
||||
(concatStringsSep ""
|
||||
(mapAttrsToList otherSettingPairArgument cfg.settings));
|
||||
|
||||
commandLineArguments = ''
|
||||
${modulesArgument} ${newlineArgument} ${pathAliasesArgument} ${otherSettingsArgument}
|
||||
${evalArgument}${modulesArgument}${modulesRightArgument}${newlineArgument}${pathAliasesArgument}${otherSettingsArgument}
|
||||
'';
|
||||
|
||||
in {
|
||||
|
@ -56,6 +63,18 @@ in {
|
|||
example = [ "host" "ssh" "cwd" "gitlite" "jobs" "exit" ];
|
||||
};
|
||||
|
||||
modulesRight = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr (types.listOf types.str);
|
||||
description = ''
|
||||
List of module names to load to be displayed on the right side.
|
||||
Currently not supported by bash. Specifying a value for this
|
||||
option will force powerline-go to use the eval format to set
|
||||
the prompt.
|
||||
'';
|
||||
example = [ "host" "venv" "git" ];
|
||||
};
|
||||
|
||||
newline = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
|
@ -111,7 +130,9 @@ in {
|
|||
mkIf (cfg.enable && config.programs.bash.enable) ''
|
||||
function _update_ps1() {
|
||||
local old_exit_status=$?
|
||||
PS1="$(${pkgs.powerline-go}/bin/powerline-go -error $old_exit_status ${commandLineArguments})"
|
||||
${
|
||||
if evalMode then "eval " else "PS1="
|
||||
}"$(${pkgs.powerline-go}/bin/powerline-go -error $old_exit_status -shell bash${commandLineArguments})"
|
||||
${cfg.extraUpdatePS1}
|
||||
return $old_exit_status
|
||||
}
|
||||
|
@ -123,7 +144,9 @@ in {
|
|||
|
||||
programs.zsh.initExtra = mkIf (cfg.enable && config.programs.zsh.enable) ''
|
||||
function powerline_precmd() {
|
||||
PS1="$(${pkgs.powerline-go}/bin/powerline-go -error $? -shell zsh ${commandLineArguments})"
|
||||
${
|
||||
if evalMode then "eval " else "PS1="
|
||||
}"$(${pkgs.powerline-go}/bin/powerline-go -error $? -shell zsh${commandLineArguments})"
|
||||
${cfg.extraUpdatePS1}
|
||||
}
|
||||
|
||||
|
@ -145,7 +168,7 @@ in {
|
|||
programs.fish.interactiveShellInit =
|
||||
mkIf (cfg.enable && config.programs.fish.enable) ''
|
||||
function fish_prompt
|
||||
eval ${pkgs.powerline-go}/bin/powerline-go -error $status -jobs (count (jobs -p)) ${commandLineArguments}
|
||||
eval ${pkgs.powerline-go}/bin/powerline-go -error $status -jobs (count (jobs -p))${commandLineArguments}
|
||||
${cfg.extraUpdatePS1}
|
||||
end
|
||||
'';
|
||||
|
|
|
@ -35,10 +35,10 @@ let
|
|||
${configStr}}
|
||||
''
|
||||
else
|
||||
mkKeyValue {
|
||||
(mkKeyValue {
|
||||
sep = " ";
|
||||
end = "";
|
||||
} name value;
|
||||
} name value) + "\n";
|
||||
|
||||
toRasi = attrs: concatStringsSep "\n" (mapAttrsToList mkRasiSection attrs);
|
||||
|
||||
|
@ -266,9 +266,9 @@ in {
|
|||
location = (getAttr cfg.location locationsMap);
|
||||
xoffset = cfg.xoffset;
|
||||
yoffset = cfg.yoffset;
|
||||
theme = themeName;
|
||||
} // cfg.extraConfig);
|
||||
};
|
||||
# @theme must go after configuration but attrs are output in alphabetical order ('@' first)
|
||||
} + (optionalString (themeName != null) (toRasi { "@theme" = themeName; }));
|
||||
|
||||
xdg.dataFile = mkIf (themePath != null) (if themePath == "custom" then {
|
||||
"rofi/themes/${themeName}.rasi".text = toRasi cfg.theme;
|
||||
|
|
|
@ -414,6 +414,22 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
includes = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
description = ''
|
||||
File globs of ssh config files that should be included via the
|
||||
<literal>Include</literal> directive.
|
||||
</para><para>
|
||||
See
|
||||
<citerefentry>
|
||||
<refentrytitle>ssh_config</refentrytitle>
|
||||
<manvolnum>5</manvolnum>
|
||||
</citerefentry>
|
||||
for more information.
|
||||
'';
|
||||
};
|
||||
|
||||
matchBlocks = mkOption {
|
||||
type = hm.types.listOrDagOf matchBlockModule;
|
||||
default = {};
|
||||
|
@ -474,9 +490,12 @@ in
|
|||
else abort "Dependency cycle in SSH match blocks: ${sortedMatchBlocksStr}";
|
||||
in ''
|
||||
${concatStringsSep "\n" (
|
||||
mapAttrsToList (n: v: "${n} ${v}") cfg.extraOptionOverrides)}
|
||||
|
||||
${concatStringsSep "\n\n" (map (block: matchBlockStr block.data) matchBlocks)}
|
||||
(mapAttrsToList (n: v: "${n} ${v}") cfg.extraOptionOverrides)
|
||||
++ (optional (cfg.includes != [ ]) ''
|
||||
Include ${concatStringsSep " " cfg.includes}
|
||||
'')
|
||||
++ (map (block: matchBlockStr block.data) matchBlocks)
|
||||
)}
|
||||
|
||||
Host *
|
||||
ForwardAgent ${yn cfg.forwardAgent}
|
||||
|
|
|
@ -6,16 +6,6 @@ let
|
|||
|
||||
cfg = config.programs.taskwarrior;
|
||||
|
||||
themePath = theme: "${pkgs.taskwarrior}/share/doc/task/rc/${theme}.theme";
|
||||
|
||||
includeTheme = location:
|
||||
if location == null then
|
||||
""
|
||||
else if isString location then
|
||||
"include ${themePath location}"
|
||||
else
|
||||
"include ${location}";
|
||||
|
||||
formatValue = value:
|
||||
if isBool value then
|
||||
if value then "true" else "false"
|
||||
|
@ -59,7 +49,7 @@ in {
|
|||
'';
|
||||
description = ''
|
||||
Key-value configuration written to
|
||||
<filename>~/.taskrc</filename>.
|
||||
<filename>$XDG_CONFIG_HOME/task/taskrc</filename>.
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -89,7 +79,7 @@ in {
|
|||
default = "";
|
||||
description = ''
|
||||
Additional content written at the end of
|
||||
<filename>~/.taskrc</filename>.
|
||||
<filename>$XDG_CONFIG_HOME/task/taskrc</filename>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
@ -98,9 +88,12 @@ in {
|
|||
config = mkIf cfg.enable {
|
||||
home.packages = [ pkgs.taskwarrior ];
|
||||
|
||||
home.file.".taskrc".text = ''
|
||||
xdg.configFile."task/taskrc".text = ''
|
||||
data.location=${cfg.dataLocation}
|
||||
${includeTheme cfg.colorTheme}
|
||||
${optionalString (cfg.colorTheme != null) (if isString cfg.colorTheme then
|
||||
"include ${cfg.colorTheme}.theme"
|
||||
else
|
||||
"include ${cfg.colorTheme}")}
|
||||
|
||||
${concatStringsSep "\n" (mapAttrsToList formatPair cfg.config)}
|
||||
|
||||
|
|
|
@ -127,11 +127,13 @@ in {
|
|||
# Adapted from https://discourse.nixos.org/t/vscode-extensions-setup/1801/2
|
||||
home.file = let
|
||||
subDir = "share/vscode/extensions";
|
||||
toPaths = path:
|
||||
# Links every dir in path to the extension path.
|
||||
mapAttrsToList
|
||||
(k: _: { "${extensionPath}/${k}".source = "${path}/${subDir}/${k}"; })
|
||||
(builtins.readDir (path + "/${subDir}"));
|
||||
toPaths = ext:
|
||||
# Links every dir in ext to the extension path.
|
||||
map (k: { "${extensionPath}/${k}".source = "${ext}/${subDir}/${k}"; })
|
||||
(if ext ? vscodeExtUniqueId then
|
||||
[ ext.vscodeExtUniqueId ]
|
||||
else
|
||||
builtins.attrNames (builtins.readDir (ext + "/${subDir}")));
|
||||
toSymlink = concatMap toPaths cfg.extensions;
|
||||
dropNullFields = filterAttrs (_: v: v != null);
|
||||
in foldr (a: b: a // b) {
|
||||
|
|
210
third_party/home-manager/modules/programs/waybar.nix
vendored
210
third_party/home-manager/modules/programs/waybar.nix
vendored
|
@ -2,72 +2,26 @@
|
|||
|
||||
let
|
||||
inherit (lib)
|
||||
any attrByPath attrNames concatMap concatMapStringsSep elem elemAt filter
|
||||
filterAttrs flip foldl' hasPrefix head length literalExpression mergeAttrs
|
||||
optionalAttrs stringLength subtractLists types unique;
|
||||
all filterAttrs hasAttr isStorePath literalExpression optionalAttrs types;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
|
||||
cfg = config.programs.waybar;
|
||||
|
||||
# Used when generating warnings
|
||||
modulesPath = "programs.waybar.settings.[].modules";
|
||||
|
||||
jsonFormat = pkgs.formats.json { };
|
||||
|
||||
# Taken from <https://github.com/Alexays/Waybar/blob/cc3acf8102c71d470b00fd55126aef4fb335f728/src/factory.cpp> (2020/10/10)
|
||||
# Order is preserved from the file for easier matching
|
||||
defaultModuleNames = [
|
||||
"battery"
|
||||
"sway/mode"
|
||||
"sway/workspaces"
|
||||
"sway/window"
|
||||
"sway/language"
|
||||
"wlr/taskbar"
|
||||
"river/tags"
|
||||
"idle_inhibitor"
|
||||
"memory"
|
||||
"cpu"
|
||||
"clock"
|
||||
"disk"
|
||||
"tray"
|
||||
"network"
|
||||
"backlight"
|
||||
"pulseaudio"
|
||||
"mpd"
|
||||
"sndio"
|
||||
"temperature"
|
||||
"bluetooth"
|
||||
];
|
||||
|
||||
# Allow specifying a CSS id after the default module name
|
||||
isValidDefaultModuleName = x:
|
||||
any (name:
|
||||
let
|
||||
res = builtins.split name x;
|
||||
# if exact match of default module name
|
||||
in if res == [ "" [ ] ] || res == [ "" [ ] "" ] then
|
||||
true
|
||||
else
|
||||
head res == "" && length res >= 3 && hasPrefix "#" (elemAt res 2))
|
||||
defaultModuleNames;
|
||||
|
||||
isValidCustomModuleName = x: hasPrefix "custom/" x && stringLength x > 7;
|
||||
|
||||
margins = let
|
||||
mkMargin = name: {
|
||||
"margin-${name}" = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
example = 10;
|
||||
description = "Margins value without unit.";
|
||||
};
|
||||
mkMargin = name:
|
||||
mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
example = 10;
|
||||
description = "Margin value without unit.";
|
||||
};
|
||||
margins = map mkMargin [ "top" "left" "bottom" "right" ];
|
||||
in foldl' mergeAttrs { } margins;
|
||||
|
||||
waybarBarConfig = with lib.types;
|
||||
waybarBarConfig = with types;
|
||||
submodule {
|
||||
freeformType = jsonFormat.type;
|
||||
|
||||
options = {
|
||||
layer = mkOption {
|
||||
type = nullOr (enum [ "top" "bottom" ]);
|
||||
|
@ -164,7 +118,10 @@ let
|
|||
example = "20 5";
|
||||
};
|
||||
|
||||
inherit (margins) margin-top margin-left margin-bottom margin-right;
|
||||
margin-left = mkMargin "left";
|
||||
margin-right = mkMargin "right";
|
||||
margin-bottom = mkMargin "bottom";
|
||||
margin-top = mkMargin "top";
|
||||
|
||||
name = mkOption {
|
||||
type = nullOr str;
|
||||
|
@ -192,9 +149,9 @@ in {
|
|||
package = mkOption {
|
||||
type = package;
|
||||
default = pkgs.waybar;
|
||||
defaultText = "pkgs.waybar";
|
||||
defaultText = literalExpression "pkgs.waybar";
|
||||
description = ''
|
||||
Waybar package to use. Set to <code>null</code> to use the default module.
|
||||
Waybar package to use. Set to <code>null</code> to use the default package.
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -241,12 +198,17 @@ in {
|
|||
systemd.enable = mkEnableOption "Waybar systemd integration";
|
||||
|
||||
style = mkOption {
|
||||
type = nullOr str;
|
||||
type = nullOr (either path str);
|
||||
default = null;
|
||||
description = ''
|
||||
CSS style of the bar.
|
||||
</para>
|
||||
<para>
|
||||
See <link xlink:href="https://github.com/Alexays/Waybar/wiki/Configuration"/>
|
||||
for the documentation.
|
||||
</para>
|
||||
<para>
|
||||
If the value is set to a path literal, then the path will be used as the css file.
|
||||
'';
|
||||
example = ''
|
||||
* {
|
||||
|
@ -266,122 +228,62 @@ in {
|
|||
};
|
||||
|
||||
config = let
|
||||
writePrettyJSON = jsonFormat.generate;
|
||||
# Removes nulls because Waybar ignores them.
|
||||
# This is not recursive.
|
||||
removeNulls = filterAttrs (_: v: v != null);
|
||||
|
||||
configSource = let
|
||||
# Removes nulls because Waybar ignores them for most values
|
||||
removeNulls = filterAttrs (_: v: v != null);
|
||||
# Makes the actual valid configuration Waybar accepts
|
||||
# (strips our custom settings before converting to JSON)
|
||||
makeConfiguration = configuration:
|
||||
let
|
||||
# The "modules" option is not valid in the JSON
|
||||
# as its descendants have to live at the top-level
|
||||
settingsWithoutModules = removeAttrs configuration [ "modules" ];
|
||||
settingsModules =
|
||||
optionalAttrs (configuration.modules != { }) configuration.modules;
|
||||
in removeNulls (settingsWithoutModules // settingsModules);
|
||||
# The clean list of configurations
|
||||
finalConfiguration = map makeConfiguration cfg.settings;
|
||||
|
||||
# Makes the actual valid configuration Waybar accepts
|
||||
# (strips our custom settings before converting to JSON)
|
||||
makeConfiguration = configuration:
|
||||
let
|
||||
# The "modules" option is not valid in the JSON
|
||||
# as its descendants have to live at the top-level
|
||||
settingsWithoutModules = removeAttrs configuration [ "modules" ];
|
||||
settingsModules =
|
||||
optionalAttrs (configuration.modules != { }) configuration.modules;
|
||||
in removeNulls (settingsWithoutModules // settingsModules);
|
||||
# The clean list of configurations
|
||||
finalConfiguration = map makeConfiguration cfg.settings;
|
||||
in writePrettyJSON "waybar-config.json" finalConfiguration;
|
||||
|
||||
#
|
||||
# Warnings are generated based on the following things:
|
||||
# 1. A `module` is referenced in any of `modules-{left,center,right}` that is neither
|
||||
# a default module name nor defined in `modules`.
|
||||
# 2. A `module` is defined in `modules` but is not referenced in either of
|
||||
# `modules-{left,center,right}`.
|
||||
# 3. A custom `module` configuration is defined in `modules` but has an invalid name
|
||||
# for a custom module (i.e. not "custom/my-module-name").
|
||||
#
|
||||
warnings = let
|
||||
mkUnreferencedModuleWarning = name:
|
||||
"The module '${name}' defined in '${modulesPath}' is not referenced "
|
||||
+ "in either `modules-left`, `modules-center` or `modules-right` of Waybar's options";
|
||||
mkUndefinedModuleWarning = settings: name:
|
||||
let
|
||||
# Locations where the module is undefined (a combination modules-{left,center,right})
|
||||
locations = flip filter [ "left" "center" "right" ]
|
||||
(x: elem name settings."modules-${x}");
|
||||
mkPath = loc: "'${modulesPath}-${loc}'";
|
||||
# The modules-{left,center,right} configuration that includes
|
||||
# an undefined module
|
||||
path = concatMapStringsSep " and " mkPath locations;
|
||||
in "The module '${name}' defined in ${path} is neither "
|
||||
+ "a default module or a custom module declared in '${modulesPath}'";
|
||||
mkInvalidModuleNameWarning = name:
|
||||
"The custom module '${name}' defined in '${modulesPath}' is not a valid "
|
||||
+ "module name. A custom module's name must start with 'custom/' "
|
||||
+ "like 'custom/mymodule' for instance";
|
||||
|
||||
allFaultyModules = flip map cfg.settings (settings:
|
||||
let
|
||||
allModules = unique
|
||||
(concatMap (x: attrByPath [ "modules-${x}" ] [ ] settings) [
|
||||
"left"
|
||||
"center"
|
||||
"right"
|
||||
]);
|
||||
declaredModules = attrNames settings.modules;
|
||||
# Modules declared in `modules` but not referenced in `modules-{left,center,right}`
|
||||
unreferencedModules = subtractLists allModules declaredModules;
|
||||
# Modules listed in modules-{left,center,right} that are not default modules
|
||||
nonDefaultModules =
|
||||
filter (x: !isValidDefaultModuleName x) allModules;
|
||||
# Modules referenced in `modules-{left,center,right}` but not declared in `modules`
|
||||
undefinedModules = subtractLists declaredModules nonDefaultModules;
|
||||
# Check for invalid module names
|
||||
invalidModuleNames = filter
|
||||
(m: !isValidCustomModuleName m && !isValidDefaultModuleName m)
|
||||
declaredModules;
|
||||
in {
|
||||
# The Waybar bar configuration (since config.settings is a list)
|
||||
inherit settings;
|
||||
undef = undefinedModules;
|
||||
unref = unreferencedModules;
|
||||
invalidName = invalidModuleNames;
|
||||
});
|
||||
|
||||
allWarnings = flip concatMap allFaultyModules
|
||||
({ settings, undef, unref, invalidName }:
|
||||
let
|
||||
unreferenced = map mkUnreferencedModuleWarning unref;
|
||||
undefined = map (mkUndefinedModuleWarning settings) undef;
|
||||
invalid = map mkInvalidModuleNameWarning invalidName;
|
||||
in undefined ++ unreferenced ++ invalid);
|
||||
in allWarnings;
|
||||
configSource = jsonFormat.generate "waybar-config.json" finalConfiguration;
|
||||
|
||||
in mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
assertions = [
|
||||
(lib.hm.assertions.assertPlatform "programs.waybar" pkgs
|
||||
lib.platforms.linux)
|
||||
({
|
||||
assertion =
|
||||
if lib.versionAtLeast config.home.stateVersion "22.05" then
|
||||
all (x: !hasAttr "modules" x) cfg.settings
|
||||
else
|
||||
true;
|
||||
message = ''
|
||||
The `programs.waybar.settings.[].modules` option has been removed.
|
||||
It is now possible to declare modules in the configuration without nesting them under the `modules` option.
|
||||
'';
|
||||
})
|
||||
];
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
}
|
||||
|
||||
(mkIf (cfg.settings != [ ]) {
|
||||
# Generate warnings about defined but unreferenced modules
|
||||
inherit warnings;
|
||||
|
||||
xdg.configFile."waybar/config" = {
|
||||
xdg.configFile."waybar/config" = mkIf (cfg.settings != [ ]) {
|
||||
source = configSource;
|
||||
onChange = ''
|
||||
${pkgs.procps}/bin/pkill -u $USER -USR2 waybar || true
|
||||
'';
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf (cfg.style != null) {
|
||||
xdg.configFile."waybar/style.css" = {
|
||||
text = cfg.style;
|
||||
xdg.configFile."waybar/style.css" = mkIf (cfg.style != null) {
|
||||
source = if builtins.isPath cfg.style || isStorePath cfg.style then
|
||||
cfg.style
|
||||
else
|
||||
pkgs.writeText "waybar/style.css" cfg.style;
|
||||
onChange = ''
|
||||
${pkgs.procps}/bin/pkill -u $USER -USR2 waybar || true
|
||||
'';
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
(mkIf cfg.systemd.enable {
|
||||
systemd.user.services.waybar = {
|
||||
|
|
|
@ -6,8 +6,6 @@ let
|
|||
|
||||
cfg = config.services.flameshot;
|
||||
|
||||
package = pkgs.flameshot;
|
||||
|
||||
iniFormat = pkgs.formats.ini { };
|
||||
|
||||
iniFile = iniFormat.generate "flameshot.ini" cfg.settings;
|
||||
|
@ -18,6 +16,13 @@ in {
|
|||
options.services.flameshot = {
|
||||
enable = mkEnableOption "Flameshot";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.flameshot;
|
||||
defaultText = literalExpression "pkgs.flameshot";
|
||||
description = "Package providing <command>flameshot</command>.";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = iniFormat.type;
|
||||
default = { };
|
||||
|
@ -41,7 +46,7 @@ in {
|
|||
lib.platforms.linux)
|
||||
];
|
||||
|
||||
home.packages = [ package ];
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile = mkIf (cfg.settings != { }) {
|
||||
"flameshot/flameshot.ini".source = iniFile;
|
||||
|
@ -60,7 +65,7 @@ in {
|
|||
|
||||
Service = {
|
||||
Environment = "PATH=${config.home.profileDirectory}/bin";
|
||||
ExecStart = "${package}/bin/flameshot";
|
||||
ExecStart = "${cfg.package}/bin/flameshot";
|
||||
Restart = "on-abort";
|
||||
|
||||
# Sandboxing.
|
||||
|
|
|
@ -10,6 +10,8 @@ let
|
|||
|
||||
iniFormat = pkgs.formats.ini { };
|
||||
in {
|
||||
meta.maintainers = with maintainers; [ polykernel ];
|
||||
|
||||
options = {
|
||||
services.fnott = {
|
||||
enable = mkEnableOption ''
|
||||
|
|
|
@ -24,7 +24,7 @@ let
|
|||
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.gmailieer}/bin/gmi sync";
|
||||
ExecStart = "${config.programs.lieer.package}/bin/gmi sync";
|
||||
WorkingDirectory = account.maildir.absPath;
|
||||
Environment =
|
||||
"NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/notmuchrc";
|
||||
|
|
|
@ -112,7 +112,9 @@ in {
|
|||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = types.attrsOf types.attrs;
|
||||
type = with types;
|
||||
let ty = oneOf [ bool int float str (listOf ty) (attrsOf ty) ];
|
||||
in attrsOf (attrsOf ty // { description = "attribute sets"; });
|
||||
description = ''
|
||||
Polybar configuration. This takes a nix attrset and converts it to the
|
||||
strange data format that polybar uses.
|
||||
|
|
70
third_party/home-manager/modules/services/window-managers/i3-sway/swaynag.nix
vendored
Normal file
70
third_party/home-manager/modules/services/window-managers/i3-sway/swaynag.nix
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.wayland.windowManager.sway.swaynag;
|
||||
|
||||
iniFormat = pkgs.formats.ini { };
|
||||
|
||||
confFormat = with types;
|
||||
let
|
||||
confAtom = nullOr (oneOf [ bool int float str ]) // {
|
||||
description = "Swaynag config atom (null, bool, int, float, str)";
|
||||
};
|
||||
in attrsOf confAtom;
|
||||
in {
|
||||
meta.maintainers = with maintainers; [ polykernel ];
|
||||
|
||||
options = {
|
||||
wayland.windowManager.sway.swaynag = {
|
||||
enable = mkEnableOption
|
||||
"configuration of swaynag, a lightweight error bar for sway";
|
||||
|
||||
settings = mkOption {
|
||||
type = types.attrsOf confFormat;
|
||||
default = { };
|
||||
description = ''
|
||||
Configuration written to
|
||||
<filename>$XDG_CONFIG_HOME/swaynag/config</filename>.
|
||||
</para><para>
|
||||
See
|
||||
<citerefentry>
|
||||
<refentrytitle>swaynag</refentrytitle>
|
||||
<manvolnum>5</manvolnum>
|
||||
</citerefentry>
|
||||
for a list of avaliable options and an example configuration.
|
||||
Note, configurations declared under <literal><config></literal>
|
||||
will override the default type values of swaynag.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
{
|
||||
"<config>" = {
|
||||
edge = "bottom";
|
||||
font = "Dina 12";
|
||||
};
|
||||
|
||||
green = {
|
||||
edge = "top";
|
||||
background = "00AA00";
|
||||
text = "FFFFFF";
|
||||
button-background = "00CC00";
|
||||
message-padding = 10;
|
||||
};
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
(hm.assertions.assertPlatform "wayland.windowManager.sway.swaynag" pkgs
|
||||
platforms.linux)
|
||||
];
|
||||
|
||||
xdg.configFile."swaynag/config" = mkIf (cfg.settings != { }) {
|
||||
source = iniFormat.generate "swaynag.conf" cfg.settings;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -132,9 +132,9 @@ in {
|
|||
|
||||
# The resulting binary name depends on the arch and os
|
||||
# https://github.com/xmonad/xmonad/blob/56b0f850bc35200ec23f05c079eca8b0a1f90305/src/XMonad/Core.hs#L565-L572
|
||||
mv "$XMONAD_DATA_DIR/xmonad-${pkgs.hostPlatform.system}" $out/bin/
|
||||
mv "$XMONAD_DATA_DIR/xmonad-${pkgs.stdenv.hostPlatform.system}" $out/bin/
|
||||
''
|
||||
}/bin/xmonad-${pkgs.hostPlatform.system}";
|
||||
}/bin/xmonad-${pkgs.stdenv.hostPlatform.system}";
|
||||
|
||||
in mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
|
@ -157,7 +157,7 @@ in {
|
|||
(mkIf (cfg.config != null) {
|
||||
xsession.windowManager.command = xmonadBin;
|
||||
home.file.".xmonad/xmonad.hs".source = cfg.config;
|
||||
home.file.".xmonad/xmonad-${pkgs.hostPlatform.system}" = {
|
||||
home.file.".xmonad/xmonad-${pkgs.stdenv.hostPlatform.system}" = {
|
||||
source = xmonadBin;
|
||||
onChange = ''
|
||||
# Attempt to restart xmonad if X is running.
|
||||
|
|
3
third_party/home-manager/modules/systemd.nix
vendored
3
third_party/home-manager/modules/systemd.nix
vendored
|
@ -258,7 +258,8 @@ in {
|
|||
|
||||
# If we run under a Linux system we assume that systemd is
|
||||
# available, in particular we assume that systemctl is in PATH.
|
||||
(mkIf pkgs.stdenv.isLinux {
|
||||
# Do not install any user services if username is root.
|
||||
(mkIf (pkgs.stdenv.isLinux && config.home.username != "root") {
|
||||
xdg.configFile = mkMerge [
|
||||
(lib.listToAttrs ((buildServices "service" cfg.services)
|
||||
++ (buildServices "slices" cfg.slices)
|
||||
|
|
|
@ -19,6 +19,8 @@ let
|
|||
writableDefaults = filterAttrs (domain: attrs: attrs != { }) nonNullDefaults;
|
||||
activationCmds = mapAttrsToList toActivationCmd writableDefaults;
|
||||
in {
|
||||
meta.maintainers = [ maintainers.midchildan ];
|
||||
|
||||
imports = [ ./fonts.nix ./keybindings.nix ./linkapps.nix ./search.nix ];
|
||||
|
||||
options.targets.darwin.defaults = mkOption {
|
||||
|
@ -48,6 +50,24 @@ in {
|
|||
platforms.darwin)
|
||||
];
|
||||
|
||||
warnings = let
|
||||
batteryPercentage =
|
||||
attrByPath [ "com.apple.menuextra.battery" "ShowPercent" ] null
|
||||
cfg.defaults;
|
||||
webkitDevExtras = attrByPath [
|
||||
"com.apple.Safari"
|
||||
"com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled"
|
||||
] null cfg.defaults;
|
||||
in optional (batteryPercentage != null) ''
|
||||
The option 'com.apple.menuextra.battery.ShowPercent' no longer works on
|
||||
macOS 11 and later. Instead, open System Preferences, go to "Dock &
|
||||
Menu Bar", select "Battery", and toggle the checkbox labeled "Show
|
||||
Percentage."
|
||||
'' ++ optional (webkitDevExtras != null) ''
|
||||
The option 'com.apple.Safari.com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled'
|
||||
is no longer present in recent versions of Safari.
|
||||
'';
|
||||
|
||||
home.activation.setDarwinDefaults = hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
$VERBOSE_ECHO "Configuring macOS user defaults"
|
||||
${concatStringsSep "\n" activationCmds}
|
||||
|
|
|
@ -12,7 +12,7 @@ let
|
|||
fonts = "${fontsEnv}/share/fonts";
|
||||
in {
|
||||
# macOS won't recognize symlinked fonts
|
||||
config = mkIf pkgs.hostPlatform.isDarwin {
|
||||
config = mkIf pkgs.stdenv.hostPlatform.isDarwin {
|
||||
home.activation.copyFonts = hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
copyFonts() {
|
||||
rm -rf ${homeDir}/Library/Fonts/HomeManager || :
|
||||
|
|
|
@ -98,7 +98,13 @@ in {
|
|||
"com.apple.menuextra.battery".ShowPercent = mkNullableOption {
|
||||
type = types.enum [ "YES" "NO" ];
|
||||
example = "NO";
|
||||
description = "Whether to show battery percentage in the menu bar.";
|
||||
description = ''
|
||||
This option no longer works on macOS 11 and later. Instead, open System
|
||||
Preferences, go to "Dock & Menu Bar", select "Battery", and toggle
|
||||
the checkbox labeled "Show Percentage."
|
||||
|
||||
Whether to show battery percentage in the menu bar.
|
||||
'';
|
||||
};
|
||||
|
||||
"com.apple.Safari" = {
|
||||
|
@ -125,20 +131,35 @@ in {
|
|||
</warning>
|
||||
'';
|
||||
};
|
||||
"com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" =
|
||||
mkNullableOption {
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Configures the web inspector.
|
||||
"WebKitPreferences.developerExtrasEnabled" = mkNullableOption {
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Configures the web inspector.
|
||||
|
||||
<warning>
|
||||
<para>
|
||||
Instead of setting this option directly, set
|
||||
<option>IncludeDevelopMenu</option> instead.
|
||||
</para>
|
||||
</warning>
|
||||
'';
|
||||
};
|
||||
<warning>
|
||||
<para>
|
||||
Instead of setting this option directly, set
|
||||
<option>IncludeDevelopMenu</option> instead.
|
||||
</para>
|
||||
</warning>
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
"com.apple.Safari.SandboxBroker" = {
|
||||
ShowDevelopMenu = mkNullableOption {
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Show the "Develop" menu in Safari's menubar.
|
||||
|
||||
<warning>
|
||||
<para>
|
||||
Instead of setting this option directly, set
|
||||
<option>"com.apple.Safari".IncludeDevelopMenu</option> instead.
|
||||
</para>
|
||||
</warning>
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
"com.googlecode.iterm2" = {
|
||||
|
@ -182,8 +203,11 @@ in {
|
|||
config = {
|
||||
"com.apple.Safari" = mkIf (safari.IncludeDevelopMenu != null) {
|
||||
WebKitDeveloperExtrasEnabledPreferenceKey = safari.IncludeDevelopMenu;
|
||||
"com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" =
|
||||
safari.IncludeDevelopMenu;
|
||||
"WebKitPreferences.developerExtrasEnabled" = safari.IncludeDevelopMenu;
|
||||
};
|
||||
"com.apple.Safari.SandboxBroker" =
|
||||
mkIf (safari.IncludeDevelopMenu != null) {
|
||||
ShowDevelopMenu = safari.IncludeDevelopMenu;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -63,8 +63,10 @@ in
|
|||
extraSpecialArgs = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
example = literalExpression "{ inherit emacs-overlay; }";
|
||||
description = ''
|
||||
Extra <literal>specialArgs</literal> passed to Home Manager.
|
||||
Extra <literal>specialArgs</literal> passed to Home Manager. This
|
||||
option can be used to pass additional arguments to all modules.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
4
third_party/home-manager/nixos/default.nix
vendored
4
third_party/home-manager/nixos/default.nix
vendored
|
@ -74,8 +74,10 @@ in {
|
|||
extraSpecialArgs = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
example = literalExpression "{ inherit emacs-overlay; }";
|
||||
description = ''
|
||||
Extra <literal>specialArgs</literal> passed to Home Manager.
|
||||
Extra <literal>specialArgs</literal> passed to Home Manager. This
|
||||
option can be used to pass additional arguments to all modules.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
2
third_party/home-manager/tests/default.nix
vendored
2
third_party/home-manager/tests/default.nix
vendored
|
@ -66,6 +66,7 @@ import nmt {
|
|||
./modules/programs/irssi
|
||||
./modules/programs/kakoune
|
||||
./modules/programs/kitty
|
||||
./modules/programs/less
|
||||
./modules/programs/lf
|
||||
./modules/programs/lieer
|
||||
./modules/programs/man
|
||||
|
@ -87,6 +88,7 @@ import nmt {
|
|||
./modules/programs/sm64ex
|
||||
./modules/programs/ssh
|
||||
./modules/programs/starship
|
||||
./modules/programs/taskwarrior
|
||||
./modules/programs/texlive
|
||||
./modules/programs/tmux
|
||||
./modules/programs/topgrade
|
||||
|
|
35
third_party/home-manager/tests/modules/misc/xdg/default-locations.nix
vendored
Normal file
35
third_party/home-manager/tests/modules/misc/xdg/default-locations.nix
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
# Test fallback behavior for stateVersion >= 20.09, which is pure.
|
||||
xdg.enable = lib.mkForce false;
|
||||
home.stateVersion = "20.09";
|
||||
|
||||
xdg.configFile.test.text = "config";
|
||||
xdg.dataFile.test.text = "data";
|
||||
home.file."${config.xdg.cacheHome}/test".text = "cache";
|
||||
home.file."${config.xdg.stateHome}/test".text = "state";
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/test
|
||||
assertFileExists home-files/.local/share/test
|
||||
assertFileExists home-files/.cache/test
|
||||
assertFileExists home-files/.local/state/test
|
||||
assertFileContent \
|
||||
home-files/.config/test \
|
||||
${builtins.toFile "test" "config"}
|
||||
assertFileContent \
|
||||
home-files/.local/share/test \
|
||||
${builtins.toFile "test" "data"}
|
||||
assertFileContent \
|
||||
home-files/.cache/test \
|
||||
${builtins.toFile "test" "cache"}
|
||||
assertFileContent \
|
||||
home-files/.local/state/test \
|
||||
${builtins.toFile "test" "state"}
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -3,4 +3,5 @@
|
|||
xdg-system-dirs = ./system-dirs.nix;
|
||||
xdg-desktop-entries = ./desktop-entries.nix;
|
||||
xdg-file-gen = ./file-gen.nix;
|
||||
xdg-default-locations = ./default-locations.nix;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ with lib;
|
|||
meta.description = "I pretend to be Firefox";
|
||||
passthru.gtk3 = null;
|
||||
} ''
|
||||
mkdir -p "$out/bin"
|
||||
mkdir -p "$out"/{bin,lib}
|
||||
touch "$out/bin/firefox"
|
||||
chmod 755 "$out/bin/firefox"
|
||||
'';
|
||||
|
|
|
@ -32,10 +32,9 @@ with lib;
|
|||
firefox-unwrapped = pkgs.runCommand "firefox-0" {
|
||||
meta.description = "I pretend to be Firefox";
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
passthru.gtk3 = null;
|
||||
} ''
|
||||
mkdir -p "$out/bin"
|
||||
mkdir -p "$out"/{bin,lib}
|
||||
touch "$out/bin/firefox"
|
||||
chmod 755 "$out/bin/firefox"
|
||||
'';
|
||||
|
|
|
@ -13,10 +13,9 @@ with lib;
|
|||
firefox-unwrapped = pkgs.runCommand "firefox-0" {
|
||||
meta.description = "I pretend to be Firefox";
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
passthru.gtk3 = null;
|
||||
} ''
|
||||
mkdir -p "$out/bin"
|
||||
mkdir -p "$out"/{bin,lib}
|
||||
touch "$out/bin/firefox"
|
||||
chmod 755 "$out/bin/firefox"
|
||||
'';
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
{ gpg-override-defaults = ./override-defaults.nix; }
|
||||
{
|
||||
gpg-immutable-keyfiles = ./immutable-keyfiles.nix;
|
||||
gpg-mutable-keyfiles = ./mutable-keyfiles.nix;
|
||||
gpg-override-defaults = ./override-defaults.nix;
|
||||
}
|
||||
|
|
52
third_party/home-manager/tests/modules/programs/gpg/immutable-keyfiles.nix
vendored
Normal file
52
third_party/home-manager/tests/modules/programs/gpg/immutable-keyfiles.nix
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.gpg = {
|
||||
enable = true;
|
||||
|
||||
mutableKeys = false;
|
||||
mutableTrust = false;
|
||||
|
||||
publicKeys = [
|
||||
{
|
||||
source = pkgs.fetchurl {
|
||||
url =
|
||||
"https://keybase.io/rycee/pgp_keys.asc?fingerprint=36cacf52d098cc0e78fb0cb13573356c25c424d4";
|
||||
sha256 = "082mjy6llvrdry6i9r5gx97nw9d89blnam7bghza4ynsjk1mmx6c";
|
||||
};
|
||||
trust = 1;
|
||||
}
|
||||
{
|
||||
source = pkgs.fetchurl {
|
||||
url = "https://www.rsync.net/resources/pubkey.txt";
|
||||
sha256 = "16nzqfb1kvsxjkq919hxsawx6ydvip3md3qyhdmw54qx6drnxckl";
|
||||
};
|
||||
trust = 2;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileNotRegex activate "^export GNUPGHOME='/home/hm-user/.gnupg'$"
|
||||
|
||||
assertFileRegex activate \
|
||||
'^install -m 0700 /nix/store/[0-9a-z]*-gpg-pubring/trustdb.gpg "/home/hm-user/.gnupg/trustdb.gpg"$'
|
||||
|
||||
# Setup GPGHOME
|
||||
export GNUPGHOME=$(mktemp -d)
|
||||
cp -r $TESTED/home-files/.gnupg/* $GNUPGHOME
|
||||
TRUSTDB=$(grep -o '/nix/store/[0-9a-z]*-gpg-pubring/trustdb.gpg' $TESTED/activate)
|
||||
install -m 0700 $TRUSTDB $GNUPGHOME/trustdb.gpg
|
||||
|
||||
# Export Trust
|
||||
export WORKDIR=$(mktemp -d)
|
||||
${pkgs.gnupg}/bin/gpg -q --export-ownertrust > $WORKDIR/gpgtrust.txt
|
||||
|
||||
# Check Trust
|
||||
assertFileRegex $WORKDIR/gpgtrust.txt \
|
||||
'^36CACF52D098CC0E78FB0CB13573356C25C424D4:2:$'
|
||||
|
||||
assertFileRegex $WORKDIR/gpgtrust.txt \
|
||||
'^BB847B5A69EF343CEF511B29073C282D7D6F806C:3:$'
|
||||
'';
|
||||
}
|
30
third_party/home-manager/tests/modules/programs/gpg/mutable-keyfiles.nix
vendored
Normal file
30
third_party/home-manager/tests/modules/programs/gpg/mutable-keyfiles.nix
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.gpg = {
|
||||
enable = true;
|
||||
|
||||
publicKeys = [
|
||||
{
|
||||
source = builtins.toFile "key1" "key1";
|
||||
trust = 1;
|
||||
}
|
||||
{ source = builtins.toFile "key2" "key2"; }
|
||||
];
|
||||
};
|
||||
|
||||
test.stubs.gnupg = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContains activate "export GNUPGHOME='/home/hm-user/.gnupg'"
|
||||
|
||||
assertFileContains activate "unset GNUPGHOME QUIET_ARG keyId importTrust"
|
||||
|
||||
assertFileRegex activate \
|
||||
'^\$DRY_RUN_CMD @gnupg@/bin/gpg \$QUIET_ARG --import /nix/store/[0-9a-z]*-key1$'
|
||||
assertFileRegex activate \
|
||||
'^\$DRY_RUN_CMD importTrust "/nix/store/[0-9a-z]*-key1" 1$'
|
||||
assertFileRegex activate \
|
||||
'^\$DRY_RUN_CMD @gnupg@/bin/gpg \$QUIET_ARG --import /nix/store/[0-9a-z]*-key2$'
|
||||
'';
|
||||
}
|
|
@ -23,6 +23,8 @@ with lib;
|
|||
nmt.script = ''
|
||||
assertFileExists home-files/bar/foopg/gpg.conf
|
||||
assertFileContent home-files/bar/foopg/gpg.conf ${./override-defaults-expected.conf}
|
||||
|
||||
assertFileNotRegex activate "^unset GNUPGHOME keyId importTrust$"
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
{
|
||||
kakoune-no-plugins = ./no-plugins.nix;
|
||||
# Temporarily disabled until https://github.com/NixOS/nixpkgs/pull/110196
|
||||
# reaches the unstable channel.
|
||||
# kakoune-use-plugins = ./use-plugins.nix;
|
||||
kakoune-use-plugins = ./use-plugins.nix;
|
||||
kakoune-whitespace-highlighter = ./whitespace-highlighter.nix;
|
||||
kakoune-whitespace-highlighter-corner-cases =
|
||||
./whitespace-highlighter-corner-cases.nix;
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.kakoune = { enable = true; };
|
||||
imports = [ ./stubs.nix ];
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-path/share/kak/autoload/plugins
|
||||
'';
|
||||
};
|
||||
programs.kakoune = { enable = true; };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-path/share/kak/autoload/plugins
|
||||
'';
|
||||
}
|
||||
|
|
12
third_party/home-manager/tests/modules/programs/kakoune/stubs.nix
vendored
Normal file
12
third_party/home-manager/tests/modules/programs/kakoune/stubs.nix
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
test.stubs.kakoune-unwrapped = {
|
||||
name = "dummy-kakoune";
|
||||
version = "1";
|
||||
outPath = null;
|
||||
buildScript = ''
|
||||
mkdir -p $out/bin $out/share/kak/doc
|
||||
touch $out/bin/kak
|
||||
chmod +x $out/bin/kak
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -3,14 +3,14 @@
|
|||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.kakoune = {
|
||||
enable = true;
|
||||
plugins = [ pkgs.kakounePlugins.kak-prelude ];
|
||||
};
|
||||
imports = [ ./stubs.nix ];
|
||||
|
||||
nmt.script = ''
|
||||
assertDirectoryNotEmpty home-path/share/kak/autoload/plugins
|
||||
'';
|
||||
programs.kakoune = {
|
||||
enable = true;
|
||||
plugins = [ pkgs.kakounePlugins.prelude-kak ];
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertDirectoryNotEmpty home-path/share/kak/autoload/plugins
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -3,23 +3,23 @@
|
|||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.kakoune = {
|
||||
enable = true;
|
||||
config.showWhitespace = {
|
||||
enable = true;
|
||||
lineFeed = ''"'';
|
||||
space = " ";
|
||||
nonBreakingSpace = "' '"; # backwards compat
|
||||
tab = "'";
|
||||
# tabStop = <default>
|
||||
};
|
||||
};
|
||||
imports = [ ./stubs.nix ];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/kak/kakrc
|
||||
assertFileContains home-files/.config/kak/kakrc \
|
||||
"add-highlighter global/ show-whitespaces -tab \"'\" -spc ' ' -nbsp ' ' -lf '\"'"
|
||||
'';
|
||||
programs.kakoune = {
|
||||
enable = true;
|
||||
config.showWhitespace = {
|
||||
enable = true;
|
||||
lineFeed = ''"'';
|
||||
space = " ";
|
||||
nonBreakingSpace = "' '"; # backwards compat
|
||||
tab = "'";
|
||||
# tabStop = <default>
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/kak/kakrc
|
||||
assertFileContains home-files/.config/kak/kakrc \
|
||||
"add-highlighter global/ show-whitespaces -tab \"'\" -spc ' ' -nbsp ' ' -lf '\"'"
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -3,23 +3,23 @@
|
|||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.kakoune = {
|
||||
enable = true;
|
||||
config.showWhitespace = {
|
||||
enable = true;
|
||||
lineFeed = "1";
|
||||
space = "2";
|
||||
nonBreakingSpace = "3";
|
||||
tab = "4";
|
||||
tabStop = "5";
|
||||
};
|
||||
};
|
||||
imports = [ ./stubs.nix ];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/kak/kakrc
|
||||
assertFileContains home-files/.config/kak/kakrc \
|
||||
"add-highlighter global/ show-whitespaces -tab '4' -tabpad '5' -spc '2' -nbsp '3' -lf '1'"
|
||||
'';
|
||||
programs.kakoune = {
|
||||
enable = true;
|
||||
config.showWhitespace = {
|
||||
enable = true;
|
||||
lineFeed = "1";
|
||||
space = "2";
|
||||
nonBreakingSpace = "3";
|
||||
tab = "4";
|
||||
tabStop = "5";
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/kak/kakrc
|
||||
assertFileContains home-files/.config/kak/kakrc \
|
||||
"add-highlighter global/ show-whitespaces -tab '4' -tabpad '5' -spc '2' -nbsp '3' -lf '1'"
|
||||
'';
|
||||
}
|
||||
|
|
1
third_party/home-manager/tests/modules/programs/less/default.nix
vendored
Normal file
1
third_party/home-manager/tests/modules/programs/less/default.nix
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{ less-with-custom-keys = ./less-with-custom-keys.nix; }
|
26
third_party/home-manager/tests/modules/programs/less/less-with-custom-keys.nix
vendored
Normal file
26
third_party/home-manager/tests/modules/programs/less/less-with-custom-keys.nix
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
programs.less = {
|
||||
enable = true;
|
||||
|
||||
keys = ''
|
||||
s back-line
|
||||
t forw-line
|
||||
'';
|
||||
};
|
||||
|
||||
test.stubs.less = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.lesskey
|
||||
assertFileContent home-files/.lesskey ${
|
||||
builtins.toFile "less.expected" ''
|
||||
s back-line
|
||||
t forw-line
|
||||
''
|
||||
}
|
||||
'';
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
mpv-example-settings = ./mpv-example-settings.nix;
|
||||
mpv-invalid-settings = ./mpv-invalid-settings.nix;
|
||||
# Temporarily commented until fixed for recent changes in Nixpkgs.
|
||||
# mpv-example-settings = ./mpv-example-settings.nix;
|
||||
# mpv-invalid-settings = ./mpv-invalid-settings.nix;
|
||||
}
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
{ pet-snippets = ./snippets.nix; }
|
||||
{
|
||||
pet-snippets = ./snippets.nix;
|
||||
pet-settings_21_05 = ./settings_21_05.nix;
|
||||
pet-settings_21_11 = ./settings_21_11.nix;
|
||||
}
|
||||
|
|
26
third_party/home-manager/tests/modules/programs/pet/settings_21_05.nix
vendored
Normal file
26
third_party/home-manager/tests/modules/programs/pet/settings_21_05.nix
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
home.stateVersion = "21.05";
|
||||
programs.pet = {
|
||||
enable = true;
|
||||
selectcmdPackage = config.lib.test.mkStubPackage { };
|
||||
settings.editor = "nvim";
|
||||
};
|
||||
|
||||
test.stubs.pet = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent home-files/.config/pet/config.toml \
|
||||
${
|
||||
builtins.toFile "pet-settings.toml" ''
|
||||
[General]
|
||||
editor = "nvim"
|
||||
selectcmd = "fzf"
|
||||
snippetfile = "/home/hm-user/.config/pet/snippet.toml"
|
||||
''
|
||||
}
|
||||
'';
|
||||
}
|
42
third_party/home-manager/tests/modules/programs/pet/settings_21_11.nix
vendored
Normal file
42
third_party/home-manager/tests/modules/programs/pet/settings_21_11.nix
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
home.stateVersion = "21.11";
|
||||
programs.pet = {
|
||||
enable = true;
|
||||
selectcmdPackage = config.lib.test.mkStubPackage { };
|
||||
settings = {
|
||||
General = {
|
||||
backend = "Gitlab";
|
||||
editor = "nvim";
|
||||
};
|
||||
Gitlab = {
|
||||
access_token = "1234";
|
||||
file_name = "pet-snippets.toml";
|
||||
visibility = "public";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
test.stubs.pet = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent home-files/.config/pet/config.toml \
|
||||
${
|
||||
builtins.toFile "pet-settings.toml" ''
|
||||
[General]
|
||||
backend = "Gitlab"
|
||||
editor = "nvim"
|
||||
selectcmd = "fzf"
|
||||
snippetfile = "/home/hm-user/.config/pet/snippet.toml"
|
||||
|
||||
[Gitlab]
|
||||
access_token = "1234"
|
||||
file_name = "pet-snippets.toml"
|
||||
visibility = "public"
|
||||
''
|
||||
}
|
||||
'';
|
||||
}
|
|
@ -24,7 +24,10 @@ with lib;
|
|||
assertFileExists home-files/.bashrc
|
||||
assertFileContains \
|
||||
home-files/.bashrc \
|
||||
'/bin/powerline-go -error $old_exit_status -modules nix-shell -newline -path-aliases \~/project/foo=prj-foo -ignore-repos /home/me/project1,/home/me/project2'
|
||||
'PS1='
|
||||
assertFileContains \
|
||||
home-files/.bashrc \
|
||||
'/bin/powerline-go -error $old_exit_status -shell bash -modules nix-shell -newline -path-aliases \~/project/foo=prj-foo -ignore-repos /home/me/project1,/home/me/project2'
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
34
third_party/home-manager/tests/modules/programs/powerline-go/bashmodulesright.nix
vendored
Normal file
34
third_party/home-manager/tests/modules/programs/powerline-go/bashmodulesright.nix
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs = {
|
||||
bash.enable = true;
|
||||
|
||||
powerline-go = {
|
||||
enable = true;
|
||||
newline = true;
|
||||
modules = [ "nix-shell" ];
|
||||
modulesRight = [ "git" ];
|
||||
pathAliases = { "\\~/project/foo" = "prj-foo"; };
|
||||
settings = {
|
||||
ignore-repos = [ "/home/me/project1" "/home/me/project2" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
test.stubs.powerline-go = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.bashrc
|
||||
assertFileContains \
|
||||
home-files/.bashrc \
|
||||
'eval'
|
||||
assertFileContains \
|
||||
home-files/.bashrc \
|
||||
'/bin/powerline-go -error $old_exit_status -shell bash -eval -modules nix-shell -modules-right git -newline -path-aliases \~/project/foo=prj-foo -ignore-repos /home/me/project1,/home/me/project2'
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -2,4 +2,6 @@
|
|||
powerline-go-bash = ./bash.nix;
|
||||
powerline-go-zsh = ./zsh.nix;
|
||||
powerline-go-fish = ./fish.nix;
|
||||
powerline-go-bashmodulesright = ./bashmodulesright.nix;
|
||||
powerline-go-zshmodulesright = ./zshmodulesright.nix;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,9 @@ with lib;
|
|||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.zshrc
|
||||
assertFileContains \
|
||||
home-files/.zshrc \
|
||||
'PS1='
|
||||
assertFileContains \
|
||||
home-files/.zshrc \
|
||||
'/bin/powerline-go -error $? -shell zsh -modules nix-shell -newline -path-aliases \~/project/foo=prj-foo -ignore-repos /home/me/project1,/home/me/project2'
|
||||
|
|
37
third_party/home-manager/tests/modules/programs/powerline-go/zshmodulesright.nix
vendored
Normal file
37
third_party/home-manager/tests/modules/programs/powerline-go/zshmodulesright.nix
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs = {
|
||||
zsh.enable = true;
|
||||
|
||||
powerline-go = {
|
||||
enable = true;
|
||||
newline = true;
|
||||
modules = [ "nix-shell" ];
|
||||
modulesRight = [ "git" ];
|
||||
pathAliases = { "\\~/project/foo" = "prj-foo"; };
|
||||
settings = {
|
||||
ignore-repos = [ "/home/me/project1" "/home/me/project2" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
test.stubs = {
|
||||
powerline-go = { };
|
||||
zsh = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.zshrc
|
||||
assertFileContains \
|
||||
home-files/.zshrc \
|
||||
'eval'
|
||||
assertFileContains \
|
||||
home-files/.zshrc \
|
||||
'/bin/powerline-go -error $? -shell zsh -eval -modules nix-shell -modules-right git -newline -path-aliases \~/project/foo=prj-foo -ignore-repos /home/me/project1,/home/me/project2'
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
configuration {
|
||||
location: 0;
|
||||
theme: "custom";
|
||||
xoffset: 0;
|
||||
yoffset: 0;
|
||||
}
|
||||
@theme "custom"
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
|
||||
|
||||
|
||||
Host *
|
||||
ForwardAgent no
|
||||
Compression no
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
ssh-defaults = ./default-config.nix;
|
||||
ssh-includes = ./includes.nix;
|
||||
ssh-match-blocks = ./match-blocks-attrs.nix;
|
||||
|
||||
ssh-forwards-dynamic-valid-bind-no-asserts =
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
|
||||
|
||||
Host dynamicBindAddressWithPort
|
||||
DynamicForward [127.0.0.1]:3000
|
||||
|
||||
Host dynamicBindPathNoPort
|
||||
DynamicForward /run/user/1000/gnupg/S.gpg-agent.extra
|
||||
|
||||
|
|
15
third_party/home-manager/tests/modules/programs/ssh/includes.nix
vendored
Normal file
15
third_party/home-manager/tests/modules/programs/ssh/includes.nix
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
includes = [ "config.d/*" "other/dir" ];
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.ssh/config
|
||||
assertFileContains home-files/.ssh/config "Include config.d/* other/dir"
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -1,13 +1,9 @@
|
|||
|
||||
|
||||
Host * !github.com
|
||||
Port 516
|
||||
IdentityFile file1
|
||||
IdentityFile file2
|
||||
|
||||
Host abc
|
||||
ProxyJump jump-host
|
||||
|
||||
Host xyz
|
||||
ServerAliveInterval 60
|
||||
ServerAliveCountMax 10
|
||||
|
@ -16,7 +12,6 @@ Host xyz
|
|||
RemoteForward [localhost]:8081 [10.0.0.2]:80
|
||||
RemoteForward /run/user/1000/gnupg/S.gpg-agent.extra /run/user/1000/gnupg/S.gpg-agent
|
||||
DynamicForward [localhost]:2839
|
||||
|
||||
Host ordered
|
||||
Port 1
|
||||
|
||||
|
|
1
third_party/home-manager/tests/modules/programs/taskwarrior/default.nix
vendored
Normal file
1
third_party/home-manager/tests/modules/programs/taskwarrior/default.nix
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{ taskwarrior = ./taskwarrior.nix; }
|
40
third_party/home-manager/tests/modules/programs/taskwarrior/taskwarrior.nix
vendored
Normal file
40
third_party/home-manager/tests/modules/programs/taskwarrior/taskwarrior.nix
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.taskwarrior = {
|
||||
enable = true;
|
||||
colorTheme = "dark-violets-256";
|
||||
dataLocation = "/some/data/location";
|
||||
config = {
|
||||
urgency.user.tag.next.coefficient = 42.42;
|
||||
urgency.blocked.coefficient = -42;
|
||||
};
|
||||
extraConfig = ''
|
||||
include /my/stuff
|
||||
urgency.user.tag.test.coefficient=-42.42
|
||||
'';
|
||||
};
|
||||
|
||||
test.stubs.taskwarrior = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/task/taskrc
|
||||
assertFileContent home-files/.config/task/taskrc ${
|
||||
pkgs.writeText "taskwarrior.expected" ''
|
||||
data.location=/some/data/location
|
||||
include dark-violets-256.theme
|
||||
|
||||
urgency.blocked.coefficient=-42
|
||||
urgency.user.tag.next.coefficient=42.420000
|
||||
|
||||
include /my/stuff
|
||||
urgency.user.tag.test.coefficient=-42.42
|
||||
|
||||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -3,5 +3,5 @@
|
|||
./systemd-with-graphical-session-target.nix;
|
||||
waybar-styling = ./styling.nix;
|
||||
waybar-settings-complex = ./settings-complex.nix;
|
||||
waybar-warnings = ./warnings-tests.nix;
|
||||
waybar-deprecated-modules-option = ./deprecated-modules-option.nix;
|
||||
}
|
||||
|
|
43
third_party/home-manager/tests/modules/programs/waybar/deprecated-modules-option.nix
vendored
Normal file
43
third_party/home-manager/tests/modules/programs/waybar/deprecated-modules-option.nix
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
home.stateVersion = "22.05";
|
||||
|
||||
programs.waybar = {
|
||||
package = config.lib.test.mkStubPackage { outPath = "@waybar@"; };
|
||||
enable = true;
|
||||
settings = [{
|
||||
modules-center = [ "test" ];
|
||||
modules = { "test" = { }; };
|
||||
}];
|
||||
};
|
||||
|
||||
test.asserts.assertions.expected = [''
|
||||
The `programs.waybar.settings.[].modules` option has been removed.
|
||||
It is now possible to declare modules in the configuration without nesting them under the `modules` option.
|
||||
''];
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/waybar/style.css
|
||||
assertFileContent \
|
||||
home-files/.config/waybar/config \
|
||||
${
|
||||
builtins.toFile "waybar-deprecated-modules-option.json" ''
|
||||
[
|
||||
{
|
||||
"modules-center": [
|
||||
"test"
|
||||
],
|
||||
"modules-left": [],
|
||||
"modules-right": [],
|
||||
"test": {}
|
||||
}
|
||||
]
|
||||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -4,6 +4,8 @@ with lib;
|
|||
|
||||
{
|
||||
config = {
|
||||
home.stateVersion = "21.11";
|
||||
|
||||
programs.waybar = {
|
||||
package = config.lib.test.mkStubPackage { outPath = "@waybar@"; };
|
||||
enable = true;
|
||||
|
|
|
@ -4,6 +4,8 @@ with lib;
|
|||
|
||||
{
|
||||
config = {
|
||||
home.stateVersion = "21.11";
|
||||
|
||||
programs.waybar = {
|
||||
package = config.lib.test.mkStubPackage { outPath = "@waybar@"; };
|
||||
enable = true;
|
||||
|
|
|
@ -4,6 +4,8 @@ with lib;
|
|||
|
||||
{
|
||||
config = {
|
||||
home.stateVersion = "21.11";
|
||||
|
||||
programs.waybar = {
|
||||
package = config.lib.test.mkStubPackage { outPath = "@waybar@"; };
|
||||
enable = true;
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.waybar = {
|
||||
package = config.lib.test.mkStubPackage { outPath = "@waybar@"; };
|
||||
enable = true;
|
||||
settings = [{
|
||||
modules-left = [ "custom/my-module" ];
|
||||
modules-center =
|
||||
[ "this_module_is_not_a_valid_default_module_nor_custom_module" ];
|
||||
modules-right = [
|
||||
"battery#bat1" # CSS identifier is allowed
|
||||
"custom/this_custom_module_doesn't_have_a_definition_in_modules"
|
||||
];
|
||||
|
||||
modules = {
|
||||
"custom/this_module_is_not_referenced" = { };
|
||||
"battery#bat1" = { };
|
||||
"custom/my-module" = { };
|
||||
};
|
||||
}];
|
||||
};
|
||||
|
||||
test.asserts.warnings.expected = [
|
||||
"The module 'this_module_is_not_a_valid_default_module_nor_custom_module' defined in 'programs.waybar.settings.[].modules-center' is neither a default module or a custom module declared in 'programs.waybar.settings.[].modules'"
|
||||
|
||||
"The module 'custom/this_custom_module_doesn't_have_a_definition_in_modules' defined in 'programs.waybar.settings.[].modules-right' is neither a default module or a custom module declared in 'programs.waybar.settings.[].modules'"
|
||||
|
||||
"The module 'custom/this_module_is_not_referenced' defined in 'programs.waybar.settings.[].modules' is not referenced in either `modules-left`, `modules-center` or `modules-right` of Waybar's options"
|
||||
];
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/waybar/style.css
|
||||
assertFileContent \
|
||||
home-files/.config/waybar/config \
|
||||
${
|
||||
pkgs.writeText "expected-json" ''
|
||||
[
|
||||
{
|
||||
"battery#bat1": {},
|
||||
"custom/my-module": {},
|
||||
"custom/this_module_is_not_referenced": {},
|
||||
"modules-center": [
|
||||
"this_module_is_not_a_valid_default_module_nor_custom_module"
|
||||
],
|
||||
"modules-left": [
|
||||
"custom/my-module"
|
||||
],
|
||||
"modules-right": [
|
||||
"battery#bat1",
|
||||
"custom/this_custom_module_doesn't_have_a_definition_in_modules"
|
||||
]
|
||||
}
|
||||
]
|
||||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -10,4 +10,6 @@
|
|||
sway-post-2003 = ./sway-post-2003.nix;
|
||||
sway-workspace-default = ./sway-workspace-default.nix;
|
||||
sway-workspace-output = ./sway-workspace-output.nix;
|
||||
swaynag-example-settings = ./swaynag-example-settings.nix;
|
||||
swaynag-empty-settings = ./swaynag-empty-settings.nix;
|
||||
}
|
||||
|
|
15
third_party/home-manager/tests/modules/services/window-managers/sway/swaynag-empty-settings.nix
vendored
Normal file
15
third_party/home-manager/tests/modules/services/window-managers/sway/swaynag-empty-settings.nix
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
wayland.windowManager.sway.swaynag = {
|
||||
enable = true;
|
||||
|
||||
settings = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/swaynag
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
[<config>]
|
||||
edge=bottom
|
||||
font=Dina 12
|
||||
|
||||
[green]
|
||||
background=00AA00
|
||||
button-background=00CC00
|
||||
edge=top
|
||||
message-padding=10
|
||||
text=FFFFFF
|
|
@ -0,0 +1,30 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
wayland.windowManager.sway.swaynag = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
"<config>" = {
|
||||
edge = "bottom";
|
||||
font = "Dina 12";
|
||||
};
|
||||
|
||||
green = {
|
||||
edge = "top";
|
||||
background = "00AA00";
|
||||
text = "FFFFFF";
|
||||
button-background = "00CC00";
|
||||
message-padding = 10;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/swaynag/config \
|
||||
${./swaynag-example-settings-expected.conf}
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
systemd-services = ./services.nix;
|
||||
systemd-services-disabled-for-root = ./services-disabled-for-root.nix;
|
||||
systemd-session-variables = ./session-variables.nix;
|
||||
systemd-timers = ./timers.nix;
|
||||
}
|
||||
|
|
23
third_party/home-manager/tests/modules/systemd/services-disabled-for-root.nix
vendored
Normal file
23
third_party/home-manager/tests/modules/systemd/services-disabled-for-root.nix
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
home.username = mkForce "root";
|
||||
|
||||
systemd.user.services."test-service@" = {
|
||||
Unit = { Description = "A basic test service"; };
|
||||
|
||||
Service = {
|
||||
Environment = [ "VAR1=1" "VAR2=2" ];
|
||||
ExecStart = ''/some/exec/start/command --with-arguments "%i"'';
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
serviceFile=home-files/.config/systemd/user/test-service@.service
|
||||
assertPathNotExists $serviceFile
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue