-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref: change the way dependencies are passed around
- Loading branch information
Showing
11 changed files
with
215 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{pkgs}: { | ||
tl-optional = pkgs.callPackage ./tl-optional {version = "1.1.0";}; | ||
tl-expected = pkgs.callPackage ./tl-expected {version = "1.1.0";}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
pkgs, | ||
version, | ||
}: | ||
pkgs.stdenv.mkDerivation { | ||
pname = "expected"; | ||
inherit version; | ||
|
||
src = pkgs.fetchFromGitHub { | ||
owner = "TartanLlama"; | ||
repo = "expected"; | ||
rev = "v${version}"; | ||
sha256 = "sha256-AuRU8VI5l7Th9fJ5jIc/6mPm0Vqbbt6rY8QCCNDOU50="; | ||
}; | ||
|
||
nativeBuildInputs = [pkgs.cmake]; | ||
|
||
strictDeps = true; | ||
|
||
postInstall = '' | ||
install -Dm644 ${./expected.pc} $out/lib/pkgconfig/expected.pc | ||
''; | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
pkgs, | ||
version, | ||
}: | ||
pkgs.stdenv.mkDerivation { | ||
pname = "optional"; | ||
inherit version; | ||
|
||
src = pkgs.fetchFromGitHub { | ||
owner = "TartanLlama"; | ||
repo = "optional"; | ||
rev = "v${version}"; | ||
sha256 = "sha256-WPTXTQmzJjAIJI1zM6svZZTO8gP/jt5xDHHRCCu9cmI="; | ||
}; | ||
|
||
strictDeps = true; | ||
|
||
nativeBuildInputs = [pkgs.cmake]; | ||
|
||
postInstall = '' | ||
install -Dm644 ${./optional.pc} $out/lib/pkgconfig/optional.pc | ||
''; | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
{ | ||
pkgs, | ||
lib, | ||
nativeDeps, | ||
buildDeps, | ||
rootDir, | ||
version, | ||
... | ||
}: | ||
let | ||
package = pkgs.callPackage ./package.nix { | ||
inherit nativeDeps buildDeps rootDir version; | ||
}; | ||
in | ||
{ | ||
packages.dev = package.dev; | ||
packages.default = package.out; | ||
pkgs, | ||
rootDir, | ||
version, | ||
... | ||
}: let | ||
package = pkgs.callPackage ./package.nix { | ||
inherit rootDir version; | ||
}; | ||
in { | ||
packages.dev = package.dev; | ||
packages.default = package.out; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,72 @@ | ||
{ | ||
pkgs, | ||
lib, | ||
nativeDeps, | ||
buildDeps, | ||
rootDir, | ||
version | ||
version, | ||
stdenv, | ||
meson, | ||
ninja, | ||
pkg-config, | ||
ctre, | ||
catch2_3, | ||
tl-optional, | ||
tl-expected, | ||
fmt, | ||
}: | ||
pkgs.stdenv.mkDerivation { | ||
pname = "dire"; | ||
inherit version; | ||
stdenv.mkDerivation { | ||
pname = "dire"; | ||
inherit version; | ||
|
||
outputs = ["out" "dev"]; | ||
outputs = ["out" "dev"]; | ||
|
||
strictDeps = true; | ||
enableParallelBuilding = true; | ||
strictDeps = true; | ||
enableParallelBuilding = true; | ||
|
||
dontUseCmakeConfigure = true; | ||
dontUseCmakeConfigure = true; | ||
|
||
nativeBuildInputs = nativeDeps; | ||
nativeBuildInputs = [ | ||
meson | ||
ninja | ||
pkg-config | ||
]; | ||
|
||
buildInputs = buildDeps; | ||
buildInputs = [ | ||
ctre | ||
catch2_3 | ||
fmt | ||
tl-optional | ||
tl-expected | ||
]; | ||
|
||
src = rootDir; | ||
src = rootDir; | ||
|
||
mesonBuildType = "release"; | ||
mesonBuildType = "release"; | ||
|
||
# We use mesonFlags, because mesonFlagsArray & the Nix ecosystem | ||
# don't have the capabilities to properly handle these flags | ||
# e.g. appending \ to the one-before-last argument making the command fail | ||
# or simply not supporting the `-DX=Y` option style | ||
mesonFlags = [ | ||
"--optimization=3" | ||
"-Db_lto_threads=8" | ||
"-Db_lto=true" | ||
"-Dstrip=true" | ||
]; | ||
# We use mesonFlags, because mesonFlagsArray & the Nix ecosystem | ||
# don't have the capabilities to properly handle these flags | ||
# e.g. appending \ to the one-before-last argument making the command fail | ||
# or simply not supporting the `-DX=Y` option style | ||
mesonFlags = [ | ||
"--optimization=3" | ||
"-Db_lto_threads=8" | ||
"-Db_lto=true" | ||
"-Dstrip=true" | ||
]; | ||
|
||
buildPhase = '' | ||
meson compile dire | ||
''; | ||
buildPhase = '' | ||
meson compile dire | ||
''; | ||
|
||
installPhase = '' | ||
mkdir -p {$dev,$out}/lib $dev/lib/pkgconfig $dev/include | ||
installPhase = '' | ||
mkdir -p {$dev,$out}/lib $dev/lib/pkgconfig $dev/include | ||
cp src/lib/libdire.a $out/lib | ||
cp src/lib/libdire.a $dev/lib | ||
cp src/lib/libdire.a $out/lib | ||
cp src/lib/libdire.a $dev/lib | ||
cp -r $src/src/lib/include/* $dev/include | ||
cp -r $src/src/lib/include/* $dev/include | ||
substitute \ | ||
${./dire.pc} \ | ||
$dev/lib/pkgconfig/dire.pc \ | ||
--subst-var out \ | ||
--subst-var version | ||
''; | ||
} | ||
substitute \ | ||
${./dire.pc} \ | ||
$dev/lib/pkgconfig/dire.pc \ | ||
--subst-var out \ | ||
--subst-var version | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,11 @@ | ||
{ | ||
pkgs, | ||
nativeDeps, | ||
buildDeps, | ||
preCommitCheck, | ||
... | ||
}: let | ||
shellDeps = [ | ||
pkgs.doxygen | ||
pkgs.cmake | ||
pkgs.graphviz | ||
]; | ||
|
||
baseShellAttrs = { | ||
hardeningDisable = ["all"]; | ||
|
||
packages = nativeDeps ++ shellDeps; | ||
|
||
buildInputs = buildDeps; | ||
}; | ||
|
||
gccStdenv = pkgs.gcc11Stdenv; | ||
|
||
clangStdenv = pkgs.llvmPackages_16.stdenv; | ||
|
||
ciGcc = pkgs.mkShell.override {stdenv = gccStdenv;} baseShellAttrs; | ||
|
||
ciClang = pkgs.mkShell.override {stdenv = clangStdenv;} baseShellAttrs; | ||
|
||
devPackages = | ||
[ | ||
pkgs.act | ||
] | ||
++ shellDeps; | ||
|
||
baseDevShellAttrs = | ||
baseShellAttrs | ||
// { | ||
inherit (preCommitCheck) shellHook; | ||
|
||
packages = baseShellAttrs.packages ++ devPackages; | ||
}; | ||
|
||
devClang = pkgs.mkShell.override {stdenv = clangStdenv;} (baseDevShellAttrs | ||
// { | ||
env = { | ||
CLANGD_PATH = "${pkgs.clang-tools_16}/bin/clangd"; | ||
ASAN_SYMBOLIZER_PATH = "${pkgs.llvmPackages_16.bintools-unwrapped}/bin/llvm-symbolizer"; | ||
}; | ||
}); | ||
|
||
devGcc = pkgs.mkShell.override {stdenv = gccStdenv;} baseDevShellAttrs; | ||
shells = pkgs.callPackage ./shells.nix {inherit preCommitCheck;}; | ||
in { | ||
devShells = { | ||
inherit ciGcc ciClang devGcc devClang; | ||
}; | ||
devShells = { | ||
inherit (shells) ciGcc ciClang devGcc devClang; | ||
}; | ||
} |
Oops, something went wrong.