From aa1a40b63d30e994232bcf69fbadb8873743a1c9 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Tue, 26 Apr 2016 15:27:48 +0300 Subject: [PATCH] dwarf-therapist: add version to derivation, use symlinkJoin --- .../dwarf-therapist/default.nix | 6 ++--- .../dwarf-therapist/wrapper.nix | 22 +++++-------------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix b/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix index 6c094ff20f81..37eab6d077a3 100644 --- a/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix +++ b/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix @@ -1,10 +1,8 @@ { stdenv, fetchFromGitHub, coreutils, qtbase, qtdeclarative, qmakeHook, texlive }: -let - version = "37.0.0"; -in -stdenv.mkDerivation { +stdenv.mkDerivation rec { name = "dwarf-therapist-original-${version}"; + version = "37.0.0"; src = fetchFromGitHub { owner = "splintermind"; diff --git a/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix b/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix index a16c1284a672..cbc8d31e6750 100644 --- a/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix +++ b/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix @@ -1,4 +1,4 @@ -{ buildEnv, lib, dwarf-therapist-original, dwarf-fortress-original, makeWrapper }: +{ symlinkJoin, lib, dwarf-therapist-original, dwarf-fortress-original, makeWrapper }: let df = dwarf-fortress-original; @@ -6,8 +6,8 @@ let inifile = "linux/v0${df.baseVersion}.${df.patchVersion}.ini"; dfHashFile = "${df}/hash.md5"; -in buildEnv { - name = "dwarf-therapist-${lib.getVersion dt}"; +in symlinkJoin { + name = "dwarf-therapist-${dt.version}"; paths = [ dt ]; @@ -16,22 +16,10 @@ in buildEnv { postBuild = '' # DwarfTherapist assumes it's run in $out/share/dwarftherapist and # therefore uses many relative paths. - rm $out/bin - mkdir $out/bin - makeWrapper ${dt}/bin/DwarfTherapist $out/bin/DwarfTherapist \ + wrapProgram $out/bin/DwarfTherapist \ --run "cd $out/share/dwarftherapist" - # Fix checksum of memory access directives. We really need #4621 fixed! - recreate_dir() { - rm "$out/$1" - mkdir -p "$out/$1" - for i in "${dt}/$1/"*; do - ln -s "$i" "$out/$1" - done - } - - recreate_dir share - recreate_dir share/dwarftherapist + rm -rf $out/share/dwarftherapist/memory_layouts/linux mkdir -p $out/share/dwarftherapist/memory_layouts/linux origmd5=$(cat "${dfHashFile}.orig" | cut -c1-8) patchedmd5=$(cat "${dfHashFile}" | cut -c1-8)