Use custom extensions from Rubygems

This commit is contained in:
Gabriel Arazas 2023-10-28 17:48:20 +08:00
parent 84aca09028
commit 38740bfd15
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
6 changed files with 18 additions and 66 deletions

View File

@ -4,7 +4,7 @@ source 'https://rubygems.org'
gem 'asciidoctor' gem 'asciidoctor'
gem 'asciidoctor-bibtex' gem 'asciidoctor-bibtex'
gem 'asciidoctor-diagram' gem 'asciidoctor-diagram'
gem 'asciidoctor-foodogsquared-extensions', path: './gems' gem 'asciidoctor-foodogsquared-extensions'
gem 'concurrent-ruby' gem 'concurrent-ruby'
gem 'open-uri-cached' gem 'open-uri-cached'
gem 'rouge' gem 'rouge'

View File

@ -1,10 +1,3 @@
PATH
remote: gems
specs:
asciidoctor-foodogsquared-extensions (1.0.0)
asciidoctor (~> 2.0)
rugged (~> 1.0)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
@ -22,6 +15,9 @@ GEM
rexml rexml
asciidoctor-diagram-ditaamini (1.0.3) asciidoctor-diagram-ditaamini (1.0.3)
asciidoctor-diagram-plantuml (1.2023.5) asciidoctor-diagram-plantuml (1.2023.5)
asciidoctor-foodogsquared-extensions (1.0.0)
asciidoctor (~> 2.0)
rugged (~> 1.0)
ast (2.4.2) ast (2.4.2)
bibtex-ruby (5.1.6) bibtex-ruby (5.1.6)
latex-decode (~> 0.0) latex-decode (~> 0.0)
@ -85,7 +81,7 @@ DEPENDENCIES
asciidoctor asciidoctor
asciidoctor-bibtex asciidoctor-bibtex
asciidoctor-diagram asciidoctor-diagram
asciidoctor-foodogsquared-extensions! asciidoctor-foodogsquared-extensions
concurrent-ruby concurrent-ruby
open-uri-cached open-uri-cached
rake rake
@ -97,4 +93,4 @@ DEPENDENCIES
tilt tilt
BUNDLED WITH BUNDLED WITH
2.4.12 2.3.26

35
flake.lock generated
View File

@ -34,43 +34,10 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": {
"locked": {
"lastModified": 1678875422,
"narHash": "sha256-T3o6NcQPwXjxJMn2shz86Chch4ljXgZn746c2caGxd8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "126f49a01de5b7e35a43fd43f891ecf6d3a51459",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs"
"ruby-nix": "ruby-nix"
}
},
"ruby-nix": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1681695382,
"narHash": "sha256-RBZnSdx3dnUg3o+FiQVKKeKZN6pntYb19mXnnA5b/i8=",
"owner": "sagittaros",
"repo": "ruby-nix",
"rev": "b1edcbec13c9f15915a900b1fb87d9c3ef1e882b",
"type": "github"
},
"original": {
"owner": "sagittaros",
"repo": "ruby-nix",
"type": "github"
} }
}, },
"systems": { "systems": {

View File

@ -4,7 +4,6 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
ruby-nix.url = "github:sagittaros/ruby-nix";
}; };
outputs = inputs@{ self, nixpkgs, ... }: outputs = inputs@{ self, nixpkgs, ... }:
@ -14,14 +13,7 @@
in in
inputs.flake-utils.lib.eachSystem systems (system: inputs.flake-utils.lib.eachSystem systems (system:
let let
pkgs = import nixpkgs { pkgs = nixpkgs.legacyPackages."${system}";
inherit system;
overlays = overlays ++ [
(final: prev: {
ruby-nix = inputs.ruby-nix.lib prev;
})
];
};
in in
{ {
devShells.default = import ./shell.nix { inherit pkgs; }; devShells.default = import ./shell.nix { inherit pkgs; };

View File

@ -66,10 +66,10 @@
groups = ["default"]; groups = ["default"];
platforms = []; platforms = [];
source = { source = {
path = "gems"; remotes = ["https://rubygems.org"];
type = "path"; sha256 = "0jkc89m22fwjc4qn481rxyv5yif2yqqhw3ib4d6qkqcv2a21448g";
type = "gem";
}; };
targets = [];
version = "1.0.0"; version = "1.0.0";
}; };
ast = { ast = {
@ -455,4 +455,4 @@
targets = []; targets = [];
version = "2.4.2"; version = "2.4.2";
}; };
} }

View File

@ -3,25 +3,22 @@
with pkgs; with pkgs;
let let
localGem = ruby-nix { gems = bundlerEnv {
name = "asciidoctor-foodogsquared-extensions"; name = "foodogsquared-blog-gems";
ruby = ruby_3_1; ruby = ruby_3_1;
gemset = ./gemset.nix; gemdir = ./.;
}; };
asciidoctorWrappedWithCustomOptions = writeShellScriptBin "asciidoctor" '' asciidoctorWrappedWithCustomOptions = writeShellScriptBin "asciidoctor" ''
${lib.getBin localGem.env}/bin/asciidoctor -T ./gems/templates $@ ${lib.getBin gems}/bin/asciidoctor -T ./gems/templates $@
''; '';
treesitterWithPlugins = (tree-sitter.withPlugins (_: tree-sitter.allGrammars)); treesitterWithPlugins = (tree-sitter.withPlugins (_: tree-sitter.allGrammars));
in in
mkShell { mkShell {
buildInputs = [
localGem.env
localGem.ruby
];
packages = [ packages = [
gems
gems.wrappedRuby
asciidoctorWrappedWithCustomOptions asciidoctorWrappedWithCustomOptions
git git