A while ago I could simply not put any input and it would grab nixpkgs from the system (really practical to avoid extra dependencies). But it seems like this won’t work with flake-parts:
error: flake-parts: The flake does not have a `nixpkgs` input. Please add it, or set `perSystem._module.args.pkgs` yourself.
Instead I tried:
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "flake:nixpkgs";
};
but it still tries to download a really recent version of nixpkgs (2 days old) instead of using my older nixpkgs. I thought that flake-part might rely on nixpkgs so I tried to make it follow nixpkgs but this fails. The only solution I found to rely on my system nixpkgs is to hardcode it like:
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:nixos/nixpkgs/c97c47f2bac4fa59e2cbdeba289686ae615f8ed4";
};
but this is of course not really practical as update etc are not very natural to do. Any idea what’s going on? Is it a bug?
For reference here is my full flake:
{
description = "A very basic flake";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:nixos/nixpkgs/c97c47f2bac4fa59e2cbdeba289686ae615f8ed4";
};
outputs = { flake-parts, ... } @ inputs: flake-parts.lib.mkFlake { inherit inputs; } {
perSystem = { config, self', inputs', pkgs, system, ... }: {
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
nodejs_22
playwright-driver.browsers
];
shellHook = ''
export PLAYWRIGHT_BROWSERS_PATH=${pkgs.playwright-driver.browsers}
export PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true;
export PLAYWRIGHT_NODEJS_PATH=${pkgs.nodejs_22}/bin/node
playwright_chromium_revision="$(${pkgs.jq}/bin/jq --raw-output '.browsers[] | select(.name == "chromium").revision' ${pkgs.playwright-driver}/browsers.json)"
export PLAYWRIGHT_LAUNCH_OPTIONS_EXECUTABLE_PATH=${pkgs.playwright-driver.browsers}/chromium-$playwright_chromium_revision/chrome-linux/chrome
echo "Using $PLAYWRIGHT_LAUNCH_OPTIONS_EXECUTABLE_PATH"
'';
};
};
# Declared systems that your flake supports. These will be enumerated in perSystem
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
};
}