1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-03-31 04:04:32 +00:00

Merge remote-tracking branch 'masterupstream/master'

This commit is contained in:
flakeuser 2025-03-13 09:23:29 -07:00
commit 948ff4966e
1035 changed files with 14126 additions and 9626 deletions

View file

@ -23,7 +23,8 @@ Also make sure to read the guidelines found at
- [ ] Code formatted with `./format`.
- [ ] Code tested through `nix-shell --pure tests -A run.all` or `nix develop --ignore-environment .#all` using Flakes.
- [ ] Code tested through `nix-shell --pure tests -A run.all`
or `nix build --reference-lock-file flake.lock ./tests#test-all` using Flakes.
- [ ] Test cases updated/added. See [example](https://github.com/nix-community/home-manager/commit/f3fbb50b68df20da47f9b0def5607857fcc0d021#diff-b61a6d542f9036550ba9c401c80f00ef).

9
.github/labeler.yml vendored
View file

@ -25,6 +25,15 @@
- modules/programs/neovim.nix
- tests/modules/programs/neovim/**/*
"program: firefox":
- changed-files:
- any-glob-to-any-file:
- modules/programs/firefox/**/*
- tests/modules/programs/firefox/**/*
- modules/misc/mozilla-messaging-hosts.nix
- modules/programs/floorp.nix
- modules/programs/librewolf.nix
"shell":
- changed-files:
- any-glob-to-any-file:

View file

@ -24,6 +24,6 @@ jobs:
- run: ./format -c
- run: nix-shell --show-trace . -A install
- run: yes | home-manager -I home-manager=. uninstall
- run: nix-shell --show-trace --arg enableBig false --pure tests -A run.all
# Somebody please help us fix the macos tests.
if: matrix.os != 'macos-latest'
- run: nix-shell -j auto --show-trace --arg enableBig false --pure tests -A run.all
env:
GC_INITIAL_HEAP_SIZE: 4294967296

View file

@ -1,6 +1,12 @@
{ pkgs ? import <nixpkgs> { } }:
rec {
let
path = builtins.path {
path = ./.;
name = "home-manager-source";
};
in rec {
docs = let releaseInfo = pkgs.lib.importJSON ./release.json;
in with import ./docs {
inherit pkgs;
@ -12,12 +18,13 @@ rec {
jsonModuleMaintainers = jsonModuleMaintainers; # Unstable, mainly for CI.
};
home-manager = pkgs.callPackage ./home-manager { path = toString ./.; };
home-manager = pkgs.callPackage ./home-manager { inherit path; };
install =
pkgs.callPackage ./home-manager/install.nix { inherit home-manager; };
nixos = import ./nixos;
lib = import ./lib { inherit (pkgs) lib; };
path = ./.;
inherit path;
}

View file

@ -29,10 +29,16 @@ through
$ nix-shell --pure tests -A run.alacritty-empty-settings
```
However, those invocations will impurely source the system's nixpkgs,
and may cause failures. To run against the nixpkgs from the flake.lock,
However, those invocations will impurely source the system's Nixpkgs,
and may cause failures. To run against the Nixpkgs from the `flake.lock` file,
use instead e.g.
``` shell
$ nix develop --ignore-environment .#all
$ nix build --reference-lock-file flake.lock ./tests#test-all
```
or
``` shell
$ nix build --reference-lock-file flake.lock ./tests#test-alacritty-empty-settings
```

View file

@ -42,9 +42,15 @@ home-manager.users.eve = { pkgs, ... }: {
home.packages = [ pkgs.atool pkgs.httpie ];
programs.bash.enable = true;
# The state version is required and should stay at the version you
# originally installed.
home.stateVersion = "24.11";
# 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 should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
home.stateVersion = "24.05"; # Please read the comment before changing.
};
```

View file

@ -30,6 +30,7 @@ nix-flakes/prerequisites.md
nix-flakes/standalone.md
nix-flakes/nixos.md
nix-flakes/nix-darwin.md
nix-flakes/flake-parts.md
```

View file

@ -0,0 +1,39 @@
# flake-parts module {#sec-flakes-flake-parts-module}
When using [flake-parts](https://flake.parts)
you may wish to import Home Manager's flake module,
`flakeModules.home-manager`.
``` nix
{
description = "flake-parts configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
# Import home-manager's flake module
inputs.home-manager.flakeModules.home-manager
];
flake = {
# Define `homeModules`, `homeConfigurations`,
# `nixosConfigurations`, etc here
};
# See flake.parts for more features, such as `perSystem`
};
}
```
The flake module defines the `flake.homeModules` and `flake.homeConfigurations`
options, allowing them to be properly merged if they are defined in multiple
modules.
If you are only defining `homeModules` and/or `homeConfigurations` once in a
single module, flake-parts should work fine without importing
`flakeModules.home-manager`.

View file

@ -17,6 +17,11 @@ This release has the following notable changes:
The `"suggest"` alternative will remain for a while longer but may
also be deprecated for removal in the future.
- The Home Manager test suite has been removed from the main Nix Flake
since it caused unnecessary evaluations and downloads. Instead the
tests are available through a Nix Flake file inside the `tests`
directory. See [](#sec-tests) for example commands.
## State Version Changes {#sec-release-25.05-state-version-changes}
The state version in this release includes the changes below. These

33
flake-module.nix Normal file
View file

@ -0,0 +1,33 @@
{ lib, flake-parts-lib, moduleLocation, ... }:
let inherit (lib) toString mapAttrs mkOption types;
in {
options = {
flake = flake-parts-lib.mkSubmoduleOptions {
homeConfigurations = mkOption {
type = types.lazyAttrsOf types.raw;
default = { };
description = ''
Instantiated Home Manager configurations.
`homeConfigurations` is for specific installations. If you want to expose
reusable configurations, add them to `homeModules` in the form of modules, so
that you can reference them in this or another flake's `homeConfigurations`.
'';
};
homeModules = mkOption {
type = types.lazyAttrsOf types.deferredModule;
default = { };
apply = mapAttrs (k: v: {
_class = "homeManager";
_file = "${toString moduleLocation}#homeModules.${k}";
imports = [ v ];
});
description = ''
Home Manager modules.
You may use this for reusable pieces of configuration, service modules, etc.
'';
};
};
};
}

6
flake.lock generated
View file

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1735834308,
"narHash": "sha256-dklw3AXr3OGO4/XT1Tu3Xz9n/we8GctZZ75ZWVqAVhk=",
"lastModified": 1741513245,
"narHash": "sha256-7rTAMNTY1xoBwz0h7ZMtEcd8LELk9R5TzBPoHuhNSCk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6df24922a1400241dae323af55f30e4318a6ca65",
"rev": "e3e32b642a31e6714ec1b712de8c91a3352ce7e1",
"type": "github"
},
"original": {

View file

@ -6,24 +6,22 @@
outputs = { self, nixpkgs, ... }:
{
nixosModules = rec {
home-manager = import ./nixos;
home-manager = ./nixos;
default = home-manager;
};
# deprecated in Nix 2.8
nixosModule = self.nixosModules.default;
darwinModules = rec {
home-manager = import ./nix-darwin;
home-manager = ./nix-darwin;
default = home-manager;
};
flakeModules = rec {
home-manager = ./flake-module.nix;
default = home-manager;
};
# unofficial; deprecated in Nix 2.8
darwinModule = self.darwinModules.default;
templates = {
standalone = {
path = ./templates/standalone;
description = "Standalone setup";
};
default = self.templates.standalone;
nixos = {
path = ./templates/nixos;
description = "Home Manager as a NixOS module,";
@ -32,69 +30,16 @@
path = ./templates/nix-darwin;
description = "Home Manager as a nix-darwin module,";
};
standalone = {
path = ./templates/standalone;
description = "Standalone setup";
};
};
defaultTemplate = self.templates.standalone;
lib = {
hm = (import ./modules/lib/stdlib-extended.nix nixpkgs.lib).hm;
homeManagerConfiguration = { modules ? [ ], pkgs, lib ? pkgs.lib
, extraSpecialArgs ? { }, check ? true
# Deprecated:
, configuration ? null, extraModules ? null, stateVersion ? null
, username ? null, homeDirectory ? null, system ? null }@args:
let
msgForRemovedArg = ''
The 'homeManagerConfiguration' arguments
- 'configuration',
- 'username',
- 'homeDirectory'
- 'stateVersion',
- 'extraModules', and
- 'system'
have been removed. Instead use the arguments 'pkgs' and
'modules'. See the 22.11 release notes for more: https://nix-community.github.io/home-manager/release-notes.xhtml#sec-release-22.11-highlights
'';
throwForRemovedArgs = v:
let
used = builtins.filter (n: (args.${n} or null) != null) [
"configuration"
"username"
"homeDirectory"
"stateVersion"
"extraModules"
"system"
];
msg = msgForRemovedArg + ''
Deprecated args passed: ''
+ builtins.concatStringsSep " " used;
in lib.throwIf (used != [ ]) msg v;
in throwForRemovedArgs (import ./modules {
inherit pkgs lib check extraSpecialArgs;
configuration = { ... }: {
imports = modules ++ [{ programs.home-manager.path = "${./.}"; }];
nixpkgs = {
config = nixpkgs.lib.mkDefault pkgs.config;
inherit (pkgs) overlays;
};
};
});
};
lib = import ./lib { inherit (nixpkgs) lib; };
} // (let
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
in {
devShells = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
tests = import ./tests { inherit pkgs; };
in tests.run);
formatter = forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in pkgs.linkFarm "format" [{
@ -105,23 +50,12 @@
packages = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
lib = pkgs.lib;
releaseInfo = nixpkgs.lib.importJSON ./release.json;
docs = import ./docs {
inherit pkgs;
inherit (releaseInfo) release isReleaseBranch;
};
hmPkg = pkgs.callPackage ./home-manager { path = "${./.}"; };
testPackages = let
tests = import ./tests { inherit pkgs; };
renameTestPkg = n: lib.nameValuePair "test-${n}";
in lib.mapAttrs' renameTestPkg tests.build;
integrationTestPackages = let
tests = import ./tests/integration { inherit pkgs; };
renameTestPkg = n: lib.nameValuePair "integration-test-${n}";
in lib.mapAttrs' renameTestPkg tests;
hmPkg = pkgs.callPackage ./home-manager { path = "${self}"; };
in {
default = hmPkg;
home-manager = hmPkg;
@ -129,8 +63,6 @@
docs-html = docs.manual.html;
docs-json = docs.options.json;
docs-manpages = docs.manPages;
} // testPackages // integrationTestPackages);
defaultPackage = forAllSystems (system: self.packages.${system}.default);
});
});
}

View file

@ -16,12 +16,12 @@ let
in runCommand "home-manager" {
preferLocalBuild = true;
nativeBuildInputs = [ gettext ];
meta = with lib; {
meta = {
mainProgram = "home-manager";
description = "A user environment configurator";
maintainers = [ maintainers.rycee ];
platforms = platforms.unix;
license = licenses.mit;
maintainers = [ lib.maintainers.rycee ];
platforms = lib.platforms.unix;
license = lib.licenses.mit;
};
} ''
install -v -D -m755 ${./home-manager} $out/bin/home-manager

262
home-manager/po/bg.po Normal file
View file

@ -0,0 +1,262 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Home Manager contributors
# This file is distributed under the same license as the Home Manager package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: Home Manager\n"
"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n"
"POT-Creation-Date: 2025-01-03 09:09+0100\n"
"PO-Revision-Date: 2025-01-30 16:22+0000\n"
"Last-Translator: Kiril Pan <eccyboo@protonmail.com>\n"
"Language-Team: Bulgarian <https://hosted.weblate.org/projects/home-manager/"
"cli/bg/>\n"
"Language: bg\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.10-dev\n"
#. translators: For example: "home-manager: missing argument for --cores"
#: home-manager/home-manager:16
msgid "%s: missing argument for %s"
msgstr "%s: липсващ аргумент за %s"
#: home-manager/home-manager:69
msgid "No configuration file found at %s"
msgstr "Не е намерен конфигурационен файл на %s"
#. translators: The first '%s' specifier will be replaced by either
#. 'home.nix' or 'flake.nix'.
#: home-manager/home-manager:86 home-manager/home-manager:90
#: home-manager/home-manager:189
msgid ""
"Keeping your Home Manager %s in %s is deprecated,\n"
"please move it to %s"
msgstr ""
"Запазването на Вашия Домоуправител %s в %s \n"
"е остаряла практика, моля преместете го в %s"
#: home-manager/home-manager:97
msgid "No configuration file found. Please create one at %s"
msgstr "Конфигурационният файл не намерен. Моля създайте такъв в %s"
#: home-manager/home-manager:112
msgid "Home Manager not found at %s."
msgstr "Home Manager не е открит в %s."
#. translators: This message will be seen by very few users that likely are familiar with English. So feel free to leave this untranslated.
#: home-manager/home-manager:120
msgid ""
"The fallback Home Manager path %s has been deprecated and a file/directory "
"was found there."
msgstr ""
"Изборът на резервната локация на Home Manager в %s е остаряла практика и "
"файлът/директорията беше намерен/а там."
#. translators: This message will be seen by very few users that likely are familiar with English. So feel free to leave this untranslated.
#: home-manager/home-manager:123
msgid ""
"To remove this warning, do one of the following.\n"
"\n"
"1. Explicitly tell Home Manager to use the path, for example by adding\n"
"\n"
" { programs.home-manager.path = \"%s\"; }\n"
"\n"
" to your configuration.\n"
"\n"
" If you import Home Manager directly, you can use the `path` parameter\n"
"\n"
" pkgs.callPackage /path/to/home-manager-package { path = \"%s\"; }\n"
"\n"
" when calling the Home Manager package.\n"
"\n"
"2. Remove the deprecated path.\n"
"\n"
" $ rm -r \"%s\""
msgstr ""
"За да премахнете това предупреждение, направенете една от следните опции:\n"
"\n"
"1. Изрично наредете на Home Manager да ползва локацията, като например "
"добавите:\n"
"\n"
" { programs.home-manager.path = \"%s\"; }\n"
"\n"
" в конфигурацията си.\n"
"\n"
" Ако импортирате Home Manager директно, можете да ползвате `path` "
"параметъра.\n"
"\n"
" pkgs.callPackage /path/to/home-manager-package { path = \"%s\"; }\n"
"\n"
" Когато повиквате Home Manager пакета.\n"
"\n"
"2. Премахнате остарялата локация.\n"
"\n"
" $ rm -r \"%s\""
#: home-manager/home-manager:151
msgid "Sanity checking Nix"
msgstr "Разумна проверка на Nix"
#: home-manager/home-manager:171
msgid "Could not find suitable profile directory, tried %s and %s"
msgstr "Не е намерена подходяща профилна директория, пробвани са %s и %s"
#. translators: Here "flake" is a noun that refers to the Nix Flakes feature.
#: home-manager/home-manager:226
msgid "Can't inspect options of a flake configuration"
msgstr "Опциите на флейк конфигурацията не могат да бъдат прегледани"
#: home-manager/home-manager:301 home-manager/home-manager:324
#: home-manager/home-manager:1061
msgid "%s: unknown option '%s'"
msgstr "%s: непозната опция '%s'"
#: home-manager/home-manager:306 home-manager/home-manager:1062
msgid "Run '%s --help' for usage help"
msgstr "Изпълнете командата '%s --help' за повече информация"
#: home-manager/home-manager:332 home-manager/home-manager:437
msgid "The file %s already exists, leaving it unchanged..."
msgstr "Файлът %s вече съществува, пропускане на промениете му..."
#: home-manager/home-manager:334 home-manager/home-manager:439
msgid "Creating %s..."
msgstr "Създаване на %s..."
#: home-manager/home-manager:481
msgid "Creating initial Home Manager generation..."
msgstr "Създаване на първоначалната Home Manager генерация..."
#. translators: The "%s" specifier will be replaced by a file path.
#: home-manager/home-manager:486
msgid ""
"All done! The home-manager tool should now be installed and you can edit\n"
"\n"
" %s\n"
"\n"
"to configure Home Manager. Run 'man home-configuration.nix' to\n"
"see all available options."
msgstr ""
"Всичко е готово! Инструментът home-manager е инсталиран и Вие можете да "
"редактирате\n"
"\n"
"....%s\n"
"\n"
"за да конфигурате Home Manager. Изпълнете командата 'man home-"
"configuration.nix'\n"
"за да видите всички налични опции."
#. translators: The "%s" specifier will be replaced by a URL.
#: home-manager/home-manager:491
msgid ""
"Uh oh, the installation failed! Please create an issue at\n"
"\n"
" %s\n"
"\n"
"if the error seems to be the fault of Home Manager."
msgstr ""
"О не, инсталацията се провали! Моля създайте запитване на\n"
"\n"
"....%s\n"
"\n"
"ако смятате, че грешката се дължи на Home Manager."
#. translators: Here "flake" is a noun that refers to the Nix Flakes feature.
#: home-manager/home-manager:502
msgid "Can't instantiate a flake configuration"
msgstr "Флейк конфигурацията не може да се инстанцира"
#: home-manager/home-manager:578
msgid ""
"There is %d unread and relevant news item.\n"
"Read it by running the command \"%s news\"."
msgid_plural ""
"There are %d unread and relevant news items.\n"
"Read them by running the command \"%s news\"."
msgstr[0] ""
"Има %d непрочетена релевантна новина.\n"
"Прочетете я като изпълните \"%s news\" командата."
msgstr[1] ""
"Има %d непрочетени релевантни новини.\n"
"Прочетете ги като изпълните \"%s news\" командата."
#: home-manager/home-manager:592
msgid "Unknown \"news.display\" setting \"%s\"."
msgstr "Непозната \"news.display\" настройка \"%s\"."
#: home-manager/home-manager:600
#, sh-format
msgid "Please set the $EDITOR or $VISUAL environment variable"
msgstr "Моля задайте $EDITOR или $VISUAL променливите на средата"
#: home-manager/home-manager:618
msgid "Cannot run build in read-only directory"
msgstr ""
"Компилацията не може да се стартира в директория предназначена само за четене"
#: home-manager/home-manager:699
msgid "No generation with ID %s"
msgstr "Не е намерена генерация с ID %s"
#: home-manager/home-manager:701
msgid "Cannot remove the current generation %s"
msgstr "Не може да бъде премахната сегашната генерация %s"
#: home-manager/home-manager:703
msgid "Removing generation %s"
msgstr "Премахване генерацията %s"
#: home-manager/home-manager:724
msgid "No generations to expire"
msgstr "Няма изтичащи генерации"
#: home-manager/home-manager:735
msgid "No home-manager packages seem to be installed."
msgstr "Изглежда няма нито един инсталиран home-manager пакет."
#: home-manager/home-manager:820
msgid "Unknown argument %s"
msgstr "Непознат аргумент %s"
#: home-manager/home-manager:845
msgid "This will remove Home Manager from your system."
msgstr "Това ще премахне Home Manager от системата Ви."
#: home-manager/home-manager:848
msgid "This is a dry run, nothing will actually be uninstalled."
msgstr "Това е сухо изпълнение - нищо няма да бъде деинсталирано."
#: home-manager/home-manager:852
msgid "Really uninstall Home Manager?"
msgstr "Наистина ли искате да деинсталирате Home Manager?"
#: home-manager/home-manager:858
msgid "Switching to empty Home Manager configuration..."
msgstr "Превключване към празна Home Manager конфигурация..."
#: home-manager/home-manager:873
msgid "Yay!"
msgstr "Ура!"
#: home-manager/home-manager:878
msgid "Home Manager is uninstalled but your home.nix is left untouched."
msgstr ""
"Home Manager бе деинсталиран но Вашия home.nix файл е оставен непроменен."
#: home-manager/home-manager:1101
msgid "expire-generations expects one argument, got %d."
msgstr "expire-generations очаква един аргумент, получил е %d."
#: home-manager/home-manager:1123
msgid "Unknown command: %s"
msgstr "Непозната команда: %s"
#: home-manager/install.nix:18
msgid "This derivation is not buildable, please run it using nix-shell."
msgstr ""
"Тази деривация не може да се компилира, моля стартирайте я ползвайки nix-"
"shell."

216
home-manager/po/tok.po Normal file
View file

@ -0,0 +1,216 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Home Manager contributors
# This file is distributed under the same license as the Home Manager package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: Home Manager\n"
"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n"
"POT-Creation-Date: 2025-01-03 09:09+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: tok\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#. translators: For example: "home-manager: missing argument for --cores"
#: home-manager/home-manager:16
msgid "%s: missing argument for %s"
msgstr ""
#: home-manager/home-manager:69
msgid "No configuration file found at %s"
msgstr ""
#. translators: The first '%s' specifier will be replaced by either
#. 'home.nix' or 'flake.nix'.
#: home-manager/home-manager:86 home-manager/home-manager:90
#: home-manager/home-manager:189
msgid ""
"Keeping your Home Manager %s in %s is deprecated,\n"
"please move it to %s"
msgstr ""
#: home-manager/home-manager:97
msgid "No configuration file found. Please create one at %s"
msgstr ""
#: home-manager/home-manager:112
msgid "Home Manager not found at %s."
msgstr ""
#. translators: This message will be seen by very few users that likely are familiar with English. So feel free to leave this untranslated.
#: home-manager/home-manager:120
msgid ""
"The fallback Home Manager path %s has been deprecated and a file/directory "
"was found there."
msgstr ""
#. translators: This message will be seen by very few users that likely are familiar with English. So feel free to leave this untranslated.
#: home-manager/home-manager:123
msgid ""
"To remove this warning, do one of the following.\n"
"\n"
"1. Explicitly tell Home Manager to use the path, for example by adding\n"
"\n"
" { programs.home-manager.path = \"%s\"; }\n"
"\n"
" to your configuration.\n"
"\n"
" If you import Home Manager directly, you can use the `path` parameter\n"
"\n"
" pkgs.callPackage /path/to/home-manager-package { path = \"%s\"; }\n"
"\n"
" when calling the Home Manager package.\n"
"\n"
"2. Remove the deprecated path.\n"
"\n"
" $ rm -r \"%s\""
msgstr ""
#: home-manager/home-manager:151
msgid "Sanity checking Nix"
msgstr ""
#: home-manager/home-manager:171
msgid "Could not find suitable profile directory, tried %s and %s"
msgstr ""
#. translators: Here "flake" is a noun that refers to the Nix Flakes feature.
#: home-manager/home-manager:226
msgid "Can't inspect options of a flake configuration"
msgstr ""
#: home-manager/home-manager:301 home-manager/home-manager:324
#: home-manager/home-manager:1061
msgid "%s: unknown option '%s'"
msgstr ""
#: home-manager/home-manager:306 home-manager/home-manager:1062
msgid "Run '%s --help' for usage help"
msgstr ""
#: home-manager/home-manager:332 home-manager/home-manager:437
msgid "The file %s already exists, leaving it unchanged..."
msgstr ""
#: home-manager/home-manager:334 home-manager/home-manager:439
msgid "Creating %s..."
msgstr ""
#: home-manager/home-manager:481
msgid "Creating initial Home Manager generation..."
msgstr ""
#. translators: The "%s" specifier will be replaced by a file path.
#: home-manager/home-manager:486
msgid ""
"All done! The home-manager tool should now be installed and you can edit\n"
"\n"
" %s\n"
"\n"
"to configure Home Manager. Run 'man home-configuration.nix' to\n"
"see all available options."
msgstr ""
#. translators: The "%s" specifier will be replaced by a URL.
#: home-manager/home-manager:491
msgid ""
"Uh oh, the installation failed! Please create an issue at\n"
"\n"
" %s\n"
"\n"
"if the error seems to be the fault of Home Manager."
msgstr ""
#. translators: Here "flake" is a noun that refers to the Nix Flakes feature.
#: home-manager/home-manager:502
msgid "Can't instantiate a flake configuration"
msgstr ""
#: home-manager/home-manager:578
msgid ""
"There is %d unread and relevant news item.\n"
"Read it by running the command \"%s news\"."
msgid_plural ""
"There are %d unread and relevant news items.\n"
"Read them by running the command \"%s news\"."
msgstr[0] ""
msgstr[1] ""
#: home-manager/home-manager:592
msgid "Unknown \"news.display\" setting \"%s\"."
msgstr ""
#: home-manager/home-manager:600
#, sh-format
msgid "Please set the $EDITOR or $VISUAL environment variable"
msgstr ""
#: home-manager/home-manager:618
msgid "Cannot run build in read-only directory"
msgstr ""
#: home-manager/home-manager:699
msgid "No generation with ID %s"
msgstr ""
#: home-manager/home-manager:701
msgid "Cannot remove the current generation %s"
msgstr ""
#: home-manager/home-manager:703
msgid "Removing generation %s"
msgstr ""
#: home-manager/home-manager:724
msgid "No generations to expire"
msgstr ""
#: home-manager/home-manager:735
msgid "No home-manager packages seem to be installed."
msgstr ""
#: home-manager/home-manager:820
msgid "Unknown argument %s"
msgstr ""
#: home-manager/home-manager:845
msgid "This will remove Home Manager from your system."
msgstr ""
#: home-manager/home-manager:848
msgid "This is a dry run, nothing will actually be uninstalled."
msgstr ""
#: home-manager/home-manager:852
msgid "Really uninstall Home Manager?"
msgstr ""
#: home-manager/home-manager:858
msgid "Switching to empty Home Manager configuration..."
msgstr ""
#: home-manager/home-manager:873
msgid "Yay!"
msgstr ""
#: home-manager/home-manager:878
msgid "Home Manager is uninstalled but your home.nix is left untouched."
msgstr ""
#: home-manager/home-manager:1101
msgid "expire-generations expects one argument, got %d."
msgstr ""
#: home-manager/home-manager:1123
msgid "Unknown command: %s"
msgstr ""
#: home-manager/install.nix:18
msgid "This derivation is not buildable, please run it using nix-shell."
msgstr ""

View file

@ -8,21 +8,21 @@ msgstr ""
"Project-Id-Version: Home Manager\n"
"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n"
"POT-Creation-Date: 2025-01-03 09:09+0100\n"
"PO-Revision-Date: 2024-02-16 22:01+0000\n"
"Last-Translator: Robert Helgesson <robert@rycee.net>\n"
"Language-Team: Chinese (Traditional) <https://hosted.weblate.org/projects/"
"home-manager/cli/zh_Hant/>\n"
"PO-Revision-Date: 2025-03-07 18:58+0000\n"
"Last-Translator: 807 <s10855168@gmail.com>\n"
"Language-Team: Chinese (Traditional Han script) <https://hosted.weblate.org/"
"projects/home-manager/cli/zh_Hant/>\n"
"Language: zh_Hant\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 5.4\n"
"X-Generator: Weblate 5.10.3-dev\n"
#. translators: For example: "home-manager: missing argument for --cores"
#: home-manager/home-manager:16
msgid "%s: missing argument for %s"
msgstr ""
msgstr "%s: 缺少參數 %s"
#: home-manager/home-manager:69
msgid "No configuration file found at %s"
@ -36,6 +36,8 @@ msgid ""
"Keeping your Home Manager %s in %s is deprecated,\n"
"please move it to %s"
msgstr ""
"保持你的 Home Manager 在 %s 中,%s 已被拋棄,\n"
"請將它移動到 %s"
#: home-manager/home-manager:97
msgid "No configuration file found. Please create one at %s"
@ -43,14 +45,14 @@ msgstr "未找到配置檔案。請在 %s 處建立一份"
#: home-manager/home-manager:112
msgid "Home Manager not found at %s."
msgstr ""
msgstr "在 %s 中找不到 Home Manager。"
#. translators: This message will be seen by very few users that likely are familiar with English. So feel free to leave this untranslated.
#: home-manager/home-manager:120
msgid ""
"The fallback Home Manager path %s has been deprecated and a file/directory "
"was found there."
msgstr ""
msgstr "備用的 Home Manager 路徑 %s 已被拋棄,但一個檔案/資料夾在這被找到。"
#. translators: This message will be seen by very few users that likely are familiar with English. So feel free to leave this untranslated.
#: home-manager/home-manager:123
@ -73,6 +75,23 @@ msgid ""
"\n"
" $ rm -r \"%s\""
msgstr ""
"要消除這個警告,請做以下其中一步。\n"
"\n"
"1. 告訴Home Manager去使用路徑例如加入\n"
"\n"
" { programs.home-manager.path = \"%s\"; }\n"
"\n"
" 到你的配置中。\n"
"\n"
" 如果你想要直接引入Home Manager 請你使用 `path` 參數r\n"
"\n"
" pkgs.callPackage /path/to/home-manager-package { path = \"%s\"; }\n"
"\n"
" 當呼叫 Home Manager 模組。\n"
"\n"
"2. 刪除無效的路徑\n"
"\n"
" $ rm -r \"%s\""
#: home-manager/home-manager:151
msgid "Sanity checking Nix"
@ -80,7 +99,7 @@ msgstr "正在進行 Nix 完整性檢查"
#: home-manager/home-manager:171
msgid "Could not find suitable profile directory, tried %s and %s"
msgstr ""
msgstr "找不到合適的 profile 目錄,已經嘗試 %s 和 %s"
#. translators: Here "flake" is a noun that refers to the Nix Flakes feature.
#: home-manager/home-manager:226
@ -98,11 +117,11 @@ msgstr "執行 %s --help 獲取用法幫助"
#: home-manager/home-manager:332 home-manager/home-manager:437
msgid "The file %s already exists, leaving it unchanged..."
msgstr ""
msgstr "檔案 %s 已經存在,不更改它..."
#: home-manager/home-manager:334 home-manager/home-manager:439
msgid "Creating %s..."
msgstr ""
msgstr "創建 %s 中..."
#: home-manager/home-manager:481
msgid "Creating initial Home Manager generation..."
@ -163,11 +182,11 @@ msgstr "未知的 “news.display” 設定項 “%s”。"
#: home-manager/home-manager:600
#, sh-format
msgid "Please set the $EDITOR or $VISUAL environment variable"
msgstr ""
msgstr "請設定 $EDITOR 或 $VISUAL 環境變數"
#: home-manager/home-manager:618
msgid "Cannot run build in read-only directory"
msgstr "無法在讀目錄中執行構建"
msgstr "無法在讀目錄中執行構建"
#: home-manager/home-manager:699
msgid "No generation with ID %s"

49
lib/default.nix Normal file
View file

@ -0,0 +1,49 @@
{ lib }: {
hm = (import ../modules/lib/stdlib-extended.nix lib).hm;
homeManagerConfiguration = { modules ? [ ], pkgs, lib ? pkgs.lib
, extraSpecialArgs ? { }, check ? true
# Deprecated:
, configuration ? null, extraModules ? null, stateVersion ? null
, username ? null, homeDirectory ? null, system ? null }@args:
let
msgForRemovedArg = ''
The 'homeManagerConfiguration' arguments
- 'configuration',
- 'username',
- 'homeDirectory'
- 'stateVersion',
- 'extraModules', and
- 'system'
have been removed. Instead use the arguments 'pkgs' and
'modules'. See the 22.11 release notes for more: https://nix-community.github.io/home-manager/release-notes.xhtml#sec-release-22.11-highlights
'';
throwForRemovedArgs = v:
let
used = builtins.filter (n: (args.${n} or null) != null) [
"configuration"
"username"
"homeDirectory"
"stateVersion"
"extraModules"
"system"
];
msg = msgForRemovedArg + ''
Deprecated args passed: '' + builtins.concatStringsSep " " used;
in lib.throwIf (used != [ ]) msg v;
in throwForRemovedArgs (import ../modules {
inherit pkgs lib check extraSpecialArgs;
configuration = { ... }: {
imports = modules ++ [{ programs.home-manager.path = "${../.}"; }];
nixpkgs = {
config = lib.mkDefault pkgs.config;
inherit (pkgs) overlays;
};
};
});
}

View file

@ -1,8 +1,6 @@
{ config, lib, pkgs, ... }:
with lib;
{ config, lib, ... }:
let
inherit (lib) mkOption types;
cfg = config.accounts.calendar;
@ -70,7 +68,7 @@ let
};
};
calendarOpts = { name, config, ... }: {
calendarOpts = { name, ... }: {
options = {
name = mkOption {
type = types.str;
@ -125,7 +123,7 @@ in {
type = types.str;
example = ".calendar";
apply = p:
if hasPrefix "/" p then p else "${config.home.homeDirectory}/${p}";
if lib.hasPrefix "/" p then p else "${config.home.homeDirectory}/${p}";
description = ''
The base directory in which to save calendars. May be a
relative path, in which case it is relative the home
@ -144,15 +142,15 @@ in {
description = "List of calendars.";
};
};
config = mkIf (cfg.accounts != { }) {
config = lib.mkIf (cfg.accounts != { }) {
assertions = let
primaries =
catAttrs "name" (filter (a: a.primary) (attrValues cfg.accounts));
primaries = lib.catAttrs "name"
(lib.filter (a: a.primary) (lib.attrValues cfg.accounts));
in [{
assertion = length primaries <= 1;
assertion = lib.length primaries <= 1;
message = "Must have at most one primary calendar account but found "
+ toString (length primaries) + ", namely "
+ concatStringsSep ", " primaries;
+ toString (lib.length primaries) + ", namely "
+ lib.concatStringsSep ", " primaries;
}];
};
}

View file

@ -1,8 +1,7 @@
{ config, lib, pkgs, ... }:
with lib;
{ config, lib, ... }:
let
inherit (lib) mkOption types;
cfg = config.accounts.contact;
@ -78,7 +77,7 @@ let
};
};
contactOpts = { name, config, ... }: {
contactOpts = { name, ... }: {
options = {
name = mkOption {
type = types.str;
@ -114,7 +113,7 @@ in {
basePath = mkOption {
type = types.str;
apply = p:
if hasPrefix "/" p then p else "${config.home.homeDirectory}/${p}";
if lib.hasPrefix "/" p then p else "${config.home.homeDirectory}/${p}";
description = ''
The base directory in which to save contacts. May be a
relative path, in which case it is relative the home

View file

@ -1,8 +1,7 @@
{ config, lib, pkgs, ... }:
with lib;
{ config, lib, ... }:
let
inherit (lib) mkDefault mkIf mkOption types;
cfg = config.accounts.email;
@ -49,7 +48,7 @@ let
default = ''
--
'';
example = literalExpression ''
example = lib.literalExpression ''
~*~*~*~*~*~*~*~*~*~*~*~
'';
description = ''
@ -60,7 +59,7 @@ let
command = mkOption {
type = with types; nullOr path;
default = null;
example = literalExpression ''
example = lib.literalExpression ''
pkgs.writeScript "signature" "echo This is my signature"
'';
description = "A command that generates a signature.";
@ -247,6 +246,7 @@ let
"fastmail.com"
"yandex.com"
"outlook.office365.com"
"migadu.com"
];
default = "plain";
description = ''
@ -267,10 +267,26 @@ let
};
aliases = mkOption {
type = types.listOf (types.strMatching ".*@.*");
description = "Alternative identities of this account.";
default = [ ];
example = [ "webmaster@example.org" "admin@example.org" ];
description = "Alternative email addresses of this account.";
type = types.listOf (types.oneOf [
(types.strMatching ".*@.*")
(types.submodule {
options = {
realName = mkOption {
type = types.str;
example = "Jane Doe";
description = "Name displayed when sending mails.";
};
address = mkOption {
type = types.strMatching ".*@.*";
example = "jane.doe@example.org";
description = "The email address of this identity.";
};
};
})
]);
};
realName = mkOption {
@ -291,7 +307,7 @@ let
passwordCommand = mkOption {
type = types.nullOr (types.either types.str (types.listOf types.str));
default = null;
apply = p: if isString p then splitString " " p else p;
apply = p: if lib.isString p then lib.splitString " " p else p;
example = "secret-tool lookup email me@example.org";
description = ''
A command, which when run writes the account password on
@ -390,10 +406,10 @@ let
};
};
config = mkMerge [
config = lib.mkMerge [
{
name = name;
maildir = mkOptionDefault { path = "${name}"; };
maildir = lib.mkOptionDefault { path = "${name}"; };
}
(mkIf (config.flavor == "yandex.com") {
@ -450,6 +466,20 @@ let
};
})
(mkIf (config.flavor == "migadu.com") {
userName = mkDefault config.address;
imap = {
host = "imap.migadu.com";
port = 993;
};
smtp = {
host = "smtp.migadu.com";
port = 465;
};
})
(mkIf (config.flavor == "gmail.com") {
userName = mkDefault config.address;
@ -495,7 +525,7 @@ in {
default = "${config.home.homeDirectory}/Maildir";
defaultText = "Maildir";
apply = p:
if hasPrefix "/" p then p else "${config.home.homeDirectory}/${p}";
if lib.hasPrefix "/" p then p else "${config.home.homeDirectory}/${p}";
description = ''
The base directory for account maildir directories. May be a
relative path (e.g. the user setting this value as "MyMaildir"),
@ -514,13 +544,14 @@ in {
config = mkIf (cfg.accounts != { }) {
assertions = [
(let
primaries =
catAttrs "name" (filter (a: a.primary) (attrValues cfg.accounts));
primaries = lib.catAttrs "name"
(lib.filter (a: a.primary) (lib.attrValues cfg.accounts));
in {
assertion = length primaries == 1;
assertion = lib.length primaries == 1;
message = "Must have exactly one primary mail account but found "
+ toString (length primaries) + optionalString (length primaries > 1)
(", namely " + concatStringsSep ", " primaries);
+ toString (lib.length primaries)
+ lib.optionalString (lib.length primaries > 1)
(", namely " + lib.concatStringsSep ", " primaries);
})
];
};

View file

@ -1,13 +1,17 @@
{ config, options, lib, pkgs, ... }:
with lib;
let
inherit (lib)
mkEnableOption mkOption mkIf mkMerge mkDefault mkAliasOptionModule types
literalExpression escapeShellArg hm getAttrFromPath any optional;
cfg = config.home.pointerCursor;
opts = options.home.pointerCursor;
pointerCursorModule = types.submodule {
options = {
enable = mkEnableOption "cursor config generation";
package = mkOption {
type = types.package;
example = literalExpression "pkgs.vanilla-dmz";
@ -46,6 +50,14 @@ let
'';
};
dotIcons = {
enable = mkEnableOption ''
`.icons` config generation for {option}`home.pointerCursor`
'' // {
default = true;
};
};
hyprcursor = {
enable = mkEnableOption "hyprcursor config generation";
@ -56,6 +68,11 @@ let
description = "The cursor size for hyprcursor.";
};
};
sway = {
enable = mkEnableOption
"sway config generation for {option}`home.pointerCursor`";
};
};
};
@ -78,7 +95,7 @@ let
};
in {
meta.maintainers = [ maintainers.league ];
meta.maintainers = [ lib.maintainers.league ];
imports = [
(mkAliasOptionModule [ "xsession" "pointerCursor" "package" ] [
@ -102,17 +119,6 @@ in {
"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 = {
@ -120,7 +126,7 @@ in {
type = types.nullOr pointerCursorModule;
default = null;
description = ''
Cursor configuration. Set to `null` to disable.
Cursor configuration.
Top-level options declared under this submodule are backend independent
options. Options declared under namespaces such as `x11`
@ -139,63 +145,107 @@ in {
};
};
config = mkIf (cfg != null) (mkMerge [
config = let
# Check if enable option was explicitly defined by the user
enableDefined = any (x: x ? enable) opts.definitions;
# Determine if cursor configuration should be enabled
enable = if enableDefined then cfg.enable else cfg != null;
in mkMerge [
(mkIf enable (mkMerge [
{
assertions = [
(hm.assertions.assertPlatform "home.pointerCursor" pkgs
lib.platforms.linux)
];
home.packages = [ cfg.package defaultIndexThemePackage ];
home.sessionVariables = {
XCURSOR_SIZE = mkDefault cfg.size;
XCURSOR_THEME = mkDefault 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.sessionSearchVariables.XCURSOR_PATH =
[ "${config.home.profileDirectory}/share/icons" ];
# Add cursor icon link to $XDG_DATA_HOME/icons as well for redundancy.
xdg.dataFile."icons/default/index.theme".source =
"${defaultIndexThemePackage}/share/icons/default/index.theme";
xdg.dataFile."icons/${cfg.name}".source =
"${cfg.package}/share/icons/${cfg.name}";
}
(mkIf cfg.dotIcons.enable {
# Add symlink of cursor icon directory to $HOME/.icons, needed for
# backwards compatibility with some applications. See:
# https://specifications.freedesktop.org/icon-theme-spec/latest/ar01s03.html
home.file.".icons/default/index.theme".source =
"${defaultIndexThemePackage}/share/icons/default/index.theme";
home.file.".icons/${cfg.name}".source =
"${cfg.package}/share/icons/${cfg.name}";
})
(mkIf cfg.x11.enable {
xsession.profileExtra = ''
${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; };
})
(mkIf cfg.hyprcursor.enable {
home.sessionVariables = {
HYPRCURSOR_THEME = cfg.name;
HYPRCURSOR_SIZE = if cfg.hyprcursor.size != null then
cfg.hyprcursor.size
else
cfg.size;
};
})
(mkIf cfg.sway.enable {
wayland.windowManager.sway = {
config = {
seat = {
"*" = {
xcursor_theme =
"${cfg.name} ${toString config.gtk.cursorTheme.size}";
};
};
};
};
})
]))
{
assertions = [
(hm.assertions.assertPlatform "home.pointerCursor" pkgs platforms.linux)
];
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.
'') ++ (optional (opts.highestPrio != (lib.mkOptionDefault { }).priority
&& cfg == null) ''
Setting home.pointerCursor to null is deprecated.
Please update your configuration to explicitly set:
home.packages = [ cfg.package defaultIndexThemePackage ];
# 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 = mkDefault ("$XCURSOR_PATH\${XCURSOR_PATH:+:}"
+ "${config.home.profileDirectory}/share/icons");
XCURSOR_SIZE = mkDefault cfg.size;
XCURSOR_THEME = mkDefault cfg.name;
};
# Add symlink of cursor icon directory to $HOME/.icons, needed for
# backwards compatibility with some applications. See:
# https://specifications.freedesktop.org/icon-theme-spec/latest/ar01s03.html
home.file.".icons/default/index.theme".source =
"${defaultIndexThemePackage}/share/icons/default/index.theme";
home.file.".icons/${cfg.name}".source =
"${cfg.package}/share/icons/${cfg.name}";
# Add cursor icon link to $XDG_DATA_HOME/icons as well for redundancy.
xdg.dataFile."icons/default/index.theme".source =
"${defaultIndexThemePackage}/share/icons/default/index.theme";
xdg.dataFile."icons/${cfg.name}".source =
"${cfg.package}/share/icons/${cfg.name}";
home.pointerCursor.enable = false;
'');
}
(mkIf cfg.x11.enable {
xsession.profileExtra = ''
${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; };
})
(mkIf cfg.hyprcursor.enable {
home.sessionVariables = {
HYPRCURSOR_THEME = cfg.name;
HYPRCURSOR_SIZE =
if cfg.hyprcursor.size != null then cfg.hyprcursor.size else cfg.size;
};
})
]);
];
}

View file

@ -17,8 +17,6 @@
{ lib, pkgs, config, ... }:
with lib;
let
inherit (config.i18n) glibcLocales;
@ -27,19 +25,19 @@ let
archivePath = "${glibcLocales}/lib/locale/locale-archive";
# lookup the version of glibcLocales and set the appropriate environment vars
localeVars = if versionAtLeast version "2.27" then {
localeVars = if lib.versionAtLeast version "2.27" then {
LOCALE_ARCHIVE_2_27 = archivePath;
} else if versionAtLeast version "2.11" then {
} else if lib.versionAtLeast version "2.11" then {
LOCALE_ARCHIVE_2_11 = archivePath;
} else
{ };
in {
meta.maintainers = with maintainers; [ midchildan ];
meta.maintainers = with lib.maintainers; [ midchildan ];
options = {
i18n.glibcLocales = mkOption {
type = types.path;
i18n.glibcLocales = lib.mkOption {
type = lib.types.path;
description = ''
Customized `glibcLocales` package providing
the `LOCALE_ARCHIVE_*` environment variable.
@ -50,7 +48,7 @@ in {
will be set to {var}`i18n.glibcLocales` from the
system configuration.
'';
example = literalExpression ''
example = lib.literalExpression ''
pkgs.glibcLocales.override {
allLocales = false;
locales = [ "en_US.UTF-8/UTF-8" ];
@ -58,11 +56,11 @@ in {
'';
# NB. See nixos/default.nix for NixOS default.
default = pkgs.glibcLocales;
defaultText = literalExpression "pkgs.glibcLocales";
defaultText = lib.literalExpression "pkgs.glibcLocales";
};
};
config = mkIf pkgs.stdenv.hostPlatform.isLinux {
config = lib.mkIf pkgs.stdenv.hostPlatform.isLinux {
# For shell sessions.
home.sessionVariables = localeVars;

View file

@ -5,16 +5,14 @@
# Extra arguments passed to specialArgs.
, extraSpecialArgs ? { } }:
with lib;
let
collectFailed = cfg:
map (x: x.message) (filter (x: !x.assertion) cfg.assertions);
map (x: x.message) (lib.filter (x: !x.assertion) cfg.assertions);
showWarnings = res:
let f = w: x: builtins.trace "warning: ${w}" x;
in fold f res res.config.warnings;
in lib.fold f res res.config.warnings;
extendedLib = import ./lib/stdlib-extended.nix lib;
@ -32,7 +30,7 @@ let
moduleChecks = raw:
showWarnings (let
failed = collectFailed raw.config;
failedStr = concatStringsSep "\n" (map (x: "- ${x}") failed);
failedStr = lib.concatStringsSep "\n" (map (x: "- ${x}") failed);
in if failed == [ ] then
raw
else
@ -52,8 +50,8 @@ let
activation-script = module.config.home.activationPackage;
newsDisplay = rawModule.config.news.display;
newsEntries = sort (a: b: a.time > b.time)
(filter (a: a.condition) rawModule.config.news.entries);
newsEntries = lib.sort (a: b: a.time > b.time)
(lib.filter (a: a.condition) rawModule.config.news.entries);
inherit (module._module.args) pkgs;

View file

@ -1,10 +1,8 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = filterAttrs (n: f: f.enable) config.home.file;
cfg = lib.filterAttrs (n: f: f.enable) config.home.file;
homeDirectory = config.home.homeDirectory;
@ -25,14 +23,14 @@ in
{
options = {
home.file = mkOption {
home.file = lib.mkOption {
description = "Attribute set of files to link into the user home.";
default = {};
type = fileType "home.file" "{env}`HOME`" homeDirectory;
};
home-files = mkOption {
type = types.package;
home-files = lib.mkOption {
type = lib.types.package;
internal = true;
description = "Package to contain all home files";
};
@ -42,11 +40,11 @@ in
assertions = [(
let
dups =
attrNames
(filterAttrs (n: v: v > 1)
(foldAttrs (acc: v: acc + v) 0
(mapAttrsToList (n: v: { ${v.target} = 1; }) cfg)));
dupsStr = concatStringsSep ", " dups;
lib.attrNames
(lib.filterAttrs (n: v: v > 1)
(lib.foldAttrs (acc: v: acc + v) 0
(lib.mapAttrsToList (n: v: { ${v.target} = 1; }) cfg)));
dupsStr = lib.concatStringsSep ", " dups;
in {
assertion = dups == [];
message = ''
@ -64,22 +62,22 @@ in
lib.file.mkOutOfStoreSymlink = path:
let
pathStr = toString path;
name = hm.strings.storeFileName (baseNameOf pathStr);
name = lib.hm.strings.storeFileName (baseNameOf pathStr);
in
pkgs.runCommandLocal name {} ''ln -s ${escapeShellArg pathStr} $out'';
pkgs.runCommandLocal name {} ''ln -s ${lib.escapeShellArg pathStr} $out'';
# This verifies that the links we are about to create will not
# overwrite an existing file.
home.activation.checkLinkTargets = hm.dag.entryBefore ["writeBoundary"] (
home.activation.checkLinkTargets = lib.hm.dag.entryBefore ["writeBoundary"] (
let
# Paths that should be forcibly overwritten by Home Manager.
# Caveat emptor!
forcedPaths =
concatMapStringsSep " " (p: ''"$HOME"/${escapeShellArg p}'')
(mapAttrsToList (n: v: v.target)
(filterAttrs (n: v: v.force) cfg));
lib.concatMapStringsSep " " (p: ''"$HOME"/${lib.escapeShellArg p}'')
(lib.mapAttrsToList (n: v: v.target)
(lib.filterAttrs (n: v: v.force) cfg));
storeDir = escapeShellArg builtins.storeDir;
storeDir = lib.escapeShellArg builtins.storeDir;
check = pkgs.substituteAll {
src = ./files/check-link-targets.sh;
@ -118,7 +116,7 @@ in
# and a failure during the intermediate state FA ∩ FB will not
# result in lost links because this set of links are in both the
# source and target generation.
home.activation.linkGeneration = hm.dag.entryAfter ["writeBoundary"] (
home.activation.linkGeneration = lib.hm.dag.entryAfter ["writeBoundary"] (
let
link = pkgs.writeShellScript "link" ''
${config.lib.bash.initHomeManagerLib}
@ -151,7 +149,7 @@ in
# A symbolic link whose target path matches this pattern will be
# considered part of a Home Manager generation.
homeFilePattern="$(readlink -e ${escapeShellArg builtins.storeDir})/*-home-manager-files/*"
homeFilePattern="$(readlink -e ${lib.escapeShellArg builtins.storeDir})/*-home-manager-files/*"
newGenFiles="$1"
shift 1
@ -216,9 +214,9 @@ in
''
);
home.activation.checkFilesChanged = hm.dag.entryBefore ["linkGeneration"] (
home.activation.checkFilesChanged = lib.hm.dag.entryBefore ["linkGeneration"] (
let
homeDirArg = escapeShellArg homeDirectory;
homeDirArg = lib.escapeShellArg homeDirectory;
in ''
function _cmp() {
if [[ -d $1 && -d $2 ]]; then
@ -228,31 +226,31 @@ in
fi
}
declare -A changedFiles
'' + concatMapStrings (v:
'' + lib.concatMapStrings (v:
let
sourceArg = escapeShellArg (sourceStorePath v);
targetArg = escapeShellArg v.target;
sourceArg = lib.escapeShellArg (sourceStorePath v);
targetArg = lib.escapeShellArg v.target;
in ''
_cmp ${sourceArg} ${homeDirArg}/${targetArg} \
&& changedFiles[${targetArg}]=0 \
|| changedFiles[${targetArg}]=1
'') (filter (v: v.onChange != "") (attrValues cfg))
'') (lib.filter (v: v.onChange != "") (lib.attrValues cfg))
+ ''
unset -f _cmp
''
);
home.activation.onFilesChange = hm.dag.entryAfter ["linkGeneration"] (
concatMapStrings (v: ''
if (( ''${changedFiles[${escapeShellArg v.target}]} == 1 )); then
home.activation.onFilesChange = lib.hm.dag.entryAfter ["linkGeneration"] (
lib.concatMapStrings (v: ''
if (( ''${changedFiles[${lib.escapeShellArg v.target}]} == 1 )); then
if [[ -v DRY_RUN || -v VERBOSE ]]; then
echo "Running onChange hook for" ${escapeShellArg v.target}
echo "Running onChange hook for" ${lib.escapeShellArg v.target}
fi
if [[ ! -v DRY_RUN ]]; then
${v.onChange}
fi
fi
'') (filter (v: v.onChange != "") (attrValues cfg))
'') (lib.filter (v: v.onChange != "") (lib.attrValues cfg))
);
# Symlink directories and files that have the right execute bit.
@ -324,10 +322,10 @@ in
fi
fi
}
'' + concatStrings (
mapAttrsToList (n: v: ''
'' + lib.concatStrings (
lib.mapAttrsToList (n: v: ''
insertFile ${
escapeShellArgs [
lib.escapeShellArgs [
(sourceStorePath v)
v.target
(if v.executable == null

View file

@ -1,8 +1,7 @@
{ config, lib, pkgs, ... }:
with lib;
let
inherit (lib) literalExpression mkOption types;
inherit (config.home) stateVersion;
@ -114,7 +113,7 @@ let
layout = mkOption {
type = with types; nullOr str;
default =
if versionAtLeast config.home.stateVersion "19.09"
if lib.versionAtLeast config.home.stateVersion "19.09"
then null
else "us";
defaultText = literalExpression "null";
@ -148,7 +147,7 @@ let
variant = mkOption {
type = with types; nullOr str;
default =
if versionAtLeast config.home.stateVersion "19.09"
if lib.versionAtLeast config.home.stateVersion "19.09"
then null
else "";
defaultText = literalExpression "null";
@ -167,10 +166,10 @@ let
in
{
meta.maintainers = [ maintainers.rycee ];
meta.maintainers = [ lib.maintainers.rycee ];
imports = [
(mkRemovedOptionModule [ "home" "sessionVariableSetter" ] ''
(lib.mkRemovedOptionModule [ "home" "sessionVariableSetter" ] ''
Session variables are now always set through the shell. This is
done automatically if the shell configuration is managed by Home
Manager. If not, then you must source the
@ -223,7 +222,7 @@ in
home.keyboard = mkOption {
type = types.nullOr keyboardSubModule;
default = if versionAtLeast stateVersion "21.11" then null else { };
default = if lib.versionAtLeast stateVersion "21.11" then null else { };
defaultText = literalExpression ''
"{ }" for state version < 21.11,
"null" for state version 21.11
@ -310,7 +309,7 @@ in
".git/safe/../../bin"
];
description = ''
Extra directories to add to {env}`PATH`.
Extra directories to prepend to {env}`PATH`.
These directories are added to the {env}`PATH` variable in a
double-quoted context, so expressions like `$HOME` are
@ -320,6 +319,27 @@ in
'';
};
home.sessionSearchVariables = mkOption {
default = { };
type = with types; attrsOf (listOf str);
example = {
MANPATH = [
"$HOME/.npm-packages/man"
"\${xdg.configHome}/.local/share/man"
];
};
description = ''
Extra directories to prepend to arbitrary PATH-like
environment variables (e.g.: {env}`MANPATH`). The values
will be concatenated by `:`.
These directories are added to the environment variable in a
double-quoted context, so expressions like `$HOME` are
expanded by the shell. However, since expressions like `~` or
`*` are escaped, they will end up in the environment
verbatim.
'';
};
home.sessionVariablesExtra = mkOption {
type = types.lines;
default = "";
@ -355,7 +375,7 @@ in
home.emptyActivationPath = mkOption {
internal = true;
type = types.bool;
default = versionAtLeast stateVersion "22.11";
default = lib.versionAtLeast stateVersion "22.11";
defaultText = literalExpression ''
false for state version < 22.11,
true for state version 22.11
@ -370,7 +390,7 @@ in
};
home.activation = mkOption {
type = hm.types.dagOf types.str;
type = lib.hm.types.dagOf types.str;
default = {};
example = literalExpression ''
{
@ -475,7 +495,7 @@ in
'';
};
home.preferXdgDirectories = mkEnableOption "" // {
home.preferXdgDirectories = lib.mkEnableOption "" // {
description = ''
Whether to make programs use XDG directories whenever supported.
'';
@ -502,7 +522,7 @@ in
config.home.enableNixpkgsReleaseCheck
&& hmRelease != nixpkgsRelease;
in
optional releaseMismatch ''
lib.optional releaseMismatch ''
You are using
Home Manager version ${hmRelease} and
@ -520,11 +540,11 @@ in
'';
home.username =
mkIf (versionOlder config.home.stateVersion "20.09")
(mkDefault (builtins.getEnv "USER"));
lib.mkIf (lib.versionOlder config.home.stateVersion "20.09")
(lib.mkDefault (builtins.getEnv "USER"));
home.homeDirectory =
mkIf (versionOlder config.home.stateVersion "20.09")
(mkDefault (builtins.getEnv "HOME"));
lib.mkIf (lib.versionOlder config.home.stateVersion "20.09")
(lib.mkDefault (builtins.getEnv "HOME"));
home.profileDirectory =
if config.submoduleSupport.enable
@ -540,7 +560,7 @@ in
home.sessionVariables =
let
maybeSet = n: v: optionalAttrs (v != null) { ${n} = v; };
maybeSet = n: v: lib.optionalAttrs (v != null) { ${n} = v; };
in
(maybeSet "LANG" cfg.language.base)
//
@ -576,17 +596,24 @@ in
export __HM_SESS_VARS_SOURCED=1
${config.lib.shell.exportAll cfg.sessionVariables}
'' + lib.optionalString (cfg.sessionPath != [ ]) ''
export PATH="$PATH''${PATH:+:}${concatStringsSep ":" cfg.sessionPath}"
'' + cfg.sessionVariablesExtra;
'' + lib.concatStringsSep "\n"
(lib.mapAttrsToList
(env: values: config.lib.shell.export
env
(config.lib.shell.prependToVar ":" env values))
cfg.sessionSearchVariables) + "\n"
+ cfg.sessionVariablesExtra;
};
home.sessionSearchVariables.PATH =
lib.mkIf (cfg.sessionPath != [ ]) cfg.sessionPath;
home.packages = [ config.home.sessionVariablesPackage ];
# The entry acting as a boundary between the activation script's "check" and
# the "write" phases. This is where we commit to attempting to actually
# activate the configuration.
home.activation.writeBoundary = hm.dag.entryAnywhere ''
home.activation.writeBoundary = lib.hm.dag.entryAnywhere ''
if [[ ! -v oldGenPath || "$oldGenPath" != "$newGenPath" ]] ; then
_i "Creating new profile generation"
run nix-env $VERBOSE_ARG --profile "$genProfilePath" --set "$newGenPath"
@ -610,7 +637,7 @@ in
# In case the user has moved from a user-install of Home Manager
# to a submodule managed one we attempt to uninstall the
# `home-manager-path` package if it is installed.
home.activation.installPackages = hm.dag.entryAfter ["writeBoundary"] (
home.activation.installPackages = lib.hm.dag.entryAfter ["writeBoundary"] (
if config.submoduleSupport.externalPackageInstall
then
''
@ -676,10 +703,10 @@ in
_iNote "Activating %s" "${res.name}"
${res.data}
'';
sortedCommands = hm.dag.topoSort cfg.activation;
sortedCommands = lib.hm.dag.topoSort cfg.activation;
activationCmds =
if sortedCommands ? result then
concatStringsSep "\n" (map mkCmd sortedCommands.result)
lib.concatStringsSep "\n" (map mkCmd sortedCommands.result)
else
abort ("Dependency cycle in activation script: "
+ builtins.toJSON sortedCommands);
@ -708,7 +735,7 @@ in
else
":$(${pkgs.coreutils}/bin/dirname $(${pkgs.coreutils}/bin/readlink -m $(type -p nix-env)))"
)
+ optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH";
+ lib.optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH";
activationScript = pkgs.writeShellScript "activation-script" ''
set -eu
@ -722,8 +749,8 @@ in
${builtins.readFile ./lib-bash/activation-init.sh}
if [[ ! -v SKIP_SANITY_CHECKS ]]; then
checkUsername ${escapeShellArg config.home.username}
checkHomeDirectory ${escapeShellArg config.home.homeDirectory}
checkUsername ${lib.escapeShellArg config.home.username}
checkHomeDirectory ${lib.escapeShellArg config.home.homeDirectory}
fi
# Create a temporary GC root to prevent collection during activation.
@ -732,7 +759,7 @@ in
${activationCmds}
${optionalString (!config.uninstall) ''
${lib.optionalString (!config.uninstall) ''
# Create the "current generation" GC root.
run --silence nix-store --realise "$newGenPath" --add-root "$currentGenGcPath"

View file

@ -1,6 +1,5 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.i18n.inputMethod;
@ -26,9 +25,9 @@ in {
options.i18n = {
inputMethod = {
enabled = mkOption {
type = types.nullOr
(types.enum [ "fcitx" "fcitx5" "nabi" "uim" "hime" "kime" ]);
enabled = lib.mkOption {
type = lib.types.nullOr
(lib.types.enum [ "fcitx" "fcitx5" "nabi" "uim" "hime" "kime" ]);
default = null;
example = "fcitx5";
description = ''
@ -61,9 +60,9 @@ in {
'';
};
package = mkOption {
package = lib.mkOption {
internal = true;
type = types.nullOr types.path;
type = lib.types.nullOr lib.types.path;
default = null;
description = ''
The input method method package.
@ -72,9 +71,10 @@ in {
};
};
config = mkIf (cfg.enabled != null) {
config = lib.mkIf (cfg.enabled != null) {
assertions = [
(hm.assertions.assertPlatform "i18n.inputMethod" pkgs platforms.linux)
(lib.hm.assertions.assertPlatform "i18n.inputMethod" pkgs
lib.platforms.linux)
{
assertion = cfg.enabled != "fcitx";
message = "fcitx has been removed, please use fcitx5 instead";
@ -84,5 +84,5 @@ in {
home.packages = [ cfg.package gtk2Cache gtk3Cache ];
};
meta.maintainers = with lib; [ hm.maintainers.kranzes ];
meta.maintainers = [ lib.hm.maintainers.kranzes ];
}

View file

@ -1,42 +1,61 @@
{ config, pkgs, lib, ... }:
with lib;
let
im = config.i18n.inputMethod;
cfg = im.fcitx5;
fcitx5Package =
pkgs.libsForQt5.fcitx5-with-addons.override { inherit (cfg) addons; };
fcitx5Package = cfg.fcitx5-with-addons.override { inherit (cfg) addons; };
in {
options = {
i18n.inputMethod.fcitx5 = {
addons = mkOption {
type = with types; listOf package;
fcitx5-with-addons = lib.mkOption {
type = lib.types.package;
default = pkgs.libsForQt5.fcitx5-with-addons;
example = lib.literalExpression "pkgs.kdePackages.fcitx5-with-addons";
description = ''
The fcitx5 package to use.
'';
};
addons = lib.mkOption {
type = with lib.types; listOf package;
default = [ ];
example = literalExpression "with pkgs; [ fcitx5-rime ]";
example = lib.literalExpression "with pkgs; [ fcitx5-rime ]";
description = ''
Enabled Fcitx5 addons.
'';
};
waylandFrontend = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Use the Wayland input method frontend.
See [Using Fcitx 5 on Wayland](https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland).
'';
};
};
};
config = mkIf (im.enabled == "fcitx5") {
config = lib.mkIf (im.enabled == "fcitx5") {
i18n.inputMethod.package = fcitx5Package;
home.sessionVariables = {
GLFW_IM_MODULE = "ibus"; # IME support in kitty
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
QT_PLUGIN_PATH =
"$QT_PLUGIN_PATH\${QT_PLUGIN_PATH:+:}${fcitx5Package}/${pkgs.qt6.qtbase.qtPluginPrefix}";
home = {
sessionVariables = {
GLFW_IM_MODULE = "ibus"; # IME support in kitty
XMODIFIERS = "@im=fcitx";
} // lib.optionalAttrs (!cfg.waylandFrontend) {
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
};
sessionSearchVariables.QT_PLUGIN_PATH =
[ "${fcitx5Package}/${pkgs.qt6.qtbase.qtPluginPrefix}" ];
};
systemd.user.services.fcitx5-daemon = {
Unit = {
Description = "Fcitx5 input method editor";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service.ExecStart = "${fcitx5Package}/bin/fcitx5";
Install.WantedBy = [ "graphical-session.target" ];

View file

@ -1,7 +1,7 @@
{ config, pkgs, lib, ... }:
with lib; {
config = mkIf (config.i18n.inputMethod.enabled == "hime") {
{
config = lib.mkIf (config.i18n.inputMethod.enabled == "hime") {
i18n.inputMethod.package = pkgs.hime;
home.sessionVariables = {

View file

@ -1,7 +1,7 @@
{ config, pkgs, lib, ... }:
with lib; {
config = mkIf (config.i18n.inputMethod.enabled == "nabi") {
{
config = lib.mkIf (config.i18n.inputMethod.enabled == "nabi") {
i18n.inputMethod.package = pkgs.nabi;
home.sessionVariables = {

View file

@ -1,14 +1,13 @@
{ config, pkgs, lib, ... }:
with lib;
let cfg = config.i18n.inputMethod.uim;
in {
options = {
i18n.inputMethod.uim = {
toolbar = mkOption {
type = types.enum [ "gtk" "gtk3" "gtk-systray" "gtk3-systray" "qt4" ];
toolbar = lib.mkOption {
type =
lib.types.enum [ "gtk" "gtk3" "gtk-systray" "gtk3-systray" "qt4" ];
default = "gtk";
example = "gtk-systray";
description = ''
@ -19,7 +18,7 @@ in {
};
config = mkIf (config.i18n.inputMethod.enabled == "uim") {
config = lib.mkIf (config.i18n.inputMethod.enabled == "uim") {
i18n.inputMethod.package = pkgs.uim;
home.sessionVariables = {

View file

@ -25,9 +25,11 @@
{ config, lib, ... }:
with lib;
let
inherit (lib) types mkOption; # added by Home Manager
{
launchdTypes = import ./types.nix { inherit config lib; };
in {
freeformType = with types; attrsOf anything; # added by Home Manager
options = {
@ -118,7 +120,7 @@ with lib;
};
LimitLoadToSessionType = mkOption {
type = types.nullOr types.str;
type = types.nullOr (types.oneOf [ types.str (types.listOf types.str) ]);
default = null;
description = ''
This configuration file only applies to sessions of the type specified. This key is used in concert
@ -369,60 +371,26 @@ with lib;
StartCalendarInterval = mkOption {
default = null;
example = {
example = [{
Hour = 2;
Minute = 30;
};
}];
description = ''
This optional key causes the job to be started every calendar interval as specified. Missing arguments
are considered to be wildcard. The semantics are much like `crontab(5)`. Unlike cron which skips job
invocations when the computer is asleep, launchd will start the job the next time the computer wakes
This optional key causes the job to be started every calendar interval as specified. The semantics are
much like {manpage}`crontab(5)`: Missing attributes are considered to be wildcard. Unlike cron which skips
job invocations when the computer is asleep, launchd will start the job the next time the computer wakes
up. If multiple intervals transpire before the computer is woken, those events will be coalesced into
one event upon wake from sleep.
one event upon waking from sleep.
::: {.important}
The list must not be empty and must not contain duplicate entries (attrsets which compare equally).
:::
::: {.caution}
Since missing attrs become wildcards, an empty attrset effectively means "every minute".
:::
'';
type = types.nullOr (types.listOf (types.submodule {
options = {
Minute = mkOption {
type = types.nullOr types.int;
default = null;
description = ''
The minute on which this job will be run.
'';
};
Hour = mkOption {
type = types.nullOr types.int;
default = null;
description = ''
The hour on which this job will be run.
'';
};
Day = mkOption {
type = types.nullOr types.int;
default = null;
description = ''
The day on which this job will be run.
'';
};
Weekday = mkOption {
type = types.nullOr types.int;
default = null;
description = ''
The weekday on which this job will be run (0 and 7 are Sunday).
'';
};
Month = mkOption {
type = types.nullOr types.int;
default = null;
description = ''
The month on which this job will be run.
'';
};
};
}));
type = types.nullOr launchdTypes.StartCalendarInterval;
};
StandardInPath = mkOption {
@ -669,22 +637,22 @@ with lib;
resource limits based on what kind of job it is. If left unspecified, the system will apply light
resource limits to the job, throttling its CPU usage and I/O bandwidth. The following are valid values:
Background
: Background jobs are generally processes that do work that was not directly requested by the user.
The resource limits applied to Background jobs are intended to prevent them from disrupting the
user experience.
Background
: Background jobs are generally processes that do work that was not directly requested by the user.
The resource limits applied to Background jobs are intended to prevent them from disrupting the
user experience.
Standard
: Standard jobs are equivalent to no ProcessType being set.
Standard
: Standard jobs are equivalent to no ProcessType being set.
Adaptive
: Adaptive jobs move between the Background and Interactive classifications based on activity over
XPC connections. See {manpage}`xpc_transaction_begin(3)` for details.
Adaptive
: Adaptive jobs move between the Background and Interactive classifications based on activity over
XPC connections. See `xpc_transaction_begin(3)` for details.
Interactive
: Interactive jobs run with the same resource limitations as apps, that is to say, none. Interactive
jobs are critical to maintaining a responsive user experience, and this key should only be
used if an app's ability to be responsive depends on it, and cannot be made Adaptive.
Interactive
: Interactive jobs run with the same resource limitations as apps, that is to say, none. Interactive
jobs are critical to maintaining a responsive user experience, and this key should only be
used if an app's ability to be responsive depends on it, and cannot be made Adaptive.
'';
};
@ -706,6 +674,15 @@ with lib;
'';
};
LowPriorityBackgroundIO = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
This optional key specifies whether the kernel should consider this daemon to be low priority when
doing file system I/O when the process is throttled with the Darwin-background classification.
'';
};
LaunchOnlyOnce = mkOption {
type = types.nullOr types.bool;
default = null;
@ -717,7 +694,7 @@ with lib;
MachServices = mkOption {
default = null;
example = { ResetAtClose = true; };
example = { "org.nixos.service" = { ResetAtClose = true; }; };
description = ''
This optional key is used to specify Mach services to be registered with the Mach bootstrap sub-system.
Each key in this dictionary should be the name of service to be advertised. The value of the key must
@ -726,31 +703,32 @@ with lib;
Finally, for the job itself, the values will be replaced with Mach ports at the time of check-in with
launchd.
'';
type = types.nullOr (types.submodule {
options = {
ResetAtClose = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
If this boolean is false, the port is recycled, thus leaving clients to remain oblivious to the
demand nature of job. If the value is set to true, clients receive port death notifications when
the job lets go of the receive right. The port will be recreated atomically with respect to bootstrap_look_up()
calls, so that clients can trust that after receiving a port death notification,
the new port will have already been recreated. Setting the value to true should be done with
care. Not all clients may be able to handle this behavior. The default value is false.
'';
};
type = types.nullOr (types.attrsOf (types.either types.bool
(types.submodule {
options = {
ResetAtClose = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
If this boolean is false, the port is recycled, thus leaving clients to remain oblivious to the
demand nature of job. If the value is set to true, clients receive port death notifications when
the job lets go of the receive right. The port will be recreated atomically with respect to bootstrap_look_up()
calls, so that clients can trust that after receiving a port death notification,
the new port will have already been recreated. Setting the value to true should be done with
care. Not all clients may be able to handle this behavior. The default value is false.
'';
};
HideUntilCheckIn = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Reserve the name in the namespace, but cause bootstrap_look_up() to fail until the job has
checked in with launchd.
'';
HideUntilCheckIn = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
Reserve the name in the namespace, but cause bootstrap_look_up() to fail until the job has
checked in with launchd.
'';
};
};
};
});
})));
};
LaunchEvents = mkOption {
@ -778,6 +756,26 @@ with lib;
};
};
ServiceIPC = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
This optional key specifies whether the job participates in advanced
communication with launchd. The default is false. This flag is
incompatible with the inetdCompatibility key.
'';
};
SessionCreate = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''
This key specifies that the job should be spawned into a new security
audit session rather than the default session for the context is belongs
to. See auditon(2) for details.
'';
};
Sockets = mkOption {
default = null;
description = ''

121
modules/launchd/types.nix Normal file
View file

@ -0,0 +1,121 @@
# launchd option type from nix-darwin
#
# Original code from https://github.com/LnL7/nix-darwin/commit/861af0fc94df9454f4e92d6892f75588763164bb
{ lib, ... }:
let
inherit (lib) imap1 types mkOption showOption mergeDefinitions;
inherit (builtins) map filter length deepSeq throw toString concatLists;
inherit (lib.options) showDefs;
wildcardText = lib.literalMD "`*`";
/* *
A type of list which does not allow duplicate elements. The base/inner
list type to use (e.g. `types.listOf` or `types.nonEmptyListOf`) is passed
via argument `listType`, which must be the final type and not a function.
NOTE: The extra check for duplicates is quadratic and strict, so use this
type sparingly and only:
* when needed, and
* when the list is expected to be recursively short (e.g. < 10 elements)
and shallow (i.e. strict evaluation of the list won't take too long)
The implementation of this function is similar to that of
`types.nonEmptyListOf`.
*/
types'.uniqueList = listType:
listType // {
description = "unique ${
types.optionDescriptionPhrase (class: class == "noun") listType
}";
substSubModules = m: types'.uniqueList (listType.substSubModules m);
# This has been taken from the implementation of `types.listOf`, but has
# been modified to throw on duplicates. This check cannot be done in the
# `check` fn as this check is deep/strict, and because `check` runs
# prior to merging.
merge = loc: defs:
let
# Each element of `dupes` is a list. When there are duplicates,
# later lists will be duplicates of earlier lists, so just throw on
# the first set of duplicates found so that we don't have duplicate
# error msgs.
checked = filter (li:
if length li > 1 then
throw ''
The option `${
showOption loc
}' contains duplicate entries after merging:
${showDefs li}''
else
false) dupes;
dupes =
map (def: filter (def': def'.value == def.value) merged) merged;
merged = filter (x: x ? value) (concatLists (imap1 (n: def:
imap1 (m: el:
let
inherit (def) file;
loc' = loc
++ [ "[definition ${toString n}-entry ${toString m}]" ];
in (mergeDefinitions loc' listType.nestedTypes.elemType [{
inherit file;
value = el;
}]).optionalValue // {
inherit loc' file;
}) def.value) defs));
in deepSeq checked (map (x: x.value) merged);
};
in {
StartCalendarInterval = let
CalendarIntervalEntry = types.submodule {
options = {
Minute = mkOption {
type = types.nullOr (types.ints.between 0 59);
default = null;
defaultText = wildcardText;
description = ''
The minute on which this job will be run.
'';
};
Hour = mkOption {
type = types.nullOr (types.ints.between 0 23);
default = null;
defaultText = wildcardText;
description = ''
The hour on which this job will be run.
'';
};
Day = mkOption {
type = types.nullOr (types.ints.between 1 31);
default = null;
defaultText = wildcardText;
description = ''
The day on which this job will be run.
'';
};
Weekday = mkOption {
type = types.nullOr (types.ints.between 0 7);
default = null;
defaultText = wildcardText;
description = ''
The weekday on which this job will be run (0 and 7 are Sunday).
'';
};
Month = mkOption {
type = types.nullOr (types.ints.between 1 12);
default = null;
defaultText = wildcardText;
description = ''
The month on which this job will be run.
'';
};
};
};
in types.either CalendarIntervalEntry
(types'.uniqueList (types.nonEmptyListOf CalendarIntervalEntry));
}

View file

@ -5,7 +5,6 @@
# are expected to be follow the same format as described in [1].
#
# [1] https://github.com/NixOS/nixpkgs/blob/fca0d6e093c82b31103dc0dacc48da2a9b06e24b/maintainers/maintainer-list.nix#LC1
{
aabccd021 = {
name = "Muhamad Abdurahman";
@ -79,6 +78,12 @@
github = "considerate";
githubId = 217918;
};
damidoug = {
email = "contact@damidoug.dev";
github = "damidoug";
githubId = 75175586;
name = "Douglas Damiano";
};
danjujan = {
name = "Jan Schmitz";
email = "44864658+danjujan@users.noreply.github.com";
@ -107,6 +112,12 @@
github = "diniamo";
githubId = 55629891;
};
dsoverlord = {
name = "Kirill Zakharov";
email = "dsoverlord@vk.com";
github = "dsoverlord";
githubId = 78819443;
};
dwagenk = {
email = "dwagenk@mailbox.org";
github = "dwagenk";
@ -478,6 +489,12 @@
github = "mainrs";
githubId = 5113257;
};
mikilio = {
name = "mikilio";
email = "official.mikilio+dev@gmail.com";
github = "mikilio";
githubId = 86004375;
};
kmaasrud = {
name = "Knut Magnus Aasrud";
email = "km@aasrud.com";
@ -550,6 +567,13 @@
githubId = 1545895;
name = "Nicola Squartini";
};
timon-schelling = {
name = "Timon Schelling";
email = "me@timon.zip";
github = "timon-schelling";
githubId = 36821505;
matrix = "@timon:beeper.com";
};
toastal = {
email = "toastal+nix@posteo.net";
matrix = "@toastal:matrix.org";
@ -578,6 +602,11 @@
github = "pedorich-n";
githubId = 15573098;
};
PopeRigby = {
name = "PopeRigby";
github = "poperigby";
githubId = 20866468;
};
liyangau = {
name = "Li Yang";
email = "d@aufomm.com";
@ -628,4 +657,38 @@
github = "ALameLlama";
githubId = 55490546;
};
ckgxrg = {
name = "ckgxrg";
email = "ckgxrg@ckgxrg.io";
github = "ckgxrg-salt";
githubId = 165614491;
};
HPsaucii = {
name = "Holly Powell";
email = "me@hpsaucii.dev";
github = "HPsaucii";
githubId = 126502193;
keys = [{
longkeyid = "rsa4096/0xEDB2C634166AE6AD";
fingerprint = "AD32 73D4 5E0E 9478 E826 543F EDB2 C634 166A E6AD";
}];
};
folliehiyuki = {
name = "Hoang Nguyen";
email = "folliekazetani@protonmail.com";
github = "folliehiyuki";
githubId = 67634026;
};
"3ulalia" = {
name = "Eulalia del Sol";
email = "3ulalia@proton.me";
github = "3ulalia";
githubId = "179992797";
};
ipsavitsky = {
name = "Ilya Savitsky";
email = "ipsavitsky234@gmail.com";
github = "ipsavitsky";
githubId = 33558632;
};
}

View file

@ -1,7 +1,9 @@
{ lib }: rec {
mkNushellInline = expr: lib.setType "nushell-inline" { inherit expr; };
toNushell = { indent ? "", multiline ? true, asBindings ? false }@args:
isNushellInline = lib.isType "nushell-inline";
toNushell = { indent ? "", multiline ? true, asBindings ? false, }@args:
v:
let
innerIndent = "${indent} ";
@ -18,7 +20,6 @@
asBindings = false;
};
concatItems = lib.concatStringsSep introSpace;
isNushellInline = lib.isType "nushell-inline";
generatedBindings = assert lib.assertMsg (badVarNames == [ ])
"Bad Nushell variable names: ${

View file

@ -1,6 +1,30 @@
{ lib }:
rec {
let
mkShellIntegrationOption = name:
{ config, baseName ? name, extraDescription ? "" }:
let attrName = "enable${baseName}Integration";
in lib.mkOption {
default = config.home.shell.${attrName};
defaultText = lib.literalMD "[](#opt-home.shell.${attrName})";
example = false;
description = "Whether to enable ${name} integration.${
lib.optionalString (extraDescription != "")
("\n\n" + extraDescription)
}";
type = lib.types.bool;
};
in rec {
# Produces a Bourne shell like statement that prepend new values to
# an possibly existing variable, using sep(arator).
# Example:
# prependToVar ":" "PATH" [ "$HOME/bin" "$HOME/.local/bin" ]
# => "$HOME/bin:$HOME/.local/bin:${PATH:+:}\$PATH"
prependToVar = sep: n: v:
"${lib.concatStringsSep sep v}\${${n}:+${sep}}\$${n}";
# Produces a Bourne shell like variable export statement.
export = n: v: ''export ${n}="${toString v}"'';
@ -8,4 +32,10 @@ rec {
# assignment, this function produces a string containing an export
# statement for each set entry.
exportAll = vars: lib.concatStringsSep "\n" (lib.mapAttrsToList export vars);
mkBashIntegrationOption = mkShellIntegrationOption "Bash";
mkFishIntegrationOption = mkShellIntegrationOption "Fish";
mkIonIntegrationOption = mkShellIntegrationOption "Ion";
mkNushellIntegrationOption = mkShellIntegrationOption "Nushell";
mkZshIntegrationOption = mkShellIntegrationOption "Zsh";
}

View file

@ -1,7 +1,5 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.manual;
@ -13,8 +11,8 @@ let
in {
options = {
manual.html.enable = mkOption {
type = types.bool;
manual.html.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to install the HTML manual. This also installs the
@ -23,8 +21,8 @@ in {
'';
};
manual.manpages.enable = mkOption {
type = types.bool;
manual.manpages.enable = lib.mkOption {
type = lib.types.bool;
default = true;
example = false;
description = ''
@ -37,8 +35,8 @@ in {
'';
};
manual.json.enable = mkOption {
type = types.bool;
manual.json.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = ''
@ -52,10 +50,10 @@ in {
};
config = {
home.packages = mkMerge [
(mkIf cfg.html.enable [ docs.manual.html docs.manual.htmlOpenTool ])
(mkIf cfg.manpages.enable [ docs.manPages ])
(mkIf cfg.json.enable [ docs.options.json ])
home.packages = lib.mkMerge [
(lib.mkIf cfg.html.enable [ docs.manual.html docs.manual.htmlOpenTool ])
(lib.mkIf cfg.manpages.enable [ docs.manPages ])
(lib.mkIf cfg.json.enable [ docs.options.json ])
];
};

View file

@ -1,29 +1,29 @@
{ config, lib, pkgs, ... }:
with lib;
let
inherit (lib) types;
cfg = config.dconf;
toDconfIni = generators.toINI { mkKeyValue = mkIniKeyValue; };
toDconfIni = lib.generators.toINI { mkKeyValue = mkIniKeyValue; };
mkIniKeyValue = key: value: "${key}=${toString (hm.gvariant.mkValue value)}";
mkIniKeyValue = key: value:
"${key}=${toString (lib.hm.gvariant.mkValue value)}";
# The dconf keys managed by this configuration. We store this as part of the
# generation state to be able to reset keys that become unmanaged during
# switch.
stateDconfKeys = pkgs.writeText "dconf-keys.json" (builtins.toJSON
(concatLists (mapAttrsToList
(dir: entries: mapAttrsToList (key: _: "/${dir}/${key}") entries)
(lib.concatLists (lib.mapAttrsToList
(dir: entries: lib.mapAttrsToList (key: _: "/${dir}/${key}") entries)
cfg.settings)));
in {
meta.maintainers = [ maintainers.rycee ];
meta.maintainers = [ lib.maintainers.rycee ];
options = {
dconf = {
enable = mkOption {
enable = lib.mkOption {
type = types.bool;
# While technically dconf on darwin could work, our activation step
# requires dbus, which only *lightly* supports Darwin in general, and
@ -43,10 +43,10 @@ in {
'';
};
settings = mkOption {
type = with types; attrsOf (attrsOf hm.types.gvariant);
settings = lib.mkOption {
type = with types; attrsOf (attrsOf lib.hm.types.gvariant);
default = { };
example = literalExpression ''
example = lib.literalExpression ''
{
"org/gnome/calculator" = {
button-mode = "programming";
@ -75,7 +75,7 @@ in {
};
};
config = mkIf (cfg.enable && cfg.settings != { }) {
config = lib.mkIf (cfg.enable && cfg.settings != { }) {
# Make sure the dconf directory exists.
xdg.configFile."dconf/.keep".source = builtins.toFile "keep" "";
@ -84,53 +84,54 @@ in {
ln -s ${stateDconfKeys} $out/state/${stateDconfKeys.name}
'';
home.activation.dconfSettings = hm.dag.entryAfter [ "installPackages" ] (let
iniFile = pkgs.writeText "hm-dconf.ini" (toDconfIni cfg.settings);
home.activation.dconfSettings = lib.hm.dag.entryAfter [ "installPackages" ]
(let
iniFile = pkgs.writeText "hm-dconf.ini" (toDconfIni cfg.settings);
statePath = "state/${stateDconfKeys.name}";
statePath = "state/${stateDconfKeys.name}";
cleanup = pkgs.writeShellScript "dconf-cleanup" ''
set -euo pipefail
cleanup = pkgs.writeShellScript "dconf-cleanup" ''
set -euo pipefail
${config.lib.bash.initHomeManagerLib}
${config.lib.bash.initHomeManagerLib}
PATH=${makeBinPath [ pkgs.dconf pkgs.jq ]}''${PATH:+:}$PATH
PATH=${lib.makeBinPath [ pkgs.dconf pkgs.jq ]}''${PATH:+:}$PATH
oldState="$1"
newState="$2"
oldState="$1"
newState="$2"
# Can't do cleanup if we don't know the old state.
if [[ ! -f $oldState ]]; then
exit 0
# Can't do cleanup if we don't know the old state.
if [[ ! -f $oldState ]]; then
exit 0
fi
# Reset all keys that are present in the old generation but not the new
# one.
jq -r -n \
--slurpfile old "$oldState" \
--slurpfile new "$newState" \
'($old[] - $new[])[]' \
| while read -r key; do
verboseEcho "Resetting dconf key \"$key\""
run $DCONF_DBUS_RUN_SESSION dconf reset "$key"
done
'';
in ''
if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then
export DCONF_DBUS_RUN_SESSION=""
else
export DCONF_DBUS_RUN_SESSION="${pkgs.dbus}/bin/dbus-run-session --dbus-daemon=${pkgs.dbus}/bin/dbus-daemon"
fi
# Reset all keys that are present in the old generation but not the new
# one.
jq -r -n \
--slurpfile old "$oldState" \
--slurpfile new "$newState" \
'($old[] - $new[])[]' \
| while read -r key; do
verboseEcho "Resetting dconf key \"$key\""
run $DCONF_DBUS_RUN_SESSION dconf reset "$key"
done
'';
in ''
if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then
export DCONF_DBUS_RUN_SESSION=""
else
export DCONF_DBUS_RUN_SESSION="${pkgs.dbus}/bin/dbus-run-session --dbus-daemon=${pkgs.dbus}/bin/dbus-daemon"
fi
if [[ -v oldGenPath ]]; then
${cleanup} \
"$oldGenPath/${statePath}" \
"$newGenPath/${statePath}"
fi
if [[ -v oldGenPath ]]; then
${cleanup} \
"$oldGenPath/${statePath}" \
"$newGenPath/${statePath}"
fi
run $DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / < ${iniFile}
run $DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / < ${iniFile}
unset DCONF_DBUS_RUN_SESSION
'');
unset DCONF_DBUS_RUN_SESSION
'');
};
}

View file

@ -1,10 +1,8 @@
{ config, pkgs, lib, ... }:
with lib;
{ config, lib, ... }:
{
options.home = {
enableDebugInfo = mkEnableOption "" // {
enableDebugInfo = lib.mkEnableOption "" // {
description = ''
Some Nix packages provide debug symbols for
{command}`gdb` in the `debug` output.
@ -15,12 +13,11 @@ with lib;
};
};
config = mkIf config.home.enableDebugInfo {
config = lib.mkIf config.home.enableDebugInfo {
home.extraOutputsToInstall = [ "debug" ];
home.sessionVariables = {
NIX_DEBUG_INFO_DIRS =
"$NIX_DEBUG_INFO_DIRS\${NIX_DEBUG_INFO_DIRS:+:}${config.home.profileDirectory}/lib/debug";
home.sessionSearchVariables = {
NIX_DEBUG_INFO_DIRS = [ "${config.home.profileDirectory}/lib/debug" ];
};
};
}

View file

@ -1,7 +1,5 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.editorconfig;
@ -9,12 +7,12 @@ let
iniFormat = pkgs.formats.ini { };
in {
meta.maintainers = with maintainers; [ loicreynier ];
meta.maintainers = with lib.maintainers; [ loicreynier ];
options.editorconfig = {
enable = mkEnableOption "EditorConfig home configuration file";
enable = lib.mkEnableOption "EditorConfig home configuration file";
settings = mkOption {
settings = lib.mkOption {
type = iniFormat.type;
default = { };
description = ''
@ -23,7 +21,7 @@ in {
it must not be added here.
See <https://editorconfig.org> for documentation.
'';
example = literalExpression ''
example = lib.literalExpression ''
{
"*" = {
charset = "utf-8";
@ -39,9 +37,9 @@ in {
};
};
config = mkIf (cfg.enable && cfg.settings != { }) {
config = lib.mkIf (cfg.enable && cfg.settings != { }) {
home.file.".editorconfig".text = let
renderedSettings = generators.toINIWithGlobalSection { } {
renderedSettings = lib.generators.toINIWithGlobalSection { } {
globalSection = { root = true; };
sections = cfg.settings;
};

View file

@ -4,8 +4,6 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.fonts.fontconfig;
@ -13,10 +11,10 @@ let
profileDirectory = config.home.profileDirectory;
in {
meta.maintainers = [ maintainers.rycee ];
meta.maintainers = [ lib.maintainers.rycee ];
imports = [
(mkRenamedOptionModule [ "fonts" "fontconfig" "enableProfileFonts" ] [
(lib.mkRenamedOptionModule [ "fonts" "fontconfig" "enableProfileFonts" ] [
"fonts"
"fontconfig"
"enable"
@ -25,8 +23,8 @@ in {
options = {
fonts.fontconfig = {
enable = mkOption {
type = types.bool;
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to enable fontconfig configuration. This will, for
@ -38,8 +36,8 @@ in {
};
defaultFonts = {
monospace = mkOption {
type = with types; listOf str;
monospace = lib.mkOption {
type = with lib.types; listOf str;
default = [ ];
description = ''
Per-user default monospace font(s). Multiple fonts may be listed in
@ -47,8 +45,8 @@ in {
'';
};
sansSerif = mkOption {
type = with types; listOf str;
sansSerif = lib.mkOption {
type = with lib.types; listOf str;
default = [ ];
description = ''
Per-user default sans serif font(s). Multiple fonts may be listed
@ -56,8 +54,8 @@ in {
'';
};
serif = mkOption {
type = with types; listOf str;
serif = lib.mkOption {
type = with lib.types; listOf str;
default = [ ];
description = ''
Per-user default serif font(s). Multiple fonts may be listed in
@ -65,8 +63,8 @@ in {
'';
};
emoji = mkOption {
type = with types; listOf str;
emoji = lib.mkOption {
type = with lib.types; listOf str;
default = [ ];
description = ''
Per-user default emoji font(s). Multiple fonts may be listed in
@ -83,7 +81,7 @@ in {
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
home.packages = [
# Make sure that buildEnv creates a real directory path so that we avoid
# trying to write to a read-only location.
@ -105,7 +103,7 @@ in {
</fontconfig>
EOF
${getBin pkgs.fontconfig}/bin/fc-cache -f
${lib.getBin pkgs.fontconfig}/bin/fc-cache -f
rm -f $out/lib/fontconfig/cache/CACHEDIR.TAG
rmdir --ignore-fail-on-non-empty -p $out/lib/fontconfig/cache
@ -147,12 +145,12 @@ in {
"fontconfig/conf.d/52-hm-default-fonts.conf".text = let
genDefault = fonts: name:
optionalString (fonts != [ ]) ''
lib.optionalString (fonts != [ ]) ''
<alias binding="same">
<family>${name}</family>
<prefer>
${
concatStringsSep "" (map (font: ''
lib.concatStringsSep "" (map (font: ''
<family>${font}</family>
'') fonts)
}

View file

@ -1,29 +1,30 @@
{ config, lib, pkgs, ... }:
with lib;
{ config, lib, ... }:
let
inherit (lib) literalExpression mkOption optionalAttrs types;
cfg = config.gtk;
cfg2 = config.gtk.gtk2;
cfg3 = config.gtk.gtk3;
cfg4 = config.gtk.gtk4;
toGtk3Ini = generators.toINI {
toGtk3Ini = lib.generators.toINI {
mkKeyValue = key: value:
let value' = if isBool value then boolToString value else toString value;
in "${escape [ "=" ] key}=${value'}";
let
value' =
if lib.isBool value then lib.boolToString value else toString value;
in "${lib.escape [ "=" ] key}=${value'}";
};
formatGtk2Option = n: v:
let
v' = if isBool v then
boolToString value
else if isString v then
v' = if lib.isBool v then
lib.boolToString lib.value
else if lib.isString v then
''"${v}"''
else
toString v;
in "${escape [ "=" ] n} = ${v'}";
in "${lib.escape [ "=" ] n} = ${v'}";
themeType = types.submodule {
options = {
@ -100,20 +101,20 @@ let
};
in {
meta.maintainers = [ maintainers.rycee ];
meta.maintainers = [ lib.maintainers.rycee ];
imports = [
(mkRemovedOptionModule [ "gtk" "gtk3" "waylandSupport" ] ''
(lib.mkRemovedOptionModule [ "gtk" "gtk3" "waylandSupport" ] ''
This options is not longer needed and can be removed.
'')
];
options = {
gtk = {
enable = mkEnableOption "GTK 2/3 configuration";
enable = lib.mkEnableOption "GTK 2/3 configuration";
font = mkOption {
type = types.nullOr hm.types.fontType;
type = types.nullOr lib.hm.types.fontType;
default = null;
description = ''
The font to use in GTK+ 2/3 applications.
@ -219,7 +220,7 @@ in {
};
};
config = mkIf cfg.enable (let
config = lib.mkIf cfg.enable (let
gtkIni = optionalAttrs (cfg.font != null) {
gtk-font-name =
let fontSize = if cfg.font.size != null then cfg.font.size else 10;
@ -258,18 +259,17 @@ in {
};
optionalPackage = opt:
optional (opt != null && opt.package != null) opt.package;
lib.optional (opt != null && opt.package != null) opt.package;
in {
home.packages = concatMap optionalPackage [
home.packages = lib.concatMap optionalPackage [
cfg.font
cfg.theme
cfg.iconTheme
cfg.cursorTheme
];
home.file.${cfg2.configLocation}.text =
concatMapStrings (l: l + "\n") (mapAttrsToList formatGtk2Option gtkIni)
+ cfg2.extraConfig + "\n";
home.file.${cfg2.configLocation}.text = lib.concatMapStrings (l: l + "\n")
(lib.mapAttrsToList formatGtk2Option gtkIni) + cfg2.extraConfig + "\n";
home.sessionVariables.GTK2_RC_FILES = cfg2.configLocation;
@ -277,16 +277,17 @@ in {
toGtk3Ini { Settings = gtkIni // cfg3.extraConfig; };
xdg.configFile."gtk-3.0/gtk.css" =
mkIf (cfg3.extraCss != "") { text = cfg3.extraCss; };
lib.mkIf (cfg3.extraCss != "") { text = cfg3.extraCss; };
xdg.configFile."gtk-3.0/bookmarks" = mkIf (cfg3.bookmarks != [ ]) {
text = concatMapStrings (l: l + "\n") cfg3.bookmarks;
xdg.configFile."gtk-3.0/bookmarks" = lib.mkIf (cfg3.bookmarks != [ ]) {
text = lib.concatMapStrings (l: l + "\n") cfg3.bookmarks;
};
xdg.configFile."gtk-4.0/settings.ini".text =
toGtk3Ini { Settings = gtkIni // cfg4.extraConfig; };
xdg.configFile."gtk-4.0/gtk.css" = mkIf (gtk4Css != "") { text = gtk4Css; };
xdg.configFile."gtk-4.0/gtk.css" =
lib.mkIf (gtk4Css != "") { text = gtk4Css; };
dconf.settings."org/gnome/desktop/interface" = dconfIni;
});

View file

@ -0,0 +1,92 @@
{ config, lib, pkgs, ... }:
let
inherit (pkgs.stdenv) isDarwin;
cfg = config.mozilla;
defaultPaths = [
# Link a .keep file to keep the directory around
(pkgs.writeTextDir "lib/mozilla/native-messaging-hosts/.keep" "")
];
thunderbirdNativeMessagingHostsPath = if isDarwin then
"Library/Mozilla/NativeMessagingHosts"
else
".mozilla/native-messaging-hosts";
firefoxNativeMessagingHostsPath = if isDarwin then
"Library/Application Support/Mozilla/NativeMessagingHosts"
else
".mozilla/native-messaging-hosts";
in {
meta.maintainers = with lib.maintainers; [
booxter
rycee
lib.hm.maintainers.bricked
];
options.mozilla = {
firefoxNativeMessagingHosts = lib.mkOption {
internal = true;
type = with lib.types; listOf package;
default = [ ];
description = ''
List of Firefox native messaging hosts to configure.
'';
};
thunderbirdNativeMessagingHosts = lib.mkOption {
internal = true;
type = with lib.types; listOf package;
default = [ ];
description = ''
List of Thunderbird native messaging hosts to configure.
'';
};
};
config = lib.mkIf (cfg.firefoxNativeMessagingHosts != [ ]
|| cfg.thunderbirdNativeMessagingHosts != [ ]) {
home.file = if isDarwin then
let
firefoxNativeMessagingHostsJoined = pkgs.symlinkJoin {
name = "ff-native-messaging-hosts";
paths = defaultPaths ++ cfg.firefoxNativeMessagingHosts;
};
thunderbirdNativeMessagingHostsJoined = pkgs.symlinkJoin {
name = "th-native-messaging-hosts";
paths = defaultPaths ++ cfg.thunderbirdNativeMessagingHosts;
};
in {
"${thunderbirdNativeMessagingHostsPath}" =
lib.mkIf (cfg.thunderbirdNativeMessagingHosts != [ ]) {
source =
"${thunderbirdNativeMessagingHostsJoined}/lib/mozilla/native-messaging-hosts";
recursive = true;
};
"${firefoxNativeMessagingHostsPath}" =
lib.mkIf (cfg.firefoxNativeMessagingHosts != [ ]) {
source =
"${firefoxNativeMessagingHostsJoined}/lib/mozilla/native-messaging-hosts";
recursive = true;
};
}
else
let
nativeMessagingHostsJoined = pkgs.symlinkJoin {
name = "mozilla-native-messaging-hosts";
# on Linux, the directory is shared between Firefox and Thunderbird; merge both into one
paths = defaultPaths ++ cfg.firefoxNativeMessagingHosts
++ cfg.thunderbirdNativeMessagingHosts;
};
in {
"${firefoxNativeMessagingHostsPath}" = {
source =
"${nativeMessagingHostsJoined}/lib/mozilla/native-messaging-hosts";
recursive = true;
};
};
};
}

View file

@ -1,6 +1,8 @@
{ config, lib, options, pkgs, ... }:
with lib;
{ config, lib, pkgs, ... }:
let
inherit (lib) mkOption types;
cfg = config.news;
hostPlatform = pkgs.stdenv.hostPlatform;
@ -39,10 +41,12 @@ let
};
};
config = { id = mkDefault (builtins.hashString "sha256" config.message); };
config = {
id = lib.mkDefault (builtins.hashString "sha256" config.message);
};
});
in {
meta.maintainers = [ maintainers.rycee ];
meta.maintainers = [ lib.maintainers.rycee ];
options = {
news = {
@ -1653,6 +1657,23 @@ in {
'';
}
{
time = "2024-05-21T20:22:57+00:00";
condition = config.programs.git.signing != { };
message = ''
The Git module now supports signing via SSH and X.509 keys, in addition to OpenPGP/GnuPG,
via the `programs.git.signing.format` option.
The format defaults to `openpgp` for now, due to backwards compatibility reasons this is
not guaranteed to last! GPG users should manually set `programs.git.signing.format` to
`openpgp` as soon as possible.
Accordingly, `programs.git.signing.gpgPath` has been renamed to the more generic option
`programs.git.signing.signer` as not everyone uses GPG.
Please migrate to the new option to suppress the generated warning.
'';
}
{
time = "2024-05-25T14:36:03+00:00";
message = ''
@ -1700,6 +1721,16 @@ in {
'';
}
{
time = "2024-08-18T11:42:08+00:00";
message = ''
A new module is available: 'programs.lapce'.
Lightning-fast and Powerful Code Editor written in Rust.
See https://lapce.dev/ for more.
'';
}
{
time = "2024-09-13T08:58:17+00:00";
condition = hostPlatform.isLinux;
@ -1864,8 +1895,8 @@ in {
{
time = "2024-12-08T17:22:13+00:00";
condition = let
usingMbsync = any (a: a.mbsync.enable)
(attrValues config.accounts.email.accounts);
usingMbsync = lib.any (a: a.mbsync.enable)
(lib.attrValues config.accounts.email.accounts);
in usingMbsync;
message = ''
isync/mbsync 1.5.0 has changed several things.
@ -1946,6 +1977,7 @@ in {
speed, features, or native UIs. Ghostty provides all three.
'';
}
{
time = "2025-01-04T15:00:00+00:00";
condition = hostPlatform.isLinux;
@ -1960,6 +1992,154 @@ in {
as well as wf-shell.
'';
}
{
time = "2025-01-21T17:28:13+00:00";
condition = with config.programs.yazi; enable && enableFishIntegration;
message = ''
Yazi's fish shell integration wrapper now calls the 'yazi' executable
directly, ignoring any shell aliases with the same name.
Your configuration may break if you rely on the wrapper calling a
'yazi' alias.
'';
}
{
time = "2025-01-29T17:34:53+00:00";
condition = config.programs.firefox.enable;
message = ''
The Firefox module now provides a
'programs.firefox.profiles.<name>.preConfig' option.
It allows extra preferences to be added to 'user.js' before the
options specified in 'programs.firefox.profiles.<name>.settings', so
that they can be overwritten.
'';
}
{
time = "2025-01-29T19:11:20+00:00";
condition = hostPlatform.isDarwin;
message = ''
A new module is available: 'programs.aerospace'.
AeroSpace is an i3-like tiling window manager for macOS.
See https://github.com/nikitabobko/AeroSpace for more.
'';
}
{
time = "2025-01-30T09:18:55+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.linux-wallpaperengine'.
Reproduce the background functionality of Wallpaper Engine on Linux
systems.
'';
}
{
time = "2025-02-07T22:31:45+00:00";
message = ''
All 'programs.<PROGRAM>.enable<SHELL>Integration' values now default
to the new 'home.shell.enable<SHELL>Integration' options, which
inherit from the new the 'home.shell.enableShellIntegration' option.
The following inconsistent default values change from 'false' to
'true':
- programs.zellij.enableBashIntegration
- programs.zellij.enableFishIntegration
- programs.zellij.enableZshIntegration
'';
}
{
time = "2025-02-11T15:25:26+00:00";
message = ''
A new module is available: 'programs.git-worktree-switcher'.
git-worktree-switcher allows you to quickly switch git worktrees.
It includes shell completions for Bash, Fish and Zsh.
See https://github.com/mateusauler/git-worktree-switcher for more.
'';
}
{
time = "2025-02-20T18:39:31+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'programs.swayimg'.
swayimg is a fully customizable and lightweight image viewer for
Wayland based display servers.
See https://github.com/artemsen/swayimg for more.
'';
}
{
time = "2025-02-16T17:00:00+00:00";
message = ''
A new module is available: 'services.wluma'.
Wluma is a tool for Wayland compositors to automatically adjust
screen brightness based on the screen contents and amount of ambient light around you.
'';
}
{
time = "2025-02-21T16:53:20+00:00";
message = ''
A new module is available: 'programs.earthly'.
Earthly is a build configuration framework utilizing buildkit and
Dockerfile-like syntax for fast builds and simplicity.
'';
}
{
time = "2025-02-22T16:53:20+00:00";
message = ''
A new module is available: 'programs.jqp'.
A TUI playground for experimenting with `jq`.
'';
}
{
time = "2025-02-22T16:46:56+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.wpaperd'.
This replaces the existing module, 'programs.wpaperd', and adds a
systemd service to ensure its execution.
'';
}
{
time = "2025-01-26T16:40:00+00:00";
message = ''
A new module is available: 'programs.mods'
mods is a command line AI tool that is highly configurable and allows
querying AI models hosted locally or by other services (OpenAI,
Cohere, Groq).
'';
}
{
time = "2025-03-11T02:34:43+00:00";
condition = config.programs.zsh.enable;
message = ''
A new module is available: 'programs.zsh.initContent'.
initContent option allows you to set the content of the zshrc file,
you can use `lib.mkOrder` to specify the order of the content you want to insert.
'';
}
];
};
}

View file

@ -1,7 +1,5 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.nixpkgs;
@ -17,28 +15,28 @@ let
let
lhs = optCall lhs_ { inherit pkgs; };
rhs = optCall rhs_ { inherit pkgs; };
in lhs // rhs // optionalAttrs (lhs ? packageOverrides) {
in lhs // rhs // lib.optionalAttrs (lhs ? packageOverrides) {
packageOverrides = pkgs:
optCall lhs.packageOverrides pkgs
// optCall (attrByPath [ "packageOverrides" ] ({ }) rhs) pkgs;
} // optionalAttrs (lhs ? perlPackageOverrides) {
// optCall (lib.attrByPath [ "packageOverrides" ] { } rhs) pkgs;
} // lib.optionalAttrs (lhs ? perlPackageOverrides) {
perlPackageOverrides = pkgs:
optCall lhs.perlPackageOverrides pkgs
// optCall (attrByPath [ "perlPackageOverrides" ] ({ }) rhs) pkgs;
// optCall (lib.attrByPath [ "perlPackageOverrides" ] { } rhs) pkgs;
};
# Copied from nixpkgs.nix.
configType = mkOptionType {
configType = lib.mkOptionType {
name = "nixpkgs-config";
description = "nixpkgs config";
check = x:
let traceXIfNot = c: if c x then true else lib.traceSeqN 1 x false;
in traceXIfNot isConfig;
merge = args: fold (def: mergeConfig def.value) { };
merge = args: lib.fold (def: mergeConfig def.value) { };
};
# Copied from nixpkgs.nix.
overlayType = mkOptionType {
overlayType = lib.mkOptionType {
name = "nixpkgs-overlay";
description = "nixpkgs overlay";
check = builtins.isFunction;
@ -46,28 +44,36 @@ let
};
in {
meta.maintainers = with maintainers; [ thiagokokada ];
meta.maintainers = with lib.maintainers; [ thiagokokada ];
options.nixpkgs = {
config = mkOption {
config = lib.mkOption {
default = null;
type = types.nullOr configType;
type = lib.types.nullOr configType;
visible = false;
};
overlays = mkOption {
overlays = lib.mkOption {
default = null;
type = types.nullOr (types.listOf overlayType);
type = lib.types.nullOr (lib.types.listOf overlayType);
visible = false;
};
};
config = {
assertions = [{
assertion = cfg.config == null || cfg.overlays == null;
message = ''
`nixpkgs` options are disabled when `home-manager.useGlobalPkgs` is enabled.
'';
}];
assertions = [
# TODO: Re-enable assertion after 25.05 (&&)
{
assertion = cfg.config == null || cfg.overlays == null;
message = ''
`nixpkgs` options are disabled when `home-manager.useGlobalPkgs` is enabled.
'';
}
];
warnings = lib.optional ((cfg.config != null) || (cfg.overlays != null)) ''
You have set either `nixpkgs.config` or `nixpkgs.overlays` while using `home-manager.useGlobalPkgs`.
This will soon not be possible. Please remove all `nixpkgs` options when using `home-manager.useGlobalPkgs`.
'';
};
}

View file

@ -2,8 +2,6 @@
{ config, lib, pkgs, pkgsPath, ... }:
with lib;
let
isConfig = x: builtins.isAttrs x || builtins.isFunction x;
@ -14,40 +12,40 @@ let
let
lhs = optCall lhs_ { inherit pkgs; };
rhs = optCall rhs_ { inherit pkgs; };
in lhs // rhs // optionalAttrs (lhs ? packageOverrides) {
in lhs // rhs // lib.optionalAttrs (lhs ? packageOverrides) {
packageOverrides = pkgs:
optCall lhs.packageOverrides pkgs
// optCall (attrByPath [ "packageOverrides" ] ({ }) rhs) pkgs;
} // optionalAttrs (lhs ? perlPackageOverrides) {
// optCall (lib.attrByPath [ "packageOverrides" ] { } rhs) pkgs;
} // lib.optionalAttrs (lhs ? perlPackageOverrides) {
perlPackageOverrides = pkgs:
optCall lhs.perlPackageOverrides pkgs
// optCall (attrByPath [ "perlPackageOverrides" ] ({ }) rhs) pkgs;
// optCall (lib.attrByPath [ "perlPackageOverrides" ] { } rhs) pkgs;
};
configType = mkOptionType {
configType = lib.mkOptionType {
name = "nixpkgs-config";
description = "nixpkgs config";
check = x:
let traceXIfNot = c: if c x then true else lib.traceSeqN 1 x false;
in traceXIfNot isConfig;
merge = args: fold (def: mergeConfig def.value) { };
merge = args: lib.fold (def: mergeConfig def.value) { };
};
overlayType = mkOptionType {
overlayType = lib.mkOptionType {
name = "nixpkgs-overlay";
description = "nixpkgs overlay";
check = builtins.isFunction;
check = lib.isFunction;
merge = lib.mergeOneOption;
};
_pkgs = import pkgsPath (filterAttrs (n: v: v != null) config.nixpkgs);
_pkgs = import pkgsPath (lib.filterAttrs (n: v: v != null) config.nixpkgs);
in {
options.nixpkgs = {
config = mkOption {
config = lib.mkOption {
default = null;
example = { allowBroken = true; };
type = types.nullOr configType;
type = lib.types.nullOr configType;
description = ''
The configuration of the Nix Packages collection. (For
details, see the Nixpkgs documentation.) It allows you to set
@ -72,9 +70,9 @@ in {
'';
};
overlays = mkOption {
overlays = lib.mkOption {
default = null;
example = literalExpression ''
example = lib.literalExpression ''
[
(final: prev: {
openssh = prev.openssh.override {
@ -85,7 +83,7 @@ in {
})
]
'';
type = types.nullOr (types.listOf overlayType);
type = lib.types.nullOr (lib.types.listOf overlayType);
description = ''
List of overlays to use with the Nix Packages collection. (For
details, see the Nixpkgs documentation.) It allows you to
@ -105,8 +103,8 @@ in {
'';
};
system = mkOption {
type = types.str;
system = lib.mkOption {
type = lib.types.str;
example = "i686-linux";
internal = true;
description = ''
@ -123,7 +121,7 @@ in {
_module.args = {
# We use a no-op override to make sure that the option can be merged without evaluating
# `_pkgs`, see https://github.com/nix-community/home-manager/pull/993
pkgs = mkOverride modules.defaultOverridePriority _pkgs;
pkgs = lib.mkOverride lib.modules.defaultOverridePriority _pkgs;
pkgs_i686 =
if _pkgs.stdenv.isLinux && _pkgs.stdenv.hostPlatform.isx86 then
_pkgs.pkgsi686Linux

View file

@ -1,25 +1,24 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.xsession.numlock;
in {
meta.maintainers = [ maintainers.evanjs ];
meta.maintainers = [ lib.maintainers.evanjs ];
options = { xsession.numlock.enable = mkEnableOption "Num Lock"; };
options = { xsession.numlock.enable = lib.mkEnableOption "Num Lock"; };
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
assertions = [
(hm.assertions.assertPlatform "xsession.numlock" pkgs platforms.linux)
(lib.hm.assertions.assertPlatform "xsession.numlock" pkgs
lib.platforms.linux)
];
systemd.user.services.numlockx = {
Unit = {
Description = "NumLockX";
After = [ "graphical-session-pre.target" ];
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};

View file

@ -1,18 +1,16 @@
{ config, lib, pkgs, ... }:
with lib;
{ config, lib, ... }:
let
cfg = config.pam;
in {
meta.maintainers = with maintainers; [ rycee veehaitch ];
meta.maintainers = with lib.maintainers; [ rycee veehaitch ];
options = {
pam.sessionVariables = mkOption {
pam.sessionVariables = lib.mkOption {
default = { };
type = types.attrs;
type = lib.types.attrs;
example = { EDITOR = "vim"; };
description = ''
Environment variables that will be set for the PAM session.
@ -25,10 +23,10 @@ in {
};
pam.yubico.authorizedYubiKeys = {
ids = mkOption {
type = with types;
ids = lib.mkOption {
type = with lib.types;
let
yubiKeyId = addCheck str (s: stringLength s == 12) // {
yubiKeyId = addCheck str (s: lib.stringLength s == 12) // {
name = "yubiKeyId";
description = "string of length 12";
};
@ -41,8 +39,8 @@ in {
'';
};
path = mkOption {
type = types.str;
path = lib.mkOption {
type = lib.types.str;
default = ".yubico/authorized_yubikeys";
description = ''
File path to write the authorized YubiKeys,
@ -52,16 +50,16 @@ in {
};
};
config = mkMerge [
(mkIf (cfg.sessionVariables != { }) {
home.file.".pam_environment".text = concatStringsSep "\n"
(mapAttrsToList (n: v: ''${n} OVERRIDE="${toString v}"'')
config = lib.mkMerge [
(lib.mkIf (cfg.sessionVariables != { }) {
home.file.".pam_environment".text = lib.concatStringsSep "\n"
(lib.mapAttrsToList (n: v: ''${n} OVERRIDE="${toString v}"'')
cfg.sessionVariables) + "\n";
})
(mkIf (cfg.yubico.authorizedYubiKeys.ids != [ ]) {
(lib.mkIf (cfg.yubico.authorizedYubiKeys.ids != [ ]) {
home.file.${cfg.yubico.authorizedYubiKeys.path}.text =
concatStringsSep ":"
lib.concatStringsSep ":"
([ config.home.username ] ++ cfg.yubico.authorizedYubiKeys.ids);
})
];

View file

@ -13,6 +13,11 @@ let
libsForQt5.plasma-integration
libsForQt5.systemsettings
];
kde6 = [
kdePackages.kio
kdePackages.plasma-integration
kdePackages.systemsettings
];
lxqt = [ lxqt.lxqt-qtplugin lxqt.lxqt-config ];
qtct = [ libsForQt5.qt5ct qt6Packages.qt6ct ];
};
@ -21,6 +26,7 @@ let
styleNames = {
gtk = "gtk2";
qtct = "qt5ct";
kde6 = "kde";
};
# Maps known lowercase style names to style packages. Non-exhaustive.
@ -75,6 +81,8 @@ in {
[ "libsForQt5" "qt5ct" ]
[ "libsForQt5" "qtstyleplugins" ]
[ "libsForQt5" "systemsettings" ]
[ "kdePackages" "plasma-integration" ]
[ "kdePackages" "systemsettings" ]
[ "lxqt" "lxqt-config" ]
[ "lxqt" "lxqt-qtplugin" ]
[ "qt6Packages" "qt6ct" ]
@ -114,7 +122,10 @@ in {
applications
`kde`
: Use Qt settings from Plasma
: Use Qt settings from Plasma 5
`kde6`
: Use Qt settings from Plasma 6
'';
};
package = lib.mkOption {
@ -131,8 +142,8 @@ in {
};
in lib.mkOption {
type = with lib.types;
nullOr
(either (enum [ "gtk" "gtk3" "gnome" "adwaita" "lxqt" "qtct" "kde" ])
nullOr (either
(enum [ "gtk" "gtk3" "gnome" "adwaita" "lxqt" "qtct" "kde" "kde6" ])
(lib.types.submodule { options = newOption; }));
default = null;
description = ''
@ -218,13 +229,10 @@ in {
inherit (config.home) profileDirectory;
qtVersions = with pkgs; [ qt5 qt6 ];
makeQtPath = prefix:
lib.concatStringsSep ":"
(map (qt: "${profileDirectory}/${qt.qtbase.${prefix}}") qtVersions);
in {
QT_PLUGIN_PATH = "$QT_PLUGIN_PATH\${QT_PLUGIN_PATH:+:}"
+ (makeQtPath "qtPluginPrefix");
QML2_IMPORT_PATH = "$QML2_IMPORT_PATH\${QML2_IMPORT_PATH:+:}"
+ (makeQtPath "qtQmlPrefix");
QT_PLUGIN_PATH = makeQtPath "qtPluginPrefix";
QML2_IMPORT_PATH = makeQtPath "qtQmlPrefix";
};
in lib.mkIf cfg.enable {
@ -248,19 +256,14 @@ in {
home = {
sessionVariables = envVars;
# home.sessionVariables does not support setting the same environment
# variable to different values.
# Since some other modules may set the QT_PLUGIN_PATH or QML2_IMPORT_PATH
# to their own value, e.g.: fcitx5, we avoid conflicts by setting
# the values in home.sessionVariablesExtra instead.
sessionVariablesExtra = ''
export QT_PLUGIN_PATH=${envVarsExtra.QT_PLUGIN_PATH}
export QML2_IMPORT_PATH=${envVarsExtra.QML2_IMPORT_PATH}
'';
sessionSearchVariables = envVarsExtra;
};
# Apply theming also to apps started by systemd.
systemd.user.sessionVariables = envVars // envVarsExtra;
systemd.user.sessionVariables = envVars // {
QT_PLUGIN_PATH = lib.concatStringsSep ":" envVarsExtra.QT_PLUGIN_PATH;
QML2_IMPORT_PATH = lib.concatStringsSep ":" envVarsExtra.QML2_IMPORT_PATH;
};
home.packages = (lib.findFirst (x: x != [ ]) [ ] [
(lib.optionals (platformTheme.package != null)

43
modules/misc/shell.nix Normal file
View file

@ -0,0 +1,43 @@
{ config, lib, ... }:
{
options.home.shell = {
enableShellIntegration = lib.mkOption {
type = lib.types.bool;
default = true;
example = false;
description = ''
Whether to globally enable shell integration for all supported shells.
Individual shell integrations can be overridden with their respective
`shell.enable<SHELL>Integration` option. For example, the following
declaration globally disables shell integration for Bash:
```nix
home.shell.enableBashIntegration = false;
```
'';
};
enableBashIntegration = lib.hm.shell.mkBashIntegrationOption {
inherit config;
baseName = "Shell";
};
enableFishIntegration = lib.hm.shell.mkFishIntegrationOption {
inherit config;
baseName = "Shell";
};
enableIonIntegration = lib.hm.shell.mkIonIntegrationOption {
inherit config;
baseName = "Shell";
};
enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption {
inherit config;
baseName = "Shell";
};
enableZshIntegration = lib.hm.shell.mkZshIntegrationOption {
inherit config;
baseName = "Shell";
};
};
}

View file

@ -1,27 +1,25 @@
{ config, name, extendModules, lib, ... }:
with lib;
{
imports =
[ (mkRenamedOptionModule [ "specialization" ] [ "specialisation" ]) ];
[ (lib.mkRenamedOptionModule [ "specialization" ] [ "specialisation" ]) ];
options.specialisation = mkOption {
type = types.attrsOf (types.submodule {
options.specialisation = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule {
options = {
configuration = mkOption {
configuration = lib.mkOption {
type = let
extended = extendModules {
modules = [{
# Prevent infinite recursion
specialisation = mkOverride 0 { };
specialisation = lib.mkOverride 0 { };
# If used inside the NixOS/nix-darwin module, we get conflicting definitions
# of `name` inside the specialisation: one is the user name coming from the
# NixOS module definition and the other is `configuration`, the name of this
# option. Thus we need to explicitly wire the former into the module arguments.
# See discussion at https://github.com/nix-community/home-manager/issues/3716
_module.args.name = mkForce name;
_module.args.name = lib.mkForce name;
}];
};
in extended.type;
@ -70,14 +68,21 @@ with lib;
'';
};
config = mkIf (config.specialisation != { }) {
config = lib.mkIf (config.specialisation != { }) {
assertions = map (n: {
assertion = !lib.hasInfix "/" n;
message =
"<name> in specialisation.<name> cannot contain a forward slash.";
}) (lib.attrNames config.specialisation);
home.extraBuilderCommands = let
link = n: v:
let pkg = v.configuration.home.activationPackage;
in "ln -s ${pkg} $out/specialisation/${n}";
in "ln -s ${pkg} $out/specialisation/${lib.escapeShellArg n}";
in ''
mkdir $out/specialisation
${concatStringsSep "\n" (mapAttrsToList link config.specialisation)}
${lib.concatStringsSep "\n"
(lib.mapAttrsToList link config.specialisation)}
'';
};
}

View file

@ -1,13 +1,11 @@
{ lib, ... }:
with lib;
{
meta.maintainers = [ maintainers.rycee ];
meta.maintainers = [ lib.maintainers.rycee ];
options.submoduleSupport = {
enable = mkOption {
type = types.bool;
enable = lib.mkOption {
type = lib.types.bool;
default = false;
internal = true;
description = ''
@ -16,8 +14,8 @@ with lib;
'';
};
externalPackageInstall = mkOption {
type = types.bool;
externalPackageInstall = lib.mkOption {
type = lib.types.bool;
default = false;
internal = true;
description = ''
@ -39,9 +37,9 @@ with lib;
# module system can not inform modules about their non-existence; see
# https://github.com/NixOS/nixpkgs/issues/311709#issuecomment-2110861842
_module.args = {
osConfig = mkDefault null;
nixosConfig = mkDefault null;
darwinConfig = mkDefault null;
osConfig = lib.mkDefault null;
nixosConfig = lib.mkDefault null;
darwinConfig = lib.mkDefault null;
};
};
}

View file

@ -1,16 +1,14 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.systemd.user.tmpfiles;
in {
meta.maintainers = [ maintainers.dawidsowa ];
meta.maintainers = [ lib.maintainers.dawidsowa ];
options.systemd.user.tmpfiles.rules = mkOption {
type = types.listOf types.str;
options.systemd.user.tmpfiles.rules = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
example = [ "L /home/user/Documents - - - - /mnt/data/Documents" ];
description = ''
@ -21,10 +19,10 @@ in {
'';
};
config = mkIf (cfg.rules != [ ]) {
config = lib.mkIf (cfg.rules != [ ]) {
assertions = [
(hm.assertions.assertPlatform "systemd.user.tmpfiles" pkgs
platforms.linux)
(lib.hm.assertions.assertPlatform "systemd.user.tmpfiles" pkgs
lib.platforms.linux)
];
xdg.configFile = {
@ -32,7 +30,7 @@ in {
text = ''
# This file is created automatically and should not be modified.
# Please change the option systemd.user.tmpfiles.rules instead.
${concatStringsSep "\n" cfg.rules}
${lib.concatStringsSep "\n" cfg.rules}
'';
onChange = "${pkgs.systemd}/bin/systemd-tmpfiles --user --create";
};

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, ... }:
let

View file

@ -1,12 +1,13 @@
{ config, lib, ... }:
with lib;
let
inherit (lib) types;
let releaseInfo = lib.importJSON ../../release.json;
releaseInfo = lib.importJSON ../../release.json;
in {
options = {
home.stateVersion = mkOption {
home.stateVersion = lib.mkOption {
type = types.enum [
"18.09"
"19.03"
@ -39,20 +40,20 @@ in {
};
home.version = {
full = mkOption {
full = lib.mkOption {
internal = true;
readOnly = true;
type = types.str;
default = let
inherit (config.home.version) release revision;
suffix =
optionalString (revision != null) "+${substring 0 8 revision}";
suffix = lib.optionalString (revision != null)
"+${lib.substring 0 8 revision}";
in "${release}${suffix}";
example = "22.11+213a0629";
description = "The full Home Manager version.";
};
release = mkOption {
release = lib.mkOption {
internal = true;
readOnly = true;
type = types.str;
@ -61,7 +62,7 @@ in {
description = "The Home Manager release.";
};
isReleaseBranch = mkOption {
isReleaseBranch = lib.mkOption {
internal = true;
readOnly = true;
type = types.bool;
@ -72,11 +73,14 @@ in {
'';
};
revision = mkOption {
revision = lib.mkOption {
internal = true;
type = types.nullOr types.str;
default = let gitRepo = "${toString ./../..}/.git";
in if pathIsGitRepo gitRepo then commitIdFromGitRepo gitRepo else null;
in if lib.pathIsGitRepo gitRepo then
lib.commitIdFromGitRepo gitRepo
else
null;
description = ''
The Git revision from which this Home Manager configuration was built.
'';

View file

@ -1,9 +1,7 @@
{ config, lib, pkgs, ... }:
with lib;
{
meta.maintainers = [ maintainers.rycee ];
meta.maintainers = [ lib.maintainers.rycee ];
options.programs = let
description = ''
@ -12,13 +10,17 @@ with lib;
directory.
'';
in {
bash.enableVteIntegration = mkEnableOption "" // { inherit description; };
bash.enableVteIntegration = lib.mkEnableOption "" // {
inherit description;
};
zsh.enableVteIntegration = mkEnableOption "" // { inherit description; };
zsh.enableVteIntegration = lib.mkEnableOption "" // {
inherit description;
};
};
config = mkMerge [
(mkIf config.programs.bash.enableVteIntegration {
config = lib.mkMerge [
(lib.mkIf config.programs.bash.enableVteIntegration {
# Unfortunately we have to do a little dance here to fix two
# problems with the upstream vte.sh file:
#
@ -42,7 +44,7 @@ with lib;
'';
})
(mkIf config.programs.zsh.enableVteIntegration {
(lib.mkIf config.programs.zsh.enableVteIntegration {
programs.zsh.initExtra = ''
. ${pkgs.vte}/etc/profile.d/vte.sh
'';

View file

@ -0,0 +1,40 @@
{ config, lib, ... }:
let
inherit (builtins) baseNameOf listToAttrs map unsafeDiscardStringContext;
inherit (lib) literalExpression mkEnableOption mkIf mkOption types;
cfg = config.xdg.autostart;
/* "/nix/store/x-foo/application.desktop" -> {
name = "autostart/application.desktop";
value = { source = "/nix/store/x-foo/application.desktop"; };
}
*/
mapDesktopEntry = entry: {
name = "autostart/${unsafeDiscardStringContext (baseNameOf entry)}";
value.source = entry;
};
in {
meta.maintainers = with lib.maintainers; [ Scrumplex ];
options.xdg.autostart = {
enable = mkEnableOption "creation of XDG autostart entries";
entries = mkOption {
type = with types; listOf path;
description = ''
Paths to desktop files that should be linked to `XDG_CONFIG_HOME/autostart`
'';
default = [ ];
example = literalExpression ''
[
"''${pkgs.evolution}/share/applications/org.gnome.Evolution.desktop"
]
'';
};
};
config = mkIf (cfg.enable && cfg.entries != [ ]) {
xdg.configFile = listToAttrs (map mapDesktopEntry cfg.entries);
};
}

View file

@ -1,13 +1,13 @@
{ config, lib, pkgs, ... }:
with lib;
let
inherit (lib) literalExpression mkOption types;
desktopEntry = {
imports = [
(mkRemovedOptionModule [ "extraConfig" ]
(lib.mkRemovedOptionModule [ "extraConfig" ]
"The `extraConfig` option of `xdg.desktopEntries` has been removed following a change in Nixpkgs.")
(mkRemovedOptionModule [ "fileValidation" ]
(lib.mkRemovedOptionModule [ "fileValidation" ]
"Validation of the desktop file is always enabled.")
];
options = {
@ -172,12 +172,12 @@ let
type exec icon comment terminal genericName startupNotify noDisplay
prefersNonDefaultGPU actions;
desktopName = config.name;
mimeTypes = optionals (config.mimeType != null) config.mimeType;
categories = optionals (config.categories != null) config.categories;
mimeTypes = lib.optionals (config.mimeType != null) config.mimeType;
categories = lib.optionals (config.categories != null) config.categories;
extraConfig = config.settings;
};
in {
meta.maintainers = [ hm.maintainers.cwyc ];
meta.maintainers = [ lib.hm.maintainers.cwyc ];
options.xdg.desktopEntries = mkOption {
description = ''
@ -203,13 +203,16 @@ in {
'';
};
config = mkIf (config.xdg.desktopEntries != { }) {
config = lib.mkIf (config.xdg.desktopEntries != { }) {
assertions = [
(hm.assertions.assertPlatform "xdg.desktopEntries" pkgs platforms.linux)
] ++ flatten (catAttrs "assertions" (attrValues config.xdg.desktopEntries));
(lib.hm.assertions.assertPlatform "xdg.desktopEntries" pkgs
lib.platforms.linux)
] ++ lib.flatten
(lib.catAttrs "assertions" (lib.attrValues config.xdg.desktopEntries));
home.packages = (map hiPrio # we need hiPrio to override existing entries
(attrsets.mapAttrsToList makeFile config.xdg.desktopEntries));
home.packages =
(map lib.hiPrio # we need hiPrio to override existing entries
(lib.attrsets.mapAttrsToList makeFile config.xdg.desktopEntries));
};
}

View file

@ -1,16 +1,15 @@
{ config, lib, pkgs, ... }:
with lib;
let
inherit (lib) mkOption types;
cfg = config.xdg.mimeApps;
strListOrSingleton = with types;
coercedTo (either (listOf str) str) toList (listOf str);
coercedTo (either (listOf str) str) lib.toList (listOf str);
in {
meta.maintainers = with maintainers; [ euxane ];
meta.maintainers = with lib.maintainers; [ euxane ];
options.xdg.mimeApps = {
enable = mkOption {
@ -29,7 +28,7 @@ in {
associations.added = mkOption {
type = types.attrsOf strListOrSingleton;
default = { };
example = literalExpression ''
example = lib.literalExpression ''
{
"mimetype1" = [ "foo1.desktop" "foo2.desktop" "foo3.desktop" ];
"mimetype2" = "foo4.desktop";
@ -56,7 +55,7 @@ in {
defaultApplications = mkOption {
type = types.attrsOf strListOrSingleton;
default = { };
example = literalExpression ''
example = lib.literalExpression ''
{
"mimetype1" = [ "default1.desktop" "default2.desktop" ];
}
@ -71,22 +70,22 @@ in {
};
};
config = mkMerge [
config = lib.mkMerge [
{
# Given a package that installs .desktop files in the usual location,
# return a mapping from mime types to lists of desktop file names. This is
# suitable for use with `xdg.mimeApps.defaultApplications`.
lib.xdg.mimeAssociations = let
processLines = str:
zipAttrs
(filter (e: e != null) (map processLine (splitString "\n" str)));
lib.zipAttrs (lib.filter (e: e != null)
(map processLine (lib.splitString "\n" str)));
processLine = str:
let
entry = splitString ";" str;
k = elemAt entry 0;
v = elemAt entry 1;
in if length entry == 2 then { ${k} = v; } else null;
entry = lib.splitString ";" str;
k = lib.elemAt entry 0;
v = lib.elemAt entry 1;
in if lib.length entry == 2 then { ${k} = v; } else null;
associations = ps:
pkgs.runCommand "mime-assoc" { inherit ps; } ''
@ -100,17 +99,19 @@ in {
in p: processLines (builtins.readFile (associations p));
}
(mkIf cfg.enable {
assertions =
[ (hm.assertions.assertPlatform "xdg.mimeApps" pkgs platforms.linux) ];
(lib.mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "xdg.mimeApps" pkgs
lib.platforms.linux)
];
# Deprecated but still used by some applications.
xdg.dataFile."applications/mimeapps.list".source =
config.xdg.configFile."mimeapps.list".source;
xdg.configFile."mimeapps.list".text =
let joinValues = mapAttrs (n: concatStringsSep ";");
in generators.toINI { } {
let joinValues = lib.mapAttrs (n: lib.concatStringsSep ";");
in lib.generators.toINI { } {
"Added Associations" = joinValues cfg.associations.added;
"Removed Associations" = joinValues cfg.associations.removed;
"Default Applications" = joinValues cfg.defaultApplications;

View file

@ -1,11 +1,10 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.xdg.mime;
inherit (lib) getExe getExe';
inherit (lib) getExe getExe' mkOption types;
in {
options = {
@ -13,8 +12,8 @@ in {
enable = mkOption {
type = types.bool;
default = pkgs.stdenv.hostPlatform.isLinux;
defaultText =
literalExpression "true if host platform is Linux, false otherwise";
defaultText = lib.literalExpression
"true if host platform is Linux, false otherwise";
description = ''
Whether to install programs and files to support the
XDG Shared MIME-info specification and XDG MIME Applications
@ -29,22 +28,23 @@ in {
sharedMimeInfoPackage = mkOption {
type = types.package;
default = pkgs.shared-mime-info;
defaultText = literalExpression "pkgs.shared-mime-info";
defaultText = lib.literalExpression "pkgs.shared-mime-info";
description = "The package to use when running update-mime-database.";
};
desktopFileUtilsPackage = mkOption {
type = types.package;
default = pkgs.desktop-file-utils;
defaultText = literalExpression "pkgs.desktop-file-utils";
defaultText = lib.literalExpression "pkgs.desktop-file-utils";
description =
"The package to use when running update-desktop-database.";
};
};
};
config = mkIf cfg.enable {
assertions =
[ (hm.assertions.assertPlatform "xdg.mime" pkgs platforms.linux) ];
config = lib.mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "xdg.mime" pkgs lib.platforms.linux)
];
home.packages = [
# Explicitly install package to provide basic mime types.
@ -63,15 +63,19 @@ in {
if [[ -w $out/share/mime && -w $out/share/mime/packages && -d $out/share/mime/packages ]]; then
XDG_DATA_DIRS=$out/share \
PKGSYSTEM_ENABLE_FSYNC=0 \
${getExe cfg.sharedMimeInfoPackage} \
-V $out/share/mime > /dev/null
${
getExe
(cfg.sharedMimeInfoPackage.__spliced.buildHost or cfg.sharedMimeInfoPackage)
} -V $out/share/mime > /dev/null
fi
if [[ -w $out/share/applications ]]; then
${getExe' cfg.desktopFileUtilsPackage "update-desktop-database"} \
$out/share/applications
${
getExe'
(cfg.desktopFileUtilsPackage.__spliced.buildHost or cfg.desktopFileUtilsPackage)
"update-desktop-database"
} $out/share/applications
fi
'';
};
}

View file

@ -1,33 +1,32 @@
{ config, lib, pkgs, ... }:
with lib;
let
inherit (lib) types;
cfg = config.xdg.systemDirs;
configDirs = concatStringsSep ":" cfg.config;
configDirs = lib.concatStringsSep ":" cfg.config;
dataDirs = concatStringsSep ":" cfg.data;
dataDirs = lib.concatStringsSep ":" cfg.data;
in {
meta.maintainers = with maintainers; [ tadfisher ];
meta.maintainers = with lib.maintainers; [ tadfisher ];
options.xdg.systemDirs = {
config = mkOption {
config = lib.mkOption {
type = types.listOf types.str;
default = [ ];
example = literalExpression ''[ "/etc/xdg" ]'';
example = lib.literalExpression ''[ "/etc/xdg" ]'';
description = ''
Directory names to add to {env}`XDG_CONFIG_DIRS`
in the user session.
'';
};
data = mkOption {
data = lib.mkOption {
type = types.listOf types.str;
default = [ ];
example = literalExpression ''[ "/usr/share" "/usr/local/share" ]'';
example = lib.literalExpression ''[ "/usr/share" "/usr/local/share" ]'';
description = ''
Directory names to add to {env}`XDG_DATA_DIRS`
in the user session.
@ -35,14 +34,15 @@ in {
};
};
config = mkMerge [
(mkIf (cfg.config != [ ] || cfg.data != [ ]) {
config = lib.mkMerge [
(lib.mkIf (cfg.config != [ ] || cfg.data != [ ]) {
assertions = [
(hm.assertions.assertPlatform "xdg.systemDirs" pkgs platforms.linux)
(lib.hm.assertions.assertPlatform "xdg.systemDirs" pkgs
lib.platforms.linux)
];
})
(mkIf (cfg.config != [ ]) {
(lib.mkIf (cfg.config != [ ]) {
home.sessionVariables.XDG_CONFIG_DIRS =
"${configDirs}\${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS}";
@ -50,7 +50,7 @@ in {
"${configDirs}\${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS}";
})
(mkIf (cfg.data != [ ]) {
(lib.mkIf (cfg.data != [ ]) {
home.sessionVariables.XDG_DATA_DIRS =
"${dataDirs}\${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}";

View file

@ -1,16 +1,15 @@
{ config, lib, pkgs, ... }:
with lib;
let
inherit (lib) literalExpression mkOption types;
cfg = config.xdg.userDirs;
in {
meta.maintainers = with maintainers; [ euxane ];
meta.maintainers = with lib.maintainers; [ euxane ];
imports = [
(mkRenamedOptionModule [ "xdg" "userDirs" "publishShare" ] [
(lib.mkRenamedOptionModule [ "xdg" "userDirs" "publishShare" ] [
"xdg"
"userDirs"
"publicShare"
@ -108,11 +107,11 @@ in {
};
createDirectories =
mkEnableOption "automatic creation of the XDG user directories";
lib.mkEnableOption "automatic creation of the XDG user directories";
};
config = let
directories = (filterAttrs (n: v: !isNull v) {
directories = (lib.filterAttrs (n: v: !isNull v) {
XDG_DESKTOP_DIR = cfg.desktop;
XDG_DOCUMENTS_DIR = cfg.documents;
XDG_DOWNLOAD_DIR = cfg.download;
@ -122,24 +121,26 @@ in {
XDG_TEMPLATES_DIR = cfg.templates;
XDG_VIDEOS_DIR = cfg.videos;
}) // cfg.extraConfig;
in mkIf cfg.enable {
assertions =
[ (hm.assertions.assertPlatform "xdg.userDirs" pkgs platforms.linux) ];
in lib.mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "xdg.userDirs" pkgs lib.platforms.linux)
];
xdg.configFile."user-dirs.dirs".text = let
# For some reason, these need to be wrapped with quotes to be valid.
wrapped = mapAttrs (_: value: ''"${value}"'') directories;
in generators.toKeyValue { } wrapped;
wrapped = lib.mapAttrs (_: value: ''"${value}"'') directories;
in lib.generators.toKeyValue { } wrapped;
xdg.configFile."user-dirs.conf".text = "enabled=False";
home.sessionVariables = directories;
home.activation.createXdgUserDirectories = mkIf cfg.createDirectories (let
directoriesList = attrValues directories;
mkdir =
(dir: ''[[ -L "${dir}" ]] || run mkdir -p $VERBOSE_ARG "${dir}"'');
in lib.hm.dag.entryAfter [ "linkGeneration" ]
(strings.concatMapStringsSep "\n" mkdir directoriesList));
home.activation.createXdgUserDirectories = lib.mkIf cfg.createDirectories
(let
directoriesList = lib.attrValues directories;
mkdir =
(dir: ''[[ -L "${dir}" ]] || run mkdir -p $VERBOSE_ARG "${dir}"'');
in lib.hm.dag.entryAfter [ "linkGeneration" ]
(lib.strings.concatMapStringsSep "\n" mkdir directoriesList));
};
}

View file

@ -1,8 +1,7 @@
{ options, config, lib, pkgs, ... }:
with lib;
{ config, lib, pkgs, ... }:
let
inherit (lib) mkOptionDefault mkIf mkOption types;
cfg = config.xdg;
@ -22,7 +21,16 @@ let
in {
options.xdg = {
enable = mkEnableOption "management of XDG base directories";
enable = lib.mkEnableOption "management of XDG base directories";
cacheFile = mkOption {
type = fileType "xdg.cacheFile" "{var}`xdg.cacheHome`" cfg.cacheHome;
default = { };
description = ''
Attribute set of files to link into the user's XDG
cache home.
'';
};
cacheHome = mkOption {
type = types.path;
@ -98,7 +106,7 @@ in {
};
};
config = mkMerge [
config = lib.mkMerge [
(let
variables = {
XDG_CACHE_HOME = cfg.cacheHome;
@ -107,10 +115,10 @@ in {
XDG_STATE_HOME = cfg.stateHome;
};
in mkIf cfg.enable {
xdg.cacheHome = mkDefault defaultCacheHome;
xdg.configHome = mkDefault defaultConfigHome;
xdg.dataHome = mkDefault defaultDataHome;
xdg.stateHome = mkDefault defaultStateHome;
xdg.cacheHome = mkOptionDefault defaultCacheHome;
xdg.configHome = mkOptionDefault defaultConfigHome;
xdg.dataHome = mkOptionDefault defaultDataHome;
xdg.stateHome = mkOptionDefault defaultStateHome;
home.sessionVariables = variables;
systemd.user.sessionVariables =
@ -118,31 +126,41 @@ in {
})
# Legacy non-deterministic setup.
(mkIf (!cfg.enable && versionOlder config.home.stateVersion "20.09") {
(mkIf (!cfg.enable && lib.versionOlder config.home.stateVersion "20.09") {
xdg.cacheHome =
mkDefault (getEnvFallback "XDG_CACHE_HOME" defaultCacheHome);
mkOptionDefault (getEnvFallback "XDG_CACHE_HOME" defaultCacheHome);
xdg.configHome =
mkDefault (getEnvFallback "XDG_CONFIG_HOME" defaultConfigHome);
xdg.dataHome = mkDefault (getEnvFallback "XDG_DATA_HOME" defaultDataHome);
mkOptionDefault (getEnvFallback "XDG_CONFIG_HOME" defaultConfigHome);
xdg.dataHome =
mkOptionDefault (getEnvFallback "XDG_DATA_HOME" defaultDataHome);
xdg.stateHome =
mkOptionDefault (getEnvFallback "XDG_STATE_HOME" defaultStateHome);
})
# "Modern" deterministic setup.
(mkIf (!cfg.enable && versionAtLeast config.home.stateVersion "20.09") {
xdg.cacheHome = mkDefault defaultCacheHome;
xdg.configHome = mkDefault defaultConfigHome;
xdg.dataHome = mkDefault defaultDataHome;
xdg.stateHome = mkDefault defaultStateHome;
(mkIf (!cfg.enable && lib.versionAtLeast config.home.stateVersion "20.09") {
xdg.cacheHome = mkOptionDefault defaultCacheHome;
xdg.configHome = mkOptionDefault defaultConfigHome;
xdg.dataHome = mkOptionDefault defaultDataHome;
xdg.stateHome = mkOptionDefault defaultStateHome;
})
{
home.file = mkMerge [
(mapAttrs' (name: file: nameValuePair "${cfg.configHome}/${name}" file)
home.file = lib.mkMerge [
(lib.mapAttrs'
(name: file: lib.nameValuePair "${cfg.cacheHome}/${name}" file)
cfg.cacheFile)
(lib.mapAttrs'
(name: file: lib.nameValuePair "${cfg.configHome}/${name}" file)
cfg.configFile)
(mapAttrs' (name: file: nameValuePair "${cfg.dataHome}/${name}" file)
(lib.mapAttrs'
(name: file: lib.nameValuePair "${cfg.dataHome}/${name}" file)
cfg.dataFile)
(mapAttrs' (name: file: nameValuePair "${cfg.stateHome}/${name}" file)
(lib.mapAttrs'
(name: file: lib.nameValuePair "${cfg.stateHome}/${name}" file)
cfg.stateFile)
{ "${cfg.cacheHome}/.keep".text = ""; }
{ "${cfg.stateHome}/.keep".text = ""; }
];
}
];

View file

@ -1,8 +1,7 @@
{ config, lib, pkgs, ... }:
with lib;
let
inherit (lib) mkOption types;
cfg = config.xfconf;
@ -51,12 +50,12 @@ let
"-s"
v
] else if builtins.isList v then
[ "-a" ] ++ concatMap withType v
[ "-a" ] ++ lib.concatMap withType v
else
throw "unexpected xfconf type: ${builtins.typeOf v}";
in {
meta.maintainers = [ maintainers.chuangzhu ];
meta.maintainers = [ lib.maintainers.chuangzhu ];
options.xfconf = {
enable = mkOption {
@ -81,7 +80,7 @@ in {
description = "xfconf settings";
};
default = { };
example = literalExpression ''
example = lib.literalExpression ''
{
xfce4-session = {
"startup/ssh-agent/enabled" = false;
@ -99,16 +98,16 @@ in {
};
};
config = mkIf (cfg.enable && cfg.settings != { }) {
config = lib.mkIf (cfg.enable && cfg.settings != { }) {
assertions =
[ (hm.assertions.assertPlatform "xfconf" pkgs platforms.linux) ];
[ (lib.hm.assertions.assertPlatform "xfconf" pkgs lib.platforms.linux) ];
home.activation.xfconfSettings = hm.dag.entryAfter [ "installPackages" ]
home.activation.xfconfSettings = lib.hm.dag.entryAfter [ "installPackages" ]
(let
mkCommand = channel: property: value: ''
run ${pkgs.xfce.xfconf}/bin/xfconf-query \
${
escapeShellArgs ([ "-c" channel "-p" "/${property}" ]
lib.escapeShellArgs ([ "-c" channel "-p" "/${property}" ]
++ (if value == null then
[ "-r" ]
else
@ -116,13 +115,12 @@ in {
}
'';
commands = mapAttrsToList
(channel: properties: mapAttrsToList (mkCommand channel) properties)
cfg.settings;
commands = lib.mapAttrsToList (channel: properties:
lib.mapAttrsToList (mkCommand channel) properties) cfg.settings;
load = pkgs.writeShellScript "load-xfconf" ''
${config.lib.bash.initHomeManagerLib}
${concatMapStrings concatStrings commands}
${lib.concatMapStrings lib.concatStrings commands}
'';
in ''
if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then

View file

@ -9,8 +9,6 @@
# If disabled, the pkgs attribute passed to this function is used instead.
, useNixpkgsModule ? true }:
with lib;
let
modules = [
@ -30,18 +28,21 @@ let
./misc/fontconfig.nix
./misc/gtk.nix
./misc/lib.nix
./misc/mozilla-messaging-hosts.nix
./misc/news.nix
./misc/nixgl.nix
./misc/numlock.nix
./misc/pam.nix
./misc/qt.nix
./misc/qt/kconfig.nix
./misc/shell.nix
./misc/specialisation.nix
./misc/submodule-support.nix
./misc/tmpfiles.nix
./misc/uninstall.nix
./misc/version.nix
./misc/vte.nix
./misc/xdg-autostart.nix
./misc/xdg-desktop-entries.nix
./misc/xdg-mime-apps.nix
./misc/xdg-mime.nix
@ -52,6 +53,7 @@ let
./misc/xfconf.nix
./programs/abook.nix
./programs/aerc.nix
./programs/aerospace.nix
./programs/afew.nix
./programs/alacritty.nix
./programs/alot.nix
@ -86,6 +88,7 @@ let
./programs/dircolors.nix
./programs/direnv.nix
./programs/discocss.nix
./programs/earthly.nix
./programs/eclipse.nix
./programs/emacs.nix
./programs/eww.nix
@ -107,6 +110,7 @@ let
./programs/ghostty.nix
./programs/git-cliff.nix
./programs/git-credential-oauth.nix
./programs/git-worktree-switcher.nix
./programs/git.nix
./programs/gitui.nix
./programs/gnome-shell.nix
@ -134,6 +138,7 @@ let
./programs/java.nix
./programs/jetbrains-remote.nix
./programs/jq.nix
./programs/jqp.nix
./programs/jujutsu.nix
./programs/joshuto.nix
./programs/joplin-desktop.nix
@ -146,6 +151,7 @@ let
./programs/kitty.nix
./programs/kodi.nix
./programs/kubecolor.nix
./programs/lapce.nix
./programs/lazygit.nix
./programs/ledger.nix
./programs/less.nix
@ -163,6 +169,7 @@ let
./programs/mercurial.nix
./programs/micro.nix
./programs/mise.nix
./programs/mods.nix
./programs/mpv.nix
./programs/mr.nix
./programs/msmtp.nix
@ -231,6 +238,7 @@ let
./programs/sqls.nix
./programs/ssh.nix
./programs/starship.nix
./programs/swayimg.nix
./programs/swaylock.nix
./programs/swayr.nix
./programs/taskwarrior.nix
@ -246,6 +254,7 @@ let
./programs/tmate.nix
./programs/tmux.nix
./programs/tofi.nix
./programs/todoman.nix
./programs/topgrade.nix
./programs/translate-shell.nix
./programs/urxvt.nix
@ -253,6 +262,7 @@ let
./programs/vifm.nix
./programs/vim-vint.nix
./programs/vim.nix
./programs/vinegar.nix
./programs/vscode.nix
./programs/vscode/haskell.nix
./programs/pywal.nix
@ -262,7 +272,6 @@ let
./programs/wezterm.nix
./programs/wlogout.nix
./programs/wofi.nix
./programs/wpaperd.nix
./programs/xmobar.nix
./programs/xplr.nix
./programs/yambar.nix
@ -295,6 +304,7 @@ let
./services/cliphist.nix
./services/clipman.nix
./services/clipmenu.nix
./services/clipse.nix
./services/comodoro.nix
./services/conky.nix
./services/copyq.nix
@ -329,8 +339,10 @@ let
./services/keybase.nix
./services/keynav.nix
./services/lieer.nix
./services/linux-wallpaperengine.nix
./services/listenbrainz-mpd.nix
./services/lorri.nix
./services/macos-remap-keys
./services/mako.nix
./services/mbsync.nix
./services/megasync.nix
@ -345,6 +357,7 @@ let
./services/nextcloud-client.nix
./services/nix-gc.nix
./services/notify-osd.nix
./services/ollama.nix
./services/opensnitch-ui.nix
./services/osmscout-server.nix
./services/owncloud-client.nix
@ -387,6 +400,7 @@ let
./services/taffybar.nix
./services/tahoe-lafs.nix
./services/taskwarrior-sync.nix
./services/tldr-update.nix
./services/trayer.nix
./services/trayscale.nix
./services/twmn.nix
@ -408,13 +422,16 @@ let
./services/window-managers/wayfire.nix
./services/window-managers/xmonad.nix
./services/wlsunset.nix
./services/wluma.nix
./services/wob.nix
./services/wpaperd.nix
./services/xcape.nix
./services/xembed-sni-proxy.nix
./services/xidlehook.nix
./services/xscreensaver.nix
./services/xsettingsd.nix
./services/xsuspender.nix
./services/yubikey-agent.nix
./systemd.nix
./targets/darwin
./targets/generic-linux.nix
@ -425,28 +442,28 @@ let
(pkgs.path + "/nixos/modules/misc/assertions.nix")
(pkgs.path + "/nixos/modules/misc/meta.nix")
(mkRemovedOptionModule [ "services" "password-store-sync" ] ''
(lib.mkRemovedOptionModule [ "services" "password-store-sync" ] ''
Use services.git-sync instead.
'')
(mkRemovedOptionModule [ "services" "keepassx" ] ''
(lib.mkRemovedOptionModule [ "services" "keepassx" ] ''
KeePassX is no longer maintained.
'')
] ++ optional useNixpkgsModule ./misc/nixpkgs.nix
++ optional (!useNixpkgsModule) ./misc/nixpkgs-disabled.nix;
] ++ lib.optional useNixpkgsModule ./misc/nixpkgs.nix
++ lib.optional (!useNixpkgsModule) ./misc/nixpkgs-disabled.nix;
pkgsModule = { config, ... }: {
config = {
_module.args.baseModules = modules;
_module.args.pkgsPath = lib.mkDefault
(if versionAtLeast config.home.stateVersion "20.09" then
(if lib.versionAtLeast config.home.stateVersion "20.09" then
pkgs.path
else
<nixpkgs>);
_module.args.pkgs = lib.mkDefault pkgs;
_module.check = check;
lib = lib.hm;
} // optionalAttrs useNixpkgsModule {
nixpkgs.system = mkDefault pkgs.stdenv.hostPlatform.system;
} // lib.optionalAttrs useNixpkgsModule {
nixpkgs.system = lib.mkDefault pkgs.stdenv.hostPlatform.system;
};
};

93
modules/po/bg.po Normal file
View file

@ -0,0 +1,93 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Home Manager contributors
# This file is distributed under the same license as the Home Manager Modules package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: Home Manager Modules\n"
"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n"
"POT-Creation-Date: 2025-01-03 09:09+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: bg\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: modules/files.nix:188
msgid "Creating home file links in %s"
msgstr ""
#: modules/files.nix:201
msgid "Cleaning up orphan links from %s"
msgstr ""
#: modules/home-environment.nix:591
msgid "Creating new profile generation"
msgstr ""
#: modules/home-environment.nix:594
msgid "No change so reusing latest profile generation"
msgstr ""
#: modules/home-environment.nix:643
msgid ""
"Oops, Nix failed to install your new Home Manager profile!\n"
"\n"
"Perhaps there is a conflict with a package that was installed using\n"
"\"%s\"? Try running\n"
"\n"
" %s\n"
"\n"
"and if there is a conflicting package you can remove it with\n"
"\n"
" %s\n"
"\n"
"Then try activating your Home Manager configuration again."
msgstr ""
#: modules/home-environment.nix:676
msgid "Activating %s"
msgstr ""
#: modules/lib-bash/activation-init.sh:22
msgid "Migrating profile from %s to %s"
msgstr ""
#: modules/lib-bash/activation-init.sh:54
msgid "Could not find suitable profile directory, tried %s and %s"
msgstr ""
#: modules/lib-bash/activation-init.sh:106
msgid "Error: USER is set to \"%s\" but we expect \"%s\""
msgstr ""
#: modules/lib-bash/activation-init.sh:115
msgid "Error: HOME is set to \"%s\" but we expect \"%s\""
msgstr ""
#: modules/lib-bash/activation-init.sh:132
msgid "Starting Home Manager activation"
msgstr ""
#: modules/lib-bash/activation-init.sh:136
msgid "Sanity checking Nix"
msgstr ""
#: modules/lib-bash/activation-init.sh:149
msgid "This is a dry run"
msgstr ""
#: modules/lib-bash/activation-init.sh:153
msgid "This is a live run"
msgstr ""
#: modules/lib-bash/activation-init.sh:159
msgid "Using Nix version: %s"
msgstr ""
#: modules/lib-bash/activation-init.sh:162
msgid "Activation variables:"
msgstr ""

View file

@ -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: 2025-01-03 09:09+0100\n"
"PO-Revision-Date: 2023-12-10 15:58+0000\n"
"Last-Translator: Nara Díaz Viñolas <rdvdev2@gmail.com>\n"
"PO-Revision-Date: 2025-02-19 21:00+0000\n"
"Last-Translator: Alejandro Masó Bonilla <alejandrobonilla2001@gmail.com>\n"
"Language-Team: Catalan <https://hosted.weblate.org/projects/home-manager/"
"modules/ca/>\n"
"Language: ca\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 5.3-dev\n"
"X-Generator: Weblate 5.10.1-dev\n"
#: modules/files.nix:188
msgid "Creating home file links in %s"
@ -29,11 +29,11 @@ msgstr "Netejant enllaços orfes de %s"
#: modules/home-environment.nix:591
msgid "Creating new profile generation"
msgstr ""
msgstr "Creant una nova generació per al nou perfil"
#: modules/home-environment.nix:594
msgid "No change so reusing latest profile generation"
msgstr ""
msgstr "No hi ha canvis llavors s'utilitzarà la generació anterior"
#: modules/home-environment.nix:643
msgid ""
@ -55,13 +55,13 @@ msgstr ""
"Potser hi ha un conflicte amb un paquet instal·lat mitjançant\n"
"\"%s\"? Prova d'executar\n"
"\n"
" %s\n"
". . . . %s\n"
"\n"
"i si hi ha un paquet conflictiu el pots eliminar amb\n"
"\n"
" %s\n"
". . . . %s\n"
"\n"
"i després provar d'activar la teva configuració de Home Manager de nou."
"Després provar d'activar la teva configuració de Home Manager de nou."
#: modules/home-environment.nix:676
msgid "Activating %s"
@ -86,7 +86,7 @@ msgstr "Error: HOME està configurat a \"%s\", però s'esperava \"%s\""
#: modules/lib-bash/activation-init.sh:132
msgid "Starting Home Manager activation"
msgstr "Començant activació de Home Manager"
msgstr "Començant l'activació de Home Manager"
#: modules/lib-bash/activation-init.sh:136
msgid "Sanity checking Nix"
@ -102,7 +102,7 @@ msgstr "Execució en viu"
#: modules/lib-bash/activation-init.sh:159
msgid "Using Nix version: %s"
msgstr "Utilitzant versió de Nix: %s"
msgstr "Utilitzant la versió de Nix: %s"
#: modules/lib-bash/activation-init.sh:162
msgid "Activation variables:"

View file

@ -8,16 +8,16 @@ msgstr ""
"Project-Id-Version: Home Manager Modules\n"
"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n"
"POT-Creation-Date: 2025-01-03 09:09+0100\n"
"PO-Revision-Date: 2023-12-08 12:04+0000\n"
"Last-Translator: David Houdek <sarejnovec@gmail.com>\n"
"PO-Revision-Date: 2025-01-22 01:25+0000\n"
"Last-Translator: Dark Templar <dark.templar0007@gmail.com>\n"
"Language-Team: Czech <https://hosted.weblate.org/projects/home-manager/"
"modules/cs/>\n"
"Language: cs\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
"X-Generator: Weblate 5.3-dev\n"
"Plural-Forms: nplurals=3; plural=((n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2);\n"
"X-Generator: Weblate 5.10-dev\n"
#: modules/files.nix:188
msgid "Creating home file links in %s"
@ -29,7 +29,7 @@ msgstr "Čištění osiřelých linků z %s"
#: modules/home-environment.nix:591
msgid "Creating new profile generation"
msgstr ""
msgstr "Vytváření nových generací profilu"
#: modules/home-environment.nix:594
msgid "No change so reusing latest profile generation"

View file

@ -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: 2025-01-03 09:09+0100\n"
"PO-Revision-Date: 2023-09-27 11:02+0000\n"
"Last-Translator: Emil Heilbo <yuki@yukie.dev>\n"
"PO-Revision-Date: 2025-01-18 01:23+0000\n"
"Last-Translator: Rasmus Enevoldsen <rasmus@enev.dk>\n"
"Language-Team: Danish <https://hosted.weblate.org/projects/home-manager/"
"modules/da/>\n"
"Language: da\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 5.1-dev\n"
"X-Generator: Weblate 5.10-dev\n"
#: modules/files.nix:188
msgid "Creating home file links in %s"
@ -29,11 +29,11 @@ msgstr "Oprydder forældreløse links fra %s"
#: modules/home-environment.nix:591
msgid "Creating new profile generation"
msgstr ""
msgstr "Laver ny profil generation"
#: modules/home-environment.nix:594
msgid "No change so reusing latest profile generation"
msgstr ""
msgstr "Ingen ændring, så genbruger den tidligste profil generation"
#: modules/home-environment.nix:643
msgid ""

View file

@ -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: 2025-01-03 09:09+0100\n"
"PO-Revision-Date: 2023-05-27 12:11+0000\n"
"Last-Translator: gallegonovato <fran-carro@hotmail.es>\n"
"PO-Revision-Date: 2025-01-30 12:43+0000\n"
"Last-Translator: Gavagai53 <masella_portlock@aleeas.com>\n"
"Language-Team: Spanish <https://hosted.weblate.org/projects/home-manager/"
"modules/es/>\n"
"Language: es\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.18-dev\n"
"X-Generator: Weblate 5.10-dev\n"
#: modules/files.nix:188
msgid "Creating home file links in %s"
@ -29,11 +29,11 @@ msgstr "Limpiando vínculos huérfanos de %s"
#: modules/home-environment.nix:591
msgid "Creating new profile generation"
msgstr ""
msgstr "Creando nueva generación de perfil"
#: modules/home-environment.nix:594
msgid "No change so reusing latest profile generation"
msgstr ""
msgstr "No hubo cambio, así que reusando la última generación de perfil"
#: modules/home-environment.nix:643
msgid ""

View file

@ -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: 2025-01-03 09:09+0100\n"
"PO-Revision-Date: 2023-10-19 04:00+0000\n"
"Last-Translator: SrGesus <gabriel.fcf04@gmail.com>\n"
"PO-Revision-Date: 2025-02-07 22:02+0000\n"
"Last-Translator: Bruno Fragoso <darth_signa@hotmail.com>\n"
"Language-Team: Portuguese <https://hosted.weblate.org/projects/home-manager/"
"modules/pt/>\n"
"Language: pt\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 5.1\n"
"X-Generator: Weblate 5.10-dev\n"
#: modules/files.nix:188
msgid "Creating home file links in %s"
@ -29,11 +29,11 @@ msgstr "A limpar links órfãos do directório %s"
#: modules/home-environment.nix:591
msgid "Creating new profile generation"
msgstr ""
msgstr "Criando nova geração de perfil"
#: modules/home-environment.nix:594
msgid "No change so reusing latest profile generation"
msgstr ""
msgstr "Reutilizando última geração de perfil devido a não existirem alterações"
#: modules/home-environment.nix:643
msgid ""

View file

@ -8,17 +8,17 @@ msgstr ""
"Project-Id-Version: Home Manager Modules\n"
"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n"
"POT-Creation-Date: 2025-01-03 09:09+0100\n"
"PO-Revision-Date: 2023-12-11 16:06+0000\n"
"Last-Translator: Blezz Rot <markus.jenya04@yandex.ru>\n"
"PO-Revision-Date: 2025-01-31 17:29+0000\n"
"Last-Translator: Vladimir <kirillov.vladimir@gmail.com>\n"
"Language-Team: Russian <https://hosted.weblate.org/projects/home-manager/"
"modules/ru/>\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 5.3-dev\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
"X-Generator: Weblate 5.10-dev\n"
#: modules/files.nix:188
msgid "Creating home file links in %s"
@ -30,11 +30,11 @@ msgstr "Удаляю устаревшие ссылки из %s"
#: modules/home-environment.nix:591
msgid "Creating new profile generation"
msgstr ""
msgstr "Создание нового поколения профиля"
#: modules/home-environment.nix:594
msgid "No change so reusing latest profile generation"
msgstr ""
msgstr "Изменений нет, повторно исползуем последнее поколение профиля"
#: modules/home-environment.nix:643
msgid ""

View file

@ -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: 2025-01-03 09:09+0100\n"
"PO-Revision-Date: 2023-05-27 12:11+0000\n"
"Last-Translator: Robert Helgesson <robert@rycee.net>\n"
"PO-Revision-Date: 2025-02-08 08:17+0000\n"
"Last-Translator: bittin1ddc447d824349b2 <bittin@reimu.nl>\n"
"Language-Team: Swedish <https://hosted.weblate.org/projects/home-manager/"
"modules/sv/>\n"
"Language: sv\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.18-dev\n"
"X-Generator: Weblate 5.10-dev\n"
#: modules/files.nix:188
msgid "Creating home file links in %s"
@ -29,11 +29,11 @@ msgstr "Rensar bort överflödiga länkar från %s"
#: modules/home-environment.nix:591
msgid "Creating new profile generation"
msgstr ""
msgstr "Skapar ny profilgeneration"
#: modules/home-environment.nix:594
msgid "No change so reusing latest profile generation"
msgstr ""
msgstr "Ingen förändring så återanvänder senaste profilgeneration"
#: modules/home-environment.nix:643
msgid ""

93
modules/po/tok.po Normal file
View file

@ -0,0 +1,93 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Home Manager contributors
# This file is distributed under the same license as the Home Manager Modules package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: Home Manager Modules\n"
"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n"
"POT-Creation-Date: 2025-01-03 09:09+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: tok\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: modules/files.nix:188
msgid "Creating home file links in %s"
msgstr ""
#: modules/files.nix:201
msgid "Cleaning up orphan links from %s"
msgstr ""
#: modules/home-environment.nix:591
msgid "Creating new profile generation"
msgstr ""
#: modules/home-environment.nix:594
msgid "No change so reusing latest profile generation"
msgstr ""
#: modules/home-environment.nix:643
msgid ""
"Oops, Nix failed to install your new Home Manager profile!\n"
"\n"
"Perhaps there is a conflict with a package that was installed using\n"
"\"%s\"? Try running\n"
"\n"
" %s\n"
"\n"
"and if there is a conflicting package you can remove it with\n"
"\n"
" %s\n"
"\n"
"Then try activating your Home Manager configuration again."
msgstr ""
#: modules/home-environment.nix:676
msgid "Activating %s"
msgstr ""
#: modules/lib-bash/activation-init.sh:22
msgid "Migrating profile from %s to %s"
msgstr ""
#: modules/lib-bash/activation-init.sh:54
msgid "Could not find suitable profile directory, tried %s and %s"
msgstr ""
#: modules/lib-bash/activation-init.sh:106
msgid "Error: USER is set to \"%s\" but we expect \"%s\""
msgstr ""
#: modules/lib-bash/activation-init.sh:115
msgid "Error: HOME is set to \"%s\" but we expect \"%s\""
msgstr ""
#: modules/lib-bash/activation-init.sh:132
msgid "Starting Home Manager activation"
msgstr ""
#: modules/lib-bash/activation-init.sh:136
msgid "Sanity checking Nix"
msgstr ""
#: modules/lib-bash/activation-init.sh:149
msgid "This is a dry run"
msgstr ""
#: modules/lib-bash/activation-init.sh:153
msgid "This is a live run"
msgstr ""
#: modules/lib-bash/activation-init.sh:159
msgid "Using Nix version: %s"
msgstr ""
#: modules/lib-bash/activation-init.sh:162
msgid "Activation variables:"
msgstr ""

View file

@ -8,16 +8,16 @@ msgstr ""
"Project-Id-Version: Home Manager Modules\n"
"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n"
"POT-Creation-Date: 2025-01-03 09:09+0100\n"
"PO-Revision-Date: 2023-01-08 11:50+0000\n"
"Last-Translator: Eric Ho <eric913@gmail.com>\n"
"Language-Team: Chinese (Traditional) <https://hosted.weblate.org/projects/"
"home-manager/modules/zh_Hant/>\n"
"PO-Revision-Date: 2025-03-07 18:58+0000\n"
"Last-Translator: 807 <s10855168@gmail.com>\n"
"Language-Team: Chinese (Traditional Han script) <https://hosted.weblate.org/"
"projects/home-manager/modules/zh_Hant/>\n"
"Language: zh_Hant\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 4.15.1-dev\n"
"X-Generator: Weblate 5.10.3-dev\n"
#: modules/files.nix:188
msgid "Creating home file links in %s"
@ -29,11 +29,11 @@ msgstr "正在從 %s 清理孤立連結"
#: modules/home-environment.nix:591
msgid "Creating new profile generation"
msgstr ""
msgstr "正在建立新一代的配置文件中"
#: modules/home-environment.nix:594
msgid "No change so reusing latest profile generation"
msgstr ""
msgstr "為發生改變,請重新使用新一代的配置文件"
#: modules/home-environment.nix:643
msgid ""
@ -69,19 +69,19 @@ msgstr "正在啟用 %s"
#: modules/lib-bash/activation-init.sh:22
msgid "Migrating profile from %s to %s"
msgstr ""
msgstr "正在從 %S 配置文件轉移到 %s 中"
#: modules/lib-bash/activation-init.sh:54
msgid "Could not find suitable profile directory, tried %s and %s"
msgstr ""
msgstr "找不到合適的 profile 目錄,已經嘗試 %s 和 %s"
#: modules/lib-bash/activation-init.sh:106
msgid "Error: USER is set to \"%s\" but we expect \"%s\""
msgstr ""
msgstr "錯誤USER 被設定為 「%s」但我們希望是 「%s」"
#: modules/lib-bash/activation-init.sh:115
msgid "Error: HOME is set to \"%s\" but we expect \"%s\""
msgstr ""
msgstr "錯誤HOME 被設定為 「%s」但我們預期得到 「%s」"
#: modules/lib-bash/activation-init.sh:132
msgid "Starting Home Manager activation"

View file

@ -134,8 +134,9 @@ in {
oauthParams = { auth, params }:
if useOauth auth && params != null && params != { } then
"?" + builtins.concatStringsSep "&" lib.attrsets.mapAttrsToList
(k: v: k + "=" + lib.strings.escapeURL v) params
"?" + builtins.concatStringsSep "&"
(lib.attrsets.mapAttrsToList (k: v: k + "=" + lib.strings.escapeURL v)
(lib.attrsets.filterAttrs (k: v: v != null) params))
else
"";

View file

@ -38,7 +38,7 @@ in {
enable = mkEnableOption "aerc";
package = mkPackageOption pkgs "aerc" { };
package = mkPackageOption pkgs "aerc" { nullable = true; };
extraAccounts = mkOption {
type = sectionsOrLines;
@ -193,7 +193,7 @@ in {
'';
}];
home.packages = [ cfg.package ];
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file = {
"${configDir}/accounts.conf" = mkIf genAccountsConf {

View file

@ -0,0 +1,240 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkOption types;
cfg = config.programs.aerospace;
tomlFormat = pkgs.formats.toml { };
# filterAttrsRecursive supporting lists, as well.
filterListAndAttrsRecursive = pred: set:
lib.listToAttrs (lib.concatMap (name:
let v = set.${name};
in if pred v then
[
(lib.nameValuePair name (if lib.isAttrs v then
filterListAndAttrsRecursive pred v
else if lib.isList v then
(map (i:
if lib.isAttrs i then filterListAndAttrsRecursive pred i else i)
(lib.filter pred v))
else
v))
]
else
[ ]) (lib.attrNames set));
filterNulls = filterListAndAttrsRecursive (v: v != null);
in {
meta.maintainers = with lib.hm.maintainers; [ damidoug ];
options.programs.aerospace = {
enable = lib.mkEnableOption "AeroSpace window manager";
package = lib.mkPackageOption pkgs "aerospace" { nullable = true; };
userSettings = mkOption {
type = types.submodule {
freeformType = tomlFormat.type;
options = {
start-at-login = lib.mkOption {
type = types.bool;
default = false;
description = "Start AeroSpace at login.";
};
after-login-command = mkOption {
type = with types; listOf str;
default = [ ];
description = ''
You can use it to add commands that run after login to macOS user session.
'start-at-login' needs to be 'true' for 'after-login-command' to work.
'';
};
after-startup-command = mkOption {
type = with types; listOf str;
default = [ ];
description = ''
You can use it to add commands that run after AeroSpace startup.
'after-startup-command' is run after 'after-login-command'
'';
example = [ "layout tiles" ];
};
enable-normalization-flatten-containers = mkOption {
type = types.bool;
default = true;
description =
''Containers that have only one child are "flattened".'';
};
enable-normalization-opposite-orientation-for-nested-containers =
mkOption {
type = types.bool;
default = true;
description =
"Containers that nest into each other must have opposite orientations.";
};
accordion-padding = mkOption {
type = types.int;
default = 30;
description = "Padding between windows in an accordion container.";
};
default-root-container-layout = mkOption {
type = types.enum [ "tiles" "accordion" ];
default = "tiles";
description = "Default layout for the root container.";
};
default-root-container-orientation = mkOption {
type = types.enum [ "horizontal" "vertical" "auto" ];
default = "auto";
description = "Default orientation for the root container.";
};
on-window-detected = mkOption {
type = types.listOf (types.submodule {
options = {
"if" = mkOption {
type = types.submodule {
options = {
app-id = mkOption {
type = with types; nullOr str;
default = null;
description = "The application ID to match (optional).";
};
workspace = mkOption {
type = with types; nullOr str;
default = null;
description = "The workspace name to match (optional).";
};
window-title-regex-substring = mkOption {
type = with types; nullOr str;
default = null;
description =
"Substring to match in the window title (optional).";
};
app-name-regex-substring = mkOption {
type = with types; nullOr str;
default = null;
description =
"Regex substring to match the app name (optional).";
};
during-aerospace-startup = mkOption {
type = with types; nullOr bool;
default = null;
description =
"Whether to match during aerospace startup (optional).";
};
};
};
default = { };
description = "Conditions for detecting a window.";
};
check-further-callbacks = mkOption {
type = with types; nullOr bool;
default = null;
description =
"Whether to check further callbacks after this rule (optional).";
};
run = mkOption {
type = with types; oneOf [ str (listOf str) ];
example = [ "move-node-to-workspace m" "resize-node" ];
description =
"Commands to execute when the conditions match (required).";
};
};
});
default = [ ];
example = [{
"if" = {
app-id = "Another.Cool.App";
workspace = "cool-workspace";
window-title-regex-substring = "Title";
app-name-regex-substring = "CoolApp";
during-aerospace-startup = false;
};
check-further-callbacks = false;
run = [ "move-node-to-workspace m" "resize-node" ];
}];
description =
"Commands to run every time a new window is detected with optional conditions.";
};
workspace-to-monitor-force-assignment = mkOption {
type = with types;
nullOr (attrsOf (oneOf [ int str (listOf str) ]));
default = null;
description = ''
Map workspaces to specific monitors.
Left-hand side is the workspace name, and right-hand side is the monitor pattern.
'';
example = {
"1" = 1; # First monitor from left to right.
"2" = "main"; # Main monitor.
"3" = "secondary"; # Secondary monitor (non-main).
"4" = "built-in"; # Built-in display.
"5" =
"^built-in retina display$"; # Regex for the built-in retina display.
"6" = [ "secondary" "dell" ]; # Match first pattern in the list.
};
};
on-focus-changed = mkOption {
type = with types; listOf str;
default = [ ];
example = [ "move-mouse monitor-lazy-center" ];
description =
"Commands to run every time focused window or workspace changes.";
};
on-focused-monitor-changed = mkOption {
type = with types; listOf str;
default = [ "move-mouse monitor-lazy-center" ];
description = "Commands to run every time focused monitor changes.";
};
exec-on-workspace-change = mkOption {
type = with types; listOf str;
default = [ ];
example = [
"/bin/bash"
"-c"
"sketchybar --trigger aerospace_workspace_change FOCUSED=$AEROSPACE_FOCUSED_WORKSPACE"
];
description = "Commands to run every time workspace changes.";
};
key-mapping.preset = mkOption {
type = types.enum [ "qwerty" "dvorak" ];
default = "qwerty";
description = "Keymapping preset.";
};
};
};
default = { };
example = lib.literalExpression ''
{
gaps = {
outer.left = 8;
outer.bottom = 8;
outer.top = 8;
outer.right = 8;
};
mode.main.binding = {
alt-h = "focus left";
alt-j = "focus down";
alt-k = "focus up";
alt-l = "focus right";
};
}
'';
description = ''
AeroSpace configuration, see
<https://nikitabobko.github.io/AeroSpace/guide#configuring-aerospace>
for supported values.
'';
};
};
config = lib.mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "programs.aerospace" pkgs
lib.platforms.darwin)
];
home = {
packages = lib.mkIf (cfg.package != null) [ cfg.package ];
file.".config/aerospace/aerospace.toml".source =
tomlFormat.generate "aerospace" (filterNulls cfg.userSettings);
};
};
}

View file

@ -132,7 +132,7 @@ in {
'';
};
package = mkPackageOption pkgs "alot" { };
package = mkPackageOption pkgs "alot" { nullable = true; };
hooks = mkOption {
type = types.lines;
@ -231,7 +231,7 @@ in {
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."alot/config".text = configFile;

View file

@ -23,33 +23,26 @@ in {
description = "The package to use for atuin.";
};
enableBashIntegration = mkOption {
type = types.bool;
default = true;
description = ''
Whether to enable Atuin's Bash integration. This will bind
`ctrl-r` to open the Atuin history.
'';
enableBashIntegration = lib.hm.shell.mkBashIntegrationOption {
inherit config;
extraDescription =
"If enabled, this will bind `ctrl-r` to open the Atuin history.";
};
enableZshIntegration = mkOption {
type = types.bool;
default = true;
description = ''
Whether to enable Atuin's Zsh integration.
If enabled, this will bind `ctrl-r` and the up-arrow
key to open the Atuin history.
'';
enableFishIntegration = lib.hm.shell.mkFishIntegrationOption {
inherit config;
extraDescription =
"If enabled, this will bind the up-arrow key to open the Atuin history.";
};
enableFishIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Atuin's Fish integration.
enableNushellIntegration =
lib.hm.shell.mkNushellIntegrationOption { inherit config; };
If enabled, this will bind the up-arrow key to open the Atuin history.
enableZshIntegration = lib.hm.shell.mkZshIntegrationOption {
inherit config;
extraDescription = ''
If enabled, this will bind `ctrl-r` and the up-arrow key to open the
Atuin history.
'';
};
@ -89,14 +82,6 @@ in {
'';
};
enableNushellIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Nushell integration.
'';
};
daemon = {
enable = mkEnableOption "Atuin daemon";
@ -211,6 +196,13 @@ in {
};
})
(mkIf isDarwin {
programs.atuin.settings = {
daemon = {
socket_path =
lib.mkDefault "${config.xdg.dataHome}/atuin/daemon.sock";
};
};
launchd.agents.atuin-daemon = {
enable = true;
config = {

View file

@ -13,29 +13,14 @@ in {
options.programs.autojump = {
enable = mkEnableOption "autojump";
enableBashIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Bash integration.
'';
};
enableBashIntegration =
lib.hm.shell.mkBashIntegrationOption { inherit config; };
enableZshIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Zsh integration.
'';
};
enableFishIntegration =
lib.hm.shell.mkFishIntegrationOption { inherit config; };
enableFishIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Fish integration.
'';
};
enableZshIntegration =
lib.hm.shell.mkZshIntegrationOption { inherit config; };
};
config = mkIf cfg.enable {

View file

@ -19,7 +19,7 @@ in {
options.programs.bacon = {
enable = mkEnableOption "bacon, a background rust code checker";
package = mkPackageOption pkgs "bacon" { };
package = mkPackageOption pkgs "bacon" { nullable = true; };
settings = mkOption {
type = settingsFormat.type;
@ -38,7 +38,7 @@ in {
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file."${configDir}/prefs.toml" = mkIf (cfg.settings != { }) {
source = settingsFormat.generate "prefs.toml" cfg.settings;

View file

@ -29,7 +29,10 @@ in {
programs.bash = {
enable = mkEnableOption "GNU Bourne-Again SHell";
package = mkPackageOption pkgs "bash" { default = "bashInteractive"; };
package = mkPackageOption pkgs "bash" {
nullable = true;
default = "bashInteractive";
};
enableCompletion = mkOption {
type = types.bool;
@ -51,7 +54,7 @@ in {
};
historySize = mkOption {
type = types.int;
type = types.nullOr types.int;
default = 10000;
description = "Number of history lines to keep in memory.";
};
@ -63,7 +66,7 @@ in {
};
historyFileSize = mkOption {
type = types.int;
type = types.nullOr types.int;
default = 100000;
description = "Number of history lines to keep on file.";
};
@ -180,19 +183,22 @@ in {
sessionVarsStr = config.lib.shell.exportAll cfg.sessionVariables;
historyControlStr = concatStringsSep "\n"
(mapAttrsToList (n: v: "${n}=${v}") ({
HISTFILESIZE = toString cfg.historyFileSize;
HISTSIZE = toString cfg.historySize;
} // optionalAttrs (cfg.historyFile != null) {
HISTFILE = ''"${cfg.historyFile}"'';
} // optionalAttrs (cfg.historyControl != [ ]) {
HISTCONTROL = concatStringsSep ":" cfg.historyControl;
} // optionalAttrs (cfg.historyIgnore != [ ]) {
HISTIGNORE = escapeShellArg (concatStringsSep ":" cfg.historyIgnore);
}));
historyControlStr = (concatStringsSep "\n"
(mapAttrsToList (n: v: "${n}=${v}")
(optionalAttrs (cfg.historyFileSize != null) {
HISTFILESIZE = toString cfg.historyFileSize;
} // optionalAttrs (cfg.historySize != null) {
HISTSIZE = toString cfg.historySize;
} // optionalAttrs (cfg.historyFile != null) {
HISTFILE = ''"${cfg.historyFile}"'';
} // optionalAttrs (cfg.historyControl != [ ]) {
HISTCONTROL = concatStringsSep ":" cfg.historyControl;
} // optionalAttrs (cfg.historyIgnore != [ ]) {
HISTIGNORE = escapeShellArg (concatStringsSep ":" cfg.historyIgnore);
}) ++ optional (cfg.historyFile != null)
''mkdir -p "$(dirname "$HISTFILE")"''));
in mkIf cfg.enable {
home.packages = [ cfg.package ];
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file.".bash_profile".source = writeBashScript "bash_profile" ''
# include .profile if it exists

View file

@ -1,28 +1,25 @@
{ config, lib, pkgs, ... }:
with lib;
let
inherit (lib) literalExpression mkEnableOption mkOption mkIf types;
cfg = config.programs.bat;
toConfigFile = attrs:
let
inherit (builtins) isBool attrNames;
nonBoolFlags = filterAttrs (_: v: !(isBool v)) attrs;
enabledBoolFlags = filterAttrs (_: v: isBool v && v) attrs;
nonBoolFlags = lib.filterAttrs (_: v: !(isBool v)) attrs;
enabledBoolFlags = lib.filterAttrs (_: v: isBool v && v) attrs;
keyValuePairs = generators.toKeyValue {
keyValuePairs = lib.generators.toKeyValue {
mkKeyValue = k: v: "--${k}=${lib.escapeShellArg v}";
listsAsDuplicateKeys = true;
} nonBoolFlags;
switches = concatMapStrings (k: ''
switches = lib.concatMapStrings (k: ''
--${k}
'') (attrNames enabledBoolFlags);
in keyValuePairs + switches;
in {
meta.maintainers = [ ];
meta.maintainers = with lib.maintainers; [ khaneliman ];
options.programs.bat = {
enable = mkEnableOption "bat, a cat clone with wings";
@ -50,7 +47,7 @@ in {
'';
};
package = mkPackageOption pkgs "bat" { };
package = lib.mkPackageOption pkgs "bat" { };
themes = mkOption {
type = types.attrsOf (types.either types.lines (types.submodule {
@ -122,15 +119,15 @@ in {
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf (any isString (attrValues cfg.themes)) {
config = mkIf cfg.enable (lib.mkMerge [
(mkIf (lib.any lib.isString (lib.attrValues cfg.themes)) {
warnings = [''
Using programs.bat.themes as a string option is deprecated and will be
removed in the future. Please change to using it as an attribute set
instead.
''];
})
(mkIf (any isString (attrValues cfg.syntaxes)) {
(mkIf (lib.any lib.isString (lib.attrValues cfg.syntaxes)) {
warnings = [''
Using programs.bat.syntaxes as a string option is deprecated and will be
removed in the future. Please change to using it as an attribute set
@ -140,18 +137,18 @@ in {
{
home.packages = [ cfg.package ] ++ cfg.extraPackages;
xdg.configFile = mkMerge ([({
xdg.configFile = lib.mkMerge ([{
"bat/config" =
mkIf (cfg.config != { }) { text = toConfigFile cfg.config; };
})] ++ (flip mapAttrsToList cfg.themes (name: val: {
"bat/themes/${name}.tmTheme" = if isString val then {
}] ++ (lib.flip lib.mapAttrsToList cfg.themes (name: val: {
"bat/themes/${name}.tmTheme" = if lib.isString val then {
text = val;
} else {
source =
if isNull val.file then "${val.src}" else "${val.src}/${val.file}";
};
})) ++ (flip mapAttrsToList cfg.syntaxes (name: val: {
"bat/syntaxes/${name}.sublime-syntax" = if isString val then {
})) ++ (lib.flip lib.mapAttrsToList cfg.syntaxes (name: val: {
"bat/syntaxes/${name}.sublime-syntax" = if lib.isString val then {
text = val;
} else {
source =
@ -162,9 +159,9 @@ in {
# NOTE: run `bat cache --build` in an empty directory to work
# around failure when ~/cache exists
# https://github.com/sharkdp/bat/issues/1726
home.activation.batCache = hm.dag.entryAfter [ "linkGeneration" ] ''
home.activation.batCache = lib.hm.dag.entryAfter [ "linkGeneration" ] ''
(
export XDG_CACHE_HOME=${escapeShellArg config.xdg.cacheHome}
export XDG_CACHE_HOME=${lib.escapeShellArg config.xdg.cacheHome}
verboseEcho "Rebuilding bat theme cache"
cd "${pkgs.emptyDirectory}"
run ${lib.getExe cfg.package} cache --build

View file

@ -12,7 +12,7 @@ in {
options.programs.bemenu = {
enable = mkEnableOption "bemenu";
package = mkPackageOption pkgs "bemenu" { };
package = mkPackageOption pkgs "bemenu" { nullable = true; };
settings = mkOption {
type = with types; attrsOf (oneOf [ str number bool ]);
@ -44,7 +44,7 @@ in {
assertions =
[ (hm.assertions.assertPlatform "programs.bemenu" pkgs platforms.linux) ];
home.packages = [ cfg.package ];
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.sessionVariables = mkIf (cfg.settings != { }) {
BEMENU_OPTS = cli.toGNUCommandLineShell { } cfg.settings;

View file

@ -243,7 +243,7 @@ in {
programs.borgmatic = {
enable = mkEnableOption "Borgmatic";
package = mkPackageOption pkgs "borgmatic" { };
package = mkPackageOption pkgs "borgmatic" { nullable = true; };
backups = mkOption {
type = types.attrsOf configModule;
@ -292,6 +292,6 @@ in {
text = writeConfig config;
}) cfg.backups;
home.packages = [ cfg.package ];
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
};
}

View file

@ -84,7 +84,7 @@ in {
options.programs.boxxy = {
enable = mkEnableOption "boxxy: Boxes in badly behaving applications";
package = mkPackageOption pkgs "boxxy" { };
package = mkPackageOption pkgs "boxxy" { nullable = true; };
rules = mkOption {
type = types.listOf boxxyRulesOpts;
@ -102,7 +102,7 @@ in {
settingsFormat.generate "boxxy-config.yaml" { rules = cfg.rules; };
};
home.packages = [ cfg.package ];
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
};
meta.maintainers = with lib.hm.maintainers; [ nikp123 ];

View file

@ -154,37 +154,17 @@ in {
options.programs.broot = {
enable = mkEnableOption "Broot, a better way to navigate directories";
enableBashIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Bash integration.
'';
};
enableBashIntegration =
lib.hm.shell.mkBashIntegrationOption { inherit config; };
enableZshIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Zsh integration.
'';
};
enableFishIntegration =
lib.hm.shell.mkFishIntegrationOption { inherit config; };
enableFishIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Fish integration.
'';
};
enableNushellIntegration =
lib.hm.shell.mkNushellIntegrationOption { inherit config; };
enableNushellIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Nushell integration.
'';
};
enableZshIntegration =
lib.hm.shell.mkZshIntegrationOption { inherit config; };
package = mkOption {
type = types.package;
@ -228,9 +208,9 @@ in {
programs.broot.settings = builtins.fromJSON (builtins.readFile
(pkgs.runCommand "default-conf.json" {
nativeBuildInputs = [ pkgs.hjson ];
nativeBuildInputs = [ pkgs.hjson-go ];
}
"hjson -c ${cfg.package.src}/resources/default-conf/conf.hjson > $out"));
"hjson-cli -c ${cfg.package.src}/resources/default-conf/conf.hjson > $out"));
programs.bash.initExtra = mkIf cfg.enableBashIntegration (shellInit "bash");

View file

@ -1,14 +1,10 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.btop;
finalConfig = let
toKeyValue = generators.toKeyValue {
mkKeyValue = generators.mkKeyValueDefault {
toKeyValue = lib.generators.toKeyValue {
mkKeyValue = lib.generators.mkKeyValueDefault {
mkValueString = v:
with builtins;
if isBool v then
@ -21,19 +17,18 @@ let
};
in ''
${toKeyValue cfg.settings}
${optionalString (cfg.extraConfig != "") cfg.extraConfig}
${lib.optionalString (cfg.extraConfig != "") cfg.extraConfig}
'';
in {
meta.maintainers = [ hm.maintainers.GaetanLepage ];
meta.maintainers = with lib.maintainers; [ GaetanLepage khaneliman ];
options.programs.btop = {
enable = mkEnableOption "btop";
enable = lib.mkEnableOption "btop";
package = mkPackageOption pkgs "btop" { };
package = lib.mkPackageOption pkgs "btop" { nullable = true; };
settings = mkOption {
type = with types; attrsOf (oneOf [ bool float int str ]);
settings = lib.mkOption {
type = with lib.types; attrsOf (oneOf [ bool float int str ]);
default = { };
example = {
color_theme = "Default";
@ -46,8 +41,8 @@ in {
'';
};
extraConfig = mkOption {
type = types.lines;
extraConfig = lib.mkOption {
type = lib.types.lines;
default = "";
description = ''
Extra lines added to the {file}`btop.conf` file.
@ -55,10 +50,10 @@ in {
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
config = lib.mkIf cfg.enable {
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."btop/btop.conf" =
mkIf (cfg.settings != { }) { text = finalConfig; };
lib.mkIf (cfg.settings != { }) { text = finalConfig; };
};
}

View file

@ -9,7 +9,7 @@ in {
options.programs.bun = {
enable = lib.mkEnableOption "Bun JavaScript runtime";
package = lib.mkPackageOption pkgs "bun" { };
package = lib.mkPackageOption pkgs "bun" { nullable = true; };
settings = lib.mkOption {
type = tomlFormat.type;
@ -42,7 +42,13 @@ in {
};
config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ];
warnings = lib.optional (cfg.package == null && cfg.enableGitIntegration) ''
You have enabled git integration for `bun` but have not set `package`.
Git integration will not be configured.
'';
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile.".bunfig.toml" = lib.mkIf (cfg.settings != { }) {
source = tomlFormat.generate "bun-config" cfg.settings;
@ -50,10 +56,12 @@ in {
# https://bun.sh/docs/install/lockfile#how-do-i-git-diff-bun-s-lockfile
programs.git.attributes =
lib.mkIf cfg.enableGitIntegration [ "*.lockb binary diff=lockb" ];
programs.git.extraConfig.diff.lockb = lib.mkIf cfg.enableGitIntegration {
textconv = lib.getExe cfg.package;
binary = true;
};
lib.mkIf (cfg.enableGitIntegration && (cfg.package != null))
[ "*.lockb binary diff=lockb" ];
programs.git.extraConfig.diff.lockb =
lib.mkIf (cfg.enableGitIntegration && (cfg.package != null)) {
textconv = lib.getExe cfg.package;
binary = true;
};
};
}

View file

@ -16,21 +16,17 @@ in {
package = mkPackageOption pkgs "carapace" { };
enableBashIntegration = mkEnableOption "Bash integration" // {
default = true;
};
enableBashIntegration =
lib.hm.shell.mkBashIntegrationOption { inherit config; };
enableZshIntegration = mkEnableOption "Zsh integration" // {
default = true;
};
enableFishIntegration =
lib.hm.shell.mkFishIntegrationOption { inherit config; };
enableFishIntegration = mkEnableOption "Fish integration" // {
default = true;
};
enableNushellIntegration =
lib.hm.shell.mkNushellIntegrationOption { inherit config; };
enableNushellIntegration = mkEnableOption "Nushell integration" // {
default = true;
};
enableZshIntegration =
lib.hm.shell.mkZshIntegrationOption { inherit config; };
};
config = mkIf cfg.enable {

View file

@ -14,7 +14,7 @@ in {
options.programs.cava = {
enable = mkEnableOption "Cava audio visualizer";
package = mkPackageOption pkgs "cava" { };
package = mkPackageOption pkgs "cava" { nullable = true; };
settings = mkOption {
type = iniFmt.type;
@ -39,7 +39,7 @@ in {
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."cava/config" = mkIf (cfg.settings != { }) {
text = ''

View file

@ -16,7 +16,7 @@ in {
options.programs.cavalier = {
enable = mkEnableOption "Cava audio visualizer GUI";
package = mkPackageOption pkgs "cavalier" { };
package = mkPackageOption pkgs "cavalier" { nullable = true; };
settings = {
general = mkOption {
@ -81,7 +81,7 @@ in {
lib.platforms.linux)
];
home.packages = [ cfg.package ];
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile = {
"Nickvision Cavalier/config.json" = mkIf (cfg.settings.general != { }) {

View file

@ -137,6 +137,18 @@ let
List of ${name} dictionaries to install.
'';
};
nativeMessagingHosts = mkOption {
type = types.listOf types.package;
default = [ ];
example = literalExpression ''
[
pkgs.kdePackages.plasma-browser-integration
]
'';
description = ''
List of ${name} native messaging hosts to install.
'';
};
};
browserConfig = cfg:
@ -178,6 +190,11 @@ let
value.source = pkg;
};
nativeMessagingHostsJoined = pkgs.symlinkJoin {
name = "${drvName}-native-messaging-hosts";
paths = cfg.nativeMessagingHosts;
};
package = if cfg.commandLineArgs != [ ] then
cfg.package.override {
commandLineArgs = concatStringsSep " " cfg.commandLineArgs;
@ -189,7 +206,14 @@ let
home.packages = [ package ];
home.file = optionalAttrs (!isProprietaryChrome) (listToAttrs
((map extensionJson cfg.extensions)
++ (map dictionary cfg.dictionaries)));
++ (map dictionary cfg.dictionaries)) // {
"${configDir}/NativeMessagingHosts" =
lib.mkIf (cfg.nativeMessagingHosts != [ ]) {
source =
"${nativeMessagingHostsJoined}/etc/chromium/native-messaging-hosts";
recursive = true;
};
});
};
in {

View file

@ -10,7 +10,7 @@ in {
options.programs.comodoro = {
enable = lib.mkEnableOption "Comodoro, a CLI to manage your time";
package = lib.mkPackageOption pkgs "comodoro" { };
package = lib.mkPackageOption pkgs "comodoro" { nullable = true; };
settings = lib.mkOption {
type = lib.types.submodule { freeformType = tomlFormat.type; };
@ -23,7 +23,7 @@ in {
};
config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ];
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."comodoro/config.toml".source =
tomlFormat.generate "comodoro-config.toml" cfg.settings;

View file

@ -13,7 +13,7 @@ in {
programs.darcs = {
enable = mkEnableOption "darcs";
package = mkPackageOption pkgs "darcs" { };
package = mkPackageOption pkgs "darcs" { nullable = true; };
author = mkOption {
type = types.listOf types.str;
@ -36,7 +36,7 @@ in {
};
config = mkIf cfg.enable (mkMerge [
{ home.packages = [ cfg.package ]; }
{ home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; }
(mkIf (cfg.author != [ ]) {
home.file.".darcs/author".text =

View file

@ -19,29 +19,14 @@ in {
'';
};
enableBashIntegration = mkOption {
type = types.bool;
default = true;
description = ''
Whether to enable Bash integration.
'';
};
enableBashIntegration =
lib.hm.shell.mkBashIntegrationOption { inherit config; };
enableFishIntegration = mkOption {
type = types.bool;
default = true;
description = ''
Whether to enable Fish integration.
'';
};
enableFishIntegration =
lib.hm.shell.mkFishIntegrationOption { inherit config; };
enableZshIntegration = mkOption {
type = types.bool;
default = true;
description = ''
Whether to enable Zsh integration.
'';
};
enableZshIntegration =
lib.hm.shell.mkZshIntegrationOption { inherit config; };
settings = mkOption {
type = with types; attrsOf str;
@ -69,155 +54,168 @@ in {
};
};
config = mkIf cfg.enable {
# Add default settings from `dircolors --print-database`.
programs.dircolors.settings = {
RESET = mkDefault "0";
DIR = mkDefault "01;34";
LINK = mkDefault "01;36";
MULTIHARDLINK = mkDefault "00";
FIFO = mkDefault "40;33";
SOCK = mkDefault "01;35";
DOOR = mkDefault "01;35";
BLK = mkDefault "40;33;01";
CHR = mkDefault "40;33;01";
ORPHAN = mkDefault "40;31;01";
MISSING = mkDefault "00";
SETUID = mkDefault "37;41";
SETGID = mkDefault "30;43";
CAPABILITY = mkDefault "30;41";
STICKY_OTHER_WRITABLE = mkDefault "30;42";
OTHER_WRITABLE = mkDefault "34;42";
STICKY = mkDefault "37;44";
EXEC = mkDefault "01;32";
".tar" = mkDefault "01;31";
".tgz" = mkDefault "01;31";
".arc" = mkDefault "01;31";
".arj" = mkDefault "01;31";
".taz" = mkDefault "01;31";
".lha" = mkDefault "01;31";
".lz4" = mkDefault "01;31";
".lzh" = mkDefault "01;31";
".lzma" = mkDefault "01;31";
".tlz" = mkDefault "01;31";
".txz" = mkDefault "01;31";
".tzo" = mkDefault "01;31";
".t7z" = mkDefault "01;31";
".zip" = mkDefault "01;31";
".z" = mkDefault "01;31";
".dz" = mkDefault "01;31";
".gz" = mkDefault "01;31";
".lrz" = mkDefault "01;31";
".lz" = mkDefault "01;31";
".lzo" = mkDefault "01;31";
".xz" = mkDefault "01;31";
".zst" = mkDefault "01;31";
".tzst" = mkDefault "01;31";
".bz2" = mkDefault "01;31";
".bz" = mkDefault "01;31";
".tbz" = mkDefault "01;31";
".tbz2" = mkDefault "01;31";
".tz" = mkDefault "01;31";
".deb" = mkDefault "01;31";
".rpm" = mkDefault "01;31";
".jar" = mkDefault "01;31";
".war" = mkDefault "01;31";
".ear" = mkDefault "01;31";
".sar" = mkDefault "01;31";
".rar" = mkDefault "01;31";
".alz" = mkDefault "01;31";
".ace" = mkDefault "01;31";
".zoo" = mkDefault "01;31";
".cpio" = mkDefault "01;31";
".7z" = mkDefault "01;31";
".rz" = mkDefault "01;31";
".cab" = mkDefault "01;31";
".wim" = mkDefault "01;31";
".swm" = mkDefault "01;31";
".dwm" = mkDefault "01;31";
".esd" = mkDefault "01;31";
".jpg" = mkDefault "01;35";
".jpeg" = mkDefault "01;35";
".mjpg" = mkDefault "01;35";
".mjpeg" = mkDefault "01;35";
".gif" = mkDefault "01;35";
".bmp" = mkDefault "01;35";
".pbm" = mkDefault "01;35";
".pgm" = mkDefault "01;35";
".ppm" = mkDefault "01;35";
".tga" = mkDefault "01;35";
".xbm" = mkDefault "01;35";
".xpm" = mkDefault "01;35";
".tif" = mkDefault "01;35";
".tiff" = mkDefault "01;35";
".png" = mkDefault "01;35";
".svg" = mkDefault "01;35";
".svgz" = mkDefault "01;35";
".mng" = mkDefault "01;35";
".pcx" = mkDefault "01;35";
".mov" = mkDefault "01;35";
".mpg" = mkDefault "01;35";
".mpeg" = mkDefault "01;35";
".m2v" = mkDefault "01;35";
".mkv" = mkDefault "01;35";
".webm" = mkDefault "01;35";
".ogm" = mkDefault "01;35";
".mp4" = mkDefault "01;35";
".m4v" = mkDefault "01;35";
".mp4v" = mkDefault "01;35";
".vob" = mkDefault "01;35";
".qt" = mkDefault "01;35";
".nuv" = mkDefault "01;35";
".wmv" = mkDefault "01;35";
".asf" = mkDefault "01;35";
".rm" = mkDefault "01;35";
".rmvb" = mkDefault "01;35";
".flc" = mkDefault "01;35";
".avi" = mkDefault "01;35";
".fli" = mkDefault "01;35";
".flv" = mkDefault "01;35";
".gl" = mkDefault "01;35";
".dl" = mkDefault "01;35";
".xcf" = mkDefault "01;35";
".xwd" = mkDefault "01;35";
".yuv" = mkDefault "01;35";
".cgm" = mkDefault "01;35";
".emf" = mkDefault "01;35";
".ogv" = mkDefault "01;35";
".ogx" = mkDefault "01;35";
".aac" = mkDefault "00;36";
".au" = mkDefault "00;36";
".flac" = mkDefault "00;36";
".m4a" = mkDefault "00;36";
".mid" = mkDefault "00;36";
".midi" = mkDefault "00;36";
".mka" = mkDefault "00;36";
".mp3" = mkDefault "00;36";
".mpc" = mkDefault "00;36";
".ogg" = mkDefault "00;36";
".ra" = mkDefault "00;36";
".wav" = mkDefault "00;36";
".oga" = mkDefault "00;36";
".opus" = mkDefault "00;36";
".spx" = mkDefault "00;36";
".xspf" = mkDefault "00;36";
};
config = let
dircolorsPath = if config.home.preferXdgDirectories then
"${config.xdg.configHome}/dir_colors"
else
"~/.dir_colors";
home.file.".dir_colors".text = concatStringsSep "\n" ([ ]
dircolorsConfig = concatStringsSep "\n" ([ ]
++ mapAttrsToList formatLine cfg.settings ++ [ "" ]
++ optional (cfg.extraConfig != "") cfg.extraConfig);
in mkIf cfg.enable (mkMerge [
{
# Add default settings from `dircolors --print-database`.
programs.dircolors.settings = {
RESET = mkDefault "0";
DIR = mkDefault "01;34";
LINK = mkDefault "01;36";
MULTIHARDLINK = mkDefault "00";
FIFO = mkDefault "40;33";
SOCK = mkDefault "01;35";
DOOR = mkDefault "01;35";
BLK = mkDefault "40;33;01";
CHR = mkDefault "40;33;01";
ORPHAN = mkDefault "40;31;01";
MISSING = mkDefault "00";
SETUID = mkDefault "37;41";
SETGID = mkDefault "30;43";
CAPABILITY = mkDefault "30;41";
STICKY_OTHER_WRITABLE = mkDefault "30;42";
OTHER_WRITABLE = mkDefault "34;42";
STICKY = mkDefault "37;44";
EXEC = mkDefault "01;32";
".tar" = mkDefault "01;31";
".tgz" = mkDefault "01;31";
".arc" = mkDefault "01;31";
".arj" = mkDefault "01;31";
".taz" = mkDefault "01;31";
".lha" = mkDefault "01;31";
".lz4" = mkDefault "01;31";
".lzh" = mkDefault "01;31";
".lzma" = mkDefault "01;31";
".tlz" = mkDefault "01;31";
".txz" = mkDefault "01;31";
".tzo" = mkDefault "01;31";
".t7z" = mkDefault "01;31";
".zip" = mkDefault "01;31";
".z" = mkDefault "01;31";
".dz" = mkDefault "01;31";
".gz" = mkDefault "01;31";
".lrz" = mkDefault "01;31";
".lz" = mkDefault "01;31";
".lzo" = mkDefault "01;31";
".xz" = mkDefault "01;31";
".zst" = mkDefault "01;31";
".tzst" = mkDefault "01;31";
".bz2" = mkDefault "01;31";
".bz" = mkDefault "01;31";
".tbz" = mkDefault "01;31";
".tbz2" = mkDefault "01;31";
".tz" = mkDefault "01;31";
".deb" = mkDefault "01;31";
".rpm" = mkDefault "01;31";
".jar" = mkDefault "01;31";
".war" = mkDefault "01;31";
".ear" = mkDefault "01;31";
".sar" = mkDefault "01;31";
".rar" = mkDefault "01;31";
".alz" = mkDefault "01;31";
".ace" = mkDefault "01;31";
".zoo" = mkDefault "01;31";
".cpio" = mkDefault "01;31";
".7z" = mkDefault "01;31";
".rz" = mkDefault "01;31";
".cab" = mkDefault "01;31";
".wim" = mkDefault "01;31";
".swm" = mkDefault "01;31";
".dwm" = mkDefault "01;31";
".esd" = mkDefault "01;31";
".jpg" = mkDefault "01;35";
".jpeg" = mkDefault "01;35";
".mjpg" = mkDefault "01;35";
".mjpeg" = mkDefault "01;35";
".gif" = mkDefault "01;35";
".bmp" = mkDefault "01;35";
".pbm" = mkDefault "01;35";
".pgm" = mkDefault "01;35";
".ppm" = mkDefault "01;35";
".tga" = mkDefault "01;35";
".xbm" = mkDefault "01;35";
".xpm" = mkDefault "01;35";
".tif" = mkDefault "01;35";
".tiff" = mkDefault "01;35";
".png" = mkDefault "01;35";
".svg" = mkDefault "01;35";
".svgz" = mkDefault "01;35";
".mng" = mkDefault "01;35";
".pcx" = mkDefault "01;35";
".mov" = mkDefault "01;35";
".mpg" = mkDefault "01;35";
".mpeg" = mkDefault "01;35";
".m2v" = mkDefault "01;35";
".mkv" = mkDefault "01;35";
".webm" = mkDefault "01;35";
".ogm" = mkDefault "01;35";
".mp4" = mkDefault "01;35";
".m4v" = mkDefault "01;35";
".mp4v" = mkDefault "01;35";
".vob" = mkDefault "01;35";
".qt" = mkDefault "01;35";
".nuv" = mkDefault "01;35";
".wmv" = mkDefault "01;35";
".asf" = mkDefault "01;35";
".rm" = mkDefault "01;35";
".rmvb" = mkDefault "01;35";
".flc" = mkDefault "01;35";
".avi" = mkDefault "01;35";
".fli" = mkDefault "01;35";
".flv" = mkDefault "01;35";
".gl" = mkDefault "01;35";
".dl" = mkDefault "01;35";
".xcf" = mkDefault "01;35";
".xwd" = mkDefault "01;35";
".yuv" = mkDefault "01;35";
".cgm" = mkDefault "01;35";
".emf" = mkDefault "01;35";
".ogv" = mkDefault "01;35";
".ogx" = mkDefault "01;35";
".aac" = mkDefault "00;36";
".au" = mkDefault "00;36";
".flac" = mkDefault "00;36";
".m4a" = mkDefault "00;36";
".mid" = mkDefault "00;36";
".midi" = mkDefault "00;36";
".mka" = mkDefault "00;36";
".mp3" = mkDefault "00;36";
".mpc" = mkDefault "00;36";
".ogg" = mkDefault "00;36";
".ra" = mkDefault "00;36";
".wav" = mkDefault "00;36";
".oga" = mkDefault "00;36";
".opus" = mkDefault "00;36";
".spx" = mkDefault "00;36";
".xspf" = mkDefault "00;36";
};
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
eval $(${pkgs.coreutils}/bin/dircolors -b ~/.dir_colors)
'';
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
eval $(${pkgs.coreutils}/bin/dircolors -b ${dircolorsPath})
'';
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
eval (${pkgs.coreutils}/bin/dircolors -c ~/.dir_colors)
'';
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
eval (${pkgs.coreutils}/bin/dircolors -c ${dircolorsPath})
'';
# Set `LS_COLORS` before Oh My Zsh and `initExtra`.
programs.zsh.initExtraBeforeCompInit = mkIf cfg.enableZshIntegration ''
eval $(${pkgs.coreutils}/bin/dircolors -b ~/.dir_colors)
'';
};
# Set `LS_COLORS` before Oh My Zsh and `initExtra`.
programs.zsh.initExtraBeforeCompInit = mkIf cfg.enableZshIntegration ''
eval $(${pkgs.coreutils}/bin/dircolors -b ${dircolorsPath})
'';
}
(mkIf (!config.home.preferXdgDirectories) {
home.file.".dir_colors".text = dircolorsConfig;
})
(mkIf config.home.preferXdgDirectories {
xdg.configFile.dir_colors.text = dircolorsConfig;
})
]);
}

View file

@ -19,7 +19,7 @@ in {
"Flake support is now always enabled.")
];
meta.maintainers = [ lib.maintainers.rycee lib.maintainers.shikanime ];
meta.maintainers = with lib.maintainers; [ khaneliman rycee shikanime ];
options.programs.direnv = {
enable = mkEnableOption "direnv, the environment switcher";
@ -48,44 +48,32 @@ in {
'';
};
enableBashIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Bash integration.
'';
};
enableBashIntegration =
lib.hm.shell.mkBashIntegrationOption { inherit config; };
enableZshIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Zsh integration.
'';
};
enableFishIntegration = lib.hm.shell.mkFishIntegrationOption {
inherit config;
extraDescription = ''
Note, enabling the direnv module will always active its functionality
for Fish since the direnv package automatically gets loaded in Fish.
If this is not the case try adding
enableFishIntegration = mkOption {
default = true;
type = types.bool;
readOnly = true;
description = ''
Whether to enable Fish integration. Note, enabling the direnv module
will always active its functionality for Fish since the direnv package
automatically gets loaded in Fish. If this is not the case try adding
```nix
environment.pathsToLink = [ "/share/fish" ];
environment.pathsToLink = [ "/share/fish" ];
```
to the system configuration.
'';
} // {
default = true;
readOnly = true;
};
enableNushellIntegration = mkOption {
default = true;
type = types.bool;
description = ''
Whether to enable Nushell integration.
'';
};
enableNushellIntegration =
lib.hm.shell.mkNushellIntegrationOption { inherit config; };
enableZshIntegration =
lib.hm.shell.mkZshIntegrationOption { inherit config; };
nix-direnv = {
enable = mkEnableOption ''

View file

@ -11,9 +11,9 @@ in {
enable = mkEnableOption
"discocss, a tiny Discord CSS injector for Linux and MacOS";
package = mkPackageOption pkgs "discocss" { };
package = mkPackageOption pkgs "discocss" { nullable = true; };
discordPackage = mkPackageOption pkgs "discord" { };
discordPackage = mkPackageOption pkgs "discord" { nullable = true; };
discordAlias = mkOption {
type = types.bool;
@ -37,10 +37,10 @@ in {
"To use discocss with discordAlias you have to remove discord from home.packages, or set discordAlias to false.";
}];
home.packages = [
home.packages = lib.mkIf (cfg.package != null) [
(cfg.package.override {
discordAlias = cfg.discordAlias;
discord = cfg.discordPackage;
discord = lib.mkIf (cfg.discordPackage != null) cfg.discordPackage;
})
];

View file

@ -0,0 +1,40 @@
{ config, lib, pkgs, ... }:
let
cfg = config.programs.earthly;
yamlFormat = pkgs.formats.yaml { };
in {
meta.maintainers = [ lib.hm.maintainers.folliehiyuki ];
options.programs.earthly = {
enable = lib.mkEnableOption "earthly";
package = lib.mkPackageOption pkgs "earthly" { nullable = true; };
settings = lib.mkOption {
type = yamlFormat.type;
default = { };
description = ''
Configuration written to ~/.earthly/config.yml file.
See https://docs.earthly.dev/docs/earthly-config for supported values.
'';
example = lib.literalExpression ''
global = {
disable_analytics = true;
disable_log_sharing = true;
};
'';
};
};
config = lib.mkIf cfg.enable {
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file.".earthly/config.yml" = lib.mkIf (cfg.settings != { }) {
source = yamlFormat.generate "earthly-config" cfg.settings;
};
};
}

View file

@ -24,7 +24,8 @@ in {
};
configDir = mkOption {
type = types.path;
type = types.nullOr types.path;
default = null;
example = literalExpression "./eww-config-dir";
description = ''
The directory that gets symlinked to
@ -32,22 +33,20 @@ in {
'';
};
enableBashIntegration = mkEnableOption "Bash integration" // {
default = true;
};
enableBashIntegration =
lib.hm.shell.mkBashIntegrationOption { inherit config; };
enableZshIntegration = mkEnableOption "Zsh integration" // {
default = true;
};
enableFishIntegration =
lib.hm.shell.mkFishIntegrationOption { inherit config; };
enableFishIntegration = mkEnableOption "Fish integration" // {
default = true;
};
enableZshIntegration =
lib.hm.shell.mkZshIntegrationOption { inherit config; };
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."eww".source = cfg.configDir;
xdg =
mkIf (cfg.configDir != null) { configFile."eww".source = cfg.configDir; };
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
if [[ $TERM != "dumb" ]]; then

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