summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2018-08-01 16:09:55 +0200
committerxeji <36407913+xeji@users.noreply.github.com>2018-08-01 16:09:55 +0200
commit134c5cc8dbf317584b2e53273e4bacd59e20b9f7 (patch)
tree4c05759b191a6dd988825d178c38a062cc3bd24d /pkgs
parent2b75a7266c41d1b22f6296ac31fb3dc8d42eb33a (diff)
downloadnixpkgs-134c5cc8dbf317584b2e53273e4bacd59e20b9f7.tar
nixpkgs-134c5cc8dbf317584b2e53273e4bacd59e20b9f7.tar.gz
nixpkgs-134c5cc8dbf317584b2e53273e4bacd59e20b9f7.tar.bz2
nixpkgs-134c5cc8dbf317584b2e53273e4bacd59e20b9f7.tar.lz
nixpkgs-134c5cc8dbf317584b2e53273e4bacd59e20b9f7.tar.xz
nixpkgs-134c5cc8dbf317584b2e53273e4bacd59e20b9f7.tar.zst
nixpkgs-134c5cc8dbf317584b2e53273e4bacd59e20b9f7.zip
termite: factor wrapper out into its own file (#43691)
Until now it's impossible to override the attrs of the actual build
instruction for the `termite` package like this:

```
termite.overrideAttrs (_: {
  # ...
})
```

This issue occurs since the `termite/default.nix` expressions returns
the `symlinkJoin` expression when I override termite (e.g. to provide a
config file).

I recently patched termite and wanted to apply this patch to my local
termite installation in my system config which is impossible this, so
splitting the wrapper and the build instruction into their own files
makes this way easier to maintian.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/misc/termite/default.nix71
-rw-r--r--pkgs/applications/misc/termite/wrapper.nix15
-rw-r--r--pkgs/top-level/all-packages.nix4
3 files changed, 47 insertions, 43 deletions
diff --git a/pkgs/applications/misc/termite/default.nix b/pkgs/applications/misc/termite/default.nix
index 560dff59427..abcd5eb4288 100644
--- a/pkgs/applications/misc/termite/default.nix
+++ b/pkgs/applications/misc/termite/default.nix
@@ -1,55 +1,42 @@
-{ stdenv, fetchFromGitHub, lib, pkgconfig, vte, gtk3, ncurses, makeWrapper, wrapGAppsHook, symlinkJoin
-, configFile ? null
-}:
+{ stdenv, fetchFromGitHub, pkgconfig, vte, gtk3, ncurses, wrapGAppsHook }:
 
-let
+stdenv.mkDerivation rec {
+  name = "termite-${version}";
   version = "13";
-  termite = stdenv.mkDerivation {
-    name = "termite-${version}";
 
-    src = fetchFromGitHub {
-      owner = "thestinger";
-      repo = "termite";
-      rev = "v${version}";
-      sha256 = "02cn70ygl93ghhkhs3xdxn5b1yadc255v3yp8cmhhyzsv5027hvj";
-      fetchSubmodules = true;
-    };
+  src = fetchFromGitHub {
+    owner = "thestinger";
+    repo = "termite";
+    rev = "v${version}";
+    sha256 = "02cn70ygl93ghhkhs3xdxn5b1yadc255v3yp8cmhhyzsv5027hvj";
+    fetchSubmodules = true;
+  };
 
-    # https://github.com/thestinger/termite/pull/516
-    patches = [ ./url_regexp_trailing.patch ./add_errno_header.patch
-                ] ++ lib.optional stdenv.isDarwin ./remove_ldflags_macos.patch;
+  # https://github.com/thestinger/termite/pull/516
+  patches = [ ./url_regexp_trailing.patch ./add_errno_header.patch
+              ] ++ stdenv.lib.optional stdenv.isDarwin ./remove_ldflags_macos.patch;
 
-    makeFlags = [ "VERSION=v${version}" "PREFIX=" "DESTDIR=$(out)" ];
+  makeFlags = [ "VERSION=v${version}" "PREFIX=" "DESTDIR=$(out)" ];
 
-    buildInputs = [ vte gtk3 ncurses ];
+  buildInputs = [ vte gtk3 ncurses ];
 
-    nativeBuildInputs = [ wrapGAppsHook pkgconfig ];
+  nativeBuildInputs = [ wrapGAppsHook pkgconfig ];
 
-    outputs = [ "out" "terminfo" ];
+  outputs = [ "out" "terminfo" ];
 
-    postInstall = ''
-      mkdir -p $terminfo/share
-      mv $out/share/terminfo $terminfo/share/terminfo
+  postInstall = ''
+    mkdir -p $terminfo/share
+    mv $out/share/terminfo $terminfo/share/terminfo
 
-      mkdir -p $out/nix-support
-      echo "$terminfo" >> $out/nix-support/propagated-user-env-packages
-    '';
+    mkdir -p $out/nix-support
+    echo "$terminfo" >> $out/nix-support/propagated-user-env-packages
+  '';
 
-    meta = with stdenv.lib; {
-      description = "A simple VTE-based terminal";
-      license = licenses.lgpl2Plus;
-      homepage = https://github.com/thestinger/termite/;
-      maintainers = with maintainers; [ koral garbas ];
-      platforms = platforms.all;
-    };
+  meta = with stdenv.lib; {
+    description = "A simple VTE-based terminal";
+    license = licenses.lgpl2Plus;
+    homepage = https://github.com/thestinger/termite/;
+    maintainers = with maintainers; [ koral garbas ];
+    platforms = platforms.all;
   };
-in if configFile == null then termite else symlinkJoin {
-  name = "termite-with-config-${version}";
-  paths = [ termite ];
-  nativeBuildInputs = [ makeWrapper ];
-  postBuild = ''
-    wrapProgram $out/bin/termite \
-      --add-flags "--config ${configFile}"
-  '';
-  passthru.terminfo = termite.terminfo;
 }
diff --git a/pkgs/applications/misc/termite/wrapper.nix b/pkgs/applications/misc/termite/wrapper.nix
new file mode 100644
index 00000000000..0b12a905360
--- /dev/null
+++ b/pkgs/applications/misc/termite/wrapper.nix
@@ -0,0 +1,15 @@
+{  makeWrapper, wrapGAppsHook, symlinkJoin, configFile ? null, termite }:
+
+if configFile == null then termite else symlinkJoin {
+  name = "termite-with-config-${termite.version}";
+
+  paths = [ termite ];
+  nativeBuildInputs = [ makeWrapper ];
+
+  postBuild = ''
+    wrapProgram $out/bin/termite \
+      --add-flags "--config ${configFile}"
+  '';
+
+  passthru.terminfo = termite.terminfo;
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 7d2694238d8..1623c1262d6 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -18549,10 +18549,12 @@ with pkgs;
     vte = gnome3.vte;
   };
 
-  termite = callPackage ../applications/misc/termite {
+  termite-unwrapped = callPackage ../applications/misc/termite {
     vte = gnome3.vte-ng;
   };
 
+  termite = callPackage ../applications/misc/termite/wrapper.nix { termite = termite-unwrapped; };
+
   termtosvg = callPackage ../tools/misc/termtosvg { };
 
   tesseract = callPackage ../applications/graphics/tesseract { };