mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-30 22:57:55 +00:00
wrapper-manager/programs/jujutsu: init
This commit is contained in:
parent
30b2f192e4
commit
5ca6749d50
@ -3,6 +3,7 @@
|
||||
./programs/blender.nix
|
||||
./programs/zellij.nix
|
||||
./programs/neovim.nix
|
||||
./programs/jujutsu.nix
|
||||
./nixgl.nix
|
||||
./dconf.nix
|
||||
./sandboxing
|
||||
|
71
modules/wrapper-manager/programs/jujutsu.nix
Normal file
71
modules/wrapper-manager/programs/jujutsu.nix
Normal file
@ -0,0 +1,71 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.programs.jujutsu;
|
||||
|
||||
settingsFormat = pkgs.formats.toml { };
|
||||
in
|
||||
{
|
||||
options.programs.jujutsu = {
|
||||
enable = lib.mkEnableOption "Jujutsu, a Git-compatible DVCS";
|
||||
|
||||
package = lib.mkPackageOption pkgs "jujutsu" { };
|
||||
|
||||
executableName = lib.mkOption {
|
||||
type = lib.types.nonEmptyStr;
|
||||
description = ''
|
||||
The name of the executable Jujutsu wrapper.
|
||||
'';
|
||||
default = "jj";
|
||||
example = "jj-custom";
|
||||
};
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = settingsFormat.type;
|
||||
description = ''
|
||||
Nix-configured settings to be used by the wrapper. This option is
|
||||
ignored if {option}`programs.jujutsu.configFile` is not `null`.
|
||||
'';
|
||||
default = { };
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
user.name = "Your Name";
|
||||
user.email = "youremail@example.com";
|
||||
ui.color = "never";
|
||||
ui.diff.tool = "vimdiff";
|
||||
merge-tools.vimdiff.diff-invocation-mode = "file-by-file";
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
configFile = lib.mkOption {
|
||||
type = with lib.types; nullOr path;
|
||||
description = ''
|
||||
The configuration file to be used for the Jujutsu wrapper. If the value
|
||||
is `null`, it will generate one from
|
||||
{option}`programs.jujutsu.settings`.
|
||||
'';
|
||||
default = null;
|
||||
example = lib.literalExpression "./config/jujutsu.toml";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
basePackages = [ cfg.package ];
|
||||
wrappers.jujutsu = lib.mkMerge [
|
||||
{
|
||||
inherit (cfg) executableName;
|
||||
arg0 = lib.getExe' cfg.package "jj";
|
||||
}
|
||||
|
||||
(lib.mkIf (cfg.configFile != null) {
|
||||
env.JJ_CONFIG.value = cfg.configFile;
|
||||
})
|
||||
|
||||
(lib.mkIf (cfg.settings != { } && cfg.configFile == null) {
|
||||
env.JJ_CONFIG.value =
|
||||
settingsFormat.generate "wrapper-manager-jujutsu-config" cfg.settings;
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
@ -20,4 +20,5 @@ in
|
||||
bubblewrap = runTests ./sandboxing/bubblewrap { };
|
||||
boxxy = runTests ./sandboxing/boxxy { };
|
||||
zellij = runTests ./programs/zellij { };
|
||||
jujutsu = runTests ./programs/jujutsu { };
|
||||
}
|
||||
|
21
tests/modules/wrapper-manager/programs/jujutsu/basic.nix
Normal file
21
tests/modules/wrapper-manager/programs/jujutsu/basic.nix
Normal file
@ -0,0 +1,21 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.jujutsu = {
|
||||
enable = true;
|
||||
settings = {
|
||||
user.name = "Your name";
|
||||
user.email = "yourname@example.com";
|
||||
};
|
||||
};
|
||||
|
||||
build.extraPassthru.tests = {
|
||||
runWithJujutsu = let
|
||||
wrapper = config.build.toplevel;
|
||||
in pkgs.runCommand ''
|
||||
[ -x ${lib.getExe' wrapper "jj"} ] && touch $out
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
basic = ./basic.nix;
|
||||
}
|
Loading…
Reference in New Issue
Block a user