Files
nixpkgs/pkgs/development/ruby-modules/bundler-update-script/default.nix
Silvan Mosberger d1a4769b38 treewide: nixfmt-rfc-style -> nixfmt
Except:
- Instances in documentation, because people in older versions
  can't switch to nixfmt yet due to it having pointed to nixfmt-classic
  before
- In code that runs based on a CI Nixpkgs version, which is also a bit
  older still
- In update script shebangs, because many of them don't pin Nixpkgs, and run
  with whatever is in NIX_PATH (and it's not easy to fix this, see
  https://github.com/NixOS/nixpkgs/issues/425551)
2025-07-15 22:14:18 +02:00

51 lines
794 B
Nix

{
runtimeShell,
lib,
writeScript,
bundix,
bundler,
coreutils,
git,
nix,
nixfmt,
}:
attrPath:
let
updateScript = writeScript "bundler-update-script" ''
#!${runtimeShell}
PATH=${
lib.makeBinPath [
bundler
bundix
coreutils
git
nix
nixfmt
]
}
set -o errexit
set -o nounset
set -o pipefail
attrPath=$1
toplevel=$(git rev-parse --show-toplevel)
position=$(nix --extra-experimental-features nix-command eval -f "$toplevel" --raw "$attrPath.meta.position")
gemdir=$(dirname "$position")
cd "$gemdir"
rm -f gemset.nix Gemfile.lock
export BUNDLE_FORCE_RUBY_PLATFORM=1
bundler lock --update
bundix
nixfmt gemset.nix
'';
in
[
updateScript
attrPath
]