Skip to content
This repository was archived by the owner on Dec 10, 2022. It is now read-only.

try supporting local tarballs #6

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added amazonka-1.6.1.tar.gz
Binary file not shown.
19 changes: 16 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
cabalFile = builtins.readFile cabalPath;
parse = field:
let
lines = filter (s: if builtins.match "^${field} *:.*$" (toLower s) != null then true else false) (splitString "\n" cabalFile);
lines = filter (s: if builtins.match "^${field} *:.*$" (toLower s) != null then true else false) (map (field: replaceStrings ["\r"] [""] field) (splitString "\n" cabalFile));
line =
if lines != [ ]
then head lines
Expand Down Expand Up @@ -141,7 +141,20 @@

mkHackageFor = system: compiler-nix-name: srcs: mkHackageFromSpecFor system compiler-nix-name (map mkPackageSpec srcs);

mkHackagesFor = system: compiler-nix-name: srcs: mkHackagesFromSpecFor system compiler-nix-name (map mkPackageSpec srcs);
untar = system: file:
let x =
(pkgsFor system).runCommand "untar ${builtins.trace "untarring file: ${file}" file}" { } ''
mkdir -p $out
cd $out
tar xfz ${file} --strip-components=1
''; in x.outPath;

mkHackagesFor = system: compiler-nix-name: srcs: mkHackagesFromSpecFor system compiler-nix-name (map (src:
if lib.hasSuffix ".tar.gz" src then
mkPackageSpec(untar system src)
# mkPackageSpec (builtins.filterSource (p: t: true) (untar system src)) # I think this needs import from derivation?
else mkPackageSpec (builtins.trace "${src}" src)
) srcs);

overlayFor = system: final: prev:
let compiler-nix-name = "ghc8107"; in
Expand Down Expand Up @@ -193,7 +206,7 @@
});

# export
inherit mkPackageSpec mkPackageTarballFor mkHackageDirFor mkHackageTarballFromDirsFor mkHackageTarballFor mkHackageNixFor mkHackageFromSpecFor mkHackagesFromSpecFor mkHackageFor mkHackagesFor;
inherit mkPackageSpec mkPackageTarballFor mkHackageDirFor mkHackageTarballFromDirsFor mkHackageTarballFor mkHackageNixFor mkHackageFromSpecFor mkHackagesFromSpecFor mkHackageFor mkHackagesFor untar;
overlay = perSystem overlayFor;

# for debugging
Expand Down