nix-config/modules/scripts/now.nix
Oliver Davies 9ed2ad3390
Some checks are pending
/ check (push) Waiting to run
Allow passing arguments to now and hnow
2025-09-21 20:35:47 +01:00

32 lines
609 B
Nix

{ withSystem, ... }:
let
name = "now";
in
{
perSystem =
{ pkgs, ... }:
{
packages.${name} = pkgs.writeShellApplication {
inherit name;
runtimeInputs = with pkgs; [ coreutils ];
text = ''
# Based on https://github.com/rwxrob/dot/blob/main/scripts/now.
out=$(date "+%A, %B %e, %Y, %R %Z" "-d ''${*:-now}")
echo "''${out// / }"
'';
};
};
flake.modules.homeManager.base =
{ pkgs, ... }:
{
home.packages = [
(withSystem pkgs.system (psArgs: psArgs.config.packages.${name}))
];
};
}