buildDartApplication: Use package source builders and setup hooks instead of package overrides
This commit is contained in:
parent
cf55bc7300
commit
2bd3e5d779
14 changed files with 153 additions and 113 deletions
|
@ -44,7 +44,6 @@
|
||||||
|
|
||||||
, runtimeDependencies ? [ ]
|
, runtimeDependencies ? [ ]
|
||||||
, extraWrapProgramArgs ? ""
|
, extraWrapProgramArgs ? ""
|
||||||
, customPackageOverrides ? { }
|
|
||||||
, autoDepsList ? false
|
, autoDepsList ? false
|
||||||
, depsListFile ? null
|
, depsListFile ? null
|
||||||
, pubspecLock
|
, pubspecLock
|
||||||
|
@ -143,25 +142,7 @@ let
|
||||||
|
|
||||||
meta = (args.meta or { }) // { platforms = args.meta.platforms or dart.meta.platforms; };
|
meta = (args.meta or { }) // { platforms = args.meta.platforms or dart.meta.platforms; };
|
||||||
});
|
});
|
||||||
|
|
||||||
packageOverrideRepository = (callPackage ../../../development/compilers/dart/package-overrides { }) // customPackageOverrides;
|
|
||||||
productPackages = if depsList == null then [ ] else depsList;
|
|
||||||
in
|
in
|
||||||
assert !(builtins.isString dartOutputType && dartOutputType != "") ->
|
assert !(builtins.isString dartOutputType && dartOutputType != "") ->
|
||||||
throw "dartOutputType must be a non-empty string";
|
throw "dartOutputType must be a non-empty string";
|
||||||
builtins.foldl'
|
|
||||||
(prev: package:
|
|
||||||
if packageOverrideRepository ? ${package.name}
|
|
||||||
then
|
|
||||||
prev.overrideAttrs
|
|
||||||
(packageOverrideRepository.${package.name} {
|
|
||||||
inherit (package)
|
|
||||||
name
|
|
||||||
version
|
|
||||||
kind
|
|
||||||
source
|
|
||||||
dependencies;
|
|
||||||
})
|
|
||||||
else prev)
|
|
||||||
baseDerivation
|
baseDerivation
|
||||||
productPackages
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{ lib
|
{ lib
|
||||||
|
, callPackage
|
||||||
, fetchurl
|
, fetchurl
|
||||||
, fetchgit
|
, fetchgit
|
||||||
, runCommand
|
, runCommand
|
||||||
|
@ -22,6 +23,14 @@
|
||||||
# Functions to generate SDK package sources.
|
# Functions to generate SDK package sources.
|
||||||
# The function names should match the SDK names, and the package name is given as an argument.
|
# The function names should match the SDK names, and the package name is given as an argument.
|
||||||
, sdkSourceBuilders ? { }
|
, sdkSourceBuilders ? { }
|
||||||
|
|
||||||
|
# Functions that create custom package source derivations.
|
||||||
|
#
|
||||||
|
# The function names should match the package names, and the package version,
|
||||||
|
# source, and source files are given in an attribute set argument.
|
||||||
|
#
|
||||||
|
# The passthru of the source derivation should be propagated.
|
||||||
|
, customSourceBuilders ? { }
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -77,20 +86,22 @@ let
|
||||||
addDependencySourceUtils = dependencySource: details: dependencySource.overrideAttrs ({ passthru, ... }: {
|
addDependencySourceUtils = dependencySource: details: dependencySource.overrideAttrs ({ passthru, ... }: {
|
||||||
passthru = passthru // {
|
passthru = passthru // {
|
||||||
inherit (details) version;
|
inherit (details) version;
|
||||||
packagePath = dependencySource + "/${dependencySource.packageRoot}";
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sourceBuilders = callPackage ../../../development/compilers/dart/package-source-builders { } // customSourceBuilders;
|
||||||
|
|
||||||
dependencySources = lib.filterAttrs (name: src: src != null) (builtins.mapAttrs
|
dependencySources = lib.filterAttrs (name: src: src != null) (builtins.mapAttrs
|
||||||
(name: details:
|
(name: details:
|
||||||
addDependencySourceUtils
|
(sourceBuilders.${name} or ({ src, ... }: src)) {
|
||||||
(({
|
inherit (details) version source;
|
||||||
|
src = ((addDependencySourceUtils (({
|
||||||
"hosted" = mkHostedDependencySource;
|
"hosted" = mkHostedDependencySource;
|
||||||
"git" = mkGitDependencySource;
|
"git" = mkGitDependencySource;
|
||||||
"path" = mkPathDependencySource;
|
"path" = mkPathDependencySource;
|
||||||
"sdk" = mkSdkDependencySource;
|
"sdk" = mkSdkDependencySource;
|
||||||
}.${details.source} name) details)
|
}.${details.source} name) details)) details);
|
||||||
details)
|
})
|
||||||
pubspecLock.packages);
|
pubspecLock.packages);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
{ lib
|
|
||||||
, llvmPackages
|
|
||||||
}:
|
|
||||||
|
|
||||||
{ ... }:
|
|
||||||
|
|
||||||
{ FFIGEN_COMPILER_OPTS ? ""
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
|
||||||
FFIGEN_LIBCLANG = lib.getLib llvmPackages.libclang;
|
|
||||||
FFIGEN_COMPILER_OPTS = "-I${FFIGEN_COMPILER_OPTS} ${llvmPackages.clang}/resource-root/include -I${lib.makeSearchPathOutput "dev" "include" [ llvmPackages.clang.libc_dev ]}";
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
{ lib
|
|
||||||
, pkg-config
|
|
||||||
, libsecret
|
|
||||||
, jsoncpp
|
|
||||||
}:
|
|
||||||
|
|
||||||
{ ... }:
|
|
||||||
|
|
||||||
{ nativeBuildInputs ? [ ]
|
|
||||||
, buildInputs ? [ ]
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
|
||||||
nativeBuildInputs = [ pkg-config ] ++ nativeBuildInputs;
|
|
||||||
buildInputs = [ libsecret jsoncpp ] ++ buildInputs;
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
{ lib
|
|
||||||
, cairo
|
|
||||||
, fribidi
|
|
||||||
}:
|
|
||||||
|
|
||||||
{ ... }:
|
|
||||||
|
|
||||||
{ CFLAGS ? ""
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
|
||||||
CFLAGS = "${CFLAGS} -isystem ${lib.getOutput "dev" fribidi}/include/fribidi -isystem ${lib.getOutput "dev" cairo}/include";
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
{ openssl
|
|
||||||
}:
|
|
||||||
|
|
||||||
{ ... }:
|
|
||||||
|
|
||||||
{ runtimeDependencies ? [ ]
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
|
||||||
runtimeDependencies = runtimeDependencies ++ [ openssl ];
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
{ olm
|
|
||||||
}:
|
|
||||||
|
|
||||||
{ ... }:
|
|
||||||
|
|
||||||
{ runtimeDependencies ? [ ]
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
|
||||||
runtimeDependencies = runtimeDependencies ++ [ olm ];
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
{ libayatana-appindicator
|
|
||||||
}:
|
|
||||||
|
|
||||||
{ ... }:
|
|
||||||
|
|
||||||
{ preBuild ? ""
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
|
||||||
preBuild = preBuild + ''
|
|
||||||
# $PUB_CACHE/hosted is a symlink to a store path.
|
|
||||||
mv $PUB_CACHE/hosted $PUB_CACHE/hosted_copy
|
|
||||||
cp -HR $PUB_CACHE/hosted_copy $PUB_CACHE/hosted
|
|
||||||
substituteInPlace $PUB_CACHE/hosted/pub.dev/system_tray-*/linux/tray.cc \
|
|
||||||
--replace "libappindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -1,7 +1,6 @@
|
||||||
{ callPackage }:
|
{ callPackage }:
|
||||||
|
|
||||||
{
|
{
|
||||||
ffigen = callPackage ./ffigen { };
|
|
||||||
flutter_secure_storage_linux = callPackage ./flutter-secure-storage-linux { };
|
flutter_secure_storage_linux = callPackage ./flutter-secure-storage-linux { };
|
||||||
handy_window = callPackage ./handy-window { };
|
handy_window = callPackage ./handy-window { };
|
||||||
matrix = callPackage ./matrix { };
|
matrix = callPackage ./matrix { };
|
|
@ -0,0 +1,23 @@
|
||||||
|
{ stdenv
|
||||||
|
, libsecret
|
||||||
|
, jsoncpp
|
||||||
|
}:
|
||||||
|
|
||||||
|
{ version, src, ... }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
pname = "flutter-secure-storage-linux";
|
||||||
|
inherit version src;
|
||||||
|
inherit (src) passthru;
|
||||||
|
|
||||||
|
propagatedBuildInputs = [ libsecret jsoncpp ];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p "$out"
|
||||||
|
ln -s '${src}'/* "$out"
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
{ stdenv
|
||||||
|
, lib
|
||||||
|
, writeScript
|
||||||
|
, cairo
|
||||||
|
, fribidi
|
||||||
|
}:
|
||||||
|
|
||||||
|
{ version, src, ... }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "handy-window";
|
||||||
|
inherit version src;
|
||||||
|
inherit (src) passthru;
|
||||||
|
|
||||||
|
setupHook = writeScript "${pname}-setup-hook" ''
|
||||||
|
handyWindowConfigureHook() {
|
||||||
|
export CFLAGS="$CFLAGS -isystem ${lib.getDev fribidi}/include/fribidi -isystem ${lib.getDev cairo}/include"
|
||||||
|
}
|
||||||
|
|
||||||
|
postConfigureHooks+=(handyWindowConfigureHook)
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p "$out"
|
||||||
|
ln -s '${src}'/* "$out"
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
{ stdenv
|
||||||
|
, lib
|
||||||
|
, writeScript
|
||||||
|
, openssl
|
||||||
|
}:
|
||||||
|
|
||||||
|
{ version, src, ... }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "matrix";
|
||||||
|
inherit version src;
|
||||||
|
inherit (src) passthru;
|
||||||
|
|
||||||
|
setupHook = writeScript "${pname}-setup-hook" ''
|
||||||
|
matrixFixupHook() {
|
||||||
|
runtimeDependencies+=('${lib.getLib openssl}')
|
||||||
|
}
|
||||||
|
|
||||||
|
preFixupHooks+=(matrixFixupHook)
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p "$out"
|
||||||
|
ln -s '${src}'/* "$out"
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
{ stdenv
|
||||||
|
, lib
|
||||||
|
, writeScript
|
||||||
|
, olm
|
||||||
|
}:
|
||||||
|
|
||||||
|
{ version, src, ... }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "olm";
|
||||||
|
inherit version src;
|
||||||
|
inherit (src) passthru;
|
||||||
|
|
||||||
|
setupHook = writeScript "${pname}-setup-hook" ''
|
||||||
|
olmFixupHook() {
|
||||||
|
runtimeDependencies+=('${lib.getLib olm}')
|
||||||
|
}
|
||||||
|
|
||||||
|
preFixupHooks+=(olmFixupHook)
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p "$out"
|
||||||
|
ln -s '${src}'/* "$out"
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
{ stdenv
|
||||||
|
, libayatana-appindicator
|
||||||
|
}:
|
||||||
|
|
||||||
|
{ version, src, ... }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "system-tray";
|
||||||
|
inherit version src;
|
||||||
|
inherit (src) passthru;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p "$out"
|
||||||
|
cp -r '${src}'/* "$out"
|
||||||
|
substituteInPlace "$out/linux/tray.cc" \
|
||||||
|
--replace "libappindicator3.so.1" "${libayatana-appindicator}/lib/libayatana-appindicator3.so.1"
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue