Skip to content

xbar: init at 2.1.7-beta#209794

Merged
NetaliDev merged 2 commits intoNixOS:masterfrom
r17x:master
Nov 26, 2024
Merged

xbar: init at 2.1.7-beta#209794
NetaliDev merged 2 commits intoNixOS:masterfrom
r17x:master

Conversation

@r17x
Copy link
Member

@r17x r17x commented Jan 9, 2023

Description of changes

Put the output from any script or program into your macOS Menu Bar (the BitBar reboot)
https://xbarapp.com/

Tested Compilations
1 package added:
xbar (init at 2.1.7-beta)

1 package built:
xbar
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/)
  • 23.05 Release Notes (or backporting 22.11 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.

@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Jan 9, 2023
@r17x r17x force-pushed the master branch 3 times, most recently from b11b104 to 092aef2 Compare April 20, 2023 19:48
@Janik-Haag Janik-Haag added the 12.first-time contribution This PR is the author's first one; please be gentle! label Jun 12, 2023
@r17x
Copy link
Member Author

r17x commented Feb 18, 2024

@Janik-Haag I read from maintainer-list.nix about invitation to the orgs. How to get invitation?

@Janik-Haag
Copy link
Member

Hi, a bot invites you automatically once your maintainers entry object gets merged.
I have no time to review this pr, sorry (the label was added by a bot). You can ask on discourse or matrix for reviews.

Copy link
Member

@hraban hraban left a comment

Choose a reason for hiding this comment

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

Personally keen on seeing this happen but I don't think a binary distribution is the way for nixpkgs. My 2¢ fwiw.

@hraban
Copy link
Member

hraban commented Feb 26, 2024

Btw I had a look at how to compile this on OSX and apparently it requires nodejs (ok), go (ok), and "wails"? some kind of golang library which lets you write osx guis in go & html? It exists in nixpkgs, but currently linux only, which is ironic to say the least.

Copy link
Member

@hraban hraban left a comment

Choose a reason for hiding this comment

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

I'm going to change my original feedback about compiling from source being preferable on the basis that one of the dependencies for this isn't available for darwin in nixpkgs, it only works on linux. I don't think it's fair to make this PR contingent on fixing that, as well. It would be nice to add a comment, maybe?

"Downloading as binary package for now because compiling from source requires wails, which is currently only available for linux in nixpkgs."

What do y'all think?

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label May 3, 2024
Copy link
Member

@hraban hraban left a comment

Choose a reason for hiding this comment

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

I know it's old but it still builds and there are no merge conflicts. I just merged this into master locally, built and tested it, and it worked fine.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/1016/166

@github-actions github-actions bot added the 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` label Aug 8, 2024
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Aug 8, 2024
@FliegendeWurst FliegendeWurst added the 6.topic: darwin Running or building packages on Darwin label Nov 10, 2024
@hraban
Copy link
Member

hraban commented Nov 23, 2024

This PR still works, would love to see this get merged in. Thanks for your patience @r17x if I had merge rights I'd do it but alas.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/1016/185

@NetaliDev
Copy link
Member

I just checked and apparently wails is now available for Darwin after all. So it should be possible to build it from source by now.

@hraban
Copy link
Member

hraban commented Nov 25, 2024

I just checked and apparently wails is now available for Darwin after all. So it should be possible to build it from source by now.

I don't know whether to laugh or cry... 😂😭 poor @r17x . This PR deserves a place in a Hall of some kind.

I guess the rule is to call this xbar-bin, then, right? Would that be an acceptable PR? I can't bear to see this rejected after 2 years because we waited so long to merge it that the build ecosystem has changed from under it 😂

@r17x
Copy link
Member Author

r17x commented Nov 25, 2024

Lemme make it build from Source @NetaliDev , Maybe I needed some help when I stuck.

Don't worries @hraban, I will cry & laugh at the same time.

@NetaliDev
Copy link
Member

Sorry for my wording at this point. I know how frustrating it must be, but unfortunately it is a fact that source builds are preferred in the nixpkgs. And of course it's very unfortunate that the PR has been open for so long that a source build is now possible again, but as frustrating as it is, I think we should at least try it. And of course, if it turns out to be too complicated for whatever reason, we can stick with the binaries.

@r17x
Copy link
Member Author

r17x commented Nov 26, 2024

@NetaliDev Don't worries. Let's make it build from source.

{
  lib,
  fetchFromGitHub,
  buildGoModule,
  wails,
  pkg-config,
  autoPatchelfHook,
}:

let
  version = "2.1.7-beta";
  src = fetchFromGitHub {
    owner = "matryer";
    repo = "xbar";
    rev = "v${version}";
    sha256 = "sha256-RiTJgMqj5CRykvLCsqdioP8iB+aO8BQMm71KQ3WB75k=";
  };

in

buildGoModule {
  name = "xbar";
  pname = "xbar";

  inherit src;
  vendorHash = null;
  modRoot = "app";
  goDeps = src + "/app/go.sum";

  nativeBuildInputs = [
    wails
    pkg-config
    autoPatchelfHook
  ];

  patchPhase = ''
    echo -n "v${version}" > .version
  '';

  buildPhase = ''
    runHook preBuild
    wails build -m -s -trimpath -skipbindings  -o xbar
    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    mkdir -p $out/Applications
    cp -R $out/xbar $out/Applications/xbar.app

    runHook postInstall
  '';

  meta = {
    description = "Put the output from any script or program into your macOS Menu Bar (the BitBar reboot)";
    homepage = "https://xbarapp.com/";
    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
    platforms = lib.platforms.darwin;
    maintainers = with lib.maintainers; [ r17x ];
    license = lib.licenses.mit;
  };
}

Anyway, I have try to build from source, got an error with buildGoModule. I think, I missed something

       >                To ignore the vendor directory, use -mod=readonly or -mod=mod.
       >                 To sync the vendor directory, run:
       >                     go mod vendor

@NetaliDev
Copy link
Member

Okay, I have also tried to build it from source and I gave up. I can't even build it outside a derivation by running the provided build scripts. And even if we could build it: I bet that macOS will complain because it is not signed.

I've never had anything to do with macOS packaging under Nix, but when I grep for undmg in the nixpkgs, I find many macOS apps that could actually be built from source, but are simply unpacked as binary packages and I would also suspect that the signatures are a reason for this, but I'm not sure.

Anyway, if all the other apps are allowed to exist as binary packages, this one should be able to as well, so let's just go with the binary package.

@NetaliDev
Copy link
Member

Result of nixpkgs-review pr 209794 run on aarch64-darwin 1

1 package built:
  • xbar

@NetaliDev NetaliDev merged commit dafe47b into NixOS:master Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: darwin Running or building packages on Darwin 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants