diff --git a/.envrc b/.envrc new file mode 100644 index 000000000..3550a30f2 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.github/workflows/ci-nix.yml b/.github/workflows/ci-nix.yml new file mode 100644 index 000000000..d260cfc7e --- /dev/null +++ b/.github/workflows/ci-nix.yml @@ -0,0 +1,24 @@ +name: CI - Nix +on: + pull_request: + paths: + - '.github/workflows/ci-nix.yml' + - '*.nix' + - 'flake.*' + schedule: + # Every 10:42 JST + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule + - cron: '42 1 * * *' + workflow_dispatch: + +jobs: + tasks: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v3 + - uses: DeterminateSystems/nix-installer-action@v4 + - uses: DeterminateSystems/magic-nix-cache-action@v2 + - run: nix flake check + - run: nix develop --command echo 'This step should be done before any other "nix develop" steps because of measuring Nix build time' + - run: nix develop --command make all diff --git a/.gitignore b/.gitignore index a5619002a..c70e08458 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ public .DS_Store **/.hugo_build.lock tmp +.direnv/ diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 000000000..e3e1ebbc7 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,10 @@ +{ + "recommendations": [ + "golang.go", + "github.vscode-github-actions", + "editorconfig.editorconfig", + "tekumara.typos-vscode", + "dprint.dprint", + "jnoortheen.nix-ide", + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..56d988dcd --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "editor.defaultFormatter": "dprint.dprint", + "editor.formatOnSave": true, + "[nix]": { + "editor.defaultFormatter": "jnoortheen.nix-ide" + }, + "[go]": { + "editor.defaultFormatter": "golang.go" + } +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..f2d223598 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1689446868, + "narHash": "sha256-OXc/8/QdT0sjxwg38MmQu3mUgpZ+S6LQSAuUs0LGHW0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7fd307937db70af23b956c4539033542809ae263", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7fd307937db70af23b956c4539033542809ae263", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "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/flake.nix b/flake.nix new file mode 100644 index 000000000..f97b00738 --- /dev/null +++ b/flake.nix @@ -0,0 +1,29 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/7fd307937db70af23b956c4539033542809ae263"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + devShells.default = with pkgs; + mkShell { + buildInputs = [ + hugo + go_1_20 + gnumake + coreutils + peco + typos + dprint + actionlint + nil + nixpkgs-fmt + ]; + }; + }); +}