-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Nix environment #1335
Merged
Merged
Support Nix environment #1335
Changes from 4 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
0528b3b
Nix setup for Makefile build
r-burns a40e63d
Modify nix files for ninja/dtk build
r-burns f3c497d
Allow specifying prebuilt dtk binary
r-burns c652400
Merge branch 'master' into nix-files
ribbanya 0baa382
Fix compiler zip url
r-burns 2a8a642
Rename nix/ to .nix/
r-burns b114b11
Add Nix CI workflow
r-burns 6bdc424
test
ribbanya 55d87dc
test
ribbanya cec8b5f
minor cleanup
ribbanya c4873aa
why did it break
ribbanya c90edf1
bourne again shell
ribbanya d2b9cbf
eoux
ribbanya f55c532
idk whatever
ribbanya e7ce0be
oh wait
ribbanya cad2282
add condition
ribbanya c0f67bf
merge workflows
ribbanya 982b96c
Merge branch 'master' into nix-files
ribbanya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import ./nix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[*.nix] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ lib | ||
, fetchFromGitHub | ||
, git | ||
, rustPlatform | ||
, stdenv | ||
}: | ||
|
||
rustPlatform.buildRustPackage rec { | ||
pname = "decomp-toolkit"; | ||
version = "0.7.3"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "encounter"; | ||
repo = "decomp-toolkit"; | ||
rev = "v${version}"; | ||
hash = "sha256-cpHaoxRr/Lyx6tpyUx7Sm+9h0BicrO+jVJA09BBgKJ4="; | ||
}; | ||
|
||
nativeBuildInputs = [ | ||
git | ||
]; | ||
|
||
cargoLock.lockFile = "${src}/Cargo.lock"; | ||
cargoLock.outputHashes."ar-0.8.0" = "sha256-OLyo+cRRWMsI1i8NsgsBKRJH1XsKW1CculQnJ/wcya0="; | ||
cargoLock.outputHashes."dol-0.1.0" = "sha256-YfMXWNtmZJhK39R3w98DEGm4y9x59osFGliG36BcuLU="; | ||
|
||
meta = with lib; { | ||
description = "A GameCube & Wii decompilation toolkit"; | ||
homepage = "https://github.com/encounter/decomp-toolkit"; | ||
license = with licenses; [ asl20 mit ]; | ||
maintainers = with maintainers; [ r-burns ]; | ||
mainProgram = "dtk"; | ||
}; | ||
} |
r-burns marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
sources ? import ./sources.nix, | ||
}: | ||
let | ||
pkgs = import sources.nixpkgs { | ||
overlays = [ | ||
(self: super: { | ||
decomp-toolkit = super.callPackage ./decomp-toolkit.nix {}; | ||
devkitppc = super.callPackage ./devkitppc.nix {}; | ||
mwcc = super.callPackage ./mwcc.nix {}; | ||
wibo = super.pkgsi686Linux.callPackage ./wibo.nix {}; | ||
}) | ||
]; | ||
}; | ||
in | ||
|
||
pkgs.callPackage ./melee.nix {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ stdenvNoCC, lib | ||
, buildEnv | ||
, fetchFromGitHub | ||
, fetchpatch | ||
, makeWrapper | ||
, overrideCC | ||
, pkgsCross | ||
}: | ||
|
||
let | ||
version = "43"; | ||
|
||
tag = "devkitPPC_r${version}"; | ||
|
||
ppcCrossBinutils = pkgsCross.ppc-embedded.buildPackages.binutils-unwrapped; | ||
|
||
bintools' = ppcCrossBinutils.overrideAttrs (oa: { | ||
patches = oa.patches ++ [ | ||
(fetchpatch { | ||
url = "https://raw.githubusercontent.com/devkitPro/buildscripts/${tag}/dkppc/patches/binutils-${oa.version}.patch"; | ||
hash = "sha256-IOqa20LQYBxfR1KKxkp0hVV21CKd9IZrvNeEyuW09us="; | ||
}) | ||
]; | ||
}); | ||
in | ||
stdenvNoCC.mkDerivation { | ||
pname = "devkitppc"; | ||
inherit version; | ||
nativeBuildInputs = [ | ||
makeWrapper | ||
]; | ||
buildCommand = '' | ||
for bindir in '${lib.getBin bintools'}/bin'; do | ||
cd "$bindir" | ||
for f in powerpc-none-eabi-*; do | ||
short="$(echo "$f" | sed s/powerpc-none-eabi-/powerpc-eabi-/)" | ||
makeWrapper "$bindir/$f" "$out/bin/$short" | ||
done | ||
done | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ lib | ||
, stdenv | ||
, decomp-toolkit | ||
, devkitppc | ||
, fetchurl | ||
, mwcc | ||
, ninja | ||
, python3 | ||
, wibo | ||
}: | ||
let | ||
sjiswrap = fetchurl { | ||
url = "https://github.com/encounter/sjiswrap/releases/download/v1.1.1/sjiswrap-windows-x86.exe"; | ||
hash = "sha256-J6PF1PJj5OuW5WGc/Noi9F0zzNEhEEx/9qN+FbP0J80="; | ||
}; | ||
in | ||
stdenv.mkDerivation { | ||
name = "doldecomp-melee"; | ||
|
||
src = lib.cleanSourceWith { | ||
filter = name: type: let | ||
basename = baseNameOf (toString name); | ||
in !(false | ||
|| basename == "build" | ||
|| basename == "expected" | ||
|| lib.hasSuffix ".nix" basename | ||
|| lib.hasSuffix ".dump" basename | ||
|| lib.hasSuffix ".o" basename | ||
); | ||
src = lib.cleanSource ../.; | ||
}; | ||
|
||
shellHook = '' | ||
runHook postPatch | ||
''; | ||
|
||
nativeBuildInputs = [ | ||
decomp-toolkit | ||
devkitppc | ||
ninja | ||
python3 | ||
wibo | ||
]; | ||
|
||
configurePhase = '' | ||
runHook preConfigure | ||
python3 ./configure.py --wrapper ${wibo}/bin/wibo \ | ||
--build-dtk ${decomp-toolkit}/bin/dtk \ | ||
--sjiswrap ${sjiswrap} \ | ||
--compilers ${mwcc} | ||
runHook postConfigure | ||
''; | ||
|
||
enableParallelBuilding = true; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out | ||
cp build/GALE01/main.dol $out/ | ||
runHook postInstall | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ lib | ||
, stdenv | ||
, fetchzip | ||
}: | ||
stdenv.mkDerivation { | ||
name = "GC_WII_COMPILERS"; | ||
src = fetchzip { | ||
url = "https://cdn.discordapp.com/attachments/727918646525165659/1129759991696457728/GC_WII_COMPILERS.zip"; | ||
stripRoot = false; | ||
sha256 = "sha256-IX3byvEUVJB6Rmc+NqO9ZNt1jl95nQpEIqxbHI+uUio="; | ||
}; | ||
# Patch 1.1 linker to not read garbage from stack. | ||
# Fixes random crashes under wibo. | ||
postPatch = '' | ||
printf '\x51' | dd of=GC/1.1/mwldeppc.exe bs=1 seek=130933 count=1 conv=notrunc | ||
''; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
cp -r . $out/ | ||
runHook postInstall | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
sources ? import ./sources.nix, | ||
}: | ||
let | ||
pkgs = import sources.nixpkgs { | ||
overlays = [ | ||
(self: super: { | ||
decomp-toolkit = super.callPackage ./decomp-toolkit.nix {}; | ||
devkitppc = super.callPackage ./devkitppc.nix {}; | ||
mwcc = super.callPackage ./mwcc.nix {}; | ||
wibo = super.pkgsi686Linux.callPackage ./wibo.nix {}; | ||
}) | ||
]; | ||
}; | ||
|
||
melee = import ./default.nix { inherit sources; }; | ||
in | ||
|
||
melee.overrideAttrs (oa: { | ||
nativeBuildInputs = oa.nativeBuildInputs ++ [ | ||
(pkgs.clang-tools.override { | ||
llvmPackages = pkgs.llvmPackages_15; | ||
}) | ||
pkgs.clang.cc.python | ||
]; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"nixpkgs": { | ||
"branch": "nixos-unstable", | ||
"description": "Nix Packages collection", | ||
"homepage": "", | ||
"owner": "NixOS", | ||
"repo": "nixpkgs", | ||
"rev": "73de017ef2d18a04ac4bfd0c02650007ccb31c2a", | ||
"sha256": "1v9sy2i2dy3qksx4mf81gwzfl0jzpqccfkzq7fjxgq832f9d255i", | ||
"type": "tarball", | ||
"url": "https://github.com/NixOS/nixpkgs/archive/73de017ef2d18a04ac4bfd0c02650007ccb31c2a.tar.gz", | ||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to exist? Like when I source Python, I do:
. ./.venv/bin/activate
Or when I source vimrc I do
:source tools/vimc
Can this file be removed and your local command updated accordingly?