gh-dash: add module

This commit is contained in:
Janik H 2023-07-05 19:56:25 +02:00 committed by Robert Helgesson
parent ab70a02363
commit a30f5b5b35
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
6 changed files with 78 additions and 0 deletions

View file

@ -1152,6 +1152,13 @@ in
A new module is available: 'wayland.windowManager.hyprland' A new module is available: 'wayland.windowManager.hyprland'
''; '';
} }
{
time = "2023-07-24T10:38:23+00:00";
message = ''
A new module is available: 'programs.gh-dash'
'';
}
]; ];
}; };
} }

View file

@ -87,6 +87,7 @@ let
./programs/gallery-dl.nix ./programs/gallery-dl.nix
./programs/getmail.nix ./programs/getmail.nix
./programs/gh.nix ./programs/gh.nix
./programs/gh-dash.nix
./programs/git-cliff.nix ./programs/git-cliff.nix
./programs/git-credential-oauth.nix ./programs/git-credential-oauth.nix
./programs/git.nix ./programs/git.nix

View file

@ -0,0 +1,42 @@
{ config, lib, pkgs, ... }:
let
cfg = config.programs.gh-dash;
yamlFormat = pkgs.formats.yaml { };
in {
meta.maintainers = [ lib.maintainers.janik ];
options.programs.gh-dash = {
enable = lib.mkEnableOption "GitHub CLI dashboard plugin";
package = lib.mkPackageOption pkgs "gh-dash" { };
settings = lib.mkOption {
type = yamlFormat.type;
default = { };
example = lib.literalExpression ''
{
prSections = [{
title = "My Pull Requests";
filters = "is:open author:@me";
}];
}
'';
description = ''
Configuration written to {file}`$XDG_CONFIG_HOME/gh-dash/config.yml`.
'';
};
};
config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ];
programs.gh.extensions = [ cfg.package ];
xdg.configFile."gh-dash/config.yml".source =
yamlFormat.generate "gh-dash-config.yml" cfg.settings;
};
}

View file

@ -77,6 +77,7 @@ import nmt {
./modules/programs/fish ./modules/programs/fish
./modules/programs/gallery-dl ./modules/programs/gallery-dl
./modules/programs/gh ./modules/programs/gh
./modules/programs/gh-dash
./modules/programs/git-cliff ./modules/programs/git-cliff
./modules/programs/git ./modules/programs/git
./modules/programs/gpg ./modules/programs/gpg

View file

@ -0,0 +1,26 @@
{ ... }:
{
programs.gh-dash = {
enable = true;
settings = {
prSections = [{
title = "My Pull Requests";
filters = "is:open author:@me";
}];
};
};
test.stubs.gh = { };
nmt.script = ''
assertFileExists home-files/.config/gh-dash/config.yml
assertFileContent home-files/.config/gh-dash/config.yml ${
builtins.toFile "config-file.yml" ''
prSections:
- filters: is:open author:@me
title: My Pull Requests
''
}
'';
}

View file

@ -0,0 +1 @@
{ gh-dash-config = ./config.nix; }