Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/14520.contrib.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Flake-based Nix build environments are now supported via ``nix develop``.
59 changes: 59 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 70 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
description = "Development environment for Pytest";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should note that this is a convenience for and by nix users and not maintained by pytest core


inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
nixpkgs-unstable.url = "github:NixOS/nixpkgs";
systems.url = "github:nix-systems/default";
};

outputs = { self, nixpkgs, nixpkgs-unstable, systems }:
let
forAllSystems = nixpkgs.lib.genAttrs (import systems);
mkPkgs = system: import nixpkgs {
inherit system;
overlays = [ self.overlays.newer-pre-commit ];
};
in
{
packages = forAllSystems (system:
let
pkgs = mkPkgs system;
in
{
fhs-test-env = pkgs.buildFHSEnv {
name = "fhs-test-env";
targetPkgs = fhspkgs:
let
python313-with-tox = pkgs.python313.withPackages (ps: with ps; [
tox
]);
in
[
python313-with-tox

# other Pythons
fhspkgs.python310
fhspkgs.python311
fhspkgs.python312
fhspkgs.python314

fhspkgs.bashInteractive
fhspkgs.pre-commit

];
runScript = "bash";
};
});

devShells = forAllSystems (system:
let
pkgs = mkPkgs system;
in
{
default = pkgs.mkShell {
packages = [ self.packages.${system}.fhs-test-env ];
shellHook = "exec fhs-test-env";
};
});

overlays = {
newer-pre-commit = final: prev: {
pre-commit =
let
pkgs = import nixpkgs-unstable { inherit (final.stdenv.hostPlatform) system; };
in
pkgs.pre-commit;
};
};
};
}