-
Notifications
You must be signed in to change notification settings - Fork 18
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
[WIP] Mob moss work on packaging flarum #23
Conversation
lastFile:README.md
lastFile:README.md
lastFile:README.md
lastFile:README.md
lastFile:README.md
lastFile:pkgs/flarum/default.nix
lastFile:pkgs/flarum/default.nix
lastFile:pkgs/flarum/default.nix
lastFile:pkgs/flarum/default.nix
lastFile:pkgs/flarum/default.nix
lastFile:pkgs/flarum/composer-env.nix
lastFile:pkgs/flarum/php-packages.nix
lastFile:pkgs/flarum/default.nix.bak
composerEnv.buildPackage { | ||
inherit packages devPackages noDev; | ||
name = "flarum-flarum"; | ||
src = composerEnv.filterSrc ./.; |
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 line seems to be written assuming that this nix
expression will be evaluated in the project repo, but because it's in ngipkgs
, we end up copying only composer.lock
and the vendor
directory into the nix store. As far as we know, we can't just replace this with fetchFromGitHub
because the flarum/flarum
and flarum/framework
repos do not have a composer.lock checked in.
So we were thinking we could get around this by using fetchFromGitHub
and then copying our composer.lock
on top of it.
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.
We came across https://discourse.nixos.org/t/source-combinators/13331/8 and https://discourse.nixos.org/t/easy-source-filtering-with-file-sets/29117 but neither seem to be usable yet
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, this is what I feared. composer2nix
makes a few assumptions here that we can't work around without ripping open the whole thing. @infinisil is still working on file set combinators, but we may get enough of it into Nixpkgs for you to use.
@@ -0,0 +1,35 @@ | |||
{ stdenv, fetchFromGitHub, php, phpPackages, ... }: |
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.
ignore this file for now, this is a mix of a default.nix
we were handwriting plus trying to copy in some of the autogenerated nix code from composer2nix
inherit (phpPackages) composer; | ||
|
||
filterSrc = src: | ||
builtins.filterSource (path: type: type != "directory" || (baseNameOf path != ".git" && baseNameOf path != ".git" && baseNameOf path != ".svn")) src; |
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 code is generic, and while usually I'd say that stuff should be part of composer2nix
and just be import
ed, you can actually trick it into doing what you want with something along these lines:
builtins.filterSource (path: type: type != "directory" || (baseNameOf path != ".git" && baseNameOf path != ".git" && baseNameOf path != ".svn")) src; | |
let | |
flarum-src = builtins.fetchTarball ...; | |
# hardcode flarum source here. not great | |
filtered-src = builtins.filterSource (path: type: type != "directory" || (baseNameOf path != ".git" && baseNameOf path != ".git" && baseNameOf path != ".svn")) flarum-src; | |
# combine what with what's actually in this source tree | |
in pkgs.symlinkJoin [ src filtered-src ]; |
Obviously this is fugly, but it doesn't make any sense to touch the generated sources file. I'm sure you'll find a more reasonable workaround.
No idea if this will actually work with symlinks.
composerEnv.buildPackage { | ||
inherit packages devPackages noDev; | ||
name = "flarum-flarum"; | ||
src = composerEnv.filterSrc ./.; |
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, this is what I feared. composer2nix
makes a few assumptions here that we can't work around without ripping open the whole thing. @infinisil is still working on file set combinators, but we may get enough of it into Nixpkgs for you to use.
commit 670a5c4 Author: Jack Leightcap <jack.leightcap@trailofbits.com> Date: Thu Jul 20 20:13:08 2023 -0400 mob next [ci-skip] [ci skip] [skip ci] lastFile:pkgs/flarum/php-packages.nix commit 29f6b9c Author: Albert Chae <albertchae@users.noreply.github.com> Date: Thu Jul 20 16:55:51 2023 -0700 mob next [ci-skip] [ci skip] [skip ci] lastFile:pkgs/flarum/default.nix.bak commit 743fcc3 Author: Jack Leightcap <jack.leightcap@trailofbits.com> Date: Thu Jul 20 19:35:17 2023 -0400 mob next [ci-skip] [ci skip] [skip ci] lastFile:pkgs/flarum/php-packages.nix commit 084ed40 Author: Jack Leightcap <jack.leightcap@trailofbits.com> Date: Thu Jul 20 18:24:17 2023 -0400 mob next [ci-skip] [ci skip] [skip ci] lastFile:pkgs/flarum/composer-env.nix commit 3faa9a6 Author: Albert Chae <albertchae@users.noreply.github.com> Date: Thu Jul 20 15:06:24 2023 -0700 mob next [ci-skip] [ci skip] [skip ci] lastFile:pkgs/flarum/default.nix commit efcd4b2 Author: Jason Odoom <jasonodoom@gmail.com> Date: Thu Jul 20 17:56:57 2023 -0400 mob next [ci-skip] [ci skip] [skip ci] lastFile:pkgs/flarum/default.nix commit 8645907 Author: Dominic Mills <dominic.millz27@gmail.com> Date: Thu Jul 20 16:38:57 2023 -0500 mob next [ci-skip] [ci skip] [skip ci] lastFile:pkgs/flarum/default.nix commit 7649658 Author: Anish Lakhwara <anish+git@lakhwara.com> Date: Thu Jul 20 14:27:08 2023 -0700 mob next [ci-skip] [ci skip] [skip ci] lastFile:pkgs/flarum/default.nix commit 5cca401 Author: Jack Leightcap <jack.leightcap@trailofbits.com> Date: Thu Jul 20 17:16:08 2023 -0400 mob next [ci-skip] [ci skip] [skip ci] lastFile:pkgs/flarum/default.nix commit 2f38aa2 Author: Jack Leightcap <jack.leightcap@trailofbits.com> Date: Thu Jul 20 17:07:20 2023 -0400 mob start [ci-skip] [ci skip] [skip ci] Co-authored-by: Jason Odoom <jasonodoom@gmail.com> Co-authored-by: Anish Lakhwara <anish+git@lakhwara.com> Co-authored-by: Dominic Mills <dominic.millz27@gmail.com> Co-authored-by: Albert Chae <albertchae@users.noreply.github.com> Signed-off-by: Jack Leightcap <jack.leightcap@trailofbits.com>
Signed-off-by: Jack Leightcap <jack.leightcap@trailofbits.com>
Signed-off-by: Jack Leightcap <jack.leightcap@trailofbits.com>
copy installPhase build script from closed PR NixOS/nixpkgs#96869 fix typo
Signed-off-by: Jack Leightcap <jack.leightcap@trailofbits.com>
Currently this is a draft PR just for communication on #10
default.nix.bak
can be ignored for nowcomposer.lock
is the lock file we got after runningcomposer create-project flarum/flarum .
as recommended by https://docs.flarum.org/install/#installing. Neither https://github.com/flarum/flarum nor https://github.com/flarum/framework havecomposer.lock
files checked in, which preventscomposer2nix
from generatingphp-packages.nix
The rest of the files (
composer-env.nix
,default.nix
,php-packages.nix
) are the output ofcomposer2nix