mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-31 04:04:32 +00:00
Merge b21bdddbc9
into 7170300119
This commit is contained in:
commit
4cc08004b7
6 changed files with 124 additions and 0 deletions
|
@ -672,6 +672,12 @@
|
|||
github = "zorrobert";
|
||||
githubId = 118135271;
|
||||
};
|
||||
Kyure-A = {
|
||||
name = "Kyure_A";
|
||||
email = "k@kyre.moe";
|
||||
github = "Kyure-A";
|
||||
githubId = 49436968;
|
||||
};
|
||||
joygnu = {
|
||||
name = "joygnu";
|
||||
email = "contact@joygnu.org";
|
||||
|
|
|
@ -239,6 +239,7 @@ let
|
|||
./programs/senpai.nix
|
||||
./programs/sesh.nix
|
||||
./programs/sftpman.nix
|
||||
./programs/sheldon.nix
|
||||
./programs/sioyek.nix
|
||||
./programs/skim.nix
|
||||
./programs/sm64ex.nix
|
||||
|
|
82
modules/programs/sheldon.nix
Normal file
82
modules/programs/sheldon.nix
Normal file
|
@ -0,0 +1,82 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.programs.sheldon;
|
||||
tomlFormat = pkgs.formats.toml { };
|
||||
sheldonCmd = "${config.home.profileDirectory}/bin/sheldon";
|
||||
in {
|
||||
meta.maintainers = with maintainers; [ Kyure-A mainrs ];
|
||||
|
||||
options.programs.sheldon = {
|
||||
enable = mkEnableOption "sheldon";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.sheldon;
|
||||
defaultText = literalExpression "pkgs.sheldon";
|
||||
description = "The package to use for the sheldon binary.";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
inherit (tomlFormat) type;
|
||||
default = { };
|
||||
description = "";
|
||||
example = literalExpression "";
|
||||
};
|
||||
|
||||
enableZshCompletions = mkEnableOption "Zsh completions" // {
|
||||
default = true;
|
||||
};
|
||||
|
||||
enableBashCompletions = mkEnableOption "Bash completions" // {
|
||||
default = true;
|
||||
};
|
||||
|
||||
enableFishCompletions = mkEnableOption "Fish completions" // {
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile."sheldon/plugins.toml" = mkIf (cfg.settings != { }) {
|
||||
source = tomlFormat.generate "sheldon-config" cfg.settings;
|
||||
};
|
||||
|
||||
programs.bash.initExtra = ''
|
||||
${optionalString (cfg.settings != { }) ''
|
||||
eval "$(sheldon source)"
|
||||
''}
|
||||
${optionalString cfg.enableBashCompletions ''
|
||||
if [[ $TERM != "dumb" ]]; then
|
||||
eval "$(${sheldonCmd} completions --shell=bash)"
|
||||
fi
|
||||
''}
|
||||
'';
|
||||
|
||||
programs.zsh.initExtra = ''
|
||||
${optionalString (cfg.settings != { }) ''
|
||||
eval "$(sheldon source)"
|
||||
''}
|
||||
${optionalString cfg.enableZshCompletions ''
|
||||
if [[ $TERM != "dumb" ]]; then
|
||||
eval "$(${sheldonCmd} completions --shell=zsh)"
|
||||
fi
|
||||
''}
|
||||
'';
|
||||
|
||||
programs.fish.interactiveShellInit = ''
|
||||
${optionalString (cfg.settings != { }) ''
|
||||
eval "$(sheldon source)"
|
||||
''}
|
||||
${optionalString cfg.enableFishCompletions ''
|
||||
if test "$TERM" != "dumb"
|
||||
eval "$(${sheldonCmd} completions --shell=fish)"
|
||||
end
|
||||
''}
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -388,6 +388,7 @@ in import nmtSrc {
|
|||
./modules/programs/senpai
|
||||
./modules/programs/sesh
|
||||
./modules/programs/sftpman
|
||||
./modules/programs/sheldon
|
||||
./modules/programs/sioyek
|
||||
./modules/programs/sm64ex
|
||||
./modules/programs/spotify-player
|
||||
|
|
27
tests/modules/programs/sheldon/default.nix
Normal file
27
tests/modules/programs/sheldon/default.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
config = {
|
||||
programs.sheldon = {
|
||||
enable = true;
|
||||
settings = {
|
||||
shell = "zsh";
|
||||
plugins = {
|
||||
zsh-syntax-highlighting = {
|
||||
github = "zsh-users/zsh-syntax-highlighting";
|
||||
apply = [ "defer" ];
|
||||
};
|
||||
};
|
||||
templates = {
|
||||
defer = ''
|
||||
{{ hooks | get: "pre" | nl }}{% for file in files %}zsh-defer source "{{ file }}"
|
||||
{% endfor %}{{ hooks | get: "post" | nl }}'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
test.stubs.sheldon = { };
|
||||
|
||||
nmt.script = "assertFileContent home-files/.config/sheldon/plugins.toml ${
|
||||
./plugins.toml
|
||||
}";
|
||||
}
|
7
tests/modules/programs/sheldon/plugins.toml
Normal file
7
tests/modules/programs/sheldon/plugins.toml
Normal file
|
@ -0,0 +1,7 @@
|
|||
shell = "zsh"
|
||||
[plugins.zsh-syntax-highlighting]
|
||||
apply = ["defer"]
|
||||
github = "zsh-users/zsh-syntax-highlighting"
|
||||
|
||||
[templates]
|
||||
defer = "{{ hooks | get: \"pre\" | nl }}{% for file in files %}zsh-defer source \"{{ file }}\"\n{% endfor %}{{ hooks | get: \"post\" | nl }}"
|
Loading…
Add table
Reference in a new issue