flk: add get command

This commit is contained in:
Timothy DeHerrera 2021-02-06 14:51:57 -07:00
parent 3bc16596f7
commit d93d63a5e8
No known key found for this signature in database
GPG key ID: 8985725DB5B0C122

View file

@ -12,7 +12,7 @@ let
flk = pkgs.writeShellScriptBin "flk" '' flk = pkgs.writeShellScriptBin "flk" ''
if [[ -z "$1" ]]; then if [[ -z "$1" ]]; then
echo "Usage: $(basename $0) [ up | iso {host} | install {host} | {host} [switch|boot|test] | home {host} {user} [switch] ]" echo "Usage: $(basename $0) [ up | get [core|community] {dest} | iso {host} | install {host} | {host} [switch|boot|test] | home {host} {user} [switch] ]"
elif [[ "$1" == "up" ]]; then elif [[ "$1" == "up" ]]; then
mkdir -p "$DEVSHELL_ROOT/up" mkdir -p "$DEVSHELL_ROOT/up"
hostname="$(hostname)" hostname="$(hostname)"
@ -32,6 +32,13 @@ let
if [[ "$4" == "switch" ]]; then if [[ "$4" == "switch" ]]; then
./result/activate && unlink result ./result/activate && unlink result
fi fi
elif [[ "$1" == "get" ]]; then
if [[ "$2" == "core" || "$2" == "community" ]]; then
nix flake new -t "github:nrdxp/nixflk/$2" "${"\${3:-flk}"}"
else
echo "flk get [core|community] {dest}"
exit 1
fi
else else
sudo nixos-rebuild --flake "$DEVSHELL_ROOT#$1" "${"\${@:2}"}" sudo nixos-rebuild --flake "$DEVSHELL_ROOT#$1" "${"\${@:2}"}"
fi fi
@ -47,6 +54,7 @@ pkgs.devshell.mkShell {
nixos-install nixos-install
nixos-generate-config nixos-generate-config
nixos-enter nixos-enter
mdbook
]; ];
env = { inherit name; }; env = { inherit name; };