build: replace justfile with run

This commit is contained in:
Oliver Davies 2023-10-07 00:05:16 +01:00
parent 7b86cafc22
commit 596ba4ac14
2 changed files with 44 additions and 14 deletions

View file

@ -1,14 +0,0 @@
default:
just --list
clean:
rm -rf ./result
nixos profile command: && clean
sudo nixos-rebuild {{ command }} --flake .#{{ profile }}
wsl2 command: && clean
NIXPKGS_ALLOW_UNFREE=1 home-manager {{ command }} --flake .#wsl2 --impure
update:
nix flake update

44
run Executable file
View file

@ -0,0 +1,44 @@
#!/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}"
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}" --flake ".#wsl2" --impure
}
TIMEFORMAT=$'\nTask completed in %3lR'
time "${@:-help}"