Add now and hnow scripts
All checks were successful
/ check (push) Successful in 1m1s

Based on ones in https://github.com/rwxrob/dot.
This commit is contained in:
Oliver Davies 2025-09-03 21:02:06 +01:00
parent 9d8cacf2e3
commit c79e19efe5
2 changed files with 67 additions and 0 deletions

35
modules/scripts/hnow.nix Normal file
View file

@ -0,0 +1,35 @@
{ lib, withSystem, ... }:
let
name = "hnow";
in
{
perSystem =
psArgs@{ pkgs, ... }:
let
now = withSystem pkgs.system (psArgs: psArgs.config.packages.now);
in
{
packages.${name} = pkgs.writeShellApplication {
inherit name;
runtimeInputs = [
psArgs.config.packages.now
];
text = ''
# Based on https://github.com/rwxrob/dot/blob/main/scripts/hnow.
echo "== $(${lib.getExe now})"
'';
};
};
flake.modules.homeManager.base =
{ pkgs, ... }:
{
home.packages = [
(withSystem pkgs.system (psArgs: psArgs.config.packages.${name}))
];
};
}

32
modules/scripts/now.nix Normal file
View file

@ -0,0 +1,32 @@
{ 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")
echo "''${out// / }"
'';
};
};
flake.modules.homeManager.base =
{ pkgs, ... }:
{
home.packages = [
(withSystem pkgs.system (psArgs: psArgs.config.packages.${name}))
];
};
}