From ad10a72f3c5cef1ca58917fad0369d5d61bb7ac5 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Wed, 13 Mar 2024 12:52:07 -0400 Subject: [PATCH] refactor(bash): make chore a script instead of an alias --- common/home/bash/default.nix | 14 -------------- common/home/git/default.nix | 24 +++++++++++++++++++++++- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/common/home/bash/default.nix b/common/home/bash/default.nix index 31fd465..1706e25 100644 --- a/common/home/bash/default.nix +++ b/common/home/bash/default.nix @@ -114,24 +114,10 @@ in { # Add whitespace after, to allow # sudo to inherit all other aliases sudo = "sudo "; - frick = "sudo $(fc -ln -1)"; ls = "ls -lah --color=auto"; tree = "tree -a -I node_modules"; cp = "cp -r"; - - chore = - /* - bash - */ - '' - ( - cd ~/.nix - git add flake.lock - git commit -m 'chore: update flake.lock' - git push - ) - ''; }; #profileExtra = '' diff --git a/common/home/git/default.nix b/common/home/git/default.nix index 3f63a36..806de2e 100644 --- a/common/home/git/default.nix +++ b/common/home/git/default.nix @@ -1,4 +1,10 @@ -{pkgs, ...}: { +{ + config, + pkgs, + ... +}: let + inherit (config.vars) mainUser; +in { programs = { git = { enable = true; @@ -62,4 +68,20 @@ }; }; }; + + home.packages = with pkgs; [ + (writeShellApplication { + name = "chore"; + runtimeInputs = [git]; + + text = '' + DIR=''${1:-"/home/${mainUser}/.nix"} + + cd "$DIR" + git add flake.lock + git commit -m 'chore: update flake.lock' + git push + ''; + }) + ]; }