-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
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
Init: chromium darwin #244152
Init: chromium darwin #244152
Conversation
a960814
to
80633f7
Compare
f479f21
to
1ea3326
Compare
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.
Would be nice if we could get a Linux maintainer's opinion on the reorganizing of the package.
pkgs/applications/networking/browsers/chromium/darwin/default.nix
Outdated
Show resolved
Hide resolved
pkgs/applications/networking/browsers/chromium/darwin/default.nix
Outdated
Show resolved
Hide resolved
Yeah that reorg is going to create a massive merge conflict with pending PRs like #229265. |
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.
Since chromium
is built from source and this isn't, they zero Nix code; there's really no benefit to having them be the same package. @toon had the right idea; rename this to chromium-bin
and put an if stdenv.hostPlatform.isDarwin then chromium-bin else ...
in pkgs/top-level/all-packages.nix
.
@amjoseph-nixpkgs there doesn't seem to be an existing chromium-bin. There wouldn't be a need for |
Right; I was suggesting that you create one. But, as you point out:
I guess if you really want to avoid creating another top-level entry you could just have The |
0ef984b
to
53ce772
Compare
Hey, looking much better, thanks a bunch for reorganizing this. I'll leave the rest of the review up to people who have Darwin hardware to test on. Nice work! |
It's not clean, but it works. What's missing is an update script and how to get the actual version without downloading the entire archive first. extractDarwinApp is a helper for making derivations from .app and .dmg bundles.
53ce772
to
b33f2c6
Compare
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.
Much simpler this way, I think making a new package was for the best.
|
||
mkdir -p $out/bin | ||
if [[ "${toString isDmg}" = "1" ]] ; then | ||
# .dmg uses sourceRoot, which means PWD is already in the sourceRoot |
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.
Can't we avoid setting the sourceRoot
to inside the .app
bundle so that we can do away with these branches and just copy the bundle in both cases?
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.
There are multiple usecases.
- the source is unpacked to contain a folder with a single subfolder
${appName}.app/
That means we can copy the subfolder with no processing
- the source is unpacked to contain a folder with multiple subfolders of which one is the
.app
folder
This makes the default unpackPhase
unhappy as it expects only a single folder https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L1136
It is that error which added the necessity for sourcesRoot
.
- the source is a folder
I'm now noticing that this isn't supported by the function in its current form.
But this can be the most difficult or the easiest, depending on how it's handled. The reason being at some point the there's a cd
into the folder by mkDerivation
--> a ${appName}.app
folder will reveal Contents/
when a ls
is run in the installPhase.
This means, either similar processing to now which still requires branching, or detecting whether it's a valid bundle and then doing processing like is done now.
If you have a suggestion to handle this without branching, that'd be great.
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.
2f85c6e treats all the usecases above but with the existing branches. I couldn't conceive a solution without branches.
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.
Just setting sourceRoot = "."
should work. It only makes passing an app as the source slightly harder but I don't think that'd be a common case?
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.
It does seem like a valid usecase. Is it a problem that it's handled?
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.
It makes everything more complex for very little gain though. When would you want to use a straight app as source and be unable to use the directory containing it instead?
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.
@michaelCTS, do you disagree strongly with the simplification?
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.
Yes, I do. It's not clear to me why we would remove support for a usecase just because of a single if/else, and wait until/if someone does stumble upon the usecase to then have another discussion about a conditional block.
Edit: I currently don't have the bandwidth to make modifications anyway, so it's OK with me if you edit it or even fork it and make another PR. You should have edit access now
The arguments and documentation implied that only `.app` and `.dmg` we supported, but that wasn't true. The case for `src = ./some/folder` and non-dmg archives with multiple folders was not supported. Now, the user can specify srcHasManySubfolders which sets the `sourceRoot` for `mkDerivation` to a default value. The user also can directly set `sourceRoot` themselves.
This allows nix to handle the supported platforms instead of throwing a string for unsupported platforms.
I just tried it out via home-manager (set the package option to chromium-bin) and it seems to be working fine. I couldn't get the extensions option to work though, but that might be related to the bin maybe? Installing them directly in the browser worked fine |
@jakuzure thanks for testing. Not sure what's up with the extensions in |
Hi, any updates on when this could be merged and if I can help it to happen sooner somehow? |
@WeetHet as per my last comment, there's no time for this on my end. I'm actually going to sell my mac as it's not necessary anymore. Feel free to branch off my branch and make the changes @toonn wanted (that I disagreed with). It's probably what will get the PR approved. |
I've opened #324701, simplifying this as much as possible in order to get it merged. Someone with more motivation may get something like |
Description of changes
Provides a simple chromium package for darwin as well as a
makeDarwinApp
.There are still some possible improvements, but I would like to keep this PR small and add those improvements in later PRs instead of having one enormous PR.
mkDerivation.meta
(though that may be messy)makeDarwinApp
should be able to retrieve the version from the source (Info.plist
should contain a field with the app version)Notes
The diff looks like
chromium/default.nix
was edited, but I moved it all intochromium/linux
and created a new one. The diff is unfortunately not better, but I hope that won't be a problemThings done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)closes #247855