diff options
author | Ben Sima <ben@bsima.me> | 2019-02-23 21:46:13 -0800 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2019-02-23 21:46:13 -0800 |
commit | 5dea32c8b804c24ee0bc8c75b14f93b43772b47f (patch) | |
tree | 2bd6d24e3c1ed742c53c18cc7b926311a68a1f6f | |
parent | f75eaf7fff963b88e412d315d0fdef8151943c20 (diff) |
Get rid of cabal
Using just nix and ghc, ah it's so nice.
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | README.md | 11 | ||||
-rw-r--r-- | apex/Ibb.hs (renamed from apex/Main.hs) | 2 | ||||
-rw-r--r-- | bild/.keep | 0 | ||||
-rw-r--r-- | depo/nutin-madaj/configuration.nix | 2 | ||||
-rw-r--r-- | pack/default.nix | 7 | ||||
-rw-r--r-- | pack/ibb.nix | 51 | ||||
-rw-r--r-- | pack/overlay.nix | 3 |
8 files changed, 45 insertions, 33 deletions
@@ -1,6 +1,6 @@ *.o *.exe *.hi -result +result* dist dist-newstyle @@ -4,11 +4,12 @@ aero browser apps, compiled with ghcjs apex server-side api stuff + bild temporary storage for build artifacts chip executable scripts in python, bash depo for deployment, machine-specific nix code, like networking.nix lore shared code, libraries, general code mode nixos modules; services and modular config - pack nix packages, like ibb/default.nix, & external packages that we import + pack nix packages & external packages that we import soar s3/spaces assets, like images, via git-annex Makefile instructions for building the artifacts default.nix contains all the build stuff, combines everything, builds the entire system @@ -19,13 +20,13 @@ This isn't totally in place yet, but it's something to work toward. To get a development shell, for example to work on ibb, you can do: - $ nix-shell pack/ibb.nix + $ nix-shell pack --attr ibb $ ghci - GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help + GHCi, version 8.4.4: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/ben/src/biz/.ghci - λ :load apex/Main.hs + λ :load apex/Ibb.hs [1 of 2] Compiling Influencers ( apex/Influencers.hs, interpreted ) - [2 of 2] Compiling Main ( apex/Main.hs, interpreted ) + [2 of 2] Compiling Ibb ( apex/Ibb.hs, interpreted ) Ok, two modules loaded. # Deployment diff --git a/apex/Main.hs b/apex/Ibb.hs index 27506d8..1472811 100644 --- a/apex/Main.hs +++ b/apex/Ibb.hs @@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} -module Main where +module Ibb where import Control.Monad.IO.Class (liftIO) import Data.ByteString.Lazy (ByteString) diff --git a/bild/.keep b/bild/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bild/.keep diff --git a/depo/nutin-madaj/configuration.nix b/depo/nutin-madaj/configuration.nix index a6d303d..9970d36 100644 --- a/depo/nutin-madaj/configuration.nix +++ b/depo/nutin-madaj/configuration.nix @@ -8,7 +8,7 @@ in { nixpkgs.config.allowUnfree = true; nixpkgs.overlays = [ - (import ../../pack/default.nix) + (import ../../pack/overlay.nix) ]; networking.firewall.allowedTCPPorts = [ 22 80 443 ]; diff --git a/pack/default.nix b/pack/default.nix index 255db4c..ee92fde 100644 --- a/pack/default.nix +++ b/pack/default.nix @@ -1,6 +1,7 @@ -self: super: +{ nixpkgs ? import "${builtins.fetchTarball (import ./nixpkgs.nix)}" {} +}: { - fathom = import ./fathom.nix { nixpkgs = super; }; - ibb = import ./ibb.nix { }; + fathom = import ./fathom.nix { inherit nixpkgs; }; + ibb = import ./ibb.nix { inherit nixpkgs; }; } diff --git a/pack/ibb.nix b/pack/ibb.nix index ba4cae7..6d3e820 100644 --- a/pack/ibb.nix +++ b/pack/ibb.nix @@ -1,23 +1,30 @@ -{ compiler ? "ghc843" -, doHaddock ? false -, doBenchmark ? false -, doCheck ? true -, withHoogle ? false -, nixpkgs ? builtins.fetchTarball (import ./nixpkgs.nix) -}: - -with import "${nixpkgs}" {}; - -haskell.packages.${compiler}.developPackage { - root = ../.; - overrides = with haskell.lib; self: super: { - ghc = - if withHoogle - then super.ghc // {withPackages = super.ghc.withHoogle;} - else super.ghc; - ghcWithPackages = - if withHoogle - then self.ghc.withPackages - else super.ghcWithPackages; - }; +{ nixpkgs }: +with nixpkgs; +let + ghc = pkgs.haskell.packages.ghc844.ghcWithPackages (hp: with hp; [ + blaze-html + blaze-markup + bytestring + random + random-shuffle + scotty + shakespeare + text + ]); +in +stdenv.mkDerivation rec { + name = "ibb"; + version = "0"; + src = ../.; + nativeBuildInputs = [ + ghc + ]; + strictDeps = true; + buildPhase = '' + ${ghc}/bin/ghc -iapex -ilore -main-is Ibb --make apex/Ibb.hs -o bild/${name} + ''; + installPhase = '' + mkdir -p $out/bin + cp bild/${name} $out/bin/${name} + ''; } diff --git a/pack/overlay.nix b/pack/overlay.nix new file mode 100644 index 0000000..b19eeb7 --- /dev/null +++ b/pack/overlay.nix @@ -0,0 +1,3 @@ +self: super: + +import ./default.nix { nixpkgs = super; } |