Skip to content

initial for workcomp angrist #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 129 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
18d462f
initial for workcomp angrist
joelmccracken May 26, 2024
69a069d
lots of random workcomp stufff
joelmccracken Jun 21, 2024
1c8f9f0
use tty
joelmccracken Aug 8, 2024
96d636e
add resets to ssh script
joelmccracken Aug 14, 2024
d31d886
update ssh belthronding
joelmccracken Sep 3, 2024
ec1edc0
ef on belthronding
joelmccracken Sep 11, 2024
7a434d2
add org timestamp inactive binding
joelmccracken Sep 12, 2024
bc03762
tweak ssh-belthronding command
joelmccracken Oct 9, 2024
80f4820
ws tool thoughts, sketch, planning
joelmccracken Oct 9, 2024
cc5a2de
asdflkj
joelmccracken Nov 1, 2024
b7c9b25
some work on ws
joelmccracken Nov 23, 2024
1203ade
create ws_tool subdir
joelmccracken Nov 23, 2024
72d20c6
ws tool refactoring/doctoring/bootstrapping
joelmccracken Nov 28, 2024
d36aec5
honestly i'm having a blast
joelmccracken Nov 29, 2024
b1b96bc
ci for ws tool
joelmccracken Nov 29, 2024
a6b1881
fooo
joelmccracken Nov 30, 2024
ca4b2a3
no recursive
joelmccracken Nov 30, 2024
97c0b5d
use public git remote
joelmccracken Nov 30, 2024
83b4718
gix test that checks git origin setting
joelmccracken Nov 30, 2024
7944694
seems like a version difference on CI
joelmccracken Nov 30, 2024
89ae022
alternative
joelmccracken Nov 30, 2024
09c3891
more math syntax tweaking
joelmccracken Dec 2, 2024
8a68784
is the++ operator not working??
joelmccracken Dec 2, 2024
3af1925
more testing
joelmccracken Dec 5, 2024
072e6eb
rm commentedc code
joelmccracken Dec 5, 2024
a8fffa8
handle settings and config options
joelmccracken Dec 5, 2024
56f0b64
refactoring
joelmccracken Dec 5, 2024
c9cf630
remove duplicate code, fix paths
joelmccracken Dec 11, 2024
b7c55ee
remove more duplicate
joelmccracken Dec 11, 2024
18f7855
fix
joelmccracken Dec 11, 2024
1b05fc5
fix local decl
joelmccracken Dec 11, 2024
2db0038
breka out properties into own file
joelmccracken Dec 15, 2024
536af74
allow properties to specify subsequent properties
joelmccracken Dec 24, 2024
4bb5610
normalize on REPLY out vars
joelmccracken Dec 24, 2024
144102b
always use read -r
joelmccracken Dec 24, 2024
38892d6
i got them all confused
joelmccracken Dec 24, 2024
aa6de84
maybe this works???
joelmccracken Dec 24, 2024
952d749
attempt to save prop result
joelmccracken Dec 24, 2024
17efc94
fix some weirdness
joelmccracken Dec 24, 2024
e67ea7b
problem using array for REPLY, hnow it prints arr
joelmccracken Dec 24, 2024
343e385
preset workstation_interactive var i guess
joelmccracken Dec 24, 2024
cd8af99
iproject root needed for ws_unset_settings, set
joelmccracken Dec 24, 2024
624973b
always set prop_result, remove debug
joelmccracken Dec 24, 2024
5b92f00
back to this way of preventing cmd failure
joelmccracken Dec 24, 2024
3a5b37d
move all files from workdir to destdir in test
joelmccracken Dec 24, 2024
6e4e102
unify how temporary files are created
joelmccracken Dec 24, 2024
7660eee
indentation, add homebrew and xcode
joelmccracken Dec 24, 2024
f7ccb62
flesh out xcode, homebrew, git install
joelmccracken Dec 24, 2024
3a82437
add a check only mode for run_props
joelmccracken Dec 24, 2024
e2b971f
add script to exercise full setup process
joelmccracken Dec 24, 2024
6baaa48
handle props possibly failing
joelmccracken Dec 25, 2024
b500cb5
handle match ordering issue
joelmccracken Dec 25, 2024
13a32ea
tweak cli parsing, remove arg args prefix
joelmccracken Dec 25, 2024
35199a2
improve the properties-ordering test
joelmccracken Dec 25, 2024
238ca8d
split properties tests
joelmccracken Dec 25, 2024
91faa99
dont specify config and settings separately
joelmccracken Dec 26, 2024
25feee0
begin home dotfiles management code
joelmccracken Dec 26, 2024
236c657
add sample config for install
joelmccracken Dec 26, 2024
df6c44a
ensure configuration is copied into place
joelmccracken Dec 26, 2024
e28d2e9
syntax flub
joelmccracken Dec 26, 2024
a12196d
failure in config, bad
joelmccracken Dec 26, 2024
0fe4993
fix sample config also
joelmccracken Dec 26, 2024
c9d3c65
move run_setup to personal config dir
joelmccracken Dec 27, 2024
5c5c67a
property for current setting symlink
joelmccracken Dec 27, 2024
12cc36f
wrap cds so pwd is restored
joelmccracken Dec 27, 2024
0663ab4
use git SHA for workstation version
joelmccracken Dec 27, 2024
f37400e
bootstrap specific workstation properties
joelmccracken Dec 27, 2024
1a11642
add test checking workstation-specific props
joelmccracken Dec 27, 2024
de8c4c7
formatting
joelmccracken Dec 27, 2024
0099a51
not sure whats going on with REPLY
joelmccracken Dec 27, 2024
d2aaea4
I guess this is reality with set -u
joelmccracken Dec 27, 2024
403a92a
last sha set
joelmccracken Dec 27, 2024
97a2fb8
fix for sha version refs
joelmccracken Dec 27, 2024
1378964
wrong fd
joelmccracken Dec 27, 2024
2e9b0c1
should be return not echo
joelmccracken Dec 27, 2024
6d1bb25
idont install nix darwin right now
joelmccracken Dec 27, 2024
5b9ead9
avoid merge commit
joelmccracken Dec 27, 2024
01e6f82
add ci full setup runs
joelmccracken Dec 27, 2024
536897e
derp i
joelmccracken Dec 27, 2024
a5d263e
ugh this is why testing ci is hard
joelmccracken Dec 27, 2024
4496636
disable cancel in progress, annoying rn
joelmccracken Dec 27, 2024
9639601
install nix, the big test, on CI
joelmccracken Dec 27, 2024
6f0c692
and now all the tasks are queued...
joelmccracken Dec 27, 2024
57c4020
concurrency here too
joelmccracken Dec 27, 2024
58db580
unify hnow two workflows are run
joelmccracken Dec 27, 2024
90efeb9
i guess now it needs ref spec as well bc pr event
joelmccracken Dec 27, 2024
d81f904
use sha not ref
joelmccracken Dec 27, 2024
d6f126e
more tweaks to get the actual commit
joelmccracken Dec 27, 2024
08b658e
output summary when properties fail
joelmccracken Dec 27, 2024
b45f995
satisfy the lisper in me
joelmccracken Dec 27, 2024
2ab2e6a
tests broke bc my reply resettihng logic was bad
joelmccracken Dec 27, 2024
cd2e519
lisper fizz
joelmccracken Dec 27, 2024
62f7568
upodate nix PM version
joelmccracken Dec 27, 2024
8cafcea
attempt to fikx bootstrap workstation script
joelmccracken Dec 28, 2024
dc5f6a9
load nix daemon profile file after install
joelmccracken Dec 28, 2024
a551b36
change how passwordless sudo works
joelmccracken Dec 28, 2024
c6d414c
backup workstation dir on install
joelmccracken Dec 28, 2024
5fab3f2
fix CI
joelmccracken Dec 28, 2024
87d8218
how is it that this file isn't being found??
joelmccracken Dec 28, 2024
c3125df
i have no idea whats going on
joelmccracken Dec 29, 2024
cbf9ffe
some nice stuff for finding config sections
joelmccracken Dec 29, 2024
4a7917d
implement settiung nix config file contents
joelmccracken Dec 29, 2024
1e84dd9
don't output to 3
joelmccracken Dec 29, 2024
a2667a6
so utterly confused, how is home dir empty besides nix??
joelmccracken Dec 29, 2024
91fdfc0
at this point just graspinmg at straws
joelmccracken Dec 29, 2024
d99aa4d
set workstation dir?
joelmccracken Dec 29, 2024
d495955
delete derelict code
joelmccracken Dec 29, 2024
8261466
move lots of files, fix sudo test
joelmccracken Dec 29, 2024
ba80800
see if this helps with intermediate problem
joelmccracken Dec 29, 2024
811a447
how on earth did I mess this up?
joelmccracken Dec 29, 2024
7553b26
improve logic on ending prop run, cleanup
joelmccracken Dec 29, 2024
ecd3707
tweak adn test nix setup
joelmccracken Dec 29, 2024
b503fa5
do more in test
joelmccracken Dec 29, 2024
a8b8e61
rm unused settings
joelmccracken Dec 29, 2024
81ec33b
wip
joelmccracken Dec 29, 2024
96eeace
im surprised this broke?
joelmccracken Dec 29, 2024
ffb523a
formatting, start of dotfiles system
joelmccracken Dec 30, 2024
dea478e
format
joelmccracken Dec 30, 2024
1d228b1
copy my dotfiles to this new location
joelmccracken Dec 30, 2024
c9d2ebe
idk
joelmccracken Dec 30, 2024
c8a953c
fix all of these
joelmccracken Dec 30, 2024
d6ac23e
fix code that sets workstation version to install
joelmccracken Dec 30, 2024
e3ae472
fix condition
joelmccracken Dec 30, 2024
8861df9
more work on dotfiles
joelmccracken Dec 30, 2024
b52e322
merge stuff from workstation
joelmccracken Dec 30, 2024
af995d3
deal with some personal config things
joelmccracken Dec 30, 2024
a75af70
only run bash specific if bash version is set
joelmccracken Dec 30, 2024
40fa3bf
fix core.bare in home dir
joelmccracken Dec 30, 2024
0397d08
of _course_ they're broken. Nix is a joke.
joelmccracken Jan 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@
# [[file:../../workstation.org::*Github Actions CI][Github Actions CI:1]]
name: CI

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
push:
branches: main
schedule:
- cron: '0 0 * * *' # every day at midnight

Expand All @@ -24,17 +30,20 @@ jobs:
strategy:
matrix:
os:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
- macos-13 # x86
- macos-latest # aarch
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

- name: Run a one-line script
env:
BW_CLIENTID: ${{ secrets.BW_CLIENTID }}
BW_CLIENTSECRET: ${{ secrets.BW_CLIENTSECRET }}
WS_BW_MASTER_PASS: ${{ secrets.WS_BW_MASTER_PASS }}
run: ./test/ci.sh
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
# ref: ${{ github.sha }}
- run: ./test/ci.sh
env:
WORKSTATION_VERSION: ${{ github.event.pull_request.head.sha }}
BW_CLIENTID: ${{ secrets.BW_CLIENTID }}
BW_CLIENTSECRET: ${{ secrets.BW_CLIENTSECRET }}
WS_BW_MASTER_PASS: ${{ secrets.WS_BW_MASTER_PASS }}
# Github Actions CI:1 ends here
59 changes: 59 additions & 0 deletions .github/workflows/ws_tool.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: WS Tool

on:
pull_request:
push:
branches: main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
strategy:
matrix:
os:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
- macos-13 # x86
- macos-latest # aarch
- ubuntu-latest
permissions:
id-token: write
contents: read
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{ github.event.pull_request.head.ref }}
- run: ws_tool/test/bats/bin/bats ws_tool/test
env:
WORKSTATION_VERSION: ${{ github.event.pull_request.head.sha }}
BW_CLIENTID: ${{ secrets.BW_CLIENTID }}
BW_CLIENTSECRET: ${{ secrets.BW_CLIENTSECRET }}
WS_BW_MASTER_PASS: ${{ secrets.WS_BW_MASTER_PASS }}

full-setup:
strategy:
matrix:
os:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
- macos-13 # x86
- macos-latest # aarch
- ubuntu-latest
permissions:
id-token: write
contents: read
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{ github.event.pull_request.head.sha }}
- run: bash ws_tool/test/ci_full_setup.bash
env:
WORKSTATION_VERSION: ${{ github.event.pull_request.head.sha }}
BW_CLIENTID: ${{ secrets.BW_CLIENTID }}
BW_CLIENTSECRET: ${{ secrets.BW_CLIENTSECRET }}
WS_BW_MASTER_PASS: ${{ secrets.WS_BW_MASTER_PASS }}
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "test/bats"]
path = test/bats
path = ws_tool/test/bats
url = https://github.com/bats-core/bats-core.git
[submodule "test/test_helper/bats-support"]
path = test/test_helper/bats-support
path = ws_tool/test/test_helper/bats-support
url = https://github.com/bats-core/bats-support.git
[submodule "test/test_helper/bats-assert"]
path = test/test_helper/bats-assert
path = ws_tool/test/test_helper/bats-assert
url = https://github.com/bats-core/bats-assert.git
8 changes: 6 additions & 2 deletions bin/cron-5.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ main() {
# env

echo "updating EF"
~/workstation/bin/update-ef-on-server.sh
# TODO this maybe could be better
# script to generate this file with pointers to specific workstation dirs
# perhaps have $HOME/.config/workstation/ standard location as well/instead?
source $HOME/workstation/hosts/current/zshrc.sh
$HOME/workstation/bin/update-ef-on-server.sh

echo "FINISHED $(date)"
}

main >> ~/workstation/var/log/cron 2>&1
main >> $HOME/workstation/var/log/cron 2>&1
6 changes: 0 additions & 6 deletions bin/disable-passwordless-sudo.sh

This file was deleted.

23 changes: 0 additions & 23 deletions bin/enable-passwordless-sudo.sh

This file was deleted.

5 changes: 5 additions & 0 deletions bin/get-workstation-dir.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

