Skip to content

Instantly share code, notes, and snippets.

@techieAgnostic
Created November 5, 2020 06:34
Show Gist options
  • Save techieAgnostic/3ae2edd5bd46c3cd940412344998e893 to your computer and use it in GitHub Desktop.
Save techieAgnostic/3ae2edd5bd46c3cd940412344998e893 to your computer and use it in GitHub Desktop.
{
description = "a skeleton haskell flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-20.09";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
overlays = [ (import ./overlay.nix) ];
inherit system;
};
in {
defaultPackage = pkgs.haskeleton;
}) // {
overlay = import ./overlay.nix;
};
}
#actually ./nix/haskeleton.nix but gists wont let me put that as the filename
{ mkDerivation, aeson, base, stdenv, text }:
mkDerivation {
pname = "haskeleton";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [ aeson base text ];
license = "unknown";
hydraPlatforms = stdenv.lib.platforms.none;
}
final: prev: {
haskeleton = (import ./release.nix) prev;
}
bspkgs:
let
dontCheckPackages = [ ];
doJailbreakPackages = [ ];
dontHaddockPackages = [ ];
config = {
packageOverrides = pkgs: rec {
haskellPackages =
let
generatedOverrides = haskellPackagesNew: haskellPackagesOld:
let
toPackage = file: _: {
name = builtins.replaceStrings [ ".nix" ] [ "" ] file;
value = haskellPackagesNew.callPackage ( ./. + "/nix/${file}") { };
};
in
pkgs.lib.mapAttrs' toPackage (builtins.readDir ./nix);
makeOverrides =
function: names: haskellPackagesNew: haskellPackagesOld:
let
toPackage = name: {
inherit name;
value = function haskellPackagesOld.${name};
};
in
builtins.listToAttrs (map toPackage names);
composeExtensionsList =
pkgs.lib.fold pkgs.lib.composeExtensions (_: _: {});
manualOverrides = haskellPackagesNew: haskellPackagesOld: {
};
in
pkgs.haskellPackages.override {
overrides = composeExtensionsList [
generatedOverrides
(makeOverrides pkgs.haskell.lib.dontCheck dontCheckPackages)
(makeOverrides pkgs.haskell.lib.doJailbreak doJailbreakPackages)
(makeOverrides pkgs.haskell.lib.dontHaddock dontHaddockPackages)
manualOverrides
];
};
};
};
pkgs = import bspkgs.path { inherit config; };
in
pkgs.haskellPackages.haskeleton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment