styx will do the heavy lifting

This commit is contained in:
Daylin Morgan 2024-01-24 13:33:48 -06:00
parent 246f47af20
commit d8972aae6c
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F
2 changed files with 28 additions and 19 deletions

View file

@ -38,7 +38,7 @@ jobs:
https://hyprland.cachix.org https://hyprland.cachix.org
https://nixpkgs-wayland.cachix.org https://nixpkgs-wayland.cachix.org
https://daylin.cachix.org https://daylin.cachix.org
cache.nixos.org https://cache.nixos.org
- uses: DeterminateSystems/magic-nix-cache-action@v2 - uses: DeterminateSystems/magic-nix-cache-action@v2
- uses: cachix/cachix-action@v14 - uses: cachix/cachix-action@v14
@ -48,16 +48,11 @@ jobs:
- name: Build - name: Build
shell: bash shell: bash
run: | run: |
# for host in algiz othalan mannaz
for host in ${HOSTS[@]} for host in ${HOSTS[@]}
do do
cachix watch-exec daylin \ ./modules/styx/styx cache --host $host --flake .
-- \
nix build \
".#nixosConfigurations.$host.config.system.build.toplevel" \
--print-build-logs
done done
- name: Push # - name: Push
env: # env:
CACHIX_ACTIVATE_TOKEN: "${{ secrets.CACHIX_ACTIVATE_TOKEN }}" # CACHIX_ACTIVATE_TOKEN: "${{ secrets.CACHIX_ACTIVATE_TOKEN }}"
run: cachix push daylin ./result # run: cachix push daylin ./result

View file

@ -4,7 +4,8 @@ set -e
# rewrite as python script? # rewrite as python script?
FLAKE_PATH=$HOME/nixcfg HOSTNAME=${HOSTNAME:-$(hostname)}
FLAKE_PATH=${FLAKE_PATH-:$HOME/nixcfg}
DIM="$(tput dim)" DIM="$(tput dim)"
BOLD="$(tput bold)" BOLD="$(tput bold)"
@ -69,6 +70,14 @@ dry() {
nix build "$FLAKE_PATH#nixosConfigurations.$(hostname).config.system.build.toplevel" --dry-run nix build "$FLAKE_PATH#nixosConfigurations.$(hostname).config.system.build.toplevel" --dry-run
} }
cache() {
cachix watch-exec daylin \
-- \
nix build "$FLAKE_PATH#nixosConfigurations.${HOSTNAME}.config.system.build.toplevel" \
--print-build-logs
}
if [[ $# -eq 0 ]]; then if [[ $# -eq 0 ]]; then
log no command specified see below for help log no command specified see below for help
help help
@ -76,17 +85,20 @@ fi
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case $1 in case $1 in
fmt | boot | switch | store | build | dry) fmt | boot | switch | store | build | dry | cache)
cmd=$1 cmd=$1
shift shift
;; ;;
-h | --help) -f | --flake)
help FLAKE_PATH="$2"
shift; shift;
;; ;;
--) -h | --host)
# stop parsing and foward the rest of the args HOSTNAME="$2"
shift shift; shift;
break ;;
--help)
help
;; ;;
-*,--*) -*,--*)
error "unknown flag: ${BOLD}$1${RESET}" error "unknown flag: ${BOLD}$1${RESET}"
@ -103,4 +115,6 @@ if [[ $# -gt 0 ]]; then
echo "forwarding args: ${BOLD}$*${RESET}" echo "forwarding args: ${BOLD}$*${RESET}"
fi fi
$cmd "$@" $cmd "$@"