shell: add command descriptions

This commit is contained in:
Timothy DeHerrera 2020-12-29 01:17:36 -07:00
parent ad4bbdd398
commit 37d40e0cfe
No known key found for this signature in database
GPG key ID: 8985725DB5B0C122

View file

@ -16,37 +16,62 @@ let
}).config.system.build; }).config.system.build;
flk = pkgs.writeShellScriptBin "flk" '' flk = pkgs.writeShellScriptBin "flk" ''
if [[ -z $1 ]]; then if [[ -z "$1" || "$1" == "help" || "--help" || "-h" ]]; then
echo "Usage: $(basename $0) [ iso | install {host} | {host} [switch|boot|test] ]" echo "Usage: $(basename "$0") [ iso | install {host} | {host} [switch|boot|test] ]"
elif [[ $1 == "iso" ]]; then elif [[ "$1" == "iso" ]]; then
nix build ${configs}.niximg.${build}.isoImage nix build ${configs}.niximg.${build}.isoImage
elif [[ $1 == "install" ]]; then elif [[ "$1" == "install" ]]; then
sudo nixos-install --flake ".#$2" "${"\${@:3}"}" sudo nixos-install --flake ".#$2" "${"\${@:3}"}"
else else
sudo nixos-rebuild --flake ".#$1" "${"\${@:2}"}" sudo nixos-rebuild --flake ".#$1" "${"\${@:2}"}"
fi fi
''; '';
nix = pkgs.writeShellScriptBin "nix" '' name = "flk";
${pkgs.nixFlakes}/bin/nix --option experimental-features "nix-command flakes ca-references" "$@"
'';
in in
pkgs.mkDevShell { pkgs.mkDevShell {
name = "nixflk"; inherit name;
packages = with pkgs; with installPkgs; [ packages = with pkgs; with installPkgs; [
git
git-crypt git-crypt
flk
nix
nixpkgs-fmt
python38Packages.grip
nixos-install nixos-install
nixos-generate-config nixos-generate-config
nixos-enter nixos-enter
nixos-rebuild
]; ];
env = { }; env = { inherit name; };
commands = with pkgs; [
{
name = nixpkgs-fmt.pname;
package = nixpkgs-fmt;
help = nixpkgs-fmt.meta.description;
category = "linters";
}
{
name = flk.name;
help = "Build, deploy, and install nixflk";
category = "main";
package = flk;
}
{
name = "grip";
help = python38Packages.grip.meta.description;
category = "servers";
package = python38Packages.grip;
}
{
name = git.pname;
help = git.meta.description;
category = "vcs";
package = git;
}
{
name = "nix";
help = nixFlakes.meta.description;
category = "main";
command = ''${nixFlakes}/bin/nix --option experimental-features "nix-command flakes ca-references" "$@"'';
}
];
} }