Skip to content

Commit

Permalink
work-in-progress Nix support
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbecich committed Oct 17, 2021
1 parent 26bdd60 commit 5a3b4d3
Show file tree
Hide file tree
Showing 15 changed files with 279 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml → .github/workflows/Cabal.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# modified from https://github.com/jgm/pandoc/blob/master/.github/workflows/ci.yml
name: CI
name: Cabal

on:
push:
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/Nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Nix

on:
push:
branches:
- '**'
paths-ignore: []
pull_request:
paths-ignore: []

jobs:
linux:

runs-on: ubuntu-20.04
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2

# https://github.com/marketplace/actions/install-nix
- name: Install Nix
uses: cachix/install-nix-action@v14
with:
extra_nix_config: |
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
substituters = https://hydra.iohk.io https://cache.nixos.org/
- run: nix build
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ CodeWorld
=========

[![Build Status](https://travis-ci.org/google/codeworld.svg?branch=master)](https://travis-ci.org/google/codeworld)
[![Build status](https://github.com/google/codeworld/actions/workflows/ci.yml/badge.svg)](https://github.com/google/codeworld/actions/workflows/ci.yml)
[![Build status](https://github.com/google/codeworld/actions/workflows/Cabal.yml/badge.svg)](https://github.com/google/codeworld/actions/workflows/Cabal.yml)
[![Build status](https://github.com/google/codeworld/actions/workflows/Nix.yml/badge.svg)](https://github.com/google/codeworld/actions/workflows/Nix.yml)

CodeWorld is an educational environment using Haskell. It provides a simple
mathematical model for geometric figures, animations, and interactive and
Expand Down
7 changes: 4 additions & 3 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ packages:
codeworld-account/
codeworld-api/
codeworld-auth/
-- codeworld-available-pkgs/
codeworld-compiler/
codeworld-error-sanitizer/
codeworld-game-api/
codeworld-game-server/
-- codeworld-game-server/
codeworld-prediction/
codeworld-server/
codeworld-base/
-- codeworld-server/
-- codeworld-base/
funblocks-client/
8 changes: 4 additions & 4 deletions codeworld-api/codeworld-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Library
mtl >= 2.2.1 && < 2.3,
random >= 1.1 && < 1.2,
ref-tf >= 0.4 && < 0.5,
reflex >= 0.6.3 && < 0.7,
reflex >= 0.6.3,
template-haskell >= 2.8 && < 2.18,
text >= 1.2.2 && < 1.3,
time >= 1.8 && < 2.0,
Expand All @@ -73,7 +73,7 @@ Library
ghcjs-prim,
codeworld-game-api,
codeworld-prediction,
ghcjs-dom >= 0.9 && < 0.9.4,
ghcjs-dom >= 0.9,
transformers
else
Build-depends: blank-canvas >= 0.6 && < 0.8,
Expand Down Expand Up @@ -122,7 +122,7 @@ Test-suite unit-tests
mtl >= 2.2.1 && < 2.3,
random >= 1.1 && < 1.2,
ref-tf >= 0.4 && < 0.5,
reflex >= 0.6.3 && < 0.7,
reflex >= 0.6.3,
template-haskell >= 2.8 && < 2.18,
text >= 1.2.2 && < 1.3,
time >= 1.8 && < 2.0,
Expand All @@ -134,7 +134,7 @@ Test-suite unit-tests
ghcjs-prim,
codeworld-game-api,
codeworld-prediction,
ghcjs-dom >= 0.9 && < 0.9.4,
ghcjs-dom >= 0.9,
transformers
else
Build-depends: blank-canvas >= 0.6 && < 0.8,
Expand Down
2 changes: 1 addition & 1 deletion codeworld-available-pkgs/codeworld-available-pkgs.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Library
generics-sop,
ghc-prim,
ghcjs-base,
ghcjs-dom,
ghcjs-dom >=0.9,
ghcjs-perch,
ghcjs-prim,
gray-code,
Expand Down
2 changes: 1 addition & 1 deletion codeworld-base/codeworld-base.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Library
codeworld-api,
ghc-prim,
ghcjs-base,
ghcjs-dom,
ghcjs-dom >=0.9,
mtl,
random,
random-shuffle,
Expand Down
8 changes: 5 additions & 3 deletions codeworld-compiler/codeworld-compiler.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,18 @@ Library
directory,
exceptions,
filepath,
ghc == 8.6.5,
ghc-boot-th == 8.6.5,
ghc,
ghc-boot,
ghc-boot-th,
ghc-lib-parser,
hashable,
haskell-src-exts >= 1.20,
megaparsec >= 7.0.0 && < 8.0.0,
memory,
mtl,
process,
regex-base,
regex-tdfa,
regex-tdfa-text,
split,
syb,
temporary,
Expand Down
6 changes: 2 additions & 4 deletions codeworld-error-sanitizer/codeworld-error-sanitizer.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ Library
else
Build-depends: array,
regex-base,
regex-tdfa,
regex-tdfa-text
regex-tdfa

Default-language: Haskell2010
Exposed: True
Expand All @@ -49,7 +48,6 @@ Test-suite unit-tests
else
Build-depends: array,
regex-base,
regex-tdfa,
regex-tdfa-text
regex-tdfa

Default-language: Haskell2010
2 changes: 1 addition & 1 deletion codeworld-requirements/codeworld-requirements.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ library
haskell-src-exts >= 1.20,
mtl,
process,
regex-base,
regex-tdfa,
regex-tdfa-text,
syb,
temporary,
text,
Expand Down
2 changes: 1 addition & 1 deletion codeworld-server/codeworld-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Executable codeworld-server
fast-logger,
filelock,
filepath,
haskell-src-exts < 1.21,
haskell-src-exts,
http-conduit,
lifted-base,
memory,
Expand Down
16 changes: 16 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# https://input-output-hk.github.io/haskell.nix/tutorials/getting-started/
let
sources = import ./nix/sources.nix {};
haskellNix = import sources.haskellNix {};
pkgs = import
haskellNix.sources.nixpkgs-2105
haskellNix.nixpkgsArgs;
in pkgs.pkgsCross.ghcjs.haskell-nix.project {
#in pkgs.haskell-nix.project {
projectFileName = "cabal.project";
src = pkgs.haskell-nix.haskellLib.cleanGit {
name = "haskell-nix-project";
src = ./.;
};
compiler-nix-name = "ghc865";
}
4 changes: 2 additions & 2 deletions funblocks-client/funblocks-client.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ Executable funblocks-client
Build-depends: ghcjs-base,
text,
containers,
ghcjs-dom,
ghcjs-dom >=0.9,
mtl
else
Build-depends: ghcjs-base-stub,
text,
containers,
ghcjs-dom,
ghcjs-dom >=0.9,
mtl
38 changes: 38 additions & 0 deletions nix/sources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"haskellNix": {
"branch": "master",
"description": "Alternative Haskell Infrastructure for Nixpkgs",
"homepage": "https://input-output-hk.github.io/haskell.nix",
"owner": "input-output-hk",
"repo": "haskell.nix",
"rev": "f51f24f8d24c1fd3f3a9bc7e93d008ede09baaab",
"sha256": "16shqxlvfa4hpshrn0wbjlwrvmiqg6l6p4fjpsbr882m26jgk2qx",
"type": "tarball",
"url": "https://github.com/input-output-hk/haskell.nix/archive/f51f24f8d24c1fd3f3a9bc7e93d008ede09baaab.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": "65a61b147f307d24bfd0a5cd56ce7d7b7cc61d2e",
"sha256": "17mirpsx5wyw262fpsd6n6m47jcgw8k2bwcp1iwdnrlzy4dhcgqh",
"type": "tarball",
"url": "https://github.com/nmattia/niv/archive/65a61b147f307d24bfd0a5cd56ce7d7b7cc61d2e.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
"branch": "release-20.03",
"description": "Nix Packages collection",
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "eb73405ecceb1dc505b7cbbd234f8f94165e2696",
"sha256": "06k21wbyhhvq2f1xczszh3c2934p0m02by3l2ixvd6nkwrqklax7",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/eb73405ecceb1dc505b7cbbd234f8f94165e2696.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}

0 comments on commit 5a3b4d3

Please sign in to comment.