mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-18 14:28:15 +00:00
Can generate the config without installing application through home-manager. Helpful when a package is broken (or not provided) on a specific platform through nixpkgs and needs to be installed through other means but you still can benefit from the declarative configuration.
52 lines
1.3 KiB
Nix
52 lines
1.3 KiB
Nix
{ 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" { nullable = true; };
|
|
|
|
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 = lib.mkIf (cfg.package != null) [ cfg.package ];
|
|
|
|
xdg.configFile."zk/config.toml" = lib.mkIf (cfg.settings != { }) {
|
|
source = tomlFormat.generate "config.toml" cfg.settings;
|
|
};
|
|
};
|
|
}
|