From 2a874332f535d13ae0dbe3ced6cd5cd55ae74f93 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 8 Mar 2024 20:52:36 -0500 Subject: nix flake & env upkeep --- org/config_env.org | 13 +++++- org/config_nix.org | 118 ++++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 97 insertions(+), 34 deletions(-) (limited to 'org') diff --git a/org/config_env.org b/org/config_env.org index ffd497a..79dfb02 100644 --- a/org/config_env.org +++ b/org/config_env.org @@ -71,7 +71,7 @@ watch_file .envrc-nix PATH_add result/bin use flake . #use flake .#default -echo " +echo ' - consider running: ❯❯ nix flake show ❯❯ nix flake update && nix flake check && nix flake show @@ -79,13 +79,22 @@ echo " - for a dev shell: ❯❯ nix develop ❯❯ nix develop ".#" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-nixpkgs-dmd-dub" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-overlay-dmd-dub" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-nixpkgs-ldc-dub" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-overlay-ldc-dub" --print-build-logs -c zsh + ❯❯ nix flake show - to build project: + ❯❯ nix build --print-build-logs + ❯❯ nix build ".#" --print-build-logs + ❯❯ nix build ".#spine-nixpkgs-dmd" --print-build-logs + ❯❯ nix build ".#spine-overlay-dmd" --print-build-logs ❯❯ nix build ".#spine-nixpkgs-ldc" --print-build-logs ❯❯ nix build ".#spine-overlay-ldc" --print-build-logs - (see nix other/additional build options): ❯❯ nix flake show -" +' #+END_SRC *** 3.0.0 diff --git a/org/config_nix.org b/org/config_nix.org index df7a3d0..f1073bd 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -23,7 +23,7 @@ #+BEGIN_SRC nix { description = "a sisu like parser & document generator"; - inputs.nixpkgs.url = "<>"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; inputs.flake-utils.url = "github:numtide/flake-utils"; outputs = { self, @@ -31,7 +31,7 @@ flake-utils, } @ inputs: let pname = "spine"; - version = "<>"; + version = "0.14.0"; shell = ./shell.nix; # ./default.nix; devEnv = ./nixDevEnv.sh; # ./shell.nix; # ./default.nix; # ./.envrc; supportedSystems = ["x86_64-linux"]; # [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; @@ -70,7 +70,7 @@ in { packages = forAllSystems (system: let pkgs-ovl = pkgsForSystem system; - pkgs = nixpkgsFor.${system}; + pkgs-nix = nixpkgsFor.${system}; in with pkgs-ovl; { default = stdenv.mkDerivation { @@ -82,7 +82,7 @@ inherit shell; inherit devEnv; buildInputs = [sqlite]; - nativeBuildInputs = [dub ldc gnumake]; # [ dub dmd ]; [ dub ldc ]; [ dub gdc ]; + nativeBuildInputs = [dub ldc gnumake]; buildPhase = '' runHook preBuild for DC_ in dmd ldmd2 ldc2 gdc gdmd; do @@ -92,7 +92,10 @@ 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 + buildCMD="dub build --cache=local --compiler=$DC --build=$DC_ --combined --skip-registry=all" + echo $buildCMD + $buildCMD + echo $buildCMD runHook postBuild ''; inherit preBuild; @@ -100,7 +103,7 @@ inherit installPhase; inherit postInstall; }; - spine-overlay-dmd = stdenv.mkDerivation { + spine-nixpkgs-dmd = stdenv.mkDerivation { inherit pname; inherit version; meta.mainProgram = "spine-dmd"; @@ -108,11 +111,14 @@ src = self; inherit shell; inherit devEnv; - buildInputs = [sqlite]; - nativeBuildInputs = [dub dmd gnumake]; + buildInputs = with pkgs-nix; [sqlite]; + nativeBuildInputs = with pkgs-nix; [dub dmd gnumake]; buildPhase = '' runHook preBuild - dub build --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all + buildCMD="dub build --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all" + echo $buildCMD + $buildCMD + echo $buildCMD runHook postBuild ''; inherit preBuild; @@ -120,7 +126,7 @@ inherit installPhase; inherit postInstall; }; - spine-overlay-ldc = stdenv.mkDerivation { + spine-nixpkgs-ldc = stdenv.mkDerivation { inherit pname; inherit version; meta.mainProgram = "spine-ldc"; @@ -128,11 +134,37 @@ src = self; inherit shell; inherit devEnv; + buildInputs = with pkgs-nix; [sqlite]; + nativeBuildInputs = with pkgs-nix; [dub ldc gnumake]; + buildPhase = '' + runHook preBuild + buildCMD="dub build --cache=local --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all" + echo $buildCMD + $buildCMD + echo $buildCMD + runHook postBuild + ''; + inherit preBuild; + inherit checkPhase; + inherit installPhase; + inherit postInstall; + }; + spine-overlay-dmd = stdenv.mkDerivation { + inherit pname; + inherit version; + meta.mainProgram = "spine-dmd"; + executable = true; + src = self; + inherit shell; + inherit devEnv; buildInputs = [sqlite]; - nativeBuildInputs = [dub ldc gnumake]; + nativeBuildInputs = [dub dmd gnumake]; buildPhase = '' runHook preBuild - dub build --cache=local --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all + buildCMD="dub build --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all" + echo $buildCMD + $buildCMD + echo $buildCMD runHook postBuild ''; inherit preBuild; @@ -140,7 +172,7 @@ inherit installPhase; inherit postInstall; }; - spine-nixpkgs-ldc = stdenv.mkDerivation { + spine-overlay-ldc = stdenv.mkDerivation { inherit pname; inherit version; meta.mainProgram = "spine-ldc"; @@ -148,11 +180,14 @@ src = self; inherit shell; inherit devEnv; - buildInputs = with pkgs; [sqlite]; - nativeBuildInputs = with pkgs; [dub ldc gnumake]; + buildInputs = [sqlite]; + nativeBuildInputs = [dub ldc gnumake]; buildPhase = '' runHook preBuild - dub build --cache=local --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all + buildCMD="dub build --cache=local --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all" + echo $buildCMD + $buildCMD + echo $buildCMD runHook postBuild ''; inherit preBuild; @@ -190,7 +225,7 @@ }); devShells = forAllSystems (system: let pkgs-ovl = pkgsForSystem system; - pkgs = nixpkgsFor.${system}; + pkgs-nix = nixpkgsFor.${system}; shellHook = '' export DFLAGS="-O2 -boundscheck=on" export Date=`date "+%Y%m%d"` @@ -201,8 +236,6 @@ name = "spine base dev shell"; inherit shell; inherit devEnv; - #buildInputs = [ sqlite ]; - #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; packages = [ ldc #dmd @@ -212,12 +245,34 @@ ]; inherit shellHook; }; + dsh-nixpkgs-dmd-dub = mkShell { + name = "spine base dev shell"; + inherit shell; + inherit devEnv; + packages = with pkgs-nix; [ + dmd + dub + gnumake + sqlite + ]; + inherit shellHook; + }; + dsh-nixpkgs-ldc-dub = mkShell { + name = "spine base dev shell"; + inherit shell; + inherit devEnv; + packages = with pkgs-nix; [ + ldc + dub + gnumake + sqlite + ]; + inherit shellHook; + }; dsh-overlay-dmd-dub = mkShell { name = "spine base dev shell"; inherit shell; inherit devEnv; - #buildInputs = [ sqlite ]; - #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; packages = [ dmd dub @@ -230,8 +285,6 @@ name = "spine base dev shell"; inherit shell; inherit devEnv; - #buildInputs = [ sqlite ]; - #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; packages = [ ldc dub @@ -325,7 +378,7 @@ ]; inherit shellHook; }; - default = import ./shell.nix {inherit pkgs;}; + default = import ./shell.nix {inherit pkgs-nix;}; }); }; } @@ -338,8 +391,8 @@ #+HEADER: :shebang "#!/usr/bin/env -S nix-shell --pure\n#!nix-shell -i bash" #+HEADER: :noweb yes #+BEGIN_SRC nix -{pkgs ? import {}}: -with pkgs; +{pkgs-nix ? import {}}: +with pkgs-nix; mkShell { buildInputs = [ # ❯❯❯ nix_related @@ -351,16 +404,17 @@ with pkgs; nix-output-monitor nix-tree jq #gx - alejandra + #alejandra git # ❯❯❯ dev gnumake ps # ❯❯❯ d_build_related # ❯❯ package manager - dub + #dub # ❯❯ compiler - ldc + #dmd + #ldc #rund # ❯❯ linker #lld @@ -369,7 +423,7 @@ with pkgs; #ninja #meson # ❯❯❯ sqlite search related - sqlite + #sqlite # ❯❯❯ pdf_latex_related # source-sans-pro # source-serif-pro @@ -426,7 +480,7 @@ with pkgs; nix-output-monitor nix-tree jq #gx - alejandra + #alejandra git # ❯❯❯ dev gnumake @@ -435,6 +489,7 @@ with pkgs; # ❯❯ package manager dub # ❯❯ compiler + #dmd ldc # ❯❯❯ sqlite search related sqlite @@ -653,7 +708,6 @@ github:nixos/nixpkgs - nix build ".#default" --print-build-logs - nix build ".#spine-dmd" --print-build-logs - nix build ".#spine-ldc" --print-build-logs -- nix build ".#spine-gdc" --print-build-logs - nix develop - nix develop ".#devShell" --print-build-logs -- cgit v1.2.3