2019-07-31 20:59:54 +00:00
|
|
|
rec {
|
2019-10-19 21:12:20 +00:00
|
|
|
colors = {
|
|
|
|
"foreground" = "#dddbff";
|
|
|
|
"background" = "#000000";
|
|
|
|
"black" = "#000000";
|
|
|
|
"brightBlack" = "#55508f";
|
|
|
|
"red" = "#e34b4f";
|
|
|
|
"brightRed" = "#e34b4f";
|
|
|
|
"green" = "#67b779";
|
|
|
|
"brightGreen" = "#45b75e";
|
|
|
|
"yellow" = "#ff9c00";
|
|
|
|
"brightYellow" = "#ff9c00";
|
|
|
|
"blue" = "#5c67ff";
|
|
|
|
"brightBlue" = "#5c67ff";
|
|
|
|
"magenta" = "#cb85ff";
|
|
|
|
"brightMagenta" = "#cb85ff";
|
|
|
|
"cyan" = "#17d0f4";
|
|
|
|
"brightCyan" = "#17d0f4";
|
|
|
|
"white" = "#dddbff";
|
|
|
|
"brightWhite" = "#ffffff";
|
|
|
|
};
|
|
|
|
pkgs = import <nixpkgs> {
|
|
|
|
};
|
2019-07-31 21:56:52 +00:00
|
|
|
unstable = import <unstable> { };
|
2019-07-25 21:35:59 +00:00
|
|
|
sources = import ../nix/sources.nix;
|
2019-07-31 23:01:30 +00:00
|
|
|
unBreak = pkg:
|
|
|
|
unstable.haskell.lib.overrideCabal pkg (drv: {
|
|
|
|
broken = false;
|
|
|
|
doCheck = false;
|
|
|
|
});
|
2019-07-31 22:38:08 +00:00
|
|
|
shh = unBreak unstable.haskellPackages.shh;
|
2019-07-31 23:01:30 +00:00
|
|
|
ghc = unstable.ghc.withPackages
|
2019-09-14 12:00:41 +00:00
|
|
|
(p: [ (unBreak p.shh) p.brittany p.hlint p.ghcid p.cabal-install ]);
|
2019-07-31 09:16:47 +00:00
|
|
|
haskellList = list: ''["${builtins.concatStringsSep ''", "'' list}"]'';
|
2019-07-31 21:56:52 +00:00
|
|
|
writeHaskellScript = { name ? "haskell-script", bins ? [ pkgs.coreutils ]
|
|
|
|
, libraries ? [ ], imports ? [ ] }:
|
|
|
|
code:
|
|
|
|
unstable.writers.writeHaskellBin name {
|
|
|
|
libraries = libraries
|
|
|
|
++ [ shh unstable.haskellPackages.string-interpolate ];
|
|
|
|
} ''
|
2019-07-24 15:24:29 +00:00
|
|
|
{-# LANGUAGE DeriveDataTypeable #-}
|
|
|
|
{-# LANGUAGE TemplateHaskell #-}
|
2019-07-25 21:35:59 +00:00
|
|
|
{-# LANGUAGE QuasiQuotes #-}
|
|
|
|
|
2019-07-24 15:24:29 +00:00
|
|
|
import Shh
|
2019-07-25 21:35:59 +00:00
|
|
|
import Data.String.Interpolate (i)
|
|
|
|
import qualified Data.ByteString as BS
|
2019-08-01 02:17:45 +00:00
|
|
|
import qualified Data.ByteString.Char8 as BSC
|
2019-07-25 21:35:59 +00:00
|
|
|
import qualified Data.ByteString.Lazy as LBS
|
2019-07-28 22:51:10 +00:00
|
|
|
import qualified Data.ByteString.Lazy.Char8 as LBSC
|
2019-07-25 21:35:59 +00:00
|
|
|
import qualified Data.Text as T
|
|
|
|
import qualified Data.Text.Lazy as LT
|
|
|
|
import qualified Data.Text.Encoding as TE
|
|
|
|
import qualified Data.Text.Lazy.Encoding as LTE
|
2019-07-28 22:51:10 +00:00
|
|
|
import System.Environment (getArgs)
|
2019-07-24 15:24:29 +00:00
|
|
|
${builtins.concatStringsSep "\n" (map (x: "import ${x}") imports)}
|
|
|
|
|
|
|
|
-- Load binaries from Nix packages. The dependencies will be captured
|
|
|
|
-- in the closure.
|
2019-07-31 23:01:30 +00:00
|
|
|
loadFromBins ${
|
|
|
|
haskellList (builtins.map toString (bins ++ [ pkgs.coreutils ]))
|
|
|
|
}
|
2019-07-24 15:24:29 +00:00
|
|
|
|
|
|
|
${code}
|
|
|
|
'';
|
2019-07-26 13:54:30 +00:00
|
|
|
get-niv-path = writeHaskellScript {
|
2019-07-25 21:35:59 +00:00
|
|
|
name = "get-niv-path";
|
2019-07-31 21:56:52 +00:00
|
|
|
bins = [ pkgs.nix ];
|
|
|
|
imports = [ "System.Console.CmdArgs.Implicit" ];
|
|
|
|
libraries =
|
|
|
|
[ unstable.haskellPackages.cmdargs unstable.haskellPackages.text ];
|
2019-07-25 21:35:59 +00:00
|
|
|
} ''
|
|
|
|
|
|
|
|
trimQuotation = pureProc $ LTE.encodeUtf8 . LT.dropAround ('"' ==) . LTE.decodeUtf8 . trim
|
2019-07-24 15:24:29 +00:00
|
|
|
|
2019-07-25 21:35:59 +00:00
|
|
|
main = do
|
2019-07-28 22:51:10 +00:00
|
|
|
[sources, channel] <- getArgs
|
|
|
|
let expr = [i|(import #{sources}).#{channel}|]
|
2019-07-25 21:35:59 +00:00
|
|
|
nix_build ["-Q", "-E", expr, "--no-out-link"] &> devNull
|
|
|
|
nix_instantiate ["--eval", "-E", [i|toString #{expr}|]] |> trimQuotation
|
2019-07-31 21:56:52 +00:00
|
|
|
'';
|
|
|
|
home-manager = pkgs.callPackage <home-manager/home-manager> { };
|
2019-07-26 13:54:30 +00:00
|
|
|
gcRetentionDays = 5;
|
2019-07-24 15:24:29 +00:00
|
|
|
}
|