@@ -4,17 +4,6 @@
44, __useLegacyCompilers ? false
55}:
66let
7− cleanSource = builtins.filterSource (name: _: let baseName = builtins.baseNameOf name; in !(
8− builtins.match "^\\.ghc\\.environment.*" baseName != null ||
9− baseName == "cabal.project.local"
10− ));
11−
12− commandRuntimeDeps = pkgs: with pkgs; [
13− coreutils
14− git
15− nix-prefetch-git
16− openssh
17− ];
187
198 getReflexPlatform = getReflexPlatform' __useLegacyCompilers;
209 getReflexPlatform' = __useLegacyCompilers: sys: import ./dep/reflex-platform {
@@ -23,92 +12,13 @@ let
2312 enableLibraryProfiling = profiling;
2413
2514 nixpkgsOverlays = [
26− (self: super: {
27− obeliskExecutableConfig = import ./lib/executable-config { nixpkgs = pkgs; filterGitSource = cleanSource; };
28− })
15+ (import ./nixpkgs-overlays)
2916 ];
3017
3118 haskellOverlays = [
32−
33− # Fix misc upstream packages
34− (self: super: let
35− pkgs = self.callPackage ({ pkgs }: pkgs) {};
36− in {
37− hnix = pkgs.haskell.lib.dontCheck (self.callCabal2nix "hnix" (pkgs.fetchFromGitHub {
38− owner = "haskell-nix";
39− repo = "hnix";
40− rev = "42afdc21da5d9e076eab57eaa42bfdde938192b8";
41− sha256 = "0psw384dx9bw2dp93xrzw8rd9amvcwgzn64jzzwby7sfspj6k349";
42− }) {});
43− # Need 8.0.2 build support
44− # PR: https://github.com/dmwit/universe/pull/33
45− universe-template = self.callCabal2nix "universe-template" (pkgs.fetchFromGitHub {
46− owner = "obsidiansystems";
47− repo = "universe";
48− rev = "6a71119bfa5db2b9990a2491c941469ff8ef5d13";
49− sha256 = "0z8smyainnlzcglv3dlx6x1n9j6d2jv48aa8f2421iayfkxg3js5";
50− } + /template) {};
51− })
52−
53− # Add obelisk packages
54− (self: super: let
55− pkgs = self.callPackage ({ pkgs }: pkgs) {};
56− in {
57− obelisk-executable-config = pkgs.obeliskExecutableConfig.haskellPackage self;
58− obelisk-executable-config-inject = pkgs.obeliskExecutableConfig.platforms.web.inject self;
59−
60− obelisk-asset-manifest = self.callCabal2nix "obelisk-asset-manifest" ./lib/asset/manifest {};
61− obelisk-asset-serve-snap = self.callCabal2nix "obelisk-asset-serve-snap" ./lib/asset/serve-snap {};
62− obelisk-backend = self.callCabal2nix "obelisk-backend" (cleanSource ./lib/backend) {};
63− obelisk-cliapp = self.callCabal2nix "obelisk-cliapp" (cleanSource ./lib/cliapp) {};
64− obelisk-command = self.callCabal2nix "obelisk-command" (cleanSource ./lib/command) {};
65− obelisk-frontend = self.callCabal2nix "obelisk-frontend" (cleanSource ./lib/frontend) {};
66− obelisk-run = self.callCabal2nix "obelisk-run" (cleanSource ./lib/run) {};
67− obelisk-route = self.callCabal2nix "obelisk-route" (cleanSource ./lib/route) {};
68− obelisk-selftest = self.callCabal2nix "obelisk-selftest" (cleanSource ./lib/selftest) {};
69− obelisk-snap-extras = self.callCabal2nix "obelisk-snap-extras" (cleanSource ./lib/snap-extras) {};
70− })
71−
72− (self: super: let
73− pkgs = self.callPackage ({ pkgs }: pkgs) {};
74− haskellLib = pkgs.haskell.lib;
75− #TODO: Upstream
76− # Modify a Haskell package to add completion scripts for the given
77− # executable produced by it. These completion scripts will be picked up
78− # automatically if the resulting derivation is installed, e.g. by
79− # `nix-env -i`.
80− addOptparseApplicativeCompletionScripts = exeName: pkg: haskellLib.overrideCabal pkg (drv: {
81− postInstall = (drv.postInstall or "") + ''
82− BASH_COMP_DIR="$out/share/bash-completion/completions"
83− mkdir -p "$BASH_COMP_DIR"
84− "$out/bin/${exeName}" --bash-completion-script "$out/bin/${exeName}" >"$BASH_COMP_DIR/ob"
85−
86− ZSH_COMP_DIR="$out/share/zsh/vendor-completions"
87− mkdir -p "$ZSH_COMP_DIR"
88− "$out/bin/${exeName}" --zsh-completion-script "$out/bin/${exeName}" >"$ZSH_COMP_DIR/_ob"
89−
90− FISH_COMP_DIR="$out/share/fish/vendor_completions.d"
91− mkdir -p "$FISH_COMP_DIR"
92− "$out/bin/${exeName}" --fish-completion-script "$out/bin/${exeName}" >"$FISH_COMP_DIR/ob.fish"
93− '';
94− });
95− in {
96− # Dynamic linking with split objects dramatically increases startup time (about
97− # 0.5 seconds on a decent machine with SSD), so we do `justStaticExecutables`.
98− obelisk-command = haskellLib.overrideCabal
99− (addOptparseApplicativeCompletionScripts "ob"
100− (haskellLib.justStaticExecutables super.obelisk-command))
101− (drv: {
102− buildTools = (drv.buildTools or []) ++ [ pkgs.buildPackages.makeWrapper ];
103− postFixup = ''
104− ${drv.postFixup or ""}
105− # Make `ob` reference its runtime dependencies.
106− wrapProgram "$out"/bin/ob --prefix PATH : ${pkgs.lib.makeBinPath (commandRuntimeDeps pkgs)}
107− '';
108− });
109− obelisk-selftest = haskellLib.justStaticExecutables super.obelisk-selftest;
110− })
111−
19+ (import ./haskell-overlays/misc-deps.nix)
20+ (import ./haskell-overlays/obelisk.nix)
21+ (import ./haskell-overlays/tighten-ob-exes.nix)
11222 ];
11323 };
11424
@@ -135,7 +45,7 @@ in rec {
13545 obelisk = ghcObelisk;
13646 obeliskEnvs = ghcObeliskEnvs;
13747 command = ghcObelisk.obelisk-command;
138− shell = pinBuildInputs "obelisk-shell" ([command] ++ commandRuntimeDeps pkgs) [];
48+ shell = pinBuildInputs "obelisk-shell" ([command] ++ command.commandRuntimeDeps) [];
13949
14050 selftest = pkgs.writeScript "selftest" ''
14151 #!/usr/bin/env bash