about summary refs log tree commit diff stats
path: root/pkgs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-11-02 18:03:59 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-11-02 18:03:59 +0100
commitc2ae8f2beeacf0e291c7ce30b53d8fd5547f3f92 (patch)
tree67532c06edcead27984c9c833c7950974161a2d5 /pkgs
parentfix(modules/less/command): Re-enable `#stop` (diff)
downloadnixos-config-c2ae8f2beeacf0e291c7ce30b53d8fd5547f3f92.tar.gz
nixos-config-c2ae8f2beeacf0e291c7ce30b53d8fd5547f3f92.zip
fix(pkgs/less): Temporary override broken `less` package
The `less` package in `nixpkgs` is currently compiled with secure
mode enabled, which prevents less from e.g. loading its configuration
file.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/by-name/le/less/package.nix61
1 files changed, 61 insertions, 0 deletions
diff --git a/pkgs/by-name/le/less/package.nix b/pkgs/by-name/le/less/package.nix
new file mode 100644
index 00000000..ce4195b7
--- /dev/null
+++ b/pkgs/by-name/le/less/package.nix
@@ -0,0 +1,61 @@
+# TODO: Remove this, once `nixpkgs` has fixed their `--without-secure`
+# Source pr: https://github.com/NixOS/nixpkgs/pull/352298 <2024-11-01>
+{
+  lib,
+  fetchurl,
+  ncurses,
+  pcre2,
+  stdenv,
+  # Boolean options
+  withSecure ? false,
+}:
+stdenv.mkDerivation (finalAttrs: {
+  pname = "less";
+  version = "668";
+
+  # `less` is provided by the following sources:
+  # - meta.homepage
+  # - GitHub: https://github.com/gwsw/less/
+  # The releases recommended for general consumption are only those from
+  # homepage, and only those not marked as beta.
+  src = fetchurl {
+    url = "https://www.greenwoodsoftware.com/less/less-${finalAttrs.version}.tar.gz";
+    hash = "sha256-KBn1VWTYbVQqu+yv2C/2HoGaPuyWf6o2zT5o8VlqRLg=";
+  };
+
+  buildInputs = [
+    ncurses
+    pcre2
+  ];
+
+  outputs = [
+    "out"
+    "man"
+  ];
+
+  configureFlags =
+    [
+      "--sysconfdir=/etc" # Look for 'sysless' in /etc
+      (lib.withFeatureAs true "regex" "pcre2")
+    ]
+    # Normally we should add `lib.withFeature withSecure "secure"` to configureFlags,
+    # but `--without-secure` does not work as expected in less-668, it enables secure
+    # mode instead, so only add `--with-secure` if enabled.
+    ++ lib.optionals withSecure [(lib.withFeature true "secure")];
+
+  strictDeps = true;
+
+  meta = {
+    homepage = "https://www.greenwoodsoftware.com/less/";
+    description = "More advanced file pager than 'more'";
+    changelog = "https://www.greenwoodsoftware.com/less/news.${finalAttrs.version}.html";
+    license = lib.licenses.gpl3Plus;
+    mainProgram = "less";
+    maintainers = with lib.maintainers; [
+      AndersonTorres
+      # not active
+      dtzWill
+    ];
+    platforms = lib.platforms.unix;
+  };
+})