Maintenance: replace generated nix with bundix
parent
aeb3465da4
commit
e5ce7ae429
|
@ -0,0 +1,14 @@
|
|||
source "https://rubygems.org"
|
||||
gem "nanoc", "<4"
|
||||
gem "awesome_print"
|
||||
gem "builder"
|
||||
gem "erubis"
|
||||
gem "image_size"
|
||||
gem "kramdown"
|
||||
gem "nokogiri"
|
||||
gem "org-ruby"
|
||||
gem "pygments.rb"
|
||||
gem "sanitize"
|
||||
gem "sass"
|
||||
gem "tidy_ffi"
|
||||
gem "w3c_validators"
|
|
@ -0,0 +1,60 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
awesome_print (1.6.1)
|
||||
builder (3.2.2)
|
||||
colored (1.2)
|
||||
crass (1.0.2)
|
||||
cri (2.7.0)
|
||||
colored (~> 1.2)
|
||||
erubis (2.7.0)
|
||||
ffi (1.9.10)
|
||||
image_size (1.4.2)
|
||||
json (1.8.3)
|
||||
kramdown (1.10.0)
|
||||
mini_portile2 (2.0.0)
|
||||
nanoc (3.8.0)
|
||||
cri (~> 2.3)
|
||||
nokogiri (1.6.7.2)
|
||||
mini_portile2 (~> 2.0.0.rc2)
|
||||
nokogumbo (1.4.7)
|
||||
nokogiri
|
||||
org-ruby (0.9.12)
|
||||
rubypants (~> 0.2)
|
||||
posix-spawn (0.3.11)
|
||||
pygments.rb (0.6.3)
|
||||
posix-spawn (~> 0.3.6)
|
||||
yajl-ruby (~> 1.2.0)
|
||||
rubypants (0.2.0)
|
||||
sanitize (4.0.1)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.4.4)
|
||||
nokogumbo (~> 1.4.1)
|
||||
sass (3.4.22)
|
||||
tidy_ffi (0.1.6)
|
||||
ffi (~> 1.2)
|
||||
w3c_validators (1.2)
|
||||
json
|
||||
nokogiri
|
||||
yajl-ruby (1.2.1)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
awesome_print
|
||||
builder
|
||||
erubis
|
||||
image_size
|
||||
kramdown
|
||||
nanoc (< 4)
|
||||
nokogiri
|
||||
org-ruby
|
||||
pygments.rb
|
||||
sanitize
|
||||
sass
|
||||
tidy_ffi
|
||||
w3c_validators
|
||||
|
||||
BUNDLED WITH
|
||||
1.11.2
|
|
@ -1,160 +1,32 @@
|
|||
{ pkgs ? import <nixpkgs> {}
|
||||
}: let
|
||||
inherit (pkgs)
|
||||
callPackage buildRubyGem lib ruby_2_2 libtidy
|
||||
lib ruby_2_2 libtidy bundlerEnv defaultGemConfig
|
||||
perlPackages pythonPackages glibcLocales;
|
||||
inherit (lib) optionalAttrs hasAttr mapAttrs;
|
||||
hotfix = mapAttrs (_: f: f {}) (callPackage <nixpkgs/pkgs/development/interpreters/ruby/bundler-env/default-gem-config.nix> {}) // {
|
||||
tidy_ffi = {
|
||||
postInstall = ''
|
||||
substituteInPlace $out/lib/ruby/gems/2.2.0/gems/tidy_ffi-0.1.6/lib/tidy_ffi/lib_tidy.rb --replace 'usr' ${libtidy}
|
||||
'';
|
||||
};
|
||||
|
||||
gemconfig = {
|
||||
tidy_ffi = attrs: {
|
||||
dontBuild = false;
|
||||
postPatch = ''
|
||||
ls -R
|
||||
substituteInPlace lib/tidy_ffi/lib_tidy.rb --replace 'usr' ${libtidy}
|
||||
'';
|
||||
};
|
||||
awesome_print = buildRubyGem ({
|
||||
name = ''awesome_print-1.6.1'';
|
||||
sha256 = ''1vwgsgyyq87iwjxi8bwh56fj3bzx7x2vjv1m6yih1fbhnbcyi2qd'';
|
||||
gemPath = [];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''awesome_print'' hotfix) hotfix.awesome_print);
|
||||
builder = buildRubyGem ({
|
||||
name = ''builder-3.2.2'';
|
||||
sha256 = ''14fii7ab8qszrvsvhz6z2z3i4dw0h41a62fjr2h1j8m41vbrmyv2'';
|
||||
gemPath = [];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''builder'' hotfix) hotfix.builder);
|
||||
erubis = buildRubyGem ({
|
||||
name = ''erubis-2.7.0'';
|
||||
sha256 = ''1fj827xqjs91yqsydf0zmfyw9p4l2jz5yikg3mppz6d7fi8kyrb3'';
|
||||
gemPath = [];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''erubis'' hotfix) hotfix.erubis);
|
||||
image_size = buildRubyGem ({
|
||||
name = ''image_size-1.4.1'';
|
||||
sha256 = ''0r42q2mfm2ab05qpl7l1smlj2pwx9v3cajy5j3xz67vs6fg49nmj'';
|
||||
gemPath = [];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''image_size'' hotfix) hotfix.image_size);
|
||||
kramdown = buildRubyGem ({
|
||||
name = ''kramdown-1.7.0'';
|
||||
sha256 = ''070r81kz88zw28c8bs5p0p92ymn1nldci2fm1arkas0bnqrd3rna'';
|
||||
gemPath = [];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''kramdown'' hotfix) hotfix.kramdown);
|
||||
nanoc = buildRubyGem ({
|
||||
name = ''nanoc-3.8.0'';
|
||||
sha256 = ''07paijr9w6h72b40q2cky3vzf5m4ggirbsdfgr9rf6pac7brf8rq'';
|
||||
gemPath = [cri ];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''nanoc'' hotfix) hotfix.nanoc);
|
||||
cri = buildRubyGem ({
|
||||
name = ''cri-2.7.0'';
|
||||
sha256 = ''0qpdyfgk7gnqycn8l2dxxh55j825axf6fbwqx8cady5hzry667l6'';
|
||||
gemPath = [colored ];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''cri'' hotfix) hotfix.cri);
|
||||
colored = buildRubyGem ({
|
||||
name = ''colored-1.2'';
|
||||
sha256 = ''0b0x5jmsyi0z69bm6sij1k89z7h0laag3cb4mdn7zkl9qmxb90lx'';
|
||||
gemPath = [];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''colored'' hotfix) hotfix.colored);
|
||||
nokogiri = buildRubyGem ({
|
||||
name = ''nokogiri-1.6.6.2'';
|
||||
sha256 = ''1j4qv32qjh67dcrc1yy1h8sqjnny8siyy4s44awla8d6jk361h30'';
|
||||
gemPath = [mini_portile ];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''nokogiri'' hotfix) hotfix.nokogiri);
|
||||
mini_portile = buildRubyGem ({
|
||||
name = ''mini_portile-0.6.2'';
|
||||
sha256 = ''0h3xinmacscrnkczq44s6pnhrp4nqma7k056x5wv5xixvf2wsq2w'';
|
||||
gemPath = [];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''mini_portile'' hotfix) hotfix.mini_portile);
|
||||
org-ruby = buildRubyGem ({
|
||||
name = ''org-ruby-0.9.12'';
|
||||
sha256 = ''0x69s7aysfiwlcpd9hkvksfyld34d8kxr62adb59vjvh8hxfrjwk'';
|
||||
gemPath = [rubypants ];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''org-ruby'' hotfix) hotfix.org-ruby);
|
||||
rubypants = buildRubyGem ({
|
||||
name = ''rubypants-0.2.0'';
|
||||
sha256 = ''1vpdkrc4c8qhrxph41wqwswl28q5h5h994gy4c1mlrckqzm3hzph'';
|
||||
gemPath = [];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''rubypants'' hotfix) hotfix.rubypants);
|
||||
pygments.rb = buildRubyGem ({
|
||||
name = ''pygments.rb-0.6.3'';
|
||||
sha256 = ''160i761q2z8kandcikf2r5318glgi3pf6b45wa407wacjvz2966i'';
|
||||
gemPath = [posix-spawn yajl-ruby ];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''pygments.rb'' hotfix) hotfix.pygments.rb);
|
||||
posix-spawn = buildRubyGem ({
|
||||
name = ''posix-spawn-0.3.9'';
|
||||
sha256 = ''042i1afggy1sv2jmdjjjhyffas28xp2r1ylj5xfv3hchy3b4civ3'';
|
||||
gemPath = [];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''posix-spawn'' hotfix) hotfix.posix-spawn);
|
||||
yajl-ruby = buildRubyGem ({
|
||||
name = ''yajl-ruby-1.2.1'';
|
||||
sha256 = ''0zvvb7i1bl98k3zkdrnx9vasq0rp2cyy5n7p9804dqs4fz9xh9vf'';
|
||||
gemPath = [];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''yajl-ruby'' hotfix) hotfix.yajl-ruby);
|
||||
sanitize = buildRubyGem ({
|
||||
name = ''sanitize-4.0.0'';
|
||||
sha256 = ''0sk78s5ivpgf7yc6mxcqqs3jjyk8db3yc2rdj1ayi64yc2f5qi2n'';
|
||||
gemPath = [crass nokogiri nokogumbo ];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''sanitize'' hotfix) hotfix.sanitize);
|
||||
crass = buildRubyGem ({
|
||||
name = ''crass-1.0.2'';
|
||||
sha256 = ''1c377r8g7m58y22803iyjgqkkvnnii0pymskda1pardxrzaighj9'';
|
||||
gemPath = [];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''crass'' hotfix) hotfix.crass);
|
||||
nokogumbo = buildRubyGem ({
|
||||
name = ''nokogumbo-1.4.1'';
|
||||
sha256 = ''0s47jdvfqmcs8bggnk1i8cbrci0k548aygjdamfb9jgfqrl3l552'';
|
||||
gemPath = [nokogiri ];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''nokogumbo'' hotfix) hotfix.nokogumbo);
|
||||
sass = buildRubyGem ({
|
||||
name = ''sass-3.4.13'';
|
||||
sha256 = ''0wxkjm41xr77pnfi06cbwv6vq0ypbni03jpbpskd7rj5b0zr27ig'';
|
||||
gemPath = [];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''sass'' hotfix) hotfix.sass);
|
||||
tidy_ffi = buildRubyGem ({
|
||||
name = ''tidy_ffi-0.1.6'';
|
||||
sha256 = ''0mz8zr6xvfj2rhznydxqlkkgn9samxlwklc9v2z9bbzl4bzbddi5'';
|
||||
gemPath = [ffi ];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''tidy_ffi'' hotfix) hotfix.tidy_ffi);
|
||||
ffi = buildRubyGem ({
|
||||
name = ''ffi-1.9.8'';
|
||||
sha256 = ''0ph098bv92rn5wl6rn2hwb4ng24v4187sz8pa0bpi9jfh50im879'';
|
||||
gemPath = [];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''ffi'' hotfix) hotfix.ffi);
|
||||
w3c_validators = buildRubyGem ({
|
||||
name = ''w3c_validators-1.2'';
|
||||
sha256 = ''0kz0y6ki2q0xplxhk1aamp8x2pmgkvkfwhz7g481dg44gqlw5pbb'';
|
||||
gemPath = [json nokogiri ];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''w3c_validators'' hotfix) hotfix.w3c_validators);
|
||||
json = buildRubyGem ({
|
||||
name = ''json-1.8.2'';
|
||||
sha256 = ''0zzvv25vjikavd3b1bp6lvbgj23vv9jvmnl4vpim8pv30z8p6vr5'';
|
||||
gemPath = [];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''json'' hotfix) hotfix.json);
|
||||
};
|
||||
muflax-env = bundlerEnv {
|
||||
name = "muflax-blog-env";
|
||||
gemConfig = defaultGemConfig // gemconfig;
|
||||
ruby = ruby_2_2;
|
||||
gemfile = ./Gemfile;
|
||||
lockfile = ./Gemfile.lock;
|
||||
gemset = ./gemset.nix;
|
||||
};
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
name = "muflax.com";
|
||||
src = ../.;
|
||||
LC_ALL="en_US.UTF-8";
|
||||
buildInputs =
|
||||
[awesome_print builder erubis image_size kramdown nanoc nokogiri org-ruby pygments.rb sanitize sass tidy_ffi w3c_validators ] ++
|
||||
[muflax-env] ++
|
||||
[perlPackages.ImageExifTool pythonPackages.pygments glibcLocales];
|
||||
patchPhase = ''
|
||||
sed -i 's/do$/do |_, _|/' commands/backup/*
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p bash curl gnugrep jq gawk libxml2 nix-prefetch-scripts
|
||||
#: Above includes transitive dependencies of our libraries, would be great to specify them at the usage site.
|
||||
|
||||
GemCache="$(mktemp ${TMPDIR:-/tmp}/GEMS.XXXXXXX)"
|
||||
source "$(dirname $(realpath $0))/lib/rubygems.sh"
|
||||
source "$(dirname $(realpath $0))/lib/prelude.sh"
|
||||
|
||||
TopLevelDependencies() {
|
||||
( # Nanoc isn't an explicit dependency:
|
||||
echo nanoc;
|
||||
# We want its filters too; and those aren't referenced in the gemspec.
|
||||
# But we really don't need all of them. (There are a lot.)
|
||||
# For now they're being incorporated on an ad-hoc basis:
|
||||
tr ' ' '\n' <<< "sass kramdown erubis pygments.rb w3c_validators builder";
|
||||
# Local requires, hopefully there aren't any gems named differently from their imports.
|
||||
grep -Proh "(?<=require ['\"])[^/'\"]+" ..;
|
||||
) | sort -u | Filter IsRubyGem
|
||||
};
|
||||
|
||||
cat <<EOF
|
||||
{ pkgs ? import <nixpkgs> {}
|
||||
}: let
|
||||
inherit (pkgs)
|
||||
callPackage buildRubyGem lib ruby_2_2 libtidy
|
||||
perlPackages pythonPackages glibcLocales;
|
||||
inherit (lib) optionalAttrs hasAttr mapAttrs;
|
||||
hotfix = mapAttrs (_: f: f {}) (callPackage <nixpkgs/pkgs/development/interpreters/ruby/bundler-env/default-gem-config.nix> {}) // {
|
||||
tidy_ffi = {
|
||||
postInstall = ''
|
||||
substituteInPlace \$out/lib/ruby/gems/2.2.0/gems/tidy_ffi-0.1.6/lib/tidy_ffi/lib_tidy.rb --replace 'usr' \${libtidy}
|
||||
'';
|
||||
};
|
||||
};
|
||||
EOF
|
||||
TopLevelDependencies | Map Gem2Nix
|
||||
cat <<EOF
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
name = "muflax.com";
|
||||
src = ../.;
|
||||
LC_ALL="en_US.UTF-8";
|
||||
buildInputs =
|
||||
[$(TopLevelDependencies | tr '\n' ' ')] ++
|
||||
[perlPackages.ImageExifTool pythonPackages.pygments glibcLocales];
|
||||
patchPhase = ''
|
||||
sed -i 's/do$/do |_, _|/' commands/backup/*
|
||||
'';
|
||||
buildPhase = ''
|
||||
nanoc references
|
||||
nanoc images
|
||||
for site in blog daily gospel muflax; do
|
||||
nanoc compile -s \$site
|
||||
done
|
||||
'';
|
||||
installPhase = ''
|
||||
mv out \$out
|
||||
'';
|
||||
}
|
||||
EOF
|
|
@ -0,0 +1,186 @@
|
|||
{
|
||||
awesome_print = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "1vwgsgyyq87iwjxi8bwh56fj3bzx7x2vjv1m6yih1fbhnbcyi2qd";
|
||||
type = "gem";
|
||||
};
|
||||
version = "1.6.1";
|
||||
};
|
||||
builder = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "14fii7ab8qszrvsvhz6z2z3i4dw0h41a62fjr2h1j8m41vbrmyv2";
|
||||
type = "gem";
|
||||
};
|
||||
version = "3.2.2";
|
||||
};
|
||||
colored = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "0b0x5jmsyi0z69bm6sij1k89z7h0laag3cb4mdn7zkl9qmxb90lx";
|
||||
type = "gem";
|
||||
};
|
||||
version = "1.2";
|
||||
};
|
||||
crass = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "1c377r8g7m58y22803iyjgqkkvnnii0pymskda1pardxrzaighj9";
|
||||
type = "gem";
|
||||
};
|
||||
version = "1.0.2";
|
||||
};
|
||||
cri = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "0qpdyfgk7gnqycn8l2dxxh55j825axf6fbwqx8cady5hzry667l6";
|
||||
type = "gem";
|
||||
};
|
||||
version = "2.7.0";
|
||||
};
|
||||
erubis = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "1fj827xqjs91yqsydf0zmfyw9p4l2jz5yikg3mppz6d7fi8kyrb3";
|
||||
type = "gem";
|
||||
};
|
||||
version = "2.7.0";
|
||||
};
|
||||
ffi = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "1m5mprppw0xcrv2mkim5zsk70v089ajzqiq5hpyb0xg96fcyzyxj";
|
||||
type = "gem";
|
||||
};
|
||||
version = "1.9.10";
|
||||
};
|
||||
image_size = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "1a6qkqs45c22222x8x224734gbazs2d9h7rc9a9vmz0b9y5awflw";
|
||||
type = "gem";
|
||||
};
|
||||
version = "1.4.2";
|
||||
};
|
||||
json = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "1nsby6ry8l9xg3yw4adlhk2pnc7i0h0rznvcss4vk3v74qg0k8lc";
|
||||
type = "gem";
|
||||
};
|
||||
version = "1.8.3";
|
||||
};
|
||||
kramdown = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "103cr77xcf9kc3asw23i0v4z6kwm8i1j8blgxsf3b7vaiwshbra0";
|
||||
type = "gem";
|
||||
};
|
||||
version = "1.10.0";
|
||||
};
|
||||
mini_portile2 = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "056drbn5m4khdxly1asmiik14nyllswr6sh3wallvsywwdiryz8l";
|
||||
type = "gem";
|
||||
};
|
||||
version = "2.0.0";
|
||||
};
|
||||
nanoc = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "07paijr9w6h72b40q2cky3vzf5m4ggirbsdfgr9rf6pac7brf8rq";
|
||||
type = "gem";
|
||||
};
|
||||
version = "3.8.0";
|
||||
};
|
||||
nokogiri = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "11sbmpy60ynak6s3794q32lc99hs448msjy8rkp84ay7mq7zqspv";
|
||||
type = "gem";
|
||||
};
|
||||
version = "1.6.7.2";
|
||||
};
|
||||
nokogumbo = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "0yax525nvp4hf79nbfxmcbf6yvfhz8x9gkjc207yzalaxdbv3b9r";
|
||||
type = "gem";
|
||||
};
|
||||
version = "1.4.7";
|
||||
};
|
||||
org-ruby = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "0x69s7aysfiwlcpd9hkvksfyld34d8kxr62adb59vjvh8hxfrjwk";
|
||||
type = "gem";
|
||||
};
|
||||
version = "0.9.12";
|
||||
};
|
||||
posix-spawn = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "052lnxbkvlnwfjw4qd7vn2xrlaaqiav6f5x5bcjin97bsrfq6cmr";
|
||||
type = "gem";
|
||||
};
|
||||
version = "0.3.11";
|
||||
};
|
||||
"pygments.rb" = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "160i761q2z8kandcikf2r5318glgi3pf6b45wa407wacjvz2966i";
|
||||
type = "gem";
|
||||
};
|
||||
version = "0.6.3";
|
||||
};
|
||||
rubypants = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "1vpdkrc4c8qhrxph41wqwswl28q5h5h994gy4c1mlrckqzm3hzph";
|
||||
type = "gem";
|
||||
};
|
||||
version = "0.2.0";
|
||||
};
|
||||
sanitize = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "07igwnb32b2qb7zv093fsjfcngsf8r5rsf2jn15zf821sif357bw";
|
||||
type = "gem";
|
||||
};
|
||||
version = "4.0.1";
|
||||
};
|
||||
sass = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "0dkj6v26fkg1g0majqswwmhxva7cd6p3psrhdlx93qal72dssywy";
|
||||
type = "gem";
|
||||
};
|
||||
version = "3.4.22";
|
||||
};
|
||||
tidy_ffi = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "0mz8zr6xvfj2rhznydxqlkkgn9samxlwklc9v2z9bbzl4bzbddi5";
|
||||
type = "gem";
|
||||
};
|
||||
version = "0.1.6";
|
||||
};
|
||||
w3c_validators = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "0kz0y6ki2q0xplxhk1aamp8x2pmgkvkfwhz7g481dg44gqlw5pbb";
|
||||
type = "gem";
|
||||
};
|
||||
version = "1.2";
|
||||
};
|
||||
yajl-ruby = {
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
sha256 = "0zvvb7i1bl98k3zkdrnx9vasq0rp2cyy5n7p9804dqs4fz9xh9vf";
|
||||
type = "gem";
|
||||
};
|
||||
version = "1.2.1";
|
||||
};
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p bash curl bundix bundler
|
||||
#: Above includes transitive dependencies of our libraries, would be great to specify them at the usage site.
|
||||
# workaround for https://github.com/NixOS/nixpkgs/issues/13744
|
||||
if [[ $SSL_CERT_FILE == "/no-cert-file.crt" ]];
|
||||
then unset SSL_CERT_FILE;
|
||||
fi
|
||||
source "$(dirname $(realpath $0))/lib/rubygems.sh"
|
||||
source "$(dirname $(realpath $0))/lib/prelude.sh"
|
||||
|
||||
TopLevelDependencies() {
|
||||
echo gem \"nanoc\", \"\<4\";
|
||||
( # Nanoc isn't an explicit dependency:
|
||||
# We want its filters too; and those aren't referenced in the gemspec.
|
||||
# But we really don't need all of them. (There are a lot.)
|
||||
# For now they're being incorporated on an ad-hoc basis:
|
||||
tr ' ' '\n' <<< "sass kramdown erubis pygments.rb w3c_validators builder";
|
||||
# Local requires, hopefully there aren't any gems named differently from their imports.
|
||||
grep -Proh "(?<=require ['\"])[^/'\"]+" ..;
|
||||
) | sort -u | Filter IsRubyGem | Map Gem2Gemfile
|
||||
};
|
||||
|
||||
rm -rf Gemfile.lock bundle/ .bundle/ Gemfile gemset.nix
|
||||
|
||||
echo "source \"https://rubygems.org\"" > Gemfile
|
||||
TopLevelDependencies >> Gemfile
|
||||
|
||||
bundler package --no-install --path bundle/
|
||||
rm -rf bundle/ .bundle/ vendor/
|
||||
|
||||
bundix
|
||||
|
|
@ -1,87 +1,10 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
source "$(dirname $(readlink -f ${BASH_SOURCE[0]}))/prelude.sh"
|
||||
|
||||
IsRubyGem() {
|
||||
test 200 = "$(curl -sL -w '%{http_code}' https://rubygems.org/api/v1/gems/$1.json -o /dev/null)";
|
||||
};
|
||||
|
||||
GetLatestVersion() {
|
||||
curl -sL https://rubygems.org/api/v1/gems/$1.json | jq -r '.version'
|
||||
};
|
||||
|
||||
read -r -d '' AWKPrelude <<EOF
|
||||
@include "join";
|
||||
function unescape(str) {
|
||||
gsub(">",">",str);
|
||||
gsub("<","<",str);
|
||||
gsub(/^= /,"== ",str);
|
||||
return str;
|
||||
}
|
||||
function ver(str) {
|
||||
n=split(str,xs,".");
|
||||
v=xs[1]; for(i=2;i<=n;i++)
|
||||
v+=xs[i]*(10**(1-i));
|
||||
return v
|
||||
}
|
||||
function unwakka(str) {
|
||||
if (str ~ /^~>/) {
|
||||
sub(/^[^ ]+ */,"",str);
|
||||
n=split(str,xs,".");xs[n-1]++;xs[n]=0;
|
||||
return(sprintf(">= %s, < %s", str, join(xs,1,n,".")));
|
||||
} else return str
|
||||
};
|
||||
EOF
|
||||
|
||||
CompileConstraint() {
|
||||
awk "$AWKPrelude"'
|
||||
NF {
|
||||
printf "%s;", $1;
|
||||
sub(".*" $1 FS, "");
|
||||
sub($0, unwakka(unescape($0)));
|
||||
split($0, xs, ", "); for (x in xs)
|
||||
split(xs[x],ys," ");
|
||||
printf "ver($0) %s %s && ", ys[1], ver(ys[2])
|
||||
print "1"
|
||||
}
|
||||
';
|
||||
};
|
||||
|
||||
SatisfyConstraint() {
|
||||
GemName="$1"; Constraint="$2";
|
||||
curl -s https://rubygems.org/api/v1/versions/$GemName.json \
|
||||
| jq -r '.[] | .number' \
|
||||
| awk "$AWKPrelude ($Constraint){print;exit}"
|
||||
};
|
||||
|
||||
GetDependencies() {
|
||||
# The RubyGems API doesn't seem to permit retrieving the dependencies of any
|
||||
# version other than the most recent, so we resort to scraping.
|
||||
GemName="$1"; GemVersion="$2";
|
||||
curl -s https://rubygems.org/gems/$GemName/versions/$GemVersion \
|
||||
| xmllint --xpath '//div[@id="runtime_dependencies"]/div/a//text()' --html 2>/dev/null - \
|
||||
| CompileConstraint \
|
||||
| { IFS=";"; while read -r Name Constraint; do
|
||||
Version="$(SatisfyConstraint "$Name" "$Constraint")"
|
||||
test -n "$Name" && test -n "$Version" && echo "$Name" "$Version"
|
||||
done; }
|
||||
};
|
||||
|
||||
GetSHA256() {
|
||||
nix-prefetch-url https://rubygems.org/downloads/$1.gem 2>/dev/null
|
||||
};
|
||||
|
||||
Gem2Nix() {
|
||||
GemName=$1; GemVersion="${2:-$(GetLatestVersion $GemName)}";
|
||||
grep -qE "^$GemName" "$GemCache" || {
|
||||
echo $GemName >> "$GemCache";
|
||||
sed 's/^ //;/^$/d' <<< "
|
||||
$GemName = buildRubyGem ({
|
||||
name = ''$GemName-$GemVersion'';
|
||||
sha256 = ''$(GetSHA256 $GemName-$GemVersion)'';
|
||||
gemPath = [$(GetDependencies "$GemName" "$GemVersion" | cut -d' ' -f1 | tr '\n' ' ')];
|
||||
ruby = ruby_2_2;
|
||||
} // optionalAttrs (hasAttr ''$GemName'' hotfix) hotfix.$GemName);
|
||||
"; GetDependencies "$GemName" "$GemVersion" | Map Gem2Nix
|
||||
};
|
||||
};
|
||||
Gem2Gemfile() {
|
||||
echo gem \"$1\"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue