-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.nix
109 lines (88 loc) · 3.09 KB
/
shell.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
{
# bootstrap ? import <nixpkgs> {},
compiler ? "ghc883", doBenchmark ? false }:
let
# fetcher = { owner, repo, rev, sha256, ... }: builtins.fetchTarball {
# inherit sha256;
# url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
# };
# inherit (bootstrap) lib;
# versions = lib.mapAttrs
# (_:fetcher)
# (builtins.fromJSON (builtins.readFile ./versions.json));
# pkgs = import versions.nixpkgs {};
sources = import ./nix/sources.nix;
haskellNix = import sources."haskell.nix" { };
nixpkgsSrc = haskellNix.sources.nixpkgs-2003;
# nixpkgs = import sources.nixpkgs haskellNix.nixpkgsArgs;
nixpkgs = import nixpkgsSrc haskellNix.nixpkgsArgs;
haskell = nixpkgs.haskell-nix;
project = haskell.cabalProject {
src = haskell.haskellLib.cleanGit {
name = "blog-hakyll";
src = ./.;
};
compiler-nix-name = compiler;
configureArgs = "";
modules = [ ];
index-state = "2020-07-05T00:00:00Z";
# plan-sha256 = "1v71yj9zwcblcvk55zpzrb11nixp0hkyq0rb1pnz4c5878v4aygd";
# materialized = ./blog-hakyll.mat;
# checkMaterialization = true;
};
site = nixpkgs.stdenv.mkDerivation {
name = "blog-hakyll-0.1.0.0";
src = nixpkgs.lib.cleanSource ./public;
LANG = "en_US.UTF-8";
buildInputs = [ project.blog-hakyll.components.exes.site ];
preConfigure = ''
export LOCALE_ARCHIVE="${nixpkgs.glibcLocales}/lib/locale/locale-archive"
export LANG="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
'';
buildPhase = ''
site build
'';
installPhase = ''
cp -r _site $out
'';
};
siteShell = project.shellFor {
packages = ps: [ ps.blog-hakyll ];
withHoogle = true;
tools = {
cabal = "3.2.0.0";
hlint = "3.1.6";
};
buildInputs = with nixpkgs.haskellPackages; [ ghcid ];
exactDeps = true;
};
in if nixpkgs.lib.inNixShell then
siteShell
else
site
# f = { mkDerivation, aeson, base, bytestring, containers, hakyll
# , lens, lens-aeson, mtl, regex-pcre, stdenv, text, time
# , time-locale-compat, vector
# }:
# mkDerivation {
# pname = "blog-hakyll";
# version = "0.1.0.0";
# src = ./.;
# isLibrary = false;
# isExecutable = true;
# executableHaskellDepends = [
# aeson base bytestring containers hakyll lens lens-aeson mtl
# regex-pcre text time time-locale-compat vector
# ];
# executableSystemDepends = if pkgs.stdenv.isDarwin then [ pkgs.darwin.apple_sdk.frameworks.Cocoa pkgs.cabal-install ] else [ pkgs.cabal-install ];
# 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