Skip to content

Commit 16c5472

Browse files
committed
Basic Nix-based build using nix develop -c gradle jpackage
This is not a full (i.e. isolated, reproducible) Nix build, but does verify that the Nix devShell in `flake.nix` works and that we can successfully build Sparrow with Gradle and JDK provided by Nix.
1 parent 2253a1b commit 16c5472

File tree

3 files changed

+125
-2
lines changed

3 files changed

+125
-2
lines changed

.github/workflows/package.yaml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ permissions:
66
contents: read
77

88
jobs:
9-
build:
9+
gradle_jpackage:
10+
name: jpackage ${{ matrix.os }}
1011
runs-on: ${{ matrix.os }}
1112
strategy:
1213
matrix:
@@ -53,4 +54,21 @@ jobs:
5354
name: Sparrow Build - ${{ runner.os }} ${{ runner.arch }} Headless
5455
path: |
5556
build/jpackage/*
56-
!build/jpackage/Sparrow/
57+
!build/jpackage/Sparrow/
58+
59+
nix_jpackage:
60+
name: jpackage Nix ${{ matrix.os }}
61+
runs-on: ${{ matrix.os }}
62+
strategy:
63+
matrix:
64+
os: [ubuntu-22.04, ubuntu-22.04-arm, macos-13, macos-14]
65+
steps:
66+
- uses: actions/checkout@v4
67+
with:
68+
submodules: true
69+
- name: Install Nix
70+
uses: cachix/install-nix-action@v30
71+
with:
72+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
73+
- name: Build in Nix development shell
74+
run: nix develop -c gradle jpackage

flake.lock

Lines changed: 69 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
description = "Sparrow Wallet Nix Flake (Development Shell only, for now)";
3+
4+
inputs = {
5+
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
6+
7+
flake-parts = {
8+
url = "github:hercules-ci/flake-parts";
9+
inputs.nixpkgs-lib.follows = "nixpkgs";
10+
};
11+
12+
devshell = {
13+
url = "github:numtide/devshell";
14+
inputs.nixpkgs.follows = "nixpkgs";
15+
};
16+
};
17+
18+
outputs = inputs @ { flake-parts, devshell, ... }:
19+
flake-parts.lib.mkFlake {inherit inputs;} {
20+
systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
21+
22+
perSystem = { config, self', inputs', pkgs, system, lib, ... }: let
23+
inherit (pkgs) stdenv;
24+
in {
25+
# define default devshell
26+
devShells.default = pkgs.mkShell {
27+
packages = with pkgs ; [
28+
jdk23 # This JDK will be in PATH
29+
(gradle.override { # Gradle 8.x (Nix package) runs using an internally-linked JDK
30+
java = jdk23; # Run Gradle with this JDK
31+
})
32+
];
33+
};
34+
};
35+
};
36+
}

0 commit comments

Comments
 (0)