Skip to content
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

Draft
wants to merge 6 commits into
base: haskell.nix
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 0 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,6 @@ in rec {
#(hackage: (import "${marsObelisk.plan-nix}/default.nix").pkgs hackage)
];

ghcjs-app = self.crossSystems.ghcjs.hsPkgs.frontend.components.exes.frontend;

userSettings = {
android = reflexHasAttr "android";
ios = reflexHasAttr "ios";
Expand Down
4 changes: 2 additions & 2 deletions dep/mars/github.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"repo": "reflex-platform",
"branch": "haskell.nix",
"private": false,
"rev": "d5f1a1eb2ab91faa2fdb162085c40e417b0e5afe",
"sha256": "1vb69xjlb0c0f0hbrvbhw9na392sl7nn464d3kinpbjdyd9kdw6n"
"rev": "4fccfb196ac724695a5006a456b2125eeff331e5",
"sha256": "0f383z3pzcdnwv0ijbbm6xiky3k0lw31dx03x3nrpv46n929nh68"
}
57 changes: 53 additions & 4 deletions skeleton/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be set to false before merging.
How do we make sure CI caches it though?
Add the accept/allow as args to this file defaulting to false and overriden by CI?

}; 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 ];
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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.
Something more like, shoved into a trivially importable overlay on reflex-platform?
Could maybe have it implicitly applied by obelisk, but then what happens on module conflicts?

Copy link
Member

Choose a reason for hiding this comment

The 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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well yes but a default on obelisk or on the obelisk skeleton?

})
];
})