From 25bf05746893a74de8c85d06b053ee4e64239666 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 1 Sep 2023 14:01:28 +0900 Subject: [PATCH 1/8] Prefer nixos-* channel and official ruby package --- .envrc | 1 - flake.lock | 82 ++++-------------------------------------------------- flake.nix | 24 ++++++++-------- 3 files changed, 18 insertions(+), 89 deletions(-) diff --git a/.envrc b/.envrc index e52db4af..197c0d59 100644 --- a/.envrc +++ b/.envrc @@ -1,4 +1,3 @@ #!/bin/bash -nix_direnv_watch_file .ruby-version use flake diff --git a/flake.lock b/flake.lock index 70c3c237..403bc5e5 100644 --- a/flake.lock +++ b/flake.lock @@ -1,21 +1,5 @@ { "nodes": { - "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" @@ -34,67 +18,26 @@ "type": "github" } }, - "flake-utils_2": { - "inputs": { - "systems": "systems_2" - }, - "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": 1690726002, - "narHash": "sha256-cACz6jCJZtsZHGCJAN4vMobxzH5s6FCOTZHMrh/Hu0M=", + "lastModified": 1693377291, + "narHash": "sha256-vYGY9bnqEeIncNarDZYhm6KdLKgXMS+HA2mTRaWEc80=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "391e8db1f06c3f74c2d313a73135515023af3993", + "rev": "e7f38be3775bab9659575f192ece011c033655f0", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-23.05", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs-ruby": { - "inputs": { - "flake-compat": "flake-compat", - "flake-utils": "flake-utils_2", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1690614109, - "narHash": "sha256-iSuFvbxyJCa3yzW0wEKiStvuwdWYOUwzCmHoInef26w=", - "owner": "bobvanderlinden", - "repo": "nixpkgs-ruby", - "rev": "509892e8018ca45f84bbe2650f2bcebc42c4c593", - "type": "github" - }, - "original": { - "owner": "bobvanderlinden", - "repo": "nixpkgs-ruby", - "type": "github" - } - }, "root": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs", - "nixpkgs-ruby": "nixpkgs-ruby" + "nixpkgs": "nixpkgs" } }, "systems": { @@ -111,21 +54,6 @@ "repo": "default", "type": "github" } - }, - "systems_2": { - "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", diff --git a/flake.nix b/flake.nix index 7c3d3b05..b0e80700 100644 --- a/flake.nix +++ b/flake.nix @@ -1,25 +1,27 @@ { inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; - nixpkgs-ruby.url = "github:bobvanderlinden/nixpkgs-ruby"; - nixpkgs-ruby.inputs.nixpkgs.follows = "nixpkgs"; + # Candidate channels + # - https://github.com/kachick/anylang-template/issues/17 + # - https://discourse.nixos.org/t/differences-between-nix-channels/13998 + # How to update the revision + # - `nix flake update --commit-lock-file` # https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake-update.html + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs, nixpkgs-ruby, flake-utils }: + outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; - ruby = nixpkgs-ruby.lib.packageFromRubyVersionFile { - file = ./.ruby-version; - inherit system; - }; in rec { devShells.default = with pkgs; mkShell { buildInputs = [ - ruby + # https://github.com/NixOS/nix/issues/730#issuecomment-162323824 + bashInteractive + + ruby_3_2 dprint tree nil @@ -42,10 +44,10 @@ cp -rf ./lib $out install -t $out/bin bin/pure-console.rb makeWrapper $out/bin/pure-console.rb $out/bin/console \ - --prefix PATH : ${nixpkgs.lib.makeBinPath [ ruby ]} + --prefix PATH : ${nixpkgs.lib.makeBinPath [ pkgs.ruby ]} ''; runtimeDependencies = [ - ruby + pkgs.ruby ]; }; From 22911286aaaf64116fe0be36a19ad61f4b01f70a Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 1 Sep 2023 14:03:53 +0900 Subject: [PATCH 2/8] Update CI dependencies with flake versions --- .github/workflows/ci-nix.yml | 2 +- .github/workflows/lint.yml | 8 ++++---- Rakefile | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-nix.yml b/.github/workflows/ci-nix.yml index a7b95156..0e2d2ef1 100644 --- a/.github/workflows/ci-nix.yml +++ b/.github/workflows/ci-nix.yml @@ -34,7 +34,7 @@ jobs: - run: nix run .#console - run: nix develop --command bundle install - name: Log current versions - run: nix develop --command bundle exec rake inspect_dependencies + run: nix develop --command bundle exec rake deps - name: Test with external dependencies run: nix develop --command bundle exec rake check_non_ruby - name: Test with Ruby diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 279e5373..797f54e0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,13 +26,13 @@ jobs: - uses: actions/checkout@v3 - uses: dprint/check@v2.2 with: - # Keep same version as *.nix - dprint-version: '0.36.1' + # Keep same version as used in *.nix + dprint-version: '0.40.2' typos: timeout-minutes: 15 runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - # Keep same version as *.nix - - uses: crate-ci/typos@v1.14.10 + # Keep same version as used in *.nix + - uses: crate-ci/typos@v1.16.8 diff --git a/Rakefile b/Rakefile index b250c880..591c62a9 100644 --- a/Rakefile +++ b/Rakefile @@ -130,7 +130,7 @@ task(:update) do end desc 'Print dependencies' -task :inspect_dependencies do +task :deps do sh('ruby --version') sh('dprint --version') sh('tree --version') From 95555447982aacf69c93b2ea20b006436a0c867a Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 1 Sep 2023 14:04:06 +0900 Subject: [PATCH 3/8] flake.lock: Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'flake-utils': 'github:numtide/flake-utils/919d646de7be200f3bf08cb76ae1f09402b6f9b4' (2023-07-11) → 'github:numtide/flake-utils/f9e7cf818399d17d347f847525c5a5a8032e4e44' (2023-08-23) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 403bc5e5..bc6fc0a7 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1689068808, - "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "lastModified": 1692799911, + "narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=", "owner": "numtide", "repo": "flake-utils", - "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44", "type": "github" }, "original": { From f986edbf348ce5b5c4ae64adca7eb5848470a847 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 1 Sep 2023 14:09:19 +0900 Subject: [PATCH 4/8] Prefer no config file for typos again --- .github/workflows/lint.yml | 6 ++++++ Rakefile | 2 +- _typos.toml | 3 --- 3 files changed, 7 insertions(+), 4 deletions(-) delete mode 100644 _typos.toml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 797f54e0..59f28dad 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -36,3 +36,9 @@ jobs: - uses: actions/checkout@v3 # Keep same version as used in *.nix - uses: crate-ci/typos@v1.16.8 + with: + # https://github.com/crate-ci/typos/issues/779 + files: | + . + .github + .vscode diff --git a/Rakefile b/Rakefile index 591c62a9..80af573a 100644 --- a/Rakefile +++ b/Rakefile @@ -141,7 +141,7 @@ end desc 'Tests except ruby' task :check_non_ruby do Rake::Task['dprint'].invoke - sh('typos') + sh('typos . .github .vscode') sh('actionlint') sh('nixpkgs-fmt --check ./*.nix') end diff --git a/_typos.toml b/_typos.toml deleted file mode 100644 index 99ec3ada..00000000 --- a/_typos.toml +++ /dev/null @@ -1,3 +0,0 @@ -[files] -ignore-hidden = false -extend-exclude = [".git", '.direnv', '.yardoc', '.bundle'] From 32e0616931fa454887da0d90829b12459527179b Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 1 Sep 2023 14:09:48 +0900 Subject: [PATCH 5/8] Move renovatebot config as dependabot --- renovate.json => .github/renovate.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename renovate.json => .github/renovate.json (100%) diff --git a/renovate.json b/.github/renovate.json similarity index 100% rename from renovate.json rename to .github/renovate.json From 75d39380e2cc6490bf320387f635714ac58e8599 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 1 Sep 2023 14:10:31 +0900 Subject: [PATCH 6/8] Bump dprint.json with old dprint `rtx exec dprint@0.39.1 -- dprint config update --yes && rtx exec dprint@0.40.2 -- dprint check` And removed the outdated includes specifier --- dprint.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dprint.json b/dprint.json index 2d660774..cf2f6c5a 100644 --- a/dprint.json +++ b/dprint.json @@ -7,7 +7,6 @@ "printWidth": 120, "singleQuote": true }, - "includes": ["**/*.{json,md,yml,html,css}"], "excludes": [ ".git", "**/*lock.json", @@ -18,7 +17,7 @@ ], "plugins": [ "https://plugins.dprint.dev/json-0.17.4.wasm", - "https://plugins.dprint.dev/markdown-0.15.3.wasm", - "https://plugins.dprint.dev/prettier-0.26.6.json@0118376786f37496e41bb19dbcfd1e7214e2dc859a55035c5e54d1107b4c9c57" + "https://plugins.dprint.dev/markdown-0.16.0.wasm", + "https://plugins.dprint.dev/prettier-0.27.0.json@3557a62b4507c55a47d8cde0683195b14d13c41dda66d0f0b0e111aed107e2fe" ] } From a6fc9487f176b35f4e0ac6c29d9a9713258122d4 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 1 Sep 2023 14:15:11 +0900 Subject: [PATCH 7/8] Reduce several CI triggers from Nix --- .github/workflows/ci-nix.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci-nix.yml b/.github/workflows/ci-nix.yml index 0e2d2ef1..d7341a42 100644 --- a/.github/workflows/ci-nix.yml +++ b/.github/workflows/ci-nix.yml @@ -6,15 +6,11 @@ on: - '.github/workflows/ci-nix.yml' - '**.nix' - 'flake.*' - - '.ruby-version' - - 'dprint.json' pull_request: paths: - '.github/workflows/ci-nix.yml' - '**.nix' - 'flake.*' - - '.ruby-version' - - 'dprint.json' schedule: # Every 10:42 JST # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule From f280ba23434cc2c23b1d891312ff6000c25d458a Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Fri, 1 Sep 2023 14:17:04 +0900 Subject: [PATCH 8/8] Remove unused vscode extension --- .vscode/extensions.json | 1 - .vscode/launch.json | 30 ------------------------------ 2 files changed, 31 deletions(-) delete mode 100644 .vscode/launch.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json index edc11f54..280fae58 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -3,7 +3,6 @@ "editorconfig.editorconfig", "github.vscode-github-actions", "tekumara.typos-vscode", - "koichisasada.vscode-rdbg", "soutaro.steep-vscode", "soutaro.rbs-syntax", "dprint.dprint", diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 40aada76..00000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "rdbg", - "name": "Debug current file with rdbg", - "request": "launch", - "script": "${file}", - "args": [], - "askParameters": true - }, - { - "type": "rdbg", - "name": "Attach with rdbg", - "request": "attach" - }, - { - "type": "rdbg", - "name": "Run rake test", - "request": "launch", - "command": "rake", - "script": "test", - "args": [], - "askParameters": false - } - ] -}