scmpuff: init (#1921)
scmpuff is a command line tool that allows you to work quicker with Git by substituting numeric shortcuts for files
This commit is contained in:
parent
db00b39a9a
commit
26fa84ebce
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
|
@ -141,6 +141,9 @@
|
|||
/modules/programs/sbt.nix @kubukoz
|
||||
/tests/modules/programs/sbt @kubukoz
|
||||
|
||||
/modules/programs/scmpuff.nix @cpcloud
|
||||
/tests/modules/programs/scmpuff @cpcloud
|
||||
|
||||
/modules/programs/ssh.nix @rycee
|
||||
|
||||
/modules/programs/starship.nix @marsam
|
||||
|
|
|
@ -118,6 +118,7 @@ let
|
|||
(loadModule ./programs/rofi.nix { })
|
||||
(loadModule ./programs/rofi-pass.nix { })
|
||||
(loadModule ./programs/rtorrent.nix { })
|
||||
(loadModule ./programs/scmpuff.nix { })
|
||||
(loadModule ./programs/skim.nix { })
|
||||
(loadModule ./programs/starship.nix { })
|
||||
(loadModule ./programs/sbt.nix { })
|
||||
|
|
46
modules/programs/scmpuff.nix
Normal file
46
modules/programs/scmpuff.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let cfg = config.programs.scmpuff;
|
||||
in {
|
||||
meta.maintainers = [ maintainers.cpcloud ];
|
||||
|
||||
options.programs.scmpuff = {
|
||||
enable = mkEnableOption
|
||||
"scmpuff, a command line tool that allows you to work quicker with Git by substituting numeric shortcuts for files";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.gitAndTools.scmpuff;
|
||||
defaultText = literalExample "pkgs.gitAndTools.scmpuff";
|
||||
description = "Package providing the <command>scmpuff</command> tool.";
|
||||
};
|
||||
|
||||
enableBashIntegration = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enable Bash integration.
|
||||
'';
|
||||
};
|
||||
|
||||
enableZshIntegration = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enable Zsh integration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
||||
eval "$(${cfg.package}/bin/scmpuff init -s)"
|
||||
'';
|
||||
|
||||
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
|
||||
eval "$(${cfg.package}/bin/scmpuff init -s)"
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -71,6 +71,7 @@ import nmt {
|
|||
./modules/programs/qutebrowser
|
||||
./modules/programs/readline
|
||||
./modules/programs/sbt
|
||||
./modules/programs/scmpuff
|
||||
./modules/programs/ssh
|
||||
./modules/programs/starship
|
||||
./modules/programs/texlive
|
||||
|
|
15
tests/modules/programs/scmpuff/bash.nix
Normal file
15
tests/modules/programs/scmpuff/bash.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ pkgs, ... }: {
|
||||
config = {
|
||||
programs = {
|
||||
scmpuff.enable = true;
|
||||
bash.enable = true;
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.bashrc
|
||||
assertFileContains \
|
||||
home-files/.bashrc \
|
||||
'eval "$(${pkgs.gitAndTools.scmpuff}/bin/scmpuff init -s)"'
|
||||
'';
|
||||
};
|
||||
}
|
7
tests/modules/programs/scmpuff/default.nix
Normal file
7
tests/modules/programs/scmpuff/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
scmpuff-bash = ./bash.nix;
|
||||
scmpuff-no-bash = ./no-bash.nix;
|
||||
scmpuff-no-shell = ./no-shell.nix;
|
||||
scmpuff-no-zsh = ./no-zsh.nix;
|
||||
scmpuff-zsh = ./zsh.nix;
|
||||
}
|
15
tests/modules/programs/scmpuff/no-bash.nix
Normal file
15
tests/modules/programs/scmpuff/no-bash.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ pkgs, ... }: {
|
||||
config = {
|
||||
programs = {
|
||||
scmpuff = {
|
||||
enable = true;
|
||||
enableBashIntegration = false;
|
||||
};
|
||||
bash.enable = true;
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileNotRegex home-files/.bashrc '${pkgs.gitAndTools.scmpuff}/bin/scmpuff'
|
||||
'';
|
||||
};
|
||||
}
|
18
tests/modules/programs/scmpuff/no-shell.nix
Normal file
18
tests/modules/programs/scmpuff/no-shell.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{ pkgs, ... }: {
|
||||
config = {
|
||||
programs = {
|
||||
scmpuff = {
|
||||
enable = true;
|
||||
enableBashIntegration = false;
|
||||
enableZshIntegration = false;
|
||||
};
|
||||
bash.enable = true;
|
||||
zsh.enable = true;
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileNotRegex home-files/.zshrc '${pkgs.gitAndTools.scmpuff} init -s'
|
||||
assertFileNotRegex home-files/.bashrc '${pkgs.gitAndTools.scmpuff} init -s'
|
||||
'';
|
||||
};
|
||||
}
|
15
tests/modules/programs/scmpuff/no-zsh.nix
Normal file
15
tests/modules/programs/scmpuff/no-zsh.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ pkgs, ... }: {
|
||||
config = {
|
||||
programs = {
|
||||
scmpuff = {
|
||||
enable = true;
|
||||
enableZshIntegration = false;
|
||||
};
|
||||
zsh.enable = true;
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileNotRegex home-files/.zshrc '${pkgs.gitAndTools.scmpuff} init -s'
|
||||
'';
|
||||
};
|
||||
}
|
15
tests/modules/programs/scmpuff/zsh.nix
Normal file
15
tests/modules/programs/scmpuff/zsh.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ pkgs, ... }: {
|
||||
config = {
|
||||
programs = {
|
||||
scmpuff.enable = true;
|
||||
zsh.enable = true;
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.zshrc
|
||||
assertFileContains \
|
||||
home-files/.zshrc \
|
||||
'eval "$(${pkgs.gitAndTools.scmpuff}/bin/scmpuff init -s)"'
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue