You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have made a test via the template and found that the pkgs override is not working and not used by the tools.
Define this flake.nix file:
{inputs={flake-parts.url="github:hercules-ci/flake-parts";flake-parts.inputs.nixpkgs.follows="nixpkgs";nixpkgs.url="github:NixOS/nixpkgs/nixos-unstable";pre-commit-hooks-nix.url="github:hercules-ci/pre-commit-hooks.nix/flakeModule";pre-commit-hooks-nix.inputs.nixpkgs.follows="nixpkgs";};outputs=inputs@{self,flake-parts, ... }:
flake-parts.lib.mkFlake{inheritself;}{imports=[inputs.pre-commit-hooks-nix.flakeModule];systems=["x86_64-linux""aarch64-darwin"];perSystem={config,pkgs, ... }: {packages.hello=pkgs.hello;pre-commit={check.enable=true;pkgs=pkgs//{nixpkgs-fmt=pkgs.writeShellApplication{name="nixpkgs-fmt";text="false";};};settings.hooks.nixpkgs-fmt.enable=true;};devShells.default=pkgs.mkShell{shellHook=''${config.pre-commit.installationScript} echo 1>&2 "Welcome to the development shell!" '';};};};}
Run nix flake check
During this experiment I found out that the overridden pkgs is used for parts of pre-commit-hooks.nix, but not for the actual tools. For example this worked, but shouldn't:
The text was updated successfully, but these errors were encountered:
terlar
changed the title
Overriding pkgs used by tools does not work when used via flake-parts
Overriding pkgs used by tools does not work when using flake-parts integration
Dec 1, 2022
pre-commit-hooks.nix uses callPackage in call-tools.nix. callPackage is unaware of anything you do with pkgs // but does support overlays. Does the problem occur with the following change?
You are right, I got tripped up by the empty object with explicit attributes, didn’t reflect on passing in callPackage and what that entails. Thank you for pointing out this oversight. Would this be the recommended way if one would need to override a tool?
I have made a test via the template and found that the pkgs override is not working and not used by the tools.
Define this flake.nix file:
Run
nix flake check
During this experiment I found out that the overridden pkgs is used for parts of
pre-commit-hooks.nix
, but not for the actual tools. For example this worked, but shouldn't:The text was updated successfully, but these errors were encountered: