git.fiddlerwoaroof.com
Browse code

feat: add nix derivation to make `gsed` a thing

Ed Langley authored on 26/06/2020 21:22:18
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1 @@
1
+result
0 2
new file mode 100644
... ...
@@ -0,0 +1,40 @@
1
+{ pkgs ? import <nixpkgs> {}, stdenv ? pkgs.stdenv , fetchurl ? pkgs.fetchurl , perl ? pkgs.perl }:
2
+
3
+stdenv.mkDerivation rec {
4
+  pname = "gnused-prefixed";
5
+  version = "4.8";
6
+
7
+  src = fetchurl {
8
+    url = "mirror://gnu/sed/sed-${version}.tar.xz";
9
+    sha256 = "0cznxw73fzv1n3nj2zsq6nf73rvsbxndp444xkpahdqvlzz0r6zp";
10
+  };
11
+
12
+  outputs = [ "out" "info" ];
13
+  configureFlags = [ "--program-prefix=g" ];
14
+
15
+  nativeBuildInputs = [ perl ];
16
+  preConfigure = "patchShebangs ./build-aux/help2man";
17
+
18
+  # Prevents attempts of running 'help2man' on cross-built binaries.
19
+  PERL = if stdenv.hostPlatform == stdenv.buildPlatform then null else "missing";
20
+
21
+  meta = {
22
+    homepage = "https://www.gnu.org/software/sed/";
23
+    description = "GNU sed, a batch stream editor";
24
+
25
+    longDescription = ''
26
+      Sed (stream editor) isn't really a true text editor or text
27
+      processor.  Instead, it is used to filter text, i.e., it takes
28
+      text input and performs some operation (or set of operations) on
29
+      it and outputs the modified text.  Sed is typically used for
30
+      extracting part of a file using pattern matching or substituting
31
+      multiple occurrences of a string within a file. This version installs sed
32
+      with a `g` program prefix, for use on macOS.
33
+    '';
34
+
35
+    license = stdenv.lib.licenses.gpl3Plus;
36
+
37
+    platforms = stdenv.lib.platforms.unix;
38
+    maintainers = [ ];
39
+  };
40
+}