diff options
| author | EuAndreh <eu@euandre.org> | 2026-09-05 10:42:08 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2026-09-05 10:44:03 -0300 |
| commit | 2fd1b2b28efef79d0f688cb3fb8f50f6d55f15ec (patch) | |
| tree | f10093f525ebe7245f98f8ee491f28aa426a360d | |
| parent | src/guix/system.scm: Remove unused module (diff) | |
| download | toph-2fd1b2b28efef79d0f688cb3fb8f50f6d55f15ec.tar.gz toph-2fd1b2b28efef79d0f688cb3fb8f50f6d55f15ec.tar.xz | |
src/guix/system.scm: Add redirects as nginx doesn't understand symlinks
| -rw-r--r-- | src/guix/system.scm | 239 |
1 files changed, 214 insertions, 25 deletions
diff --git a/src/guix/system.scm b/src/guix/system.scm index 5166574..4cefcc6 100644 --- a/src/guix/system.scm +++ b/src/guix/system.scm @@ -41,6 +41,193 @@ +(define +nginx-redirects+ + '(("/index.html" + "/en/index.html") + ("/til.html" + "/en/til/index.html") + ("/podcast.en.html" + "/en/podcast/index.html") + ("/screencasts.en.html" + "/en/screencast/index.html") + ("/pastebins.en.html" + "/en/pastebin/index.html") + ("/about.html" + "/en/about.html") + ("/articles-by-category.html" + "/en/blog/categories.html") + ("/til-by-category.html" + "/en/til/categories.html") + ("/podcast-episodes-by-category.html" + "/en/podcast/categories.html") + ("/screencasts-by-category.html" + "/en/screencast/categories.html") + ("/pastebins-by-category.html" + "/en/pastebin/categories.html") + ("/2021/04/29/a-relational-model-of-data-for-large-shared-data-banks-article-review.html" + "/en/blog/2021/04/29/relational-review.html") + ("/podcast/2020/12/19/a-test-entry.html" + "/en/podcast/2020/12/19/test-entry.html") + ("/2021/02/17/ann-fallible-fault-injection-library-for-stress-testing-failure-scenarios.html" + "/en/blog/2021/02/17/fallible.html") + ("/2021/01/26/ann-remembering-add-memory-to-dmenu-fzf-and-similar-tools.html" + "/en/blog/2021/01/26/remembering-ann.html") + ("/til/2020/08/13/anchor-headers-and-code-lines-in-jekyll.html" + "/en/til/2020/08/13/code-jekyll.html") + ("/screencast/2021/02/07/autoqemu-automate-installation-and-ssh-setup-of-iso-os-images.html" + "/en/screencast/2021/02/07/autoqemu.html") + ("/til/2020/12/15/awk-snippet-shellcheck-all-scripts-in-a-repository.html" + "/en/til/2020/12/15/shellcheck-repo.html") + ("/til/2021/01/12/awk-snippet-send-email-to-multiple-recipients-with-curl.html" + "/en/til/2021/01/12/curl-awk-emails.html") + ("/til/2020/08/14/browse-a-git-repository-at-a-specific-commit.html" + "/en/til/2020/08/14/browse-git.html") + ("/til/2021/04/24/clojure-auto-curry.html" + "/en/til/2021/04/24/clojure-autocurry.html") + ("/til/2021/04/24/common-lisp-argument-precedence-order-parameterization-of-a-generic-function.html" + "/en/til/2021/04/24/cl-generic-precedence.html") + ("/2020/11/07/diy-an-offline-bug-tracker-with-text-files-git-and-email.html" + "/en/blog/2020/11/07/diy-bugs.html") + ("/til/2020/11/12/diy-bare-bones-ci-server-with-bash-and-nix.html" + "/en/til/2020/11/12/diy-nix-bash-ci.html") + ("/pastebin/2021/06/08/debit-reading-session-sicp-solutions-pt-1.html" + "/en/pastebin/2021/06/08/reading-session-pt1.html") + ("/2020/11/12/durable-persistent-trees-and-parser-combinators-building-a-database.html" + "/en/blog/2020/11/12/database-parsers-trees.html") + ("/til/2021/08/11/encoding-and-decoding-javascript-bigint-values-with-reviver.html" + "/en/til/2021/08/11/js-bigint-reviver.html") + ("/pastebin/2020/01/04/failure-on-guix-tex-live-importer.html" + "/en/pastebin/2020/01/04/guix-import-failure.html") + ("/pastebin/2020/12/15/failure-with-relocatable-guix-pack-tarball.html" + "/en/pastebin/2020/12/15/guix-pack-fail.html") + ("/2020/10/19/feature-flags-differences-between-backend-frontend-and-mobile.html" + "/en/blog/2020/10/19/feature-flags.html") + ("/til/2020/11/08/find-broken-symlinks-with-find.html" + "/en/til/2020/11/08/find-broken-symlink.html") + ("/pastebin/2023/07/22/funcallable-amop.html" + "/en/pastebin/2023/07/22/funcallable-amop.html") + ("/pastebin/2018/07/13/gnu-guix-systemd-daemon-for-nixos.html" + "/en/pastebin/2018/07/13/guix-nixos-systemd.html") + ("/til/2021/07/23/gpg-verification-of-git-repositories-without-tls.html" + "/en/til/2021/07/23/git-tls-gpg.html") + ("/til/2020/11/12/git-bisect-automation.html" + "/en/til/2020/11/12/git-bisect-automation.html") + ("/til/2020/08/28/grep-online-repositories.html" + "/en/til/2020/08/28/grep-online.html") + ("/pastebin/2020/11/27/guix-build-local-module.html" + "/en/pastebin/2020/11/27/guix-build-local.html") + ("/pastebin/2018/07/13/guix-builder-user-creation-commands.html" + "/en/pastebin/2018/07/13/guixbuilder.html") + ("/2020/08/10/guix-inside-sourcehut-builds-sr-ht-ci.html" + "/en/blog/2020/08/10/guix-srht.html") + ("/pastebin/2020/02/14/guix-shebang.html" + "/en/pastebin/2020/02/14/guix-shebang.html") + ("/pastebin/2018/07/13/guix-users-in-nixos-system-configuration.html" + "/en/pastebin/2018/07/13/guixbuilder-nixos.html") + ("/2020/10/20/how-not-to-interview-engineers.html" + "/en/blog/2020/10/20/wrong-interviewing.html") + ("/pastebin/2019/06/08/inconsistent-hash-of-buildgomodule.html" + "/en/pastebin/2019/06/08/inconsistent-hash.html") + ("/pastebin/2021/04/03/javascript-naive-slugify.html" + "/en/pastebin/2021/04/03/naive-slugify-js.html") + ("/pastebin/2018/07/25/nix-exps.html" + "/en/pastebin/2018/07/25/nix-exps.html") + ("/pastebin/2018/07/11/nix-pinning.html" + "/en/pastebin/2018/07/11/nix-pinning.html") + ("/pastebin/2018/07/13/nix-string-padding.html" + "/en/pastebin/2018/07/13/nix-strpad.html") + ("/til/2021/01/17/posix-sh-and-shebangs.html" + "/en/til/2021/01/17/posix-shebang.html") + ("/til/2020/09/05/pull-requests-with-git-the-old-school-way.html" + "/en/til/2020/09/05/oldschool-pr.html") + ("/pastebin/2016/04/05/rpn-macro-setup.html" + "/en/pastebin/2016/04/05/rpn.html") + ("/pastebin/2019/12/29/raku-tuple-type-annotation.html" + "/en/pastebin/2019/12/29/raku-tuple-type.html") + ("/2018/07/17/running-guix-on-nixos.html" + "/en/blog/2018/07/17/guix-nixos.html") + ("/pastebin/2021/09/02/sicp-exercise-3-19.html" + "/en/pastebin/2021/09/02/sicp-3-19.html") + ("/pastebin/2021/09/03/sicp-persistent-amortized-o1-queue.html" + "/en/pastebin/2021/09/03/sicp-persistent-queue.html") + ("/til/2020/12/29/svg-favicon.html" + "/en/til/2020/12/29/svg.html") + ("/til/2020/10/11/search-changes-to-a-filename-pattern-in-git-history.html" + "/en/til/2020/10/11/search-git-history.html") + ("/til/2020/08/16/search-in-git.html" + "/en/til/2020/08/16/git-search.html") + ("/til/2020/09/04/send-emails-using-the-command-line-for-fun-and-profit.html" + "/en/til/2020/09/04/cli-email-fun-profit.html") + ("/til/2020/08/12/simple-filename-timestamp.html" + "/en/til/2020/08/12/filename-timestamp.html") + ("/pastebin/2021/08/11/spaces-around-h1-tags.html" + "/en/pastebin/2021/08/11/h1-spacing.html") + ("/til/2020/11/30/storing-ci-data-on-git-notes.html" + "/en/til/2020/11/30/git-notes-ci.html") + ("/2020/11/08/the-next-paradigm-shift-in-programming-video-review.html" + "/en/blog/2020/11/08/paradigm-shift-review.html") + ("/2020/08/31/the-database-i-wish-i-had.html" + "/en/blog/2020/08/31/database-i-wish-i-had.html") + ("/til/2021/04/24/three-way-conditional-for-number-signs-on-lisp.html" + "/en/til/2021/04/24/scm-nif.html") + ("/til/2020/11/12/useful-bash-variables.html" + "/en/til/2020/11/12/useful-bashvars.html") + ("/2018/12/21/using-youtube-dl-to-manage-youtube-subscriptions.html" + "/en/blog/2018/12/21/ytdl-subs.html") + ("/2019/06/02/using-nixos-as-an-stateless-workstation.html" + "/en/blog/2019/06/02/nixos-stateless-workstation.html") + ("/2018/08/01/verifying-npm-ci-reproducibility.html" + "/en/blog/2018/08/01/npm-ci-reproducibility.html") + ("/2020/10/05/cargo2nix-dramatically-simpler-rust-in-nix.html" + "/en/blog/2020/10/05/cargo2nix.html") + ("/til/2020/11/14/gpodder-as-a-media-subscription-manager.html" + "/en/til/2020/11/14/gpodder-media.html") + ("/pastebin/2022/07/14/git-cleanup-command.html" + "/en/pastebin/2022/07/14/git-cleanup.html") + ("/pastebin/2018/07/25/nix-show-derivation-sample-output.html" + "/en/pastebin/2018/07/25/nix-showdrv.html") + ("/2020/10/05/swift2nix-run-swift-inside-nix-builds.html" + "/en/blog/2020/10/05/swift2nix.html") + ("/2020/11/14/local-first-software-you-own-your-data-in-spite-of-the-cloud-article-review.html" + "/en/blog/2020/11/14/local-first-review.html") + ("/pastebin/2021/06/22/cloc-curl-and-wget.html" + "/en/pastebin/2021/06/22/curl-wget.html") + ("/til/2020/08/12/nome-de-arquivo-com-timestamp-simplificado.html" + "/pt/hea/2020/08/12/arquivo-datado.html") + ("/sobre.html" + "/pt/sobre.html") + ("/a-propos.html" + "/fr/a-propos.html") + ("/pri.html" + "/eo/pri.html") + ("/hea.html" + "/pt/hea/index.html") + ("/hea-por-categoria.html" + "/pt/hea/categorias.html") + ("/slides.html" + "/en/slide/index.html") + ("/slides-by-category.html" + "/en/slide/categories.html") + ("/slides/2020/10/19/rollout-feature-flag-experiment-operational-toggle.html" + "/en/slide/2020/10/19/feature-flags.html") + ("/slides/2020/11/14/on-local-first-beyond-the-crdt-silver-bullet.html" + "/en/slide/2020/11/14/local-first-hype.html") + ("/2019/06/02/stateless-os.html" + "/en/blog/2019/06/02/nixos-stateless-workstation.html") + ("/pastebin/raku-tuple-type-annotation.html" + "/en/pastebin/2019/12/29/raku-tuple-type.html") + ("/pastebin/inconsistent-hash-of-buildgomodule.html" + "/en/pastebin/2019/06/08/inconsistent-hash.html"))) + +(define (redirect-location redirect) + (nginx-location-configuration + (uri (pkgs:str "= " (car redirect))) + (body + (list + (pkgs:fmt "return 301 ~a;" (cadr redirect)))))) + + + (define package-symbols '()) @@ -85,32 +272,34 @@ (ssl-certificate-key (pkgs:fmt "/etc/letsencrypt/live/~a/privkey.pem" +tld+)) (locations - (list - (nginx-location-configuration - (uri "~ ^(.*)/index\\.html$") - (body - '("if ($request_uri ~ /index\\.html$) {\n" - " rewrite ^(.*)/index\\.html$ $1/ permanent;\n" - "}\n"))) - (nginx-location-configuration - (uri "/git/static/") - (body - (list - (list "alias " cgit "/share/cgit/;")))) - (nginx-location-configuration - (uri "/git/") - (body - (list + (append + (map redirect-location +nginx-redirects+) + (list + (nginx-location-configuration + (uri "~ ^(.*)/index\\.html$") + (body + '("if ($request_uri ~ /index\\.html$) {\n" + " rewrite ^(.*)/index\\.html$ $1/ permanent;\n" + "}\n"))) + (nginx-location-configuration + (uri "/git/static/") + (body + (list + (list "alias " cgit "/share/cgit/;")))) + (nginx-location-configuration + (uri "/git/") + (body (list - "fastcgi_param SCRIPT_FILENAME " - cgit - "/lib/cgit/cgit.cgi;") - "fastcgi_param PATH_INFO $uri;" - "fastcgi_param PATH /run/current-system/profile/bin;" - "fastcgi_param QUERY_STRING $args;" - "fastcgi_param HTTP_HOST $server_name;" - "fastcgi_pass localhost:9000;" - "rewrite /git(.*) $1 break;"))))) + (list + "fastcgi_param SCRIPT_FILENAME " + cgit + "/lib/cgit/cgit.cgi;") + "fastcgi_param PATH_INFO $uri;" + "fastcgi_param PATH /run/current-system/profile/bin;" + "fastcgi_param QUERY_STRING $args;" + "fastcgi_param HTTP_HOST $server_name;" + "fastcgi_pass localhost:9000;" + "rewrite /git(.*) $1 break;")))))) (raw-content (list "ssl_protocols TLSv1.3;" |
