-
Notifications
You must be signed in to change notification settings - Fork 70
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
Compatibility with nix #143
Comments
Thank you for tackling this. Our most untenable moment is when a user attempts to use it for the first time. And if something doesn't work off the bat - many would lose confidence and interest right away. And even advocated by someone else later, they most likely would not even try again. |
I just switched to nix as my package manager after doing a fresh re-install to macOS 12.4, and indeed I've run into some issues re: fennel.
Being a fairly green dev, spacehammer is my first introduction to hammerspoon Lua/fennel/emacs etc. (note: I haven't actually used spacehammer yet, due to this plan going awry) I've tried
both in hopes that whatever is going on with the fennel lookup would find the required files. Not sure what I can do to help but looking to learn nix and would love to get this working. @eccentric-j were you able to hack together any solutions? |
Thanks for that insight. Unfortunately I have not had a chance to set nix up on my personal yet. Based on what you describe editing spacehammer's init.lua to point to your fennel installation might be a quick way to get unblocked. From there can discuss options for making that smarter. Some options off the top of my head...
Open to more ideas too. |
After a bunch of messing around, I've got the following line added to the init.lua
and am getting the following
It seems like it's able to find the correct path but I'm unfamiliar with mach-o, lua and fennel and what might be going wrong here. |
mach-o is basically just ELF (a binary format) but for OSX. So basically, it looks like it's trying to import fennel as a binary. The problem is that you're setting CPATH, which is for binary libraries, not lua files. What type of file in your bin/fennel? |
Upon some investigation it looks like the imported fennel from
Noted about the CPATH, thank you. Gets me the following output from the hs console.
Which references the following code block from the /bin/fennel (file?) at line 5767
Googling the errors has turned up that this tends to be a fairly common error. One solution was that the path perhaps needed a "/" but besides trying (and failing) with that, I'm not sure where to dig next. |
I recently got my Nix config working for Spacehammer. If you are using Home Manager to configure your system this might be useful.
FWIW vendoring Fennel as suggested in #169 would greatly improve the ergonomics. |
This is my current, "self-contained" setup: home.file.".hammerspoon" = {
recursive = true;
source = pkgs.applyPatches {
src = pkgs.fetchFromGitHub {
owner = "agzam";
repo = "spacehammer";
rev = "0241428669872d708368ee2d21b909d837a5a851";
sha256 = "18yjcyvsvai378wqf7gw0kmsd71isx1708607x4y29qax8arsp2s";
# date = 2023-04-17T22:50:17-05:00;
};
# Edit-with-emacs workaround
patches = [ ./pkgs/spacehammer/0001-replace-usr-bin-with-nix-path.patch ];
};
};
home.file.".hammerspoon/fennel.lua" = {
source = builtins.fetchTarball
{
url = "https://fennel-lang.org/downloads/fennel-1.3.0.tar.gz";
sha256 = "sha256:0wciqn0ayqjxaz58hxfavwf4j63vv1v2b4ki7qgzxvzx38yhl8jl";
} + "/fennel.lua";
};
home.file.".hammerspoon/fennelview.lua" = {
source = builtins.fetchTarball
{
url = "https://fennel-lang.org/downloads/fennel-1.3.0.tar.gz";
sha256 = "sha256:0wciqn0ayqjxaz58hxfavwf4j63vv1v2b4ki7qgzxvzx38yhl8jl";
} + "/fennelview.lua";
}; |
Currently, nix is becoming a more common way to manage packages so it’s possible users may have fennel installed through nix instead of luarocks.
Going to install nix again on an older computer and figure out some solutions.
The text was updated successfully, but these errors were encountered: