From 1cf046d60d4660aa3239571f999fa296afda3880 Mon Sep 17 00:00:00 2001 From: Nikita Wootten Date: Sat, 2 Sep 2023 23:26:07 -0400 Subject: [PATCH] Replaced devenv with nix devshell, added snippets --- .envrc | 4 +- .github/workflows/gh-pages.yaml | 23 ++-- .gitignore | 5 - .vscode/congo.code-snippets | 36 +++++++ CONTRIBUTING.md | 2 +- content/posts/makefile-tips/index.md | 3 + devenv.lock | 156 --------------------------- devenv.nix | 9 -- devenv.yaml | 3 - flake.lock | 27 +++++ flake.nix | 25 +++++ go.mod | 2 +- 12 files changed, 101 insertions(+), 194 deletions(-) create mode 100644 .vscode/congo.code-snippets delete mode 100644 devenv.lock delete mode 100644 devenv.nix delete mode 100644 devenv.yaml create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc index 6de8a8a..8392d15 100644 --- a/.envrc +++ b/.envrc @@ -1,3 +1 @@ -source_url "https://raw.githubusercontent.com/cachix/devenv/d1f7b48e35e6dee421cfd0f51481d17f77586997/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0=" - -use devenv \ No newline at end of file +use flake \ No newline at end of file diff --git a/.github/workflows/gh-pages.yaml b/.github/workflows/gh-pages.yaml index ad81973..84323dd 100644 --- a/.github/workflows/gh-pages.yaml +++ b/.github/workflows/gh-pages.yaml @@ -19,22 +19,13 @@ jobs: with: submodules: true # Fetch Hugo themes (true OR recursive) fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod - - - uses: cachix/install-nix-action@v20 - with: - github_access_token: ${{ secrets.GITHUB_TOKEN }} - - - uses: cachix/cachix-action@v12 - with: - name: devenv - - - name: Install devenv.sh - run: nix profile install github:cachix/devenv/latest - shell: sh - - run: devenv ci - - - run: devenv shell make build-prod - + - uses: actions/checkout@v3 + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v4 + - name: Setup cache + uses: DeterminateSystems/magic-nix-cache-action@main + - name: Build Site + run: nix develop --command make build-prod - name: Deploy uses: peaceiris/actions-gh-pages@v3 # only deploy if on main branch diff --git a/.gitignore b/.gitignore index 8d68c72..800ff50 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,3 @@ public /resources/_gen/ /layouts/partials/openring.html - -# Devenv -.devenv* -devenv.local.nix -.direnv/ diff --git a/.vscode/congo.code-snippets b/.vscode/congo.code-snippets new file mode 100644 index 0000000..8539973 --- /dev/null +++ b/.vscode/congo.code-snippets @@ -0,0 +1,36 @@ +{ + // Place your nikitawootten.github.io workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and + // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope + // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is + // used to trigger the snippet and the body will be expanded and inserted. Possible variables are: + // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. + // Placeholders with the same ids are connected. + // Example: + // "Print to console": { + // "scope": "javascript,typescript", + // "prefix": "log", + // "body": [ + // "console.log('$1');", + // "$2" + // ], + // "description": "Log output to console" + // } + "Alert": { + "scope": "markdown", + "prefix": "_alert", + "body": [ + "{{< alert ${1:\"${2|circle-info|}\" }>}}", + "$3", + "{{< /alert >}}" + ] + }, + "Lead": { + "scope": "markdown", + "prefix": "_lead", + "body": [ + "{{< lead >}}", + "$1", + "{{< /lead >}}" + ] + } +} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fd7ebe8..76b9367 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1 +1 @@ -This repository is meant to house my personal site, but if you see anything that sticks out (embarrassing typos, suggestions, etc) feel free to submit a PR or Issue :) \ No newline at end of file +This repository is meant to house my personal site, but if you see anything that sticks out (embarrassing typos, suggestions, etc) feel free to submit a PR or Issue :) diff --git a/content/posts/makefile-tips/index.md b/content/posts/makefile-tips/index.md index 1e7e6d1..95204f0 100644 --- a/content/posts/makefile-tips/index.md +++ b/content/posts/makefile-tips/index.md @@ -5,7 +5,10 @@ draft: false tags: [makefile, nix, tips] --- +{{< lead >}} I have a secret: I adore Makefiles. +{{< /lead >}} + I'll admit, the syntax is a bit arcane, and if you don't know what you're doing you can create some really insidious bugs, but once things are set up you can really improve the developer experience on your projects likely without requiring developers to install any [additional tools](https://github.com/casey/just). In this post I'd like to share some tips I've gathered for making your Makefiles more effective. diff --git a/devenv.lock b/devenv.lock deleted file mode 100644 index 14885c5..0000000 --- a/devenv.lock +++ /dev/null @@ -1,156 +0,0 @@ -{ - "nodes": { - "devenv": { - "locked": { - "dir": "src/modules", - "lastModified": 1688824367, - "narHash": "sha256-qHxX0U8K+BvN+P1+ZhPuFMHRL2aCmQxSnXLzzNpTLD0=", - "owner": "cachix", - "repo": "devenv", - "rev": "1e4701fb1f51f8e6fe3b0318fc2b80aed0761914", - "type": "github" - }, - "original": { - "dir": "src/modules", - "owner": "cachix", - "repo": "devenv", - "type": "github" - } - }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "pre-commit-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1688798537, - "narHash": "sha256-+3QEnDgBiso8lgUJpMagn6xCujmarc6zCWfKYAd6nqU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "842e90934a352f517d23963df3ec0474612e483c", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1685801374, - "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-23.05", - "repo": "nixpkgs", - "type": "github" - } - }, - "pre-commit-hooks": { - "inputs": { - "flake-compat": "flake-compat", - "flake-utils": "flake-utils", - "gitignore": "gitignore", - "nixpkgs": [ - "nixpkgs" - ], - "nixpkgs-stable": "nixpkgs-stable" - }, - "locked": { - "lastModified": 1688596063, - "narHash": "sha256-9t7RxBiKWHygsqXtiNATTJt4lim/oSYZV3RG8OjDDng=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "c8d18ba345730019c3faf412c96a045ade171895", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, - "root": { - "inputs": { - "devenv": "devenv", - "nixpkgs": "nixpkgs", - "pre-commit-hooks": "pre-commit-hooks" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/devenv.nix b/devenv.nix deleted file mode 100644 index c5c8d78..0000000 --- a/devenv.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ pkgs, ... }: - -{ - packages = with pkgs; [ - hugo - openring - go - ]; -} diff --git a/devenv.yaml b/devenv.yaml deleted file mode 100644 index c7cb5ce..0000000 --- a/devenv.yaml +++ /dev/null @@ -1,3 +0,0 @@ -inputs: - nixpkgs: - url: github:NixOS/nixpkgs/nixpkgs-unstable diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..b07f264 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1693626178, + "narHash": "sha256-Rpiy6lIOu4zny8tfGuIeN1ji9eSz9nPmm9yBhh/4IOM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "bfb7dfec93f3b5d7274db109f2990bc889861caf", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..b809b87 --- /dev/null +++ b/flake.nix @@ -0,0 +1,25 @@ +{ + description = "nikita.computer dev environment"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + }; + + outputs = { self, nixpkgs }: let + systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + # forEachSystem [ "x86_64-linux" ] (_: { example = true; }) -> { x86_64-linux.example = true } + forEachSystem = nixpkgs.lib.genAttrs systems; + in { + devShells = forEachSystem (system: let + pkgs = nixpkgs.legacyPackages.${system}; + in { + default = pkgs.mkShell { + buildInputs = with pkgs; [ + hugo + openring + go + ]; + }; + }); + }; +} diff --git a/go.mod b/go.mod index 4f5838b..414e876 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/nikitawootten/nikitawootten.github.io +module github.com/nikitawootten/nikita.computer go 1.19