2019-07-31 20:59:54 +00:00
|
|
|
rec {
|
2019-10-19 21:12:20 +00:00
|
|
|
colors = {
|
|
|
|
"foreground" = "#dddbff";
|
2019-11-29 18:22:38 +00:00
|
|
|
"background" = "#000018";
|
2019-10-19 21:12:20 +00:00
|
|
|
"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";
|
|
|
|
};
|
2019-10-20 03:28:54 +00:00
|
|
|
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:
|
2019-10-20 03:28:54 +00:00
|
|
|
pkgs.haskell.lib.overrideCabal pkg (drv: {
|
2019-07-31 23:01:30 +00:00
|
|
|
broken = false;
|
|
|
|
doCheck = false;
|
|
|
|
});
|
2019-10-20 03:28:54 +00:00
|
|
|
shh = unBreak pkgs.haskellPackages.shh;
|
2020-01-22 18:14:04 +00:00
|
|
|
ghc = unstable.ghc.withPackages (p: [
|
2019-11-02 00:08:43 +00:00
|
|
|
(unBreak p.shh)
|
|
|
|
p.brittany
|
|
|
|
p.hlint
|
|
|
|
p.ghcid
|
|
|
|
p.cabal-install
|
2020-01-22 18:14:04 +00:00
|
|
|
p.relude
|
2019-11-02 00:08:43 +00:00
|
|
|
p.shake
|
2020-01-07 21:32:56 +00:00
|
|
|
p.hledger-lib
|
2020-01-22 18:14:04 +00:00
|
|
|
p.releaser
|
2020-02-09 19:58:02 +00:00
|
|
|
p.megaparsec
|
2020-03-29 13:23:28 +00:00
|
|
|
p.pandoc
|
2019-11-02 00:08:43 +00:00
|
|
|
]);
|
2019-07-31 09:16:47 +00:00
|
|
|
haskellList = list: ''["${builtins.concatStringsSep ''", "'' list}"]'';
|
2020-01-22 18:14:04 +00:00
|
|
|
writeHaskellScript =
|
|
|
|
{ name ? "haskell-script", bins ? [ ], libraries ? [ ], imports ? [ ] }:
|
2019-07-31 21:56:52 +00:00
|
|
|
code:
|
2019-10-20 03:28:54 +00:00
|
|
|
pkgs.writers.writeHaskellBin name {
|
|
|
|
libraries = libraries ++ [
|
|
|
|
shh
|
|
|
|
pkgs.haskellPackages.string-interpolate
|
2020-01-19 16:40:02 +00:00
|
|
|
pkgs.haskellPackages.relude
|
2019-10-20 03:28:54 +00:00
|
|
|
];
|
2019-07-31 21:56:52 +00:00
|
|
|
} ''
|
2019-07-24 15:24:29 +00:00
|
|
|
{-# LANGUAGE DeriveDataTypeable #-}
|
|
|
|
{-# LANGUAGE TemplateHaskell #-}
|
2019-07-25 21:35:59 +00:00
|
|
|
{-# LANGUAGE QuasiQuotes #-}
|
2019-10-21 20:58:12 +00:00
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
{-# LANGUAGE ExtendedDefaultRules #-}
|
2020-01-08 00:14:05 +00:00
|
|
|
{-# LANGUAGE MultiWayIf #-}
|
2020-01-10 19:32:07 +00:00
|
|
|
{-# LANGUAGE LambdaCase #-}
|
2020-01-12 01:11:43 +00:00
|
|
|
{-# LANGUAGE ViewPatterns #-}
|
|
|
|
{-# LANGUAGE ScopedTypeVariables #-}
|
2020-01-19 16:40:02 +00:00
|
|
|
{-# LANGUAGE NoImplicitPrelude #-}
|
2019-07-25 21:35:59 +00:00
|
|
|
|
2019-07-24 15:24:29 +00:00
|
|
|
import Shh
|
2020-01-19 16:40:02 +00:00
|
|
|
import Relude
|
|
|
|
import qualified Relude.Unsafe as Unsafe
|
2019-07-25 21:35:59 +00:00
|
|
|
import qualified Data.ByteString as BS
|
2020-01-19 16:40:02 +00:00
|
|
|
import qualified Data.Text as Text
|
|
|
|
import System.Environment (getArgs)
|
2020-01-19 18:55:01 +00:00
|
|
|
import Control.Exception (bracket, try)
|
2020-01-19 16:40:02 +00:00
|
|
|
import Data.String.Interpolate (i)
|
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-10-20 03:28:54 +00:00
|
|
|
loadFromBins (${
|
2019-07-31 23:01:30 +00:00
|
|
|
haskellList (builtins.map toString (bins ++ [ pkgs.coreutils ]))
|
2019-10-20 03:28:54 +00:00
|
|
|
} :: [String])
|
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" ];
|
2019-10-20 03:28:54 +00:00
|
|
|
libraries = [ pkgs.haskellPackages.cmdargs pkgs.haskellPackages.text ];
|
2019-07-25 21:35:59 +00:00
|
|
|
} ''
|
|
|
|
|
2020-01-19 16:40:02 +00:00
|
|
|
trimQuotation = pureProc $ encodeUtf8 . Text.dropAround ('"' ==) . 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
|
2019-10-20 03:28:54 +00:00
|
|
|
let expr = [i|(import #{sources}).#{channel}|] :: String
|
2019-07-25 21:35:59 +00:00
|
|
|
nix_build ["-Q", "-E", expr, "--no-out-link"] &> devNull
|
2019-10-20 03:28:54 +00:00
|
|
|
nix_instantiate ["--eval" :: String, "-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
|
|
|
}
|