Created
April 8, 2024 16:47
-
-
Save emptyflask/18c967eee631a44a2b18119b98ff1caf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
inputs = { | |
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; | |
ruby-nix.url = "github:inscapist/ruby-nix"; | |
bundix = { | |
url = "github:inscapist/bundix/main"; | |
inputs.nixpkgs.follows = "nixpkgs"; | |
}; | |
fu.url = "github:numtide/flake-utils"; | |
bob-ruby.url = "github:bobvanderlinden/nixpkgs-ruby"; | |
bob-ruby.inputs.nixpkgs.follows = "nixpkgs"; | |
}; | |
outputs = { self, nixpkgs, fu, ruby-nix, bundix, bob-ruby }: | |
with fu.lib; | |
eachDefaultSystem (system: | |
let | |
pkgs = import nixpkgs { | |
inherit system; | |
overlays = [ bob-ruby.overlays.default ]; | |
}; | |
rubyNix = ruby-nix.lib pkgs; | |
gemset = if builtins.pathExists ./gemset.nix then import ./gemset.nix else { }; | |
gemConfig = { | |
# one way to add jemalloc to all gems... | |
# bigdecimal = attrs: { buildInputs = [ pkgs.jemalloc ]; }; | |
# bindex = attrs: { buildInputs = [ pkgs.jemalloc ]; }; | |
# bcrypt_pbkdf = attrs: { buildInputs = [ pkgs.jemalloc ]; }; | |
# ... | |
}; | |
jemallocGemConfig = builtins.listToAttrs (map (name: { | |
inherit name; | |
value = attrs: attrs // { buildInputs = (attrs.buildInputs or []) ++ [ pkgs.jemalloc ]; }; | |
}) (builtins.attrNames gemset)); | |
rubyVersion = nixpkgs.lib.fileContents ./.ruby-version; | |
ruby = pkgs."${rubyVersion}".override { | |
jemallocSupport = true; | |
yjitSupport = true; | |
}; | |
bundixcli = bundix.packages.${system}.default; | |
in rec { | |
inherit (rubyNix { | |
inherit gemset ruby; | |
name = "chronos"; | |
gemConfig = pkgs.defaultGemConfig // gemConfig // jemallocGemConfig; | |
groups = [ "default" "development" "mover" "test" "toolbox"]; | |
}) env; | |
devShells = rec { | |
default = dev; | |
dev = pkgs.mkShell { | |
buildInputs = [ env bundixcli ] | |
++ (with pkgs; [ | |
act | |
nodejs_20 | |
pass | |
rufo | |
yarn | |
(with nodePackages; [ | |
eslint | |
typescript | |
typescript-language-server | |
]) | |
]); | |
}; | |
}; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment