Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
inaugural commit
Browse files Browse the repository at this point in the history
  • Loading branch information
manveru committed Oct 1, 2019
0 parents commit da0dc88
Show file tree
Hide file tree
Showing 9 changed files with 22,807 additions and 0 deletions.
1 change: 1 addition & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let pkgs = import ./nix {}; in pkgs.packages
11 changes: 11 additions & 0 deletions nix/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{ sources ? import ./sources.nix }:
with
{ overlay = _: pkgs:
{ inherit (import sources.niv {}) niv;
packages = pkgs.callPackages ./packages.nix {};
inherit (import sources.yarn2nix { inherit pkgs; }) yarn2nix mkYarnPackage mkYarnModules;
js-chain-libs = sources.js-chain-libs;
};
};
import sources.nixpkgs
{ overlays = [ overlay ] ; config = {}; }
62 changes: 62 additions & 0 deletions nix/packages.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{ mkYarnPackage, mkYarnModules, stdenv, nodejs, yarn, python, js-chain-libs }:
let
inherit (stdenv) lib;

src = js-chain-libs + "/examples/explorer";
in rec {
jormungandr-explorer = stdenv.mkDerivation {
name = "jormungandr-explorer";
inherit src;

nativeBuildInputs = [ react-scripts yarn ];

buildPhase = ''
ln -s ${react-scripts}/libexec/jormungandr-explorer/node_modules/
yarn run relay
yarn run build
'';

installPhase = ''
cp -r build $out
'';
};

yarn-modules = mkYarnModules {
name = "jormungandr-explorer";
pname = "jormungandr-explorer";
version = "0.1.0";

packageJSON = ../package.json;
yarnLock = ../yarn.lock;
yarnNix = ../yarn.nix;
};

react-scripts = mkYarnPackage {
name = "react-scripts";
inherit src;

packageJSON = ../package.json;
yarnLock = ../yarn.lock;
yarnNix = ../yarn.nix;

publishBinsFor = ["react-scripts" "relay-compiler"];

yarnPreBuild = ''
mkdir -p $HOME/.node-gyp/${nodejs.version}
echo 9 > $HOME/.node-gyp/${nodejs.version}/installVersion
ln -sfv ${nodejs}/include $HOME/.node-gyp/${nodejs.version}
'';

pkgConfig = {
node-sass = {
buildInputs = [ python ];
postInstall = ''
${nodejs}/lib/node_modules/npm/bin/node-gyp-bin/node-gyp configure
${nodejs}/lib/node_modules/npm/bin/node-gyp-bin/node-gyp build
mkdir -p vendor/linux-x64-57
mv build/Release/binding.node vendor/linux-x64-57/binding.node
'';
};
};
};
}
46 changes: 46 additions & 0 deletions nix/sources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"js-chain-libs": {
"branch": "master",
"description": "chain-libs javascript SDK",
"homepage": null,
"owner": "input-output-hk",
"repo": "js-chain-libs",
"rev": "22e57a257f87273e289174dfc58f92d867fb3b03",
"sha256": "1vy1ll61ni7z8cg6avw523h12azbk2vikq3mgbfi8qwv8cwf0ib0",
"type": "tarball",
"url": "https://github.com/input-output-hk/js-chain-libs/archive/22e57a257f87273e289174dfc58f92d867fb3b03.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"niv": {
"branch": "master",
"description": "Easy dependency management for Nix projects",
"homepage": "https://github.com/nmattia/niv",
"owner": "nmattia",
"repo": "niv",
"rev": "1dd094156b249586b66c16200ecfd365c7428dc0",
"sha256": "1b2vjnn8iac5iiqszjc2v1s1ygh0yri998c0k3s4x4kn0dsqik21",
"url": "https://github.com/nmattia/niv/archive/1dd094156b249586b66c16200ecfd365c7428dc0.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "nixos-18.09",
"description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to",
"homepage": "https://github.com/NixOS/nixpkgs",
"owner": "NixOS",
"repo": "nixpkgs-channels",
"rev": "a7e559a5504572008567383c3dc8e142fa7a8633",
"sha256": "16j95q58kkc69lfgpjkj76gw5sx8rcxwi3civm0mlfaxxyw9gzp6",
"url": "https://github.com/NixOS/nixpkgs-channels/archive/a7e559a5504572008567383c3dc8e142fa7a8633.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"yarn2nix": {
"branch": "master",
"description": "Generate nix expressions from a yarn.lock file",
"owner": "moretea",
"repo": "yarn2nix",
"rev": "7effadded30d611a460e212cb73614506ef61c52",
"sha256": "0r4ww3mjx3n7bn2v1iav33liyphyr2x005ak6644qs15bp4bn3cr",
"url": "https://github.com/moretea/yarn2nix/archive/7effadded30d611a460e212cb73614506ef61c52.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}
26 changes: 26 additions & 0 deletions nix/sources.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# A record, from name to path, of the third-party packages
with
{
versions = builtins.fromJSON (builtins.readFile ./sources.json);

# fetchTarball version that is compatible between all the versions of Nix
fetchTarball =
{ url, sha256 }:
if builtins.lessThan builtins.nixVersion "1.12" then
builtins.fetchTarball { inherit url; }
else
builtins.fetchTarball { inherit url sha256; };
};

# NOTE: spec must _not_ have an "outPath" attribute
builtins.mapAttrs (_: spec:
if builtins.hasAttr "outPath" spec
then abort
"The values in versions.json should not have an 'outPath' attribute"
else
if builtins.hasAttr "url" spec && builtins.hasAttr "sha256" spec
then
spec //
{ outPath = fetchTarball { inherit (spec) url sha256; } ; }
else spec
) versions
66 changes: 66 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"name": "jormungandr-explorer",
"keywords": [
"cardano",
"ada",
"jormungandr",
"cryptocurrency",
"crypto",
"blockchain",
"explorer",
"react"
],
"version": "0.1.0",
"private": true,
"dependencies": {
"@reach/router": "1.2.1",
"bootstrap": "4.3.1",
"graphql": "14.5.8",
"node-sass": "4.12.0",
"react": "16.9.0",
"react-bootstrap": "1.0.0-beta.12",
"react-dom": "16.9.0",
"react-relay": "6.0.0",
"react-scripts": "3.1.1"
},
"devDependencies": {
"babel-plugin-relay": "6.0.0",
"eslint": "6.4.0",
"eslint-config-airbnb": "18.0.1",
"eslint-config-prettier": "6.3.0",
"eslint-plugin-css-modules": "2.11.0",
"eslint-plugin-import": "2.18.2",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-prettier": "3.1.1",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-react": "7.14.3",
"eslint-plugin-react-hooks": "1.7.0",
"prettier": "1.18.2",
"relay-compiler": "6.0.0",
"relay-config": "6.0.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"eslint": "./node_modules/eslint/bin/eslint.js . --ext .jsx --ext .js",
"eslint-fix": "./node_modules/eslint/bin/eslint.js . --ext .jsx --ext .js --fix",
"relay": "relay-compiler --src ./src --schema ./data/schema.graphql --extensions js jsx"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
8 changes: 8 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
with import ./nix {};
mkShell {
buildInputs = [
niv
yarn
yarn2nix
];
}

0 comments on commit da0dc88

Please sign in to comment.