mirror of
https://github.com/ilyakooo0/haskell.nix.git
synced 2024-10-26 09:37:17 +03:00
d5d304d5b5
* Include dependencies of haskell.nix that were tracked in `nix/sources.json` as flake inputs (`flake.lock` replaces `nix/sources.json`). * Use `flake-compat` to continue to provide a compatible interface for non flake projects. Co-authored-by: Alexander Bantyev <balsoft@balsoft.ru> Co-authored-by: Shea Levy <shea@shealevy.com>
78 lines
2.5 KiB
Nix
78 lines
2.5 KiB
Nix
{ src
|
|
, userDefaults ? {}
|
|
, nixpkgs ? null
|
|
, nixpkgsPin ? null
|
|
, pkgs ? null
|
|
, checkMaterialization ? null
|
|
, compiler-nix-name ? null
|
|
, shell ? null
|
|
, ...}@commandArgs:
|
|
let
|
|
inherit ((lib.evalModules {
|
|
modules = [
|
|
(import ../modules/project-common.nix)
|
|
(import ../modules/stack-project.nix)
|
|
(import ../modules/cabal-project.nix)
|
|
(import ../modules/project.nix)
|
|
(import ../modules/hix-project.nix)
|
|
projectDefaults
|
|
commandArgs'
|
|
{ _module.args.pkgs = {}; }
|
|
];
|
|
}).config) name;
|
|
inherit (import ./.. {}) sources;
|
|
lib = import (sources.nixpkgs-unstable + "/lib");
|
|
commandArgs' =
|
|
builtins.listToAttrs (
|
|
builtins.concatMap (
|
|
name:
|
|
if commandArgs.${name} == null || name == "src" || name == "userDefaults" || name == "inNixShell"
|
|
then []
|
|
else [{ inherit name; value = commandArgs.${name}; }]
|
|
) (builtins.attrNames commandArgs));
|
|
defaultArgs = {
|
|
nixpkgsPin = "nixpkgs-unstable";
|
|
};
|
|
importDefaults = src:
|
|
if src == null || !(__pathExists src)
|
|
then {}
|
|
else import src;
|
|
userDefaults = importDefaults (commandArgs.userDefaults or null);
|
|
projectDefaults = importDefaults (toString (src.origSrcSubDir or src) + "/nix/hix.nix");
|
|
inherit ((lib.evalModules {
|
|
modules = [
|
|
(import ../modules/project-common.nix)
|
|
(import ../modules/stack-project.nix)
|
|
(import ../modules/cabal-project.nix)
|
|
(import ../modules/project.nix)
|
|
(import ../modules/hix-project.nix)
|
|
userDefaults
|
|
projectDefaults
|
|
commandArgs'
|
|
({config, pkgs, ...}: {
|
|
haskellNix = import ./.. { inherit checkMaterialization; };
|
|
nixpkgsPin = "nixpkgs-unstable";
|
|
nixpkgs = config.haskellNix.sources.${config.nixpkgsPin};
|
|
nixpkgsArgs = config.haskellNix.nixpkgsArgs // {
|
|
overlays = config.haskellNix.nixpkgsArgs.overlays ++ config.overlays;
|
|
};
|
|
pkgs = import config.nixpkgs config.nixpkgsArgs;
|
|
project = config.pkgs.haskell-nix.project [
|
|
(import ../modules/hix-project.nix)
|
|
userDefaults
|
|
projectDefaults
|
|
commandArgs'
|
|
{
|
|
src =
|
|
if __pathExists (toString (src.origSrcSubDir or src) + "/.git")
|
|
then config.pkgs.haskell-nix.haskellLib.cleanGit {
|
|
inherit src name;
|
|
}
|
|
else src;
|
|
}
|
|
];
|
|
})
|
|
];
|
|
}).config) project shell;
|
|
in project
|