Skip to content

Nix devShell and Nix-based GitHub Actions build using nix develop #1648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/package-nix.yaml
Original file line number Diff line number Diff line change
@@ -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
69 changes: 69 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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
})
];
};
};
};
}