Something went wrong. Try again.
Just a first repo to make sure I have tangled and everything set up correctly. I figured this would be a good way to say hello :)
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455{ description = "Java dev environment";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
outputs = { self, nixpkgs }: let systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f { pkgs = import nixpkgs { inherit system; }; }); in { packages = forAllSystems ({ pkgs }: { default = pkgs.stdenv.mkDerivation { pname = "hello-java"; version = "0.1.0"; src = ./.; nativeBuildInputs = [ pkgs.jdk ]; buildPhase = '' javac hello.java ''; installPhase = '' mkdir -p $out/share/java $out/bin cp hello.class $out/share/java/ cat > $out/bin/hello-java <<EOF #!${pkgs.bash}/bin/bash exec ${pkgs.jre}/bin/java -cp $out/share/java hello EOF chmod +x $out/bin/hello-java ''; }; });
devShells = forAllSystems ({ pkgs }: { default = pkgs.mkShell { packages = with pkgs; [ jdk gradle maven ];
JAVA_HOME = "${pkgs.jdk}"; }; });
apps = forAllSystems ({ pkgs }: { default = { type = "app"; program = "${self.packages.${pkgs.system}.default}/bin/hello-java"; }; }); };}