Skip to content

Commit 901548e

Browse files
committed
Format nix files
1 parent e8cba66 commit 901548e

File tree

12 files changed

+290
-222
lines changed

12 files changed

+290
-222
lines changed

dependencies/edalize.nix

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
{ lib, buildPythonPackage, fetchPypi,
2-
jinja2, setuptools_scm, simplesat
1+
{
2+
lib,
3+
buildPythonPackage,
4+
fetchPypi,
5+
jinja2,
6+
setuptools_scm,
7+
simplesat,
38
}:
49
buildPythonPackage rec {
510
pname = "edalize";
@@ -9,7 +14,7 @@ buildPythonPackage rec {
914
sha256 = "1734aprwzm0z2l60xapqrfxxw747n9h9fflv3n0x4iaradf75abj";
1015
};
1116
SETUPTOOLS_SCM_PRETEND_VERSION = "${version}";
12-
nativeBuildInputs = [ setuptools_scm ];
13-
propagatedBuildInputs = [ jinja2 simplesat ];
17+
nativeBuildInputs = [setuptools_scm];
18+
propagatedBuildInputs = [jinja2 simplesat];
1419
doCheck = false;
1520
}

dependencies/flake.nix

Lines changed: 97 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -3,102 +3,109 @@
33

44
inputs = {
55
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
6-
lowrisc_fusesoc_src = { url = "github:lowRISC/fusesoc?ref=ot-0.2"; flake = false; };
7-
lowrisc_edalize_src = { url = "github:lowRISC/edalize?ref=ot-0.2"; flake = false; };
6+
lowrisc_fusesoc_src = {
7+
url = "github:lowRISC/fusesoc?ref=ot-0.2";
8+
flake = false;
9+
};
10+
lowrisc_edalize_src = {
11+
url = "github:lowRISC/edalize?ref=ot-0.2";
12+
flake = false;
13+
};
814
};
915

10-
outputs = {self, nixpkgs,
11-
lowrisc_fusesoc_src, lowrisc_edalize_src,
12-
}:
13-
let
14-
system = "x86_64-linux";
15-
pkgs = import nixpkgs {
16-
inherit system;
17-
config = { allowUnfree = true; };
18-
};
19-
20-
lowRISC_python_overrides = pfinal: pprev: {
21-
fusesoc = pprev.fusesoc.overridePythonAttrs (oldAttrs: {
22-
version = "0.3.3.dev";
23-
src = lowrisc_fusesoc_src;
24-
});
25-
edalize = pprev.edalize.overridePythonAttrs (oldAttrs: {
26-
version = "0.3.3.dev";
27-
src = lowrisc_edalize_src;
28-
});
29-
};
16+
outputs = {
17+
self,
18+
nixpkgs,
19+
lowrisc_fusesoc_src,
20+
lowrisc_edalize_src,
21+
}: let
22+
system = "x86_64-linux";
23+
pkgs = import nixpkgs {
24+
inherit system;
25+
config = {allowUnfree = true;};
26+
};
3027

31-
lowRISC_spike_override = final: prev: {
32-
riscv-isa-sim = prev.riscv-isa-sim.overrideAttrs (oldAttrs: rec {
33-
version = "ibex-cosim-v0.3";
34-
src = pkgs.fetchFromGitHub {
35-
owner = "lowrisc";
36-
repo = oldAttrs.pname;
37-
rev = version;
38-
sha256 = "sha256-pKuOpzybOI8UqWV1TSFq4hqTHf7Bft/3WL19fRpwmfU=";
39-
};
40-
});
41-
};
28+
lowRISC_python_overrides = pfinal: pprev: {
29+
fusesoc = pprev.fusesoc.overridePythonAttrs (oldAttrs: {
30+
version = "0.3.3.dev";
31+
src = lowrisc_fusesoc_src;
32+
});
33+
edalize = pprev.edalize.overridePythonAttrs (oldAttrs: {
34+
version = "0.3.3.dev";
35+
src = lowrisc_edalize_src;
36+
});
37+
};
4238

43-
# Using requireFile prevents rehashing each time.
44-
# This saves much seconds during rebuilds.
45-
vivado_bundled_installer_src = pkgs.requireFile rec {
46-
name = "vivado_bundled.tar.gz";
47-
sha256 = "1yxx6crvawhzvary9js0m8bzm35vv6pzfqdkv095r84lb13fyp7b";
48-
# Print the following message if the name / hash are not
49-
# found in the store.
50-
message = ''
51-
requireFile :
52-
file/dir not found in /nix/store
53-
file = ${name}
54-
hash = ${sha256}
39+
lowRISC_spike_override = final: prev: {
40+
riscv-isa-sim = prev.riscv-isa-sim.overrideAttrs (oldAttrs: rec {
41+
version = "ibex-cosim-v0.3";
42+
src = pkgs.fetchFromGitHub {
43+
owner = "lowrisc";
44+
repo = oldAttrs.pname;
45+
rev = version;
46+
sha256 = "sha256-pKuOpzybOI8UqWV1TSFq4hqTHf7Bft/3WL19fRpwmfU=";
47+
};
48+
});
49+
};
5550

56-
This nix expression requires that ${name} is already part of the store.
57-
- Login to xilinx.com
58-
- Download Unified Installer from https://www.xilinx.com/support/download.html,
59-
- Run installer, specify a 'Download Image (Install Seperately)'
60-
- Gzip the bundled installed image directory
61-
- Rename the file to ${name}
62-
- Add it to the nix store with
63-
nix-prefetch-url --type sha256 file:/path/to/${name}
64-
- Change the sha256 key above to $HASH
65-
'';
66-
};
51+
# Using requireFile prevents rehashing each time.
52+
# This saves much seconds during rebuilds.
53+
vivado_bundled_installer_src = pkgs.requireFile rec {
54+
name = "vivado_bundled.tar.gz";
55+
sha256 = "1yxx6crvawhzvary9js0m8bzm35vv6pzfqdkv095r84lb13fyp7b";
56+
# Print the following message if the name / hash are not
57+
# found in the store.
58+
message = ''
59+
requireFile :
60+
file/dir not found in /nix/store
61+
file = ${name}
62+
hash = ${sha256}
6763
68-
vivado = pkgs.callPackage (import ./vivado.nix) {
69-
# We need to prepare the pre-downloaded installer to
70-
# execute within a nix build. Make use of the included java deps,
71-
# but we still need to do a little patching to make it work.
72-
vivado-src = pkgs.stdenv.mkDerivation rec {
73-
pname = "vivado_src";
74-
version = "2022.2";
75-
src = vivado_bundled_installer_src;
76-
postPatch = ''
77-
patchShebangs .
78-
patchelf \
79-
--set-interpreter $(cat ${pkgs.stdenv.cc}/nix-support/dynamic-linker) \
80-
tps/lnx64/jre*/bin/java
81-
'';
82-
dontBuild = true; dontFixup = true;
83-
installPhase = ''
84-
mkdir -p $out
85-
cp -R * $out
86-
'';
87-
};
88-
};
64+
This nix expression requires that ${name} is already part of the store.
65+
- Login to xilinx.com
66+
- Download Unified Installer from https://www.xilinx.com/support/download.html,
67+
- Run installer, specify a 'Download Image (Install Seperately)'
68+
- Gzip the bundled installed image directory
69+
- Rename the file to ${name}
70+
- Add it to the nix store with
71+
nix-prefetch-url --type sha256 file:/path/to/${name}
72+
- Change the sha256 key above to $HASH
73+
'';
74+
};
8975

90-
in
91-
{
92-
overlay_pkgs = pkgs.lib.composeManyExtensions [
93-
(import ./overlay.nix)
94-
lowRISC_spike_override
95-
(final: prev: {
96-
inherit vivado;
97-
})
98-
];
99-
overlay_python = pkgs.lib.composeManyExtensions [
100-
(import ./python-overlay.nix)
101-
lowRISC_python_overrides
102-
];
76+
vivado = pkgs.callPackage (import ./vivado.nix) {
77+
# We need to prepare the pre-downloaded installer to
78+
# execute within a nix build. Make use of the included java deps,
79+
# but we still need to do a little patching to make it work.
80+
vivado-src = pkgs.stdenv.mkDerivation rec {
81+
pname = "vivado_src";
82+
version = "2022.2";
83+
src = vivado_bundled_installer_src;
84+
postPatch = ''
85+
patchShebangs .
86+
patchelf \
87+
--set-interpreter $(cat ${pkgs.stdenv.cc}/nix-support/dynamic-linker) \
88+
tps/lnx64/jre*/bin/java
89+
'';
90+
dontBuild = true;
91+
dontFixup = true;
92+
installPhase = ''
93+
mkdir -p $out
94+
cp -R * $out
95+
'';
10396
};
97+
};
98+
in {
99+
overlay_pkgs = pkgs.lib.composeManyExtensions [
100+
(import ./overlay.nix)
101+
lowRISC_spike_override
102+
(final: prev: {
103+
inherit vivado;
104+
})
105+
];
106+
overlay_python = pkgs.lib.composeManyExtensions [
107+
(import ./python-overlay.nix)
108+
lowRISC_python_overrides
109+
];
110+
};
104111
}

dependencies/fusesoc.nix

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
{ lib, buildPythonPackage, fetchPypi,
2-
setuptools_scm, pyparsing, pyyaml, simplesat, ipyxact, edalize
1+
{
2+
lib,
3+
buildPythonPackage,
4+
fetchPypi,
5+
setuptools_scm,
6+
pyparsing,
7+
pyyaml,
8+
simplesat,
9+
ipyxact,
10+
edalize,
311
}:
412
buildPythonPackage rec {
513
pname = "fusesoc";
@@ -9,7 +17,7 @@ buildPythonPackage rec {
917
sha256 = "1065arwk1hylf4lqmgqb77fw9izgh7jaib5qnl2dqwdic11c2w44";
1018
};
1119
SETUPTOOLS_SCM_PRETEND_VERSION = "${version}"; # Hack
12-
nativeBuildInputs = [ setuptools_scm ];
13-
propagatedBuildInputs = [ pyparsing pyyaml simplesat ipyxact edalize ];
20+
nativeBuildInputs = [setuptools_scm];
21+
propagatedBuildInputs = [pyparsing pyyaml simplesat ipyxact edalize];
1422
doCheck = false;
1523
}

dependencies/ipyxact.nix

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
{ lib, buildPythonPackage, fetchPypi,
2-
pyyaml }:
1+
{
2+
lib,
3+
buildPythonPackage,
4+
fetchPypi,
5+
pyyaml,
6+
}:
37
buildPythonPackage rec {
48
pname = "ipyxact";
59
version = "0.3.1";
610
src = fetchPypi {
711
inherit pname version;
812
sha256 = "09rv8zn6gqwhdnwgx246mz9biln0q71hsxjf6sb9ilhan75fsn0z";
913
};
10-
propagatedBuildInputs = [ pyyaml ];
14+
propagatedBuildInputs = [pyyaml];
1115
doCheck = false;
1216
}

dependencies/okonomiyaki.nix

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
{ lib, buildPythonPackage, fetchPypi,
2-
attrs, jsonschema, six, zipfile2, distro }:
1+
{
2+
lib,
3+
buildPythonPackage,
4+
fetchPypi,
5+
attrs,
6+
jsonschema,
7+
six,
8+
zipfile2,
9+
distro,
10+
}:
311
buildPythonPackage rec {
412
pname = "okonomiyaki";
513
version = "1.3.2";
614
src = fetchPypi {
715
inherit pname version;
816
sha256 = "1dw9di7s92z201lwq7aqy5h9h53af73ffx6pnl5iz3lnfi0zf85p";
917
};
10-
propagatedBuildInputs = [ attrs jsonschema six zipfile2 distro ];
18+
propagatedBuildInputs = [attrs jsonschema six zipfile2 distro];
1119
doCheck = false;
1220
}

dependencies/riscv-gcc-toolchain-lowrisc.nix

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
{ pkgs, lib, stdenv,
2-
fetchzip, zlib, ncurses5,
1+
{
2+
pkgs,
3+
lib,
4+
stdenv,
5+
fetchzip,
6+
zlib,
7+
ncurses5,
38
}:
4-
59
# Used for reference...
610
# https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/compilers/gcc-arm-embedded/10/default.nix
7-
811
stdenv.mkDerivation rec {
912
name = "riscv-gcc-toolchain";
1013
version = "20220210-1";
@@ -26,7 +29,7 @@ stdenv.mkDerivation rec {
2629
find $out -type f ! -name ".o" | while read f; do
2730
patchelf "$f" > /dev/null 2>&1 || continue
2831
patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) "$f" || true
29-
patchelf --set-rpath ${lib.makeLibraryPath [ "$out" stdenv.cc.cc ncurses5 ]} "$f" || true
32+
patchelf --set-rpath ${lib.makeLibraryPath ["$out" stdenv.cc.cc ncurses5]} "$f" || true
3033
done
3134
'';
3235
}

dependencies/riscv-isa-sim.nix

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
{ lib, stdenv, fetchFromGitHub,
2-
dtc
1+
{
2+
lib,
3+
stdenv,
4+
fetchFromGitHub,
5+
dtc,
36
}:
4-
57
stdenv.mkDerivation rec {
68
name = "spike";
79
pname = "riscv-isa-sim";
@@ -16,17 +18,17 @@ stdenv.mkDerivation rec {
1618

1719
enableParallelBuilding = true;
1820
# buildInputs = [ ];
19-
nativeBuildInputs = [ dtc ];
20-
configureFlags = [ "--enable-commitlog" "--enable-misaligned" ];
21+
nativeBuildInputs = [dtc];
22+
configureFlags = ["--enable-commitlog" "--enable-misaligned"];
2123

2224
doCheck = false;
2325
dontInstall = false;
2426

2527
meta = with lib; {
2628
description = "Riscv golden-reference simulator Spike";
27-
homepage = "https://github.com/riscv-software-src/riscv-isa-sim";
28-
license = with licenses; [];
29-
platforms = platforms.unix;
29+
homepage = "https://github.com/riscv-software-src/riscv-isa-sim";
30+
license = with licenses; [];
31+
platforms = platforms.unix;
3032
maintainers = with maintainers; [];
3133
};
3234
}

0 commit comments

Comments
 (0)