Skip to content

Commit 173e03f

Browse files
committed
reduce.
1 parent aef38a7 commit 173e03f

File tree

1 file changed

+8
-63
lines changed

1 file changed

+8
-63
lines changed

flake.nix

Lines changed: 8 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,6 @@
2727
sed -e 's/dynamic = "license"/dynamic = ["license"]/' -i pyproject.toml
2828
'';
2929

30-
pyelftools = pkgs.fetchgit {
31-
name = "pyelftools";
32-
url = "https://chromium.googlesource.com/chromiumos/third_party/pyelftools";
33-
rev = "refs/heads/chromeos-0.22";
34-
hash = "sha256-MArasbUre77vVGThaPxNotukIX+lGiNC4mhzZT52vl8=";
35-
};
36-
37-
crosutils = pkgs.fetchgit {
38-
name = "crosutils";
39-
url = "https://chromium.googlesource.com/chromiumos/platform/crosutils";
40-
rev = "refs/heads/main";
41-
hash = "sha256-ahnXEetj99TLEocogZcSSUdj/r0QXiOw1OIVRrMt0cI=";
42-
};
43-
4430
ec = pkgs.fetchFromGitHub {
4531
name = "ec";
4632
owner = "FrameworkComputer";
@@ -56,13 +42,6 @@
5642
hash = "sha256-IKmdIn/K1eHBVxA0sNvzr1i5LpkgJQMAMsks13lmDNw=";
5743
};
5844

59-
hal_stm32 = pkgs.fetchgit {
60-
name = "hal_stm32";
61-
url = "https://chromium.googlesource.com/chromiumos/third_party/zephyr/hal_stm32";
62-
rev = "refs/heads/chromeos-main";
63-
hash = "sha256-r1aks0sgUrJeX8t2lO98sOtGjBMvHgt2St0am+qEz3E=";
64-
};
65-
6645
zephyr = pkgs.fetchFromGitHub {
6746
name = "zephyr";
6847
owner = "FrameworkComputer";
@@ -71,27 +50,13 @@
7150
hash = "sha256-KgTh39Ba9jDByv7+9gDdZHCl2OOku3Y3yxq0Pt4GeBo=";
7251
};
7352

74-
nanopb = pkgs.fetchgit {
75-
name = "nanopb";
76-
url = "https://chromium.googlesource.com/chromiumos/third_party/zephyr/nanopb";
77-
rev = "refs/heads/main";
78-
hash = "sha256-qt9ey7dbuqxIAhc4BKm0EqkMusOdsuQZNppmaN4ZVfA=";
79-
};
80-
8153
u-boot = pkgs.fetchgit {
8254
name = "u-boot";
8355
url = "https://chromium.googlesource.com/chromiumos/third_party/u-boot";
8456
rev = "refs/heads/upstream/next";
8557
hash = "sha256-h5y0M1dupdO9CNG+OhUYi56UXsWAL5B0PTnhx+gU3FA=";
8658
fetchSubmodules = false;
8759
};
88-
89-
depot_tools = pkgs.fetchgit {
90-
name = "depot_tools";
91-
url = "https://chromium.googlesource.com/chromium/tools/depot_tools";
92-
rev = "84edf22d0e5bf3f9ae60714ed9789fd62f86cf2a";
93-
hash = "sha256-3t03DdZ+dRen1z3PTyGt2rDPHIHTe+qS8ek/bH4kuKo=";
94-
};
9560
in rec {
9661
formatter = pkgs.alejandra;
9762

@@ -101,49 +66,24 @@
10166
name = "lotus";
10267

10368
srcs = [
104-
pyelftools
105-
crosutils
10669
ec
10770
cmsis
108-
hal_stm32
10971
zephyr
110-
nanopb
111-
u-boot
112-
depot_tools
11372
];
11473

11574
sourceRoot = ".";
11675

117-
# TODO: see how much of the below we can remove and still get a build.
11876
postPatch = ''
11977
mkdir .repo
12078
121-
mkdir -p chromite/third_party
122-
mv pyelftools chromite/third_party/pyelftools
123-
124-
mkdir -p src
125-
mv crosutils src/scripts
126-
12779
mkdir -p src/platform
12880
mv ec src/platform/ec
12981
13082
mkdir -p src/third_party/zephyr
13183
mv cmsis src/third_party/zephyr/cmsis
13284
133-
mkdir -p src/third_party/zephyr
134-
mv hal_stm32 src/third_party/zephyr/hal_stm32
135-
13685
mkdir -p src/third_party/zephyr
13786
mv zephyr src/third_party/zephyr/main
138-
139-
mkdir -p src/third_party/zephyr
140-
mv nanopb src/third_party/zephyr/nanopb
141-
142-
mkdir -p src/third_party/u-boot
143-
mv u-boot src/third_party/u-boot/files
144-
145-
mkdir -p src/chromium
146-
mv depot_tools src/chromium/depot_tools
14787
'';
14888

14989
nativeBuildInputs = [
@@ -164,10 +104,13 @@
164104
buildPhase = ''
165105
${packages.zmake}/bin/zmake -j8 build lotus -DCMAKE_MAKE_PROGRAM="${pkgs.ninja}/bin/ninja" -DBUILD_VERSION=awawa
166106
'';
107+
167108
installPhase = ''
168109
mkdir $out
169110
cp src/platform/ec/build/zephyr/lotus/output/* $out/
170111
'';
112+
113+
dontFixup = true;
171114
};
172115

173116
packages.zmake = pythonPkgs.buildPythonPackage {
@@ -177,10 +120,12 @@
177120
pyproject = true;
178121
build-system = [pythonPkgs.setuptools];
179122

180-
# The DYLD_LIBRARY_PATH part here is only needed for Darwin, but it
181-
# doesn't harm Linux. TODO: don't do on Linux.
182123
postPatch = ''
183-
sed -e 's#"/bin:/usr/bin"#"/bin:/usr/bin:${pkgs.gcc}/bin:${pkgs.dtc}/bin","DYLD_LIBRARY_PATH":"${pkgs.dtc}/lib"#' -i zmake/jobserver.py
124+
sed -e 's#"/bin:/usr/bin"#"/bin:/usr/bin:${pkgs.gcc}/bin:${pkgs.dtc}/bin"${
125+
if pkgs.stdenv.hostPlatform.isDarwin then
126+
'',"DYLD_LIBRARY_PATH":"${pkgs.dtc}/lib"''
127+
else ""
128+
}#' -i zmake/jobserver.py
184129
'';
185130
};
186131

0 commit comments

Comments
 (0)