summaryrefslogtreecommitdiffhomepage
path: root/flake.nix
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2024-04-24 12:11:50 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2024-04-24 12:11:50 -0400
commit7591439b407b39ecfc37b667bc3d54192aa4b9ef (patch)
treee95e3977686f54735fcd8707da815ead918e703d /flake.nix
ldc-1.37.0 ... dub 1.36.0
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix170
1 files changed, 170 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..a085a14
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,170 @@
+{
+ description = "build dummy D package using dub build tool";
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+ inputs.flake-utils.url = "github:numtide/flake-utils";
+ outputs = {
+ self,
+ nixpkgs,
+ flake-utils,
+ } @ inputs: let
+ pname = "dummy";
+ version = "0.1.0";
+ shell = ./shell.nix;
+ devEnv = ./nixDevEnv.sh; # ./.envrc;
+ 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;});
+ checkPhase = ''
+ runHook preCheck
+ #dub test --combined --skip-registry=all
+ runHook postCheck
+ '';
+ localOverlay = (final: prev: {
+ ldc = prev.callPackage ./nix-overlays/ldc { }; # -> ok 1.37.0
+ dmd = prev.callPackage ./nix-overlays/dmd { }; # -> ok 2.106.1
+ dub = prev.callPackage ./nix-overlays/dub { }; # -> ? 1.36.0
+ dtools = prev.callPackage ./nix-overlays/dtools { }; # -> ok 2.103.1
+ #gdc = prev.callPackage ./nix-overlays/gdc { }; # empty
+ });
+ pkgsForSystem = system: import nixpkgs {
+ overlays = [
+ localOverlay
+ ];
+ inherit system;
+ };
+ installPhase = ''
+ runHook preInstall
+ mkdir -p $out/bin
+ install -m755 ./bin/dummy $out/bin/dummy
+ runHook postInstall
+ '';
+ postInstall = ''
+ echo `ls -la $out/bin/dummy`
+ $out/bin/dummy -v
+ '';
+ in {
+ packages = forAllSystems (system: let
+ pkgs-ovl = pkgsForSystem system;
+ pkgs-nix = nixpkgsFor.${system};
+ in
+ with pkgs-ovl; {
+ default = tilix;
+ check-tilix = tilix;
+ check-local-dir-build = stdenv.mkDerivation {
+ inherit pname;
+ inherit version;
+ meta.mainProgram = "dummy";
+ executable = true;
+ src = self;
+ inherit shell;
+ inherit devEnv;
+ buildInputs = [sqlite];
+ nativeBuildInputs = [dub ldc gnumake]; # [ dub dmd ]; [ dub ldc ]; [ dub gdc ];
+ buildPhase = ''
+ runHook preBuild
+ for DC_ in dmd ldmd2 ldc2 gdc gdmd; do
+ echo "- check for D compiler $DC_"
+ DC=$(type -P $DC_ || echo "")
+ if [ ! "$DC" == "" ]; then break; fi
+ done
+ if [ "$DC" == "" ]; then exit "Error: could not find D compiler"; fi
+ echo "$DC_ used as D compiler to build $pname"
+ dub build --cache=local --compiler=$DC --build=$DC_ --combined --skip-registry=all
+ runHook postBuild
+ '';
+ inherit checkPhase;
+ inherit installPhase;
+ inherit postInstall;
+ };
+ });
+ devShells = forAllSystems (system: let
+ pkgs-ovl = pkgsForSystem system;
+ pkgs-nix = nixpkgsFor.${system};
+ shellHook = ''
+ '';
+ in
+ with pkgs-ovl; {
+ dsh-overlay-dtools = mkShell {
+ name = "overlay - ldc-1.37.0 - dub-1.36.0 - dtools-2.103.1";
+ inherit shell;
+ inherit devEnv;
+ packages = [
+ gnumake
+ ldc
+ dub
+ dtools
+ ];
+ inherit shellHook;
+ };
+ dsh-overlay-ldc-dub = mkShell {
+ name = "overlay - ldc-1.37.0 - dub-1.36.0";
+ inherit shell;
+ inherit devEnv;
+ packages = [
+ gnumake
+ ldc
+ dub
+ ];
+ inherit shellHook;
+ };
+ dsh-overlay-dmd-dub = mkShell {
+ name = "overlay - dmd-2.106.1 - dub-1.36.0 - broken";
+ inherit shell;
+ inherit devEnv;
+ packages = [
+ gnumake
+ dmd
+ dub
+ ];
+ inherit shellHook;
+ };
+ dsh-overlay-dtest-tilix = mkShell {
+ name = "overlay - ldc-1.37.0 - dub-1.36.0 - tilix - gtkd";
+ inherit shell;
+ inherit devEnv;
+ packages = [
+ gnumake
+ ldc
+ gtkd
+ tilix
+ dub
+ ];
+ inherit shellHook;
+ };
+ #dsh-overlay-gdc = mkShell {
+ # name = "dub + gdc dev shell";
+ # inherit shell;
+ # inherit devEnv;
+ # packages = [
+ # gnumake
+ # gdc
+ # dub
+ # ];
+ # inherit shellHook;
+ #};
+ dsh-nixpkgs-ldc-dub = mkShell {
+ name = "nixpkgs - ldc - dub";
+ inherit shell;
+ inherit devEnv;
+ packages = with pkgs-nix; [
+ ldc
+ dub
+ gnumake
+ ];
+ inherit shellHook;
+ };
+ dsh-nixpkgs-dmd-dub = mkShell {
+ name = "nixpkgs - ldc - dub";
+ inherit shell;
+ inherit devEnv;
+ packages = with pkgs-nix; [
+ dmd
+ dub
+ gnumake
+ ];
+ inherit shellHook;
+ };
+ default = import ./shell.nix {inherit pkgs-nix;};
+ });
+ };
+}