diff options
author | Ben Sima <ben@bsima.me> | 2023-10-03 22:22:45 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2023-10-03 22:22:45 -0400 |
commit | 6107f8178e26ada67e5d5ec60501e24528b3db56 (patch) | |
tree | 6e7d8bc57231b841545c6e3add46eb51c64a5946 /Biz/Bild | |
parent | 4226cbd8020253b010fb44d395db12efe68e1272 (diff) |
Add rundeps feature to bild
This allows me to specify runtime dependencies, not just system or
language deps.
Diffstat (limited to 'Biz/Bild')
-rw-r--r-- | Biz/Bild/Builder.nix | 8 | ||||
-rw-r--r-- | Biz/Bild/Meta.hs | 18 |
2 files changed, 21 insertions, 5 deletions
diff --git a/Biz/Bild/Builder.nix b/Biz/Bild/Builder.nix index 2ed3dd1..959d176 100644 --- a/Biz/Bild/Builder.nix +++ b/Biz/Bild/Builder.nix @@ -51,6 +51,12 @@ let else lib.attrsets.attrVals target.sysdeps pkgs; + rundeps_ = + if isEmpty target.rundeps then + [] + else + lib.attrsets.attrVals target.rundeps bild.pkgs; + CODEROOT = "."; builders = { @@ -73,7 +79,7 @@ let installPhase = '' install -D ${name} $out/bin/${name} wrapProgram $out/bin/${name} \ - --prefix PATH : ${lib.makeBinPath sysdeps_} + --prefix PATH : ${lib.makeBinPath rundeps_} ''; }; diff --git a/Biz/Bild/Meta.hs b/Biz/Bild/Meta.hs index 5549cb3..ad5fdd6 100644 --- a/Biz/Bild/Meta.hs +++ b/Biz/Bild/Meta.hs @@ -14,14 +14,17 @@ import qualified Text.Regex.Applicative as Regex -- | A third-party dependency. This gets mapped to some name in nixpkgs, -- prefixed by package set like @haskellPackages@ or --- @python3Packages@. Currently this prefix is implicit, but it should be added --- here as part of a tuple or something. +-- @python3Packages@. type Dep = String -- | This is a system-level requirement, the string gets mapped to a name in --- nixpkgs at the top level, like @pkgs.thing@. If I add the package set prefix to 'Dep', then this can just become literally @(Sys, "thing")@. +-- nixpkgs at the top level, like @pkgs.thing@. type Sys = String +-- | A run-time dependency. This is some executable that will be placed on +-- @PATH@. This gets selected from @bild.pkgs@, so it must be exported there. +type Run = String + -- | An arbitrary compiler argument that may get added to the compilation -- command. Should be used sparingly, and not all builds will support this. type Arg = String @@ -40,7 +43,8 @@ data Parsed = Parsed { pdep :: Set Dep, parg :: Set Arg, pout :: Out, - psys :: Set Sys + psys :: Set Sys, + prun :: Set Run } detect :: Ord a => Regex.RE Char a -> [Text] -> Set a @@ -69,6 +73,7 @@ detectAll m cl = Parsed {..} pdep = detect_ dep psys = detect_ sys parg = detect_ arg + prun = detect_ run dep :: [Char] -> Regex.RE Char Dep dep comment = @@ -96,3 +101,8 @@ arg :: [Char] -> Regex.RE Char Arg arg comment = Regex.string (comment ++ " : arg ") *> Regex.many Regex.anySym + +run :: [Char] -> Regex.RE Char Run +run comment = + Regex.string (comment ++ " : run ") + *> Regex.many Regex.anySym |