summaryrefslogtreecommitdiffhomepage
path: root/flake.nix
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2023-06-09 16:48:04 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2023-06-09 16:48:04 -0400
commit77ca961d67f7dc1c6de5b5f89f7a55ff703bddde (patch)
tree945510aa8c5995b775e1a57101b4d5d11eb38f99 /flake.nix
parentnix dev + update direnv 2.2.1 => 2.3.0 (diff)
nix overlays introduced and tracked
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix57
1 files changed, 46 insertions, 11 deletions
diff --git a/flake.nix b/flake.nix
index 7a0b1b5..8fe746e 100644
--- a/flake.nix
+++ b/flake.nix
@@ -2,10 +2,16 @@
description = "a sisu like document parser search form";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; # "github:nixos/nixpkgs"; "github:NixOS/nixpkgs/nixpkgs-unstable"; "nixpkgs/nixos-unstable"; "nixpkgs/nixos-21.11";
inputs.flake-utils.url = "github:numtide/flake-utils";
+ #inputs.d-overlay = {
+ # url = "git+file:///home/ralph/grotto/repo/git.repo/projects/doc-reform/packages/nix-flakes/dlang/dlang-nix-flakes";
+ # inputs.nixpkgs.follows = "nixpkgs";
+ # flake = true;
+ #};
outputs = {
self,
nixpkgs,
flake-utils,
+ #d-overlay,
} @ inputs: let
pname = "spine_search";
version = "0.12.0";
@@ -13,12 +19,24 @@
devEnv = ./.envrc; # ./shell.nix; # ./default.nix;
supportedSystems = ["x86_64-linux"]; # [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
- nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); # nixpkgs instantiated for supported system types.
+ nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); # nixpkgs instantiated for supported system types
checkPhase = ''
runHook preCheck
dub test --combined --skip-registry=all
runHook postCheck
'';
+ localOverlay = (final: prev: {
+ ldc = prev.callPackage ./nix-overlays/ldc { };
+ dmd = prev.callPackage ./nix-overlays/dmd { };
+ dub = prev.callPackage ./nix-overlays/dub { }; # -> ?
+ #gdc = prev.callPackage ./nix-overlays/gdc { }; # empty
+ });
+ pkgsForSystem = system: import nixpkgs {
+ overlays = [
+ localOverlay
+ ];
+ inherit system;
+ };
installPhase = ''
runHook preInstall
mkdir -p $out/share/cgi-bin
@@ -30,9 +48,10 @@
'';
in {
packages = forAllSystems (system: let
+ pkgs-ovl = pkgsForSystem system;
pkgs = nixpkgsFor.${system};
in
- with pkgs; {
+ with pkgs-ovl; {
default = stdenv.mkDerivation {
inherit pname;
inherit version;
@@ -51,7 +70,7 @@
done
if [ "$DC" == "" ]; then exit "Error: could not find D compiler"; fi
echo "$DC_ used as D compiler to build $pname"
- dub build --compiler=$DC --build=$DC_ --combined --skip-registry=all
+ dub build --cache=local --compiler=$DC --build=$DC_ --combined --skip-registry=all
runHook postBuild
'';
inherit checkPhase;
@@ -70,7 +89,7 @@
nativeBuildInputs = [dub dmd gnumake];
buildPhase = ''
runHook preBuild
- dub build --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all
+ dub build --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all
runHook postBuild
'';
inherit checkPhase;
@@ -89,7 +108,7 @@
nativeBuildInputs = [dub ldc gnumake];
buildPhase = ''
runHook preBuild
- dub build --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all
+ dub build --cache=local --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all
runHook postBuild
'';
inherit checkPhase;
@@ -108,7 +127,7 @@
# nativeBuildInputs = [ dub gdc gnumake ];
# buildPhase = ''
# runHook preBuild
- # dub build --compiler=$(type -P gdc) --build=gdc --combined --skip-registry=all
+ # dub build --cache=local --compiler=$(type -P gdc) --build=gdc --combined --skip-registry=all
# runHook postBuild
# '';
# inherit checkPhase;
@@ -118,15 +137,16 @@
#vendorSha256 = "sha256-0Q00000000000000000000000000000000000000000=";
});
devShells = forAllSystems (system: let
+ pkgs-ovl = pkgsForSystem system;
pkgs = nixpkgsFor.${system};
shellHook = ''
- export DFLAGS="-O2 -inline -boundscheck=on -color=on"
+ export DFLAGS="-O2 -boundscheck=on"
export Date=`date "+%Y%m%d"`
## set local values in .envrc-local (or here if you must)
'';
in
- with pkgs; {
- devShell = mkShell {
+ with pkgs-ovl; {
+ dsh-overlay = mkShell {
name = "spine base dev shell";
inherit shell;
inherit devEnv;
@@ -135,13 +155,14 @@
packages = [
sqlite
dub
- dmd
+ #dmd
ldc
gnumake
];
inherit shellHook;
};
- devShell-sqlite = mkShell {
+ #dsh-d-overlay = d-overlay.devShells.${system}.default;
+ dsh-sqlite = mkShell {
name = "spine dev shell for latex & pdf output";
inherit shell;
inherit devEnv;
@@ -154,6 +175,20 @@
];
inherit shellHook;
};
+ dsh-nixpkgs-ldc-dub = mkShell {
+ name = "nixpkgs - ldc - dub";
+ inherit shell;
+ inherit devEnv;
+ #nativeBuildInputs = [ dub dmd ldc gdc gnumake ];
+ #buildInputs = [ sqlite ];
+ packages = with pkgs; [
+ ldc
+ dub
+ gnumake
+ sqlite
+ ];
+ inherit shellHook;
+ };
default = import ./shell.nix {inherit pkgs;};
});
};