diff options
author | Alan Pearce | 2024-04-21 18:46:12 +0200 |
---|---|---|
committer | Alan Pearce | 2024-04-21 20:48:34 +0200 |
commit | f334fc8d4caed2663ef3008f43d2f2fc48e3eaa9 (patch) | |
tree | f0942e920e8a2e4161f0a8dad3a15b9a7aff6d08 /nix | |
parent | 2c6722bd18097cdcbed23d526ace0b751caf324a (diff) | |
download | website-f334fc8d4caed2663ef3008f43d2f2fc48e3eaa9.tar.lz website-f334fc8d4caed2663ef3008f43d2f2fc48e3eaa9.tar.zst website-f334fc8d4caed2663ef3008f43d2f2fc48e3eaa9.zip |
use justfile for scripting
Diffstat (limited to 'nix')
-rw-r--r-- | nix/scripts.nix | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/nix/scripts.nix b/nix/scripts.nix deleted file mode 100644 index e097648..0000000 --- a/nix/scripts.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ pkgs ? import <nixpkgs> { }, ... }: -let - watchFlake = with pkgs; '' - ${watchexec}/bin/watchexec --restart \ - --watch flake.nix \ - --watch flake.lock \ - ''; - imageName = (builtins.fromTOML (builtins.readFile ../fly.toml)).build.image; - nonDarwinSystem = builtins.replaceStrings [ "darwin" ] [ "linux" ] pkgs.stdenv.system; - flySystem = "x86_64-linux"; - mkAttr = type: system: ".#docker-${type}-${system}"; - sh = (pkgs.lib.optionalString pkgs.stdenv.isDarwin "ssh linux-builder ") - + "sh"; - stream = system: "nix build --print-out-paths ${(mkAttr "stream") system} | ${sh}"; - image = system: "nix build ${(mkAttr "image") system}"; -in -with pkgs; [ - (writeShellScriptBin "watch-builder" '' - ${watchFlake} "direnv exec . watchexec -i cmd/server -i public -r go run ./cmd/build $@" - '') - (writeShellScriptBin "watch-server" '' - ${watchFlake} "direnv exec . watchexec -r go run ./cmd/server $@" - '') - (writeShellScriptBin "check-licenses" '' - ${go-licenses}/bin/go-licenses check --include_tests ./... --disallowed_types=restricted,forbidden - '') - (writeShellScriptBin "stream" "${stream nonDarwinSystem}") - (writeShellScriptBin "stream-fly" "${stream flySystem}") - (writeShellScriptBin "image" "${image nonDarwinSystem}") - (writeShellScriptBin "image-fly" "${image flySystem}") - (writeShellScriptBin "load-locally" '' - stream | ${docker-client}/bin/docker load "$@" - '') - (writeShellScriptBin "push-to-registry" '' - if test -z "''${1:-}"; then - cat <<-EOF - USAGE: $0 <docker-url> [skopeo-copy-options] - - Example: $0 docker://some_docker_registry/myimage:tag - - See: https://github.com/containers/skopeo/blob/main/docs/skopeo-copy.1.md - EOF - exit 1 - fi - echo skopeo copy docker-archive:/dev/stdin "$@" - stream fly | ${gzip}/bin/gzip --fast | ${skopeo}/bin/skopeo copy docker-archive:/dev/stdin "$@" - '') - (writeShellScriptBin "deploy" '' - set -eu - TAG=$(git rev-parse HEAD) - IMAGE=${imageName}:$TAG - push-to-registry docker://$IMAGE - ${pkgs.flyctl}/bin/flyctl deploy --image $IMAGE - '') -] |