mirror of
https://github.com/nix-community/home-manager
synced 2024-12-24 02:39:48 +01:00
bun: add module
This commit is contained in:
parent
40a99619da
commit
b00d0e4fe9
4 changed files with 73 additions and 0 deletions
|
@ -77,6 +77,12 @@
|
|||
githubId = 32838899;
|
||||
name = "Daniel Wagenknecht";
|
||||
};
|
||||
jack5079 = {
|
||||
name = "Jack W.";
|
||||
email = "nix@jack.cab";
|
||||
github = "jack5079";
|
||||
githubId = 29169102;
|
||||
};
|
||||
jkarlson = {
|
||||
email = "jekarlson@gmail.com";
|
||||
github = "jkarlson";
|
||||
|
|
|
@ -1469,6 +1469,13 @@ in {
|
|||
A new module is available: 'services.activitywatch'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2024-04-08T21:43:38+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.bun'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ let
|
|||
./programs/broot.nix
|
||||
./programs/browserpass.nix
|
||||
./programs/btop.nix
|
||||
./programs/bun.nix
|
||||
./programs/carapace.nix
|
||||
./programs/cava.nix
|
||||
./programs/chromium.nix
|
||||
|
|
59
modules/programs/bun.nix
Normal file
59
modules/programs/bun.nix
Normal file
|
@ -0,0 +1,59 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.programs.bun;
|
||||
tomlFormat = pkgs.formats.toml { };
|
||||
in {
|
||||
meta.maintainers = [ lib.hm.maintainers.jack5079 ];
|
||||
|
||||
options.programs.bun = {
|
||||
enable = lib.mkEnableOption "Bun JavaScript runtime";
|
||||
|
||||
package = lib.mkPackageOption pkgs "bun" { };
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = tomlFormat.type;
|
||||
default = { };
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
smol = true;
|
||||
telemetry = false;
|
||||
test = {
|
||||
coverage = true;
|
||||
coverageThreshold = 0.9;
|
||||
};
|
||||
install.lockfile = {
|
||||
print = "yarn";
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Configuration written to
|
||||
{file}`$XDG_CONFIG_HOME/.bunfig.toml`.
|
||||
|
||||
See <https://bun.sh/docs/runtime/bunfig>
|
||||
for the full list of options.
|
||||
'';
|
||||
};
|
||||
|
||||
enableGitIntegration = lib.mkEnableOption "Git integration" // {
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile.".bunfig.toml" = lib.mkIf (cfg.settings != { }) {
|
||||
source = tomlFormat.generate "bun-config" cfg.settings;
|
||||
};
|
||||
|
||||
# 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;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue