1
0
Fork 0
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:
phil 2024-06-27 14:09:12 +02:00
parent 1a4f12ae0b
commit a07fc06fb8
8 changed files with 125 additions and 0 deletions

View file

@ -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";

View file

@ -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
View 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;
};
};
}

View file

@ -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

View file

@ -0,0 +1,4 @@
{
jrnl-example-config = ./example-config.nix;
jrnl-empty-config = ./empty-config.nix;
}

View file

@ -0,0 +1,9 @@
{
programs.jrnl.enable = true;
test.stubs.jrnl = { };
nmt.script = ''
assertPathNotExists home-files/.config/jrnl
'';
}

View 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}
'';
}

View 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'