From f6ef3f7d3bb9a33dfac3e46dc7d3bf29b12c30bb Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 1 Aug 2023 12:34:50 +0900 Subject: [PATCH] Install ruby-3.2 global with the nixpkgs privided pkg (#233) * Install ruby-3.2 global with the nixpkgs privided pkg * Improve comment * Make sure ruby exists in CI * Update step name --- .github/workflows/ci-home.yml | 6 +++++- home-manager/home.nix | 7 +++++-- home-manager/packages.nix | 11 +++++------ home/.local/share/homemade/bin/irb.bash | 5 ----- home/.local/share/homemade/bin/ruby.bash | 5 ----- 5 files changed, 15 insertions(+), 19 deletions(-) delete mode 100755 home/.local/share/homemade/bin/irb.bash delete mode 100755 home/.local/share/homemade/bin/ruby.bash diff --git a/.github/workflows/ci-home.yml b/.github/workflows/ci-home.yml index c217152f..7695e092 100644 --- a/.github/workflows/ci-home.yml +++ b/.github/workflows/ci-home.yml @@ -61,16 +61,20 @@ jobs: ${{ matrix.cleanup-script }} - uses: actions/checkout@v3 - run: home-manager switch -f ./home-manager/user-github-actions.nix - - name: Print shell paths + - name: Print paths run: | which fish which zsh which bash # Be non nix shell + which ruby + which irb # Do not use interactive mode here. # Solutions as https://github.com/actions/runner/issues/241#issuecomment-924327172 will not fit with several problems - name: Run customized dependencies run: | fish --command 'starship --version' zsh -c 'which dprint' + zsh -c 'ruby --version' + zsh -c 'irb --version' - name: Run homemade commands run: zsh -c 'la' diff --git a/home-manager/home.nix b/home-manager/home.nix index 92a1568b..d9a20a94 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -88,6 +88,11 @@ enable = true; # Replacement of `programs.direnv.enableNixDirenvIntegration = true;` + # + # Make much faster, but I may add nix_direnv_watch_file in several repositories when it has `.ruby-version` + # See following reference + # - https://github.com/nix-community/nix-direnv/blob/ed2cb75553b4864e3c931a48e3a2cd43b93152c5/README.md?plain=1#L368-L373 + # - https://github.com/kachick/ruby-ulid/pull/410 nix-direnv = { enable = true; }; @@ -165,6 +170,4 @@ xdg.dataFile."homemade/bin/la".source = ../home/.local/share/homemade/bin/la.bash; xdg.dataFile."homemade/bin/zj".source = ../home/.local/share/homemade/bin/zj.bash; xdg.dataFile."homemade/bin/add_nix_channels".source = ../home/.local/share/homemade/bin/add_nix_channels.bash; - xdg.dataFile."homemade/bin/ruby".source = ../home/.local/share/homemade/bin/ruby.bash; - xdg.dataFile."homemade/bin/irb".source = ../home/.local/share/homemade/bin/irb.bash; } diff --git a/home-manager/packages.nix b/home-manager/packages.nix index 02ed33b1..cfa930f1 100644 --- a/home-manager/packages.nix +++ b/home-manager/packages.nix @@ -68,15 +68,14 @@ # pkgs.gnumake # pkgs.cargo-make - # This section is just a note for my strggle - # Often failed to build ruby even if I enabled following dependencies + + # https://github.com/NixOS/nixpkgs/pull/218114 + pkgs.ruby_3_2 + # If you need to build cruby from source, this section may remind the struggle + # Often failed to build cruby even if I enabled following dependencies # pkgs.zlib # pkgs.libyaml # pkgs.openssl - # - # Don't include nixpkgs ruby for complex gems and other handlings - # Prefer adhoc use of https://github.com/bobvanderlinden/nixpkgs-ruby as follows - # `nix shell github:bobvanderlinden/nixpkgs-ruby#'"ruby-3.2"' --command irb` # As a boardgamer # pkgs.tesseract diff --git a/home/.local/share/homemade/bin/irb.bash b/home/.local/share/homemade/bin/irb.bash deleted file mode 100755 index 74561b79..00000000 --- a/home/.local/share/homemade/bin/irb.bash +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -nix shell github:bobvanderlinden/nixpkgs-ruby#'"ruby-3.2"' --command irb "$@" diff --git a/home/.local/share/homemade/bin/ruby.bash b/home/.local/share/homemade/bin/ruby.bash deleted file mode 100755 index 7b9d4933..00000000 --- a/home/.local/share/homemade/bin/ruby.bash +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -nix shell github:bobvanderlinden/nixpkgs-ruby#'"ruby-3.2"' --command ruby "$@"