Merge commit '70824bb5c790b820b189f62f643f795b1d2ade2e'

home-manager merge on 2022-06-08
main
Katharina Fey 2 years ago
commit ea24089e12
Signed by: kookie
GPG Key ID: 90734A9E619C8A6C
  1. 12
      infra/libkookie/home-manager/.github/CODEOWNERS
  2. 1
      infra/libkookie/home-manager/.gitignore
  3. 2
      infra/libkookie/home-manager/LICENSE
  4. 25
      infra/libkookie/home-manager/README.md
  5. 14
      infra/libkookie/home-manager/default.nix
  6. 13
      infra/libkookie/home-manager/docs/default.nix
  7. 12
      infra/libkookie/home-manager/docs/installation.adoc
  8. 2
      infra/libkookie/home-manager/docs/man-pages.xml
  9. 8
      infra/libkookie/home-manager/docs/nix-flakes.adoc
  10. 2
      infra/libkookie/home-manager/docs/release-notes/release-notes.adoc
  11. 2
      infra/libkookie/home-manager/docs/release-notes/rl-2205.adoc
  12. 19
      infra/libkookie/home-manager/docs/release-notes/rl-2211.adoc
  13. 94
      infra/libkookie/home-manager/flake.lock
  14. 75
      infra/libkookie/home-manager/flake.nix
  15. 1
      infra/libkookie/home-manager/format
  16. 1
      infra/libkookie/home-manager/home-manager/default.nix
  17. 124
      infra/libkookie/home-manager/integration-common.nix
  18. 9
      infra/libkookie/home-manager/modules/accounts/email.nix
  19. 156
      infra/libkookie/home-manager/modules/config/home-cursor.nix
  20. 16
      infra/libkookie/home-manager/modules/lib/maintainers.nix
  21. 4
      infra/libkookie/home-manager/modules/misc/gtk.nix
  22. 1940
      infra/libkookie/home-manager/modules/misc/news.nix
  23. 71
      infra/libkookie/home-manager/modules/misc/specialization.nix
  24. 1
      infra/libkookie/home-manager/modules/misc/version.nix
  25. 2
      infra/libkookie/home-manager/modules/misc/xdg-desktop-entries.nix
  26. 6
      infra/libkookie/home-manager/modules/modules.nix
  27. 28
      infra/libkookie/home-manager/modules/po/fr.po
  28. 28
      infra/libkookie/home-manager/modules/po/zh_Hans.po
  29. 20
      infra/libkookie/home-manager/modules/programs/emacs.nix
  30. 2
      infra/libkookie/home-manager/modules/programs/fish.nix
  31. 85
      infra/libkookie/home-manager/modules/programs/git.nix
  32. 10
      infra/libkookie/home-manager/modules/programs/himalaya.nix
  33. 36
      infra/libkookie/home-manager/modules/programs/htop.nix
  34. 19
      infra/libkookie/home-manager/modules/programs/neomutt.nix
  35. 9
      infra/libkookie/home-manager/modules/programs/neovim.nix
  36. 4
      infra/libkookie/home-manager/modules/programs/offlineimap.nix
  37. 76
      infra/libkookie/home-manager/modules/programs/pywal.nix
  38. 32
      infra/libkookie/home-manager/modules/programs/swaylock.nix
  39. 53
      infra/libkookie/home-manager/modules/programs/tealdeer.nix
  40. 2
      infra/libkookie/home-manager/modules/services/getmail.nix
  41. 18
      infra/libkookie/home-manager/modules/services/gpg-agent.nix
  42. 11
      infra/libkookie/home-manager/modules/services/mako.nix
  43. 136
      infra/libkookie/home-manager/modules/services/mopidy.nix
  44. 15
      infra/libkookie/home-manager/modules/services/mpdris2.nix
  45. 4
      infra/libkookie/home-manager/modules/services/swayidle.nix
  46. 6
      infra/libkookie/home-manager/modules/services/window-managers/i3-sway/sway.nix
  47. 90
      infra/libkookie/home-manager/modules/xcursor.nix
  48. 156
      infra/libkookie/home-manager/nix-darwin/default.nix
  49. 236
      infra/libkookie/home-manager/nixos/default.nix
  50. 11
      infra/libkookie/home-manager/tests/default.nix
  51. 1
      infra/libkookie/home-manager/tests/modules/misc/specialization/default.nix
  52. 18
      infra/libkookie/home-manager/tests/modules/misc/specialization/specialization.nix
  53. 20
      infra/libkookie/home-manager/tests/modules/programs/emacs/extra-config.nix
  54. 8
      infra/libkookie/home-manager/tests/modules/programs/himalaya/himalaya-expected.toml
  55. 9
      infra/libkookie/home-manager/tests/modules/programs/htop/header_layout.nix
  56. 9
      infra/libkookie/home-manager/tests/modules/programs/htop/settings-without-fields.nix
  57. 2
      infra/libkookie/home-manager/tests/modules/programs/neomutt/default.nix
  58. 1
      infra/libkookie/home-manager/tests/modules/programs/neomutt/hm-example.com-expected
  59. 1
      infra/libkookie/home-manager/tests/modules/programs/neomutt/hm-example.com-gpg-expected.conf
  60. 1
      infra/libkookie/home-manager/tests/modules/programs/neomutt/hm-example.com-msmtp-expected.conf
  61. 1
      infra/libkookie/home-manager/tests/modules/programs/neomutt/hm-example.com-no-folder-change-expected.conf
  62. 38
      infra/libkookie/home-manager/tests/modules/programs/neomutt/hm-example.com-signature-command-expected
  63. 38
      infra/libkookie/home-manager/tests/modules/programs/neomutt/hm-example.com-signature-expected
  64. 45
      infra/libkookie/home-manager/tests/modules/programs/neomutt/neomutt-with-signature-command.nix
  65. 48
      infra/libkookie/home-manager/tests/modules/programs/neomutt/neomutt-with-signature.nix
  66. 5
      infra/libkookie/home-manager/tests/modules/programs/swaylock/config
  67. 4
      infra/libkookie/home-manager/tests/modules/programs/swaylock/default.nix
  68. 7
      infra/libkookie/home-manager/tests/modules/programs/swaylock/disabled.nix
  69. 16
      infra/libkookie/home-manager/tests/modules/programs/swaylock/settings.nix
  70. 10
      infra/libkookie/home-manager/tests/modules/services/mopidy/basic-configuration.conf
  71. 38
      infra/libkookie/home-manager/tests/modules/services/mopidy/basic-configuration.nix
  72. 1
      infra/libkookie/home-manager/tests/modules/services/mopidy/default.nix
  73. 8
      infra/libkookie/home-manager/tests/modules/services/mpdris2/basic-configuration.config
  74. 19
      infra/libkookie/home-manager/tests/modules/services/mpdris2/basic-configuration.nix
  75. 13
      infra/libkookie/home-manager/tests/modules/services/mpdris2/basic-configuration.service
  76. 4
      infra/libkookie/home-manager/tests/modules/services/mpdris2/default.nix
  77. 9
      infra/libkookie/home-manager/tests/modules/services/mpdris2/with-password.config
  78. 22
      infra/libkookie/home-manager/tests/modules/services/mpdris2/with-password.nix

@ -16,6 +16,8 @@
/modules/misc/gtk.nix @rycee
/modules/config/home-cursor.nix @polykernel @league
/modules/config/i18n.nix @midchildan
/tests/modules/config/i18n @midchildan
@ -245,6 +247,11 @@
/modules/programs/starship.nix @marsam
/modules/programs/swaylock.nix @rcerc
/tests/modules/programs/swaylock @rcerc
/modules/programs/tealdeer.nix @marsam
/modules/programs/terminator.nix @chisui
/modules/programs/texlive.nix @rycee
@ -342,6 +349,9 @@
/modules/services/mbsync.nix @pjones
/modules/services/mopidy.nix @foo-dogsquared
/tests/modules/services/mopidy @foo-dogsquared
/modules/services/mpdris2.nix @pjones
/modules/services/mpd-discord-rpc.nix @Kranzes
@ -438,8 +448,6 @@
/modules/systemd.nix @rycee
/modules/xcursor.nix @league
/modules/xresources.nix @rycee
/modules/xsession.nix @rycee

@ -1,2 +1 @@
/flake.lock
/result*

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

