-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix mobile builds #1108
base: haskell.nix
Are you sure you want to change the base?
Fix mobile builds #1108
Changes from all commits
3e7d3fe
850749c
5381781
2ba24b0
f44cf14
e3abc6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
} | ||
, local-self ? import ./. self-args | ||
, supportedSystems ? [ builtins.currentSystem ] | ||
, __useNewerCompiler ? true # false if one wants to use ghc 8.6.5 | ||
}: | ||
|
||
let | ||
|
@@ -41,8 +40,21 @@ let | |
else if lib.isList v then lib.concatMap collect v | ||
else []; | ||
|
||
# A simple derivation that just creates a file with the names of all | ||
# of its inputs. If built, it will have a runtime dependency on all | ||
# of the given build inputs. | ||
pinBuildInputs = name: buildInputs: (local-self.nixpkgs.releaseTools.aggregate { | ||
inherit name; | ||
constituents = buildInputs; | ||
}).overrideAttrs (old: { | ||
buildCommand = old.buildCommand + '' | ||
echo "$propagatedBuildInputs $buildInputs $nativeBuildInputs $propagatedNativeBuildInputs" > "$out/deps" | ||
''; | ||
inherit buildInputs; | ||
}); | ||
|
||
perPlatform = lib.genAttrs cacheBuildSystems (system: let | ||
reflex-platform = import ./dep/mars { inherit system __useNewerCompiler; }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gives me eval errors There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you could post those errors that'd be great! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean, the flag is gone on the haskell.nix branch. |
||
reflex-platform = import ./dep/mars { inherit system; }; | ||
|
||
mkPerProfiling = profiling: let | ||
obelisk = import ./. (self-args // { inherit system profiling; }); | ||
|
@@ -69,8 +81,6 @@ let | |
echo "return" >> "$out" | ||
cat "${skeleton.shells.ghc}" >> "$out" | ||
''; | ||
androidSkeleton = skeleton.android.frontend; | ||
iosSkeleton = skeleton.ios.frontend; | ||
nameSuffix = if profiling then "profiled" else "unprofiled"; | ||
packages = { | ||
skeletonProfiledObRun = rawSkeleton.__unstable__.profiledObRun; | ||
|
@@ -84,13 +94,13 @@ let | |
ghcjs | ||
serverSkeletonExe | ||
; | ||
} // lib.optionalAttrs reflex-platform.androidSupport { | ||
inherit androidSkeleton; | ||
} // lib.optionalAttrs reflex-platform.iosSupport { | ||
inherit iosSkeleton; | ||
} // lib.optionalAttrs (system == "x86_64-linux") { | ||
android-app = rawSkeleton.android.app.aarch64; | ||
} // lib.optionalAttrs (system == "x86_64-darwin") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For now I mirrored what's in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hm the |
||
ios-app = rawSkeleton.ios.app.aarch64; | ||
}; | ||
in packages // { | ||
cache = reflex-platform.pinBuildInputs | ||
cache = pinBuildInputs | ||
"obelisk-${system}-${nameSuffix}" | ||
(collect packages); | ||
}; | ||
|
@@ -100,12 +110,12 @@ let | |
unprofiled = mkPerProfiling false; | ||
}; | ||
in perProfiling // { | ||
cache = reflex-platform.pinBuildInputs | ||
cache = pinBuildInputs | ||
"obelisk-${system}" | ||
(map (p: p.cache) (builtins.attrValues perProfiling)); | ||
}); | ||
|
||
metaCache = local-self.reflex-platform.pinBuildInputs | ||
metaCache = pinBuildInputs | ||
"obelisk-everywhere" | ||
(map (a: a.cache) (builtins.attrValues perPlatform)); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,27 @@ | ||
{ supportedSystems ? [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ] | ||
{ supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ] | ||
}: | ||
let | ||
obelisk = import ./. {}; | ||
pkgs = obelisk.nixpkgs; | ||
recurse = x: x // { recurseForDerivations = true; }; | ||
in | ||
recurse (pkgs.lib.genAttrs supportedSystems (system: | ||
let | ||
skeleton = import ./skeleton { inherit system; }; | ||
in with skeleton; recurse ({ | ||
inherit exe; | ||
inherit (obelisk.marsObelisk.hsPkgs) obelisk-selftest; | ||
} // pkgs.lib.optionalAttrs (system == "x86_64-linux") { | ||
android-app = recurse android.app; | ||
} // pkgs.lib.optionalAttrs (system == "x86_64-darwin") { | ||
ios-app = recurse ios.app; | ||
}))) | ||
|
||
/* | ||
rec { | ||
recurseForDerivations = true; | ||
build = import ./all-builds.nix { inherit supportedSystems; }; | ||
test = import ./all-tests.nix { inherit supportedSystems; }; | ||
inherit (build) metaCache; | ||
} | ||
*/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,23 +15,72 @@ | |
} | ||
}: | ||
with obelisk; | ||
project {} ({ pkgs, ... }: { | ||
let args = { | ||
# You must accept the Android Software Development Kit License Agreement at | ||
# https://developer.android.com/studio/terms in order to build Android apps. | ||
# Uncomment this to indicate your acceptance: | ||
android_sdk_accept_license = true; | ||
allowUnfree = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be set to false before merging. |
||
}; in | ||
|
||
project args ({ pkgs, ... }: { | ||
name = "skeleton"; | ||
android = { | ||
executable = ps: exes: (exes (ps.frontend)).frontend; | ||
executableName = "obelisk-skeleton"; | ||
applicationId = "systems.obsidian.obelisk.examples.minimal"; | ||
displayName = "Obelisk Minimal Example"; | ||
}; | ||
ios = { | ||
executable = ps: exes: (exes (ps.frontend)).frontend; | ||
executableName = "obelisk-skeleton"; | ||
bundleIdentifier = "systems.obsidian.obelisk.examples.minimal"; | ||
bundleName = "Obelisk Minimal Example"; | ||
}; | ||
web = { | ||
executable = ps: exes: (exes (ps.frontend)).frontend; | ||
}; | ||
extraArgs = { | ||
staticFiles = ./static; | ||
}; | ||
src = ./.; | ||
inputThunks = pkgs.obsidianCompilers.thunkSets.common ++ [ | ||
pkgs._dep.source.aeson-1541 | ||
pkgs._dep.source.android-activity | ||
cidkidnix marked this conversation as resolved.
Show resolved
Hide resolved
|
||
]; | ||
shells = ps: with ps; [ | ||
backend | ||
]; | ||
overrides = [ | ||
({ config, pkgs, lib, ... }: { | ||
config.enableShared = if pkgs.stdenv.targetPlatform.isiOS then lib.mkForce false else true; | ||
config.enableStatic = lib.mkForce true; | ||
}) | ||
({pkgs, lib, config, ... }: { | ||
packages.obelisk-run.components.library.build-tools = with pkgs; [ | ||
iproute | ||
]; | ||
packages.obelisk-run.components.library.build-tools = with pkgs; [ | ||
iproute | ||
]; | ||
|
||
packages.reflex-dom = { | ||
flags = { | ||
webkit2gtk = if (pkgs.stdenv.targetPlatform.isAndroid) then lib.mkForce false else true; | ||
}; | ||
}; | ||
|
||
packages.frontend.components.exes.frontend = { | ||
frameworks = if (!pkgs.stdenv.targetPlatform.isiOS && pkgs.stdenv.targetPlatform.isDarwin) then [ pkgs.darwin.apple_sdk.frameworks.CoreFoundation ] else [ ]; | ||
postInstall = lib.optionalString (pkgs.stdenv.hostPlatform.isDarwin) '' | ||
mkdir -p $out/obelisk-skeleton.app | ||
cp -r obelisk-skeleton $out | ||
cp $out/bin/obelisk-skeleton $out/obelisk-skeleton.app | ||
''; | ||
}; | ||
packages.jsaddle-wkwebview.src = (thunkSource ../dep/jsaddle) + "/jsaddle-wkwebview"; | ||
packages.jsaddle-wkwebview.components.library = { | ||
frameworks = | ||
if (pkgs.stdenv.targetPlatform.isiOS) then lib.mkForce [ pkgs.darwin.iosSdkPkgs.sdk pkgs.darwin.apple_sdk.frameworks.CoreFoundation ] | ||
else [ pkgs.darwin.apple_sdk.frameworks.CoreFoundation ]; | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was getting webkit2gtk eval failures on android so cargo-culted this section from https://github.com/reflex-frp/reflex-platform/blob/4fccfb196ac724695a5006a456b2125eeff331e5/example/default.nix#L62 We definitely don't want this re-done on every project. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the linked code should always be applied in obelisk (not so much in reflex-platform). If folks need to overwrite it they can use "lib.mkOverride" for a higher value than "lib.mkForce". I'd much rather this be a default instead of some documentation or comments anywhere There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well yes but a default on obelisk or on the obelisk skeleton? |
||
}) | ||
]; | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was removed from reflex-platform. Not sure if intentional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I wasn't needing them while doing the haskell.nix work. I don't think we need them in reflex-platform anymore but pulling it into the obelisk nix is fine by me