Skip to content

Instantly share code, notes, and snippets.

@cfcosta
Created March 8, 2023 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cfcosta/2831e83aadd068bcd6ea4999fe50b72c to your computer and use it in GitHub Desktop.
Save cfcosta/2831e83aadd068bcd6ea4999fe50b72c to your computer and use it in GitHub Desktop.
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.my-packages.notes;
directory = "/home/johndoe";
today = pkgs.writeShellScriptBin "today"
''$EDITOR "${directory}/$(date +%Y-%M-%d).md"'';
yesterday = pkgs.writeShellScriptBin "yesterday"
''$EDITOR "${directory}/$(date -d "yesterday" +%Y-%M-%d).md"'';
tomorrow = pkgs.writeShellScriptBin "tomorrow"
''$EDITOR "${directory}/$(date -d "tomorrow" +%Y-%M-%d).md"'';
in {
options.my-packages.notes.enable = mkEnableOption "notes";
config = mkIf cfg.enable {
home.packages = with pkgs; [ today yesterday tomorrow ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment