diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..2247d26 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_size = 2 +indent_style = space +max_line_length = 120 +trim_trailing_whitespace = true + +[*.adoc] +indent_size = unset + +[*.{adoc,envrc,nu,html}] +max_line_length = off + +[{justfile,.justfile,*.just}] +indent_size = 4 diff --git a/.github/workflows/format-just.yaml b/.github/workflows/format-just.yaml deleted file mode 100644 index ee8d9cb..0000000 --- a/.github/workflows/format-just.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: Format justfiles -"on": - pull_request: - branches: ["main"] - paths: - - .github/workflows/format-just.yaml - - flake.lock - - '**/.justfile' - - '**/justfile' - - '**/*.just' - -jobs: - format-just: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: DeterminateSystems/nix-installer-action@v14 - - uses: DeterminateSystems/magic-nix-cache-action@v8 - - name: Format justfile - run: nix develop --command just --check --fmt --unstable diff --git a/.github/workflows/test-nushell.yaml b/.github/workflows/test-nushell.yaml deleted file mode 100644 index 4553b47..0000000 --- a/.github/workflows/test-nushell.yaml +++ /dev/null @@ -1,18 +0,0 @@ -name: Test Nushell -"on": - pull_request: - branches: ["main"] - paths: - - .github/workflows/test-nushell.yaml - - flake.lock - - '**/*.nu' - -jobs: - test-nushell: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: DeterminateSystems/nix-installer-action@v14 - - uses: DeterminateSystems/magic-nix-cache-action@v8 - - name: Run the Nushell tests - run: nix develop --command nu update-nixos-release-tests.nu diff --git a/.github/workflows/test-update-nix-direnv.yaml b/.github/workflows/test-update-nix-direnv.yaml new file mode 100644 index 0000000..1465960 --- /dev/null +++ b/.github/workflows/test-update-nix-direnv.yaml @@ -0,0 +1,27 @@ +name: Test update-nix-direnv.nu +"on": + pull_request: + branches: ["main"] + paths: + - .github/workflows/test-update-nix-direnv.yaml + - flake.lock + - update-nix-direnv.nu + - update-nix-direnv-tests.nu + push: + branches: ["main"] + paths: + - .github/workflows/test-update-nix-direnv.yaml + - flake.lock + - update-nix-direnv.nu + - update-nix-direnv-tests.nu + workflow_dispatch: + +jobs: + test-update-nix-direnv: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - name: Run the Nushell tests + run: nix develop --command nu update-nix-direnv-tests.nu diff --git a/.github/workflows/test-update-nixos-release.yaml b/.github/workflows/test-update-nixos-release.yaml new file mode 100644 index 0000000..dac5786 --- /dev/null +++ b/.github/workflows/test-update-nixos-release.yaml @@ -0,0 +1,27 @@ +name: Test update-nixos-release.nu +"on": + pull_request: + branches: ["main"] + paths: + - .github/workflows/test-update-nixos-release.yaml + - flake.lock + - update-nixos-release.nu + - update-nixos-release-tests.nu + push: + branches: ["main"] + paths: + - .github/workflows/test-update-nixos-release.yaml + - flake.lock + - update-nixos-release.nu + - update-nixos-release-tests.nu + workflow_dispatch: + +jobs: + test-update-nixos-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - name: Run the Nushell tests + run: nix develop --command nu update-nixos-release-tests.nu diff --git a/.github/workflows/treefmt.yaml b/.github/workflows/treefmt.yaml new file mode 100644 index 0000000..443f9c4 --- /dev/null +++ b/.github/workflows/treefmt.yaml @@ -0,0 +1,21 @@ +name: Check files with treefmt +"on": + pull_request: + branches: ["main"] + push: + branches: ["main"] + +jobs: + treefmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - name: Run treefmt + run: nix develop --command treefmt --fail-on-change --no-cache + - uses: reviewdog/action-suggester@v1 + with: + fail_on_error: true + github_token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} + tool_name: treefmt diff --git a/.github/workflows/pre-commit-autoupdate.yaml b/.github/workflows/update-nix-direnv.yaml similarity index 51% rename from .github/workflows/pre-commit-autoupdate.yaml rename to .github/workflows/update-nix-direnv.yaml index 1c5626b..4ca2b0b 100644 --- a/.github/workflows/pre-commit-autoupdate.yaml +++ b/.github/workflows/update-nix-direnv.yaml @@ -1,9 +1,8 @@ -name: Pre-commit auto-update +name: Update nix-direnv "on": schedule: - # Once a month on the 2nd - - cron: "0 0 2 * *" + - cron: "0 0 16 * *" workflow_dispatch: permissions: @@ -11,21 +10,19 @@ permissions: pull-requests: write jobs: - pre-commit-autoupdate: + update-nix-direnv: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: DeterminateSystems/nix-installer-action@v14 - uses: DeterminateSystems/magic-nix-cache-action@v8 - - name: Update pre-commit hooks - run: nix develop --command pre-commit autoupdate - - name: Run pre-commit hooks - run: nix develop --command pre-commit run --all-files + - name: Update nix-direnv to the latest version + run: nix develop --command nu update-nix-direnv.nu - name: Create Pull Request uses: peter-evans/create-pull-request@v7 with: assignees: ${{ github.repository_owner }} - branch: "update/pre-commit-hooks" - commit-message: "chore(deps): Update pre-commit hooks" - title: "chore(deps): Update pre-commit hooks" + branch: "update/nix-direnv" + commit-message: "chore(deps): Update nix-direnv" + title: "chore(deps): Update nix-direnv" token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} diff --git a/.github/workflows/yamllint.yaml b/.github/workflows/yamllint.yaml index 82ac14f..29a7e39 100644 --- a/.github/workflows/yamllint.yaml +++ b/.github/workflows/yamllint.yaml @@ -6,8 +6,16 @@ name: yamllint - .github/workflows/yamllint.yaml - .yamllint.yaml - flake.lock - - '**.yaml' - - '**.yml' + - "**.yaml" + - "**.yml" + push: + branches: ["main"] + paths: + - .github/workflows/yamllint.yaml + - .yamllint.yaml + - flake.lock + - "**.yaml" + - "**.yml" jobs: yamllint: diff --git a/.gitignore b/.gitignore index 71107d1..d0cf0ee 100644 --- a/.gitignore +++ b/.gitignore @@ -72,3 +72,6 @@ build-iPhoneSimulator/ # Nix result + +# git-hooks.nix +/.pre-commit-config.yaml diff --git a/.ignore b/.ignore new file mode 100644 index 0000000..88cc107 --- /dev/null +++ b/.ignore @@ -0,0 +1,2 @@ +*.jpg +*.png diff --git a/.justfile b/.justfile index 91fbe5d..e923eab 100644 --- a/.justfile +++ b/.justfile @@ -4,7 +4,7 @@ alias f := format alias fmt := format format: - just --fmt --unstable + treefmt alias l := lint @@ -25,6 +25,7 @@ alias t := test test: nu update-nixos-release-tests.nu + nu update-nix-direnv-tests.nu alias u := update alias up := update @@ -34,4 +35,4 @@ update: && build test nix flake update bundle update bundix - pre-commit autoupdate + nu update-nix-direnv.nu diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index e4637a6..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,34 +0,0 @@ -repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 - hooks: - - id: check-byte-order-marker - - id: check-executables-have-shebangs - - id: check-json - - id: check-merge-conflict - - id: check-yaml - args: [--allow-multiple-documents] - - id: end-of-file-fixer - - id: mixed-line-ending - - id: pretty-format-json - args: ["--autofix"] - exclude: ^.vscode/.*\.json$ - - id: trailing-whitespace - - repo: local - hooks: - - id: just - entry: just --fmt --unstable - files: | - (?x)^( - \.justfile| - justfile - )$ - language: system - name: just - pass_filenames: false - - id: yamllint - entry: nix develop --command yamllint - language: system - name: yamllint - pass_filenames: true - types: [file, yaml] diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..4eb4dd5 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +# Ignore HTML documents since they use Liquid templating +**/*.html diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 0000000..f2941de --- /dev/null +++ b/.typos.toml @@ -0,0 +1,11 @@ +[default] +extend-ignore-re = [ + "sha256[[:space:]]*=[[:space:]]*\"[[:alnum:]]+\"", + "SHA256:[[:space:]]*[[a-zA-Z0-9+]]+[[:space:]]*", +] + +[default.extend-identifiers] +96AFE6CB = "96AFE6CB" + +[default.extend-words] +hda = "hda" diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..c7cecc9 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,11 @@ +{ + "recommendations": [ + "ibecker.treefmt-vscode", + "asciidoctor.asciidoctor-vscode", + "mkhl.direnv", + "bbenoist.nix", + "thenuprojectcontributors.vscode-nushell-lang", + "nefrob.vscode-just-syntax", + "tekumara.typos-vscode" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 9b555fb..073d68d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,281 +1,286 @@ { - "cSpell.words": [ - "accountsservices", - "adoc", - "antigenrc", - "Armbian", - "asdf", - "ashift", - "assumeyes", - "audiobooks", - "audiodev", - "autodefrag", - "autofix", - "automount", - "autoremove", - "autoupdate", - "backends", - "backports", - "Bazel", - "blkid", - "blockdev", - "bootable", - "Btrbk", - "Btrbk's", - "btrfs", - "buildtype", - "cachefile", - "canmount", - "Canonical's", - "CDDL", - "cdrom", - "Cflags", - "cgdisk", - "chattr", - "chmod", - "chsh", - "cmake", - "Codeberg", - "codepage", - "conv", - "coreaudio", - "cpuinfo", - "cryptoswap", - "cryptsetup", - "Cryptsetup", - "Cryptsetup's", - "crypttab", - "ctest", - "daemonless", - "datacow", - "datasum", - "dbus", - "deduplication", - "defragment", - "defragmentation", - "Denable", - "deque", - "devel", - "direnv", - "direnvrc", - "dirsync", - "dkms", - "dmask", - "dphys", - "dumpxml", - "egrep", - "elmentary", - "envrc", - "eobundles", - "eval", - "eventmachine", - "exfat", - "fdisk", - "filesystem's", - "filesystems", - "findmnt", - "Flathub", - "Flatpak", - "Flatpaks", - "fmask", - "fsync", - "gdisk", - "gemset", - "Gibibytes", - "GIO's", - "gnupg", - "gsub", - "haswell", - "hfsplus", - "hostfwd", - "idbloader", - "IDE's", - "ifdef", - "ignoreroot", - "Immich", - "includedir", - "inode", - "iocharset", - "justfile", - "jwillikers", - "kdbx", - "keepass", - "keepassxc", - "keyfile", - "keyfiles", - "keyserver", - "kube", - "Kubernetes", - "Kubic", - "labelmap", - "lazytime", - "ldconfig", - "libav", - "libavcodec", - "libblockdev", - "libcamera", - "libdir", - "libjpeg", - "libpam", - "libvirt", - "libvirt's", - "libvirtd", - "linker's", - "lldb", - "llvm", - "longpanda", - "lsblk", - "ltensorflow", - "LUKS", - "LVFS", - "machdep", - "macos", - "Manjaro", - "maxfiles", - "MAXSWAP", - "mkdir", - "mkfs", - "mkntfs", - "mkswap", - "mlocate", - "mmcblk", - "mobilenet", - "mountopt", - "mountpoint", - "multipass", - "MULTIPATH", - "namecase", - "netdev", - "newgrp", - "noatime", - "noauto", - "nocompression", - "nocow", - "nodatacow", - "nodatasum", - "nodecompose", - "nodev", - "nodiratime", - "nodiscard", - "noexec", - "nofail", - "nographic", - "nojoliet", - "noload", - "noninteractive", - "nopasswd", - "nopreview", - "norecover", - "norock", - "nosuid", - "nosymfollow", - "notrunc", - "nouser", - "nproc", - "ntfs", - "oneshot", - "os", - "ostree", - "pacman", - "passwd", - "Phoronix", - "Pinebook", - "pinentry", - "Pipenv", - "Pipfile", - "pkgconfig", - "plist", - "plists", - "Podman", - "Podman's", - "PPA's", - "printf", - "PRUNENAMES", - "qcow", - "qemu", - "Rakefile", - "raspberrypi", - "recordsize", - "refcount", - "refcounts", - "reiserfs", - "relatime", - "robbyrussell", - "rpicam", - "rpool", - "rsync", - "rubygem", - "runtimes", - "sbin", - "setrlimit", - "sgdisk", - "showexec", - "SIGINT", - "snapcraft", - "snapd", - "snaphots", - "SSD's", - "strictatime", - "subcommand", - "subcommands", - "subvol", - "subvolid", - "subvolume", - "subvolumes", - "sudoers", - "swapfile", - "swapfiles", - "swapon", - "SWAPSIZE", - "swapspace", - "symlink", - "symlinks", - "sysconfig", - "sysctl", - "systemctl", - "systemd's", - "syuu", - "tarball's", - "Technica", - "tflite", - "Timeshift", - "TLPUI", - "toolchain", - "udev", - "udevadm", - "udevd", - "udevil", - "udisks", - "udisksctl", - "UEFI", - "uncommented", - "undelete", - "unifi", - "unmount", - "Unmounting", - "unmounts", - "updatedb", - "updatedbconf", - "urandom", - "usefree", - "userdata", - "usermod", - "userspace", - "usesless", - "Ventoy", - "venv", - "vfat", - "virsh", - "virt", - "virtio", - "virtualenv", - "vmnic", - "VTOYEFI", - "whpx", - "xfreerdp", - "xrdp", - "zpool", - "zstd", - "ZSYS" - ] + "files.associations": { + "*.html": "liquid" + }, + "cSpell.words": [ + "accountsservices", + "adoc", + "antigenrc", + "Armbian", + "asdf", + "ashift", + "assumeyes", + "audiobooks", + "audiodev", + "autodefrag", + "autofix", + "automount", + "autoremove", + "autoupdate", + "backends", + "backports", + "Bazel", + "blkid", + "blockdev", + "bootable", + "Btrbk", + "Btrbk's", + "btrfs", + "buildtype", + "cachefile", + "canmount", + "Canonical's", + "CDDL", + "cdrom", + "Cflags", + "cgdisk", + "chattr", + "chmod", + "chsh", + "cmake", + "Codeberg", + "codepage", + "conv", + "coreaudio", + "cpuinfo", + "cryptoswap", + "cryptsetup", + "Cryptsetup", + "Cryptsetup's", + "crypttab", + "ctest", + "daemonless", + "datacow", + "datasum", + "dbus", + "deduplication", + "defragment", + "defragmentation", + "Denable", + "deque", + "devel", + "direnv", + "direnvrc", + "dirsync", + "dkms", + "dmask", + "dphys", + "dumpxml", + "egrep", + "elmentary", + "envrc", + "eobundles", + "eval", + "eventmachine", + "exfat", + "fdisk", + "filesystem's", + "filesystems", + "findmnt", + "Flathub", + "Flatpak", + "Flatpaks", + "fmask", + "fsync", + "gdisk", + "gemset", + "Gibibytes", + "GIO's", + "gnupg", + "gsub", + "haswell", + "hfsplus", + "hostfwd", + "idbloader", + "IDE's", + "ifdef", + "ignoreroot", + "Immich", + "includedir", + "inode", + "iocharset", + "justfile", + "jwillikers", + "kdbx", + "keepass", + "keepassxc", + "keyfile", + "keyfiles", + "keyserver", + "kube", + "Kubernetes", + "Kubic", + "labelmap", + "lazytime", + "ldconfig", + "libav", + "libavcodec", + "libblockdev", + "libcamera", + "libdir", + "libjpeg", + "libpam", + "libvirt", + "libvirt's", + "libvirtd", + "linker's", + "lldb", + "llvm", + "longpanda", + "lsblk", + "ltensorflow", + "LUKS", + "LVFS", + "machdep", + "macos", + "Manjaro", + "maxfiles", + "MAXSWAP", + "mkdir", + "mkfs", + "mkntfs", + "mkswap", + "mlocate", + "mmcblk", + "mobilenet", + "mountopt", + "mountpoint", + "multipass", + "MULTIPATH", + "namecase", + "netdev", + "newgrp", + "nixos", + "noatime", + "noauto", + "nocompression", + "nocow", + "nodatacow", + "nodatasum", + "nodecompose", + "nodev", + "nodiratime", + "nodiscard", + "noexec", + "nofail", + "nographic", + "nojoliet", + "noload", + "noninteractive", + "nopasswd", + "nopreview", + "norecover", + "norock", + "nosuid", + "nosymfollow", + "notrunc", + "nouser", + "nproc", + "ntfs", + "oneshot", + "os", + "ostree", + "pacman", + "passwd", + "Phoronix", + "Pinebook", + "pinentry", + "Pipenv", + "Pipfile", + "pkgconfig", + "plist", + "plists", + "Podman", + "Podman's", + "PPA's", + "printf", + "PRUNENAMES", + "qcow", + "qemu", + "Rakefile", + "raspberrypi", + "recordsize", + "refcount", + "refcounts", + "reiserfs", + "relatime", + "robbyrussell", + "rpicam", + "rpool", + "rsync", + "rubygem", + "runtimes", + "sbin", + "setrlimit", + "sgdisk", + "showexec", + "SIGINT", + "snapcraft", + "snapd", + "snaphots", + "SSD's", + "strictatime", + "subcommand", + "subcommands", + "subvol", + "subvolid", + "subvolume", + "subvolumes", + "sudoers", + "swapfile", + "swapfiles", + "swapon", + "SWAPSIZE", + "swapspace", + "symlink", + "symlinks", + "sysconfig", + "sysctl", + "systemctl", + "systemd's", + "syuu", + "tarball's", + "Technica", + "tflite", + "Timeshift", + "TLPUI", + "toolchain", + "udev", + "udevadm", + "udevd", + "udevil", + "udisks", + "udisksctl", + "UEFI", + "uncommented", + "undelete", + "unifi", + "unmount", + "Unmounting", + "unmounts", + "updatedb", + "updatedbconf", + "urandom", + "usefree", + "userdata", + "usermod", + "userspace", + "usesless", + "Ventoy", + "venv", + "vfat", + "virsh", + "virt", + "virtio", + "virtualenv", + "vmnic", + "VTOYEFI", + "whpx", + "xfreerdp", + "xrdp", + "zpool", + "zstd", + "ZSYS" + ], + "asciidoc.antora.enableAntoraSupport": false } diff --git a/.yamlfmt.yaml b/.yamlfmt.yaml new file mode 100644 index 0000000..0d7c56d --- /dev/null +++ b/.yamlfmt.yaml @@ -0,0 +1,3 @@ +formatter: + type: basic + retain_line_breaks_single: true diff --git a/README.adoc b/README.adoc index 3fe9c6c..90989b7 100644 --- a/README.adoc +++ b/README.adoc @@ -76,13 +76,6 @@ sudo systemctl reboot direnv allow ---- -. Run `pre-commit install` to configure pre-commit hooks in the repository. -+ -[,sh] ----- -pre-commit install ----- - === Build The website can be generated locally with the `jekyll build` command. diff --git a/_config.yml b/_config.yml index fd9591b..4a9acab 100644 --- a/_config.yml +++ b/_config.yml @@ -29,13 +29,10 @@ basewebsite: / url: "https://www.jwillikers.com" repository: "jwillikers/blog" name: >- - Jordan Williams -
- - Creative Commons License -
- + Creative Commons License +
JWillikers by Jordan Williams @@ -56,10 +53,10 @@ collections: pagination: enabled: true per_page: 7 - permalink: '/page:num/' - title: ':title | :num of :max' + permalink: "/page:num/" + title: ":title | :num of :max" limit: 0 - sort_field: 'date' + sort_field: "date" sort_reverse: true defaults: @@ -117,8 +114,8 @@ minimal_mistakes_skin: "dark" read_time: true words_per_minute: 50 search: true -#search_provider: algolia -#algolia: +# search_provider: algolia +# algolia: # application_id: BMA3RTGG4I # index_name: prod_jwillikers # search_only_api_key: 95fa80641d767b8500a5e89ada72c377 @@ -139,7 +136,7 @@ asciidoctor: attributes: icons: font idseparator: - experimental: '' + experimental: "" source-highlighter: rouge pygments-css: style base_dir: :docdir diff --git a/_drafts/dependency_management_for_ruby.adoc b/_drafts/dependency_management_for_ruby.adoc index ecda96a..82e189b 100644 --- a/_drafts/dependency_management_for_ruby.adoc +++ b/_drafts/dependency_management_for_ruby.adoc @@ -6,8 +6,8 @@ date = "2020-10-17" draft = true +++ -Seperating various project dependencies from system dependencies has been a huge software issue for a long time. -There are many methods to acheive this depending on the platfrom and programming language. +Separating various project dependencies from system dependencies has been a huge software issue for a long time. +There are many methods to achieve this depending on the platform and programming language. The tool I use for writing this blog - and lots of documentation - is https://asciidoctor.org/[Asciidoctor]. Asciidoctor is written in https://www.ruby-lang.org/en/[Ruby]. Until recently, I've managed Asciidoctor and other Ruby dependencies at the system level. diff --git a/_includes/footer.html b/_includes/footer.html index 9893c83..8e454c7 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -1,21 +1,37 @@ - {% if site.footer.links %} - {% for link in site.footer.links %} - {% if link.label and link.url %} -
  • {{ link.label }}
  • - {% endif %} - {% endfor %} - {% endif %} - - {% unless site.atom_feed.hide %} -
  • {{ site.data.ui-text[site.locale].feed_label | default: "Feed" }}
  • - {% endunless %} - - - - + diff --git a/_posts/2020-03-28-Unbound Adblock.adoc b/_posts/2020-03-28-Unbound Adblock.adoc index 8232f09..a0657b1 100644 --- a/_posts/2020-03-28-Unbound Adblock.adoc +++ b/_posts/2020-03-28-Unbound Adblock.adoc @@ -114,7 +114,7 @@ table { 8.8.8.8 8.8.4.4 } pass in quick on $lan_if quick inet proto { tcp udp } to port domain rdr-to $lan_dns_server port domain ---- -NOTE: Be careful to position this rule in a place where it is not superceded by a preceding `quick` rule. +NOTE: Be careful to position this rule in a place where it is not superseded by a preceding `quick` rule. My actual configuration is a bit more complex, but I have included it here for reference. diff --git a/_posts/2020-05-24-OpenSMTPD Ubuntu.adoc b/_posts/2020-05-24-OpenSMTPD Ubuntu.adoc index 9b7c38a..85b915e 100644 --- a/_posts/2020-05-24-OpenSMTPD Ubuntu.adoc +++ b/_posts/2020-05-24-OpenSMTPD Ubuntu.adoc @@ -8,7 +8,7 @@ Unfortunately, this isn't always straightforward, especially when you want to se Sending an email directly from your desktop to your email account is likely going to accomplish nothing. The email will likely be blocked since, to your email provider, it is from an unknown source. I ran into this problem recently trying to set up https://www.smartmontools.org/[SmartMonTools] to send an email when it detected hard drive errors. -The https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol[Simple Mail Transfer Protocal (SMTP)] is perfect for getting around this by *relaying* the email through your account from an established email provider. +The https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol[Simple Mail Transfer Protocol (SMTP)] is perfect for getting around this by *relaying* the email through your account from an established email provider. In my instance, I wanted to relay the alert through my GMail account, which has nice support for SMTP. Using an Ubuntu desktop computer, I figured this would be a breeze. diff --git a/_posts/2020-05-25-Automatically Detect and Report Hard Drive Failure.adoc b/_posts/2020-05-25-Automatically Detect and Report Hard Drive Failure.adoc index 9249448..ae75378 100644 --- a/_posts/2020-05-25-Automatically Detect and Report Hard Drive Failure.adoc +++ b/_posts/2020-05-25-Automatically Detect and Report Hard Drive Failure.adoc @@ -8,7 +8,7 @@ Long story short, the hard disk was toast. When I repaired the computer, I decided it would be best to avoid the frustration and confusion of a failing hard drive in the future. So, how does one know if his or her mother-in-law's hard disk is reaching senility? https://www.smartmontools.org/[SmartMonTools] appears to be the best tool for the job. -It's a tool for monitoring and reporting hard disk health with https://en.wikipedia.org/wiki/S.M.A.R.T[Self-Monitoring, Anlysis, and Reporting Technology (SMART)] which is built into most hard drives. +It's a tool for monitoring and reporting hard disk health with https://en.wikipedia.org/wiki/S.M.A.R.T[Self-Monitoring, Analysis, and Reporting Technology (SMART)] which is built into most hard drives. SmartMonTools is even cross-platform and available in package repositories everywhere. == Tutorial diff --git "a/_posts/2020-10-02-\"Too Many Open Files\" on macOS when Compiling.adoc" "b/_posts/2020-10-02-\"Too Many Open Files\" on macOS when Compiling.adoc" index d178a06..f1eef72 100644 --- "a/_posts/2020-10-02-\"Too Many Open Files\" on macOS when Compiling.adoc" +++ "b/_posts/2020-10-02-\"Too Many Open Files\" on macOS when Compiling.adoc" @@ -142,4 +142,4 @@ ulimit -S -n == Conclusion There's a fair bit of work involved for this fix but it is quite robust. -Not only should file process limits not be an issue for you for the forseeable future, you should have gained some valuable insights into macOS service management with `launchd`. +Not only should file process limits not be an issue for you for the foreseeable future, you should have gained some valuable insights into macOS service management with `launchd`. diff --git a/_posts/2020-10-08-Solarized Vim.adoc b/_posts/2020-10-08-Solarized Vim.adoc index e9879ec..7866d41 100644 --- a/_posts/2020-10-08-Solarized Vim.adoc +++ b/_posts/2020-10-08-Solarized Vim.adoc @@ -4,7 +4,7 @@ :page-tags: [BSD, Editor, Linux, macOS, Solarized, Ubuntu, Unix, Vim] I enjoy the https://github.com/altercation/solarized[Solarized] color scheme, so I figured out how to set it up in https://www.vim.org/[Vim]. -The Solarized color scheme provides a https://github.com/altercation/vim-colors-solarized[plugin for Vim], which makes this pretty straightfoward. +The Solarized color scheme provides a https://github.com/altercation/vim-colors-solarized[plugin for Vim], which makes this pretty straightforward. The following instructions detail how to do this on https://ubuntu.com/[Ubuntu] 20.04, but other than the installation step, this should work on any Unix-like system so long as Vim is at least version eight. This guide assumes you are familiar with installing packages from the command-line on Ubuntu, https://git-scm.com/[git], configuring Vim, and https://github.com/vim/vim/blob/856c1110c1cf0d6e44e387b70732/runtime/doc/repeat.txt#L525[using Vim packages].footnote:[https://vi.stackexchange.com/a/9523[Vi and Vim StackExchange: What is the Vim8 package feature and how should I use it?]] diff --git a/_posts/2020-12-07-Backup Git Repositories/update_git_mirrors.fish b/_posts/2020-12-07-Backup Git Repositories/update_git_mirrors.fish index 85030b6..5636fe5 100644 --- a/_posts/2020-12-07-Backup Git Repositories/update_git_mirrors.fish +++ b/_posts/2020-12-07-Backup Git Repositories/update_git_mirrors.fish @@ -1,4 +1,5 @@ -function update_git_mirrors -d "For each directory given, non-recursively update each Git mirror repository directory suffixed with .git" +function update_git_mirrors -d \ + "For each directory given, non-recursively update each Git mirror repository directory suffixed with .git" for dir in $argv if not test -d $dir continue @@ -7,8 +8,8 @@ function update_git_mirrors -d "For each directory given, non-recursively update for mirror in $dir/*.git if test -d $mirror - git -C $mirror remote update --prune >/dev/null - echo "Updated $mirror" + git -C $mirror remote update --prune >/dev/null + echo "Updated $mirror" end end end diff --git a/_posts/2021-02-13-Btrfs Layout.adoc b/_posts/2021-02-13-Btrfs Layout.adoc index c08fb61..f0fa496 100644 --- a/_posts/2021-02-13-Btrfs Layout.adoc +++ b/_posts/2021-02-13-Btrfs Layout.adoc @@ -43,7 +43,7 @@ One of the best features of {Btrfs} is the ability to produce snapshots of data instantaneously. Rollbacks take advantage of Btrfs to revert the system, or any subvolume, to a previous state like before that major kernel update. This is an extremely valuable feature. -Unfortunately, to take advantage of a snapshots and rollbacks properly, the filesystem must be layed out intentionally. +Unfortunately, to take advantage of a snapshots and rollbacks properly, the filesystem must be laid out intentionally. Certain directories need to be left alone during a rollback. You don't want to rollback your system and have your hard-work lost nor do you want to inadvertently destroy critical system logs. Unless your on {openSUSE}, this just isn't done for you on most popular Linux distributions or at least not yet.footnote:[Ubuntu does this for you with {ZFS} and {ZSYS}, but I'm talking about Btrfs here.] diff --git a/assets/css/asciidoctor.css b/assets/css/asciidoctor.css index 8a54cc2..6e42063 100644 --- a/assets/css/asciidoctor.css +++ b/assets/css/asciidoctor.css @@ -5,11 +5,10 @@ span.icon > .fa { text-align: center; height: 80px; width: 80px; - } .admonitionblock td.icon [class^="fa icon-"] { font-size: 2.5em; - text-shadow: 1px 1px 2px rgba(0,0,0,.5); + text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5); cursor: default; } .admonitionblock td.icon .icon-note:before { @@ -18,7 +17,7 @@ span.icon > .fa { } .admonitionblock td.icon .icon-tip:before { content: "\f0eb"; - text-shadow: 1px 1px 2px rgba(155,155,0,.8); + text-shadow: 1px 1px 2px rgba(155, 155, 0, 0.8); color: #b58900; } .admonitionblock td.icon .icon-warning:before { diff --git a/default.nix b/default.nix index 1b93611..5166314 100644 --- a/default.nix +++ b/default.nix @@ -1,13 +1,14 @@ -{ stdenv -, gems -}: +{ stdenv, gems }: stdenv.mkDerivation { pname = "jwillikers-blog"; version = "0.1.0"; src = ./.; - buildInputs = [gems gems.wrappedRuby]; + buildInputs = [ + gems + gems.wrappedRuby + ]; buildPhase = '' jekyll build diff --git a/flake.lock b/flake.lock index ec27125..87bf6cc 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,21 @@ { "nodes": { + "flake-compat": { + "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-utils": { "inputs": { "systems": "systems" @@ -18,13 +34,50 @@ "type": "github" } }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1727672256, - "narHash": "sha256-9/79hjQc9+xyH+QxeMcRsA6hDyw6Z9Eo1/oxjvwirLk=", + "lastModified": 1728328465, + "narHash": "sha256-a0a0M1TmXMK34y3M0cugsmpJ4FJPT/xsblhpiiX1CXo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1bfbbbe5bbf888d675397c66bfdb275d0b99361c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1720386169, + "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1719f27dd95fd4206afb9cec9f415b539978827e", + "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", "type": "github" }, "original": { @@ -34,10 +87,51 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1726871744, + "narHash": "sha256-V5LpfdHyQkUF7RfOaDPrZDP+oqz88lTJrMT1+stXNwo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a1d92660c6b3b7c26fb883500a80ea9d33321be2", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1728092656, + "narHash": "sha256-eMeCTJZ5xBeQ0f9Os7K8DThNVSo9gy4umZLDfF5q6OM=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "1211305a5b237771e13fcca0c51e60ad47326a9a", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks", + "treefmt-nix": "treefmt-nix" } }, "systems": { @@ -54,6 +148,24 @@ "repo": "default", "type": "github" } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1727984844, + "narHash": "sha256-xpRqITAoD8rHlXQafYZOLvUXCF6cnZkPfoq67ThN0Hc=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "4446c7a6fc0775df028c5a3f6727945ba8400e64", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index ba9457e..39d1645 100644 --- a/flake.nix +++ b/flake.nix @@ -1,54 +1,127 @@ { inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + pre-commit-hooks = { + url = "github:cachix/pre-commit-hooks.nix"; + inputs = { + nixpkgs.follows = "nixpkgs"; + }; + }; + treefmt-nix.url = "github:numtide/treefmt-nix"; }; - outputs = { self, nixpkgs, flake-utils }: - flake-utils.lib.eachDefaultSystem - (system: - let - overlays = [ - ]; - pkgs = import nixpkgs { - inherit system overlays; - }; - gems = pkgs.bundlerEnv { - name = "jwillikers-blog"; - gemdir = ./.; - extraConfigPaths = [ "${./.}/.ruby-version" ]; + outputs = + { + self, + flake-utils, + nixpkgs, + pre-commit-hooks, + treefmt-nix, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + overlays = [ ]; + pkgs = import nixpkgs { inherit system overlays; }; + gems = pkgs.bundlerEnv { + name = "jwillikers-blog"; + gemdir = ./.; + extraConfigPaths = [ "${./.}/.ruby-version" ]; + }; + nativeBuildInputs = with pkgs; [ + fish + gems + gems.wrappedRuby + just + nushell + ]; + buildInputs = with pkgs; [ ]; + treefmt = { + config = { + programs = { + actionlint.enable = true; + jsonfmt.enable = true; + just.enable = true; + nixfmt.enable = true; + prettier.enable = true; + typos.enable = true; + yamlfmt.enable = true; + }; + projectRootFile = "flake.nix"; }; - nativeBuildInputs = with pkgs; [ - gems - gems.wrappedRuby - fish - just - nushell - pre-commit - yamllint - ]; - buildInputs = with pkgs; [ - ]; - in - with pkgs; - { - devShells.default = mkShell { - inherit buildInputs nativeBuildInputs; + }; + treefmtEval = treefmt-nix.lib.evalModule pkgs treefmt; + pre-commit = pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { + check-executables-have-shebangs.enable = true; + + # todo Not integrated with Nix? + check-format = { + enable = true; + entry = "${treefmtEval.config.build.wrapper}/bin/treefmt --fail-on-change"; + }; + + check-json.enable = true; + check-toml.enable = true; + check-yaml.enable = true; + detect-private-keys.enable = true; + editorconfig-checker.enable = true; + end-of-file-fixer.enable = true; + fix-byte-order-marker.enable = true; + # todo Broken for 24.05 branch + # flake-checker.enable = true; + mixed-line-endings.enable = true; + + strip-location-metadata = { + name = "Strip location metadata"; + description = "Strip geolocation metadata from image files"; + enable = true; + entry = "${pkgs.exiftool}/bin/exiftool -duplicates -overwrite_original '-gps*='"; + package = pkgs.exiftool; + types = [ "image" ]; + }; + + trim-trailing-whitespace.enable = true; + yamllint.enable = true; }; - packages.default = callPackage ./default.nix { inherit gems; }; - apps = { - default = let + }; + in + with pkgs; + { + apps = { + default = + let script = pkgs.writeShellApplication { name = "serve"; - runtimeInputs = with pkgs; [gems gems.wrappedRuby]; + runtimeInputs = with pkgs; [ + gems + gems.wrappedRuby + ]; text = '' jekyll serve --destination ${self.packages.${system}.default}/srv --open-url --skip-initial-build ''; }; - in { + in + { type = "app"; program = "${script}/bin/serve"; }; - }; - } - ); + }; + devShells.default = mkShell { + inherit buildInputs; + inherit (pre-commit) shellHook; + nativeBuildInputs = + nativeBuildInputs + ++ [ + treefmtEval.config.build.wrapper + # Make formatters available for IDE's. + (lib.attrValues treefmtEval.config.build.programs) + ] + ++ pre-commit.enabledPackages; + }; + packages.default = callPackage ./default.nix { inherit gems; }; + formatter = treefmtEval.config.build.wrapper; + } + ); } diff --git a/gemset.nix b/gemset.nix index 287126d..da5feec 100644 --- a/gemset.nix +++ b/gemset.nix @@ -1,548 +1,692 @@ { addressable = { - dependencies = ["public_suffix"]; - groups = ["default" "jekyll_plugins"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; + dependencies = [ "public_suffix" ]; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; sha256 = "0cl2qpvwiffym62z991ynks7imsm87qmgxf0yfsmlwzkgi9qcaa6"; type = "gem"; }; version = "2.8.7"; }; asciidoctor = { - groups = ["default" "jekyll_plugins"]; - platforms = []; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1wyxgwmnz9bw377r3lba26b090hbsq9qnbw8575a1prpy83qh82j"; type = "gem"; }; version = "2.0.23"; }; bigdecimal = { - groups = ["default" "jekyll_plugins"]; - platforms = []; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1gi7zqgmqwi5lizggs1jhc3zlwaqayy9rx2ah80sxy24bbnng558"; type = "gem"; }; version = "3.1.8"; }; coderay = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0jvxqxzply1lwp7ysn94zjhh57vc14mcshw1ygw14ib8lhc00lyw"; type = "gem"; }; version = "1.1.3"; }; colorator = { - groups = ["default" "jekyll_plugins"]; - platforms = []; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0f7wvpam948cglrciyqd798gdc6z3cfijciavd0dfixgaypmvy72"; type = "gem"; }; version = "1.1.0"; }; concurrent-ruby = { - groups = ["default" "jekyll_plugins"]; - platforms = []; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0chwfdq2a6kbj6xz9l6zrdfnyghnh32si82la1dnpa5h75ir5anl"; type = "gem"; }; version = "1.3.4"; }; em-websocket = { - dependencies = ["eventmachine" "http_parser.rb"]; - groups = ["default" "jekyll_plugins"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; + dependencies = [ + "eventmachine" + "http_parser.rb" + ]; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; sha256 = "1a66b0kjk6jx7pai9gc7i27zd0a128gy73nmas98gjz6wjyr4spm"; type = "gem"; }; version = "0.5.3"; }; eventmachine = { - groups = ["default" "jekyll_plugins"]; - platforms = []; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0wh9aqb0skz80fhfn66lbpr4f86ya2z5rx6gm5xlfhd05bj1ch4r"; type = "gem"; }; version = "1.2.7"; }; faraday = { - dependencies = ["faraday-net_http" "json" "logger"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; + dependencies = [ + "faraday-net_http" + "json" + "logger" + ]; + groups = [ "default" ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; sha256 = "05s5pyxh7y68jphb0lgrh0ksxbp4lmbsc6a6qg0ahj15pjqx01ni"; type = "gem"; }; version = "2.12.0"; }; faraday-net_http = { - dependencies = ["net-http"]; - groups = ["default"]; - platforms = []; + dependencies = [ "net-http" ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0rg54k4skaz8z7j358p6pdzc9pr84fjq7sdlpicf7s5ig7vb1rlk"; type = "gem"; }; version = "3.3.0"; }; ffi = { - groups = ["default" "jekyll_plugins"]; - platforms = []; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "07139870npj59jnl8vmk39ja3gdk3fb5z9vc0lf32y2h891hwqsi"; type = "gem"; }; version = "1.17.0"; }; forwardable-extended = { - groups = ["default" "jekyll_plugins"]; - platforms = []; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "15zcqfxfvsnprwm8agia85x64vjzr2w0xn9vxfnxzgcv8s699v0v"; type = "gem"; }; version = "2.6.0"; }; google-protobuf = { - dependencies = ["bigdecimal" "rake"]; - groups = ["default" "jekyll_plugins"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; + dependencies = [ + "bigdecimal" + "rake" + ]; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; sha256 = "0acw51kaavvfkwp748azahlcb3rhv6zjipdlb4nzqcxwcr2vnhb8"; type = "gem"; }; version = "4.28.2"; }; "http_parser.rb" = { - groups = ["default" "jekyll_plugins"]; - platforms = []; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1gj4fmls0mf52dlr928gaq0c0cb0m3aqa9kaa6l0ikl2zbqk42as"; type = "gem"; }; version = "0.8.0"; }; i18n = { - dependencies = ["concurrent-ruby"]; - groups = ["default" "jekyll_plugins"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; + dependencies = [ "concurrent-ruby" ]; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; sha256 = "0k31wcgnvcvd14snz0pfqj976zv6drfsnq6x8acz10fiyms9l8nw"; type = "gem"; }; version = "1.14.6"; }; jekyll = { - dependencies = ["addressable" "colorator" "em-websocket" "i18n" "jekyll-sass-converter" "jekyll-watch" "kramdown" "kramdown-parser-gfm" "liquid" "mercenary" "pathutil" "rouge" "safe_yaml" "terminal-table" "webrick"]; - groups = ["default" "jekyll_plugins"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; + dependencies = [ + "addressable" + "colorator" + "em-websocket" + "i18n" + "jekyll-sass-converter" + "jekyll-watch" + "kramdown" + "kramdown-parser-gfm" + "liquid" + "mercenary" + "pathutil" + "rouge" + "safe_yaml" + "terminal-table" + "webrick" + ]; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; sha256 = "0124fnqizh7njn99qg4f3jvf9kg2rpm88drs9p9r5hqr50n2i264"; type = "gem"; }; version = "4.3.4"; }; jekyll-archives = { - dependencies = ["jekyll"]; - groups = ["jekyll_plugins"]; - platforms = []; + dependencies = [ "jekyll" ]; + groups = [ "jekyll_plugins" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0c2rks7xf6ajp18h4f4wmmbqm5ljprv70bqcz2sabi17zncmz9n0"; type = "gem"; }; version = "2.2.1"; }; jekyll-asciidoc = { - dependencies = ["asciidoctor" "jekyll"]; - groups = ["jekyll_plugins"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; + dependencies = [ + "asciidoctor" + "jekyll" + ]; + groups = [ "jekyll_plugins" ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; sha256 = "0mpjgwswyxlxqazv3nsafajxhn6b5mqa2kfnzjr6r1hqg7dgn0mh"; type = "gem"; }; version = "3.0.1"; }; jekyll-feed = { - dependencies = ["jekyll"]; - groups = ["jekyll_plugins"]; - platforms = []; + dependencies = [ "jekyll" ]; + groups = [ "jekyll_plugins" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1hzwmjrxi57x68i7jx5rxi8qlcbqcbg3di55wywrp53pr0bap6k8"; type = "gem"; }; version = "0.17.0"; }; jekyll-gist = { - dependencies = ["octokit"]; - groups = ["default"]; - platforms = []; + dependencies = [ "octokit" ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "03wz9j6yq3552nzf4g71qrdm9pfdgbm68abml9sjjgiaan1n8ns9"; type = "gem"; }; version = "1.5.0"; }; jekyll-include-cache = { - dependencies = ["jekyll"]; - groups = ["jekyll_plugins"]; - platforms = []; + dependencies = [ "jekyll" ]; + groups = [ "jekyll_plugins" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "01d2l6qrmjc42664ns83cv36jbvalcxqbkmj5i22fakka7jvkm67"; type = "gem"; }; version = "0.2.1"; }; jekyll-paginate = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0r7bcs8fq98zldih4787zk5i9w24nz5wa26m84ssja95n3sas2l8"; type = "gem"; }; version = "1.1.0"; }; jekyll-paginate-v2 = { - dependencies = ["jekyll"]; - groups = ["jekyll_plugins"]; - platforms = []; + dependencies = [ "jekyll" ]; + groups = [ "jekyll_plugins" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1qzlqhpiqz28624fp0ak76hfy7908w6kpx62v7z43aiwjv0yc6q0"; type = "gem"; }; version = "3.0.0"; }; jekyll-postfiles = { - dependencies = ["jekyll"]; - groups = ["jekyll_plugins"]; - platforms = []; + dependencies = [ "jekyll" ]; + groups = [ "jekyll_plugins" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0l8n0qwn6cr5mqhjzi4v8z1gm6d4f0rjpc6745vkm5b9kv3vjpii"; type = "gem"; }; version = "3.1.0"; }; jekyll-sass-converter = { - dependencies = ["sass-embedded"]; - groups = ["default" "jekyll_plugins"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; + dependencies = [ "sass-embedded" ]; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; sha256 = "00n9v19h0qgjijygfdkdh2gwpmdlz49nw1mqk6fnp43f317ngrz2"; type = "gem"; }; version = "3.0.0"; }; jekyll-seo-tag = { - dependencies = ["jekyll"]; - groups = ["jekyll_plugins"]; - platforms = []; + dependencies = [ "jekyll" ]; + groups = [ "jekyll_plugins" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0638mqhqynghnlnaz0xi1kvnv53wkggaq94flfzlxwandn8x2biz"; type = "gem"; }; version = "2.8.0"; }; jekyll-sitemap = { - dependencies = ["jekyll"]; - groups = ["jekyll_plugins"]; - platforms = []; + dependencies = [ "jekyll" ]; + groups = [ "jekyll_plugins" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0622rwsn5i0m5xcyzdn86l68wgydqwji03lqixdfm1f1xdfqrq0d"; type = "gem"; }; version = "1.4.0"; }; jekyll-watch = { - dependencies = ["listen"]; - groups = ["default" "jekyll_plugins"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; + dependencies = [ "listen" ]; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; sha256 = "1qd7hy1kl87fl7l0frw5qbn22x7ayfzlv9a5ca1m59g0ym1ysi5w"; type = "gem"; }; version = "2.2.1"; }; json = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0b4qsi8gay7ncmigr0pnbxyb17y3h8kavdyhsh7nrlqwr35vb60q"; type = "gem"; }; version = "2.7.2"; }; kramdown = { - dependencies = ["rexml"]; - groups = ["default" "jekyll_plugins"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; + dependencies = [ "rexml" ]; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; sha256 = "1ic14hdcqxn821dvzki99zhmcy130yhv5fqfffkcf87asv5mnbmn"; type = "gem"; }; version = "2.4.0"; }; kramdown-parser-gfm = { - dependencies = ["kramdown"]; - groups = ["default" "jekyll_plugins"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; + dependencies = [ "kramdown" ]; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; sha256 = "0a8pb3v951f4x7h968rqfsa19c8arz21zw1vaj42jza22rap8fgv"; type = "gem"; }; version = "1.1.0"; }; liquid = { - groups = ["default" "jekyll_plugins"]; - platforms = []; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1czxv2i1gv3k7hxnrgfjb0z8khz74l4pmfwd70c7kr25l2qypksg"; type = "gem"; }; version = "4.0.4"; }; listen = { - dependencies = ["rb-fsevent" "rb-inotify"]; - groups = ["default" "jekyll_plugins"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; + dependencies = [ + "rb-fsevent" + "rb-inotify" + ]; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; sha256 = "0rwwsmvq79qwzl6324yc53py02kbrcww35si720490z5w0j497nv"; type = "gem"; }; version = "3.9.0"; }; logger = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0lwncq2rf8gm79g2rcnnyzs26ma1f4wnfjm6gs4zf2wlsdz5in9s"; type = "gem"; }; version = "1.6.1"; }; mercenary = { - groups = ["default" "jekyll_plugins"]; - platforms = []; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0f2i827w4lmsizrxixsrv2ssa3gk1b7lmqh8brk8ijmdb551wnmj"; type = "gem"; }; version = "0.4.0"; }; minimal-mistakes-jekyll = { - dependencies = ["jekyll" "jekyll-feed" "jekyll-gist" "jekyll-include-cache" "jekyll-paginate" "jekyll-sitemap"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; + dependencies = [ + "jekyll" + "jekyll-feed" + "jekyll-gist" + "jekyll-include-cache" + "jekyll-paginate" + "jekyll-sitemap" + ]; + groups = [ "default" ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; sha256 = "1fylw1nwccipwqn5xaq32h6xkc2z2ka6fa2dkc3bx0lcyybwfzi1"; type = "gem"; }; version = "4.26.2"; }; net-http = { - dependencies = ["uri"]; - groups = ["default"]; - platforms = []; + dependencies = [ "uri" ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "10n2n9aq00ih8v881af88l1zyrqgs5cl3njdw8argjwbl5ggqvm9"; type = "gem"; }; version = "0.4.1"; }; octokit = { - dependencies = ["faraday" "sawyer"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; + dependencies = [ + "faraday" + "sawyer" + ]; + groups = [ "default" ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; sha256 = "15lvy06h276jryxg19258b2yqaykf0567sp0n16yipywhbp94860"; type = "gem"; }; version = "4.25.1"; }; pathutil = { - dependencies = ["forwardable-extended"]; - groups = ["default" "jekyll_plugins"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; + dependencies = [ "forwardable-extended" ]; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; sha256 = "12fm93ljw9fbxmv2krki5k5wkvr7560qy8p4spvb9jiiaqv78fz4"; type = "gem"; }; version = "0.16.2"; }; public_suffix = { - groups = ["default" "jekyll_plugins"]; - platforms = []; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0vqcw3iwby3yc6avs1vb3gfd0vcp2v7q310665dvxfswmcf4xm31"; type = "gem"; }; version = "6.0.1"; }; rake = { - groups = ["default" "jekyll_plugins"]; - platforms = []; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "17850wcwkgi30p7yqh60960ypn7yibacjjha0av78zaxwvd3ijs6"; type = "gem"; }; version = "13.2.1"; }; rb-fsevent = { - groups = ["default" "jekyll_plugins"]; - platforms = []; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1zmf31rnpm8553lqwibvv3kkx0v7majm1f341xbxc0bk5sbhp423"; type = "gem"; }; version = "0.11.2"; }; rb-inotify = { - dependencies = ["ffi"]; - groups = ["default" "jekyll_plugins"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; + dependencies = [ "ffi" ]; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; sha256 = "0vmy8xgahixcz6hzwy4zdcyn2y6d6ri8dqv5xccgzc1r292019x0"; type = "gem"; }; version = "0.11.1"; }; rexml = { - groups = ["default" "jekyll_plugins"]; - platforms = []; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0rr145mvjgc4n28lfy0gw87aw3ab680h83bdi5i102ik8mixk3zn"; type = "gem"; }; version = "3.3.8"; }; rouge = { - groups = ["default" "jekyll_plugins"]; - platforms = []; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0r0b48945hakgy0y7lg6h1bb7pkfz8jqd0r6777f80ij3sansvbs"; type = "gem"; }; version = "4.4.0"; }; safe_yaml = { - groups = ["default" "jekyll_plugins"]; - platforms = []; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0j7qv63p0vqcd838i2iy2f76c3dgwzkiz1d1xkg7n0pbnxj2vb56"; type = "gem"; }; version = "1.0.5"; }; sass-embedded = { - dependencies = ["google-protobuf" "rake"]; - groups = ["default" "jekyll_plugins"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; + dependencies = [ + "google-protobuf" + "rake" + ]; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; sha256 = "14ifw54zz56w25qbkwimxj9lcm42hmvlryn1d7z141f8pg8i3dmx"; type = "gem"; }; version = "1.79.4"; }; sawyer = { - dependencies = ["addressable" "faraday"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; + dependencies = [ + "addressable" + "faraday" + ]; + groups = [ "default" ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; sha256 = "1jks1qjbmqm8f9kvwa81vqj39avaj9wdnzc531xm29a55bb74fps"; type = "gem"; }; version = "0.9.2"; }; terminal-table = { - dependencies = ["unicode-display_width"]; - groups = ["default" "jekyll_plugins"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; + dependencies = [ "unicode-display_width" ]; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; sha256 = "14dfmfjppmng5hwj7c5ka6qdapawm3h6k9lhn8zj001ybypvclgr"; type = "gem"; }; version = "3.0.2"; }; unicode-display_width = { - groups = ["default" "jekyll_plugins"]; - platforms = []; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0nkz7fadlrdbkf37m0x7sw8bnz8r355q3vwcfb9f9md6pds9h9qj"; type = "gem"; }; version = "2.6.0"; }; uri = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "07ndgxyhzd02cg94s6rnfhkb9rwx9z72lzk368sa9j78wc9qnbfz"; type = "gem"; }; version = "0.13.1"; }; webrick = { - groups = ["default" "jekyll_plugins"]; - platforms = []; + groups = [ + "default" + "jekyll_plugins" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "089gy5494j560b242vi173wnbj2913hwlwnjkpzld58r96ilc5s3"; type = "gem"; }; diff --git a/update-nix-direnv-tests.nu b/update-nix-direnv-tests.nu new file mode 100755 index 0000000..66e83f4 --- /dev/null +++ b/update-nix-direnv-tests.nu @@ -0,0 +1,29 @@ +#!/usr/bin/env nu +use update-nix-direnv.nu update_nix_direnv_in_envrc + +use std assert +use std log + +def test_update_nix_direnv_in_envrc [] { + for t in [ + [text version hash expected]; + [ +'if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM=" +fi + +use flake' "3.0.7" "TEsTJaRMf8oF5LznDrlCXbkOQrywm0IHv1VjYGaTesT=" +'if ! has nix_direnv_version || ! nix_direnv_version 3.0.7; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.7/direnvrc" "sha256-TEsTJaRMf8oF5LznDrlCXbkOQrywm0IHv1VjYGaTesT=" +fi + +use flake'] + ] { + assert equal ($t.text | update_nix_direnv_in_envrc $t.version $t.hash) $t.expected + } +} + +def main [] [] { + test_update_nix_direnv_in_envrc + echo "All tests passed!" +} diff --git a/update-nix-direnv.nu b/update-nix-direnv.nu new file mode 100755 index 0000000..d04f335 --- /dev/null +++ b/update-nix-direnv.nu @@ -0,0 +1,62 @@ +#!/usr/bin/env nu + +# https://github.com/nix-community/nix-direnv + +# get_latest_nix_direnv_release +# get_latest_nix_direnv_release + +# Get the newest version of nix-direnv. +def get_latest_nix_direnv_version [] [ nothing -> string ] { + http get https://api.github.com/repos/nix-community/nix-direnv/releases/latest | get name +} + +# Get the SHA-256 hash of the direnvrc file for a particular version of nix-direnv. +def get_direnvrc_hash [ + version: string # The version of nix-direnv, i.e. 3.0.6 +] [ nothing -> string ] { + http get $"https://raw.githubusercontent.com/nix-community/nix-direnv/($version)/direnvrc" | hash sha256 --binary | encode new-base64 +} + +# Replace the current version of nix-direnv with the given version and update the SHA-256 checksum of the direnvrc file. +# +# This function takes as input the content of a .envrc file, like the following. +# +# if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then +# source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM=" +# fi +# +# use flake +# +export def update_nix_direnv_in_envrc [ + version: string # nix-direnv version, i.e. 3.0.6 + hash: string # The sha256 checksum of the release +] [ string -> string ] { + ( + $in + | str replace --regex "nix_direnv_version [0-9]+\\.[0-9]+\\.[0-9]+" + $"nix_direnv_version ($version)" + | str replace --regex "source_url \"https://raw.githubusercontent.com/nix-community/nix-direnv/[0-9]+\\.[0-9]+\\.[0-9]+/direnvrc\" \"sha256-[[:alnum:]]+=\"" + $'source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/($version)/direnvrc" "sha256-($hash)"' + ) +} + +def main [ + files: list = [] # A list of `.envrc` files to operate on. +] { + let files = ( + if ($files | is-empty) { + glob **/.envrc + } else { + $files + } + ) + + let version = get_latest_nix_direnv_version + let hash = get_direnvrc_hash $version + + for file in $files { + $file | open | update_nix_direnv_in_envrc $version $hash | save --force $file + } + + exit 0 +} diff --git a/update-nixos-release-tests.nu b/update-nixos-release-tests.nu index 07060cb..ff2623e 100755 --- a/update-nixos-release-tests.nu +++ b/update-nixos-release-tests.nu @@ -32,7 +32,7 @@ def test_update_nixos_release_in_flake [] { outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system: - let + let overlays = [ ]; pkgs = import nixpkgs { @@ -57,7 +57,7 @@ def test_update_nixos_release_in_flake [] { outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system: - let + let overlays = [ ]; pkgs = import nixpkgs { diff --git a/update-nixos-release.nu b/update-nixos-release.nu index a18361f..40f78e3 100755 --- a/update-nixos-release.nu +++ b/update-nixos-release.nu @@ -40,7 +40,10 @@ export def get_latest_nixos_release [date: datetime] [ nothing -> string ] { export def update_nixos_release_in_flake [ release: string # NixOS release, i.e. 24.05 ] [ string -> string ] { - $in | str replace --regex "github:NixOS/nixpkgs/nixos-[0-9][0-9].[0-9][0-9]" $"github:NixOS/nixpkgs/nixos-($release)" + ( + $in | str replace --regex "github:NixOS/nixpkgs/nixos-[0-9][0-9]\\.[0-9][0-9]" + $"github:NixOS/nixpkgs/nixos-($release)" + ) } def main [