Aylur / ags

A customizable and extensible shell
GNU General Public License v3.0
2.09k stars 109 forks source link

Offline build (Gentoo) #122

Closed xoores closed 11 months ago

xoores commented 11 months ago

Hi,

I would like to create an ebuild so Gentoo users can install AGS. But the installation process has to be offline as the whole build is done in an isolated sandbox with no internet access.

Is there any way to "skip" npm install? Perhaps git submodules in repo or something similar?

Thanks

Aylur commented 11 months ago

Would packing the node_modules with the releases help?

xoores commented 11 months ago

I think yes - I can certainly try if you could perhaps send me an archive with those :)

(I would try to prepare that archive myself but I don't really know much about NPM and I would probably mess that up :sweat_smile: )

xoores commented 11 months ago

So I'm not sure if I got it right, but I did a git pull and then npm install - it created node_modules directory. I just re-packed this directory as-is and pushed it to through the ebuild process and it worked!

So if I understood your point correctly, it would definitely help to pack that node_modules to an archive with the sources :slightly_smiling_face: Ebuilds for Gentoo users would be then easy and I would create them - you could either point to my overlay or use them as you see fit.

Edit: It's not that easy :slightly_frowning_face: Although I can compile ags, I cannot run it as it is complaining about missing "Gvc" (Requiring Gvc, version none: Typelib file for namespace 'Gvc' (any version) not found) - and I don't really know how to fix this - I tried to copy node_modules to:

Now Gvc should be graphviz, right? I'm really lost in the Javascript ecosystem when it comes to the "backend" :sweat_smile: In the package.json I see something like girs/gvc - but googling that yields only one repo gjsify/types that seems a bit odd... I can see there is a gvc-1.0.0 in that repo and I can see that this is not in my node_modules directory :shrug:

xoores commented 11 months ago

I also noticed that it compiles libgvc.so... I just blindly assumed it is a Graphviz and just removed it as it collides with standard Graphviz library... Will try to uninstall graphviz & see if that is the problem.

edit: yes, that is it... that submodule libgnome-volume-control defininetly conflicts vit Graphviz :sweat_smile: - I have opened an issue with gnome.org here.

bearcatsandor commented 11 months ago

Hey @xoores, which overlay will this ebuild be in, and what will the ebuild be called? Thank you very much for your work on this.

xoores commented 11 months ago

Hi @bearcatsandor, it is in my overlay right here :slightly_smiling_face:

I just noticed that I have a license wrong - I will fix that, but that will not prevent it from building of course :slightly_smiling_face:

edit: It expects to have node_modules (it cannot download them as the ebuild runs in an offline sandbox) as a part of a package as @Aylur mentioned - until he gets around to do this, you will have to do that manually unfortunately :slightly_frowning_face: If you need help with that, let me know and I will tell you how to do it.

bearcatsandor commented 11 months ago

The downloaded source file is failing it's checksum.

Also, I have no idea how to deal with node_modules and I'd love the education.

Thanks

kotontrion commented 11 months ago

There are 3 ways to include the node_modules in the release:

  1. include node_modules in the ags-version.tar.gz
  2. have a separate node_modules.tar.gz
  3. have a ags-version.tar.gz without node and a ags-version-with-node.tar.gz including the node_modules

Most people won't need the node_modules, so I personally would prefer the second or third option.

@xoores I updated the github action to include the node modules in the release using the second option over at my fork and created a release there, so you can test it.

Edit: BTW, I just looked at your ebuild. I'm not familiar with how those work, but for the libgvc.so conflict instead of editing the meson.build with sed, for the AUR package I pass the following parameter to the meson build command --libdir "lib/$pkgname"

xoores commented 11 months ago

@kotontrion All options are perfectly viable for this :slightly_smiling_face: And option 2 and 3 sounds good. I will update ebuild for your fork when I get home.

I edited that with sed because the target path is com.github.Aylur.ags and I did not want to hardcode that into an ebuild. I also did not want to change any buildpaths since I had some problems getting everything to compile and I did not really want to introduce another variable into the process.

@bearcatsandor Yeah, it fails because this repo does not have that file. You will either have to create it yourself or wait a few hours and I will create an ebuild that will use Kotontrions fork that has these files already baked in :slightly_smiling_face:

Aylur commented 11 months ago

the libdir was lib/$pkgname at first (and still should be), thats where gnome installs gvc too, but I changed it to lib so that there is no need for a patch using nix. I didn't know about --libdir option for meson, but that should definitely solve the conflict. You might want to close the issue about this on gvc's gitlab because they state it in their readme that its meant to be used as a sub-module

@kotontrion could you make a PR with the updated github action? would appriciate it, I will tag a 1.4 release after this issue is resolved

also let me know what installation guide I should put on the wiki for Gentoo

kotontrion commented 11 months ago

@kotontrion could you make a PR with the updated github action? would appriciate it, I will tag a 1.4 release after this issue is resolved

Done. I initially wanted to wait for xoores to confirm that this solves the issue first.

xoores commented 11 months ago

@kotontrion could you make a PR with the updated github action? would appriciate it, I will tag a 1.4 release after this issue is resolved

Done. I initially wanted to wait for xoores to confirm that this solves the issue first.

Works like a charm! :+1:

I also fixed the license and added the --libdir rather than sed :slightly_smiling_face:

xoores commented 11 months ago

@bearcatsandor I just pushed ebuild that uses that repo @kotontrion made :slightly_smiling_face:

You can pull it from here and test it out.

bearcatsandor commented 11 months ago

Tna kyou so much folks! I have it installed and I'm busy theming!

Aylur commented 11 months ago

@xoores I released 1.4.0 with node_modules

xoores commented 11 months ago

Working:

ags --version
1.4.0

For Gentoo users you could add something like "Ebuilds for Portage are in Xoores' overlay" to the Howto :slightly_smiling_face:

Thanks for this, I'm currently fighting with notifications and CSS as I'm creating my own shell. And something has changed from 1.3.0 because I'm getting undefined around Hyprland.active.workspace. :grin: Had to revert back to 1.3.0 to get by bar back :sweat_smile:

Aylur commented 11 months ago

For Gentoo users you could add something like "Ebuilds for Portage are in Xoores' overlay" to the Howto 🙂

I've never used Gentoo, so I assume it would be enough to put this into the wiki as users will know what to do with it, but I would rather put exact commands on the wiki to make it clear, so what are the exact commands to get it installed?

xoores commented 11 months ago

I will try and add my repo to official Overlay list and then there will be a few commands on how to do it :-) I'll keep you posted - for now it is quite dependant on how any particular Gentoo user has set up his/her overlays.

Btw when I compile the 1.4 I get quite a lot "undefined" globals such as Hyprland etc... Did anything change? When I switch back to 1.3 (without touching that config) it works again...

Aylur commented 11 months ago

I will try and add my repo to official Overlay list and then there will be a few commands on how to do it :-) I'll keep you posted - for now it is quite dependant on how any particular Gentoo user has set up his/her overlays.

Sound great

Btw when I compile the 1.4 I get quite a lot "undefined" globals such as Hyprland etc... Did anything change? When I switch back to 1.3 (without touching that config) it works again...

the ags global got removed in 1.4.0, so you can't do ags.Service.Hyprland anymore, refer to the wiki on how to import them

xoores commented 11 months ago

I'm importing it like this (basically taken from your example/dotfiles) so I would say I was not doing it :sweat_smile:

const resource = file => `resource:///com/github/Aylur/ags/${file}.js`;
const require = async file => (await import(resource(file))).default;
const service = async file => (await require(`service/${file}`)).instance;

const Hyprland = await service('hyprland');
export const Widget = await require('widget');
export const Utils = await import(resource('utils'));

edit: I'm an idiot... :facepalm:

Here is the solution in case anyone else runs into this:

const service = async file => (await require(`service/${file}`));