Skip to content

Comments

kbd: remove dependency on bash#391836

Closed
blitz wants to merge 1 commit intoNixOS:stagingfrom
blitz:kbd-compression
Closed

kbd: remove dependency on bash#391836
blitz wants to merge 1 commit intoNixOS:stagingfrom
blitz:kbd-compression

Conversation

@blitz
Copy link
Contributor

@blitz blitz commented Mar 21, 2025

This PR makes the parts of kbd optional that depend on bash:

  • Compression support is now optional. It only saves 2MB (and is not useful, in case you have a compressed /nix/store) and pulls in bash via popen calls.
  • Installing unicode_start and unicode_stop are now optional. As far as I can tell, these are not used anyhow?

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/)
  • 25.05 Release Notes (or backporting 24.11 and 25.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
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@blitz blitz force-pushed the kbd-compression branch from 7a0058c to 51a13e2 Compare March 21, 2025 12:31
@github-actions github-actions bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. labels Mar 21, 2025
@nix-owners nix-owners bot requested a review from davidak March 21, 2025 12:33
@blitz blitz force-pushed the kbd-compression branch from 51a13e2 to 8ea0883 Compare March 21, 2025 12:34
@blitz blitz marked this pull request as draft March 21, 2025 12:40
@blitz blitz force-pushed the kbd-compression branch from 8ea0883 to 3f63862 Compare March 21, 2025 12:41
@blitz blitz changed the base branch from master to staging March 21, 2025 12:41
@blitz blitz force-pushed the kbd-compression branch from 3f63862 to a8b4d69 Compare March 21, 2025 16:29
@blitz blitz requested review from nikstur and toastal March 21, 2025 16:30
@blitz blitz marked this pull request as ready for review March 21, 2025 16:31
@blitz blitz force-pushed the kbd-compression branch from a8b4d69 to 1f2ff57 Compare March 21, 2025 17:52
@blitz blitz force-pushed the kbd-compression branch from 1f2ff57 to ce82825 Compare March 22, 2025 00:01
@blitz blitz force-pushed the kbd-compression branch from ce82825 to 2c7218a Compare March 23, 2025 11:03
@blitz blitz requested a review from drupol March 23, 2025 11:03
Copy link
Contributor

@drupol drupol left a comment

Choose a reason for hiding this comment

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

Diff LGTM - let's wait for a couple of days to have some other feedback.

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one person. label Mar 23, 2025
Copy link
Contributor

@doronbehar doronbehar left a comment

Choose a reason for hiding this comment

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

I like this change! A few small comments and I think this should be good to go :).

Comment on lines +18 to +22
# This might be worthwhile to disable if the store lives on a compressed filesystem.
withCompression ? true,
# Allow disabling the unicode_start/unicode_stop utilities, which
# unfortunately pull in bash into the closure.
withScripts ? true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can take the risk and disable these too by default? Disabling these in an overlay would require lots of rebuilds, and being able to use compression and the scripts, is something that would be required for specific applications, and a user that needs these features can build and use a modified version of kbd just for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Other distros (Debian) ship these scripts as well. I would only feel comfortable disabling these by default, if we find out who actually needs them.

Another option would be to rewrite them in C.

See the code for details what they do: https://github.com/legionus/kbd/blob/master/src/unicode_start#L18

Copy link
Contributor

Choose a reason for hiding this comment

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

Other distros (Debian) ship these scripts as well. I would only feel comfortable disabling these by default, if we find out who actually needs them.

Another option would be to rewrite them in C.

See the code for details what they do: legionus/kbd@master/src/unicode_start#L18

OK I see. I have an idea :) How about using multiple outputs? The bin output shouldn't be installed by default IIRC.

}:

stdenv.mkDerivation rec {
strictDeps = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I find it very weird that this appears at the beginning (unfortunately we don't have official guidelines for that).

Comment on lines +141 to +151
{
updateScript = gitUpdater {
# No nicer place to find latest release.
url = "https://github.com/legionus/kbd.git";
rev-prefix = "v";
};

tests = {
inherit (nixosTests) keymap kbd-setfont-decompress kbd-update-search-paths-patch;
};
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I'd add these in 2 separate commits.

@blitz
Copy link
Contributor Author

blitz commented Jun 5, 2025

Mmh. There is more work to be done in nixos/modules/config/console.nix that I currently don't have time for. I might return to this, but if someone wants to carry this forward, please do!

@blitz blitz closed this Jun 5, 2025
@doronbehar doronbehar mentioned this pull request Jun 18, 2025
13 tasks
@doronbehar
Copy link
Contributor

Opened an alternative, slightly more minimal PR at:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants