#153 bind to 0.0.0.0 instead of localhost (#154)

* Bind to 0.0.0.0 instead of localhost

* Don't use nixjs for purescript

* Use lorri

* Use niv

* Use nix for travis build

* Clean up travis config
This commit is contained in:
Connor Prussin 2020-02-26 16:43:38 -08:00 committed by GitHub
parent 91224a955f
commit 61b88de59b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 44 additions and 25 deletions

2
.envrc
View File

@ -1 +1 @@
use nix
eval "$(lorri direnv)"

View File

@ -1,18 +1,4 @@
language: node_js
dist: trusty
sudo: required
node_js: stable
language: nix
notifications:
email: false
env:
- PATH=$HOME/purescript:$PATH
install:
- TAG=$(wget -q -O - https://github.com/purescript/purescript/releases/latest --server-response --max-redirect 0 2>&1 | sed -n -e 's/.*Location:.*tag\///p')
- wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
- tar -xvf $HOME/purescript.tar.gz -C $HOME/
- chmod a+x $HOME/purescript
- npm install -g bower pulp purescript-psa psc-package
script:
- make test
after_success:
- test -n $TRAVIS_TAG && (echo $GITHUB_TOKEN | pulp login) && (yes | pulp publish --no-push)
script: nix-shell --run 'make test'

View File

@ -1,16 +1,23 @@
{
purescript ? "0.12.4",
nixjs ? fetchTarball "https://github.com/cprussin/nixjs/tarball/release-19.03",
nixpkgs ? <nixpkgs>
}:
{ sources ? import ./sources.nix }:
let
nixjs-overlay = import nixjs { inherit purescript; };
pkgs = import nixpkgs { overlays = [ nixjs-overlay ]; };
niv-overlay = self: _: {
niv = self.symlinkJoin {
name = "niv";
paths = [ sources.niv ];
buildInputs = [ self.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/niv \
--add-flags "--sources-file ${toString ./sources.json}"
'';
};
};
pkgs = import sources.nixpkgs { overlays = [ niv-overlay ]; };
in
pkgs.mkShell {
buildInputs = [
pkgs.niv
pkgs.git
pkgs.nodejs
pkgs.yarn

14
sources.json Normal file
View File

@ -0,0 +1,14 @@
{
"nixpkgs": {
"branch": "nixos-19.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": "b7bbc6d37878ed00b6467b574b02e840279f7d3d",
"sha256": "02q10jgi6m0vak3amb50ifw1pj82i17hs0npdkig7lsp8w3is7jq",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs-channels/archive/b7bbc6d37878ed00b6467b574b02e840279f7d3d.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}

12
sources.nix Normal file
View File

@ -0,0 +1,12 @@
let
nivSrc = fetchTarball {
url = "https://github.com/nmattia/niv/tarball/4f038fc598d5494f5d16302270edc61ab2898c79";
sha256 = "1dwfkd942wisccpsv0kf47abl0n17d9v4zasv4bm8lvy1dhv82ia";
};
sources = import "${nivSrc}/nix/sources.nix" {
sourcesFile = ./sources.json;
};
niv = import nivSrc {};
in
niv // sources

View File

@ -81,7 +81,7 @@ serveSecure' sslOptions options router onStarted = do
-- | Given a port number, return a `HTTP.ListenOptions` `Record`.
listenOptions :: Int -> HTTP.ListenOptions
listenOptions port =
{ hostname: "localhost"
{ hostname: "0.0.0.0"
, port: port
, backlog: Maybe.Nothing
}