mirror of
https://github.com/nix-community/home-manager
synced 2024-11-14 15:19:45 +01:00
zk: add module
This commit is contained in:
parent
a208d4e7a3
commit
c18657cc4c
8 changed files with 113 additions and 0 deletions
|
@ -205,6 +205,12 @@
|
||||||
fingerprint = "F0E0 0311 126A CD72 4392 25E6 68BF 2EAE 6D91 CAFF";
|
fingerprint = "F0E0 0311 126A CD72 4392 25E6 68BF 2EAE 6D91 CAFF";
|
||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
|
silmarp = {
|
||||||
|
name = "Silmar Pereira da Silva Junior";
|
||||||
|
email = "silmarjr2@gmail.com";
|
||||||
|
github = "silmarp";
|
||||||
|
githubID = 67292496;
|
||||||
|
};
|
||||||
fendse = {
|
fendse = {
|
||||||
email = "46252070+Fendse@users.noreply.github.com";
|
email = "46252070+Fendse@users.noreply.github.com";
|
||||||
github = "Fendse";
|
github = "Fendse";
|
||||||
|
|
|
@ -1422,6 +1422,13 @@ in {
|
||||||
A new module is available: 'wayland.windowManager.river'.
|
A new module is available: 'wayland.windowManager.river'.
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
time = "2024-03-08T22:20:04+00:00";
|
||||||
|
message = ''
|
||||||
|
A new module is available: 'programs.zk'
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,6 +247,7 @@ let
|
||||||
./programs/z-lua.nix
|
./programs/z-lua.nix
|
||||||
./programs/zathura.nix
|
./programs/zathura.nix
|
||||||
./programs/zellij.nix
|
./programs/zellij.nix
|
||||||
|
./programs/zk.nix
|
||||||
./programs/zoxide.nix
|
./programs/zoxide.nix
|
||||||
./programs/zplug.nix
|
./programs/zplug.nix
|
||||||
./programs/zsh.nix
|
./programs/zsh.nix
|
||||||
|
|
52
modules/programs/zk.nix
Normal file
52
modules/programs/zk.nix
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
cfg = config.programs.zk;
|
||||||
|
tomlFormat = pkgs.formats.toml { };
|
||||||
|
|
||||||
|
in {
|
||||||
|
meta.maintainers = [ lib.hm.maintainers.silmarp ];
|
||||||
|
|
||||||
|
options.programs.zk = {
|
||||||
|
enable = lib.mkEnableOption "zk";
|
||||||
|
|
||||||
|
package = lib.mkPackageOption pkgs "zk" { };
|
||||||
|
|
||||||
|
settings = lib.mkOption {
|
||||||
|
type = tomlFormat.type;
|
||||||
|
default = { };
|
||||||
|
example = lib.literalExpression ''
|
||||||
|
{
|
||||||
|
note = {
|
||||||
|
language = "en";
|
||||||
|
default-title = "Untitled";
|
||||||
|
filename = "{{id}}-{{slug title}}";
|
||||||
|
extension = "md";
|
||||||
|
template = "default.md";
|
||||||
|
id-charset = "alphanum";
|
||||||
|
id-length = 4;
|
||||||
|
id-case = "lower";
|
||||||
|
};
|
||||||
|
extra = {
|
||||||
|
author = "Mickaël";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
Configuration written to {file}`$XDG_CONFIG_HOME/zk/config.toml`.
|
||||||
|
|
||||||
|
See <https://github.com/mickael-menu/zk/blob/main/docs/config.md> for
|
||||||
|
available options and documentation.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
|
xdg.configFile."zk/config.toml" = lib.mkIf (cfg.settings != { }) {
|
||||||
|
source = tomlFormat.generate "config.toml" cfg.settings;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -153,6 +153,7 @@ in import nmtSrc {
|
||||||
./modules/programs/wezterm
|
./modules/programs/wezterm
|
||||||
./modules/programs/yazi
|
./modules/programs/yazi
|
||||||
./modules/programs/zellij
|
./modules/programs/zellij
|
||||||
|
./modules/programs/zk
|
||||||
./modules/programs/zplug
|
./modules/programs/zplug
|
||||||
./modules/programs/zsh
|
./modules/programs/zsh
|
||||||
./modules/services/syncthing/common
|
./modules/services/syncthing/common
|
||||||
|
|
1
tests/modules/programs/zk/default.nix
Normal file
1
tests/modules/programs/zk/default.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{ zk = ./zk.nix; }
|
15
tests/modules/programs/zk/expected.toml
Normal file
15
tests/modules/programs/zk/expected.toml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
[extra]
|
||||||
|
author = "Mickaël"
|
||||||
|
|
||||||
|
[note]
|
||||||
|
default-title = "Untitled"
|
||||||
|
extension = "md"
|
||||||
|
filename = "{{id}}-{{slug title}}"
|
||||||
|
id-case = "lower"
|
||||||
|
id-charset = "alphanum"
|
||||||
|
id-length = 4
|
||||||
|
language = "en"
|
||||||
|
template = "default.md"
|
||||||
|
|
||||||
|
[notebook]
|
||||||
|
dir = "~/notebook"
|
30
tests/modules/programs/zk/zk.nix
Normal file
30
tests/modules/programs/zk/zk.nix
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs.zk = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
extra = { author = "Mickaël"; };
|
||||||
|
|
||||||
|
note = {
|
||||||
|
default-title = "Untitled";
|
||||||
|
extension = "md";
|
||||||
|
filename = "{{id}}-{{slug title}}";
|
||||||
|
id-case = "lower";
|
||||||
|
id-charset = "alphanum";
|
||||||
|
id-length = 4;
|
||||||
|
template = "default.md";
|
||||||
|
language = "en";
|
||||||
|
};
|
||||||
|
|
||||||
|
notebook = { dir = "~/notebook"; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
test.stubs.zk = { };
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.config/zk/config.toml
|
||||||
|
assertFileContent home-files/.config/zk/config.toml ${./expected.toml}
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue