Skip to content

Commit

Permalink
feat(flake)!: add boolean for pre-commit checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ProducerMatt committed Aug 26, 2024
1 parent 46f3f1b commit ff5a63d
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
flake-utils.lib.eachDefaultSystem
(
system: let
# NOTE: change to true to enable commit checks
# when disabled, also run "pre-commit uninstall" to disable
enablePreCommitChecks = true;

pkgs = nixpkgs.legacyPackages.${system};

inherit (pkgs) lib;
Expand Down Expand Up @@ -148,21 +152,21 @@
++ systemPackages;

# define shell startup command
sh-hook = ''
export FLAKE_PYTHON="${python}/bin/python3"
# this allows mix to work on the local directory
mkdir -p .nix-mix
mkdir -p .nix-hex
export MIX_HOME=$PWD/.nix-mix
export HEX_HOME=$PWD/.nix-hex
export PATH=$MIX_HOME/bin:$PATH
export PATH=$HEX_HOME/bin:$PATH
export LANG=en_US.UTF-8
export ERL_AFLAGS="-kernel shell_history enabled"
${pc-hooks.shellHook}
'';
sh-hook =
''
export FLAKE_PYTHON="${python}/bin/python3"
# this allows mix to work on the local directory
mkdir -p .nix-mix
mkdir -p .nix-hex
export MIX_HOME=$PWD/.nix-mix
export HEX_HOME=$PWD/.nix-hex
export PATH=$MIX_HOME/bin:$PATH
export PATH=$HEX_HOME/bin:$PATH
export LANG=en_US.UTF-8
export ERL_AFLAGS="-kernel shell_history enabled"
''
+ lib.optionalString enablePreCommitChecks pc-hooks.shellHook;
in
pkgs.mkShell {
buildInputs = inputs;
Expand Down

0 comments on commit ff5a63d

Please sign in to comment.