Skip to content
Browse files

support WildCards

  • Loading branch information...
1 parent 611deec commit d1d5e3f8c832a93c758451ac65c2d94322cf760d haxe committed with MarcWeber Jan 8, 2010
Showing with 7 additions and 1 deletion.
  1. +1 −1 hack-nix-envs/nix/default.nix
  2. +6 −0 src/NixLangUtil.hs
View
2 hack-nix-envs/nix/default.nix
@@ -1,4 +1,4 @@
-let nixOverlay = import "/pr/gitnixdev/haskell-nix-overlay" {};
+let nixOverlay = import "/home/haxe/haskell-nix-overlay" {};
lib = nixOverlay.lib;
pkgs = nixOverlay.pkgs;
pkgFlags = lib.fold (a: n: a // n) {} (map ({n, v}: lib.attrSingleton n v) [ ]);
View
6 src/NixLangUtil.hs
@@ -93,6 +93,12 @@ instance TypeToNix VersionRange where
-- version only !)
toNix (LaterVersion version) = NixAttrs [] $ M.fromList [("gt", toNix version)]
toNix (EarlierVersion version) = NixAttrs [] $ M.fromList [("lt", toNix version)]
+ -- encode wildarcd as version range
+ toNix (WildcardVersion (Version version _)) =
+ NixAttrs [] $ M.fromList [("i1", lower), ("i2", upper)]
+ where lower = NixAttrs [] $ M.fromList [("le", nixVersion $ init version ++ [1 + last version])]
+ upper = NixAttrs [] $ M.fromList [("gte", nixVersion version)]
+
-- Build-Depends: base >= 4 is represented as (== 4) union (> 4) so rewrite this as greater or equal (gte)
toNix (UnionVersionRanges v1 v2)

0 comments on commit d1d5e3f

Please sign in to comment.
Something went wrong with that request. Please try again.