2025-04-06 17:17:51 +02:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
2025-04-08 15:46:22 +02:00
|
|
|
inherit (lib) types;
|
2025-04-06 17:17:51 +02:00
|
|
|
|
2025-04-08 15:46:22 +02:00
|
|
|
cfg = config.dependencies;
|
2025-04-06 17:17:51 +02:00
|
|
|
|
|
|
|
mkDependencyOption = name: properties: {
|
|
|
|
enable = lib.mkEnableOption "Add ${name} to dependencies.";
|
|
|
|
|
2025-04-12 05:30:59 +01:00
|
|
|
package =
|
|
|
|
lib.mkPackageOption pkgs name properties
|
|
|
|
# Handle example manually so that we can embed the original attr-path within
|
|
|
|
# the literalExpression object. This simplifies testing the examples.
|
2025-04-21 08:47:28 +01:00
|
|
|
// lib.optionalAttrs (builtins.isList properties.example) {
|
|
|
|
example = {
|
|
|
|
_type = "literalExpression";
|
|
|
|
text = "pkgs.${lib.showAttrPath properties.example}";
|
|
|
|
path = properties.example;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
// lib.optionalAttrs (literalExpressionType.check properties.example) {
|
|
|
|
inherit (properties) example;
|
2025-04-12 05:30:59 +01:00
|
|
|
};
|
2025-04-06 17:17:51 +02:00
|
|
|
};
|
2025-04-21 08:47:28 +01:00
|
|
|
|
|
|
|
attrPathType = with types; coercedTo str lib.toList (listOf str);
|
2025-04-21 08:47:28 +01:00
|
|
|
|
|
|
|
literalExpressionType = lib.types.mkOptionType {
|
|
|
|
name = "literal-expression";
|
|
|
|
description = "literal expression";
|
|
|
|
descriptionClass = "noun";
|
|
|
|
merge = lib.options.mergeEqualOption;
|
|
|
|
check = v: v ? _type && (v._type == "literalExpression" || v._type == "literalMD");
|
|
|
|
};
|
2025-04-06 17:17:51 +02:00
|
|
|
in
|
|
|
|
{
|
2025-04-08 15:46:22 +02:00
|
|
|
options = {
|
|
|
|
__depPackages = lib.mkOption {
|
|
|
|
type = types.attrsOf (
|
|
|
|
types.submodule {
|
|
|
|
options = {
|
|
|
|
default = lib.mkOption {
|
2025-04-21 08:47:28 +01:00
|
|
|
type = attrPathType;
|
2025-04-08 15:46:22 +02:00
|
|
|
description = ''
|
2025-04-21 08:47:28 +01:00
|
|
|
Attribute path for this dependency's default package, relative to `pkgs`.
|
2025-04-08 15:46:22 +02:00
|
|
|
'';
|
|
|
|
example = "git";
|
|
|
|
};
|
|
|
|
|
|
|
|
example = lib.mkOption {
|
2025-04-21 08:47:28 +01:00
|
|
|
type = types.nullOr (types.either attrPathType literalExpressionType);
|
2025-04-08 15:46:22 +02:00
|
|
|
description = ''
|
2025-04-21 08:47:28 +01:00
|
|
|
Attribute path for an alternative package that provides dependency, relative to `pkgs`.
|
2025-04-08 15:46:22 +02:00
|
|
|
'';
|
|
|
|
example = "gitMinimal";
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
2025-04-21 08:40:40 +01:00
|
|
|
description = ''
|
|
|
|
A set of dependency packages, used internally to construct the `dependencies.<name>` options.
|
|
|
|
'';
|
2025-04-08 15:46:22 +02:00
|
|
|
default = { };
|
2025-04-21 08:47:28 +01:00
|
|
|
example = {
|
|
|
|
curl.default = "curl";
|
|
|
|
git = {
|
|
|
|
default = "git";
|
|
|
|
example = "gitMinimal";
|
|
|
|
};
|
|
|
|
};
|
2025-04-08 15:46:22 +02:00
|
|
|
internal = true;
|
|
|
|
visible = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
dependencies = lib.mapAttrs mkDependencyOption config.__depPackages;
|
|
|
|
};
|
2025-04-06 17:17:51 +02:00
|
|
|
|
|
|
|
config = {
|
|
|
|
extraPackages = lib.pipe cfg [
|
|
|
|
builtins.attrValues
|
|
|
|
(builtins.filter (p: p.enable))
|
|
|
|
(builtins.map (p: p.package))
|
|
|
|
];
|
2025-04-08 15:46:22 +02:00
|
|
|
|
|
|
|
__depPackages = {
|
|
|
|
bat.default = "bat";
|
2025-05-07 21:37:12 -05:00
|
|
|
claude-code.default = "claude-code";
|
2025-04-08 15:46:22 +02:00
|
|
|
codeium.default = "codeium";
|
|
|
|
coreutils = {
|
|
|
|
default = "coreutils";
|
|
|
|
example = "uutils-coreutils";
|
|
|
|
};
|
|
|
|
cornelis.default = "cornelis";
|
|
|
|
ctags.default = "ctags";
|
|
|
|
curl.default = "curl";
|
|
|
|
direnv.default = "direnv";
|
|
|
|
distant.default = "distant";
|
|
|
|
fish.default = "fish";
|
|
|
|
flutter.default = "flutter";
|
|
|
|
fzf = {
|
|
|
|
default = "fzf";
|
|
|
|
example = "skim";
|
|
|
|
};
|
|
|
|
gcc.default = "gcc";
|
|
|
|
gh.default = "gh";
|
|
|
|
git = {
|
|
|
|
default = "git";
|
|
|
|
example = "gitMinimal";
|
|
|
|
};
|
|
|
|
glow.default = "glow";
|
|
|
|
go.default = "go";
|
|
|
|
godot.default = "godot_4";
|
|
|
|
gzip.default = "gzip";
|
|
|
|
lazygit.default = "lazygit";
|
|
|
|
lean.default = "lean4";
|
|
|
|
ledger.default = "ledger";
|
|
|
|
llm-ls.default = "llm-ls";
|
|
|
|
manix.default = "manix";
|
|
|
|
nodejs = {
|
|
|
|
default = "nodejs";
|
|
|
|
example = "nodejs_22";
|
|
|
|
};
|
|
|
|
plantuml.default = "plantuml";
|
|
|
|
ripgrep.default = "ripgrep";
|
|
|
|
rust-analyzer.default = "rust-analyzer";
|
|
|
|
sd.default = "sd";
|
|
|
|
sed.default = "gnused";
|
|
|
|
texpresso.default = "texpresso";
|
|
|
|
tinymist.default = "tinymist";
|
|
|
|
tmux.default = "tmux";
|
|
|
|
tree-sitter.default = "tree-sitter";
|
|
|
|
typst.default = "typst";
|
|
|
|
ueberzug.default = "ueberzugpp";
|
|
|
|
util-linux.default = "util-linux";
|
|
|
|
websocat.default = "websocat";
|
|
|
|
wezterm.default = "wezterm";
|
|
|
|
which.default = "which";
|
|
|
|
xxd.default = [
|
|
|
|
"unixtools"
|
|
|
|
"xxd"
|
|
|
|
];
|
|
|
|
yazi.default = "yazi";
|
|
|
|
yq.default = "yq";
|
|
|
|
zk.default = "zk";
|
|
|
|
};
|
2025-04-06 17:17:51 +02:00
|
|
|
};
|
|
|
|
}
|