mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-31 04:04:32 +00:00
Merge branch 'master' into xonsh
This commit is contained in:
commit
3693ff7d23
623 changed files with 10008 additions and 3361 deletions
9
.github/labeler.yml
vendored
9
.github/labeler.yml
vendored
|
@ -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:
|
||||
|
|
4
.github/workflows/github_pages.yml
vendored
4
.github/workflows/github_pages.yml
vendored
|
@ -11,10 +11,10 @@ jobs:
|
|||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v30
|
||||
- uses: cachix/install-nix-action@v31
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
- uses: cachix/cachix-action@v15
|
||||
- uses: cachix/cachix-action@v16
|
||||
with:
|
||||
name: nix-community
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
|
|
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
|
@ -12,7 +12,7 @@ jobs:
|
|||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v30
|
||||
- uses: cachix/install-nix-action@v31
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
- run: |
|
||||
|
@ -25,7 +25,5 @@ jobs:
|
|||
- run: nix-shell --show-trace . -A install
|
||||
- run: yes | home-manager -I home-manager=. uninstall
|
||||
- run: nix-shell -j auto --show-trace --arg enableBig false --pure tests -A run.all
|
||||
# Somebody please help us fix the macos tests.
|
||||
if: matrix.os != 'macos-latest'
|
||||
env:
|
||||
GC_INITIAL_HEAP_SIZE: 4294967296
|
||||
|
|
2
.github/workflows/update-flake.yml
vendored
2
.github/workflows/update-flake.yml
vendored
|
@ -12,7 +12,7 @@ jobs:
|
|||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Nix
|
||||
uses: cachix/install-nix-action@v30
|
||||
uses: cachix/install-nix-action@v31
|
||||
- name: Update flake.lock
|
||||
uses: DeterminateSystems/update-flake-lock@v24
|
||||
with:
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
.Op Fl -keep-failed
|
||||
.Op Fl -keep-going
|
||||
.Op Bro Fl L | Fl -print-build-logs Brc
|
||||
.Op Fl -log-format
|
||||
.Op Fl -show-trace
|
||||
.Op Fl -(no-)substitute
|
||||
.Op Fl -no-out-link
|
||||
|
@ -335,6 +336,13 @@ when building from a flake\&.
|
|||
.RE
|
||||
.Pp
|
||||
|
||||
.It Cm Fl -log-format Ar format
|
||||
.RS 4
|
||||
Passed on to
|
||||
\fBnix-build\fR(1)\&.
|
||||
.RE
|
||||
.Pp
|
||||
|
||||
.It Cm Fl -show-trace
|
||||
.RS 4
|
||||
Passed on to
|
||||
|
|
|
@ -34,6 +34,31 @@ to your system `configuration.nix` file, which will introduce a new
|
|||
NixOS option called `home-manager.users` whose type is an attribute set
|
||||
that maps user names to Home Manager configurations.
|
||||
|
||||
Alternatively, home-manager installation can be done declaratively through configuration.nix using the following syntax:
|
||||
```nix
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
home-manager = builtins.fetchTarball https://github.com/nix-community/home-manager/archive/release-24.11.tar.gz;
|
||||
in
|
||||
{
|
||||
imports =
|
||||
[
|
||||
(import "${home-manager}/nixos")
|
||||
];
|
||||
|
||||
users.users.eve.isNormalUser = true;
|
||||
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";
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
For example, a NixOS configuration may include the lines
|
||||
|
||||
``` nix
|
||||
|
@ -42,9 +67,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.
|
||||
|
||||
};
|
||||
```
|
||||
|
||||
|
@ -123,3 +154,4 @@ you create. This contains the system's NixOS configuration.
|
|||
|
||||
Once installed you can see [Using Home Manager](#ch-usage) for a more detailed
|
||||
description of Home Manager and how to use it.
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ you may wish to import Home Manager's flake module,
|
|||
inputs.home-manager.flakeModules.home-manager
|
||||
];
|
||||
flake = {
|
||||
# Define `homeManagerModules`, `homeConfigurations`,
|
||||
# Define `homeModules`, `homeConfigurations`,
|
||||
# `nixosConfigurations`, etc here
|
||||
};
|
||||
# See flake.parts for more features, such as `perSystem`
|
||||
|
@ -30,10 +30,10 @@ you may wish to import Home Manager's flake module,
|
|||
}
|
||||
```
|
||||
|
||||
The flake module defines the `flake.homeManagerModules` and `flake.homeConfigurations`
|
||||
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 `homeManagerModules` and/or `homeConfigurations` once in a
|
||||
If you are only defining `homeModules` and/or `homeConfigurations` once in a
|
||||
single module, flake-parts should work fine without importing
|
||||
`flakeModules.home-manager`.
|
||||
|
|
|
@ -4,7 +4,7 @@ in {
|
|||
options = {
|
||||
flake = flake-parts-lib.mkSubmoduleOptions {
|
||||
homeConfigurations = mkOption {
|
||||
type = types.lazyAttrsOf types.deferredModule;
|
||||
type = types.lazyAttrsOf types.raw;
|
||||
default = { };
|
||||
description = ''
|
||||
Instantiated Home Manager configurations.
|
||||
|
@ -14,12 +14,12 @@ in {
|
|||
that you can reference them in this or another flake's `homeConfigurations`.
|
||||
'';
|
||||
};
|
||||
homeManagerModules = mkOption {
|
||||
type = types.lazyAttrsOf types.unspecified;
|
||||
homeModules = mkOption {
|
||||
type = types.lazyAttrsOf types.deferredModule;
|
||||
default = { };
|
||||
apply = mapAttrs (k: v: {
|
||||
_class = "homeManager";
|
||||
_file = "${toString moduleLocation}#homeManagerModules.${k}";
|
||||
_file = "${toString moduleLocation}#homeModules.${k}";
|
||||
imports = [ v ];
|
||||
});
|
||||
description = ''
|
||||
|
|
6
flake.lock
generated
6
flake.lock
generated
|
@ -2,11 +2,11 @@
|
|||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1739020877,
|
||||
"narHash": "sha256-mIvECo/NNdJJ/bXjNqIh8yeoSjVLAuDuTUzAo7dzs8Y=",
|
||||
"lastModified": 1742669843,
|
||||
"narHash": "sha256-G5n+FOXLXcRx+3hCJ6Rt6ZQyF1zqQ0DL0sWAMn2Nk0w=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a79cfe0ebd24952b580b1cf08cd906354996d547",
|
||||
"rev": "1e5b653dff12029333a6546c11e108ede13052eb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -300,7 +300,7 @@ _home-manager_completions ()
|
|||
Options=( "-f" "--file" "-b" "-A" "-I" "-h" "--help" "-n" "--dry-run" "-v" \
|
||||
"--verbose" "--cores" "--debug" "--impure" "--keep-failed" \
|
||||
"--keep-going" "-j" "--max-jobs" "--no-substitute" "--no-out-link" \
|
||||
"-L" "--print-build-logs" \
|
||||
"-L" "--print-build-logs" "--log-format" \
|
||||
"--show-trace" "--flake" "--substitute" "--builders" "--version" \
|
||||
"--update-input" "--override-input" "--experimental-features" \
|
||||
"--extra-experimental-features" "--refresh")
|
||||
|
|
|
@ -61,6 +61,7 @@ complete -c home-manager -x -s j -l "max-jobs" -d "Max number of build jobs in p
|
|||
complete -c home-manager -x -l "option" -d "Set Nix configuration option"
|
||||
complete -c home-manager -x -l "builders" -d "Remote builders"
|
||||
complete -c home-manager -f -s L -l "print-build-logs" -d "Print full build logs on standard error"
|
||||
complete -c home-manager -x -l "log-format" -d "Set the format of log output"
|
||||
complete -c home-manager -f -l "show-trace" -d "Print stack trace of evaluation errors"
|
||||
complete -c home-manager -f -l "substitute"
|
||||
complete -c home-manager -f -l "no-substitute"
|
||||
|
|
|
@ -21,6 +21,7 @@ _arguments \
|
|||
'--option[option]:NAME VALUE:()' \
|
||||
'--builders[builders]:SPEC:()' \
|
||||
'(-L --print-build-logs)'{--print-build-logs,-L}'[print build logs]' \
|
||||
'--log-format[log format]:FORMAT:()' \
|
||||
'--show-trace[show trace]' \
|
||||
'--override-input[override flake input]:NAME VALUE:()' \
|
||||
'--update-input[update flake input]:NAME:()' \
|
||||
|
@ -63,6 +64,7 @@ case "$state" in
|
|||
'--no-out-link[no out link]' \
|
||||
'--no-substitute[no substitute]' \
|
||||
'--option[option]:NAME VALUE:()' \
|
||||
'--log-format[log format]:FORMAT:()' \
|
||||
'--show-trace[show trace]' \
|
||||
'--substitute[substitute]' \
|
||||
'--builders[builders]:SPEC:()' \
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -907,6 +907,7 @@ function doHelp() {
|
|||
echo " -j, --max-jobs NUM"
|
||||
echo " --option NAME VALUE"
|
||||
echo " -L, --print-build-logs"
|
||||
echo " --log-format FORMAT"
|
||||
echo " --show-trace"
|
||||
echo " --(no-)substitute"
|
||||
echo " --no-out-link Do not create a symlink to the output path"
|
||||
|
@ -1036,7 +1037,7 @@ while [[ $# -gt 0 ]]; do
|
|||
PASSTHROUGH_OPTS+=("$opt" "$1" "$2")
|
||||
shift 2
|
||||
;;
|
||||
-j|--max-jobs|--cores|--builders)
|
||||
-j|--max-jobs|--cores|--builders|--log-format)
|
||||
[[ -v 1 && $1 != -* ]] || errMissingOptArg "$opt"
|
||||
PASSTHROUGH_OPTS+=("$opt" "$1")
|
||||
shift
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
}];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.";
|
||||
|
@ -268,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 {
|
||||
|
@ -292,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
|
||||
|
@ -391,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") {
|
||||
|
@ -510,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"),
|
||||
|
@ -529,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);
|
||||
})
|
||||
];
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
})
|
||||
]);
|
||||
];
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 "[1;31mwarning: ${w}[0m" 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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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 ];
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
im = config.i18n.inputMethod;
|
||||
cfg = im.fcitx5;
|
||||
|
@ -9,25 +7,25 @@ let
|
|||
in {
|
||||
options = {
|
||||
i18n.inputMethod.fcitx5 = {
|
||||
fcitx5-with-addons = mkOption {
|
||||
type = types.package;
|
||||
fcitx5-with-addons = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.libsForQt5.fcitx5-with-addons;
|
||||
example = literalExpression "pkgs.kdePackages.fcitx5-with-addons";
|
||||
example = lib.literalExpression "pkgs.kdePackages.fcitx5-with-addons";
|
||||
description = ''
|
||||
The fcitx5 package to use.
|
||||
'';
|
||||
};
|
||||
addons = mkOption {
|
||||
type = with types; listOf package;
|
||||
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 = mkOption {
|
||||
type = types.bool;
|
||||
waylandFrontend = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Use the Wayland input method frontend.
|
||||
|
@ -37,23 +35,27 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
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
|
||||
XMODIFIERS = "@im=fcitx";
|
||||
QT_PLUGIN_PATH =
|
||||
"$QT_PLUGIN_PATH\${QT_PLUGIN_PATH:+:}${fcitx5Package}/${pkgs.qt6.qtbase.qtPluginPrefix}";
|
||||
} // lib.optionalAttrs (!cfg.waylandFrontend) {
|
||||
GTK_IM_MODULE = "fcitx";
|
||||
QT_IM_MODULE = "fcitx";
|
||||
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" ];
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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
121
modules/launchd/types.nix
Normal 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));
|
||||
}
|
|
@ -24,6 +24,12 @@
|
|||
github = "afresquet";
|
||||
githubId = 29437693;
|
||||
};
|
||||
aguirre-matteo = {
|
||||
name = "aguirre-matteo";
|
||||
email = "aguirre.matteo.nix@gmail.com";
|
||||
github = "aguirre-matteo";
|
||||
githubId = 158215792;
|
||||
};
|
||||
amesgen = {
|
||||
name = "amesgen";
|
||||
email = "amesgen@amesgen.de";
|
||||
|
@ -60,6 +66,12 @@
|
|||
github = "bertof";
|
||||
githubId = 9915675;
|
||||
};
|
||||
bmrips = {
|
||||
name = "Benedikt Rips";
|
||||
email = "benedikt.rips@gmail.com";
|
||||
github = "bmrips";
|
||||
githubId = 20407973;
|
||||
};
|
||||
bricked = {
|
||||
name = "Bricked";
|
||||
email = "hello@bricked.dev";
|
||||
|
@ -112,6 +124,12 @@
|
|||
github = "diniamo";
|
||||
githubId = 55629891;
|
||||
};
|
||||
dsoverlord = {
|
||||
name = "Kirill Zakharov";
|
||||
email = "dsoverlord@vk.com";
|
||||
github = "dsoverlord";
|
||||
githubId = 78819443;
|
||||
};
|
||||
dwagenk = {
|
||||
email = "dwagenk@mailbox.org";
|
||||
github = "dwagenk";
|
||||
|
@ -124,6 +142,14 @@
|
|||
githubId = "56848082";
|
||||
name = "Henri Sota";
|
||||
};
|
||||
hey2022 = {
|
||||
name = "Yiheng He";
|
||||
email = "yiheng.he@proton.me";
|
||||
matrix = "@hey2022:matrix.org";
|
||||
github = "hey2022";
|
||||
keys =
|
||||
[{ fingerprint = "128E 09C0 6F73 D678 6BB5 E551 5EA5 3C75 F7BE 3EDE"; }];
|
||||
};
|
||||
jack5079 = {
|
||||
name = "Jack W.";
|
||||
email = "nix@jack.cab";
|
||||
|
@ -137,6 +163,15 @@
|
|||
github = "Janik-Haag";
|
||||
githubId = 80165193;
|
||||
};
|
||||
jess = {
|
||||
name = "Jessica";
|
||||
email = "jess+nix@jessie.cafe";
|
||||
githubId = 43591752;
|
||||
keys = [{
|
||||
longkeyid = "rsa3072/0xBA3350686C918606";
|
||||
fingerprint = "8092 3BD1 ECD0 E436 671D C8E9 BA33 5068 6C91 8606";
|
||||
}];
|
||||
};
|
||||
jkarlson = {
|
||||
email = "jekarlson@gmail.com";
|
||||
github = "jkarlson";
|
||||
|
@ -275,6 +310,12 @@
|
|||
github = "mifom";
|
||||
githubId = 23462908;
|
||||
};
|
||||
msyds = {
|
||||
name = "Madeleine Sydney Ślaga";
|
||||
email = "65362461+msyds@users.noreply.github.com";
|
||||
github = "msyds";
|
||||
githubId = 65362461;
|
||||
};
|
||||
nikp123 = {
|
||||
name = "nikp123";
|
||||
email = "nikp123@users.noreply.github.com";
|
||||
|
@ -667,4 +708,28 @@
|
|||
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;
|
||||
};
|
||||
noodlez = {
|
||||
name = "Nathaniel Barragan";
|
||||
email = "contact@nathanielbarragan.xyz";
|
||||
github = "Noodlez1232";
|
||||
githubId = 12480453;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -17,6 +17,14 @@ let
|
|||
};
|
||||
|
||||
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}"'';
|
||||
|
||||
|
|
|
@ -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 ])
|
||||
];
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
'');
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
|
92
modules/misc/mozilla-messaging-hosts.nix
Normal file
92
modules/misc/mozilla-messaging-hosts.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -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 = {
|
||||
|
@ -1891,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.
|
||||
|
@ -2062,6 +2066,120 @@ in {
|
|||
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.
|
||||
'';
|
||||
}
|
||||
{
|
||||
time = "2025-03-19T18:10:56+00:00";
|
||||
condition = config.services.easyeffects.enable;
|
||||
message = ''
|
||||
The Easyeffects module now supports adding json formatted presets
|
||||
under '$XDG_CONFIG_HOME/easyeffects/{input,output}/'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2025-02-12T15:56:00+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.tex-fmt'.
|
||||
|
||||
tex-fmt is a LaTeX formatter written in Rust.
|
||||
See https://github.com/WGUNDERWOOD/tex-fmt for more information.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2025-03-24T22:31:45+00:00";
|
||||
message = ''
|
||||
The following default values change from 'true' to
|
||||
'false':
|
||||
|
||||
- programs.zellij.enableBashIntegration
|
||||
- programs.zellij.enableFishIntegration
|
||||
- programs.zellij.enableZshIntegration
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2025-01-02T11:21:19+00:00";
|
||||
message = ''
|
||||
A new module is available: 'services.mpdscribble'.
|
||||
|
||||
A MPD client which submits information about tracks being played to a
|
||||
scrobbler (e.g. last.fm)
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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,18 +44,18 @@ 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;
|
||||
};
|
||||
};
|
||||
|
@ -73,7 +71,7 @@ in {
|
|||
}
|
||||
];
|
||||
|
||||
warnings = optional ((cfg.config != null) || (cfg.overlays != null)) ''
|
||||
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`.
|
||||
'';
|
||||
|
|
|
@ -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 = 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
|
||||
|
|
|
@ -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" ];
|
||||
};
|
||||
|
||||
|
|
|
@ -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);
|
||||
})
|
||||
];
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
|
||||
|
|
|
@ -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.
|
||||
'';
|
||||
|
|
|
@ -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,8 +44,8 @@ with lib;
|
|||
'';
|
||||
})
|
||||
|
||||
(mkIf config.programs.zsh.enableVteIntegration {
|
||||
programs.zsh.initExtra = ''
|
||||
(lib.mkIf config.programs.zsh.enableVteIntegration {
|
||||
programs.zsh.initContent = ''
|
||||
. ${pkgs.vte}/etc/profile.d/vte.sh
|
||||
'';
|
||||
})
|
||||
|
|
|
@ -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));
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
'';
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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}";
|
||||
|
||||
|
|
|
@ -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));
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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 = ""; }
|
||||
];
|
||||
}
|
||||
];
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
# If disabled, the pkgs attribute passed to this function is used instead.
|
||||
, useNixpkgsModule ? true }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
modules = [
|
||||
|
@ -30,6 +28,7 @@ let
|
|||
./misc/fontconfig.nix
|
||||
./misc/gtk.nix
|
||||
./misc/lib.nix
|
||||
./misc/mozilla-messaging-hosts.nix
|
||||
./misc/news.nix
|
||||
./misc/nixgl.nix
|
||||
./misc/numlock.nix
|
||||
|
@ -89,6 +88,8 @@ let
|
|||
./programs/dircolors.nix
|
||||
./programs/direnv.nix
|
||||
./programs/discocss.nix
|
||||
./programs/distrobox.nix
|
||||
./programs/earthly.nix
|
||||
./programs/eclipse.nix
|
||||
./programs/emacs.nix
|
||||
./programs/eww.nix
|
||||
|
@ -131,6 +132,7 @@ let
|
|||
./programs/i3blocks.nix
|
||||
./programs/i3status-rust.nix
|
||||
./programs/i3status.nix
|
||||
./programs/iamb.nix
|
||||
./programs/imv.nix
|
||||
./programs/info.nix
|
||||
./programs/ion.nix
|
||||
|
@ -138,6 +140,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
|
||||
|
@ -151,6 +154,7 @@ let
|
|||
./programs/kodi.nix
|
||||
./programs/kubecolor.nix
|
||||
./programs/lapce.nix
|
||||
./programs/lazydocker.nix
|
||||
./programs/lazygit.nix
|
||||
./programs/ledger.nix
|
||||
./programs/less.nix
|
||||
|
@ -166,8 +170,10 @@ let
|
|||
./programs/mbsync.nix
|
||||
./programs/mcfly.nix
|
||||
./programs/mercurial.nix
|
||||
./programs/mergiraf.nix
|
||||
./programs/micro.nix
|
||||
./programs/mise.nix
|
||||
./programs/mods.nix
|
||||
./programs/mpv.nix
|
||||
./programs/mr.nix
|
||||
./programs/msmtp.nix
|
||||
|
@ -193,6 +199,7 @@ let
|
|||
./programs/octant.nix
|
||||
./programs/offlineimap.nix
|
||||
./programs/oh-my-posh.nix
|
||||
./programs/onlyoffice.nix
|
||||
./programs/opam.nix
|
||||
./programs/openstackclient.nix
|
||||
./programs/pandoc.nix
|
||||
|
@ -215,9 +222,11 @@ let
|
|||
./programs/qutebrowser.nix
|
||||
./programs/ranger.nix
|
||||
./programs/rbw.nix
|
||||
./programs/rclone.nix
|
||||
./programs/readline.nix
|
||||
./programs/rio.nix
|
||||
./programs/ripgrep.nix
|
||||
./programs/ripgrep-all.nix
|
||||
./programs/rofi-pass.nix
|
||||
./programs/rofi.nix
|
||||
./programs/rtorrent.nix
|
||||
|
@ -236,12 +245,14 @@ let
|
|||
./programs/sqls.nix
|
||||
./programs/ssh.nix
|
||||
./programs/starship.nix
|
||||
./programs/swayimg.nix
|
||||
./programs/swaylock.nix
|
||||
./programs/swayr.nix
|
||||
./programs/taskwarrior.nix
|
||||
./programs/tealdeer.nix
|
||||
./programs/terminator.nix
|
||||
./programs/termite.nix
|
||||
./programs/tex-fmt.nix
|
||||
./programs/texlive.nix
|
||||
./programs/thefuck.nix
|
||||
./programs/thunderbird.nix
|
||||
|
@ -259,16 +270,17 @@ let
|
|||
./programs/vifm.nix
|
||||
./programs/vim-vint.nix
|
||||
./programs/vim.nix
|
||||
./programs/vinegar.nix
|
||||
./programs/vscode.nix
|
||||
./programs/vscode/haskell.nix
|
||||
./programs/pywal.nix
|
||||
./programs/rbenv.nix
|
||||
./programs/watson.nix
|
||||
./programs/waylogout.nix
|
||||
./programs/waybar.nix
|
||||
./programs/wezterm.nix
|
||||
./programs/wlogout.nix
|
||||
./programs/wofi.nix
|
||||
./programs/wpaperd.nix
|
||||
./programs/xmobar.nix
|
||||
./programs/xplr.nix
|
||||
./programs/xonsh.nix
|
||||
|
@ -302,10 +314,12 @@ let
|
|||
./services/cliphist.nix
|
||||
./services/clipman.nix
|
||||
./services/clipmenu.nix
|
||||
./services/clipse.nix
|
||||
./services/comodoro.nix
|
||||
./services/conky.nix
|
||||
./services/copyq.nix
|
||||
./services/darkman.nix
|
||||
./services/davmail.nix
|
||||
./services/devilspie2.nix
|
||||
./services/dropbox.nix
|
||||
./services/dunst.nix
|
||||
|
@ -329,22 +343,28 @@ let
|
|||
./services/hound.nix
|
||||
./services/hypridle.nix
|
||||
./services/hyprpaper.nix
|
||||
./services/hyprpolkitagent.nix
|
||||
./services/imapnotify.nix
|
||||
./services/jankyborders.nix
|
||||
./services/kanshi.nix
|
||||
./services/kbfs.nix
|
||||
./services/kdeconnect.nix
|
||||
./services/keybase.nix
|
||||
./services/keynav.nix
|
||||
./services/librespot.nix
|
||||
./services/lieer.nix
|
||||
./services/linux-wallpaperengine.nix
|
||||
./services/listenbrainz-mpd.nix
|
||||
./services/lorri.nix
|
||||
./services/lxqt-policykit-agent.nix
|
||||
./services/macos-remap-keys
|
||||
./services/mako.nix
|
||||
./services/mbsync.nix
|
||||
./services/megasync.nix
|
||||
./services/mopidy.nix
|
||||
./services/mpd.nix
|
||||
./services/mpdris2.nix
|
||||
./services/mpdscribble.nix
|
||||
./services/mpd-discord-rpc.nix
|
||||
./services/mpd-mpris.nix
|
||||
./services/mpris-proxy.nix
|
||||
|
@ -367,6 +387,7 @@ let
|
|||
./services/playerctld.nix
|
||||
./services/plex-mpv-shim.nix
|
||||
./services/podman-linux
|
||||
./services/polkit-gnome.nix
|
||||
./services/polybar.nix
|
||||
./services/poweralertd.nix
|
||||
./services/psd.nix
|
||||
|
@ -382,6 +403,7 @@ let
|
|||
./services/screen-locker.nix
|
||||
./services/sctd.nix
|
||||
./services/signaturepdf.nix
|
||||
./services/skhd.nix
|
||||
./services/snixembed.nix
|
||||
./services/spotifyd.nix
|
||||
./services/ssh-agent.nix
|
||||
|
@ -390,6 +412,7 @@ let
|
|||
./services/swayidle.nix
|
||||
./services/swaync.nix
|
||||
./services/swayosd.nix
|
||||
./services/swww.nix
|
||||
./services/sxhkd.nix
|
||||
./services/syncthing.nix
|
||||
./services/systembus-notify.nix
|
||||
|
@ -418,7 +441,9 @@ 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
|
||||
|
@ -436,28 +461,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;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -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:"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
"";
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -29,7 +29,7 @@ in {
|
|||
options.programs.aerospace = {
|
||||
enable = lib.mkEnableOption "AeroSpace window manager";
|
||||
|
||||
package = lib.mkPackageOption pkgs "aerospace" { };
|
||||
package = lib.mkPackageOption pkgs "aerospace" { nullable = true; };
|
||||
|
||||
userSettings = mkOption {
|
||||
type = types.submodule {
|
||||
|
@ -232,7 +232,7 @@ in {
|
|||
];
|
||||
|
||||
home = {
|
||||
packages = [ cfg.package ];
|
||||
packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||
file.".config/aerospace/aerospace.toml".source =
|
||||
tomlFormat.generate "aerospace" (filterNulls cfg.userSettings);
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -31,12 +31,12 @@ in {
|
|||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
programs.zsh.initExtraBeforeCompInit = let
|
||||
programs.zsh.initContent = let
|
||||
configFiles = pkgs.runCommand "hm_antidote-files" { } ''
|
||||
echo "${zPluginStr cfg.plugins}" > $out
|
||||
'';
|
||||
hashId = parseHashId "${configFiles}";
|
||||
in ''
|
||||
in (mkOrder 550 ''
|
||||
## home-manager/antidote begin :
|
||||
source ${cfg.package}/share/antidote/antidote.zsh
|
||||
${optionalString cfg.useFriendlyNames
|
||||
|
@ -50,6 +50,6 @@ in {
|
|||
antidote load $bundlefile $staticfile
|
||||
|
||||
## home-manager/antidote end
|
||||
'';
|
||||
'');
|
||||
};
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ in {
|
|||
fi
|
||||
'';
|
||||
|
||||
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
||||
programs.zsh.initContent = mkIf cfg.enableZshIntegration ''
|
||||
if [[ $options[zle] = on ]]; then
|
||||
eval "$(${lib.getExe cfg.package} init zsh ${flagsStr})"
|
||||
fi
|
||||
|
|
|
@ -30,7 +30,7 @@ in {
|
|||
. ${package}/share/autojump/autojump.bash
|
||||
'');
|
||||
|
||||
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
||||
programs.zsh.initContent = mkIf cfg.enableZshIntegration ''
|
||||
. ${package}/share/autojump/autojump.zsh
|
||||
'';
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
@ -195,7 +198,7 @@ in {
|
|||
}) ++ 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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 ];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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 ];
|
||||
|
|
|
@ -214,7 +214,7 @@ in {
|
|||
|
||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration (shellInit "bash");
|
||||
|
||||
programs.zsh.initExtra = mkIf cfg.enableZshIntegration (shellInit "zsh");
|
||||
programs.zsh.initContent = mkIf cfg.enableZshIntegration (shellInit "zsh");
|
||||
|
||||
programs.fish.shellInit = mkIf cfg.enableFishIntegration (shellInit "fish");
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ in {
|
|||
options.programs.btop = {
|
||||
enable = lib.mkEnableOption "btop";
|
||||
|
||||
package = lib.mkPackageOption pkgs "btop" { };
|
||||
package = lib.mkPackageOption pkgs "btop" { nullable = true; };
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = with lib.types; attrsOf (oneOf [ bool float int str ]);
|
||||
|
@ -51,7 +51,7 @@ in {
|
|||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||
|
||||
xdg.configFile."btop/btop.conf" =
|
||||
lib.mkIf (cfg.settings != { }) { text = finalConfig; };
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ in {
|
|||
source <(${bin} _carapace bash)
|
||||
'';
|
||||
|
||||
zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
||||
zsh.initContent = mkIf cfg.enableZshIntegration ''
|
||||
source <(${bin} _carapace zsh)
|
||||
'';
|
||||
|
||||
|
@ -69,18 +69,23 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
xdg.configFile =
|
||||
mkIf (config.programs.fish.enable && cfg.enableFishIntegration) (
|
||||
xdg.configFile = mkIf (config.programs.fish.enable
|
||||
&& cfg.enableFishIntegration
|
||||
&& lib.versionOlder config.programs.fish.package.version "4.0.0") (
|
||||
# Convert the entries from `carapace --list` to empty
|
||||
# xdg.configFile."fish/completions/NAME.fish" entries.
|
||||
#
|
||||
# This is to disable fish builtin completion for each of the
|
||||
# carapace-supported completions It is in line with the instructions from
|
||||
# carapace-supported completions.
|
||||
#
|
||||
# This is necessary for carapace to properly work with fish version < 4.0b1.
|
||||
#
|
||||
# It is in line with the instructions from
|
||||
# carapace-bin:
|
||||
#
|
||||
# carapace --list | awk '{print $1}' | xargs -I{} touch ~/.config/fish/completions/{}.fish
|
||||
#
|
||||
# See https://github.com/rsteube/carapace-bin#getting-started
|
||||
# See https://carapace-sh.github.io/carapace-bin/setup.html#fish
|
||||
let
|
||||
carapaceListFile = pkgs.runCommandLocal "carapace-list" {
|
||||
buildInputs = [ cfg.package ];
|
||||
|
|
|
@ -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 = ''
|
||||
|
|
|
@ -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 != { }) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -54,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.initContent = mkIf cfg.enableZshIntegration (mkOrder 550 ''
|
||||
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;
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ in {
|
|||
enableFishIntegration = lib.hm.shell.mkFishIntegrationOption {
|
||||
inherit config;
|
||||
extraDescription = ''
|
||||
Note, enabling the direnv module will always active its functionality
|
||||
Note, enabling the direnv module will always activate its functionality
|
||||
for Fish since the direnv package automatically gets loaded in Fish.
|
||||
If this is not the case try adding
|
||||
```nix
|
||||
|
@ -128,7 +128,7 @@ in {
|
|||
eval "$(${getExe cfg.package} hook bash)"
|
||||
'');
|
||||
|
||||
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
||||
programs.zsh.initContent = mkIf cfg.enableZshIntegration ''
|
||||
eval "$(${getExe cfg.package} hook zsh)"
|
||||
'';
|
||||
|
||||
|
|
|
@ -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;
|
||||
})
|
||||
];
|
||||
|
||||
|
|
96
modules/programs/distrobox.nix
Normal file
96
modules/programs/distrobox.nix
Normal file
|
@ -0,0 +1,96 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
let
|
||||
inherit (lib) generators types mkIf mkEnableOption mkPackageOption mkOption;
|
||||
|
||||
cfg = config.programs.distrobox;
|
||||
|
||||
formatter = pkgs.formats.ini { listsAsDuplicateKeys = true; };
|
||||
in {
|
||||
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
|
||||
|
||||
options.programs.distrobox = {
|
||||
enable = mkEnableOption "distrobox";
|
||||
|
||||
package = mkPackageOption pkgs "distrobox" { };
|
||||
|
||||
containers = mkOption {
|
||||
type = formatter.type;
|
||||
default = { };
|
||||
example = ''
|
||||
{
|
||||
python-project = {
|
||||
image = "fedora:40";
|
||||
additional_packages = "python3 git";
|
||||
init_hooks = "pip3 install numpy pandas torch torchvision";
|
||||
};
|
||||
|
||||
common-debian = {
|
||||
image = "debian:13";
|
||||
entry = true;
|
||||
additional_packages = "git";
|
||||
init_hooks = [
|
||||
"ln -sf /usr/bin/distrobox-host-exec /usr/local/bin/docker"
|
||||
"ln -sf /usr/bin/distrobox-host-exec /usr/local/bin/docker-compose"
|
||||
];
|
||||
};
|
||||
|
||||
office = {
|
||||
clone = "common-debian";
|
||||
additional_packages = "libreoffice onlyoffice";
|
||||
entry = true;
|
||||
};
|
||||
|
||||
random-things = {
|
||||
clone = "common-debian";
|
||||
entry = false;
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
A set of containers and all its respective configurations. Each option can be either a
|
||||
bool, string or a list of strings. If passed a list, the option will be repeated for each element.
|
||||
See common-debian in the example config. All the available options for the containers can be found
|
||||
in the distrobox-assemble documentation at <https://github.com/89luca89/distrobox/blob/main/docs/usage/distrobox-assemble.md>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
(lib.hm.assertions.assertPlatform "programs.distrobox" pkgs
|
||||
lib.platforms.linux)
|
||||
];
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile."distrobox/containers.ini".source =
|
||||
(formatter.generate "containers.ini" cfg.containers);
|
||||
|
||||
systemd.user.services.distrobox-home-manager = {
|
||||
Unit.Description =
|
||||
"Build the containers declared in ~/.config/distrobox/containers.ini";
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
|
||||
Service.ExecStart = "${pkgs.writeShellScript "distrobox-home-manager" ''
|
||||
PATH=/run/current-system/sw/bin:
|
||||
|
||||
containers_file=${config.xdg.configHome}/distrobox/containers.ini
|
||||
prev_hash_file=${config.xdg.configHome}/distrobox/prev_hash
|
||||
new_hash=$(sha256sum $containers_file | cut -f 1 -d " ")
|
||||
|
||||
if [[ -f $prev_hash_file ]]; then
|
||||
prev_hash=$(cat $prev_hash_file)
|
||||
else
|
||||
prev_hash=0
|
||||
fi
|
||||
|
||||
if [[ $prev_hash != $new_hash ]]; then
|
||||
rm -rf /tmp/storage-run-1000/containers
|
||||
rm -rf /tmp/storage-run-1000/libpod/tmp
|
||||
${cfg.package}/bin/distrobox-assemble create --file $containers_file
|
||||
echo $new_hash > $prev_hash_file
|
||||
fi
|
||||
''}";
|
||||
};
|
||||
};
|
||||
}
|
40
modules/programs/earthly.nix
Normal file
40
modules/programs/earthly.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -54,7 +54,7 @@ in {
|
|||
fi
|
||||
'';
|
||||
|
||||
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
||||
programs.zsh.initContent = mkIf cfg.enableZshIntegration ''
|
||||
if [[ $TERM != "dumb" ]]; then
|
||||
eval "$(${ewwCmd} shell-completions --shell zsh)"
|
||||
fi
|
||||
|
|
|
@ -75,7 +75,7 @@ with lib;
|
|||
'';
|
||||
};
|
||||
|
||||
package = mkPackageOption pkgs "eza" { };
|
||||
package = mkPackageOption pkgs "eza" { nullable = true; };
|
||||
};
|
||||
|
||||
config = let
|
||||
|
@ -108,7 +108,7 @@ with lib;
|
|||
|
||||
programs.eza.icons = ${if cfg.icons then ''"auto"'' else "null"}'';
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||
|
||||
programs.bash.shellAliases = optionsAlias
|
||||
// optionalAttrs cfg.enableBashIntegration aliases;
|
||||
|
|
|
@ -13,7 +13,7 @@ in {
|
|||
options.programs.fastfetch = {
|
||||
enable = mkEnableOption "Fastfetch";
|
||||
|
||||
package = mkPackageOption pkgs "fastfetch" { };
|
||||
package = mkPackageOption pkgs "fastfetch" { nullable = true; };
|
||||
|
||||
settings = mkOption {
|
||||
type = jsonFormat.type;
|
||||
|
@ -59,7 +59,7 @@ in {
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||
|
||||
xdg.configFile."fastfetch/config.jsonc" = mkIf (cfg.settings != { }) {
|
||||
source = jsonFormat.generate "config.jsonc" cfg.settings;
|
||||
|
|
|
@ -30,7 +30,7 @@ with lib; {
|
|||
'';
|
||||
};
|
||||
|
||||
package = mkPackageOption pkgs "fd" { };
|
||||
package = mkPackageOption pkgs "fd" { nullable = true; };
|
||||
};
|
||||
|
||||
config = let
|
||||
|
@ -40,7 +40,7 @@ with lib; {
|
|||
|
||||
optionsAlias = optionalAttrs (args != "") { fd = "fd ${args}"; };
|
||||
in mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||
|
||||
programs.bash.shellAliases = optionsAlias;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ in {
|
|||
options.programs.feh = {
|
||||
enable = mkEnableOption "feh - a fast and light image viewer";
|
||||
|
||||
package = mkPackageOption pkgs "feh" { };
|
||||
package = mkPackageOption pkgs "feh" { nullable = true; };
|
||||
|
||||
buttons = mkOption {
|
||||
default = { };
|
||||
|
@ -104,7 +104,7 @@ in {
|
|||
"To disable a keybinding, use `null` instead of an empty string.";
|
||||
}];
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||
|
||||
xdg.configFile."feh/buttons" =
|
||||
mkIf (cfg.buttons != { }) { text = renderBindings cfg.buttons + "\n"; };
|
||||
|
|
|
@ -18,12 +18,8 @@ in {
|
|||
unwrappedPackageName = "firefox-unwrapped";
|
||||
visible = true;
|
||||
|
||||
platforms.linux = rec {
|
||||
vendorPath = ".mozilla";
|
||||
configPath = "${vendorPath}/firefox";
|
||||
};
|
||||
platforms.linux = rec { configPath = ".mozilla/firefox"; };
|
||||
platforms.darwin = {
|
||||
vendorPath = "Library/Application Support/Mozilla";
|
||||
configPath = "Library/Application Support/Firefox";
|
||||
};
|
||||
})
|
||||
|
|
|
@ -30,23 +30,6 @@ let
|
|||
profilesPath =
|
||||
if isDarwin then "${cfg.configPath}/Profiles" else cfg.configPath;
|
||||
|
||||
nativeMessagingHostsPath = if isDarwin then
|
||||
"${cfg.vendorPath}/NativeMessagingHosts"
|
||||
else
|
||||
"${cfg.vendorPath}/native-messaging-hosts";
|
||||
|
||||
nativeMessagingHostsJoined = pkgs.symlinkJoin {
|
||||
name = "ff_native-messaging-hosts";
|
||||
paths = [
|
||||
# Link a .keep file to keep the directory around
|
||||
(pkgs.writeTextDir "lib/mozilla/native-messaging-hosts/.keep" "")
|
||||
# Link package configured native messaging hosts (entire browser actually)
|
||||
cfg.finalPackage
|
||||
]
|
||||
# Link user configured native messaging hosts
|
||||
++ cfg.nativeMessagingHosts;
|
||||
};
|
||||
|
||||
# The extensions path shared by all profiles; will not be supported
|
||||
# by future browser versions.
|
||||
extensionPath = "extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
|
||||
|
@ -73,10 +56,10 @@ let
|
|||
else
|
||||
builtins.toJSON pref);
|
||||
|
||||
mkUserJs = prePrefs: prefs: extraPrefs: bookmarks: extensions:
|
||||
mkUserJs = prePrefs: prefs: extraPrefs: bookmarksFile: extensions:
|
||||
let
|
||||
prefs' = lib.optionalAttrs ([ ] != bookmarks) {
|
||||
"browser.bookmarks.file" = toString (browserBookmarksFile bookmarks);
|
||||
prefs' = lib.optionalAttrs (bookmarksFile != null) {
|
||||
"browser.bookmarks.file" = toString bookmarksFile;
|
||||
"browser.places.importBookmarksHTML" = true;
|
||||
} // lib.optionalAttrs (extensions != { }) {
|
||||
"extensions.webextensions.ExtensionStorageIDB.enabled" = false;
|
||||
|
@ -129,59 +112,6 @@ let
|
|||
}}
|
||||
'';
|
||||
|
||||
browserBookmarksFile = bookmarks:
|
||||
let
|
||||
indent = level:
|
||||
lib.concatStringsSep "" (map (lib.const " ") (lib.range 1 level));
|
||||
|
||||
bookmarkToHTML = indentLevel: bookmark:
|
||||
''
|
||||
${indent indentLevel}<DT><A HREF="${
|
||||
escapeXML bookmark.url
|
||||
}" ADD_DATE="1" LAST_MODIFIED="1"${
|
||||
lib.optionalString (bookmark.keyword != null)
|
||||
" SHORTCUTURL=\"${escapeXML bookmark.keyword}\""
|
||||
}${
|
||||
lib.optionalString (bookmark.tags != [ ])
|
||||
" TAGS=\"${escapeXML (concatStringsSep "," bookmark.tags)}\""
|
||||
}>${escapeXML bookmark.name}</A>'';
|
||||
|
||||
directoryToHTML = indentLevel: directory: ''
|
||||
${indent indentLevel}<DT>${
|
||||
if directory.toolbar then
|
||||
''
|
||||
<H3 ADD_DATE="1" LAST_MODIFIED="1" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks Toolbar''
|
||||
else
|
||||
''<H3 ADD_DATE="1" LAST_MODIFIED="1">${escapeXML directory.name}''
|
||||
}</H3>
|
||||
${indent indentLevel}<DL><p>
|
||||
${allItemsToHTML (indentLevel + 1) directory.bookmarks}
|
||||
${indent indentLevel}</DL><p>'';
|
||||
|
||||
itemToHTMLOrRecurse = indentLevel: item:
|
||||
if item ? "url" then
|
||||
bookmarkToHTML indentLevel item
|
||||
else
|
||||
directoryToHTML indentLevel item;
|
||||
|
||||
allItemsToHTML = indentLevel: bookmarks:
|
||||
lib.concatStringsSep "\n"
|
||||
(map (itemToHTMLOrRecurse indentLevel) bookmarks);
|
||||
|
||||
bookmarkEntries = allItemsToHTML 1 bookmarks;
|
||||
in pkgs.writeText "${packageName}-bookmarks.html" ''
|
||||
<!DOCTYPE NETSCAPE-Bookmark-file-1>
|
||||
<!-- This is an automatically generated file.
|
||||
It will be read and overwritten.
|
||||
DO NOT EDIT! -->
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
|
||||
<TITLE>Bookmarks</TITLE>
|
||||
<H1>Bookmarks Menu</H1>
|
||||
<DL><p>
|
||||
${bookmarkEntries}
|
||||
</DL>
|
||||
'';
|
||||
|
||||
mkNoDuplicateAssertion = entities: entityKind:
|
||||
(let
|
||||
# Return an attribute set with entity IDs as keys and a list of
|
||||
|
@ -224,9 +154,12 @@ let
|
|||
package.override (old: {
|
||||
cfg = old.cfg or { } // fcfg;
|
||||
extraPolicies = (old.extraPolicies or { }) // cfg.policies;
|
||||
pkcs11Modules = (old.pkcs11Modules or [ ]) ++ cfg.pkcs11Modules;
|
||||
})
|
||||
else
|
||||
(pkgs.wrapFirefox.override { config = bcfg; }) package { };
|
||||
|
||||
bookmarkTypes = import ./profiles/bookmark-types.nix { inherit lib; };
|
||||
in {
|
||||
options = setAttrByPath modulePath {
|
||||
enable = mkOption {
|
||||
|
@ -296,11 +229,7 @@ in {
|
|||
vendorPath = mkOption {
|
||||
internal = true;
|
||||
type = with types; nullOr str;
|
||||
default = with platforms;
|
||||
if isDarwin then
|
||||
darwin.vendorPath or null
|
||||
else
|
||||
linux.vendorPath or null;
|
||||
default = null;
|
||||
example = ".mozilla";
|
||||
description =
|
||||
"Directory containing the native messaging hosts directory.";
|
||||
|
@ -315,7 +244,7 @@ in {
|
|||
description = "Directory containing the ${appName} configuration files.";
|
||||
};
|
||||
|
||||
nativeMessagingHosts = optionalAttrs (cfg.vendorPath != null) (mkOption {
|
||||
nativeMessagingHosts = mkOption {
|
||||
inherit visible;
|
||||
type = types.listOf types.package;
|
||||
default = [ ];
|
||||
|
@ -323,7 +252,7 @@ in {
|
|||
Additional packages containing native messaging hosts that should be
|
||||
made available to ${appName} extensions.
|
||||
'';
|
||||
});
|
||||
};
|
||||
|
||||
finalPackage = mkOption {
|
||||
inherit visible;
|
||||
|
@ -354,6 +283,8 @@ in {
|
|||
profiles = mkOption {
|
||||
inherit visible;
|
||||
type = types.attrsOf (types.submodule ({ config, name, ... }: {
|
||||
imports = [ (pkgs.path + "/nixos/modules/misc/assertions.nix") ];
|
||||
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
|
@ -421,7 +352,7 @@ in {
|
|||
};
|
||||
|
||||
userChrome = mkOption {
|
||||
type = types.lines;
|
||||
type = types.oneOf [ types.lines types.path ];
|
||||
default = "";
|
||||
description = "Custom ${appName} user chrome CSS.";
|
||||
example = ''
|
||||
|
@ -440,7 +371,7 @@ in {
|
|||
};
|
||||
|
||||
userContent = mkOption {
|
||||
type = types.lines;
|
||||
type = types.oneOf [ types.lines types.path ];
|
||||
default = "";
|
||||
description = "Custom ${appName} user content CSS.";
|
||||
example = ''
|
||||
|
@ -450,104 +381,36 @@ in {
|
|||
};
|
||||
|
||||
bookmarks = mkOption {
|
||||
type = (with types;
|
||||
coercedTo bookmarkTypes.settingsType (bookmarks:
|
||||
if bookmarks != { } then
|
||||
warn ''
|
||||
${cfg.name} bookmarks have been refactored into a submodule that now explicitly require a 'force' option to be enabled.
|
||||
|
||||
Replace:
|
||||
|
||||
${moduleName}.profiles.${name}.bookmarks = [ ... ];
|
||||
|
||||
With:
|
||||
|
||||
${moduleName}.profiles.${name}.bookmarks = {
|
||||
force = true;
|
||||
settings = [ ... ];
|
||||
};
|
||||
'' {
|
||||
force = true;
|
||||
settings = bookmarks;
|
||||
}
|
||||
else
|
||||
{ }) (submodule ({ config, ... }:
|
||||
import ./profiles/bookmarks.nix {
|
||||
inherit config lib pkgs;
|
||||
modulePath = modulePath
|
||||
++ [ "profiles" name "bookmarks" ];
|
||||
})));
|
||||
default = { };
|
||||
internal = !enableBookmarks;
|
||||
type = let
|
||||
bookmarkSubmodule = types.submodule ({ config, name, ... }: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = name;
|
||||
description = "Bookmark name.";
|
||||
};
|
||||
|
||||
tags = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = "Bookmark tags.";
|
||||
};
|
||||
|
||||
keyword = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Bookmark search keyword.";
|
||||
};
|
||||
|
||||
url = mkOption {
|
||||
type = types.str;
|
||||
description = "Bookmark url, use %s for search terms.";
|
||||
};
|
||||
};
|
||||
}) // {
|
||||
description = "bookmark submodule";
|
||||
};
|
||||
|
||||
bookmarkType = types.addCheck bookmarkSubmodule (x: x ? "url");
|
||||
|
||||
directoryType = types.submodule ({ config, name, ... }: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = name;
|
||||
description = "Directory name.";
|
||||
};
|
||||
|
||||
bookmarks = mkOption {
|
||||
type = types.listOf nodeType;
|
||||
default = [ ];
|
||||
description = "Bookmarks within directory.";
|
||||
};
|
||||
|
||||
toolbar = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Make this the toolbar directory. Note, this does _not_
|
||||
mean that this directory will be added to the toolbar,
|
||||
this directory _is_ the toolbar.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}) // {
|
||||
description = "directory submodule";
|
||||
};
|
||||
|
||||
nodeType = types.either bookmarkType directoryType;
|
||||
in with types;
|
||||
coercedTo (attrsOf nodeType) attrValues (listOf nodeType);
|
||||
default = [ ];
|
||||
example = literalExpression ''
|
||||
[
|
||||
{
|
||||
name = "wikipedia";
|
||||
tags = [ "wiki" ];
|
||||
keyword = "wiki";
|
||||
url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
|
||||
}
|
||||
{
|
||||
name = "kernel.org";
|
||||
url = "https://www.kernel.org";
|
||||
}
|
||||
{
|
||||
name = "Nix sites";
|
||||
toolbar = true;
|
||||
bookmarks = [
|
||||
{
|
||||
name = "homepage";
|
||||
url = "https://nixos.org/";
|
||||
}
|
||||
{
|
||||
name = "wiki";
|
||||
tags = [ "wiki" "nix" ];
|
||||
url = "https://wiki.nixos.org/";
|
||||
}
|
||||
];
|
||||
}
|
||||
]
|
||||
'';
|
||||
description = ''
|
||||
Preloaded bookmarks. Note, this may silently overwrite any
|
||||
previously existing bookmarks!
|
||||
'';
|
||||
description = "Declarative bookmarks.";
|
||||
};
|
||||
|
||||
path = mkOption {
|
||||
|
@ -783,6 +646,26 @@ in {
|
|||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
assertions = [
|
||||
(mkNoDuplicateAssertion config.containers "container")
|
||||
{
|
||||
assertion = config.extensions.settings == { }
|
||||
|| config.extensions.force;
|
||||
message = ''
|
||||
Using '${
|
||||
lib.showAttrPath (modulePath
|
||||
++ [ "profiles" config.name "extensions" "settings" ])
|
||||
}' will override all previous extensions settings.
|
||||
Enable '${
|
||||
lib.showAttrPath (modulePath
|
||||
++ [ "profiles" config.name "extensions" "force" ])
|
||||
}' to acknowledge this.
|
||||
'';
|
||||
}
|
||||
] ++ config.bookmarks.assertions;
|
||||
};
|
||||
}));
|
||||
default = { };
|
||||
description = "Attribute set of ${appName} profiles.";
|
||||
|
@ -799,6 +682,14 @@ in {
|
|||
`true`.
|
||||
'';
|
||||
};
|
||||
|
||||
pkcs11Modules = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Additional packages to be loaded as PKCS #11 modules in Firefox.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable ({
|
||||
|
@ -838,58 +729,52 @@ in {
|
|||
}
|
||||
|
||||
(mkNoDuplicateAssertion cfg.profiles "profile")
|
||||
] ++ (mapAttrsToList
|
||||
(_: profile: mkNoDuplicateAssertion profile.containers "container")
|
||||
cfg.profiles) ++ (mapAttrsToList (profileName: profile: {
|
||||
assertion = profile.extensions.settings == { }
|
||||
|| profile.extensions.force;
|
||||
message = ''
|
||||
Using '${
|
||||
lib.showAttrPath
|
||||
(modulePath ++ [ "profiles" profileName "extensions" "settings" ])
|
||||
}' will override all previous extensions settings.
|
||||
Enable '${
|
||||
lib.showAttrPath
|
||||
(modulePath ++ [ "profiles" profileName "extensions" "force" ])
|
||||
}' to acknowledge this.
|
||||
'';
|
||||
}) cfg.profiles);
|
||||
] ++ (concatMap (profile: profile.assertions) (attrValues cfg.profiles));
|
||||
|
||||
warnings = optional (cfg.enableGnomeExtensions or false) ''
|
||||
Using '${moduleName}.enableGnomeExtensions' has been deprecated and
|
||||
will be removed in the future. Please change to overriding the package
|
||||
configuration using '${moduleName}.package' instead. You can refer to
|
||||
its example for how to do this.
|
||||
'' ++ optional (cfg.vendorPath != null) ''
|
||||
Using '${moduleName}.vendorPath' has been deprecated and
|
||||
will be removed in the future. Native messaging hosts will function normally without specifying this path.
|
||||
'';
|
||||
|
||||
home.packages = lib.optional (cfg.finalPackage != null) cfg.finalPackage;
|
||||
|
||||
mozilla.firefoxNativeMessagingHosts = cfg.nativeMessagingHosts
|
||||
# package configured native messaging hosts (entire browser actually)
|
||||
++ (lib.optional (cfg.finalPackage != null) cfg.finalPackage);
|
||||
|
||||
home.file = mkMerge ([{
|
||||
"${cfg.configPath}/profiles.ini" =
|
||||
mkIf (cfg.profiles != { }) { text = profilesIni; };
|
||||
}] ++ optional (cfg.vendorPath != null) {
|
||||
"${nativeMessagingHostsPath}" = {
|
||||
source =
|
||||
"${nativeMessagingHostsJoined}/lib/mozilla/native-messaging-hosts";
|
||||
recursive = true;
|
||||
};
|
||||
} ++ flip mapAttrsToList cfg.profiles (_: profile:
|
||||
}] ++ flip mapAttrsToList cfg.profiles (_: profile:
|
||||
# Merge the regular profile settings with extension settings
|
||||
mkMerge ([{
|
||||
"${profilesPath}/${profile.path}/.keep".text = "";
|
||||
|
||||
"${profilesPath}/${profile.path}/chrome/userChrome.css" =
|
||||
mkIf (profile.userChrome != "") { text = profile.userChrome; };
|
||||
mkIf (profile.userChrome != "") (let
|
||||
key =
|
||||
if builtins.isString profile.userChrome then "text" else "source";
|
||||
in { "${key}" = profile.userChrome; });
|
||||
|
||||
"${profilesPath}/${profile.path}/chrome/userContent.css" =
|
||||
mkIf (profile.userContent != "") { text = profile.userContent; };
|
||||
mkIf (profile.userContent != "") (let
|
||||
key = if builtins.isString profile.userContent then
|
||||
"text"
|
||||
else
|
||||
"source";
|
||||
in { "${key}" = profile.userContent; });
|
||||
|
||||
"${profilesPath}/${profile.path}/user.js" = mkIf (profile.preConfig
|
||||
!= "" || profile.settings != { } || profile.extraConfig != ""
|
||||
|| profile.bookmarks != [ ]) {
|
||||
|| profile.bookmarks.configFile != null) {
|
||||
text =
|
||||
mkUserJs profile.preConfig profile.settings profile.extraConfig
|
||||
profile.bookmarks profile.extensions.settings;
|
||||
profile.bookmarks.configFile profile.extensions.settings;
|
||||
};
|
||||
|
||||
"${profilesPath}/${profile.path}/containers.json" =
|
||||
|
@ -922,7 +807,7 @@ in {
|
|||
(name: settingConfig: {
|
||||
"${profilesPath}/${profile.path}/browser-extension-data/${name}/storage.js" =
|
||||
{
|
||||
force = settingConfig.force;
|
||||
force = settingConfig.force || profile.extensions.force;
|
||||
text = generators.toJSON { } settingConfig.settings;
|
||||
};
|
||||
}) profile.extensions.settings)))));
|
||||
|
|
75
modules/programs/firefox/profiles/bookmark-types.nix
Normal file
75
modules/programs/firefox/profiles/bookmark-types.nix
Normal file
|
@ -0,0 +1,75 @@
|
|||
{ lib, ... }:
|
||||
|
||||
let
|
||||
|
||||
inherit (builtins) attrValues;
|
||||
inherit (lib) types mkOption;
|
||||
|
||||
in rec {
|
||||
settingsType = with types;
|
||||
coercedTo (addCheck (attrsOf nodeType)
|
||||
# Check whether attribute set is of correct type
|
||||
(attrs: !(attrs ? settings) || nodeType.check attrs.settings)) attrValues
|
||||
(listOf nodeType);
|
||||
|
||||
bookmarkSubmodule = types.submodule ({ name, ... }: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = name;
|
||||
description = "Bookmark name.";
|
||||
};
|
||||
|
||||
tags = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = "Bookmark tags.";
|
||||
};
|
||||
|
||||
keyword = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Bookmark search keyword.";
|
||||
};
|
||||
|
||||
url = mkOption {
|
||||
type = types.str;
|
||||
description = "Bookmark url, use %s for search terms.";
|
||||
};
|
||||
};
|
||||
}) // {
|
||||
description = "bookmark submodule";
|
||||
};
|
||||
|
||||
bookmarkType = types.addCheck bookmarkSubmodule (x: x ? "url");
|
||||
|
||||
directoryType = types.submodule ({ name, ... }: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = name;
|
||||
description = "Directory name.";
|
||||
};
|
||||
|
||||
bookmarks = mkOption {
|
||||
type = types.listOf nodeType;
|
||||
default = [ ];
|
||||
description = "Bookmarks within directory.";
|
||||
};
|
||||
|
||||
toolbar = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Make this the toolbar directory. Note, this does _not_
|
||||
mean that this directory will be added to the toolbar,
|
||||
this directory _is_ the toolbar.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}) // {
|
||||
description = "directory submodule";
|
||||
};
|
||||
|
||||
nodeType = types.either bookmarkType directoryType;
|
||||
}
|
146
modules/programs/firefox/profiles/bookmarks.nix
Normal file
146
modules/programs/firefox/profiles/bookmarks.nix
Normal file
|
@ -0,0 +1,146 @@
|
|||
{ config, lib, pkgs, modulePath }:
|
||||
|
||||
let
|
||||
inherit (lib)
|
||||
escapeXML concatStringsSep mkOption maintainers types literalExpression;
|
||||
|
||||
inherit (bookmarkTypes) settingsType;
|
||||
|
||||
bookmarkTypes = import ./bookmark-types.nix { inherit lib; };
|
||||
|
||||
bookmarksFile = bookmarks:
|
||||
let
|
||||
indent = level:
|
||||
lib.concatStringsSep "" (map (lib.const " ") (lib.range 1 level));
|
||||
|
||||
bookmarkToHTML = indentLevel: bookmark:
|
||||
''
|
||||
${indent indentLevel}<DT><A HREF="${
|
||||
escapeXML bookmark.url
|
||||
}" ADD_DATE="1" LAST_MODIFIED="1"${
|
||||
lib.optionalString (bookmark.keyword != null)
|
||||
" SHORTCUTURL=\"${escapeXML bookmark.keyword}\""
|
||||
}${
|
||||
lib.optionalString (bookmark.tags != [ ])
|
||||
" TAGS=\"${escapeXML (concatStringsSep "," bookmark.tags)}\""
|
||||
}>${escapeXML bookmark.name}</A>'';
|
||||
|
||||
directoryToHTML = indentLevel: directory: ''
|
||||
${indent indentLevel}<DT>${
|
||||
if directory.toolbar then
|
||||
''
|
||||
<H3 ADD_DATE="1" LAST_MODIFIED="1" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks Toolbar''
|
||||
else
|
||||
''<H3 ADD_DATE="1" LAST_MODIFIED="1">${escapeXML directory.name}''
|
||||
}</H3>
|
||||
${indent indentLevel}<DL><p>
|
||||
${allItemsToHTML (indentLevel + 1) directory.bookmarks}
|
||||
${indent indentLevel}</DL><p>'';
|
||||
|
||||
itemToHTMLOrRecurse = indentLevel: item:
|
||||
if item ? "url" then
|
||||
bookmarkToHTML indentLevel item
|
||||
else
|
||||
directoryToHTML indentLevel item;
|
||||
|
||||
allItemsToHTML = indentLevel: bookmarks:
|
||||
lib.concatStringsSep "\n"
|
||||
(map (itemToHTMLOrRecurse indentLevel) bookmarks);
|
||||
|
||||
bookmarkEntries = allItemsToHTML 1 bookmarks;
|
||||
in pkgs.writeText "bookmarks.html" ''
|
||||
<!DOCTYPE NETSCAPE-Bookmark-file-1>
|
||||
<!-- This is an automatically generated file.
|
||||
It will be read and overwritten.
|
||||
DO NOT EDIT! -->
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
|
||||
<TITLE>Bookmarks</TITLE>
|
||||
<H1>Bookmarks Menu</H1>
|
||||
<DL><p>
|
||||
${bookmarkEntries}
|
||||
</DL>
|
||||
'';
|
||||
in {
|
||||
imports = [
|
||||
(pkgs.path + "/nixos/modules/misc/assertions.nix")
|
||||
(pkgs.path + "/nixos/modules/misc/meta.nix")
|
||||
];
|
||||
|
||||
# We're currently looking for a maintainer who actively uses bookmarks!
|
||||
meta.maintainers = with maintainers; [ kira-bruneau ];
|
||||
|
||||
options = {
|
||||
enable = mkOption {
|
||||
type = with types; bool;
|
||||
default = config.settings != [ ];
|
||||
internal = true;
|
||||
};
|
||||
|
||||
force = mkOption {
|
||||
type = with types; bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to force override existing custom bookmarks.
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = settingsType;
|
||||
default = [ ];
|
||||
example = literalExpression ''
|
||||
[
|
||||
{
|
||||
name = "wikipedia";
|
||||
tags = [ "wiki" ];
|
||||
keyword = "wiki";
|
||||
url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
|
||||
}
|
||||
{
|
||||
name = "kernel.org";
|
||||
url = "https://www.kernel.org";
|
||||
}
|
||||
{
|
||||
name = "Nix sites";
|
||||
toolbar = true;
|
||||
bookmarks = [
|
||||
{
|
||||
name = "homepage";
|
||||
url = "https://nixos.org/";
|
||||
}
|
||||
{
|
||||
name = "wiki";
|
||||
tags = [ "wiki" "nix" ];
|
||||
url = "https://wiki.nixos.org/";
|
||||
}
|
||||
];
|
||||
}
|
||||
]
|
||||
'';
|
||||
description = ''
|
||||
Custom bookmarks.
|
||||
'';
|
||||
};
|
||||
|
||||
configFile = mkOption {
|
||||
type = with types; nullOr path;
|
||||
default = if config.enable then bookmarksFile config.settings else null;
|
||||
description = ''
|
||||
Configuration file to define custom bookmarks.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
assertions = [{
|
||||
assertion = config.enable -> config.force;
|
||||
message = ''
|
||||
Using '${
|
||||
lib.showAttrPath (modulePath ++ [ "settings" ])
|
||||
}' will override all previous bookmarks.
|
||||
Enable ${
|
||||
lib.showAttrPath (modulePath ++ [ "force" ])
|
||||
}' to acknowledge this.
|
||||
'';
|
||||
}];
|
||||
};
|
||||
}
|
|
@ -12,11 +12,8 @@ let
|
|||
"name"
|
||||
"isAppProvided"
|
||||
"loadPath"
|
||||
"hasPreferredIcon"
|
||||
"updateInterval"
|
||||
"updateURL"
|
||||
"iconUpdateURL"
|
||||
"iconURL"
|
||||
"iconMapObj"
|
||||
"metaData"
|
||||
"orderHint"
|
||||
|
@ -26,36 +23,44 @@ let
|
|||
searchForm = "__searchForm";
|
||||
};
|
||||
|
||||
# Convenience to specify absolute path to icon
|
||||
iconUrl = icon:
|
||||
if isPath icon || hasPrefix "/" icon then "file://${icon}" else icon;
|
||||
|
||||
processCustomEngineInput = input:
|
||||
(removeAttrs input [ "icon" ]) // optionalAttrs (input ? icon) {
|
||||
# Convenience to specify absolute path to icon
|
||||
iconURL = "file://${input.icon}";
|
||||
} // (optionalAttrs (input ? iconUpdateURL) {
|
||||
# Convenience to default iconURL to iconUpdateURL so
|
||||
# the icon is immediately downloaded from the URL
|
||||
iconURL = input.iconURL or input.iconUpdateURL;
|
||||
{
|
||||
name = input.id;
|
||||
} // (removeAttrs input [ "icon" ])
|
||||
// optionalAttrs (input ? icon || input ? iconMapObj) {
|
||||
iconMapObj = mapAttrs (name: iconUrl) ((optionalAttrs (input ? icon) {
|
||||
# Convenience to specify single icon instead of map
|
||||
"16" = input.icon;
|
||||
}) // (input.iconMapObj or { }));
|
||||
} // {
|
||||
# Required for custom engine configurations, loadPaths
|
||||
# are unique identifiers that are generally formatted
|
||||
# like: [source]/path/to/engine.xml
|
||||
loadPath = "[home-manager]/${
|
||||
concatStringsSep "." (map strings.escapeNixIdentifier
|
||||
(modulePath ++ [ "engines" input.name ]))
|
||||
lib.showAttrPath (modulePath ++ [ "engines" input.id ])
|
||||
}";
|
||||
});
|
||||
};
|
||||
|
||||
processEngineInput = name: input:
|
||||
processEngineInput = id: input:
|
||||
let
|
||||
requiredInput = {
|
||||
inherit name;
|
||||
isAppProvided = input.isAppProvided or removeAttrs input [ "metaData" ]
|
||||
== { };
|
||||
inherit id;
|
||||
isAppProvided =
|
||||
input.isAppProvided or (removeAttrs input [ "metaData" ] == { });
|
||||
metaData = input.metaData or { };
|
||||
};
|
||||
in if requiredInput.isAppProvided then
|
||||
requiredInput
|
||||
else
|
||||
processCustomEngineInput (input // requiredInput);
|
||||
pipe (input // requiredInput) [
|
||||
migrateEngineToV11
|
||||
migrateEngineToV12
|
||||
processCustomEngineInput
|
||||
];
|
||||
|
||||
buildEngineConfig = name: input:
|
||||
mapAttrs' (name: value: {
|
||||
|
@ -65,10 +70,10 @@ let
|
|||
|
||||
sortEngineConfigs = configs:
|
||||
let
|
||||
buildEngineConfigWithOrder = order: name:
|
||||
buildEngineConfigWithOrder = order: id:
|
||||
let
|
||||
config = configs.${name} or {
|
||||
_name = name;
|
||||
config = configs.${id} or {
|
||||
inherit id;
|
||||
_isAppProvided = true;
|
||||
_metaData = { };
|
||||
};
|
||||
|
@ -89,15 +94,15 @@ let
|
|||
};
|
||||
|
||||
settings = {
|
||||
version = 6;
|
||||
version = 12;
|
||||
engines = sortEngineConfigs (mapAttrs buildEngineConfig engineInput);
|
||||
|
||||
metaData = optionalAttrs (config.default != null) {
|
||||
current = config.default;
|
||||
hash = "@hash@";
|
||||
defaultEngineId = config.default;
|
||||
defaultEngineIdHash = "@hash@";
|
||||
} // optionalAttrs (config.privateDefault != null) {
|
||||
private = config.privateDefault;
|
||||
privateHash = "@privateHash@";
|
||||
privateDefaultEngineId = config.privateDefault;
|
||||
privateDefaultEngineIdHash = "@privateHash@";
|
||||
} // {
|
||||
useSavedOrder = config.order != [ ];
|
||||
};
|
||||
|
@ -155,6 +160,204 @@ let
|
|||
mozlz4a <(echo "$json") "$out"
|
||||
fi
|
||||
'';
|
||||
|
||||
engineNameToId = {
|
||||
# Derived from https://searchfox.org/mozilla-central/rev/e3f42ec9320748b2aab3d474d1e47075def9000c/services/settings/dumps/main/search-config-v2.json
|
||||
"1&1 Suche" = "1und1";
|
||||
"Allegro" = "allegro-pl";
|
||||
"Amazon.co.jp" = "amazon-jp";
|
||||
"Amazon.com" = "amazondotcom-us";
|
||||
"Azerdict" = "azerdict";
|
||||
"百度" = "baidu";
|
||||
"Bing" = "bing";
|
||||
"Ordbok" = "bok-NO";
|
||||
"Ceneje.si" = "ceneji";
|
||||
"Cốc Cốc" = "coccoc";
|
||||
"다음" = "daum-kr";
|
||||
"DuckDuckGo" = "ddg";
|
||||
"eBay" = "ebay";
|
||||
"Ecosia" = "ecosia";
|
||||
"EUdict Eng->Cro" = "eudict";
|
||||
"Am Faclair Beag" = "faclair-beag";
|
||||
"GMX Suche" = "gmx-de";
|
||||
"GMX Search" = "gmx-en-GB";
|
||||
"GMX - Búsqueda web" = "gmx-es";
|
||||
"GMX - Recherche web" = "gmx-fr";
|
||||
"GMX Shopping" = "gmx-shopping";
|
||||
"Google" = "google";
|
||||
"Gule sider" = "gulesider-NO";
|
||||
"LEO Eng-Deu" = "leo_ende_de";
|
||||
"พจนานุกรม ลองดู" = "longdo";
|
||||
"mail.com search" = "mailcom";
|
||||
"Mapy.cz" = "mapy-cz";
|
||||
"MercadoLibre Argentina" = "mercadolibre-ar";
|
||||
"MercadoLibre Chile" = "mercadolibre-cl";
|
||||
"MercadoLibre Mexico" = "mercadolibre-mx";
|
||||
"MercadoLivre" = "mercadolivre";
|
||||
"네이버" = "naver-kr";
|
||||
"Odpiralni Časi" = "odpiralni";
|
||||
"Pazaruvaj" = "pazaruvaj";
|
||||
"Priberam" = "priberam";
|
||||
"Prisjakt" = "prisjakt-sv-SE";
|
||||
"Qwant" = "qwant";
|
||||
"Qwant Junior" = "qwantjr";
|
||||
"楽天市場" = "rakuten";
|
||||
"Readmoo 讀墨電子書" = "readmoo";
|
||||
"Reddit" = "reddit";
|
||||
"Salidzini.lv" = "salidzinilv";
|
||||
"Seznam" = "seznam-cz";
|
||||
"Tyda.se" = "tyda-sv-SE";
|
||||
"Vatera.hu" = "vatera";
|
||||
"WEB.DE Suche" = "webde";
|
||||
"Wikipedia (en)" = "wikipedia";
|
||||
"Wikipedia (nn)" = "wikipedia-NN";
|
||||
"Wikipedia (nb)" = "wikipedia-NO";
|
||||
"Wikipedia (af)" = "wikipedia-af";
|
||||
"Biquipedia (an)" = "wikipedia-an";
|
||||
"ويكيبيديا (ar)" = "wikipedia-ar";
|
||||
"Wikipedia (ast)" = "wikipedia-ast";
|
||||
"Vikipediya (az)" = "wikipedia-az";
|
||||
"Вікіпедыя (be)" = "wikipedia-be";
|
||||
"Вікіпэдыя (be-tarask)" = "wikipedia-be-tarask";
|
||||
"Уикипедия (bg)" = "wikipedia-bg";
|
||||
"উইকিপিডিয়া (bn)" = "wikipedia-bn";
|
||||
"Wikipedia (br)" = "wikipedia-br";
|
||||
"Wikipedia (bs)" = "wikipedia-bs";
|
||||
"Viquipèdia (ca)" = "wikipedia-ca";
|
||||
"Wicipedia (cy)" = "wikipedia-cy";
|
||||
"Wikipedie (cs)" = "wikipedia-cz";
|
||||
"Wikipedia (da)" = "wikipedia-da";
|
||||
"Wikipedia (de)" = "wikipedia-de";
|
||||
"Wikipedija (dsb)" = "wikipedia-dsb";
|
||||
"Βικιπαίδεια (el)" = "wikipedia-el";
|
||||
"Vikipedio (eo)" = "wikipedia-eo";
|
||||
"Wikipedia (es)" = "wikipedia-es";
|
||||
"Vikipeedia (et)" = "wikipedia-et";
|
||||
"Wikipedia (eu)" = "wikipedia-eu";
|
||||
"ویکیپدیا (fa)" = "wikipedia-fa";
|
||||
"Wikipedia (fi)" = "wikipedia-fi";
|
||||
"Wikipédia (fr)" = "wikipedia-fr";
|
||||
"Wikipedy (fy)" = "wikipedia-fy-NL";
|
||||
"Vicipéid (ga)" = "wikipedia-ga-IE";
|
||||
"Uicipeid (gd)" = "wikipedia-gd";
|
||||
"Wikipedia (gl)" = "wikipedia-gl";
|
||||
"Vikipetã (gn)" = "wikipedia-gn";
|
||||
"વિકિપીડિયા (gu)" = "wikipedia-gu";
|
||||
"ויקיפדיה" = "wikipedia-he";
|
||||
"विकिपीडिया (hi)" = "wikipedia-hi";
|
||||
"Wikipedija (hr)" = "wikipedia-hr";
|
||||
"Wikipedija (hsb)" = "wikipedia-hsb";
|
||||
"Wikipédia (hu)" = "wikipedia-hu";
|
||||
"Վիքիպեդիա (hy)" = "wikipedia-hy";
|
||||
"Wikipedia (ia)" = "wikipedia-ia";
|
||||
"Wikipedia (id)" = "wikipedia-id";
|
||||
"Wikipedia (is)" = "wikipedia-is";
|
||||
"Wikipedia (it)" = "wikipedia-it";
|
||||
"Wikipedia (ja)" = "wikipedia-ja";
|
||||
"ვიკიპედია (ka)" = "wikipedia-ka";
|
||||
"Wikipedia (kab)" = "wikipedia-kab";
|
||||
"Уикипедия (kk)" = "wikipedia-kk";
|
||||
"វិគីភីឌា (km)" = "wikipedia-km";
|
||||
"ವಿಕಿಪೀಡಿಯ (kn)" = "wikipedia-kn";
|
||||
"위키백과 (ko)" = "wikipedia-kr";
|
||||
"Wikipedia (lij)" = "wikipedia-lij";
|
||||
"ວິກິພີເດຍ (lo)" = "wikipedia-lo";
|
||||
"Vikipedija (lt)" = "wikipedia-lt";
|
||||
"Vikipedeja (ltg)" = "wikipedia-ltg";
|
||||
"Vikipēdija (lv)" = "wikipedia-lv";
|
||||
"Википедија (mk)" = "wikipedia-mk";
|
||||
"विकिपीडिया (mr)" = "wikipedia-mr";
|
||||
"Wikipedia (ms)" = "wikipedia-ms";
|
||||
"ဝီကီပီးဒီးယား (my)" = "wikipedia-my";
|
||||
"विकिपिडिया (ne)" = "wikipedia-ne";
|
||||
"Wikipedia (nl)" = "wikipedia-nl";
|
||||
"Wikipèdia (oc)" = "wikipedia-oc";
|
||||
"ਵਿਕੀਪੀਡੀਆ (pa)" = "wikipedia-pa";
|
||||
"Wikipedia (pl)" = "wikipedia-pl";
|
||||
"Wikipédia (pt)" = "wikipedia-pt";
|
||||
"Wikipedia (rm)" = "wikipedia-rm";
|
||||
"Wikipedia (ro)" = "wikipedia-ro";
|
||||
"Википедия (ru)" = "wikipedia-ru";
|
||||
"විකිපීඩියා (si)" = "wikipedia-si";
|
||||
"Wikipédia (sk)" = "wikipedia-sk";
|
||||
"Wikipedija (sl)" = "wikipedia-sl";
|
||||
"Wikipedia (sq)" = "wikipedia-sq";
|
||||
"Википедија (sr)" = "wikipedia-sr";
|
||||
"Wikipedia (sv)" = "wikipedia-sv-SE";
|
||||
"விக்கிப்பீடியா (ta)" = "wikipedia-ta";
|
||||
"వికీపీడియా (te)" = "wikipedia-te";
|
||||
"วิกิพีเดีย" = "wikipedia-th";
|
||||
"Wikipedia (tl)" = "wikipedia-tl";
|
||||
"Vikipedi (tr)" = "wikipedia-tr";
|
||||
"Вікіпедія (uk)" = "wikipedia-uk";
|
||||
"ویکیپیڈیا (ur)" = "wikipedia-ur";
|
||||
"Vikipediya (uz)" = "wikipedia-uz";
|
||||
"Wikipedia (vi)" = "wikipedia-vi";
|
||||
"Wikipedia (wo)" = "wikipedia-wo";
|
||||
"维基百科" = "wikipedia-zh-CN";
|
||||
"Wikipedia (zh)" = "wikipedia-zh-TW";
|
||||
"ವಿಕ್ಷನರಿ (kn)" = "wiktionary-kn";
|
||||
"Wikiccionari (oc)" = "wiktionary-oc";
|
||||
"விக்சனரி (ta)" = "wiktionary-ta";
|
||||
"విక్షనరీ (te)" = "wiktionary-te";
|
||||
"Wolne Lektury" = "wolnelektury-pl";
|
||||
"Yahoo! JAPAN" = "yahoo-jp";
|
||||
"Yahoo!オークション" = "yahoo-jp-auctions";
|
||||
"YouTube" = "youtube";
|
||||
|
||||
# Derived from https://searchfox.org/mozilla-central/rev/e3f42ec9320748b2aab3d474d1e47075def9000c/toolkit/components/search/SearchSettings.sys.mjs#32-44
|
||||
"Wikipedia (hy)" = "wikipedia-hy";
|
||||
"Wikipedia (kn)" = "wikipedia-kn";
|
||||
"Vikipēdija" = "wikipedia-lv";
|
||||
"Wikipedia (no)" = "wikipedia-NO";
|
||||
"Wikipedia (el)" = "wikipedia-el";
|
||||
"Wikipedia (lt)" = "wikipedia-lt";
|
||||
"Wikipedia (my)" = "wikipedia-my";
|
||||
"Wikipedia (pa)" = "wikipedia-pa";
|
||||
"Wikipedia (pt)" = "wikipedia-pt";
|
||||
"Wikipedia (si)" = "wikipedia-si";
|
||||
"Wikipedia (tr)" = "wikipedia-tr";
|
||||
};
|
||||
|
||||
migrateEngineNameToIdV7 = engine:
|
||||
if builtins.hasAttr engine engineNameToId then
|
||||
warn "Search engines are now referenced by id instead of by name, use '${
|
||||
engineNameToId.${engine}
|
||||
}' instead of '${engine}'" engineNameToId.${engine}
|
||||
else
|
||||
engine;
|
||||
|
||||
migrateEngineToV11 = engine:
|
||||
engine // lib.optionalAttrs (engine ? iconMapObj) {
|
||||
iconMapObj = mapAttrs' (name: value:
|
||||
let nameToIntResult = builtins.tryEval (toInt name);
|
||||
in {
|
||||
name = if nameToIntResult.success then
|
||||
name
|
||||
else
|
||||
let size = toString (builtins.fromJSON name).width;
|
||||
in warn
|
||||
"JSON object names for 'iconMapObj' are deprecated, use '${size}' instead of '${name}'"
|
||||
size;
|
||||
|
||||
inherit value;
|
||||
}) engine.iconMapObj;
|
||||
};
|
||||
|
||||
migrateEngineToV12 = engine:
|
||||
let
|
||||
iconMapObj = optionalAttrs (engine ? iconURL) {
|
||||
"16" = warn "'iconURL' is deprecated, use 'icon = ${
|
||||
strings.escapeNixString engine.iconURL
|
||||
}' instead" engine.iconURL;
|
||||
} // optionalAttrs (engine ? iconUpdateURL) {
|
||||
"16" = warn "'iconUpdateURL' is deprecated, use 'icon = ${
|
||||
strings.escapeNixString engine.iconUpdateURL
|
||||
}' instead" engine.iconUpdateURL;
|
||||
} // (engine.iconMapObj or { });
|
||||
in throwIf (engine ? hasPreferredIcon) "hasPreferredIcon has been removed"
|
||||
(removeAttrs engine [ "iconURL" "iconUpdateURL" ])
|
||||
// lib.optionalAttrs (iconMapObj != { }) { inherit iconMapObj; };
|
||||
in {
|
||||
imports = [ (pkgs.path + "/nixos/modules/misc/meta.nix") ];
|
||||
|
||||
|
@ -182,8 +385,10 @@ in {
|
|||
|
||||
default = mkOption {
|
||||
type = with types; nullOr str;
|
||||
apply = engine:
|
||||
if engine != null then migrateEngineNameToIdV7 engine else null;
|
||||
default = null;
|
||||
example = "DuckDuckGo";
|
||||
example = "ddg";
|
||||
description = ''
|
||||
The default search engine used in the address bar and search
|
||||
bar.
|
||||
|
@ -192,8 +397,10 @@ in {
|
|||
|
||||
privateDefault = mkOption {
|
||||
type = with types; nullOr str;
|
||||
apply = engine:
|
||||
if engine != null then migrateEngineNameToIdV7 engine else null;
|
||||
default = null;
|
||||
example = "DuckDuckGo";
|
||||
example = "ddg";
|
||||
description = ''
|
||||
The default search engine used in the Private Browsing.
|
||||
'';
|
||||
|
@ -201,8 +408,9 @@ in {
|
|||
|
||||
order = mkOption {
|
||||
type = with types; uniq (listOf str);
|
||||
apply = builtins.map migrateEngineNameToIdV7;
|
||||
default = [ ];
|
||||
example = [ "DuckDuckGo" "Google" ];
|
||||
example = [ "ddg" "google" ];
|
||||
description = ''
|
||||
The order the search engines are listed in. Any engines that
|
||||
aren't included in this list will be listed after these in an
|
||||
|
@ -212,10 +420,17 @@ in {
|
|||
|
||||
engines = mkOption {
|
||||
type = with types; attrsOf (attrsOf jsonFormat.type);
|
||||
|
||||
apply = mapAttrs' (name: value: {
|
||||
name = migrateEngineNameToIdV7 name;
|
||||
inherit value;
|
||||
});
|
||||
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
"Nix Packages" = {
|
||||
nix-packages = {
|
||||
name = "Nix Packages";
|
||||
urls = [{
|
||||
template = "https://search.nixos.org/packages";
|
||||
params = [
|
||||
|
@ -228,15 +443,15 @@ in {
|
|||
definedAliases = [ "@np" ];
|
||||
};
|
||||
|
||||
"NixOS Wiki" = {
|
||||
urls = [{ template = "https://wiki.nixos.org/index.php?search={searchTerms}"; }];
|
||||
iconUpdateURL = "https://wiki.nixos.org/favicon.png";
|
||||
updateInterval = 24 * 60 * 60 * 1000; # every day
|
||||
nixos-wiki = {
|
||||
name = "NixOS Wiki";
|
||||
urls = [{ template = "https://wiki.nixos.org/w/index.php?search={searchTerms}"; }];
|
||||
iconMapObj."16" = "https://wiki.nixos.org/favicon.ico";
|
||||
definedAliases = [ "@nw" ];
|
||||
};
|
||||
|
||||
"Bing".metaData.hidden = true;
|
||||
"Google".metaData.alias = "@g"; # builtin engines only support specifying one additional alias
|
||||
bing.metaData.hidden = true;
|
||||
google.metaData.alias = "@g"; # builtin engines only support specifying one additional alias
|
||||
}
|
||||
'';
|
||||
|
||||
|
@ -245,7 +460,7 @@ in {
|
|||
only have {var}`metaData` specified will be treated as builtin
|
||||
to ${appName}.
|
||||
|
||||
See [SearchEngine.jsm](https://searchfox.org/mozilla-central/rev/669329e284f8e8e2bb28090617192ca9b4ef3380/toolkit/components/search/SearchEngine.jsm#1138-1177)
|
||||
See [SearchEngine.jsm](https://searchfox.org/mozilla-central/rev/e3f42ec9320748b2aab3d474d1e47075def9000c/toolkit/components/search/SearchEngine.sys.mjs#890-923)
|
||||
in ${appName}'s source for available options. We maintain a
|
||||
mapping to let you specify all options in the referenced link
|
||||
without underscores, but it may fall out of date with future
|
||||
|
|
|
@ -167,6 +167,16 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
command = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
description = ''
|
||||
Specifies the command(s) for which the abbreviation should expand. If
|
||||
set, the abbreviation will only expand when used as an argument to
|
||||
the given command(s).
|
||||
'';
|
||||
};
|
||||
|
||||
setCursor = mkOption {
|
||||
type = with types; (either bool str);
|
||||
default = false;
|
||||
|
@ -201,7 +211,7 @@ let
|
|||
(lib.generators.mkValueStringDefault { } v)
|
||||
];
|
||||
} {
|
||||
inherit position regex function;
|
||||
inherit position regex command function;
|
||||
set-cursor = setCursor;
|
||||
};
|
||||
modifiers = if isAttrs def then mods else "";
|
||||
|
@ -439,7 +449,7 @@ in {
|
|||
for src in $srcs; do
|
||||
if [ -d $src/share/man ]; then
|
||||
find -L $src/share/man -type f \
|
||||
| xargs python ${cfg.package}/share/fish/tools/create_manpage_completions.py --directory $out \
|
||||
-exec python ${cfg.package}/share/fish/tools/create_manpage_completions.py --directory $out {} + \
|
||||
> /dev/null
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -19,14 +19,8 @@ in {
|
|||
unwrappedPackageName = "floorp-unwrapped";
|
||||
visible = true;
|
||||
|
||||
platforms.linux = {
|
||||
configPath = ".floorp";
|
||||
vendorPath = ".mozilla";
|
||||
};
|
||||
platforms.darwin = {
|
||||
configPath = "Library/Application Support/Floorp";
|
||||
vendorPath = "Library/Application Support/Mozilla";
|
||||
};
|
||||
platforms.linux = { configPath = ".floorp"; };
|
||||
platforms.darwin = { configPath = "Library/Application Support/Floorp"; };
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ in {
|
|||
options.programs.freetube = {
|
||||
enable = mkEnableOption "FreeTube, a YT client for Windows, Mac, and Linux";
|
||||
|
||||
package = mkPackageOption pkgs "freetube" { };
|
||||
package = mkPackageOption pkgs "freetube" { nullable = true; };
|
||||
|
||||
settings = mkOption {
|
||||
type = lib.types.attrs;
|
||||
|
@ -44,7 +44,7 @@ in {
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||
|
||||
xdg.configFile."FreeTube/hm_settings.db" = {
|
||||
source = pkgs.writeText "hm_settings.db" (settings cfg.settings);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue