diff --git a/.github/workflows/package-nix.yaml b/.github/workflows/package-nix.yaml new file mode 100644 index 00000000..c7498cce --- /dev/null +++ b/.github/workflows/package-nix.yaml @@ -0,0 +1,24 @@ +name: Nix Package + +on: workflow_dispatch + +permissions: + contents: read + +jobs: + build-nix: + name: build-nix (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04, ubuntu-22.04-arm, macos-13, macos-14] + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Install Nix + uses: cachix/install-nix-action@v30 + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + - name: Build in Nix development shell + run: nix develop -c gradle jpackage diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..1811be24 --- /dev/null +++ b/flake.lock @@ -0,0 +1,69 @@ +{ + "nodes": { + "devshell": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1735644329, + "narHash": "sha256-tO3HrHriyLvipc4xr+Ewtdlo7wM1OjXNjlWRgmM7peY=", + "owner": "numtide", + "repo": "devshell", + "rev": "f7795ede5b02664b57035b3b757876703e2c3eac", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1738453229, + "narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1739866667, + "narHash": "sha256-EO1ygNKZlsAC9avfcwHkKGMsmipUk1Uc0TbrEZpkn64=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "73cf49b8ad837ade2de76f87eb53fc85ed5d4680", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "devshell": "devshell", + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..7501d579 --- /dev/null +++ b/flake.nix @@ -0,0 +1,36 @@ +{ + description = "Sparrow Wallet Nix Flake (Development Shell only, for now)"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + flake-parts = { + url = "github:hercules-ci/flake-parts"; + inputs.nixpkgs-lib.follows = "nixpkgs"; + }; + + devshell = { + url = "github:numtide/devshell"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = inputs @ { flake-parts, devshell, ... }: + flake-parts.lib.mkFlake {inherit inputs;} { + systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + + perSystem = { config, self', inputs', pkgs, system, lib, ... }: let + inherit (pkgs) stdenv; + in { + # define default devshell + devShells.default = pkgs.mkShell { + packages = with pkgs ; [ + jdk23 # This JDK will be in PATH + (gradle.override { # Gradle 8.x (Nix package) runs using an internally-linked JDK + java = jdk23; # Run Gradle with this JDK + }) + ]; + }; + }; + }; +}