mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-14 11:57:55 +00:00
jujutsu: add module
This commit is contained in:
parent
f2d6291150
commit
c4f3a37071
8 changed files with 130 additions and 0 deletions
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
|
@ -163,6 +163,9 @@ Makefile @thiagokokada
|
|||
|
||||
/modules/programs/just.nix @maximsmol
|
||||
|
||||
/modules/programs/jujutsu.nix @shikanime
|
||||
/tests/modules/programs/jujutsu @shikanime
|
||||
|
||||
/modules/programs/k9s.nix @katexochen
|
||||
/tests/modules/programs/k9s @katexochen
|
||||
|
||||
|
|
|
@ -994,6 +994,13 @@ in
|
|||
A new module is available: 'programs.mr'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2023-04-28T19:59:23+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.jujutsu'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -100,6 +100,7 @@ let
|
|||
./programs/irssi.nix
|
||||
./programs/java.nix
|
||||
./programs/jq.nix
|
||||
./programs/jujutsu.nix
|
||||
./programs/just.nix
|
||||
./programs/k9s.nix
|
||||
./programs/kakoune.nix
|
||||
|
|
76
modules/programs/jujutsu.nix
Normal file
76
modules/programs/jujutsu.nix
Normal file
|
@ -0,0 +1,76 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.jujutsu;
|
||||
tomlFormat = pkgs.formats.toml { };
|
||||
|
||||
in {
|
||||
meta.maintainers = [ maintainers.shikanime ];
|
||||
|
||||
options.programs.jujutsu = {
|
||||
enable =
|
||||
mkEnableOption "a Git-compatible DVCS that is both simple and powerful";
|
||||
|
||||
package = mkPackageOption pkgs "jujutsu" { };
|
||||
|
||||
settings = mkOption {
|
||||
type = tomlFormat.type;
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
user = {
|
||||
name = "John Doe";
|
||||
email = "jdoe@example.org";
|
||||
};
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
Options to add to the <filename>.jjconfig.toml</filename> file. See
|
||||
<link xlink:href="https://github.com/martinvonz/jj/blob/main/docs/config.md"/>
|
||||
for options.
|
||||
'';
|
||||
};
|
||||
|
||||
enableBashIntegration = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether to enable Bash integration.";
|
||||
};
|
||||
|
||||
enableZshIntegration = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether to enable Zsh integration.";
|
||||
};
|
||||
|
||||
enableFishIntegration = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether to enable Fish integration.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
home.file.".jjconfig.toml" = mkIf (cfg.settings != { }) {
|
||||
source = tomlFormat.generate "jujutsu-config" cfg.settings;
|
||||
};
|
||||
|
||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
||||
source <(${pkgs.jujutsu}/bin/jj debug completion)
|
||||
'';
|
||||
|
||||
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
||||
source <(${pkgs.jujutsu}/bin/jj debug completion --zsh | sed '$d')
|
||||
compdef _jj ${pkgs.jujutsu}/bin/jj
|
||||
'';
|
||||
|
||||
programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration ''
|
||||
${pkgs.jujutsu}/bin/jj debug completion --fish | source
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -81,6 +81,7 @@ import nmt {
|
|||
./modules/programs/hyfetch
|
||||
./modules/programs/i3status
|
||||
./modules/programs/irssi
|
||||
./modules/programs/jujutsu
|
||||
./modules/programs/k9s
|
||||
./modules/programs/kakoune
|
||||
./modules/programs/kitty
|
||||
|
|
4
tests/modules/programs/jujutsu/default.nix
Normal file
4
tests/modules/programs/jujutsu/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
jujutsu-example-config = ./example-config.nix;
|
||||
jujutsu-empty-config = ./empty-config.nix;
|
||||
}
|
11
tests/modules/programs/jujutsu/empty-config.nix
Normal file
11
tests/modules/programs/jujutsu/empty-config.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.jujutsu.enable = true;
|
||||
|
||||
test.stubs.jujutsu = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.jjconfig.toml
|
||||
'';
|
||||
}
|
27
tests/modules/programs/jujutsu/example-config.nix
Normal file
27
tests/modules/programs/jujutsu/example-config.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
programs.jujutsu = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage { };
|
||||
settings = {
|
||||
user = {
|
||||
name = "John Doe";
|
||||
email = "jdoe@example.org";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.jjconfig.toml
|
||||
assertFileContent \
|
||||
home-files/.jjconfig.toml \
|
||||
${
|
||||
builtins.toFile "expected.toml" ''
|
||||
[user]
|
||||
email = "jdoe@example.org"
|
||||
name = "John Doe"
|
||||
''
|
||||
}
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue