diff --git a/.gitignore b/.gitignore index 822e2d8..6cfba92 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ dist +dist-newstyle cabal-dev *.o *.hi @@ -17,3 +18,5 @@ cabal.sandbox.config _cache/ _site/ drafts/ +.ghc.* +.envrc diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..23285b2 --- /dev/null +++ b/default.nix @@ -0,0 +1,7 @@ +{ pkgs ? import (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz)) +, haskellCompiler ? "ghc865" +}: + pkgs.haskell-nix.cabalProject { + src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; }; + ghc = pkgs.buildPackages.pkgs.haskell-nix.compiler.${haskellCompiler}; + } diff --git a/shell.nix b/shell.nix index f0081ce..ad944dd 100644 --- a/shell.nix +++ b/shell.nix @@ -1,35 +1,4 @@ -{ nixpkgs ? import {}, compiler ? "default", doBenchmark ? false }: - let - - inherit (nixpkgs) pkgs; - - f = { mkDerivation, base, directory, filepath, hakyll, HTTP - , stdenv, time - }: - mkDerivation { - pname = "nek0-blog"; - version = "0.1.0.0"; - src = ./.; - isLibrary = false; - isExecutable = true; - executableHaskellDepends = [ - base directory filepath hakyll HTTP time - ]; - homepage = "https://nek0.eu"; - description = "My blog"; - license = stdenv.lib.licenses.unfree; - hydraPlatforms = stdenv.lib.platforms.none; - }; - - haskellPackages = if compiler == "default" - then pkgs.haskellPackages - else pkgs.haskell.packages.${compiler}; - - variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id; - - drv = variant (haskellPackages.callPackage f {}); - + hsPkgs = import ./default.nix {}; in - - if pkgs.lib.inNixShell then drv.env else drv + hsPkgs.nek0-blog.components.all diff --git a/shell.nix.bak b/shell.nix.bak new file mode 100644 index 0000000..f0081ce --- /dev/null +++ b/shell.nix.bak @@ -0,0 +1,35 @@ +{ nixpkgs ? import {}, compiler ? "default", doBenchmark ? false }: + +let + + inherit (nixpkgs) pkgs; + + f = { mkDerivation, base, directory, filepath, hakyll, HTTP + , stdenv, time + }: + mkDerivation { + pname = "nek0-blog"; + version = "0.1.0.0"; + src = ./.; + isLibrary = false; + isExecutable = true; + executableHaskellDepends = [ + base directory filepath hakyll HTTP time + ]; + homepage = "https://nek0.eu"; + description = "My blog"; + license = stdenv.lib.licenses.unfree; + hydraPlatforms = stdenv.lib.platforms.none; + }; + + haskellPackages = if compiler == "default" + then pkgs.haskellPackages + else pkgs.haskell.packages.${compiler}; + + variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id; + + drv = variant (haskellPackages.callPackage f {}); + +in + + if pkgs.lib.inNixShell then drv.env else drv