Skip to content

luajitPackages.sofa: init at 2024-04-30#308073

Merged
teto merged 1 commit intoNixOS:masterfrom
f4z3r:feat/sofa
Jun 7, 2025
Merged

luajitPackages.sofa: init at 2024-04-30#308073
teto merged 1 commit intoNixOS:masterfrom
f4z3r:feat/sofa

Conversation

@f4z3r
Copy link
Copy Markdown
Contributor

@f4z3r f4z3r commented Apr 30, 2024

Description of changes

Sofa is a small command/snippet management tool with nice features such as dynamic parameter definition based on command executions, a tight integration with Rofi, and more.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • 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/)
  • 24.05 Release Notes (or backporting 23.05 and 23.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
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions Bot added 6.topic: lua Lua is a powerful, efficient, lightweight, embeddable scripting language. 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` labels Apr 30, 2024
@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-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Apr 30, 2024
@teto
Copy link
Copy Markdown
Member

teto commented Apr 30, 2024

Looks good but I am doing a big lua update that I want to have in staging first. Will merge this afterwards.

Copy link
Copy Markdown
Contributor

@LordMZTE LordMZTE left a comment

Choose a reason for hiding this comment

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

Unfortunately does not build for me:

       > Missing dependencies for sofa 0.4.0-0:
       >    compat53 >= 0.13 (not installed)

This is rather strange as the dependency does seem to be declared.

@f4z3r
Copy link
Copy Markdown
Contributor Author

f4z3r commented May 2, 2024

Unfortunately does not build for me:

       > Missing dependencies for sofa 0.4.0-0:
       >    compat53 >= 0.13 (not installed)

This is rather strange as the dependency does seem to be declared.

Yup sorry, this is because compat53 is only on version 0.12.1-0 on unstable. I already fixed it on sofa itself, and released a new rockspec to luarocks. Just did not yet get to update this PR. Will do it tonight as soon as I get off from work.

Copy link
Copy Markdown
Contributor

@LordMZTE LordMZTE left a comment

Choose a reason for hiding this comment

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

Thanks for the update! Everything works as expected now.

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one person. label May 2, 2024
@teto
Copy link
Copy Markdown
Member

teto commented May 13, 2024

can you rebase please ?

@teto
Copy link
Copy Markdown
Member

teto commented May 14, 2024

there is a stupid trend in recent software to fail to start without a config. I tried to start it with:

$ results/luajitPackages.sofa/bin/sofa
 /nix/store/g1p9296iz8hl66z60spqq23464jnhx6j-luajit-2.1.1693350652/bin/luajit: /home/teto/.config/sofa/config.yaml: No such file or directory

after creating an empty config:

 /nix/store/g1p9296iz8hl66z60spqq23464jnhx6j-luajit-2.1.1693350652/bin/luajit: ...jlf-luajit2.1-sofa-0.4.0-1/share/lua/5.1/sofa/config.lua:36: attempt to index local 'conf' (a nil value)

then I picked a random config and got

$ results/luajitPackages.sofa/bin/sofa
/nix/store/g1p9296iz8hl66z60spqq23464jnhx6j-luajit-2.1.1693350652/bin/luajit: ...ijlf-luajit2.1-sofa-0.4.0-1/share/lua/5.1/sofa/utils.lua:73: bad argument #1 to 'pairs' (table expected, got nil)

Do you think it would be possible to add a test ? On the next lua update, I dont feel like manually testing such flimsy software.

@f4z3r
Copy link
Copy Markdown
Contributor Author

f4z3r commented May 14, 2024

there is a stupid trend in recent software to fail to start without a config. I tried to start it with:

$ results/luajitPackages.sofa/bin/sofa
 /nix/store/g1p9296iz8hl66z60spqq23464jnhx6j-luajit-2.1.1693350652/bin/luajit: /home/teto/.config/sofa/config.yaml: No such file or directory

after creating an empty config:

 /nix/store/g1p9296iz8hl66z60spqq23464jnhx6j-luajit-2.1.1693350652/bin/luajit: ...jlf-luajit2.1-sofa-0.4.0-1/share/lua/5.1/sofa/config.lua:36: attempt to index local 'conf' (a nil value)

then I picked a random config and got

$ results/luajitPackages.sofa/bin/sofa
/nix/store/g1p9296iz8hl66z60spqq23464jnhx6j-luajit-2.1.1693350652/bin/luajit: ...ijlf-luajit2.1-sofa-0.4.0-1/share/lua/5.1/sofa/utils.lua:73: bad argument #1 to 'pairs' (table expected, got nil)

Do you think it would be possible to add a test ? On the next lua update, I dont feel like manually testing such flimsy software.

Hi @teto I have already fixed this. However, the version that fixes it also depends on another package that is not currently contained in nixpkgs. I can lifecycle to the new version, but then this will not build until #309030 is merged.

@wegank wegank removed the 12.approvals: 1 This PR was reviewed and approved by one person. label May 14, 2024
@teto
Copy link
Copy Markdown
Member

teto commented May 14, 2024

didn't realize you were the author ^^'' I merged the dependency so you can update this. Looks like you already have busted tests so that's great. I am a bit hesitant to merge a 0-star software with a request by the author but the screenshots look good and I now want to make it work. Does sofa bring the fading in screenshots or is it some external wayland process ?

@f4z3r
Copy link
Copy Markdown
Contributor Author

f4z3r commented May 14, 2024

Sofa uses rofi (x11, not wayland) for the prompting (or you can configure it to use fzf instead, or use xwayland for rofi). The look and feel of the program is then based on your personal rofi configuration. sofa just patches the commands together, does the parameter substitution, default injections, etc. So when you want to try it out, you will need to either have rofi or fzf on your system (and configure sofa accordingly when using fzf).

Does sofa bring the fading in screenshots or is it some external wayland process ?

I am not sure what you are asking here. If you are talking about the fading in and out of the prompt windows, that is defined based on your compositor.

Regarding the star count: Yeah I know. It is a very new software project, and I don't advertise about such stuff. But I might give it a go, since everyone I have shown it so far has ended up using it.

I will update the PR to use the newest version with the luatext dependency asap.

@teto
Copy link
Copy Markdown
Member

teto commented May 15, 2024

some feedback if you are interested (on the program, not the PR):
configuation not found <- typo configuRation. Also it could show the potential paths because I couldn't find in README where to put the files (neither does sofa --help).

strace showed me it was ~/.config/sofa/config.yaml. so i copy/pasted your config and it ran. Looks interesting.
sofa --help shows completion is available. Do you want to add it to the PR ? you can do like "busted" does in pkgs/development/lua-modules/overrides.nix .

@f4z3r
Copy link
Copy Markdown
Contributor Author

f4z3r commented May 16, 2024

Hi @teto , the configuration is documented in docs/configuration which is linked in the README. But you are right, it would definitely make sense to have a reference to how configuration should be set in sofa --help. I will update this and the typo soon. I would also be very interested in adding the completion. Thanks for the example with busted.

I am currently on holidays, so it might take a few days until I get to doing it.

@f4z3r
Copy link
Copy Markdown
Contributor Author

f4z3r commented May 23, 2024

@teto Not gonna lie, I am very unsure whether the way I added the auto-completion stuff is correct.

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Sep 10, 2024
@teto
Copy link
Copy Markdown
Member

teto commented Oct 2, 2024

you can rebase if you wnat this in the next nixos release

@ofborg ofborg Bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Oct 3, 2024
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Apr 2, 2025
@ofborg ofborg Bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label May 3, 2025
@teto
Copy link
Copy Markdown
Member

teto commented May 3, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 308073


x86_64-linux

❌ 5 packages failed to build:
  • lua51Packages.sofa
  • luaPackages.sofa (lua52Packages.sofa)
  • lua53Packages.sofa
  • lua54Packages.sofa
  • luajitPackages.sofa

@f4z3r
Copy link
Copy Markdown
Contributor Author

f4z3r commented May 4, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 308073

x86_64-linux

❌ 5 packages failed to build:

My bad, did not really understand how the completion is supposed to work and how to test the builds. Should be fixed.

@teto
Copy link
Copy Markdown
Member

teto commented May 4, 2025

this builds now but

 ./result/bin/sofa                      
WARN - '/home/teto/.config/sofa/config.yaml': configuration not found, using empty default config

does nothing ? I have rofi installed though. rofi -i seems to call rofi but fails because rofi asks me what mode to show.
I feel the --help could be more detailed. https://github.com/f4z3r/sofa shows neat config but out of the box the config does nothing (ie using empty default config ) ?

@f4z3r
Copy link
Copy Markdown
Contributor Author

f4z3r commented May 4, 2025

Yes if you don't setup some command templates in the config, it will not do anything as there is nothing to choose from. I could update sofa that it creates some dummy config with a sample template if launched without a config. Not sure how useful that would be though.

@teto teto merged commit f7d136f into NixOS:master Jun 7, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: lua Lua is a powerful, efficient, lightweight, embeddable scripting language. 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-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants