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

pop-launcher: init at 1.2.1 #176303

Merged
merged 2 commits into from
Feb 3, 2023
Merged

pop-launcher: init at 1.2.1 #176303

merged 2 commits into from
Feb 3, 2023

Conversation

samhug
Copy link
Contributor

@samhug samhug commented Jun 4, 2022

Description of changes

Add package for pop-launcher https://github.com/pop-os/launcher

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@necrophcodr
Copy link
Contributor

I tried building it and running it, but unfortunately I couldn't test it with pop-shell. But it builds and starts just fine at least.

@Micka-R
Copy link

Micka-R commented Jun 20, 2022

Working very well here, thank you!

@sevenautumns
Copy link
Contributor

sevenautumns commented Jun 21, 2022

Works great, but why are you applying a patch?
Wouldn't this suffice:

substituteInPlace src/lib.rs \
    --replace '/usr/lib/pop-launcher' "$out/share/pop-launcher"
substituteInPlace plugins/src/scripts/mod.rs \
    --replace '/usr/lib/pop-launcher' "$out/share/pop-launcher"

As far as I know, the DISTRIBUTION constants used, are the locations where pop-launcher expects plugins and scripts within a distribution, and since we use nix as the packagemanager, these should be set to nix specific locations instead, hence $out/share/pop-launcher

@samhug
Copy link
Contributor Author

samhug commented Jun 21, 2022

Works great, but why are you applying a patch? Wouldn't this suffice:

substituteInPlace src/lib.rs \
    --replace '/usr/lib/pop-launcher' "$out/share/pop-launcher"
substituteInPlace plugins/src/scripts/mod.rs \
    --replace '/usr/lib/pop-launcher' "$out/share/pop-launcher"

As far as I know, the DISTRIBUTION constants used, are the locations where pop-launcher expects plugins and scripts within a distribution, and since we use nix as the packagemanager, these should be set to nix specific locations instead, hence $out/share/pop-launcher

Hi @Steav005, thanks for testing

I left the DISTRIBUTION constants as is so that the package would still find plugins/scripts installed in those paths. I thought that might be useful on a non-NixOS system or if someone wanted to install additional plugins/scripts using a NixOS module

@sevenautumns
Copy link
Contributor

I left the DISTRIBUTION constants as is so that the package would still find plugins/scripts installed in those paths. I thought that might be useful on a non-NixOS system or if someone wanted to install additional plugins/scripts using a NixOS module

I understand, but for additional systemwide and per-user plugins/scripts other locations are used by pop-launcher
https://github.com/pop-os/launcher#plugin-directories

For non-NixOS systems, this may help, but again, there are other locations were additions plugins/scripts are supposed to be placed. For additional NixOS modules providing plugins/scripts /usr/lib does not help either, because on nix systems there is no /usr/lib.

On that note, maybe you also want to consider, changing the plugin/script path from share to lib.
Here is one example where this is done:

--replace "/usr/lib" "$out/lib"

These are just my two cents, I dont have any say in here

@samhug
Copy link
Contributor Author

samhug commented Jun 22, 2022

I understand, but for additional systemwide and per-user plugins/scripts other locations are used by pop-launcher https://github.com/pop-os/launcher#plugin-directories

For non-NixOS systems, this may help, but again, there are other locations were additions plugins/scripts are supposed to be placed. For additional NixOS modules providing plugins/scripts /usr/lib does not help either, because on nix systems there is no /usr/lib.

That seems reasonable to me - I'll update the PR later today

@SuperSandro2000
Copy link
Member

@ofborg eval

nativeBuildInputs = [ just ];

buildPhase = ''
just
Copy link
Member

Choose a reason for hiding this comment

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

Does just support -j (jobs) or a similar flag like make does?

Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't appear to. But it also isn't really meant as a replacement for a build tool, since it's more of a command runner.

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 that is just invoking cargo commands, right? then we should use the nixpkgs tooling for cargo rather than just.

Copy link
Contributor

Choose a reason for hiding this comment

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

@SuperSandro2000 it does a bit more than that, and who knows what it might do in the future. However I do agree that as it is now, replacing it for just the nixpkgs handling of cargo with some additional postBuildPhase script might be the ideal and more straightforward way of doing this yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SuperSandro2000 I changed it to use the default build phase with a postInstall instead of overriding with the upstream build script

Copy link
Member

Choose a reason for hiding this comment

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

looks better now

@ghost
Copy link

ghost commented Jul 22, 2022

Thanks for this. I did a quick test with b21aca4, the launcher works great!

One issue I noticed, two of the built-in plugins calculator and file search are not working due to missing packages fd and libqalculate, is it a good idea to include these as optional inputs?

@samhug
Copy link
Contributor Author

samhug commented Jul 23, 2022

One issue I noticed, two of the built-in plugins calculator and file search are not working due to missing packages fd and libqalculate, is it a good idea to include these as optional inputs?

I had left fd and libqalculate out and figured people could them to their PATH if they used those plugins. I'm not opposed to adding these to the closure if that's preferred though.

There is also https://github.com/pop-os/launcher/blob/master/plugins/src/terminal/mod.rs#L127 which assumes either /usr/bin/x-terminal-emulator or /usr/bin/gnome-terminal exists. These are absolute paths so I'm not sure what the best approach is here.

@SuperSandro2000
Copy link
Member

There is also https://github.com/pop-os/launcher/blob/master/plugins/src/terminal/mod.rs#L127 which assumes either /usr/bin/x-terminal-emulator or /usr/bin/gnome-terminal exists. These are absolute paths so I'm not sure what the best approach is here.

We don't create a x-terminal-emulator symlink on NixOS. If we don't always want to depend on gnome terminal than we could just remove the absolute part.

I had left fd and libqalculate out and figured people could them to their PATH if they used those plugins. I'm not opposed to adding these to the closure if that's preferred though.

Either we point those paths directly to the binaries or wrap the exectuable to add them to PATH.

@samhug
Copy link
Contributor Author

samhug commented Jul 24, 2022

I updated this to include fd and libqalculate, and removed the absolute portion of the gnome-terminal path

@samhug
Copy link
Contributor Author

samhug commented Jul 24, 2022

I removed the shebang patch for justfile since this isn't using the upstream script anymore

foo-dogsquared added a commit to foo-dogsquared/nixos-config that referenced this pull request Aug 10, 2022
@ermyril
Copy link

ermyril commented Oct 30, 2022

Is there any chances of it getting merged?

Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

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

and please rebase. Otherwise LGTM

pkgs/applications/misc/pop-launcher/default.nix Outdated Show resolved Hide resolved
@flokli
Copy link
Contributor

flokli commented Feb 3, 2023

This builds and runs. I didn't test if pop-shell can discover it, but that'd probably be a fixup in pop-shell anyways, not here. Let's get this in!

@flokli flokli merged commit 1aeeffd into NixOS:master Feb 3, 2023
@samhug samhug deleted the pop-launcher branch February 4, 2023 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants