Skip to content

Commit

Permalink
nix: use devenv to create a shell environment
Browse files Browse the repository at this point in the history
Devenv[^1] is tool to create easily composable development
environments for nix.

Hooking it in to our nix flake gives us the following improvements:
 - more declarative python environment config
 - avoid the `patchElf` hack to pull in native dependencies
 - python packages updates won't undo the effect of `patchElf`
 - due to a long-standing bug[^2], a patched `devenv` version is needed

[^1]: https://devenv.sh/
[^2]: cachix/devenv-nixpkgs#2
  • Loading branch information
vlaci committed Sep 30, 2024
1 parent 77dbc45 commit 44be1f4
Show file tree
Hide file tree
Showing 5 changed files with 458 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ jobs:
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
extraPullNames: pyperscan
- run: |
nix flake check -L --option system ${{ matrix.arch }} --extra-platforms ${{ matrix.arch }}
nix flake check -L --impure --option system ${{ matrix.arch }} --extra-platforms ${{ matrix.arch }}
24 changes: 24 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{ pkgs, ... }:

# https://devenv.sh/reference/options/
{
languages.python = {
enable = true;
libraries = with pkgs; [
file # python-magic
];
poetry = {
enable = true;
activate.enable = true;
install.enable = true;
install = {
groups = [ "dev" ];
installRootPackage = true;
};
};
};

packages = with pkgs; [
nvfetcher
] ++ unblob.runtimeDeps;
}
Loading

0 comments on commit 44be1f4

Please sign in to comment.