-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nix lets anyone build this glorious repo without even cloning it.
- Loading branch information
Showing
8 changed files
with
225 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
target/ | ||
*.falsemetal | ||
*.joeydecaio | ||
/result |
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,47 @@ | ||
{ | ||
jre, | ||
jdk, | ||
makeWrapper, | ||
maven, | ||
}: | ||
|
||
maven.buildMavenPackage { | ||
pname = "it.nanowar.ofsteel.helloworld"; | ||
version = "0.0.1"; | ||
src = ./.; | ||
|
||
mvnHash = "sha256-QVRwMC4FREgwojlX5JzTap2eg7HPFNgElIeCVycPOAI="; | ||
|
||
buildInputs = [ jre ]; | ||
nativeBuildInputs = [ jdk makeWrapper maven ]; | ||
|
||
installPhase = '' | ||
mkdir -p $out/bin $out/share/HelloWorld | ||
jar="$(echo target/HelloWorld-*.jar)" | ||
install -Dm644 "$jar" $out/share/HelloWorld | ||
makeWrapper ${jre}/bin/java $out/bin/HelloWorld \ | ||
--add-flags "-cp $out/share/HelloWorld/$(basename -- "$jar")" \ | ||
--add-flags "it.nanowar.ofsteel.helloworld.HelloWorldMainLauncherClass" | ||
''; | ||
|
||
doInstallCheck = true; | ||
installCheckPhase = '' | ||
result="$({ $out/bin/HelloWorld || true; } 2>&1)" | ||
echo "Result:" >&2 | ||
echo "--------" >&2 | ||
echo "$result" >&2 | ||
echo "--------" >&2 | ||
if [ "$(echo "$result" | grep 'Hello World!' | wc -l)" != 4 ]; then | ||
echo "Incorrect number of hello world lines" >&2 | ||
exit 1 | ||
fi | ||
if [ -z "$(echo "$result" | grep NullPointerException | grep joeyDeCaio)" ]; then | ||
echo "Program should have failed with the correct error message" >&2 | ||
exit 1 | ||
fi | ||
''; | ||
} |
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,13 @@ | ||
(import | ||
( | ||
let | ||
lock = builtins.fromJSON (builtins.readFile ./flake.lock); | ||
nodeName = lock.nodes.root.inputs.flake-compat; | ||
in | ||
fetchTarball { | ||
url = lock.nodes.${nodeName}.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.${nodeName}.locked.rev}.tar.gz"; | ||
sha256 = lock.nodes.${nodeName}.locked.narHash; | ||
} | ||
) | ||
{ src = ./.; } | ||
).defaultNix |
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 @@ | ||
{ | ||
mkShell, | ||
HelloWorld, | ||
cowsay | ||
}: | ||
|
||
mkShell { | ||
inherit (HelloWorld) pname version; | ||
inputsFrom = [ HelloWorld ]; | ||
buildInputs = [ cowsay ]; | ||
shellHook = '' | ||
echo "nanowar of steel rulez" | cowsay -f dragon >&2 | ||
''; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,33 @@ | ||
{ | ||
description = "https://www.youtube.com/watch?v=yup8gIXxWDU"; | ||
inputs = { | ||
flake-parts.url = "github:hercules-ci/flake-parts"; | ||
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"; | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; | ||
}; | ||
outputs = | ||
inputs@{ flake-parts, ... }: | ||
flake-parts.lib.mkFlake { inherit inputs; } { | ||
systems = [ | ||
"x86_64-linux" | ||
"aarch64-linux" | ||
"aarch64-darwin" | ||
"x86_64-darwin" | ||
]; | ||
perSystem = | ||
{ | ||
config, | ||
self', | ||
inputs', | ||
pkgs, | ||
system, | ||
... | ||
}: | ||
rec { | ||
packages.default = pkgs.callPackage ./build.nix { }; | ||
devShells.default = pkgs.callPackage ./develop.nix { | ||
HelloWorld = packages.default; | ||
}; | ||
}; | ||
}; | ||
} |
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,13 @@ | ||
(import | ||
( | ||
let | ||
lock = builtins.fromJSON (builtins.readFile ./flake.lock); | ||
nodeName = lock.nodes.root.inputs.flake-compat; | ||
in | ||
fetchTarball { | ||
url = lock.nodes.${nodeName}.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.${nodeName}.locked.rev}.tar.gz"; | ||
sha256 = lock.nodes.${nodeName}.locked.narHash; | ||
} | ||
) | ||
{ src = ./.; } | ||
).shellNix |