mirror of
https://github.com/nix-community/home-manager
synced 2025-02-17 05:35:06 +01:00
jrnl: add module
jrnl is a simple journal application for the command line.
This commit is contained in:
parent
1a4f12ae0b
commit
a07fc06fb8
8 changed files with 125 additions and 0 deletions
|
@ -412,6 +412,12 @@
|
|||
githubId = 9267430;
|
||||
name = "Philipp Mildenberger";
|
||||
};
|
||||
phil170 = {
|
||||
name = "phil170";
|
||||
email = "phil170@mailbox.org";
|
||||
github = "phil170";
|
||||
githubId = 93428721;
|
||||
};
|
||||
pinage404 = {
|
||||
name = "pinage404";
|
||||
email = "pinage404@gmail.com";
|
||||
|
|
|
@ -129,6 +129,7 @@ let
|
|||
./programs/java.nix
|
||||
./programs/jetbrains-remote.nix
|
||||
./programs/jq.nix
|
||||
./programs/jrnl.nix
|
||||
./programs/jujutsu.nix
|
||||
./programs/joshuto.nix
|
||||
./programs/joplin-desktop.nix
|
||||
|
|
51
modules/programs/jrnl.nix
Normal file
51
modules/programs/jrnl.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.jrnl;
|
||||
yamlFormat = pkgs.formats.yaml { };
|
||||
|
||||
in {
|
||||
meta.maintainers = [ hm.maintainers.phil170 ];
|
||||
|
||||
options.programs.jrnl = {
|
||||
enable = mkEnableOption
|
||||
"jrnl, a simple journal application for the command line";
|
||||
|
||||
package = mkPackageOption pkgs "jrnl" { };
|
||||
|
||||
settings = mkOption {
|
||||
type = yamlFormat.type;
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
colors = {
|
||||
body = "none";
|
||||
date = "none";
|
||||
tags = "yellow";
|
||||
title = "cyan";
|
||||
};
|
||||
default_hour = 23;
|
||||
default_minute = 59;
|
||||
editor = nvim;
|
||||
journals = {
|
||||
default = {
|
||||
journal = /path/to/journal.txt;
|
||||
};
|
||||
};
|
||||
'';
|
||||
description = ''
|
||||
Configuration written to {file}`$XDG_CONFIG_HOME/jrnl/jrnl.yaml`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile."jrnl/jrnl.yaml" = mkIf (cfg.settings != { }) {
|
||||
source = yamlFormat.generate "jrnl.yaml" cfg.settings;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -201,6 +201,7 @@ in import nmtSrc {
|
|||
./modules/programs/i3blocks
|
||||
./modules/programs/i3status-rust
|
||||
./modules/programs/imv
|
||||
./modules/programs/jrnl
|
||||
./modules/programs/kodi
|
||||
./modules/programs/looking-glass-client
|
||||
./modules/programs/mangohud
|
||||
|
|
4
tests/modules/programs/jrnl/default.nix
Normal file
4
tests/modules/programs/jrnl/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
jrnl-example-config = ./example-config.nix;
|
||||
jrnl-empty-config = ./empty-config.nix;
|
||||
}
|
9
tests/modules/programs/jrnl/empty-config.nix
Normal file
9
tests/modules/programs/jrnl/empty-config.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
programs.jrnl.enable = true;
|
||||
|
||||
test.stubs.jrnl = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/jrnl
|
||||
'';
|
||||
}
|
35
tests/modules/programs/jrnl/example-config.nix
Normal file
35
tests/modules/programs/jrnl/example-config.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
programs.jrnl = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage { };
|
||||
settings = {
|
||||
colors = {
|
||||
body = "none";
|
||||
date = "black";
|
||||
tags = "yellow";
|
||||
title = "cyan";
|
||||
};
|
||||
default_hour = 23;
|
||||
default_minute = 59;
|
||||
editor = "nvim";
|
||||
encrypt = false;
|
||||
highlight = true;
|
||||
indent_character = "|";
|
||||
journals.default.journal = "/home/hm-user/jrnl/journal.txt";
|
||||
linewrap = 79;
|
||||
tagsymbols = "#@";
|
||||
template = false;
|
||||
timeformat = "%d. %h %Y %H:%M";
|
||||
};
|
||||
};
|
||||
|
||||
test.stubs.jrnl = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/jrnl/jrnl.yaml \
|
||||
${./example-config.yaml}
|
||||
'';
|
||||
}
|
18
tests/modules/programs/jrnl/example-config.yaml
Normal file
18
tests/modules/programs/jrnl/example-config.yaml
Normal file
|
@ -0,0 +1,18 @@
|
|||
colors:
|
||||
body: none
|
||||
date: black
|
||||
tags: yellow
|
||||
title: cyan
|
||||
default_hour: 23
|
||||
default_minute: 59
|
||||
editor: nvim
|
||||
encrypt: false
|
||||
highlight: true
|
||||
indent_character: '|'
|
||||
journals:
|
||||
default:
|
||||
journal: /home/hm-user/jrnl/journal.txt
|
||||
linewrap: 79
|
||||
tagsymbols: '#@'
|
||||
template: false
|
||||
timeformat: '%d. %h %Y %H:%M'
|
Loading…
Add table
Reference in a new issue