Created
March 8, 2023 21:58
-
-
Save cfcosta/2831e83aadd068bcd6ea4999fe50b72c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ 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