Skip to content

Commit

Permalink
Merge branch 'main' into improve-parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
yvan-sraka authored Sep 5, 2023
2 parents c5d918c + 1a307b9 commit b364ec4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 31 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ jobs:
name: foliage
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- uses: DeterminateSystems/magic-nix-cache-action@v2

- run: nix build --accept-flake-config
28 changes: 0 additions & 28 deletions .github/workflows/release.yml

This file was deleted.

6 changes: 5 additions & 1 deletion app/Foliage/HackageSecurity.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ readJSONSimple fp = do
p <- makeAbsolute (fromFilePath fp)
readJSON_NoKeys_NoLayout p

forceFileInfo :: FileInfo -> ()
forceFileInfo (FileInfo a b) = a `seq` b `seq` ()

computeFileInfoSimple :: FilePath -> IO FileInfo
computeFileInfoSimple fp = do
p <- makeAbsolute (fromFilePath fp)
computeFileInfo p
fi <- computeFileInfo p
return $! forceFileInfo fi `seq` fi

createKeys :: FilePath -> IO ()
createKeys base = do
Expand Down
16 changes: 14 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@
lib.attrsets.optionalAttrs (system == "x86_64-linux")
{ crossPlatforms = p: [ p.musl64 ]; }
);

# Wrap the foliage executable with the needed dependencies in PATH.
# See #71.
wrapExe = drv:
pkgs.runCommand "foliage" {
nativeBuildInputs = [ pkgs.makeWrapper ];
} ''
mkdir -p $out/bin
makeWrapper ${drv}/bin/foliage $out/bin/foliage \
--prefix PATH : ${with pkgs; lib.makeBinPath [ curl patch ]}:$out/bin
'';

in

flake // {
Expand All @@ -46,9 +58,9 @@

apps = { default = flake.apps."foliage:exe:foliage"; }
// lib.attrsets.optionalAttrs (system == "x86_64-linux")
{ static = flake.apps."x86_64-unknown-linux-musl:foliage:exe:foliage"; }
{ static = wrapExe flake.apps."x86_64-unknown-linux-musl:foliage:exe:foliage"; }
// lib.attrsets.optionalAttrs (system == "aarch64-linux")
{ static = flake.apps."aarch64-multiplatform-musl:foliage:exe:foliage"; };
{ static = wrapExe flake.apps."aarch64-multiplatform-musl:foliage:exe:foliage"; };

packages = { default = flake.packages."foliage:exe:foliage"; }
// lib.attrsets.optionalAttrs (system == "x86_64-linux")
Expand Down

0 comments on commit b364ec4

Please sign in to comment.