Move wsl2-* commands to justfile

This commit is contained in:
Oliver Davies 2024-04-08 13:01:54 +01:00
parent 2027eb4d2b
commit 0171861a44
2 changed files with 14 additions and 50 deletions

View file

@ -15,3 +15,17 @@ nixos-test:
update:
nix flake update
wsl-build:
NIXPKGS_ALLOW_UNFREE=1 home-manager build \
--extra-experimental-features flakes \
--extra-experimental-features nix-command \
--flake ".#wsl2" \
--impure
wsl-switch:
NIXPKGS_ALLOW_UNFREE=1 home-manager switch \
--extra-experimental-features flakes \
--extra-experimental-features nix-command \
--flake ".#wsl2" \
--impure

50
run
View file

@ -1,50 +0,0 @@
#!/usr/bin/env bash
set -eu
# delete any temporary or generated files.
function clean {
rm -rf ./result
}
# Display a list of all available commands.
function help {
printf "%s <task> [args]\n\nTasks:\n" "${0}"
compgen -A function | grep -v "^_" | cat -n
printf "\nExtended help:\n Each task has comments for general usage\n"
}
# Perform nixos-rebuild commands for a specified flake on NixOS.
function nixos {
clean
local profile="${1}"
local command="${2}"
shift 2
sudo nixos-rebuild "${command}" \
--flake ".#${profile}" "${@}"
}
# Update the Nix Flake.
function update {
nix flake update
}
# Perform home-manager commands on WSL2.
function wsl2 {
clean
local command="${1}"
NIXPKGS_ALLOW_UNFREE=1 home-manager "${command}" \
--extra-experimental-features flakes \
--extra-experimental-features nix-command \
--flake ".#wsl2" \
--impure
}
TIMEFORMAT=$'\nTask completed in %3lR'
time "${@:-help}"