From 62614a71d94f410deae5cf6b9506fb7da9f703e0 Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Tue, 7 May 2019 15:51:28 +0200 Subject: [PATCH] Move shellHook to respective Nix expressions --- nix/desktop/linux/base-image/default.nix | 53 ++++++++++-------- nix/desktop/linux/default.nix | 7 +-- nix/desktop/macos/base-image/default.nix | 53 ++++++++++-------- nix/desktop/windows/base-image/default.nix | 65 ++++++++++++---------- nix/desktop/windows/default.nix | 2 +- 5 files changed, 99 insertions(+), 81 deletions(-) diff --git a/nix/desktop/linux/base-image/default.nix b/nix/desktop/linux/base-image/default.nix index 96a5941135..8987b22af3 100644 --- a/nix/desktop/linux/base-image/default.nix +++ b/nix/desktop/linux/base-image/default.nix @@ -2,31 +2,38 @@ with pkgs; -stdenv.mkDerivation rec { - name = "StatusImAppImage"; - version = "20181208"; +let + package = stdenv.mkDerivation rec { + name = "StatusImAppImage"; + version = "20181208"; - src = - if stdenv.hostPlatform.system == "x86_64-linux" then - fetchurl { - url = "https://desktop-app-files.ams3.digitaloceanspaces.com/${name}_${version}.zip"; - sha256 = "15c6p5v6325kj2whc298dn1dyigi0yzk2nzh1y10d03aqr4j8mp5"; - } - else throw "${name} is not supported on ${stdenv.hostPlatform.system}"; + src = + if stdenv.hostPlatform.system == "x86_64-linux" then + fetchurl { + url = "https://desktop-app-files.ams3.digitaloceanspaces.com/${name}_${version}.zip"; + sha256 = "15c6p5v6325kj2whc298dn1dyigi0yzk2nzh1y10d03aqr4j8mp5"; + } + else throw "${name} is not supported on ${stdenv.hostPlatform.system}"; - nativeBuildInputs = [ unzip ]; + nativeBuildInputs = [ unzip ]; - phases = [ "unpackPhase" ]; - unpackPhase = '' - mkdir -p $out/src - unzip $src -d $out/src - ''; + phases = [ "unpackPhase" ]; + unpackPhase = '' + mkdir -p $out/src + unzip $src -d $out/src + ''; - meta = { - description = "A base image for Linux Status Desktop release distributions"; - homepage = https://desktop-app-files.ams3.digitaloceanspaces.com/; - license = stdenv.lib.licenses.gpl3; - maintainers = [ stdenv.lib.maintainers.pombeirp ]; - platforms = stdenv.lib.platforms.linux; + meta = { + description = "A base image for Linux Status Desktop release distributions"; + homepage = https://desktop-app-files.ams3.digitaloceanspaces.com/; + license = stdenv.lib.licenses.gpl3; + maintainers = [ stdenv.lib.maintainers.pombeirp ]; + platforms = stdenv.lib.platforms.linux; + }; }; -} + +in package // { + shellHook = '' + export STATUSREACT_LINUX_BASEIMAGE_PATH="${package}/src" + ''; +} \ No newline at end of file diff --git a/nix/desktop/linux/default.nix b/nix/desktop/linux/default.nix index a7db225cc8..c575e319b8 100644 --- a/nix/desktop/linux/default.nix +++ b/nix/desktop/linux/default.nix @@ -10,11 +10,8 @@ let appimagekit = callPackage ./appimagekit { }; linuxdeployqt = callPackage ./linuxdeployqt { inherit appimagekit; }; -in -{ +in { buildInputs = [ appimagekit linuxdeployqt patchelf baseImage ]; - shellHook = '' - export STATUSREACT_LINUX_BASEIMAGE_PATH="${baseImage}/src" - ''; + inherit (baseImage) shellHook; } diff --git a/nix/desktop/macos/base-image/default.nix b/nix/desktop/macos/base-image/default.nix index b9938b0792..9a8a357084 100644 --- a/nix/desktop/macos/base-image/default.nix +++ b/nix/desktop/macos/base-image/default.nix @@ -2,31 +2,38 @@ with pkgs; -stdenv.mkDerivation rec { - name = "StatusImAppBundle"; - version = "20181113"; +let + package = stdenv.mkDerivation rec { + name = "StatusImAppBundle"; + version = "20181113"; - src = - if stdenv.hostPlatform.system == "x86_64-darwin" then - fetchurl { - url = "https://desktop-app-files.ams3.digitaloceanspaces.com/Status_${version}.app.zip"; - sha256 = "0n8n6p60dwsr4q5v4vq8fffcy5qmqhp03yy95k66q4yic72r0hhz"; - } - else throw "${name} is not supported on ${stdenv.hostPlatform.system}"; + src = + if stdenv.hostPlatform.system == "x86_64-darwin" then + fetchurl { + url = "https://desktop-app-files.ams3.digitaloceanspaces.com/Status_${version}.app.zip"; + sha256 = "0n8n6p60dwsr4q5v4vq8fffcy5qmqhp03yy95k66q4yic72r0hhz"; + } + else throw "${name} is not supported on ${stdenv.hostPlatform.system}"; - nativeBuildInputs = [ unzip ]; + nativeBuildInputs = [ unzip ]; - phases = [ "unpackPhase" ]; - unpackPhase = '' - mkdir -p $out/src - unzip $src -d $out/src - ''; + phases = [ "unpackPhase" ]; + unpackPhase = '' + mkdir -p $out/src + unzip $src -d $out/src + ''; - meta = { - description = "A base image for macOS Status Desktop release distributions"; - homepage = https://desktop-app-files.ams3.digitaloceanspaces.com/; - license = stdenv.lib.licenses.gpl3; - maintainers = [ stdenv.lib.maintainers.pombeirp ]; - platforms = stdenv.lib.platforms.darwin; + meta = { + description = "A base image for macOS Status Desktop release distributions"; + homepage = https://desktop-app-files.ams3.digitaloceanspaces.com/; + license = stdenv.lib.licenses.gpl3; + maintainers = [ stdenv.lib.maintainers.pombeirp ]; + platforms = stdenv.lib.platforms.darwin; + }; }; -} + +in package // { + shellHook = '' + export STATUSREACT_MACOS_BASEIMAGE_PATH="${package}/src" + ''; +} \ No newline at end of file diff --git a/nix/desktop/windows/base-image/default.nix b/nix/desktop/windows/base-image/default.nix index 12fc9b55e2..d0dc0e67a4 100644 --- a/nix/desktop/windows/base-image/default.nix +++ b/nix/desktop/windows/base-image/default.nix @@ -4,39 +4,46 @@ with pkgs; assert stdenv.isLinux; -stdenv.mkDerivation rec { - name = "StatusIm-Windows-base-image"; - version = "20181113"; +let + package = stdenv.mkDerivation rec { + name = "StatusIm-Windows-base-image"; + version = "20181113"; - src = - if stdenv.hostPlatform.system == "x86_64-linux" then - fetchurl { - url = "https://desktop-app-files.ams3.digitaloceanspaces.com/${name}_${version}.zip"; - sha256 = "1wrxcss63zlwspmw76k549z72hcycxzd9iw4cdh98l4hs2ayzsk3"; - } - else throw "${name} is not supported on ${stdenv.hostPlatform.system}"; + src = + if stdenv.hostPlatform.system == "x86_64-linux" then + fetchurl { + url = "https://desktop-app-files.ams3.digitaloceanspaces.com/${name}_${version}.zip"; + sha256 = "1wrxcss63zlwspmw76k549z72hcycxzd9iw4cdh98l4hs2ayzsk3"; + } + else throw "${name} is not supported on ${stdenv.hostPlatform.system}"; - nativeBuildInputs = [ unzip ]; + nativeBuildInputs = [ unzip ]; - phases = [ "unpackPhase" "installPhase" ]; - unpackPhase = '' - mkdir -p $out/src - unzip $src -d $out/src - ''; - installPhase = '' - runHook preInstall + phases = [ "unpackPhase" "installPhase" ]; + unpackPhase = '' + mkdir -p $out/src + unzip $src -d $out/src + ''; + installPhase = '' + runHook preInstall - echo $out - ls $out -al + echo $out + ls $out -al - runHook postInstall - ''; + runHook postInstall + ''; - meta = { - description = "A base image for Windows Status Desktop release distributions"; - homepage = https://desktop-app-files.ams3.digitaloceanspaces.com/; - license = stdenv.lib.licenses.gpl3; - maintainers = [ stdenv.lib.maintainers.pombeirp ]; - platforms = stdenv.lib.platforms.linux; + meta = { + description = "A base image for Windows Status Desktop release distributions"; + homepage = https://desktop-app-files.ams3.digitaloceanspaces.com/; + license = stdenv.lib.licenses.gpl3; + maintainers = [ stdenv.lib.maintainers.pombeirp ]; + platforms = stdenv.lib.platforms.linux; + }; }; -} + +in package // { + shellHook = '' + export STATUSREACT_WINDOWS_BASEIMAGE_PATH="${package}/src" + ''; +} \ No newline at end of file diff --git a/nix/desktop/windows/default.nix b/nix/desktop/windows/default.nix index 0cdee1d057..6fb43b2eca 100644 --- a/nix/desktop/windows/default.nix +++ b/nix/desktop/windows/default.nix @@ -18,7 +18,7 @@ in ]; shellHook = '' - export STATUSREACT_WINDOWS_BASEIMAGE_PATH="${baseImage}/src" + ${baseImage.shellHook} unset QT_PATH ''; }