nix-direnv/flake.nix
Bryan Bennett c59b60e747 Switch to bats over pytest
This removes python entirely from the stack.
Yet to run the tests on macOS, but they're buildable by way of nix
wrapping. Worst case scenario, you cannot run them from the devshell
but `nix run .#test-runner-<latest||stable>` should work okay.
2025-08-19 08:44:42 -04:00

66 lines
1.8 KiB
Nix

{
description = "A faster, persistent implementation of `direnv`'s `use_nix`, to replace the built-in one.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } (
{ lib, ... }:
{
imports = [ ./treefmt.nix ];
systems = [
"aarch64-linux"
"x86_64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
perSystem =
{
config,
pkgs,
self',
...
}:
let
nix-direnv = pkgs.callPackage ./default.nix { };
test_pkgs = pkgs.lib.callPackagesWith pkgs ./tests { inherit nix-direnv; };
in
{
packages = test_pkgs // {
inherit nix-direnv;
default = nix-direnv;
};
devShells.default = pkgs.callPackage ./shell.nix {
treefmt = config.treefmt.build.wrapper;
};
checks =
let
packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self'.packages;
devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells;
in
packages // devShells;
};
flake = {
overlays.default = final: _prev: { nix-direnv = final.callPackage ./default.nix { }; };
templates.default = {
path = ./templates/flake;
description = "nix flake new -t github:nix-community/nix-direnv .";
};
};
}
);
}