Skip to content

Commit 1feb27a

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 1feb27a

File tree

3 files changed

+129
-0
lines changed

3 files changed

+129
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Nix Package
2+
3+
on: workflow_dispatch
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
nix_jpackage:
10+
name: jpackage Nix ${{ matrix.os }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-22.04, ubuntu-22.04-arm, macos-13, macos-14]
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
submodules: true
19+
- name: Install Nix
20+
uses: cachix/install-nix-action@v30
21+
with:
22+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
23+
- name: Build in Nix development shell
24+
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)