Nix installation
Hello!
I'm trying to install this addon for Firefox with the buildFirefoxXpiAddon build command:
buildFirefoxXpiAddon {
pname = "spookfox";
version = "git";
addonId = "[email protected]";
url = "https://github.com/bitspook/spookfox/releases/download/v0.4.0/spookfox-ff.xpi";
sha256 = "57a5917cc4a46f6fd3692e9b8432e8d0f60f31afc26cef89972762f5d30257d8";
meta = with lib; {
homepage = "https://github.com/bitspook/spookfox";
description = "A tinkerer's bridge b/w Emacs and Web Browser (Firefox and Chrome)";
license = licenses.mit;
mozPermissions = [
# https://github.com/bitspook/spookfox/blob/ee4f23f022db70e8ad3b057140c75a17a3df6dab/spookfox-addon/src/manifest.json#L44
"<all_urls>" "tabs" "search" "scripting"
];
platforms = platforms.all;
};
};
however, I get the following error:
building '/nix/store/5a7xwb1gxyphyvdbr3szvmhi2vs5fjw5-emacs-spookfox-unstable-2024-04-25.drv'...
error: builder for '/nix/store/5a7xwb1gxyphyvdbr3szvmhi2vs5fjw5-emacs-spookfox-unstable-2024-04-25.drv' failed with exit code 1;
last 10 log lines:
> calling 'postUnpack' function hook '_updateSourceDateEpochFromSourceRoot'
> Running phase: patchPhase
> Running phase: updateAutotoolsGnuConfigScriptsPhase
> Running phase: configurePhase
> calling 'preConfigure' function hook '_multioutConfig'
> no configure script, doing nothing
> Running phase: buildPhase
> Running phase: installPhase
> install: missing destination file operand after '/nix/store/92zbiw4fqjx10sj2s7bscgsqxb95qrm6-emacs-spookfox-unstable-2024-04-25/share/emacs/site-lisp'
> Try 'install --help' for more information.
For full logs, run 'nix log /nix/store/5a7xwb1gxyphyvdbr3szvmhi2vs5fjw5-emacs-spookfox-unstable-2024-04-25.drv'.
error: 1 dependencies of derivation '/nix/store/38i66pb3yzpxqn7kfdr6s9p4h6nka5if-home-manager-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/08yyvxvw5f6sirf8qkhfgpzkrkmavz0w-home-manager-generation.drv' failed to build
error: 1 dependencies of derivation '/nix/store/fcg8hfwcpk32bpmgfj5y9mp8yl1i9dn7-unit-home-manager-admin.service.drv' failed to build
error: 1 dependencies of derivation '/nix/store/dsfq85klqwnf4arwl4xhypk6100mbdv6-system-units.drv' failed to build
error: 1 dependencies of derivation '/nix/store/g9cn3n3l8y90wpscx971n45m1rpp6iq9-etc.drv' failed to build
error: 1 dependencies of derivation '/nix/store/4ysj17a51rz2g06a8yxzmzj06p9g7hdy-nixos-system-nixos-24.05.20240717.c716603.drv' failed to build
Thoughts?
Looks like install is called on the addon id: https://gitlab.com/rycee/nur-expressions/-/blob/master/pkgs/firefox-addons/default.nix#L23 I probably got it wrong.
Actually, I see now that the error is regarding the emacs package in this repo. The Firefox addon is building fine. I built the Emacs package like this:
(emacsPackages.trivialBuild {
pname = "spookfox";
version = "unstable-2024-04-25";
src = fetchFromGitHub {
owner = "bitspook";
repo = "spookfox";
sha256 = "1sjx8cvms0ykngicsbw75ngcgpip36pvzxp5xpwys2836g0i5w23";
rev = "ee4f23f022db70e8ad3b057140c75a17a3df6dab";
};
})
Probably the trivial build is not picking up the elisp files because of the unusual directory structure.
Hello @walseb,
I've had it in back of my head (and in my TODOs.org) to package this project for nix+guix, but hasn't been able to find time for it yet. Thank you for initiating this! ❤️
I've used nix pretty much as a user, but never to package anything. I'll try reading up on emacsPackages.trivialBuild and see if I can help!
No problem!
To be clear, once this package is up on Firefox add-ons and melpa, the nix recipes should be automatically generated and updated, but until then they need to be built manually like this.
The Firefox add-on will need to be added to the list here for them to be generated with Rycee's firefox add-ons overlay: https://gitlab.com/rycee/nur-expressions/-/blob/master/pkgs/firefox-addons/addons.json
But once on melpa, the emacs package should be added to nixpkgs automatically.
This builds the elisp Spookfox package on Nixos properly:
(emacsPackages.trivialBuild {
pname = "spookfox";
version = "git";
preInstall = ''
cp lisp/spookfox.el .
cp lisp/apps/* .
'';
src = fetchFromGitHub {
owner = "bitspook";
repo = "spookfox";
rev = "96fb7ced244d388fb67290fbbe4ec1a8d4af0095";
hash = "sha256-xgL3qEz8NHBIDl8vVRZj1JJZErI7utzvqEJIDaquv7c=";
};
packageRequires = with emacsPackages; [ websocket ];
})
Also, for Nix to automatically install the Spookfox Firefox addon you need to install it on the firefox-devedition package, as it allows for .xpis to be installed without being approved by Firefox.
Perhaps this should be added to the documentation? Should I close this?