migrate to uv2nix #8
@ -1,36 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
if (($# != 3)); then
|
|
||||||
echo "usage: $0 <cache/cache group> <cache pattern> <token type>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cache="$1"
|
|
||||||
cache_pattern="$2"
|
|
||||||
token_type="$3"
|
|
||||||
|
|
||||||
case $token_type in
|
|
||||||
"cache-creator")
|
|
||||||
atticd-atticadm make-token --sub "$cache-cache-creator" --validity "1y" \
|
|
||||||
--pull "$cache_pattern" --push "$cache_pattern" --delete "$cache_pattern" \
|
|
||||||
--create-cache "$cache_pattern" --configure-cache "$cache_pattern" \
|
|
||||||
--configure-cache-retention "$cache_pattern" --destroy-cache "$cache_pattern"
|
|
||||||
;;
|
|
||||||
"admin")
|
|
||||||
atticd-atticadm make-token --sub "$cache-admin" --validity "1y" --pull "$cache_pattern" \
|
|
||||||
--push "$cache_pattern" --configure-cache "$cache_pattern" \
|
|
||||||
--configure-cache-retention "$cache_pattern"
|
|
||||||
;;
|
|
||||||
"writer")
|
|
||||||
atticd-atticadm make-token --sub "$cache-writer" --validity "1y" --pull "$cache_pattern" \
|
|
||||||
--push "$cache_pattern"
|
|
||||||
;;
|
|
||||||
"reader")
|
|
||||||
atticd-atticadm make-token --sub "$cache-reader" --validity "1y" --pull "$cache_pattern"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "invalid token type: $token_type"
|
|
||||||
echo "available options: cache-creator, admin, writer, reader"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
@ -1,13 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
cache_name=""
|
|
||||||
action=""
|
|
||||||
|
|
||||||
case "$action" in
|
|
||||||
"login")
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo ""
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
@ -1,23 +0,0 @@
|
|||||||
#!/usr/bin/env nix
|
|
||||||
#! nix shell nixpkgs#bash nixpkgs#nix-prefetch-docker --command bash
|
|
||||||
|
|
||||||
# retrieves the latest image tags
|
|
||||||
|
|
||||||
set -x
|
|
||||||
set -v
|
|
||||||
set -e
|
|
||||||
|
|
||||||
script_path=$(dirname "$(readlink -f $0)")
|
|
||||||
parent_path=$(dirname "$script_path")
|
|
||||||
|
|
||||||
# a list of images to pull
|
|
||||||
# relpath is the relative path to the parent_path where you want the file written
|
|
||||||
# format: <image name>,<image tag>,<image architecture>,<os>,<relpath>
|
|
||||||
images=(
|
|
||||||
"nextcloud,apache,amd64,linux,/systems/palatine-hill/docker/nextcloud-image/nextcloud-apache.nix"
|
|
||||||
)
|
|
||||||
IFS=","
|
|
||||||
while read -r name tag arch os relpath; do
|
|
||||||
nix-prefetch-docker --image-name "$name" --image-tag "$tag" --arch "$arch" --os "$os" --quiet >"$parent_path/$relpath"
|
|
||||||
git --no-pager diff "$parent_path/$relpath"
|
|
||||||
done <<<"${images[@]}"
|
|
@ -1,14 +0,0 @@
|
|||||||
network:
|
|
||||||
ethernets:
|
|
||||||
addresses:
|
|
||||||
- 155.128.134.198/23
|
|
||||||
- 2002:18f0:b009:f84:5200:03ff:fdf7:d0c2/64
|
|
||||||
- abc
|
|
||||||
dhcp4: false
|
|
||||||
ens3: null
|
|
||||||
gateway4: 155.128.134.198
|
|
||||||
nameservers:
|
|
||||||
addresses:
|
|
||||||
- 108.61.10.10
|
|
||||||
renderer: networkd
|
|
||||||
version: 2
|
|
@ -1,10 +0,0 @@
|
|||||||
network:
|
|
||||||
version: 2
|
|
||||||
renderer: networkd
|
|
||||||
ethernets:
|
|
||||||
ens3:
|
|
||||||
dhcp4: no
|
|
||||||
addresses: [155.128.134.198/23,'2002:18f0:b009:f84:5200:03ff:fdf7:d0c2/64']
|
|
||||||
gateway4: 155.128.134.198
|
|
||||||
nameservers:
|
|
||||||
addresses: [108.61.10.10]
|
|
@ -1 +0,0 @@
|
|||||||
pyyaml
|
|
@ -1,20 +0,0 @@
|
|||||||
#!/usr/bin/env nix
|
|
||||||
#! nix shell nixpkgs#python312 nixpkgs#python312Packages.pyyaml --command python
|
|
||||||
|
|
||||||
import yaml
|
|
||||||
import pprint
|
|
||||||
|
|
||||||
with open(".sops.yaml", "r") as in_yamlfile:
|
|
||||||
cur_yaml = yaml.safe_load(in_yamlfile)
|
|
||||||
|
|
||||||
cur_yaml["keys"].append("&test testkey")
|
|
||||||
|
|
||||||
pprint.pprint(cur_yaml)
|
|
||||||
|
|
||||||
# with open('new.yaml','w') as out_yamlfile:
|
|
||||||
# yaml.safe_dump(cur_yaml, out_yamlfile)
|
|
||||||
|
|
||||||
# with open('new.yaml','r') as inn_yamlfile:
|
|
||||||
# new_yaml = yaml.safe_load(inn_yamlfile)
|
|
||||||
|
|
||||||
# assert(cur_yaml == new_yaml)
|
|
@ -1,67 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Rename CLI parameters to friendlier names
|
|
||||||
# https://git-scm.com/docs/gitattributes#_defining_a_custom_merge_driver
|
|
||||||
base="$1"
|
|
||||||
local_="$2"
|
|
||||||
remote="$3"
|
|
||||||
merged="$4"
|
|
||||||
|
|
||||||
# Load the mergetool scripts
|
|
||||||
TOOL_MODE=merge
|
|
||||||
source "$(git --exec-path)/git-mergetool--lib"
|
|
||||||
mergetool=$(get_merge_tool)
|
|
||||||
setup_tool "${mergetool}"
|
|
||||||
|
|
||||||
# Create file names for decrypted contents
|
|
||||||
# example_LOCAL_2823.yaml -> example_LOCAL_2823.decrypted.yaml
|
|
||||||
extension=".${base##*.}"
|
|
||||||
base_decrypted="${base/$extension/.decrypted$extension}"
|
|
||||||
local_decrypted="${local_/$extension/.decrypted$extension}"
|
|
||||||
remote_decrypted="${remote/$extension/.decrypted$extension}"
|
|
||||||
merged_decrypted="${base_decrypted/_BASE_/_MERGED_}"
|
|
||||||
backup_decrypted="${base_decrypted/_BASE_/_BACKUP_}"
|
|
||||||
|
|
||||||
# If anything goes wrong, then delete our decrypted files
|
|
||||||
handle_trap_exit() {
|
|
||||||
rm $base_decrypted || true
|
|
||||||
rm $local_decrypted || true
|
|
||||||
rm $remote_decrypted || true
|
|
||||||
rm $merged_decrypted || true
|
|
||||||
rm $backup_decrypted || true
|
|
||||||
}
|
|
||||||
trap handle_trap_exit EXIT
|
|
||||||
|
|
||||||
# Decrypt our file contents
|
|
||||||
sops --decrypt --show-master-keys "$base" >"$base_decrypted"
|
|
||||||
sops --decrypt --show-master-keys "$local_" >"$local_decrypted"
|
|
||||||
sops --decrypt --show-master-keys "$remote" >"$remote_decrypted"
|
|
||||||
|
|
||||||
# Create a merge-diff to compare against
|
|
||||||
git merge-file -p "$local_decrypted" "$base_decrypted" "$remote_decrypted" >"$merged_decrypted"
|
|
||||||
cp "$merged_decrypted" "$backup_decrypted"
|
|
||||||
|
|
||||||
# Set up variables for the mergetool
|
|
||||||
# https://github.com/git/git/blob/v2.8.2/mergetools/meld
|
|
||||||
# https://github.com/git/git/blob/v2.8.2/git-mergetool--lib.sh#L95-L111
|
|
||||||
LOCAL="$local_decrypted"
|
|
||||||
BASE="$base_decrypted"
|
|
||||||
REMOTE="$remote_decrypted"
|
|
||||||
MERGED="$merged_decrypted"
|
|
||||||
BACKUP="$backup_decrypted"
|
|
||||||
|
|
||||||
# Override `check_unchanged` with a custom script
|
|
||||||
check_unchanged() {
|
|
||||||
# If the contents haven't changed, then fail
|
|
||||||
if test "$MERGED" -nt "$BACKUP"; then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Run the mergetool
|
|
||||||
run_merge_tool "${mergetool}" true
|
|
||||||
|
|
||||||
# Re-encrypt content
|
|
||||||
sops --encrypt "$merged_decrypted" >"$merged"
|
|
@ -1,88 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Exit on first error and verify variables have been set/passed via CLI
|
|
||||||
#set -eu
|
|
||||||
set -v
|
|
||||||
set -x
|
|
||||||
|
|
||||||
# Rename our variables to friendlier equivalents
|
|
||||||
# https://git-scm.com/docs/gitattributes#_defining_a_custom_merge_driver
|
|
||||||
base="$1"
|
|
||||||
local_="$2"
|
|
||||||
remote="$3"
|
|
||||||
merged="$4"
|
|
||||||
|
|
||||||
echo "$base"
|
|
||||||
echo "$local_"
|
|
||||||
echo "$remote"
|
|
||||||
echo "$merged"
|
|
||||||
|
|
||||||
# Resolve our default mergetool
|
|
||||||
# https://github.com/git/git/blob/v2.8.2/git-mergetool--lib.sh#L3
|
|
||||||
mergetool="$(git config --get merge.tool)"
|
|
||||||
GIT_DIR="$(git --exec-path)"
|
|
||||||
if test "$mergetool" = ""; then
|
|
||||||
echo 'No default `merge.tool` was set for `git`. Please set one via `git config --set merge.tool <tool>`' 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create file names for our decrypted contents
|
|
||||||
# example_LOCAL_2823.yaml -> example_LOCAL_2823.decrypted.yaml
|
|
||||||
extension=".${base##*.}"
|
|
||||||
base_decrypted="${base/$extension/.decrypted$extension}"
|
|
||||||
local_decrypted="${local_/$extension/.decrypted$extension}"
|
|
||||||
remote_decrypted="${remote/$extension/.decrypted$extension}"
|
|
||||||
merged_decrypted="${base_decrypted/_BASE_/_MERGED_}"
|
|
||||||
backup_decrypted="${base_decrypted/_BASE_/_BACKUP_}"
|
|
||||||
|
|
||||||
# If anything goes wrong, then delete our decrypted files
|
|
||||||
handle_trap_exit() {
|
|
||||||
rm $base_decrypted || true
|
|
||||||
rm $local_decrypted || true
|
|
||||||
rm $remote_decrypted || true
|
|
||||||
rm $merged_decrypted || true
|
|
||||||
rm $backup_decrypted || true
|
|
||||||
}
|
|
||||||
trap handle_trap_exit EXIT
|
|
||||||
|
|
||||||
# Decrypt our file contents
|
|
||||||
sops --decrypt --show-master-keys "$base" >"$base_decrypted"
|
|
||||||
sops --decrypt --show-master-keys "$local_" >"$local_decrypted"
|
|
||||||
sops --decrypt --show-master-keys "$remote" >"$remote_decrypted"
|
|
||||||
|
|
||||||
# Create a merge-diff to compare against
|
|
||||||
set +e
|
|
||||||
git merge-file -p "$local_decrypted" "$base_decrypted" "$remote_decrypted" >"$merged_decrypted"
|
|
||||||
set -e
|
|
||||||
cp "$merged_decrypted" "$backup_decrypted"
|
|
||||||
|
|
||||||
# Set up variables for our mergetool
|
|
||||||
# https://github.com/git/git/blob/v2.8.2/mergetools/meld
|
|
||||||
# https://github.com/git/git/blob/v2.8.2/git-mergetool--lib.sh#L95-L111
|
|
||||||
export LOCAL="$local_decrypted"
|
|
||||||
export BASE="$base_decrypted"
|
|
||||||
export REMOTE="$remote_decrypted"
|
|
||||||
export MERGED="$merged_decrypted"
|
|
||||||
export BACKUP="$backup_decrypted"
|
|
||||||
|
|
||||||
# Load our mergetool scripts
|
|
||||||
source "$GIT_DIR/git-mergetool--lib"
|
|
||||||
source "$GIT_DIR/mergetools/$mergetool"
|
|
||||||
|
|
||||||
# Override `check_unchanged` with a custom script
|
|
||||||
check_unchanged() {
|
|
||||||
# If the contents haven't changed, then fail
|
|
||||||
if test "$MERGED" -nt "$BACKUP"; then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Run our mergetool
|
|
||||||
set +eu
|
|
||||||
export merge_tool_path="$(get_merge_tool_path "$mergetool")"
|
|
||||||
merge_cmd
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
# Re-encrypt content
|
|
||||||
sops --encrypt "$merged_decrypted" >"$merged"
|
|
Loading…
x
Reference in New Issue
Block a user