diff --git a/content/about.md b/content/about.md index 705ccc5..abd7701 100644 --- a/content/about.md +++ b/content/about.md @@ -5,12 +5,15 @@ date: 2020-07-16T21:42:33-07:00 ## The Site -This is a static site generated using [Hugo](https://gohugo.io/). There's a public repo for this site -[here](https://github.com/alejandro-angulo/alejandr0angul0.dev). Nothing fancy going on. I'm planning on using this site as a sort -of personal documentation. Hopefully what I write here will be useful to whoever stumbles upon it. +This is a static site generated using [Hugo](https://gohugo.io/). There's a +public repo for this site +[here](https://github.com/alejandro-angulo/alejandr0angul0.dev). Nothing fancy +going on. I'm planning on using this site as a sort of personal documentation. +Hopefully what I write here will be useful to whoever stumbles upon it. -For you vim fans, this site supports scrolling vertically with vim bindings (as long as you allow this site to run javascript). As -of now the following are supported: +For you vim fans, this site supports scrolling vertically with vim bindings (as +long as you allow this site to run javascript). As of now the following are +supported: - `j` (scrolls down) - `k` (scrolls up) @@ -19,9 +22,10 @@ of now the following are supported: ## Me -I'm Alejandro Angulo, a code monkey living in the Los Angeles area. When I'm not ~~introducting bugs~~ writing beautiful, -performant code I like [working on random personal projects](https://github.com/alejandro-angulo/qmk_firmware/), going to the gym, -and hanging out with my girlfiend and my chihuahua. +I'm Alejandro Angulo, a code monkey living in the Los Angeles area. When I'm +not ~~introducting bugs~~ writing beautiful, performant code I like [working on +random personal projects](https://github.com/alejandro-angulo/qmk_firmware/), +going to the gym, and hanging out with my wife and our chihuahua. ## Contact diff --git a/content/posts/now-with-more-nix.md b/content/posts/now-with-more-nix.md new file mode 100644 index 0000000..e86ba6c --- /dev/null +++ b/content/posts/now-with-more-nix.md @@ -0,0 +1,324 @@ ++++ +title = "Now With More Nix" +date = "2023-08-27T17:25:57-07:00" +author = "alejandro" +authorTwitter = "" #do not include @ +cover = "" +tags = ["nix flake", "cachix", "devenv", "meta"] +keywords = ["nix"] +showFullContent = false ++++ + +It's been about a year since my last post into the void. Since [my last +post](/posts/dotfiles) I've completely overhauled how my computers are +configured. I now have [a nix +flake](https://github.com/alejandro-angulo/dotfiles) to manage my personal +machines. I'm going all in on nix and wanted to update the deployment process +for this site to use nix flakes as well. + +## Managing Development Environments with devenv and nix flakes + +It's been a while since I touched anything on this site and I didn't have any +of the right packages installed to work on this. I could have installed +programs like [hugo](https://gohugo.io/) system-wide. But, since I have been +tinkering with nix, I wanted to use [a flake to manage all the +things](https://github.com/alejandro-angulo/alejandr0angul0.dev/blob/b8174db2150f3ac9925f8450bc75264678cf06c9/flake.nix) +needed for development (including writing posts). + +Here's what the devenv configuration looked like at the time I was writing this +post. + +```nix + devShell = devenv.lib.mkShell { + inherit inputs pkgs; + modules = [ + ({pkgs, ...}: { + languages.javascript = { + enable = true; + npm.install.enable = true; + corepack.enable = true; + }; + + packages = with pkgs; [ + actionlint + alejandra + hugo + html-proofer + awscli2 + ]; + + pre-commit = { + hooks = { + actionlint.enable = true; + alejandra.enable = true; + eslint.enable = true; + markdownlint = { + enable = true; + excludes = ["node_modules"]; + }; + prettier = { + enable = true; + excludes = ["flake.lock"]; + }; + }; + + settings.markdownlint.config = { + MD013.code_blocks = false; + }; + }; + + enterShell = '' + export PATH=./node_modules/.bin:$PATH + ''; + }) + ]; + }; +``` + +This completely configures my development environment! It has all the packages +I want and sets up some pre-commit hooks for me in a single file. I don't need +to manage a `.pre-commit-config.yaml` and an `.mdlrc` file separately (these +files configure [pre-commit](https://pre-commit.com/) and +[markdownlint](https://github.com/markdownlint/markdownlint) respectively). The +best part is that I can easily get this development environment set up on any +machine (assuming I have [nix set up with flakes +support](https://nixos.wiki/wiki/Flakes#Enable_flakes) of course). + +My `flake.nix` can accomplish what would traditionally be done with +[make](https://www.gnu.org/software/make/) and a `Makefile`. This section +handles building the site + +```nix + packages.alejandr0angul0-dot-dev = pkgs.stdenv.mkDerivation { + name = "alejandr0angul0-dot-dev"; + src = self; + + buildPhase = '' + ${pkgs.hugo}/bin/hugo --minify + ''; + + doCheck = true; + checkPhase = '' + env LOCALE_ARCHIVE=${utf8Locale}/lib/locale/locale-archive LC_ALL=en_US.UTF-8 \ + ${pkgs.html-proofer}/bin/htmlproofer public \ + --allow-hash-href \ + --ignore-empty-alt \ + --disable-external \ + --no-enforce-https + ''; + + installPhase = '' + cp -r public "$out" + ''; + }; +``` + +This snippet defines how to build a +[derivation](https://nixos.org/manual/nix/stable/language/derivations.html) +that describes the site. It took me a while to make sense of all of this but +basically there are a bunch of [build +phases](https://nixos.org/manual/nixpkgs/stable/#sec-stdenv-phases). I only +needed three phases (build, check, and install). Nothing super special is going +on here. + +I tell `hugo` to build a minified version of the site + +```nix + buildPhase = '' + ${pkgs.hugo}/bin/hugo --minify + ''; +``` + +I enabled an optional check phase which tests the results of the build phase. +Here I run [htmlproofer](https://github.com/gjtorikian/html-proofer) to do some +quick sanity checks (like making sure I don't have broken internal links). + +I did run into a small issue with this. `htmlproofer` was reading file contents +as if it were [US-ASCII](https://en.wikipedia.org/wiki/ASCII) but I have some +unicode characters in my source. The `env` below configures the +[locale](https://wiki.archlinux.org/title/Locale) to be +[UTF-8](https://en.wikipedia.org/wiki/UTF-8). + +```nix + doCheck = true; + checkPhase = '' + env LOCALE_ARCHIVE=${utf8Locale}/lib/locale/locale-archive LC_ALL=en_US.UTF-8 \ + ${pkgs.html-proofer}/bin/htmlproofer public \ + --allow-hash-href \ + --ignore-empty-alt \ + --disable-external \ + --no-enforce-https + ''; +``` + +The results of the build process should live in the `$out` directory. I just +need to move what `hugo` generated (it defaults to creating a `public/` folder) +into `$out`. + +```nix + installPhase = '' + cp -r public "$out" + ''; +``` + +## Updating CI/CD + +This site is deployed to an S3 bucket just like before switching over to using +nix. However, I don't need to use docker containers anymore and can use nix +fully. Here's the [github actions +configuration](https://github.com/alejandro-angulo/alejandr0angul0.dev/blob/97a655bc0c3e18f8c8921b90f14f87f5a07ae837/.github/workflows/ci.yml) +at the time of writing. + +```yaml +name: "CI" + +on: + pull_request: + push: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v22 + - uses: cachix/cachix-action@v12 + with: + name: devenv + - uses: cachix/cachix-action@v12 + with: + name: alejandr0angul0-dev + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + - name: Run pre-commit hooks + run: | + git fetch origin + nix develop --accept-flake-config --impure --command bash -c \ + "pre-commit run --from-ref origin/main --to-ref $GITHUB_SHA" + build: + needs: [lint] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v22 + - uses: cachix/cachix-action@v12 + with: + name: devenv + - uses: cachix/cachix-action@v12 + with: + name: alejandr0angul0-dev + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + - run: nix build --accept-flake-config -L + # Convoluted upload below is a workaround for #92 + # See: + # - https://github.com/actions/upload-artifact/issues/92 + # - https://github.com/actions/upload-artifact/issues/92#issuecomment-1080347032 + - run: echo "UPLOAD_PATH=$(readlink -f result)" >> "$GITHUB_ENV" + - uses: actions/upload-artifact@v3 + with: + name: built-site + path: ${{ env.UPLOAD_PATH }} + + deploy: + needs: [build] + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + env: + PROD_DEPLOY_CONFIG_PATH: config/production/deployment.toml + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} + HUGO_ENV: production + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v22 + - uses: cachix/cachix-action@v12 + with: + name: devenv + - uses: cachix/cachix-action@v12 + with: + name: alejandr0angul0-dev + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + - uses: actions/download-artifact@v3 + with: + name: built-site + path: public/ + - name: Deploy + run: | + sed 's~{{S3URL}}~${{ secrets.S3URL }}~g' "${PROD_DEPLOY_CONFIG_PATH}.sample" > "${PROD_DEPLOY_CONFIG_PATH}" + sed -i 's~{{CLOUDFRONTDISTRIBUTIONID}}~${{ secrets.CLOUDFRONTDISTRIBUTIONID }}~g' "${PROD_DEPLOY_CONFIG_PATH}" + nix develop --accept-flake-config --impure --command bash \ + -c 'hugo deploy --invalidateCDN' +``` + +[cachix](https://www.cachix.org) is a nix binary cache hosting service ran by +[Domen Kožar](https://github.com/domenkozar). (Cachix also happens to be the +entity behind devenv.) They've also provided some github actions to make that +allow me to cache the results of my nix commands to help speed up CI/CD +run times. I'm taking advantage of the +[install-nix-action](https://github.com/cachix/install-nix-action) (installs +nix on the ubuntu runners I'm using) and +[cachix-action](https://github.com/cachix/cachix-action) (gives me access to +the binaries hosted in cachix caches -- the site has its own cache) actions. + +I only have three steps: lint -> build -> deploy. The lint step runs all the +pre-commit hooks I defined in my flake.nix file. I initially ran into errors +telling me that there was no `main` branch so I had to fetch origin and make +sure to explicitly reference the branch's remote (e.g. `origin/main`) . + +```yaml +- name: Run pre-commit hooks + run: | + git fetch origin + nix develop --accept-flake-config --impure --command bash -c \ + "pre-commit run --from-ref origin/main --to-ref $GITHUB_SHA" +``` + +Notice I didn't need to explicitly install `pre-commit`. That happens +automagically when I run `nix develop`. + +Once those checks are ready it's time to make sure the site can be built +successfully. I ran into another snafu with [a bug in github's +`upload-artifacts` +action](https://github.com/actions/upload-artifact/issues/92); luckily +[`exFalso` shared a +workaround](https://github.com/actions/upload-artifact/issues/92#issuecomment-1080347032). + +```yaml +- run: nix build --accept-flake-config -L +# Convoluted upload below is a workaround for #92 +# See: +# - https://github.com/actions/upload-artifact/issues/92 +# - https://github.com/actions/upload-artifact/issues/92#issuecomment-1080347032 +- run: echo "UPLOAD_PATH=$(readlink -f result)" >> "$GITHUB_ENV" +- uses: actions/upload-artifact@v3 + with: + name: built-site + path: ${{ env.UPLOAD_PATH }} +``` + +Building the site (running `hugo`, `htmlproofer`, and whatever else I decide to +add to my build process) is done with a single call to `nix build`. The output +lives in a `result/` directory which I upload as [a build +artifact](https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts) +so it can be deployed later (if the commit being checked is on the `main` +branch). + +The deploy step configures some secrets and uses hugo's provided deploy subcommand. + +```yaml +- uses: actions/download-artifact@v3 + with: + name: built-site + path: public/ +- name: Deploy + run: | + sed 's~{{S3URL}}~${{ secrets.S3URL }}~g' "${PROD_DEPLOY_CONFIG_PATH}.sample" > "${PROD_DEPLOY_CONFIG_PATH}" + sed -i 's~{{CLOUDFRONTDISTRIBUTIONID}}~${{ secrets.CLOUDFRONTDISTRIBUTIONID }}~g' "${PROD_DEPLOY_CONFIG_PATH}" + nix develop --accept-flake-config --impure --command bash \ + -c 'hugo deploy --invalidateCDN' +``` + +## "...cool I guess?" + +So yeah, I have exactly the same site now. Nothing changes from a reader's +perspective but this scratched my tinkering itch. diff --git a/flake.lock b/flake.lock index 1a3bf73..b69243c 100644 --- a/flake.lock +++ b/flake.lock @@ -1,22 +1,158 @@ { "nodes": { - "devenv": { + "cachix": { "inputs": { - "flake-compat": "flake-compat", - "nix": "nix", - "nixpkgs": "nixpkgs", - "pre-commit-hooks": "pre-commit-hooks" + "devenv": "devenv_2", + "flake-compat": [ + "devenv", + "flake-compat" + ], + "git-hooks": [ + "devenv", + "pre-commit-hooks" + ], + "nixpkgs": [ + "devenv", + "nixpkgs" + ] }, "locked": { - "lastModified": 1692203620, - "narHash": "sha256-9SF/H8oCWv166q5o+JtV7tK+koydgFMu02HCB27UWpU=", + "lastModified": 1726520618, + "narHash": "sha256-jOsaBmJ/EtX5t/vbylCdS7pWYcKGmWOKg4QKUzKr6dA=", "owner": "cachix", - "repo": "devenv", - "rev": "eee80243720b7f284128873a9694a520d9967b2f", + "repo": "cachix", + "rev": "695525f9086542dfb09fde0871dbf4174abbf634", "type": "github" }, "original": { "owner": "cachix", + "repo": "cachix", + "type": "github" + } + }, + "cachix_2": { + "inputs": { + "devenv": "devenv_3", + "flake-compat": [ + "devenv", + "cachix", + "devenv", + "flake-compat" + ], + "nixpkgs": [ + "devenv", + "cachix", + "devenv", + "nixpkgs" + ], + "pre-commit-hooks": [ + "devenv", + "cachix", + "devenv", + "pre-commit-hooks" + ] + }, + "locked": { + "lastModified": 1712055811, + "narHash": "sha256-7FcfMm5A/f02yyzuavJe06zLa9hcMHsagE28ADcmQvk=", + "owner": "cachix", + "repo": "cachix", + "rev": "02e38da89851ec7fec3356a5c04bc8349cae0e30", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "cachix", + "type": "github" + } + }, + "devenv": { + "inputs": { + "cachix": "cachix", + "flake-compat": "flake-compat_2", + "nix": "nix_3", + "nixpkgs": "nixpkgs_3", + "pre-commit-hooks": "pre-commit-hooks_2" + }, + "locked": { + "lastModified": 1730213537, + "narHash": "sha256-bWoeNdFISbGK8M0Xw4edmManGCkJ1oNqbfNY0Hlv9Vc=", + "owner": "cachix", + "repo": "devenv", + "rev": "5c046eeafd13f7a2b9fc733f70ea17571b24410f", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "devenv_2": { + "inputs": { + "cachix": "cachix_2", + "flake-compat": [ + "devenv", + "cachix", + "flake-compat" + ], + "nix": "nix_2", + "nixpkgs": [ + "devenv", + "cachix", + "nixpkgs" + ], + "pre-commit-hooks": [ + "devenv", + "cachix", + "git-hooks" + ] + }, + "locked": { + "lastModified": 1723156315, + "narHash": "sha256-0JrfahRMJ37Rf1i0iOOn+8Z4CLvbcGNwa2ChOAVrp/8=", + "owner": "cachix", + "repo": "devenv", + "rev": "ff5eb4f2accbcda963af67f1a1159e3f6c7f5f91", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "devenv_3": { + "inputs": { + "flake-compat": [ + "devenv", + "cachix", + "devenv", + "cachix", + "flake-compat" + ], + "nix": "nix", + "nixpkgs": "nixpkgs", + "poetry2nix": "poetry2nix", + "pre-commit-hooks": [ + "devenv", + "cachix", + "devenv", + "cachix", + "pre-commit-hooks" + ] + }, + "locked": { + "lastModified": 1708704632, + "narHash": "sha256-w+dOIW60FKMaHI1q5714CSibk99JfYxm0CzTinYWr+Q=", + "owner": "cachix", + "repo": "devenv", + "rev": "2ee4450b0f4b95a1b90f2eb5ffea98b90e48c196", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "python-rewrite", "repo": "devenv", "type": "github" } @@ -37,16 +173,54 @@ "type": "github" } }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "devenv", + "nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712014858, + "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" }, "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", "owner": "numtide", "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", "type": "github" }, "original": { @@ -56,15 +230,30 @@ } }, "flake-utils_2": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { "inputs": { "systems": "systems_2" }, "locked": { - "lastModified": 1689068808, - "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", "type": "github" }, "original": { @@ -82,11 +271,11 @@ ] }, "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", "owner": "hercules-ci", "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", "type": "github" }, "original": { @@ -95,53 +284,142 @@ "type": "github" } }, - "lowdown-src": { + "libgit2": { "flake": false, "locked": { - "lastModified": 1633514407, - "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", - "owner": "kristapsdz", - "repo": "lowdown", - "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", + "lastModified": 1697646580, + "narHash": "sha256-oX4Z3S9WtJlwvj0uH9HlYcWv+x1hqp8mhXl7HsLu2f0=", + "owner": "libgit2", + "repo": "libgit2", + "rev": "45fd9ed7ae1a9b74b957ef4f337bc3c8b3df01b5", "type": "github" }, "original": { - "owner": "kristapsdz", - "repo": "lowdown", + "owner": "libgit2", + "repo": "libgit2", "type": "github" } }, "nix": { "inputs": { - "lowdown-src": "lowdown-src", + "flake-compat": "flake-compat", "nixpkgs": [ + "devenv", + "cachix", + "devenv", + "cachix", "devenv", "nixpkgs" ], "nixpkgs-regression": "nixpkgs-regression" }, "locked": { - "lastModified": 1676545802, - "narHash": "sha256-EK4rZ+Hd5hsvXnzSzk2ikhStJnD63odF7SzsQ8CuSPU=", + "lastModified": 1712911606, + "narHash": "sha256-BGvBhepCufsjcUkXnEEXhEVjwdJAwPglCC2+bInc794=", "owner": "domenkozar", "repo": "nix", - "rev": "7c91803598ffbcfe4a55c44ac6d49b2cf07a527f", + "rev": "b24a9318ea3f3600c1e24b4a00691ee912d4de12", "type": "github" }, "original": { "owner": "domenkozar", - "ref": "relaxed-flakes", + "ref": "devenv-2.21", + "repo": "nix", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "devenv", + "cachix", + "devenv", + "cachix", + "devenv", + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1688870561, + "narHash": "sha256-4UYkifnPEw1nAzqqPOTL2MvWtm3sNGw1UTYTalkTcGY=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "165b1650b753316aa7f1787f3005a8d2da0f5301", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nix_2": { + "inputs": { + "flake-compat": [ + "devenv", + "cachix", + "devenv", + "flake-compat" + ], + "nixpkgs": [ + "devenv", + "cachix", + "devenv", + "nixpkgs" + ], + "nixpkgs-regression": "nixpkgs-regression_2" + }, + "locked": { + "lastModified": 1712911606, + "narHash": "sha256-BGvBhepCufsjcUkXnEEXhEVjwdJAwPglCC2+bInc794=", + "owner": "domenkozar", + "repo": "nix", + "rev": "b24a9318ea3f3600c1e24b4a00691ee912d4de12", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "devenv-2.21", + "repo": "nix", + "type": "github" + } + }, + "nix_3": { + "inputs": { + "flake-compat": [ + "devenv", + "flake-compat" + ], + "flake-parts": "flake-parts", + "libgit2": "libgit2", + "nixpkgs": "nixpkgs_2", + "nixpkgs-23-11": "nixpkgs-23-11", + "nixpkgs-regression": "nixpkgs-regression_3", + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1727438425, + "narHash": "sha256-X8ES7I1cfNhR9oKp06F6ir4Np70WGZU5sfCOuNBEwMg=", + "owner": "domenkozar", + "repo": "nix", + "rev": "f6c5ae4c1b2e411e6b1e6a8181cc84363d6a7546", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "devenv-2.24", "repo": "nix", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1678875422, - "narHash": "sha256-T3o6NcQPwXjxJMn2shz86Chch4ljXgZn746c2caGxd8=", + "lastModified": 1692808169, + "narHash": "sha256-x9Opq06rIiwdwGeK2Ykj69dNc2IvUH1fY55Wm7atwrE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "126f49a01de5b7e35a43fd43f891ecf6d3a51459", + "rev": "9201b5ff357e781bf014d0330d18555695df7ba8", "type": "github" }, "original": { @@ -151,6 +429,22 @@ "type": "github" } }, + "nixpkgs-23-11": { + "locked": { + "lastModified": 1717159533, + "narHash": "sha256-oamiKNfr2MS6yH64rUn99mIZjc45nGJlj9eGth/3Xuw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446", + "type": "github" + } + }, "nixpkgs-regression": { "locked": { "lastModified": 1643052045, @@ -167,29 +461,93 @@ "type": "github" } }, - "nixpkgs-stable": { + "nixpkgs-regression_2": { "locked": { - "lastModified": 1685801374, - "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-23.05", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgs-regression_3": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1720386169, + "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_2": { "locked": { - "lastModified": 1692174805, - "narHash": "sha256-xmNPFDi/AUMIxwgOH/IVom55Dks34u1g7sFKKebxUm0=", + "lastModified": 1717432640, + "narHash": "sha256-+f9c4/ZX5MWDOuB1rKoWj+lBNm0z0rs4CK47HBLxy1o=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "caac0eb6bdcad0b32cb2522e03e4002c8975c62e", + "rev": "88269ab3044128b7c2f4c7d68448b2fb50456870", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "release-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1716977621, + "narHash": "sha256-Q1UQzYcMJH4RscmpTkjlgqQDX5yi1tZL0O345Ri6vXQ=", + "owner": "cachix", + "repo": "devenv-nixpkgs", + "rev": "4267e705586473d3e5c8d50299e71503f16a6fb6", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "rolling", + "repo": "devenv-nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1729880355, + "narHash": "sha256-RP+OQ6koQQLX5nw0NmcDrzvGL8HDLnyXt/jHhL1jwjM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "18536bf04cd71abd345f9579158841376fdd0c5a", "type": "github" }, "original": { @@ -199,13 +557,75 @@ "type": "github" } }, + "poetry2nix": { + "inputs": { + "flake-utils": "flake-utils", + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "devenv", + "cachix", + "devenv", + "cachix", + "devenv", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1692876271, + "narHash": "sha256-IXfZEkI0Mal5y1jr6IRWMqK8GW2/f28xJenZIPQqkY0=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "d5006be9c2c2417dafb2e2e5034d83fabd207ee3", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, "pre-commit-hooks": { + "inputs": { + "flake-compat": [ + "devenv", + "nix" + ], + "flake-utils": "flake-utils_2", + "gitignore": [ + "devenv", + "nix" + ], + "nixpkgs": [ + "devenv", + "nix", + "nixpkgs" + ], + "nixpkgs-stable": [ + "devenv", + "nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712897695, + "narHash": "sha256-nMirxrGteNAl9sWiOhoN5tIHyjBbVi5e2tgZUgZlK3Y=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "40e6053ecb65fcbf12863338a6dcefb3f55f1bf8", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "pre-commit-hooks_2": { "inputs": { "flake-compat": [ "devenv", "flake-compat" ], - "flake-utils": "flake-utils", "gitignore": "gitignore", "nixpkgs": [ "devenv", @@ -214,11 +634,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1688056373, - "narHash": "sha256-2+SDlNRTKsgo3LBRiMUcoEUb6sDViRNQhzJquZ4koOI=", + "lastModified": 1726745158, + "narHash": "sha256-D5AegvGoEjt4rkKedmxlSEmC+nNLMBPWFxvmYnVLhjk=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "5843cf069272d92b60c3ed9e55b7a8989c01d4c7", + "rev": "4e743a6920eab45e8ba0fbe49dc459f1423a4b74", "type": "github" }, "original": { @@ -230,8 +650,8 @@ "root": { "inputs": { "devenv": "devenv", - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_2" + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_4" } }, "systems": { diff --git a/flake.nix b/flake.nix index c87f1cd..f46ad3d 100644 --- a/flake.nix +++ b/flake.nix @@ -49,6 +49,10 @@ ''; }; + # Workaround for cachix/devenv#756 + # See here: https://github.com/cachix/devenv/issues/756 + packages.devenv-up = self.devShell.${system}.config.procfileScript; + defaultPackage = self.packages.${system}.alejandr0angul0-dot-dev; apps = rec { @@ -82,6 +86,9 @@ markdownlint = { enable = true; excludes = ["node_modules"]; + settings.configuration = { + MD013.code_blocks = false; + }; }; prettier = { enable = true; @@ -90,6 +97,8 @@ }; }; + processes.hugo-server.exec = "${pkgs.hugo}/bin/hugo server"; + enterShell = '' export PATH=./node_modules/.bin:$PATH ''; diff --git a/themes/alejandro-angulo/assets/css/main.css b/themes/alejandro-angulo/assets/css/main.css index 7582679..921a4bc 100644 --- a/themes/alejandro-angulo/assets/css/main.css +++ b/themes/alejandro-angulo/assets/css/main.css @@ -1,9 +1,19 @@ +:root { + --main-page-max-width: 1000px; +} + body { background-color: #1d2021; color: #ffffdf; margin: 1em; - max-width: 800px; + max-width: var(--main-page-max-width); margin: 1em auto 0; + font-family: OpenSans, sans-serif; + font-size: 1.2em; +} + +pre, +code { font-family: Hack, monospace; } @@ -12,12 +22,16 @@ body { font-size: 20px; } +i.fab { + font-style: normal; +} + a { color: #00a7af; padding: 0.1em; } a:visited { - color: #005f87; + color: #961ee1; } a:hover { background-color: #00a7af; @@ -45,7 +59,7 @@ a:hover { } #banner { - max-width: 800px; + max-width: var(--main-page-max-width); margin: 0 auto; padding: 0.3em 0; } diff --git a/themes/alejandro-angulo/assets/css/opensans.css b/themes/alejandro-angulo/assets/css/opensans.css new file mode 100644 index 0000000..7be70cb --- /dev/null +++ b/themes/alejandro-angulo/assets/css/opensans.css @@ -0,0 +1,37 @@ +/*! + * Open Sans typeface https://github.com/FontFaceKit/open-sans + * License: ??? + */ +/* FONT PATHS + * -------------------------- */ +@font-face { + font-family: "OpenSans"; + src: url("/fonts/OpenSans-Regular.woff2") format("woff2"); + font-weight: 400; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: "OpenSans"; + src: url("/fonts/OpenSans-Bold.woff2") format("woff2"); + font-weight: 700; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: "OpenSans"; + src: url("/fonts/OpenSans-Italic.woff2") format("woff2"); + font-weight: 400; + font-style: italic; + font-display: swap; +} + +@font-face { + font-family: "OpenSans"; + src: url("/fonts/OpenSans-BoldItalic.woff2") format("woff2"); + font-weight: 700; + font-style: italic; + font-display: swap; +} diff --git a/themes/alejandro-angulo/layouts/partials/head.html b/themes/alejandro-angulo/layouts/partials/head.html index b8faee8..3de2f10 100644 --- a/themes/alejandro-angulo/layouts/partials/head.html +++ b/themes/alejandro-angulo/layouts/partials/head.html @@ -4,21 +4,22 @@ {{ $main_style := resources.Get "css/main.css" | minify }} {{ $highlight_style := resources.Get "css/highlight.css" | minify }} - {{ $css := slice $main_style $highlight_style | resources.Concat "css/style.css" | fingerprint }} + {{ $opensans_style := resources.Get "css/opensans.css" | minify }} + {{ $css := slice $main_style $highlight_style $opensans_style | resources.Concat "css/style.css" | fingerprint }}