diff options
author | Ben Sima <ben@bsima.me> | 2023-08-22 10:53:12 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2023-08-22 11:00:32 -0400 |
commit | 9eac46cfeddc65938b3cc946629a9c3d93ac35ee (patch) | |
tree | 75ec4d97e9cde9d477f37c4a8f70b2d407103740 /Biz/Bild.nix | |
parent | 8f5f080fe73f0b0cfbc18dfe2b8a466ed4b43375 (diff) |
Add a commit-msg hook lint and various other cleanups
Turns out that gitlint by default enforces the exact commit-msg format that I
like to use. I'm enabling this because even I write poor commit messages
sometimes, and looking back on my commits from even a few days ago is sometimes
not very helpful.
I also made some minor comment and nix changes that I noticed while reviewing my
work from the last few days.
Diffstat (limited to 'Biz/Bild.nix')
-rw-r--r-- | Biz/Bild.nix | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/Biz/Bild.nix b/Biz/Bild.nix index 1955d2c..183e633 100644 --- a/Biz/Bild.nix +++ b/Biz/Bild.nix @@ -53,15 +53,15 @@ in nixpkgs // { bild = rec { bildRuntimeDeps = with nixpkgs; [ pkg-config # this is just to get access to ghc-pkg in bild - (haskell.ghcWith (hpkgs: with hpkgs; [])) + (haskell.ghcWith (_: [])) # lisp deps guile (lisp.sbclWith (p: with p; [asdf alexandria])) # just enough to build Example.lisp ]; - # a standard nix build for `bild` - this should be the only hand-written - # builder we need + # a standard nix build for bild, for bootstrapping. this should be the only + # hand-written builder we need bild = nixpkgs.stdenv.mkDerivation { name = "bild"; src = ../.; @@ -91,7 +91,7 @@ in nixpkgs // { bild = rec { }; # wrapper around bild - runBildAnalyze = main: nixpkgs.stdenv.mkDerivation rec { + runBildAnalyze = target: nixpkgs.stdenv.mkDerivation rec { name = "bild-analysis"; src = ../.; USER = "nixbld"; @@ -100,10 +100,10 @@ in nixpkgs // { bild = rec { BIZ_ROOT = "/build/biz"; # we need to remove the $src root because bild expects paths relative to the # working directory: - MAIN = "." + lib.strings.removePrefix (toString src) (toString main); + TARGET = "." + lib.strings.removePrefix (toString src) (toString target); buildPhase = '' mkdir $out - ${bild}/bin/bild --json "$MAIN" 1> $out/analysis.json \ + ${bild}/bin/bild --json "$TARGET" 1> $out/analysis.json \ 2> >(tee -a $out/stderr >&2) ''; installPhase = "exit 0"; @@ -111,31 +111,28 @@ in nixpkgs // { bild = rec { # gather data needed for compiling by analyzing the main module. returns the # json object of the build - analyze = main: builtins.readFile (runBildAnalyze main + "/analysis.json"); + analyze = target: builtins.readFile (runBildAnalyze target + "/analysis.json"); - # i think this isn't going to work because we have a nix-in-nix problem. - # instead: - # - get the store path some other way. if i can pass that to bild.os, then nix - # should automatically get all the deps required - # - just do runBildAnalyze, pass the args to Bild/Builder.nix, should continue - # no problem - run = main: import ./Bild/Builder.nix { analysisJSON = analyze main; }; + # this does a bild build for the given target, but entirely in nix. its kinda + # like IFD, but not as costly, i think + run = target: import ./Bild/Builder.nix { analysisJSON = analyze target; }; # the main development environment - env = let - linters = with nixpkgs.pkgs; [ ormolu hlint deadnix indent black]; - in nixpkgs.pkgs.mkShell { + env = nixpkgs.pkgs.mkShell { name = "bizdev"; # this should just be dev tools - buildInputs = with nixpkgs.pkgs; linters ++ bildRuntimeDeps ++ [ + buildInputs = with nixpkgs.pkgs; [ bild + black ctags + deadnix figlet git - nixpkgs.haskell.packages.${constants.ghcCompiler}.fast-tags + gitlint hlint + indent lolcat - #nixops # fails to build + nixpkgs.haskell.packages.${constants.ghcCompiler}.fast-tags ormolu shellcheck wemux |