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:
Phillip Cloud 2021-04-22 22:27:29 -04:00 committed by GitHub
parent db00b39a9a
commit 26fa84ebce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 136 additions and 0 deletions

3
.github/CODEOWNERS vendored
View file

@ -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

View file

@ -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 { })

View 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)"
'';
};
}

View file

@ -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

View 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)"'
'';
};
}

View 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;
}

View 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'
'';
};
}

View 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'
'';
};
}

View 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'
'';
};
}

View 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)"'
'';
};
}