cd "$(dirname "$BASH_SOURCE[0])")"
cd ../
echo -n "$(pwd)"
4 changes: 2 additions & 2 deletions bin/home-manager-flake-switch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
# [[file:../workstation.org::*flake-world equivalent to home-manager 'switch'][flake-world equivalent to home-manager 'switch':1]]
set -u # error in case WORKSTATION_NAME is not set
function home_manager_flake_switch() {
nix build --no-link ~/workstation/#homeConfigurations.${WORKSTATION_NAME}.$(whoami).activationPackage --show-trace
"$(nix path-info ~/workstation/#homeConfigurations.${WORKSTATION_NAME}.$(whoami).activationPackage)"/activate --show-trace
nix build --no-link ${WORKSTATION_DIR}/#homeConfigurations.${WORKSTATION_NAME}.$(whoami).activationPackage --show-trace
"$(nix path-info ${WORKSTATION_DIR}/#homeConfigurations.${WORKSTATION_NAME}.$(whoami).activationPackage)"/activate --show-trace
}
home_manager_flake_switch
# flake-world equivalent to home-manager 'switch':1 ends here
18 changes: 17 additions & 1 deletion bin/ssh-belthronding
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
#!/usr/bin/env bash
set -x
# BELTHRONDING=137.184.110.5
BELTHRONDING=belthronding.wildkraken.monster

reset_command(){
cat <<-EOF
reset;
ssh -t -o ConnectTimeout=10 joel@"$BELTHRONDING" "$@";
reset;
echo belthronding ssh exited and terminal reset, args "$@"
EOF
}

ssh_with_resets() {
exec bash -c "$(reset_command)"
}

# run a command on cloud workstation
ssh [email protected] "$@"
ssh_with_resets "$@"
54 changes: 54 additions & 0 deletions bin/sudopw
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
# Passwordless sudo
# Occasionally, sudo is extremely annoying. Having to type "sudo" in the middle of a nix-darwin rebuild really interrupts the flow. So here are a couple of scripts
# to toggle passwordless sudo.

# [[file:../workstation.org::*Passwordless sudo][Passwordless sudo:1]]
set -euo pipefail

sudo_file=/etc/sudoers.d/sudo-file

usage() {
echo 'usage: sudopw <--pw|--no-pw> ';
echo ' - enable/disable passwordless sudo';
echo ' must be run with sudo.';
exit 1
}

mk_sudoer_file(){
local modifier="$1" file
file="$(mktemp -d "${TMPDIR:-/tmp}/sudoerd-file.XXXXXXXXX")/file"

cat > $file <<-EOF
$SUDO_USER ALL=(ALL) ${modifier}ALL
EOF
visudo -c "$file" > /dev/null
echo "$file";
}

no_pw() {
put_sudo_file 'NOPASSWD: '
}

yes_pw() {
put_sudo_file ''
}

put_sudo_file() {
local param="$1"
local tmpfile
tmpfile="$(mk_sudoer_file "$param")"

mv "$tmpfile" "$sudo_file"
}


if (( $# != 1 )) || [[ -z "${SUDO_USER:-}" ]]; then
usage
fi

case "$1" in
(--pw) yes_pw;;
(--no-pw) no_pw;;
(*) usage;;
esac
2 changes: 1 addition & 1 deletion bin/tangle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@


# [[file:../workstation.org::*Makefile][Makefile:2]]
source ~/workstation/lib/shell/foundation.sh
source ${WORKSTATION_DIR}/lib/shell/foundation.sh
$WORKSTATION_EMACS_CONFIG_DIR/bin/doomscript lib/emacs/tangle-file.el
# Makefile:2 ends here
32 changes: 32 additions & 0 deletions bin/workstation-doctor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

# TODO idea for basic workstation sanity checking framework
# can KISS instead of making things too complicated


# check settings for current workstation, are
# workstation_name and workstation_dir set? is link at hosts/current?
# is there anything else that needs to be done? can I move anything from test script to here, and also
# invoke this script within the test scripty?
#
# check emacs works
# check secrets setup
# - use a dummy secrete + some sha for checking w.r.t real secrets setup correctly
# - check workstation origin for newer version?
# - see other notes about what to do here, have thought about doing this a million times
# - check somehow if pending migration to run?
# - check if nix stuff needs to be rebuilt?
# - maybe keep some of this stuff in ~/.config
#
#
#
# see here for more ideas https://unix.stackexchange.com/questions/312988/understanding-home-configuration-file-locations-config-and-local-sha#313001
#
# can replace var directory
#
# add standard sanity checking in front of all workstaiton scripts, and have standard bypass
# infra if I want to run script anyway.
# TODO run git diff in ~ and $WORKSTATION_DIR to check for any stray changes.
# TODO someday run reddup also
# TODO someday have this script run automatically and have action items output in
# notable spots (bitbar, shell input notice)
Loading
Loading