Skip to content

Commit dde05e5

Browse files
Fixing up nix deps
1 parent 14f052d commit dde05e5

File tree

4 files changed

+115
-23
lines changed

4 files changed

+115
-23
lines changed

flake.lock

Lines changed: 21 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,24 @@
55
description = "Environment for developing and simulating the ibex core.";
66

77
inputs = {
8-
nixpkgs.url = "nixpkgs/nixos-24.05";
9-
flake-utils.url = "github:numtide/flake-utils";
8+
9+
nixpkgs.follows = "lowrisc-nix/nixpkgs";
10+
flake-utils.follows = "lowrisc-nix/flake-utils";
1011

1112
poetry2nix = {
1213
url = "github:nix-community/poetry2nix";
1314
inputs.nixpkgs.follows = "nixpkgs";
1415
inputs.flake-utils.follows = "flake-utils";
1516
};
17+
1618
mkshell-minimal.url = "github:viperML/mkshell-minimal";
1719

1820
# The input 'lowrisc-nix' contains some common dependencies that can be used
1921
# by lowRISC projects. There is also an associated public binary cache.
2022
lowrisc-nix = {
23+
# Checkout from when
24+
# url = "github:lowrisc/lowrisc-nix?ref=d7e90e450bcfbed83b6b8a2458d29c0ddd7fe58d";
2125
url = "github:lowrisc/lowrisc-nix";
22-
inputs.nixpkgs.follows = "nixpkgs";
23-
inputs.flake-utils.follows = "flake-utils";
2426
};
2527

2628
psgen = {

nix/env/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
}: let
1010
poetry2nix = inputs.poetry2nix.lib.mkPoetry2Nix {inherit pkgs;};
1111
ibexPoetryOverrides = import ./poetryOverrides.nix {inherit pkgs;};
12-
lowriscPoetryOverrides = inputs.lowrisc-nix.lib.poetryOverrides {inherit pkgs;};
12+
lowriscPoetryOverrides = import ./poetryOverridesLowriscNix.nix {inherit pkgs;};
1313
in
1414
poetry2nix.mkPoetryEnv {
1515
projectDir = ./.;
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Copyright lowRISC Contributors.
2+
# Licensed under the MIT License, see LICENSE for details.
3+
# SPDX-License-Identifier: MIT
4+
{pkgs, ...}: let
5+
# https://github.com/nix-community/poetry2nix/blob/master/docs/edgecases.md
6+
# poetry2nix tries to build the python packages based on the information
7+
# given in their own build description files (setup.py etc.)
8+
# Sometimes, the inputs are incomplete. Add missing inputs here.
9+
pypkgs-missing-build-requirements = {
10+
# package: build-requirements #
11+
attrs = ["hatchling" "hatch-fancy-pypi-readme" "hatch-vcs"];
12+
beautifulsoup4 = ["hatchling"];
13+
pyfinite = ["setuptools"];
14+
zipfile2 = ["setuptools"];
15+
okonomiyaki = ["setuptools"];
16+
simplesat = ["setuptools"];
17+
urllib3 = ["hatchling"];
18+
fusesoc = ["setuptools" "setuptools-scm"];
19+
chipwhisperer = ["setuptools"];
20+
siphash = ["setuptools"];
21+
tockloader = ["setuptools"];
22+
};
23+
buildreqs-overlay = (
24+
final: prev:
25+
builtins.mapAttrs (
26+
package: build-requirements:
27+
(builtins.getAttr package prev).overridePythonAttrs (old: {
28+
buildInputs =
29+
(old.buildInputs or [])
30+
++ (
31+
builtins.map
32+
(pkg: builtins.getAttr pkg final)
33+
build-requirements
34+
);
35+
})
36+
)
37+
pypkgs-missing-build-requirements
38+
);
39+
40+
# The following modules are very slow to build or are otherwise broken.
41+
# For now, preferWheel to pull the binary dist.
42+
preferwheel-overlay = final: prev: {
43+
mypy = prev.mypy.override {
44+
# Very slow build.
45+
preferWheel = true;
46+
};
47+
libcst = prev.libcst.override {
48+
preferWheel = true;
49+
# }).overridePythonAttrs ( old: {
50+
# # This fix is incomplete, and appears to be due to the issue here:
51+
# # https://github.com/nix-community/poetry2nix/issues/413
52+
# # https://github.com/nix-community/poetry2nix/issues/442
53+
# buildInputs = (old.buildInputs or []) ++ [
54+
# pkgs.rustc
55+
# pkgs.cargo
56+
# # pkgs.rustPlatform.cargoSetupHook
57+
# final.setuptools-rust
58+
# ];
59+
# });
60+
};
61+
# isort = prev.isort.override {
62+
# # Some problem building due to a malformed semantic version string.
63+
# preferWheel = true;
64+
# };
65+
# ninja = prev.ninja.override {
66+
# # Build error.
67+
# preferWheel = true;
68+
# };
69+
pyyaml = prev.pyyaml.override {
70+
# Build error.
71+
preferWheel = true;
72+
};
73+
};
74+
75+
# Nix wraps python programs which causes PATH to change. We want to keep
76+
# PATH in case a program needs to invoke user-defined programs.
77+
dontwrap-overlay = final: prev: {
78+
fusesoc = prev.fusesoc.overridePythonAttrs {
79+
dontWrapPythonPrograms = true;
80+
};
81+
};
82+
in
83+
pkgs.lib.composeManyExtensions [
84+
preferwheel-overlay
85+
buildreqs-overlay
86+
dontwrap-overlay
87+
]

0 commit comments

Comments
 (0)