Skip to content
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

nixos/less configure less with module #34381

Merged
merged 2 commits into from Jan 30, 2018
Merged

nixos/less configure less with module #34381

merged 2 commits into from Jan 30, 2018

Conversation

JohnAZoidberg
Copy link
Member

Motivation for this change

Because less is configured not directly with a plaintext file but the config file requires translation to a binary file I thought this is the perfect use case for a nixos module.
Not only can less be configured declaratively now, but I added the convenience that less by default now extracts (xz, gzip, bz2) compressed files transparently before reading.

I think everything possible in the real configuration can be done with the nix language now - therefore there is no need for an option like "extraConfig".

Things done

Added a module to configure less with. Extracts compressed files by default before opening them.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

"${pkgs.less}/bin/lesskey -o $out $src";

lessPipe = pkgs.writeScriptBin "lesspipe.sh" ''
#! /bin/sh
Copy link
Member Author

Choose a reason for hiding this comment

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

Should I change it to #!${stdenv.shell}?

Copy link
Member

Choose a reason for hiding this comment

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

yes

Copy link
Member

Choose a reason for hiding this comment

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

I wonder if lesspipe would be the better default here. We already package it in nixpkgs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, that's a good idea. It's (almost) always better to use something well maintained than to hack a script together yourself.

Rather than a custom script the less config now uses the lesspipe
package config by default.
@Mic92 Mic92 merged commit add22af into NixOS:master Jan 30, 2018
@Mic92
Copy link
Member

Mic92 commented Jan 30, 2018

Thanks. Module looks good to me with good examples.

@JohnAZoidberg JohnAZoidberg deleted the less branch February 5, 2018 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants