1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 11:39:46 +01:00

bun: add module

This commit is contained in:
Jack W 2024-04-09 14:48:15 -04:00 committed by GitHub
parent 40a99619da
commit b00d0e4fe9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 73 additions and 0 deletions

View file

@ -77,6 +77,12 @@
githubId = 32838899; githubId = 32838899;
name = "Daniel Wagenknecht"; name = "Daniel Wagenknecht";
}; };
jack5079 = {
name = "Jack W.";
email = "nix@jack.cab";
github = "jack5079";
githubId = 29169102;
};
jkarlson = { jkarlson = {
email = "jekarlson@gmail.com"; email = "jekarlson@gmail.com";
github = "jkarlson"; github = "jkarlson";

View file

@ -1469,6 +1469,13 @@ in {
A new module is available: 'services.activitywatch'. A new module is available: 'services.activitywatch'.
''; '';
} }
{
time = "2024-04-08T21:43:38+00:00";
message = ''
A new module is available: 'programs.bun'.
'';
}
]; ];
}; };
} }

View file

@ -72,6 +72,7 @@ let
./programs/broot.nix ./programs/broot.nix
./programs/browserpass.nix ./programs/browserpass.nix
./programs/btop.nix ./programs/btop.nix
./programs/bun.nix
./programs/carapace.nix ./programs/carapace.nix
./programs/cava.nix ./programs/cava.nix
./programs/chromium.nix ./programs/chromium.nix

59
modules/programs/bun.nix Normal file
View 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;
};
};
}