@ -6,11 +6,16 @@ using the [Nix][] package manager together with the Nix libraries
found in [Nixpkgs][]. It allows declarative configuration of user
specific (non global) packages and dotfiles.
Usage
-----
Before attempting to use Home Manager please read the warning below.
For a more systematic overview of Home Manager and its available
options, please see the Home Manager [manual][manual] and
[options][configuration options].
For a systematic overview of Home Manager and its available options,
please see
- the [Home Manager manual][manual] and
- the [Home Manager configuration options][configuration options].
If you would like to contribute to Home Manager
then please have a look at the [contributing][] chapter of the manual.
@ -36,7 +41,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.11 (the
Home Manager targets [NixOS][] unstable and NixOS version 22.05 (the
current stable version), it may or may not work on other Linux
distributions and NixOS versions.
@ -101,7 +106,7 @@ Home Manager is developed against `nixpkgs-unstable` branch, which
often causes it to contain tweaks for changes/packages not yet
released in stable NixOS. To avoid breaking users' configurations,
Home Manager is released in branches corresponding to NixOS releases
(e.g. `release-21.11`). These branches get fixes, but usually not new
(e.g. `release-22.05`). These branches get fixes, but usually not new
modules. If you need a module to be backported, then feel free to open
an issue.
@ -110,18 +115,18 @@ License
This project is licensed under the terms of the [MIT license](LICENSE).
[Nix]: https://nixos.org/nix/
[Nix]: https://nixos.org/explore.html
[NixOS]: https://nixos.org/
[Nixpkgs]: https://nixos.org/nixpkgs/
[manual]: https://nix-community.github.io/home-manager/
[Nixpkgs]: https://github.com/NixOS/nixpkgs
[manual]: https://nix-community.github.io/home-manager/index.html
[contributing]: https://nix-community.github.io/home-manager/#ch-contributing
[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/
[Nix Pills]: https://nixos.org/nixos/nix-pills/
[Nix Pills]: https://nixos.org/guides/nix-pills/
[Nix Flakes]: https://nixos.wiki/wiki/Flakes
[nix-darwin]: https://github.com/LnL7/nix-darwin/
[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

@ -1,6 +1,16 @@
{ pkgs ? import <nixpkgs> { } }:
rec {
let
flake = (import
(let lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in fetchTarball {
url =
"https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}) { src = ./.; }).defaultNix;
in rec {
docs = with import ./docs { inherit pkgs; }; {
html = manual.html;
manPages = manPages;
@ -16,4 +26,6 @@ rec {
nixos = import ./nixos;
path = ./.;
inherit (flake) inputs;
}

@ -1,18 +1,10 @@
{ pkgs
{ pkgs, nmdSrc ? (import ./.. { }).inputs.nmd
# Note, this should be "the standard library" + HM extensions.
# Note, this should be "the standard library" + HM extensions.
, lib ? import ../modules/lib/stdlib-extended.nix pkgs.lib }:
let
nmdSrc = pkgs.fetchFromGitLab {
name = "nmd";
owner = "rycee";
repo = "nmd";
rev = "de522bdd533350b3afb41e1ce9b3afb72922fba2";
sha256 = "1ji4q7b48nnicgpnnl6yb9xb9zfkmmzkch4yifinphw3ag38qrmd";
};
nmd = import nmdSrc { inherit lib pkgs; };
# Make sure the used package is scrubbed to avoid actually
@ -89,6 +81,7 @@ let
docs = nmd.buildDocBookDocs {
pathName = "home-manager";
projectName = "Home Manager";
modulesDocs = [ hmModulesDocs nixDarwinModuleDocs nixosModuleDocs ];
documentsDirectory = ./.;
documentType = "book";

@ -54,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.11 channel you can run
and if you follow a Nixpkgs version 22.05 channel you can run
+
[source,console]
----
$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.11.tar.gz home-manager
$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-22.05.tar.gz home-manager
$ nix-channel --update
----
+
@ -136,11 +136,11 @@ or an unstable channel, you can run
# nix-channel --update
----
and if you follow a Nixpkgs version 21.11 channel, you can run
and if you follow a Nixpkgs version 22.05 channel, you can run
[source,console]
----
# nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.11.tar.gz home-manager
# nix-channel --add https://github.com/nix-community/home-manager/archive/release-22.05.tar.gz home-manager
# nix-channel --update
----
@ -247,11 +247,11 @@ or an unstable channel, you can run
# nix-channel --update
----
and if you follow a Nixpkgs version 21.11 channel, you can run
and if you follow a Nixpkgs version 22.05 channel, you can run
[source,console]
----
# nix-channel --add https://github.com/nix-community/home-manager/archive/release-21.11.tar.gz home-manager
# nix-channel --add https://github.com/nix-community/home-manager/archive/release-22.05.tar.gz home-manager
# nix-channel --update
----

@ -4,7 +4,7 @@
<title>Home Manager Reference Pages</title>
<info>
<author><personname>Home Manager contributors</personname></author>
<copyright><year>2017–2020</year><holder>Home Manager contributors</holder>
<copyright><year>2017–2022</year><holder>Home Manager contributors</holder>
</copyright>
</info>
<xi:include href="man-configuration.xml" />

@ -72,7 +72,7 @@ Remove the line containing `home.stateVersion` in the example.
# Update the state version as needed.
# See the changelog here:
# https://nix-community.github.io/home-manager/release-notes.html#sec-release-21.05
stateVersion = "21.11";
stateVersion = "22.05";
# Optionally use extraSpecialArgs
# to pass through arguments to home.nix
@ -85,9 +85,9 @@ Remove the line containing `home.stateVersion` in the example.
====
* The above example tracks the master branch of Home Manager
and nixos-unstable branch of Nixpkgs.
If you would like to use the `release-21.11` branch,
change the `home-manager` input url to `github:nix-community/home-manager/release-21.11`
and `nixpkgs` url to `github:NixOS/nixpkgs/nixos-21.11`.
If you would like to use the `release-22.05` branch,
change the `home-manager` input url to `github:nix-community/home-manager/release-22.05`
and `nixpkgs` url to `github:NixOS/nixpkgs/nixos-22.05`.
Make sure to also update to the `stateVersion` option accordingly.
* The Home Manager library is exported by the flake under

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

@ -1,7 +1,7 @@
[[sec-release-22.05]]
== Release 22.05
This is the current unstable branch and the information in this section is therefore not final.
The 22.05 release branch became the stable branch in May, 2022.
[[sec-release-22.05-highlights]]
=== Highlights

@ -0,0 +1,19 @@
[[sec-release-22.11]]
== Release 22.11
This is the current unstable branch and the information in this section is therefore not final.
[[sec-release-22.11-highlights]]
=== Highlights
This release has the following notable changes:
* No changes.
[[sec-release-22.11-state-version-changes]]
=== State Version Changes
The state version in this release includes the changes below.
These changes are only active if the `home.stateVersion` option is set to "22.11" or later.
* No changes.

@ -0,0 +1,94 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1654230545,
"narHash": "sha256-8Vlwf0x8ow6pPOK2a04bT+pxIeRnM1+O0Xv9/CuDzRs=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "236cc2971ac72acd90f0ae3a797f9f83098b17ec",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nmd": {
"flake": false,
"locked": {
"lastModified": 1653339422,
"narHash": "sha256-8nc7lcYOgih3YEmRMlBwZaLLJYpLPYKBlewqHqx8ieg=",
"owner": "rycee",
"repo": "nmd",
"rev": "9e7a20e6ee3f6751f699f79c0b299390f81f7bcd",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmd",
"type": "gitlab"
}
},
"nmt": {
"flake": false,
"locked": {
"lastModified": 1648075362,
"narHash": "sha256-u36WgzoA84dMVsGXzml4wZ5ckGgfnvS0ryzo/3zn/Pc=",
"owner": "rycee",
"repo": "nmt",
"rev": "d83601002c99b78c89ea80e5e6ba21addcfe12ae",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmt",
"type": "gitlab"
}
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs",
"nmd": "nmd",
"nmt": "nmt",
"utils": "utils"
}
},
"utils": {
"locked": {
"lastModified": 1653893745,
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

@ -1,43 +1,31 @@
{
description = "Home Manager for Nix";
outputs = { self, nixpkgs }:
let
# List of systems supported by home-manager binary
supportedSystems = with nixpkgs.lib.platforms; linux ++ darwin;
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.nmd.url = "gitlab:rycee/nmd";
inputs.nmd.flake = false;
inputs.nmt.url = "gitlab:rycee/nmt";
inputs.nmt.flake = false;
# Function to generate a set based on supported systems
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
inputs.utils.url = "github:numtide/flake-utils";
inputs.flake-compat.url = "github:edolstra/flake-compat";
inputs.flake-compat.flake = false;
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
in rec {
nixosModules.home-manager = import ./nixos;
nixosModule = self.nixosModules.home-manager;
darwinModules.home-manager = import ./nix-darwin;
darwinModule = self.darwinModules.home-manager;
packages = forAllSystems (system:
let docs = import ./docs { pkgs = nixpkgsFor.${system}; };
in {
home-manager = nixpkgsFor.${system}.callPackage ./home-manager { };
docs-html = docs.manual.html;
docs-manpages = docs.manPages;
docs-json = docs.options.json;
default = self.packages.${system}.home-manager;
});
# defaultPackage is deprecated as of Nix 2.7.0
defaultPackage = forAllSystems (system: self.packages.${system}.default);
apps = forAllSystems (system: {
home-manager = {
type = "app";
program = "${defaultPackage.${system}}/bin/home-manager";
};
});
outputs = { self, nixpkgs, nmd, utils, ... }:
{
nixosModules = rec {
home-manager = import ./nixos;
default = home-manager;
};
# deprecated in Nix 2.8
nixosModule = self.nixosModules.default;
defaultApp = forAllSystems (system: apps.${system}.home-manager);
darwinModules = rec {
home-manager = import ./nix-darwin;
default = home-manager;
};
# unofficial; deprecated in Nix 2.8
darwinModule = self.darwinModules.default;
lib = {
hm = import ./modules/lib { lib = nixpkgs.lib; };
@ -56,5 +44,22 @@
};
};
};
};
} // utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
docs = import ./docs {
inherit pkgs;
nmdSrc = nmd;
};
in {
packages = rec {
home-manager = pkgs.callPackage ./home-manager { };
docs-html = docs.manual.html;
docs-manpages = docs.manPages;
docs-json = docs.options.json;
default = home-manager;
};
# deprecated in Nix 2.7
defaultPackage = self.packages.${system}.default;
});
}

@ -27,6 +27,5 @@ find . -name '*.nix' \
! -path ./modules/programs/bash.nix \
! -path ./modules/programs/ssh.nix \
! -path ./modules/programs/zsh.nix \
! -path ./nix-darwin/default.nix \
! -path ./tests/default.nix \
-exec nixfmt $CHECK_ARG {} +

@ -19,6 +19,7 @@ in runCommand "home-manager" {
preferLocalBuild = true;
nativeBuildInputs = [ gettext ];
meta = with lib; {
mainProgram = "home-manager";
description = "A user environment configurator";
maintainers = [ maintainers.rycee ];
platforms = platforms.unix;

@ -0,0 +1,124 @@
# This module is the common base for the NixOS and nix-darwin modules.
# For OS-specific configuration, please edit nixos/default.nix or nix-darwin/default.nix instead.
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.home-manager;
extendedLib = import ./modules/lib/stdlib-extended.nix pkgs.lib;
hmModule' = types.submoduleWith {
specialArgs = {
lib = extendedLib;
osConfig = config;
modulesPath = builtins.toString ./modules;
} // cfg.extraSpecialArgs;
modules = [
({ name, ... }: {
imports = import ./modules/modules.nix {
inherit pkgs;
lib = extendedLib;
useNixpkgsModule = !cfg.useGlobalPkgs;
};
config = {
submoduleSupport.enable = true;
submoduleSupport.externalPackageInstall = cfg.useUserPackages;
home.username = config.users.users.${name}.name;
home.homeDirectory = config.users.users.${name}.home;
# Make activation script use same version of Nix as system as a whole.
# This avoids problems with Nix not being in PATH.
home.extraActivationPath = [ config.nix.package ];
};
})
] ++ cfg.sharedModules;
} // {
description = "Home Manager module";
};
# TODO: hack until https://github.com/NixOS/nixpkgs/pull/173621 lands
hmModule = hmModule' // {
substSubModules = m:
hmModule'.substSubModules m // {
inherit (hmModule') description;
};
};
in {
options.home-manager = {
useUserPackages = mkEnableOption ''
installation of user packages through the
<option>users.users.&lt;name&gt;.packages</option> option
'';
useGlobalPkgs = mkEnableOption ''
using the system configuration's <literal>pkgs</literal>
argument in Home Manager. This disables the Home Manager
options <option>nixpkgs.*</option>
'';
backupFileExtension = mkOption {
type = types.nullOr types.str;
default = null;
example = "backup";
description = ''
On activation move existing files by appending the given
file extension rather than exiting with an error.
'';
};
extraSpecialArgs = mkOption {
type = types.attrs;
default = { };
example = literalExpression "{ inherit emacs-overlay; }";
description = ''
Extra <literal>specialArgs</literal> passed to Home Manager. This
option can be used to pass additional arguments to all modules.
'';
};
sharedModules = mkOption {
type = with types; listOf raw;
default = [ ];
example = literalExpression "[ { home.packages = [ nixpkgs-fmt ]; } ]";
description = ''
Extra modules added to all users.
'';
};
verbose = mkEnableOption "verbose output on activation";
users = mkOption {
type = types.attrsOf hmModule;
default = { };
# Prevent the entire submodule being included in the documentation.
visible = "shallow";
description = ''
Per-user Home Manager configuration.
'';
};
};
config = mkIf (cfg.users != { }) {
warnings = flatten (flip mapAttrsToList cfg.users (user: config:
flip map config.warnings (warning: "${user} profile: ${warning}")));
assertions = flatten (flip mapAttrsToList cfg.users (user: config:
flip map config.assertions (assertion: {
inherit (assertion) assertion;
message = "${user} profile: ${assertion.message}";
})));
users.users = mkIf cfg.useUserPackages
(mapAttrs (username: usercfg: { packages = [ usercfg.home.path ]; })
cfg.users);
environment.pathsToLink = mkIf cfg.useUserPackages [ "/etc/profile.d" ];
};
}

@ -44,6 +44,15 @@ let
'';
};
command = mkOption {
type = with types; nullOr path;
default = null;
example = literalExpression ''
pkgs.writeScript "signature" "echo This is my signature"
'';
description = "A command that generates a signature.";
};
showSignature = mkOption {
type = types.enum [ "append" "attach" "none" ];
default = "none";

@ -0,0 +1,156 @@
{ config, options, lib, pkgs, ... }:
with lib;
let
cfg = config.home.pointerCursor;
pointerCursorModule = types.submodule {
options = {
package = mkOption {
type = types.package;
example = literalExpression "pkgs.vanilla-dmz";
description = "Package providing the cursor theme.";
};
name = mkOption {
type = types.str;
example = "Vanilla-DMZ";
description = "The cursor name within the package.";
};
size = mkOption {
type = types.int;
default = 32;
example = 64;
description = "The cursor size.";
};
x11 = {
enable = mkEnableOption ''
x11 config generation for <option>home.pointerCursor</option>
'';
defaultCursor = mkOption {
type = types.str;
default = "left_ptr";
example = "X_cursor";
description = "The default cursor file to use within the package.";
};
};
gtk = {
enable = mkEnableOption ''
gtk config generation for <option>home.pointerCursor</option>
'';
};
};
};
cursorPath = "${cfg.package}/share/icons/${escapeShellArg cfg.name}/cursors/${
escapeShellArg cfg.x11.defaultCursor
}";
in {
meta.maintainers = [ maintainers.polykernel maintainers.league ];
imports = [
(mkAliasOptionModule [ "xsession" "pointerCursor" "package" ] [
"home"
"pointerCursor"
"package"
])
(mkAliasOptionModule [ "xsession" "pointerCursor" "name" ] [
"home"
"pointerCursor"
"name"
])
(mkAliasOptionModule [ "xsession" "pointerCursor" "size" ] [
"home"
"pointerCursor"
"size"
])
(mkAliasOptionModule [ "xsession" "pointerCursor" "defaultCursor" ] [
"home"
"pointerCursor"
"x11"
"defaultCursor"
])
({ ... }: {
warnings = optional (any (x:
getAttrFromPath
([ "xsession" "pointerCursor" ] ++ [ x ] ++ [ "isDefined" ])
options) [ "package" "name" "size" "defaultCursor" ]) ''
The option `xsession.pointerCursor` has been merged into `home.pointerCursor` and will be removed
in the future. Please change to set `home.pointerCursor` directly and enable `home.pointerCursor.x11.enable`
to generate x11 specific cursor configurations. You can refer to the documentation for more details.
'';
})
];
options = {
home.pointerCursor = mkOption {
type = types.nullOr pointerCursorModule;
default = null;
description = ''
Cursor configuration. Set to <literal>null</literal> to disable.
</para><para>
Top-level options declared under this submodule are backend indepedent
options. Options declared under namespaces such as <literal>x11</literal>
are backend specific options. By default, only backend independent cursor
configurations are generated. If you need configurations for specific
backends, you can toggle them via the enable option. For example, <varname>
<link linkend="opt-home.pointerCursor.x11.enable">home.pointerCursor.x11.enable</link>
</varname> will enable x11 cursor configurations.
'';
};
};
config = mkIf (cfg != null) (mkMerge [
{
assertions = [
(hm.assertions.assertPlatform "home.pointerCursor" pkgs platforms.linux)
];
home.packages = [ cfg.package ];
# Set name in icons theme, for compatibility with AwesomeWM etc. See:
# https://github.com/nix-community/home-manager/issues/2081
# https://wiki.archlinux.org/title/Cursor_themes#XDG_specification
home.file.".icons/default/index.theme".text = ''
[icon theme]
Name=Default
Comment=Default Cursor Theme
Inherits=${cfg.name}
'';
# Set directory to look for cursors in, needed for some applications
# that are unable to find cursors otherwise. See:
# https://github.com/nix-community/home-manager/issues/2812
# https://wiki.archlinux.org/title/Cursor_themes#Environment_variable
home.sessionVariables = {
XCURSOR_PATH = "$XCURSOR_PATH\${XCURSOR_PATH:+:}"
+ "${config.home.profileDirectory}/share/icons";
};
}
(mkIf cfg.x11.enable {
xsession.initExtra = ''
${pkgs.xorg.xsetroot}/bin/xsetroot -xcf ${cursorPath} ${
toString cfg.size
}
'';
xresources.properties = {
"Xcursor.theme" = cfg.name;
"Xcursor.size" = cfg.size;
};
})
(mkIf cfg.gtk.enable {
gtk.cursorTheme = mkDefault { inherit (cfg) package name size; };
})
]);
}

@ -55,6 +55,12 @@
github = "chisui";
githubId = 4526429;
};
foo-dogsquared = {
name = "Gabriel Arazas";
email = "foo.dogsquared@gmail.com";
github = "foo-dogsquared";
githubId = 34962634;
};
olmokramer = {
name = "Olmo Kramer";
email = "olmokramer@users.noreply.github.com";
@ -265,4 +271,14 @@
github = "rszamszur";
githubId = 10353018;
};
rcerc = {
name = "rcerc";
email = "88944439+rcerc@users.noreply.github.com";
github = "rcerc";
githubId = 88944439;
keys = [{
longkeyid = "ed25519/0x3F98EC7EC2B87ED1";
fingerprint = "D5D6 FD1F 0D9A 3284 FB9B C26D 3F98 EC7E C2B8 7ED1";
}];
};
}

@ -30,7 +30,7 @@ let
package = mkOption {
type = types.nullOr types.package;
default = null;
example = literalExpression "pkgs.gnome.gnome_themes_standard";
example = literalExpression "pkgs.gnome.gnome-themes-extra";
description = ''
Package providing the theme. This package will be installed
to your profile. If <literal>null</literal> then the theme
@ -51,7 +51,7 @@ let
package = mkOption {
type = types.nullOr types.package;
default = null;
example = literalExpression "pkgs.adwaita-icon-theme";
example = literalExpression "pkgs.gnome.adwaita-icon-theme";
description = ''
Package providing the icon theme. This package will be installed
to your profile. If <literal>null</literal> then the theme

File diff suppressed because it is too large Load Diff

@ -0,0 +1,71 @@
{ config, extendModules, lib, ... }:
with lib;
{
options.specialization = mkOption {
type = types.attrsOf (types.submodule {
options = {
configuration = mkOption {
type = let
stopRecursion = { specialization = mkOverride 0 { }; };
extended = extendModules { modules = [ stopRecursion ]; };
in extended.type;
default = { };
visible = "shallow";
description = ''
Arbitrary Home Manager configuration settings.
'';
};
};
});
default = { };
description = ''
A set of named specialized configurations. These can be used to extend
your base configuration with additional settings. For example, you can
have specializations named <quote>light</quote> and <quote>dark</quote>
that applies light and dark color theme configurations.
</para><para>
Note, this is an experimental option for now and you therefore have to
activate the specialization by looking up and running the activation
script yourself. Note, running the activation script will create a new
Home Manager generation.
</para><para>
For example, to activate the <quote>dark</quote> specialization. You can
first look up your current Home Manager generation by running
<programlisting language="console">
$ home-manager generations | head -1
2022-05-02 22:49 : id 1758 -> /nix/store/jyac-home-manager-generation
</programlisting>
then run
<programlisting language="console">
$ /nix/store/jyac-home-manager-generation/specialization/dark/activate
Starting Home Manager activation
</programlisting>
</para><para>
WARNING! Since this option is experimental, the activation process may
change in backwards incompatible ways.
'';
};
config = mkIf (config.specialization != { }) {
home.extraBuilderCommands = let
link = n: v:
let pkg = v.configuration.home.activationPackage;
in "ln -s ${pkg} $out/specialization/${n}";
in ''
mkdir $out/specialization
${concatStringsSep "\n" (mapAttrsToList link config.specialization)}
'';
};
}

@ -15,6 +15,7 @@ with lib;
"21.05"
"21.11"
"22.05"
"22.11"
];
default = "18.09";
description = ''

@ -152,7 +152,7 @@ let
};
# Required for the assertions
# TODO: Remove me once `mkRemovedOptionModule` works correctly with submodules
# TODO: Remove me once https://github.com/NixOS/nixpkgs/issues/96006 is fixed
assertions = mkOption {
type = types.listOf types.unspecified;
default = [ ];

@ -15,6 +15,7 @@ let
modules = [
./accounts/email.nix
./config/home-cursor.nix
./config/i18n.nix
./files.nix
./home-environment.nix
@ -30,6 +31,7 @@ let
./misc/numlock.nix
./misc/pam.nix
./misc/qt.nix
./misc/specialization.nix
./misc/submodule-support.nix
./misc/tmpfiles.nix
./misc/version.nix
@ -148,7 +150,9 @@ let
./programs/sqls.nix
./programs/ssh.nix
./programs/starship.nix
./programs/swaylock.nix
./programs/taskwarrior.nix
./programs/tealdeer.nix
./programs/terminator.nix
./programs/termite.nix
./programs/texlive.nix
@ -209,6 +213,7 @@ let
./services/lorri.nix
./services/mako.nix
./services/mbsync.nix
./services/mopidy.nix
./services/mpd.nix
./services/mpdris2.nix
./services/mpd-discord-rpc.nix
@ -270,7 +275,6 @@ let
./systemd.nix
./targets/darwin
./targets/generic-linux.nix
./xcursor.nix
./xresources.nix
./xsession.nix
./misc/nix.nix

@ -8,8 +8,8 @@ msgstr ""
"Project-Id-Version: Home Manager Modules\n"
"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n"
"POT-Creation-Date: 2022-03-26 15:08+0100\n"
"PO-Revision-Date: 2022-03-26 23:57+0000\n"
"Last-Translator: Robert Helgesson <robert@rycee.net>\n"
"PO-Revision-Date: 2022-05-18 23:12+0000\n"
"Last-Translator: Naïm Camille Favier <n@monade.li>\n"
"Language-Team: French <https://hosted.weblate.org/projects/home-manager/"
"modules/fr/>\n"
"Language: fr\n"
@ -17,7 +17,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.12-dev\n"
"X-Generator: Weblate 4.13-dev\n"
#: modules/files.nix:233
msgid "Creating home file links in %s"
@ -53,11 +53,11 @@ msgstr ""
"Oups, Nix n'a pas réussi à installer votre nouveau profil de Home Manager!\n"
"\n"
"Il y a peut-être un conflit avec un autre paquet qui a été installé avec\n"
"« %s »? Essayez d'éxecuter\n"
"« %s »? Essayez d'ecuter\n"
"\n"
" %s\n"
"\n"
"et s'il y a un paquet en conflict, vous pourrez le supprimer avec\n"
"et s'il y a un paquet en conflit, vous pourrez le supprimer avec\n"
"\n"
" %s\n"
"\n"
@ -69,7 +69,7 @@ msgstr "Activation de %s"
#: modules/lib-bash/activation-init.sh:31
msgid "Sanity checking oldGenNum and oldGenPath"
msgstr "Vérification rationnelle de oldGenNum et oldGenPath"
msgstr "Vérification de oldGenNum et oldGenPath"
#: modules/lib-bash/activation-init.sh:34
msgid ""
@ -86,20 +86,20 @@ msgid ""
"\n"
"and trying home-manager switch again. Good luck!"
msgstr ""
"Le numéro et le chemin de la génération dernière sont en conflit ! Ils "
"Le numéro et le chemin de la génération précédente sont en conflit ! Ils "
"doivent\n"
"être vides ou les deux mis à\n"
"\n"
" '%s' et '%s'\n"
"\n"
"Si ça ne vous dérange pas de perdre la génération dernière, la solution la "
"plus\n"
"Si ça ne vous dérange pas de perdre les générations précédentes, la solution "
"la plus\n"
"simple est probablement d'exécuter\n"
"\n"
" rm %s/home-manager*\n"
" rm %s/current-home\n"
"\n"
"et d'essayer encore home-manager switch. Bonne chance !"
"et de réessayer home-manager switch. Bonne chance !"
#: modules/lib-bash/activation-init.sh:51
msgid "Starting Home Manager activation"
@ -107,19 +107,19 @@ msgstr "Démarrage de l'activation de Home Manager"
#: modules/lib-bash/activation-init.sh:55
msgid "Sanity checking Nix"
msgstr "Vérification rationnelle de Nix"
msgstr "Vérification de Nix"
#: modules/lib-bash/activation-init.sh:61
msgid "This is a dry run"
msgstr "Ceci est une course à sec"
msgstr "Ceci est une fausse activation (essai à blanc)"
#: modules/lib-bash/activation-init.sh:64
msgid "This is a live run"
msgstr "Ceci est une course réelle"
msgstr "Ceci est une vraie activation"
#: modules/lib-bash/activation-init.sh:69
msgid "Using Nix version: %s"
msgstr "Usage de la version de Nix : %s"
msgstr "Version de Nix : %s"
#: modules/lib-bash/activation-init.sh:72
msgid "Activation variables:"

@ -8,8 +8,8 @@ msgstr ""
"Project-Id-Version: Home Manager Modules\n"
"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n"
"POT-Creation-Date: 2022-03-26 15:08+0100\n"
"PO-Revision-Date: 2022-01-05 00:56+0000\n"
"Last-Translator: ethinx <eth2net@gmail.com>\n"
"PO-Revision-Date: 2022-05-16 13:18+0000\n"
"Last-Translator: Yubo-Cao <Cao2006721@gmail.com>\n"
"Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/"
"home-manager/modules/zh_Hans/>\n"
"Language: zh_Hans\n"
@ -17,7 +17,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 4.10.1\n"
"X-Generator: Weblate 4.13-dev\n"
#: modules/files.nix:233
msgid "Creating home file links in %s"
@ -50,6 +50,18 @@ msgid ""
"\n"
"Then try activating your Home Manager configuration again."
msgstr ""
"糟糕,Nix 未能安装您的新 Home Manager 配置文件!\n"
"\n"
"也许这里和使用 \"%s\" 安装的包有冲突?\n"
"尝试运行\n"
"\n"
" %s\n"
"\n"
"如果有冲突的包,你可以用\n"
"\n"
" %s\n"
"\n"
"来移除。然后尝试再次激活您的 Home Manager 配置。"
#: modules/home-environment.nix:639
msgid "Activating %s"
@ -57,7 +69,7 @@ msgstr "正在激活 %s"
#: modules/lib-bash/activation-init.sh:31
msgid "Sanity checking oldGenNum and oldGenPath"
msgstr ""
msgstr "正在进行 oldGenNum 和 oldGenPath 的完整性检查"
#: modules/lib-bash/activation-init.sh:34
msgid ""
@ -81,15 +93,15 @@ msgstr "正在启动 Home Manager 初始化程序"
#: modules/lib-bash/activation-init.sh:55
msgid "Sanity checking Nix"
msgstr ""
msgstr "正在进行 Nix 完整性检查"
#: modules/lib-bash/activation-init.sh:61
msgid "This is a dry run"
msgstr ""
msgstr "这是试运行"
#: modules/lib-bash/activation-init.sh:64
msgid "This is a live run"
msgstr ""
msgstr "这是在实际运行"
#: modules/lib-bash/activation-init.sh:69
msgid "Using Nix version: %s"
@ -97,4 +109,4 @@ msgstr "正在使用的 Nix 版本: %s"
#: modules/lib-bash/activation-init.sh:72
msgid "Activation variables:"
msgstr ""
msgstr "激活的变量:"

@ -13,11 +13,15 @@ let
emacsWithPackages = emacsPackages.emacsWithPackages;
createConfPackage = epkgs:
epkgs.trivialBuild {
pname = "default";
src = pkgs.writeText "default.el" cfg.extraConfig;
};
extraPackages = epkgs:
let
packages = cfg.extraPackages epkgs;
userConfig = epkgs.trivialBuild {
pname = "default";
src = pkgs.writeText "default.el" cfg.extraConfig;
packageRequires = packages;
};
in packages ++ optional (cfg.extraConfig != "") userConfig;
in {
meta.maintainers = [ maintainers.rycee ];
@ -91,10 +95,6 @@ in {
config = mkIf cfg.enable {
home.packages = [ cfg.finalPackage ];
programs.emacs = {
finalPackage = emacsWithPackages cfg.extraPackages;
extraPackages = epkgs:
optional (cfg.extraConfig != "") (createConfPackage epkgs);
};
programs.emacs.finalPackage = emacsWithPackages extraPackages;
};
}

@ -307,7 +307,7 @@ in {
generateCompletions = package:
pkgs.runCommand "${package.name}-fish-completions" {
src = package;
nativeBuildInputs = [ pkgs.python2 ];
nativeBuildInputs = [ pkgs.python3 ];
buildInputs = [ cfg.package ];
preferLocalBuild = true;
} ''

@ -296,6 +296,65 @@ in {
'';
};
};
diff-so-fancy = {
enable = mkEnableOption "" // {
description = ''
Enable the <command>diff-so-fancy</command> diff colorizer.
See <link xlink:href="https://github.com/so-fancy/diff-so-fancy" />.
'';
};
markEmptyLines = mkOption {
type = types.bool;
default = true;
example = false;
description = ''
Whether the first block of an empty line should be colored.
'';
};
changeHunkIndicators = mkOption {
type = types.bool;
default = true;
example = false;
description = ''
Simplify git header chunks to a more human readable format.
'';
};
stripLeadingSymbols = mkOption {
type = types.bool;
default = true;
example = false;
description = ''
Whether the <literal>+</literal> or <literal>-</literal> at
line-start should be removed.
'';
};
useUnicodeRuler = mkOption {
type = types.bool;
default = true;
example = false;
description = ''
By default, the separator for the file header uses Unicode
line-drawing characters. If this is causing output errors on
your terminal, set this to false to use ASCII characters instead.
'';
};
rulerWidth = mkOption {
type = types.nullOr types.int;
default = null;
example = false;
description = ''
By default, the separator for the file header spans the full
width of the terminal. Use this setting to set the width of
the file header manually.
'';
};
};
};
};
@ -303,9 +362,12 @@ in {
{
home.packages = [ cfg.package ];
assertions = [{
assertion = !(cfg.delta.enable && cfg.difftastic.enable);
assertion = let
enabled =
[ cfg.delta.enable cfg.diff-so-fancy.enable cfg.difftastic.enable ];
in count id enabled <= 1;
message =
"Only one of 'programs.git.delta.enable' or 'programs.git.difftastic.enable' can be set to true at the same time.";
"Only one of 'programs.git.delta.enable' or 'programs.git.difftastic.enable' or 'programs.git.diff-so-fancy.enable' can be set to true at the same time.";
}];
programs.git.iniContent.user = {
@ -432,5 +494,24 @@ in {
delta = cfg.delta.options;
};
})
(mkIf cfg.diff-so-fancy.enable {
home.packages = [ pkgs.diff-so-fancy ];
programs.git.iniContent =
let dsfCommand = "${pkgs.diff-so-fancy}/bin/diff-so-fancy";
in {
core.pager = "${dsfCommand} | ${pkgs.less}/bin/less --tabs=4 -RFX";
interactive.diffFilter = "${dsfCommand} --patch";
diff-so-fancy = {
markEmptyLines = cfg.diff-so-fancy.markEmptyLines;
changeHunkIndicators = cfg.diff-so-fancy.changeHunkIndicators;
stripLeadingSymbols = cfg.diff-so-fancy.stripLeadingSymbols;
useUnicodeRuler = cfg.diff-so-fancy.useUnicodeRuler;
rulerWidth = mkIf (cfg.diff-so-fancy.rulerWidth != null)
(cfg.diff-so-fancy.rulerWidth);
};
};
})
]);
}

@ -14,10 +14,12 @@ let
name = account.realName;
default = account.primary;
inbox-folder = account.folders.inbox;
sent-folder = account.folders.sent;
draft-folder = account.folders.drafts;
# NOTE: himalaya does not support configuring the name of the trash folder
mailboxes = {
inbox = account.folders.inbox;
sent = account.folders.sent;
draft = account.folders.drafts;
# NOTE: himalaya does not support configuring the name of the trash folder
};
# FIXME: does not support disabling TLS altogether
# NOTE: does not accept sequence of strings for password commands

@ -3,6 +3,7 @@
with lib;
let
inherit (pkgs.stdenv.hostPlatform) isDarwin;
cfg = config.programs.htop;
@ -41,6 +42,8 @@ let
TIME = 49;
NLWP = 50;
TGID = 51;
PERCENT_NORM_CPU = 52;
ELAPSED = 53;
CMINFLT = 10;
CMAJFLT = 12;
UTIME = 13;
@ -73,6 +76,21 @@ let
M_PSSWP = 120;
};
defaultFields = with fields; [
PID
USER
PRIORITY
NICE
M_SIZE
M_RESIDENT
M_SHARE
STATE
PERCENT_CPU
PERCENT_MEM
TIME
COMM
];
modes = {
Bar = 1;
Text = 2;
@ -154,20 +172,10 @@ in {
xdg.configFile."htop/htoprc" = let
defaults = {
fields = with fields; [
PID
USER
PRIORITY
NICE
M_SIZE
M_RESIDENT
M_SHARE
STATE
PERCENT_CPU
PERCENT_MEM
TIME
COMM
];
fields = if isDarwin then
remove fields.M_SHARE defaultFields
else
defaultFields;
};
before = optionalAttrs (cfg.settings ? header_layout) {

@ -196,7 +196,16 @@ let
accountStr = account:
with account;
''
let
signature = if account.signature.showSignature == "none" then
"unset signature"
else if account.signature.command != null then
''set signature = "${account.signature.command}|"''
else
"set signature = ${
pkgs.writeText "signature.txt" account.signature.text
}";
in ''
# Generated by Home Manager.
set ssl_force_tls = yes
set certificate_file=${toString config.accounts.email.certificatesFile}
@ -223,11 +232,9 @@ let
# Extra configuration
${account.neomutt.extraConfig}
'' + (if (account.signature.showSignature == "none") then ''
unset signature
'' else ''
set signature = ${pkgs.writeText "signature.txt" account.signature.text}
'') + optionalString account.notmuch.enable (notmuchSection account);
${signature}
'' + optionalString account.notmuch.enable (notmuchSection account);
in {
options = {

@ -66,7 +66,7 @@ let
allPlugins = cfg.plugins ++ optional cfg.coc.enable {
type = "viml";
plugin = pkgs.vimPlugins.coc-nvim;
plugin = cfg.coc.package;
config = cfg.coc.pluginConfig;
optional = false;
};
@ -302,6 +302,13 @@ in {
coc = {
enable = mkEnableOption "Coc";
package = mkOption {
type = types.package;
default = pkgs.vimPlugins.coc-nvim;
defaultText = literalExpression "pkgs.vimPlugins.coc-nvim";
description = "The package to use for the CoC plugin.";
};
settings = mkOption {
type = jsonFormat.type;
default = { };

@ -158,13 +158,13 @@ in {
xdg.configFile."offlineimap/get_settings.py".text = cfg.pythonFile;
xdg.configFile."offlineimap/get_settings.pyc".source = "${
pkgs.runCommandLocal "get_settings-compile" {
nativeBuildInputs = [ pkgs.python2 ];
nativeBuildInputs = [ pkgs.offlineimap ];
pythonFile = cfg.pythonFile;
passAsFile = [ "pythonFile" ];
} ''
mkdir -p $out/bin
cp $pythonFilePath $out/bin/get_settings.py
python2 -m py_compile $out/bin/get_settings.py
python -m py_compile $out/bin/get_settings.py
''
}/bin/get_settings.pyc";

@ -0,0 +1,76 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.programs.pywal;
in {
options = { programs.pywal = { enable = mkEnableOption "pywal"; }; };
config = mkIf cfg.enable {
home.packages = [ pkgs.pywal ];
programs.zsh.initExtra = ''
# Import colorscheme from 'wal' asynchronously
# & # Run the process in the background.
# ( ) # Hide shell job control messages.
(cat ${config.xdg.cacheHome}/wal/sequences &)
'';
programs.kitty.extraConfig = ''
include ${config.xdg.cacheHome}/wal/colors-kitty.conf
'';
programs.rofi.theme."@import" =
"${config.xdg.cacheHome}/wal/colors-rofi-dark.rasi";
# wal generates and that's the one we should load from /home/teto/.cache/wal/colors.Xresources ~/.Xresources
xsession.windowManager.i3 = {
extraConfig = ''
set_from_resource $bg i3wm.color0 #ff0000
set_from_resource $bg-alt i3wm.color14 #ff0000
set_from_resource $fg i3wm.color15 #ff0000
set_from_resource $fg-alt i3wm.color2 #ff0000
set_from_resource $hl i3wm.color13 #ff0000
'';
config.colors = {
focused = {
border = "$fg-alt";
background = "$bg";
text = "$hl";
indicator = "$fg-alt";
childBorder = "$hl";
};
focusedInactive = {
border = "$fg-alt";
background = "$bg";
text = "$fg";
indicator = "$fg-alt";
childBorder = "$fg-alt";
};
unfocused = {
border = "$fg-alt";
background = "$bg";
text = "$fg";
indicator = "$fg-alt";
childBorder = "$fg-alt";
};
urgent = {
border = "$fg-alt";
background = "$bg";
text = "$fg";
indicator = "$fg-alt";
childBorder = "$fg-alt";
};
background = "$bg";
};
};
};
}

@ -0,0 +1,32 @@
{ config, lib, ... }:
let cfg = config.programs.swaylock;
in {
meta.maintainers = [ lib.hm.maintainers.rcerc ];
options.programs.swaylock.settings = lib.mkOption {
type = with lib.types; attrsOf (oneOf [ bool float int str ]);
default = { };
description = ''
Default arguments to <command>swaylock</command>. An empty set
disables configuration generation.
'';
example = {
color = "808080";
font-size = 24;
indicator-idle-visible = false;
indicator-radius = 100;
line-color = "ffffff";
show-failed-attempts = true;
};
};
config.xdg.configFile."swaylock/config" = lib.mkIf (cfg.settings != { }) {
text = lib.concatStrings (lib.mapAttrsToList (n: v:
if v == false then
""
else
(if v == true then n else n + "=" + builtins.toString v) + "\n")
cfg.settings);
};
}

@ -0,0 +1,53 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.tealdeer;
tomlFormat = pkgs.formats.toml { };
configDir = if pkgs.stdenv.isDarwin then
"Library/Application Support"
else
config.xdg.configHome;
in {
meta.maintainers = [ maintainers.marsam ];
options.programs.tealdeer = {
enable = mkEnableOption "Tealdeer";
settings = mkOption {
type = tomlFormat.type;
default = { };
defaultText = literalExpression "{ }";
example = literalExpression ''
{
display = {
compact = false;
use_pager = true;
};
updates = {
auto_update = false;
};
};
'';
description = ''
Configuration written to
<filename>$XDG_CONFIG_HOME/tealdeer/config.toml</filename> on Linux or
<filename>$HOME/Library/Application Support/tealdeer/config.toml</filename>
on Darwin. See
<link xlink:href="https://dbrgn.github.io/tealdeer/config.html"/>
for more information.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.tealdeer ];
home.file."${configDir}/tealdeer/config.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "tealdeer-config" cfg.settings;
};
};
}

@ -44,7 +44,7 @@ in {
systemd.user.services.getmail = {
Unit = { Description = "getmail email fetcher"; };
Service = { ExecStart = "${pkgs.getmail}/bin/getmail ${configFiles}"; };
Service = { ExecStart = "${pkgs.getmail6}/bin/getmail ${configFiles}"; };
};
systemd.user.timers.getmail = {

@ -197,6 +197,18 @@ in {
now.
'';
};
enableBashIntegration = mkEnableOption "Bash integration" // {
default = true;
};
enableZshIntegration = mkEnableOption "Zsh integration" // {
default = true;
};
enableFishIntegration = mkEnableOption "Fish integration" // {
default = true;
};
};
};
@ -224,9 +236,9 @@ in {
fi
'';
programs.bash.initExtra = gpgInitStr;
programs.zsh.initExtra = gpgInitStr;
programs.fish.interactiveShellInit = ''
programs.bash.initExtra = mkIf cfg.enableBashIntegration gpgInitStr;
programs.zsh.initExtra = mkIf cfg.enableZshIntegration gpgInitStr;
programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration ''
set -gx GPG_TTY (tty)
'';
}

@ -15,6 +15,13 @@ in {
Mako, lightweight notification daemon for Wayland
'';
package = mkOption {
type = types.package;
default = pkgs.mako;
defaultText = literalExpression "pkgs.mako";
description = "The mako package to use.";
};
maxVisible = mkOption {
default = 5;
type = types.nullOr types.int;
@ -295,11 +302,11 @@ in {
assertions =
[ (hm.assertions.assertPlatform "services.mako" pkgs platforms.linux) ];
home.packages = [ pkgs.mako ];
home.packages = [ cfg.package ];
xdg.configFile."mako/config" = {
onChange = ''
${pkgs.mako}/bin/makoctl reload || true
${cfg.package}/bin/makoctl reload || true
'';
text = ''
${optionalInteger "max-visible" cfg.maxVisible}

@ -0,0 +1,136 @@
{ config, options, lib, pkgs, ... }:
with lib;
let
cfg = config.services.mopidy;
# The configuration format of Mopidy. It seems to use configparser with
# some quirky handling of its types. You can see how they're handled in
# `mopidy/config/types.py` from the source code.
toMopidyConf = generators.toINI {
mkKeyValue = generators.mkKeyValueDefault {
mkValueString = v:
if isList v then
"\n " + concatStringsSep "\n " v
else
generators.mkValueStringDefault { } v;
} " = ";
};
mopidyEnv = pkgs.buildEnv {
name = "mopidy-with-extensions-${pkgs.mopidy.version}";
paths = closePropagation cfg.extensionPackages;
pathsToLink = [ "/${pkgs.mopidyPackages.python.sitePackages}" ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
makeWrapper ${pkgs.mopidy}/bin/mopidy $out/bin/mopidy \
--prefix PYTHONPATH : $out/${pkgs.mopidyPackages.python.sitePackages}
'';
};
# Nix-representable format for Mopidy config.
mopidyConfFormat = { }: {
type = with types;
let
valueType = nullOr (oneOf [ bool float int str (listOf valueType) ])
// {
description = "Mopidy config value";
};
in attrsOf (attrsOf valueType);
generate = name: value: pkgs.writeText name (toMopidyConf value);
};
settingsFormat = mopidyConfFormat { };
in {
meta.maintainers = [ hm.maintainers.foo-dogsquared ];
options.services.mopidy = {
enable = mkEnableOption "Mopidy music player daemon";
extensionPackages = mkOption {
type = with types; listOf package;
default = [ ];
example = literalExpression
"with pkgs; [ mopidy-spotify mopidy-mpd mopidy-mpris ]";
description = ''
Mopidy extensions that should be loaded by the service.
'';
};
settings = mkOption {
type = settingsFormat.type;
default = { };
example = literalExpression ''
{
file = {
media_dirs = [
"$XDG_MUSIC_DIR|Music"
"~/library|Library"
];
follow_symlinks = true;
excluded_file_extensions = [
".html"
".zip"
".jpg"
".jpeg"
".png"
];
};
# Please don't put your mopidy-spotify configuration in the public. :)
# Think of your Spotify Premium subscription!
spotify = {
client_id = "CLIENT_ID";
client_secret = "CLIENT_SECRET";
};
}
'';
description = ''
Configuration written to
<filename>$XDG_CONFIG_HOME/mopidy/mopidy.conf</filename>.
</para><para>
See <link xlink:href="https://docs.mopidy.com/en/latest/config/"/> for
more details.
'';
};
};
config = mkIf cfg.enable {
assertions =
[ (hm.assertions.assertPlatform "services.mopidy" pkgs platforms.linux) ];
xdg.configFile."mopidy/mopidy.conf".source =
settingsFormat.generate "mopidy-${config.home.username}" cfg.settings;
systemd.user.services.mopidy = {
Unit = {
Description = "mopidy music player daemon";
Documentation = [ "https://mopidy.com/" ];
After = [ "network.target" "sound.target" ];
};
Service = { ExecStart = "${mopidyEnv}/bin/mopidy"; };
Install.WantedBy = [ "default.target" ];
};
systemd.user.services.mopidy-scan = {
Unit = {
Description = "mopidy local files scanner";
Documentation = [ "https://mopidy.com/" ];
After = [ "network.target" "sound.target" ];
};
Service = {
ExecStart = "${mopidyEnv}/bin/mopidy local scan";
Type = "oneshot";
};
Install.WantedBy = [ "default.target" ];
};
};
}

@ -21,6 +21,8 @@ let
host = cfg.mpd.host;
port = cfg.mpd.port;
music_dir = cfg.mpd.musicDirectory;
} // optionalAttrs (cfg.mpd.password != null) {
password = cfg.mpd.password;
};
Bling = {
@ -70,6 +72,14 @@ in {
If set, mpDris2 will use this directory to access music artwork.
'';
};
password = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
The password to connect to MPD.
'';
};
};
};
@ -77,11 +87,6 @@ in {
assertions = [
(lib.hm.assertions.assertPlatform "services.mpdris2" pkgs
lib.platforms.linux)
{
assertion = config.services.mpd.enable;
message = "The mpdris2 module requires 'services.mpd.enable = true'.";
}
];
xdg.configFile."mpDris2/mpDris2.conf".text = toIni mpdris2Conf;

@ -15,8 +15,8 @@ let
mkEvent = e: [ e.event (escapeShellArg e.command) ];
args = (concatMap mkTimeout cfg.timeouts) ++ (concatMap mkEvent cfg.events)
++ cfg.extraArgs;
args = cfg.extraArgs ++ (concatMap mkTimeout cfg.timeouts)
++ (concatMap mkEvent cfg.events);
in {
meta.maintainers = [ maintainers.c0deaddict ];

@ -431,12 +431,14 @@ in {
home.packages = optional (cfg.package != null) cfg.package
++ optional cfg.xwayland pkgs.xwayland;
xdg.configFile."sway/config" = {
xdg.configFile."sway/config" = let
swayPackage = if cfg.package == null then pkgs.sway else cfg.package;
in {
source = configFile;
onChange = ''
swaySocket="''${XDG_RUNTIME_DIR:-/run/user/$UID}/sway-ipc.$UID.$(${pkgs.procps}/bin/pgrep --uid $UID -x sway || true).sock"
if [ -S "$swaySocket" ]; then
${pkgs.sway}/bin/swaymsg -s $swaySocket reload
${swayPackage}/bin/swaymsg -s $swaySocket reload
fi
'';
};

@ -1,90 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.xsession.pointerCursor;
cursorType = types.submodule {
options = {
package = mkOption {
type = types.package;
example = literalExpression "pkgs.vanilla-dmz";
description = "Package providing the cursor theme.";
};
name = mkOption {
type = types.str;
example = "Vanilla-DMZ";
description = "The cursor name within the package.";
};
size = mkOption {
type = types.int;
default = 32;
example = 64;
description = "The cursor size.";
};
defaultCursor = mkOption {
type = types.str;
default = "left_ptr";
example = "X_cursor";
description = "The default cursor file to use within the package.";
};
};
};
cursorPath = "${cfg.package}/share/icons/${escapeShellArg cfg.name}/cursors/${
escapeShellArg cfg.defaultCursor
}";
in {
meta.maintainers = [ maintainers.league ];
options = {
xsession.pointerCursor = mkOption {
type = types.nullOr cursorType;
default = null;
description = ''
The X cursor theme and settings. The package
<varname>xorg.xcursorthemes</varname> contains cursors named
whiteglass, redglass, and handhelds. The package
<varname>vanilla-dmz</varname> contains cursors named Vanilla-DMZ
and Vanilla-DMZ-AA. Note: handhelds does not seem to work at
custom sizes.
'';
};
};
config = mkIf (cfg != null) {
assertions = [
(hm.assertions.assertPlatform "xsession.pointerCursor" pkgs
platforms.linux)
];
home.packages = [ cfg.package ];
xsession.initExtra = ''
${pkgs.xorg.xsetroot}/bin/xsetroot -xcf ${cursorPath} ${toString cfg.size}
'';
xresources.properties = {
"Xcursor.theme" = cfg.name;
"Xcursor.size" = cfg.size;
};
gtk.cursorTheme = mkDefault { inherit (cfg) package name size; };
# Set name in icons theme, for compatibility with AwesomeWM etc. See:
# https://github.com/nix-community/home-manager/issues/2081
# https://wiki.archlinux.org/title/Cursor_themes#XDG_specification
home.file.".icons/default/index.theme".text = ''
[icon theme]
Name=Default
Comment=Default Cursor Theme
Inherits=${cfg.name}
'';
};
}

@ -6,140 +6,26 @@ let
cfg = config.home-manager;
extendedLib = import ../modules/lib/stdlib-extended.nix pkgs.lib;
hmModule = types.submoduleWith {
specialArgs = {
lib = extendedLib;
darwinConfig = config;
osConfig = config;
modulesPath = builtins.toString ../modules;
} // cfg.extraSpecialArgs;
modules = [
({ name, ... }: {
imports = import ../modules/modules.nix {
inherit pkgs;
lib = extendedLib;
useNixpkgsModule = !cfg.useGlobalPkgs;
};
config = {
submoduleSupport.enable = true;
submoduleSupport.externalPackageInstall = cfg.useUserPackages;
home.username = config.users.users.${name}.name;
home.homeDirectory = config.users.users.${name}.home;
# Make activation script use same version of Nix as system as a whole.
# This avoids problems with Nix not being in PATH.
home.extraActivationPath = [ config.nix.package ];
};
})
] ++ cfg.sharedModules;
};
in
{
options = {
home-manager = {
useUserPackages = mkEnableOption ''
installation of user packages through the
<option>users.users.&lt;name?&gt;.packages</option> option.
'';
useGlobalPkgs = mkEnableOption ''
using the system configuration's <literal>pkgs</literal>
argument in Home Manager. This disables the Home Manager
options <option>nixpkgs.*</option>
'';
backupFileExtension = mkOption {
type = types.nullOr types.str;
default = null;
example = "backup";
description = ''
On activation move existing files by appending the given
file extension rather than exiting with an error.
'';
};
extraSpecialArgs = mkOption {
type = types.attrs;
default = { };
example = literalExpression "{ inherit emacs-overlay; }";
description = ''
Extra <literal>specialArgs</literal> passed to Home Manager. This
option can be used to pass additional arguments to all modules.
'';
};
sharedModules = mkOption {
type = with types;
# TODO: use types.raw once this PR is merged: https://github.com/NixOS/nixpkgs/pull/132448
listOf (mkOptionType {
name = "submodule";
inherit (submodule { }) check;
merge = lib.options.mergeOneOption;
description = "Home Manager modules";
});
default = [ ];
example = literalExpression "[ { home.packages = [ nixpkgs-fmt ]; } ]";
description = ''
Extra modules added to all users.
'';
};
verbose = mkEnableOption "verbose output on activation";
users = mkOption {
type = types.attrsOf hmModule;
default = {};
# Set as not visible to prevent the entire submodule being included in
# the documentation.
visible = false;
description = ''
Per-user Home Manager configuration.
'';
};
};
};
config = mkIf (cfg.users != {}) {
warnings =
flatten (flip mapAttrsToList cfg.users (user: config:
flip map config.warnings (warning:
"${user} profile: ${warning}"
)
));
assertions =
flatten (flip mapAttrsToList cfg.users (user: config:
flip map config.assertions (assertion:
{
inherit (assertion) assertion;
message = "${user} profile: ${assertion.message}";
in {
imports = [ ../integration-common.nix ];
config = mkMerge [
{ home-manager.extraSpecialArgs.darwinConfig = config; }
(mkIf (cfg.users != { }) {
system.activationScripts.postActivation.text = concatStringsSep "\n"
(mapAttrsToList (username: usercfg: ''
echo Activating home-manager configuration for ${username}
sudo -u ${username} -s --set-home ${
pkgs.writeShellScript "activation-${username}" ''
${lib.optionalString (cfg.backupFileExtension != null)
"export HOME_MANAGER_BACKUP_EXT=${
lib.escapeShellArg cfg.backupFileExtension
}"}
${lib.optionalString cfg.verbose "export VERBOSE=1"}
exec ${usercfg.home.activationPackage}/activate
''
}
)
));
users.users = mkIf cfg.useUserPackages (
mapAttrs (username: usercfg: {
packages = [ usercfg.home.path ];
}) cfg.users
);
environment.pathsToLink = mkIf cfg.useUserPackages [ "/etc/profile.d" ];
system.activationScripts.postActivation.text =
concatStringsSep "\n" (mapAttrsToList (username: usercfg: ''
echo Activating home-manager configuration for ${username}
sudo -u ${username} -s --set-home ${pkgs.writeShellScript "activation-${username}" ''
${lib.optionalString (cfg.backupFileExtension != null)
"export HOME_MANAGER_BACKUP_EXT=${lib.escapeShellArg cfg.backupFileExtension}"}
${lib.optionalString cfg.verbose "export VERBOSE=1"}
exec ${usercfg.home.activationPackage}/activate
''}
'') cfg.users);
};
'') cfg.users);
})
];
}

@ -6,180 +6,80 @@ let
cfg = config.home-manager;
extendedLib = import ../modules/lib/stdlib-extended.nix pkgs.lib;
hmModule = types.submoduleWith {
specialArgs = {
lib = extendedLib;
nixosConfig = config;
osConfig = config;
modulesPath = builtins.toString ../modules;
} // cfg.extraSpecialArgs;
modules = [
({ name, ... }: {
imports = import ../modules/modules.nix {
inherit pkgs;
lib = extendedLib;
useNixpkgsModule = !cfg.useGlobalPkgs;
};
config = {
submoduleSupport.enable = true;
submoduleSupport.externalPackageInstall = cfg.useUserPackages;
# The per-user directory inside /etc/profiles is not known by
# fontconfig by default.
fonts.fontconfig.enable = cfg.useUserPackages
&& config.fonts.fontconfig.enable;
home.username = config.users.users.${name}.name;
home.homeDirectory = config.users.users.${name}.home;
# Make activation script use same version of Nix as system as a whole.
# This avoids problems with Nix not being in PATH.
home.extraActivationPath = [ config.nix.package ];
};
})
] ++ cfg.sharedModules;
};
serviceEnvironment = optionalAttrs (cfg.backupFileExtension != null) {
HOME_MANAGER_BACKUP_EXT = cfg.backupFileExtension;
} // optionalAttrs cfg.verbose { VERBOSE = "1"; };
in {
options = {
home-manager = {
useUserPackages = mkEnableOption ''
installation of user packages through the
<option>users.users.&lt;name&gt;.packages</option> option
'';
useGlobalPkgs = mkEnableOption ''
using the system configuration's <literal>pkgs</literal>
argument in Home Manager. This disables the Home Manager
options <option>nixpkgs.*</option>
'';
backupFileExtension = mkOption {
type = types.nullOr types.str;
default = null;
example = "backup";
description = ''
On activation move existing files by appending the given
file extension rather than exiting with an error.
'';
};
extraSpecialArgs = mkOption {
type = types.attrs;
default = { };
example = literalExpression "{ inherit emacs-overlay; }";
description = ''
Extra <literal>specialArgs</literal> passed to Home Manager. This
option can be used to pass additional arguments to all modules.
'';
};
imports = [ ../integration-common.nix ];
sharedModules = mkOption {
type = with types;
# TODO: use types.raw once this PR is merged: https://github.com/NixOS/nixpkgs/pull/132448
listOf (mkOptionType {
name = "submodule";
inherit (submodule { }) check;
merge = lib.options.mergeOneOption;
description = "Home Manager modules";
});
default = [ ];
example = literalExpression "[ { home.packages = [ nixpkgs-fmt ]; } ]";
description = ''
Extra modules added to all users.
'';
};
config = mkMerge [
{
home-manager = {
extraSpecialArgs.nixosConfig = config;
verbose = mkEnableOption "verbose output on activation";
users = mkOption {
type = types.attrsOf hmModule;
default = { };
# Set as not visible to prevent the entire submodule being included in
# the documentation.
visible = false;
description = ''
Per-user Home Manager configuration.
'';
sharedModules = [{
# The per-user directory inside /etc/profiles is not known by
# fontconfig by default.
fonts.fontconfig.enable = cfg.useUserPackages
&& config.fonts.fontconfig.enable;
}];
};
};
};
config = mkIf (cfg.users != { }) {
warnings = flatten (flip mapAttrsToList cfg.users (user: config:
flip map config.warnings (warning: "${user} profile: ${warning}")));
assertions = flatten (flip mapAttrsToList cfg.users (user: config:
flip map config.assertions (assertion: {
inherit (assertion) assertion;
message = "${user} profile: ${assertion.message}";
})));
users.users = mkIf cfg.useUserPackages
(mapAttrs (username: usercfg: { packages = [ usercfg.home.path ]; })
cfg.users);
environment.pathsToLink = mkIf cfg.useUserPackages [ "/etc/profile.d" ];
systemd.services = mapAttrs' (_: usercfg:
let username = usercfg.home.username;
in nameValuePair ("home-manager-${utils.escapeSystemdPath username}") {
description = "Home Manager environment for ${username}";
wantedBy = [ "multi-user.target" ];
wants = [ "nix-daemon.socket" ];
after = [ "nix-daemon.socket" ];
before = [ "systemd-user-sessions.service" ];
environment = serviceEnvironment;
unitConfig = { RequiresMountsFor = usercfg.home.homeDirectory; };
stopIfChanged = false;
serviceConfig = {
User = usercfg.home.username;
Type = "oneshot";
RemainAfterExit = "yes";
TimeoutStartSec = 90;
SyslogIdentifier = "hm-activate-${username}";
ExecStart = let
systemctl =
"XDG_RUNTIME_DIR=\${XDG_RUNTIME_DIR:-/run/user/$UID} systemctl";
sed = "${pkgs.gnused}/bin/sed";
exportedSystemdVariables = concatStringsSep "|" [
"DBUS_SESSION_BUS_ADDRESS"
"DISPLAY"
"WAYLAND_DISPLAY"
"XAUTHORITY"
"XDG_RUNTIME_DIR"
];
setupEnv = pkgs.writeScript "hm-setup-env" ''
#! ${pkgs.runtimeShell} -el
# The activation script is run by a login shell to make sure
# that the user is given a sane environment.
# If the user is logged in, import variables from their current
# session environment.
eval "$(
${systemctl} --user show-environment 2> /dev/null \
| ${sed} -En '/^(${exportedSystemdVariables})=/s/^/export /p'
)"
exec "$1/activate"
'';
in "${setupEnv} ${usercfg.home.activationPackage}";
};
}) cfg.users;
};
}
(mkIf (cfg.users != { }) {
systemd.services = mapAttrs' (_: usercfg:
let username = usercfg.home.username;
in nameValuePair ("home-manager-${utils.escapeSystemdPath username}") {
description = "Home Manager environment for ${username}";
wantedBy = [ "multi-user.target" ];
wants = [ "nix-daemon.socket" ];
after = [ "nix-daemon.socket" ];
before = [ "systemd-user-sessions.service" ];
environment = serviceEnvironment;
unitConfig = { RequiresMountsFor = usercfg.home.homeDirectory; };
stopIfChanged = false;
serviceConfig = {
User = usercfg.home.username;
Type = "oneshot";
RemainAfterExit = "yes";
TimeoutStartSec = 90;
SyslogIdentifier = "hm-activate-${username}";
ExecStart = let
systemctl =
"XDG_RUNTIME_DIR=\${XDG_RUNTIME_DIR:-/run/user/$UID} systemctl";
sed = "${pkgs.gnused}/bin/sed";
exportedSystemdVariables = concatStringsSep "|" [
"DBUS_SESSION_BUS_ADDRESS"
"DISPLAY"
"WAYLAND_DISPLAY"
"XAUTHORITY"
"XDG_RUNTIME_DIR"
];
setupEnv = pkgs.writeScript "hm-setup-env" ''
#! ${pkgs.runtimeShell} -el
# The activation script is run by a login shell to make sure
# that the user is given a sane environment.
# If the user is logged in, import variables from their current
# session environment.
eval "$(
${systemctl} --user show-environment 2> /dev/null \
| ${sed} -En '/^(${exportedSystemdVariables})=/s/^/export /p'
)"
exec "$1/activate"
'';
in "${setupEnv} ${usercfg.home.activationPackage}";
};
}) cfg.users;
})
];
}

@ -4,12 +4,7 @@ let
lib = import ../modules/lib/stdlib-extended.nix pkgs.lib;
nmt = pkgs.fetchFromGitLab {
owner = "rycee";
repo = "nmt";
rev = "d83601002c99b78c89ea80e5e6ba21addcfe12ae";
sha256 = "1xzwwxygzs1cmysg97hzd285r7n1g1lwx5y1ar68gwq07a1rczmv";
};
inherit ((import ./.. { }).inputs) nmt;
modules = import ../modules/modules.nix {
inherit lib pkgs;
@ -46,6 +41,7 @@ import nmt {
./modules/home-environment
./modules/misc/fontconfig
./modules/misc/nix
./modules/misc/specialization
./modules/programs/alacritty
./modules/programs/alot
./modules/programs/aria2
@ -134,6 +130,7 @@ import nmt {
./modules/programs/rbw
./modules/programs/rofi
./modules/programs/rofi-pass
./modules/programs/swaylock
./modules/programs/terminator
./modules/programs/waybar
./modules/programs/xmobar
@ -152,7 +149,9 @@ import nmt {
./modules/services/home-manager-auto-upgrade
./modules/services/kanshi
./modules/services/lieer
./modules/services/mopidy
./modules/services/mpd
./modules/services/mpdris2
./modules/services/pantalaimon
./modules/services/pbgopy
./modules/services/picom

@ -0,0 +1,18 @@
{ config, lib, pkgs, ... }:
with lib;
{
home.file.testfile.text = "not special";
specialization.test.configuration = {
home.file.testfile.text = "very special";
};
nmt.script = ''
assertFileExists home-files/testfile
assertFileContains home-files/testfile "not special"
assertFileExists specialization/test/home-files/testfile
assertFileContains specialization/test/home-files/testfile "not special"
'';
}

@ -5,16 +5,32 @@ let
testScript = pkgs.writeText "test.el" ''
;; Emacs won't automatically load default.el when --script is specified
(load "default")
(kill-emacs (if (eq hm 'home-manager) 0 1))
(let* ((test-load-config (eq hm 'home-manager))
(test-load-package (eq (hm-test-fn) 'success))
(is-ok (and test-load-config test-load-package)))
(kill-emacs (if is-ok 0 1)))
'';
emacsBin = "${config.programs.emacs.finalPackage}/bin/emacs";
mkTestPackage = epkgs:
epkgs.trivialBuild {
pname = "hm-test";
src = pkgs.writeText "hm-test.el" ''
(defun hm-test-fn () 'success)
(provide 'hm-test)
'';
};
in lib.mkIf config.test.enableBig {
programs.emacs = {
enable = true;
package = pkgs.emacs-nox;
extraConfig = "(setq hm 'home-manager)";
extraConfig = ''
(require 'hm-test)
(setq hm 'home-manager)
'';
extraPackages = epkgs: [ (mkTestPackage epkgs) ];
};
# running emacs with --script would enable headless mode

@ -4,18 +4,20 @@ name = ""
["hm@example.com"]
default = true
default-page-size = 50
draft-folder = "Drafts"
email = "hm@example.com"
imap-host = "imap.example.com"
imap-login = "home.manager"
imap-passwd-cmd = "'password-command'"
imap-port = 995
imap-starttls = false
inbox-folder = "In"
name = "H. M. Test"
sent-folder = "Out"
smtp-host = "smtp.example.com"
smtp-login = "home.manager"
smtp-passwd-cmd = "'password-command'"
smtp-port = 465
smtp-starttls = false
["hm@example.com".mailboxes]
draft = "Drafts"
inbox = "In"
sent = "Out"

@ -17,7 +17,12 @@ with lib;
# Test that the 'fields' key is written in addition to the customized
# settings or htop won't read the options.
nmt.script = ''
nmt.script = let
fields = if pkgs.stdenv.hostPlatform.isDarwin then
"0 48 17 18 38 39 2 46 47 49 1"
else
"0 48 17 18 38 39 40 2 46 47 49 1";
in ''
htoprc=home-files/.config/htop/htoprc
assertFileExists $htoprc
assertFileContent $htoprc \
@ -28,7 +33,7 @@ with lib;
column_meters_1=Tasks LoadAverage Uptime Systemd
column_meters_modes_0=1 1 1 2
column_meters_modes_1=2 2 2 2
fields=0 48 17 18 38 39 40 2 46 47 49 1
fields=${fields}
''
}
'';

@ -11,14 +11,19 @@ with lib;
# Test that the 'fields' key is written in addition to the customized
# settings or htop won't read the options.
nmt.script = ''
nmt.script = let
fields = if pkgs.stdenv.hostPlatform.isDarwin then
"0 48 17 18 38 39 2 46 47 49 1"
else
"0 48 17 18 38 39 40 2 46 47 49 1";
in ''
htoprc=home-files/.config/htop/htoprc
assertFileExists $htoprc
assertFileContent $htoprc \
${
builtins.toFile "htoprc-expected" ''
color_scheme=6
fields=0 48 17 18 38 39 40 2 46 47 49 1
fields=${fields}
''
}
'';

@ -9,4 +9,6 @@
neomutt-with-gpg = ./neomutt-with-gpg.nix;
neomutt-no-folder-change = ./neomutt-no-folder-change.nix;
neomutt-with-named-mailboxes = ./neomutt-with-named-mailboxes.nix;
neomutt-with-signature = ./neomutt-with-signature.nix;
neomutt-with-signature-command = ./neomutt-with-signature-command.nix;
}

@ -31,6 +31,7 @@ set trash='+Trash'
# Extra configuration
color status cyan default
unset signature
# notmuch section
set nm_default_uri = "notmuch:///home/hm-user/Mail"

@ -30,4 +30,5 @@ set trash='+Trash'
# Extra configuration
unset signature

@ -30,4 +30,5 @@ set trash='+Trash'
# Extra configuration
color status cyan default
unset signature

@ -0,0 +1,38 @@
# Generated by Home Manager.
set ssl_force_tls = yes
set certificate_file=/etc/ssl/certs/ca-certificates.crt
# GPG section
set crypt_use_gpgme = yes
set crypt_autosign = no
set crypt_opportunistic_encrypt = no
set pgp_use_gpg_agent = yes
set mbox_type = Maildir
set sort = "threads"
# MTA section
set smtp_pass="`password-command`"
set smtp_url='smtps://home.manager@smtp.example.com'
# MRA section
set folder='/home/hm-user/Mail/hm@example.com'
set from='hm@example.com'
set postponed='+Drafts'
set realname='H. M. Test'
set record='+Sent'
set spoolfile='+Inbox'
set trash='+Trash'
# Extra configuration
color status cyan default
set signature = "/nix/store/00000000000000000000000000000000-signature|"
# notmuch section
set nm_default_uri = "notmuch:///home/hm-user/Mail"
virtual-mailboxes "My INBOX" "notmuch://?query=tag:inbox"

@ -0,0 +1,38 @@
# Generated by Home Manager.
set ssl_force_tls = yes
set certificate_file=/etc/ssl/certs/ca-certificates.crt
# GPG section
set crypt_use_gpgme = yes
set crypt_autosign = no
set crypt_opportunistic_encrypt = no
set pgp_use_gpg_agent = yes
set mbox_type = Maildir
set sort = "threads"
# MTA section
set smtp_pass="`password-command`"
set smtp_url='smtps://home.manager@smtp.example.com'
# MRA section
set folder='/home/hm-user/Mail/hm@example.com'
set from='hm@example.com'
set postponed='+Drafts'
set realname='H. M. Test'
set record='+Sent'
set spoolfile='+Inbox'
set trash='+Trash'
# Extra configuration
color status cyan default
set signature = /nix/store/00000000000000000000000000000000-signature.txt
# notmuch section
set nm_default_uri = "notmuch:///home/hm-user/Mail"
virtual-mailboxes "My INBOX" "notmuch://?query=tag:inbox"

@ -0,0 +1,45 @@
{ config, lib, pkgs, ... }:
with lib;
{
imports = [ ../../accounts/email-test-accounts.nix ];
config = {
accounts.email.accounts = {
"hm@example.com" = {
notmuch.enable = true;
neomutt = {
enable = true;
extraConfig = ''
color status cyan default
'';
};
imap.port = 993;
signature = {
showSignature = "append";
command = pkgs.writeScript "signature" "echo This is my signature";
};
};
};
programs.neomutt = {
enable = true;
vimKeys = false;
};
test.stubs.neomutt = { };
nmt.script = ''
assertFileExists home-files/.config/neomutt/neomuttrc
assertFileExists home-files/.config/neomutt/hm@example.com
assertFileContent home-files/.config/neomutt/neomuttrc ${
./neomutt-expected.conf
}
expectedSignature=$(normalizeStorePaths "home-files/.config/neomutt/hm@example.com")
assertFileContent "$expectedSignature" ${
./hm-example.com-signature-command-expected
}
'';
};
}

@ -0,0 +1,48 @@
{ config, lib, pkgs, ... }:
with lib;
{
imports = [ ../../accounts/email-test-accounts.nix ];
config = {
accounts.email.accounts = {
"hm@example.com" = {
notmuch.enable = true;
neomutt = {
enable = true;
extraConfig = ''
color status cyan default
'';
};
imap.port = 993;
signature = {
showSignature = "append";
text = ''
--
Test Signature
'';
};
};
};
programs.neomutt = {
enable = true;
vimKeys = false;
};
test.stubs.neomutt = { };
nmt.script = ''
assertFileExists home-files/.config/neomutt/neomuttrc
assertFileExists home-files/.config/neomutt/hm@example.com
assertFileContent home-files/.config/neomutt/neomuttrc ${
./neomutt-expected.conf
}
expectedSignature=$(normalizeStorePaths "home-files/.config/neomutt/hm@example.com")
assertFileContent "$expectedSignature" ${
./hm-example.com-signature-expected
}
'';
};
}

@ -0,0 +1,5 @@
color=808080
font-size=24
indicator-radius=100
line-color=ffffff
show-failed-attempts

@ -0,0 +1,4 @@
{
swaylock-disabled = import ./disabled.nix;
swaylock-settings = import ./settings.nix;
}

@ -0,0 +1,7 @@
{ ... }: {
programs.swaylock.settings = { };
nmt.script = ''
assertPathNotExists home-files/.config/swaylock/config
'';
}

@ -0,0 +1,16 @@
{ ... }: {
programs.swaylock.settings = {
color = "808080";
font-size = 24;
indicator-idle-visible = false; # Test that this does nothing
indicator-radius = 100;
line-color = "ffffff";
show-failed-attempts = true;
};
nmt.script = let homeConfig = "home-files/.config/swaylock/config";
in ''
assertFileExists ${homeConfig}
assertFileContent ${homeConfig} ${./config}
'';
}

@ -0,0 +1,10 @@
[file]
enabled = true
media_dirs =
$XDG_MUSIC_DIR|Music
~/Downloads|Downloads
[spotify]
client_id = TOTALLY_NOT_A_FAKE_CLIENT_ID
client_secret = YOU_CAN_USE_ME_FOR_YOUR_SPOTIFY_PREMIUM_SUBSCRIPTION
enabled = true

@ -0,0 +1,38 @@
{ config, pkgs, ... }:
{
services.mopidy = {
enable = true;
settings = {
file = {
enabled = true;
media_dirs = [ "$XDG_MUSIC_DIR|Music" "~/Downloads|Downloads" ];
};
spotify = {
enabled = true;
client_id = "TOTALLY_NOT_A_FAKE_CLIENT_ID";
client_secret = "YOU_CAN_USE_ME_FOR_YOUR_SPOTIFY_PREMIUM_SUBSCRIPTION";
};
};
};
test.stubs.mopidy = {
version = "0";
outPath = null;
buildScript = ''
mkdir -p $out/bin
touch $out/bin/mopidy
chmod +x $out/bin/mopidy
'';
};
nmt.script = ''
assertFileExists home-files/.config/systemd/user/mopidy.service
assertFileExists home-files/.config/systemd/user/mopidy-scan.service
assertFileExists home-files/.config/mopidy/mopidy.conf
assertFileContent home-files/.config/mopidy/mopidy.conf \
${./basic-configuration.conf}
'';
}

@ -0,0 +1 @@
{ mopidy-basic-configuration = ./basic-configuration.nix; }

@ -0,0 +1,8 @@
[Bling]
mmkeys = True
notify = True
[Connection]
host = 127.0.0.1
music_dir = /home/hm-user/music
port = 6600

@ -0,0 +1,19 @@
{ ... }:
{
services.mpdris2 = {
enable = true;
notifications = true;
multimediaKeys = true;
};
test.stubs.mpdris2 = { };
nmt.script = ''
serviceFile=home-files/.config/systemd/user/mpdris2.service
assertFileContent "$serviceFile" ${./basic-configuration.service}
configFile=home-files/.config/mpDris2/mpDris2.conf
assertFileContent "$configFile" ${./basic-configuration.config}
'';
}

@ -0,0 +1,13 @@
[Install]
WantedBy=default.target
[Service]
BusName=org.mpris.MediaPlayer2.mpd
ExecStart=@mpdris2@/bin/mpDris2
Restart=on-failure
RestartSec=5s
Type=simple
[Unit]
After=mpd.service
Description=MPRIS 2 support for MPD

@ -0,0 +1,4 @@
{
mpdris2-basic-configuration = ./basic-configuration.nix;
mpdris2-with-password = ./with-password.nix;
}

@ -0,0 +1,9 @@
[Bling]
mmkeys = False
notify = False
[Connection]
host = somehost
music_dir = /home/hm-user/music
password = foo
port = 42

@ -0,0 +1,22 @@
{ ... }:
{
services.mpdris2 = {
enable = true;
mpd = {
host = "somehost";
port = 42;
password = "foo";
};
};
test.stubs.mpdris2 = { };
nmt.script = ''
serviceFile=home-files/.config/systemd/user/mpdris2.service
assertFileContent "$serviceFile" ${./basic-configuration.service}
configFile=home-files/.config/mpDris2/mpDris2.conf
assertFileContent "$configFile" ${./with-password.config}
'';
}
Loading…
Cancel
Save