Skip to content

Commit

Permalink
add nix flake configuration
Browse files Browse the repository at this point in the history
Introduce `flake.nix` and `flake.lock` to support building the Rust
project using the Nix flakes system. This includes specifying
dependencies, using the nightly Rust toolchain, and setting up necessary
build inputs such as OpenSSL.
  • Loading branch information
keinsell committed Jan 27, 2025
1 parent ede3f09 commit 1a75a87
Show file tree
Hide file tree
Showing 10 changed files with 5,544 additions and 2 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,31 @@ jobs:
target/${{ matrix.target }}/release/neuronek-cli
target/${{ matrix.target }}/release/neuronek-cli.exe
nix_build:
name: "Nix Build"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4

# Install Nix
- uses: cachix/install-nix-action@v24
with:
nix_path: nixpkgs=channel:nixos-unstable

# Build with Nix
- name: Build with Nix
run: nix build

# Optional: Run tests
- name: Run Nix tests
run: nix flake check

# Optional: Save build result as artifact
- name: Upload build result
uses: actions/upload-artifact@v3
with:
name: nix-build-result
path: ./result

# Disabled until automatic versioning will be configured
# cargo_release:
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -335,3 +335,25 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive

nix_package:
needs: [plan]
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4

# Install Nix
- uses: cachix/install-nix-action@v24
with:
nix_path: nixpkgs=channel:nixos-unstable

# Build package
- name: Build Nix package
run: nix build .#packages.x86_64-linux.default

# Upload package
- name: Upload Nix package
uses: actions/upload-artifact@v3
with:
name: nix-package
path: ./result
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk
Expand Down
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Contribution Guidelines

```
# Enter development shell
nix develop
# Build project
nix build
# Run continuous checks
bacon
```
Loading

0 comments on commit 1a75a87

Please sign in to comment.