Oni fails to build reliably
Opened this issue · 0 comments
Hi there!
Firstly - thanks for your work on this package - it's really helping in porting Oni to work on NixOS.
I am, however, having problems building Oni properly using the following:
oni.nix
self: super:
{
yarn2nix = super.callPackage ( builtins.fetchTarball {
url = "https://github.com/moretea/yarn2nix/archive/8a6b9dcf7cef8840eb7bc64d7639bad566af2e9d.tar.gz";
sha256 = "0ih11vcd9ad5y13877bxz7ijsykhqwdfwmvwhic3xlgcdhxji80v";
}) {};
oni = self.yarn2nix.mkYarnPackage rec {
name = "oni";
version = "0.3.7-beta3";
src = super.fetchFromGitHub {
owner = "onivim";
repo = "oni";
rev = "v${version}";
sha256 = "0kd8m17war8wsm7v8qwkdx2756y43lmj4i0xv7g2m40hl7idihd1";
};
patches = [
./browser_tsconfig.patch
./git_plugin_tsignore.patch
./yarn_classnames.patch
];
nativeBuildInputs = with super; [ python xorg.libxkbfile xorg.libX11 ];
# this is needed because the yarn.lock file is read before normal patching runs
yarnLock = super.runCommand "yarn.lock" {} ''
patch ${src}/yarn.lock -p1 -o - < ${./yarn_classnames.patch} > $out
'';
buildPhase = ''
${super.yarn}/bin/yarn run build
'';
postInstall = ''
cat <<EOF > $out/bin/oni
#!${super.bash}/bin/bash
PATH=${super.stdenv.lib.makeBinPath [ self.electron-oni super.neovim super.nodejs super.python super.ripgrep ] }
electron "$out/libexec/${name}/deps/${name}/lib/main/src/main.js"
EOF
chmod +x $out/bin/oni
'';
};
}
browser_tsconfig.patch
This patch allows the browser to compile successfully - without it the build fails.
--- a/browser/tsconfig.json
+++ b/browser/tsconfig.json
@@ -9,9 +9,7 @@
"module": "esnext",
"moduleResolution": "node",
"newLine": "LF",
- "noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
- "noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
git_plugin_tsignore.patch
This patch ignores the ts linting and allows the compilation of this plugin to succeed.
--- a/vim/core/oni-plugin-git/src/index.tsx
+++ b/vim/core/oni-plugin-git/src/index.tsx
@@ -129,6 +129,7 @@
"-L",
`${args.lineOne},${args.lineTwo}`,
]
+ // @ts-ignore
const raw = await this._git(this._projectRoot).raw(cmd)
return this._formatRawBlame(raw)
} catch (e) {
@@ -140,6 +141,7 @@
public unstage = async (files: string[]) => {
const flags = ["HEAD", ...files]
try {
+ // @ts-ignore
await this._git(this._projectRoot).reset(flags)
const changed = files.map(path => ({ path, status: VCS.Statuses.modified }))
this._onFileStatusChanged.dispatch(changed)
@@ -150,6 +152,7 @@
public uncommit = async (sha?: string) => {
try {
+ // @ts-ignore
await this._git(this._projectRoot).reset(["--soft", "HEAD^"])
this._onFileStatusChanged.dispatch()
} catch (e) {
@@ -177,6 +180,7 @@
public commitFiles = async (message: string[], files?: string[]): Promise<VCS.Commits> => {
try {
+ // @ts-ignore
const commit = await this._git(this._projectRoot).commit(message, files)
const changed = (files || []).map(file => ({
path: file,
yarn_classnames.patch
Added fix allowing all sources to be fetched properly by yarn2nix.
--- a/yarn.lock
+++ b/yarn.lock
@@ -2305,7 +2301,7 @@
classnames@^2.2.3, classnames@^2.2.5:
version "2.2.5"
- resolved "https://codeload.github.com/JedWatson/classnames/tar.gz/34a05a53d31d35879ec7088949ae5a1b2224043a"
+ resolved "https://codeload.github.com/JedWatson/classnames/tar.gz/34a05a53d31d35879ec7088949ae5a1b2224043a#dc5d48c08eeffc4406102736457dac2273d6e389"
clean-css@4.1.x:
version "4.1.11"
When I try to build this way manually - it works just fine (with above patches applied) but when I try to do the same in Nix by using oni.nix above - all CPUs are maxed out and I run out of memory (~14GB total incl. swap) and then the build aborts.