Skip to content
Merged
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
77 changes: 10 additions & 67 deletions devenv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1767704193,
"lastModified": 1773672671,
"narHash": "sha256-TcU3EYJ6vVNRE6Kdhwh7wI3X6UTqyX+K84PnP03YK7Y=",
"owner": "cachix",
"repo": "devenv",
"rev": "b472e02e27003280097bfd03bcc390af7f387804",
"rev": "9dfa16743f60733f62634ae2826c8c8a4762e255",
"type": "github"
},
"original": {
Expand All @@ -16,68 +17,13 @@
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1767039857,
"owner": "NixOS",
"repo": "flake-compat",
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "flake-compat",
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1767281941,
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "f0927703b7b1c8d97511c4116eb9b4ec6645a0fa",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1762808025,
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "cb5e3fdca1de58ccbc3ef53de65bd372b48f567c",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1767364772,
"lastModified": 1773597492,
"narHash": "sha256-hQ284SkIeNaeyud+LS0WVLX+WL2rxcVZLFEaK0e03zg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "16c7794d0a28b5a37904d55bcca36003b9109aaa",
"rev": "a07d4ce6bee67d7c838a8a5796e75dff9caa21ef",
"type": "github"
},
"original": {
Expand All @@ -90,11 +36,7 @@
"root": {
"inputs": {
"devenv": "devenv",
"git-hooks": "git-hooks",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": [
"git-hooks"
],
"rust-overlay": "rust-overlay"
}
},
Expand All @@ -105,10 +47,11 @@
]
},
"locked": {
"lastModified": 1767667566,
"lastModified": 1773630837,
"narHash": "sha256-zJhgAGnbVKeBMJOb9ctZm4BGS/Rnrz+5lfSXTVah4HQ=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "056ce5b125ab32ffe78c7d3e394d9da44733c95e",
"rev": "f600ea449c7b5bb596fa1cf21c871cc5b9e31316",
"type": "github"
},
"original": {
Expand All @@ -120,4 +63,4 @@
},
"root": "root",
"version": 7
}
}
43 changes: 31 additions & 12 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{ pkgs, lib, inputs, config, ... }:
let
cfg = config.hugr;
darwinRuntimeLibraries = with pkgs; [
libiconv
xz
libffi
libxml2
ncurses
];
darwinRuntimeLibraryPath = lib.makeLibraryPath darwinRuntimeLibraries;
in
{
options.hugr = {
Expand All @@ -26,31 +34,42 @@ in
pkgs.libffi
pkgs.libxml2
pkgs.ncurses
] ++ lib.optionals pkgs.stdenv.isDarwin [
pkgs.xz
];
] ++ lib.optionals pkgs.stdenv.isDarwin darwinRuntimeLibraries;

env = let
llvmPackage = pkgs."llvmPackages_${cfg.llvmVersion}";
versionInfo = builtins.splitVersion llvmPackage.release_version;
llvmVersionMajor = builtins.elemAt versionInfo 0;
llvmVersionMinor = builtins.elemAt versionInfo 1;
in {
"LLVM_SYS_${llvmVersionMajor}${llvmVersionMinor}_PREFIX" = "${llvmPackage.libllvm.dev}";
};
env =
let
llvmPackage = pkgs."llvmPackages_${cfg.llvmVersion}";
versionInfo = builtins.splitVersion llvmPackage.release_version;
llvmVersionMajor = builtins.elemAt versionInfo 0;
llvmVersionMinor = builtins.elemAt versionInfo 1;
in
{
"LLVM_SYS_${llvmVersionMajor}${llvmVersionMinor}_PREFIX" = "${llvmPackage.libllvm.dev}";
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
# `uv` and other prebuilt binaries on macOS can link against `libiconv.2`
# without carrying an absolute runtime path to the Nix-provided library.
# Make the fallback loader path explicit so `uv sync` stays stable across
# devenv/nixpkgs updates instead of depending on incidental shell state.
DYLD_FALLBACK_LIBRARY_PATH = darwinRuntimeLibraryPath;
};


enterShell = ''
cargo --version
# UV_PYTHON is set by devenv to the Nix python-env derivation, which carries
# an EXTERNALLY-MANAGED marker. This causes `uv pip install` (invoked by
# maturin) to target the immutable Nix store Python instead of the project
# venv. Unset it so uv resolves the interpreter from the active venv instead.
unset UV_PYTHON
'';

languages.python = {
enable = true;
venv.enable = false;
uv = {
enable = true;
sync.enable = true;
};
venv.enable = true;
};


Expand Down
Loading