mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
andcli: add module
This commit is contained in:
parent
2fffa806e7
commit
efb5aa7779
4 changed files with 89 additions and 0 deletions
53
modules/programs/andcli.nix
Normal file
53
modules/programs/andcli.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkIf
|
||||||
|
mkEnableOption
|
||||||
|
mkPackageOption
|
||||||
|
mkOption
|
||||||
|
;
|
||||||
|
|
||||||
|
cfg = config.programs.andcli;
|
||||||
|
yamlFormat = pkgs.formats.yaml { };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
|
||||||
|
options.programs.andcli = {
|
||||||
|
enable = mkEnableOption "andcli";
|
||||||
|
package = mkPackageOption pkgs "andcli" { nullable = true; };
|
||||||
|
settings = mkOption {
|
||||||
|
inherit (yamlFormat) type;
|
||||||
|
default = { };
|
||||||
|
example = {
|
||||||
|
options = {
|
||||||
|
show_usernames = false;
|
||||||
|
show_tokens = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
description = ''
|
||||||
|
Configuration settings for andcli. All the details can be found here:
|
||||||
|
<https://github.com/tjblackheart/andcli/blob/7de13cc933eeb23d53558f76fefef226bd531c2c/internal/config/config.go#L16>
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config =
|
||||||
|
let
|
||||||
|
configPath =
|
||||||
|
if pkgs.stdenv.hostPlatform.isDarwin then
|
||||||
|
"Library/Application Support/andcli"
|
||||||
|
else
|
||||||
|
"${lib.removePrefix config.home.homeDirectory config.xdg.configHome}/andcli";
|
||||||
|
in
|
||||||
|
mkIf cfg.enable {
|
||||||
|
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
||||||
|
home.file."${configPath}/config.yaml" = mkIf (cfg.settings != { }) {
|
||||||
|
source = yamlFormat.generate "andcli-config.yaml" cfg.settings;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
3
tests/modules/programs/andcli/config.yaml
Normal file
3
tests/modules/programs/andcli/config.yaml
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
options:
|
||||||
|
show_tokens: true
|
||||||
|
show_usernames: false
|
||||||
1
tests/modules/programs/andcli/default.nix
Normal file
1
tests/modules/programs/andcli/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{ andcli-settings = ./settings.nix; }
|
||||||
32
tests/modules/programs/andcli/settings.nix
Normal file
32
tests/modules/programs/andcli/settings.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs.andcli = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
options = {
|
||||||
|
show_usernames = false;
|
||||||
|
show_tokens = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script =
|
||||||
|
let
|
||||||
|
configPath =
|
||||||
|
if pkgs.stdenv.hostPlatform.isDarwin then
|
||||||
|
"Library/Application Support/andcli"
|
||||||
|
else
|
||||||
|
"${lib.removePrefix config.home.homeDirectory config.xdg.configHome}/andcli";
|
||||||
|
in
|
||||||
|
''
|
||||||
|
assertFileExists "home-files/${configPath}/config.yaml"
|
||||||
|
assertFileContent "home-files/${configPath}/config.yaml" \
|
||||||
|
${./config.yaml}
|
||||||
|
'';
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue