nix machine / user configurations

feat(qol): add commit script for easier committing

ptr.pet 248ad247 99c32875

verified
Changed files
+30 -1
shells
+27
commit.nu
···
+
#!/usr/bin/env nu
+
+
use std "path add"
+
+
+
path add /nix/var/nix/profiles/default/bin
+
+
+
def unwrap-or-else [val block] {
+
if $val == null { do $block } else { $val }
+
}
+
+
+
def main [
+
msg: string
+
--type (-t): string
+
--scope (-s): string
+
...rest
+
] {
+
let types = ["feat" "build" "ci" "fix" "refactor" "chore" "style"]
+
let hosts: list<string> = (nix eval ".#nixosConfigurations" --apply builtins.attrNames --json | from json)
+
+
let ty: string = unwrap-or-else $type { $types | input list 'choose type' --fuzzy }
+
let scp: string = unwrap-or-else $scope { $hosts | input list 'choose host' --fuzzy }
+
let commit_msg = $"($ty)\(($scp)\): ($msg)"
+
git commit -m $commit_msg ...$rest
+
}
+3 -1
shells/default.nix
···
fi
'';
};
+
commit = pkgs.writers.writeNuBin "commit" ../commit.nu;
+
deploy = pkgs.writers.writeNuBin "deploy" ../deploy.nu;
in
{
default = mkNakedShell {
···
rage
nh
])
-
++ [ agenix-wrapped ];
+
++ [ agenix-wrapped commit deploy ];
shellHook = ''
echo \"$(tput bold)welcome to PRTS, $USER$(tput sgr0)\"
export FLAKE=$PWD