-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
148 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{config, lib, util, env}: | ||
with lib; | ||
let | ||
|
||
console = import ./console.nix { inherit lib; }; | ||
inherit (console) s indent; | ||
inherit (s) colors; | ||
|
||
pkgs = config.pkgs; | ||
|
||
ghc = config.envs.${env}.ghc.ghc; | ||
|
||
dep' = name: version: let | ||
desc = if version == null then colors.magenta name else "${colors.magenta name} ${colors.cyan version}"; | ||
pkg = ghc.${name}; | ||
actual = | ||
if pkg == null | ||
then "[boot package or unknown]" | ||
else "${colors.green "->"} ${colors.red pkg.version}"; | ||
in ["${desc} ${actual}"]; | ||
|
||
dep = d: | ||
if isAttrs d | ||
then dep' d.name d.version | ||
else let | ||
result = builtins.split "^([[:graph:]]+) (.*)$" d; | ||
parts = head (drop 1 result); | ||
name = head parts; | ||
version = head (drop 1 parts); | ||
in | ||
if length result == 3 | ||
then dep' name version | ||
else dep' d null; | ||
|
||
componentDeps = name: conf: let | ||
head = colors.yellow name; | ||
in [head] ++ indent (concatMap dep conf.dependencies); | ||
|
||
packageDeps = name: conf: let | ||
head = colors.blue name; | ||
in [head] ++ indent (util.concatMapAttrsToList componentDeps conf.internal.componentsSet); | ||
|
||
packagesDeps = | ||
pkgs.writeText "dep-versions" (util.unlines (util.concatMapAttrsToList packageDeps config.packages)); | ||
|
||
in pkgs.writeScript "print-dep-versions" '' | ||
#!${pkgs.zsh}/bin/zsh | ||
echo -e "$(cat ${packagesDeps})" | ||
'' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,6 +141,7 @@ let | |
(opt "hackage" "Hackage" mod-hackage) | ||
(text tags) | ||
(text cross) | ||
(text misc) | ||
]; | ||
} | ||
]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module Dep where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
description = "hix test project"; | ||
|
||
inputs.hix.url = "path:HIX"; | ||
|
||
outputs = { hix, ... }: | ||
hix.lib.flake { | ||
main = "root"; | ||
packages = { | ||
|
||
dep = { | ||
src = ./dep; | ||
cabal = { | ||
dependencies = ["aeson >= 2" "extra ^>= 1.7"]; | ||
}; | ||
library = { | ||
enable = true; | ||
dependencies = ["uuid == 1.3" "vector >= 0.11 && < 0.13"]; | ||
}; | ||
}; | ||
|
||
root = { | ||
src = ./.; | ||
|
||
library = { | ||
enable = true; | ||
dependencies = [{ name = "aeson"; version = "^>= 2.1"; } "array"]; | ||
}; | ||
|
||
}; | ||
|
||
}; | ||
|
||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module Root where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ pkgs }: { | ||
test = builtins.toFile "dep-versions-test" '' | ||
cd ./root | ||
nix flake update | ||
target='[34mdep[0m | ||
[33mlibrary[0m | ||
[35maeson[0m [36m>= 2[0m [32m->[0m [31m2.1.2.1[0m | ||
[35mextra[0m [36m^>= 1.7[0m [32m->[0m [31m1.7.14[0m | ||
[35muuid[0m [36m== 1.3[0m [32m->[0m [31m1.3.15[0m | ||
[35mvector[0m [36m>= 0.11 && < 0.13[0m [32m->[0m [31m0.13.0.0[0m | ||
[34mroot[0m | ||
[33mlibrary[0m | ||
[35maeson[0m [36m^>= 2.1[0m [32m->[0m [31m2.1.2.1[0m | ||
[35marray[0m [boot package or unknown]' | ||
check 'nix run .#dep-versions' $target 'Output is wrong' | ||
''; | ||
} |