diff --git a/modules/scripts/add-weight.nix b/modules/scripts/add-weight.nix new file mode 100644 index 00000000..cb884e97 --- /dev/null +++ b/modules/scripts/add-weight.nix @@ -0,0 +1,34 @@ +{ withSystem, ... }: + +let + name = "add-weight"; +in +{ + perSystem = + psArgs@{ pkgs, ... }: + { + packages.${name} = pkgs.writeShellApplication { + inherit name; + + runtimeInputs = with pkgs; [ + coreutils + psArgs.config.packages.today2 + psArgs.config.packages.weight + ]; + + text = '' + echo "$(today2),$1" >> "$XDG_DOCUMENTS_DIR/wiki/2-areas/health-fitness/weight.csv" + + weight + ''; + }; + }; + + flake.modules.homeManager.base = + { pkgs, ... }: + { + home.packages = [ + (withSystem pkgs.system (psArgs: psArgs.config.packages.${name})) + ]; + }; +} diff --git a/modules/scripts/weight.nix b/modules/scripts/weight.nix new file mode 100644 index 00000000..4c63f47c --- /dev/null +++ b/modules/scripts/weight.nix @@ -0,0 +1,28 @@ +{ withSystem, ... }: + +let + name = "weight"; +in +{ + perSystem = + { pkgs, ... }: + { + packages.${name} = pkgs.writeShellApplication { + inherit name; + + runtimeInputs = with pkgs; [ + coreutils + ]; + + text = ''tail "$XDG_DOCUMENTS_DIR/wiki/2-areas/health-fitness/weight.csv"''; + }; + }; + + flake.modules.homeManager.base = + { pkgs, ... }: + { + home.packages = [ + (withSystem pkgs.system (psArgs: psArgs.config.packages.${name})) + ]; + }; +}