summary refs log tree commit diff
path: root/pkgs/tools/misc/rcm
diff options
context:
space:
mode:
authorMichael Alyn Miller <malyn@strangeGizmo.com>2015-01-25 09:52:46 -0800
committerMichael Alyn Miller <malyn@strangeGizmo.com>2015-01-25 14:59:04 -0800
commit41de5f60cd7e007fede9bfa77e5557f79cf80b8d (patch)
tree9b814294672c3a3dfe9b4bdf501a8697ad6e935a /pkgs/tools/misc/rcm
parentf4c2ded737dcf4abe3170c0e1335b3e5e155c1ba (diff)
downloadnixpkgs-41de5f60cd7e007fede9bfa77e5557f79cf80b8d.tar
nixpkgs-41de5f60cd7e007fede9bfa77e5557f79cf80b8d.tar.gz
nixpkgs-41de5f60cd7e007fede9bfa77e5557f79cf80b8d.tar.bz2
nixpkgs-41de5f60cd7e007fede9bfa77e5557f79cf80b8d.tar.lz
nixpkgs-41de5f60cd7e007fede9bfa77e5557f79cf80b8d.tar.xz
nixpkgs-41de5f60cd7e007fede9bfa77e5557f79cf80b8d.tar.zst
nixpkgs-41de5f60cd7e007fede9bfa77e5557f79cf80b8d.zip
rcm: Use Nix store path for RCM_LIB
The shell scripts in the rcm package use a relative path in order to
find the rcm.sh library.  That works fine when rcm is installed with
nix-env -- ~/.nix-profile/share/rcm exists as expected -- but does not
work when installed via /etc/nixos/configuration.nix.  In the
system-wide case, /run/current-system/sw/share does not contain the rcm
directory.
Diffstat (limited to 'pkgs/tools/misc/rcm')
-rw-r--r--pkgs/tools/misc/rcm/default.nix17
-rw-r--r--pkgs/tools/misc/rcm/fix-rcmlib-path.patch68
2 files changed, 81 insertions, 4 deletions
diff --git a/pkgs/tools/misc/rcm/default.nix b/pkgs/tools/misc/rcm/default.nix
index 7fa9eb0e34f..59eccbb1ab6 100644
--- a/pkgs/tools/misc/rcm/default.nix
+++ b/pkgs/tools/misc/rcm/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation {
   name = "rcm-1.2.3";
 
   src = fetchurl {
@@ -8,9 +8,18 @@ stdenv.mkDerivation rec {
     sha256 = "0gwpclbc152jkclj3w83s2snx3dcgljwr75q1z8czl3yar7d8bsh";
   };
  
-  meta = {
+  patches = [ ./fix-rcmlib-path.patch ];
+
+  postPatch = ''
+    for f in bin/*.in; do
+      substituteInPlace $f --subst-var-by rcm $out
+    done
+  '';
+
+  meta = with stdenv.lib; {
     description = "Management Suite for Dotfiles";
     homepage = https://github.com/thoughtbot/rcm;
-    license = stdenv.lib.licenses.bsd3;
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ malyn ];
   };
-}
\ No newline at end of file
+}
diff --git a/pkgs/tools/misc/rcm/fix-rcmlib-path.patch b/pkgs/tools/misc/rcm/fix-rcmlib-path.patch
new file mode 100644
index 00000000000..45bd32a2d2b
--- /dev/null
+++ b/pkgs/tools/misc/rcm/fix-rcmlib-path.patch
@@ -0,0 +1,68 @@
+*** rcm-1.2.3/bin/lsrc.in.orig	2014-05-09 04:57:39.000000000 -0700
+--- rcm-1.2.3/bin/lsrc.in	2015-01-24 14:27:48.786595479 -0800
+***************
+*** 1,6 ****
+  #!@SHELL@
+  
+! : ${RCM_LIB:=$(dirname "$0")/../share/rcm}
+  . "$RCM_LIB/rcm.sh"
+  
+  pushdir() {
+--- 1,6 ----
+  #!@SHELL@
+  
+! RCM_LIB=@rcm@/share/rcm
+  . "$RCM_LIB/rcm.sh"
+  
+  pushdir() {
+*** rcm-1.2.3/bin/mkrc.in.orig	2014-05-09 04:57:39.000000000 -0700
+--- rcm-1.2.3/bin/mkrc.in	2015-01-24 14:27:48.786595479 -0800
+***************
+*** 1,6 ****
+  #!@SHELL@
+  
+! : ${RCM_LIB:=$(dirname "$0")/../share/rcm}
+  . "$RCM_LIB/rcm.sh"
+  
+  destination() {
+--- 1,6 ----
+  #!@SHELL@
+  
+! RCM_LIB=@rcm@/share/rcm
+  . "$RCM_LIB/rcm.sh"
+  
+  destination() {
+*** rcm-1.2.3/bin/rcdn.in.orig	2014-05-09 04:57:39.000000000 -0700
+--- rcm-1.2.3/bin/rcdn.in	2015-01-24 14:27:48.786595479 -0800
+***************
+*** 1,6 ****
+  #!@SHELL@
+  
+! : ${RCM_LIB:=$(dirname "$0")/../share/rcm}
+  . "$RCM_LIB/rcm.sh"
+  
+  remove_link() {
+--- 1,6 ----
+  #!@SHELL@
+  
+! RCM_LIB=@rcm@/share/rcm
+  . "$RCM_LIB/rcm.sh"
+  
+  remove_link() {
+*** rcm-1.2.3/bin/rcup.in.orig	2014-05-09 04:57:39.000000000 -0700
+--- rcm-1.2.3/bin/rcup.in	2015-01-24 14:27:48.786595479 -0800
+***************
+*** 1,6 ****
+  #!@SHELL@
+  
+! : ${RCM_LIB:=$(dirname "$0")/../share/rcm}
+  . "$RCM_LIB/rcm.sh"
+  
+  link_or_copy() {
+--- 1,6 ----
+  #!@SHELL@
+  
+! RCM_LIB=@rcm@/share/rcm
+  . "$RCM_LIB/rcm.sh"
+  
+  link_or_copy() {