-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(flake): remove dependency on flake-utils
Keep the dependency tree small.
- Loading branch information
Showing
3 changed files
with
128 additions
and
155 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,59 @@ | ||
{ | ||
config, | ||
lib, | ||
pkgs, | ||
... | ||
}: let | ||
{ config | ||
, lib | ||
, pkgs | ||
, ... | ||
}: | ||
let | ||
cfg = config.language.hare; | ||
strOrPackage = import ../../nix/strOrPackage.nix {inherit lib pkgs;}; | ||
makeHareFullPath = thirdParty: let | ||
allHareThirdPartyPkgs = builtins.attrValues (pkgs.hareThirdParty.packages pkgs); | ||
isPropagatedLib = drv: builtins.any (x: drv == x) allHareThirdPartyPkgs; | ||
pkgsPropagatedBuildInputs = builtins.foldl' (acc: e: acc ++ e.propagatedBuildInputs) [] thirdParty; | ||
propagatedLibs = builtins.filter isPropagatedLib pkgsPropagatedBuildInputs; | ||
in | ||
strOrPackage = import ../../nix/strOrPackage.nix { inherit lib pkgs; }; | ||
makeHareFullPath = thirdParty: | ||
let | ||
allHareThirdPartyPkgs = builtins.attrValues (pkgs.hareThirdParty.packages pkgs); | ||
isPropagatedLib = drv: builtins.any (x: drv == x) allHareThirdPartyPkgs; | ||
pkgsPropagatedBuildInputs = builtins.foldl' (acc: e: acc ++ e.propagatedBuildInputs) [ ] thirdParty; | ||
propagatedLibs = builtins.filter isPropagatedLib pkgsPropagatedBuildInputs; | ||
in | ||
lib.makeSearchPath | ||
"src/hare/third-party" | ||
(thirdParty ++ propagatedLibs); | ||
"src/hare/third-party" | ||
(thirdParty ++ propagatedLibs); | ||
in | ||
with lib; { | ||
options.language.hare = { | ||
thirdPartyLibs = mkOption { | ||
type = types.listOf strOrPackage; | ||
default = []; | ||
example = literalExpression "[ hareThirdParty.hare-compress ]"; | ||
description = "List of extra packages (coming from hareThirdParty) to add"; | ||
}; | ||
vendoredLibs = mkOption { | ||
type = types.listOf types.str; | ||
default = []; | ||
example = literalExpression "[ ./vendor/lib ]"; | ||
description = "List of paths to add to HAREPATH"; | ||
}; | ||
package = mkOption { | ||
type = strOrPackage; | ||
default = pkgs.hare; | ||
example = literalExpression "pkgs.hare"; | ||
description = "Which Hare package to use"; | ||
}; | ||
with lib; { | ||
options.language.hare = { | ||
thirdPartyLibs = mkOption { | ||
type = types.listOf strOrPackage; | ||
default = [ ]; | ||
example = literalExpression "[ hareThirdParty.hare-compress ]"; | ||
description = "List of extra packages (coming from hareThirdParty) to add"; | ||
}; | ||
|
||
config = { | ||
env = [ | ||
(mkIf (cfg.thirdPartyLibs != [] || cfg.vendoredLibs != []) { | ||
name = "HAREPATH"; | ||
value = lib.makeSearchPath "src/hare/stdlib" [cfg.package]; | ||
}) | ||
(mkIf (cfg.thirdPartyLibs != []) { | ||
name = "HAREPATH"; | ||
prefix = makeHareFullPath cfg.thirdPartyLibs; | ||
}) | ||
(mkIf (cfg.vendoredLibs != []) { | ||
name = "HAREPATH"; | ||
prefix = concatStringsSep ":" cfg.vendoredLibs; | ||
}) | ||
]; | ||
devshell.packages = [cfg.package]; | ||
vendoredLibs = mkOption { | ||
type = types.listOf types.str; | ||
default = [ ]; | ||
example = literalExpression "[ ./vendor/lib ]"; | ||
description = "List of paths to add to HAREPATH"; | ||
}; | ||
package = mkOption { | ||
type = strOrPackage; | ||
default = pkgs.hare; | ||
example = literalExpression "pkgs.hare"; | ||
description = "Which Hare package to use"; | ||
}; | ||
} | ||
}; | ||
|
||
config = { | ||
env = [ | ||
(mkIf (cfg.thirdPartyLibs != [ ] || cfg.vendoredLibs != [ ]) { | ||
name = "HAREPATH"; | ||
value = lib.makeSearchPath "src/hare/stdlib" [ cfg.package ]; | ||
}) | ||
(mkIf (cfg.thirdPartyLibs != [ ]) { | ||
name = "HAREPATH"; | ||
prefix = makeHareFullPath cfg.thirdPartyLibs; | ||
}) | ||
(mkIf (cfg.vendoredLibs != [ ]) { | ||
name = "HAREPATH"; | ||
prefix = concatStringsSep ":" cfg.vendoredLibs; | ||
}) | ||
]; | ||
devshell.packages = [ cfg.package ]; | ||
}; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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