diff --git a/.editorconfig b/.editorconfig index 4266da6..bc4d8b6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,4 +6,4 @@ insert_final_newline = true trim_trailing_whitespace = true charset = utf-8 indent_style = space -indent_size = 4 +indent_size = 2 diff --git a/.woodpecker.yml b/.woodpecker.yml index ecbef55..138fc27 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,6 +1,6 @@ steps: build: - image: git.mzhang.io/michael/blog-docker-builder:n409yvghr9s92rshjfca0niqsq5vnpl7 + image: git.mzhang.io/michael/blog-docker-builder:qr7whzx27pqqakdxm32c7b958ggyg07z environment: - ASTRO_TELEMETRY_DISABLED=1 commands: @@ -13,7 +13,7 @@ steps: - event: push deploy: - image: git.mzhang.io/michael/blog-docker-builder:n409yvghr9s92rshjfca0niqsq5vnpl7 + image: git.mzhang.io/michael/blog-docker-builder:qr7whzx27pqqakdxm32c7b958ggyg07z commands: - echo "$${SSH_SECRET_KEY}" > SSH_SECRET_KEY - chmod 600 SSH_SECRET_KEY diff --git a/nix/docker-builder.nix b/nix/docker-builder.nix index 2b65016..7e4a81a 100644 --- a/nix/docker-builder.nix +++ b/nix/docker-builder.nix @@ -8,6 +8,7 @@ , coreutils , nodejs_20 , gnused +, pkgsLinux }: dockerTools.buildLayeredImage { @@ -24,7 +25,22 @@ dockerTools.buildLayeredImage { gnused usrBinEnv caCertificates + fakeNss ]; + + # fakeRootCommands = '' + # #!${pkgsLinux.runtimeShell} + # ${pkgsLinux.dockerTools.shadowSetup} + # groupadd -r builder + # useradd -r -g builder builder + # ''; + + config = { + Cmd = '' + + ''; + # User = "builder:builder"; + }; } # copyToRoot = with dockerTools; buildEnv { diff --git a/scripts/upload-builder.sh b/scripts/upload-builder.sh index ca29796..5f78a16 100755 --- a/scripts/upload-builder.sh +++ b/scripts/upload-builder.sh @@ -6,7 +6,10 @@ nix build .#docker-builder IMAGE_NAME=$(docker load -q -i ./result | cut -d':' -f2,3 | xargs) REMOTE_IMAGE_NAME="git.mzhang.io/michael/$IMAGE_NAME" docker image tag "$IMAGE_NAME" "$REMOTE_IMAGE_NAME" -docker push "$REMOTE_IMAGE_NAME" -set -x sed -i -E "s~(.*image: ).*blog-docker-builder:?.*~\1$REMOTE_IMAGE_NAME~" .woodpecker.yml +echo "Created $REMOTE_IMAGE_NAME" + +if [ "${1+}" == "push" ]; then + docker push "$REMOTE_IMAGE_NAME" +fi diff --git a/src/Prelude.agda b/src/Prelude.agda new file mode 100644 index 0000000..47c781d --- /dev/null +++ b/src/Prelude.agda @@ -0,0 +1,51 @@ +{-# OPTIONS --cubical-compatible #-} + +module Prelude where + +open import Agda.Primitive + +module šŸ˜ where + data āŠ„ : Set where + Ā¬_ : Set ā†’ Set + Ā¬ A = A ā†’ āŠ„ +open šŸ˜ public + +module šŸ™ where + data āŠ¤ : Set where + tt : āŠ¤ +open šŸ™ public + +module šŸš where + data Bool : Set where + true : Bool + false : Bool +open šŸš public + +id : {l : Level} {A : Set l} ā†’ A ā†’ A +id x = x + +module Nat where + data ā„• : Set where + zero : ā„• + suc : ā„• ā†’ ā„• + {-# BUILTIN NATURAL ā„• #-} + + infixl 6 _+_ + _+_ : ā„• ā†’ ā„• ā†’ ā„• + zero + n = n + suc m + n = suc (m + n) +open Nat public + +infix 4 _ā‰”_ +data _ā‰”_ {l} {A : Set l} : (a b : A) ā†’ Set l where + instance refl : {x : A} ā†’ x ā‰” x + +transport : {lā‚ lā‚‚ : Level} {A : Set lā‚} {x y : A} + ā†’ (P : A ā†’ Set lā‚‚) + ā†’ (p : x ā‰” y) + ā†’ P x ā†’ P y +transport {lā‚} {lā‚‚} {A} {x} {y} P refl = id + +infix 4 _ā‰¢_ +_ā‰¢_ : āˆ€ {A : Set} ā†’ A ā†’ A ā†’ Set +x ā‰¢ y = Ā¬ (x ā‰” y) diff --git a/src/content/posts/2023-04-21-proving-true-from-false.lagda.md b/src/content/posts/2023-04-21-proving-true-from-false.lagda.md index 3171a25..ce40566 100644 --- a/src/content/posts/2023-04-21-proving-true-from-false.lagda.md +++ b/src/content/posts/2023-04-21-proving-true-from-false.lagda.md @@ -13,15 +13,8 @@ These are some imports that are required for code on this page to work properly. ```agda {-# OPTIONS --cubical #-} - open import Cubical.Foundations.Prelude -open import Data.Bool -open import Data.Unit -open import Data.Empty - -Ā¬_ : Set ā†’ Set -Ā¬ A = A ā†’ āŠ„ - +open import Prelude hiding (_ā‰¢_; _ā‰”_; refl; transport) infix 4 _ā‰¢_ _ā‰¢_ : āˆ€ {A : Set} ā†’ A ā†’ A ā†’ Set x ā‰¢ y = Ā¬ (x ā‰” y) @@ -40,7 +33,6 @@ For many "obvious" statements, it suffices to just write `refl` since the two sides are trivially true via rewriting. For example: ``` -open import Data.Nat 1+2ā‰”3 : 1 + 2 ā‰” 3 1+2ā‰”3 = refl ``` diff --git a/src/content/posts/2023-10-23-path-induction-gadt-perspective.lagda.md b/src/content/posts/2023-10-23-path-induction-gadt-perspective.lagda.md index 7fabc84..4147fce 100644 --- a/src/content/posts/2023-10-23-path-induction-gadt-perspective.lagda.md +++ b/src/content/posts/2023-10-23-path-induction-gadt-perspective.lagda.md @@ -9,11 +9,15 @@ tags: ["type-theory", "programming-languages"] Imports ``` -open import Relation.Binary.PropositionalEquality hiding (J) -open import Data.Integer -open import Data.Bool -open import Data.String -Int = ā„¤ +-- These types aren't actually imported to improve CI performance :( +-- It doesn't matter what they are, just that they exist +data Int : Set where +postulate + String : Set +{-# BUILTIN STRING String #-} + +data _ā‰”_ {l} {A : Set l} : (a b : A) ā†’ Set l where + instance refl : {x : A} ā†’ x ā‰” x ```