-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added nix flake Signed-off-by: emilpriver <[email protected]>
- Loading branch information
1 parent
688bb3c
commit 8552462
Showing
8 changed files
with
160 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Nix | ||
|
||
on: | ||
pull_request: | ||
push: | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup | ||
run: | | ||
sudo apt-get install -y mariadb-client postgresql-client | ||
- name: Databases | ||
run: docker compose up -d | ||
- name: Run tests | ||
run: cargo test --verbose | ||
nix: | ||
needs: [test] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: cachix/install-nix-action@v25 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
- name: Databases | ||
run: docker compose up -d | ||
- name: Nix flake check | ||
run: nix flake check | ||
- name: Test nix build | ||
run: | | ||
nix run . -- --help | grep -q "Usage: geni <COMMAND>" || exit 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,4 +177,3 @@ jobs: | |
env: | ||
GITHUN_REF_NAME: ${{github.ref_name}} | ||
run: bash scripts/update-homebrew-geni-formula.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ example.db | |
*.sqlite3 | ||
/tmp/ | ||
scripts/migrations | ||
result |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ pkgs ? import <nixpkgs> {} }: | ||
let manifest = (pkgs.lib.importTOML ./Cargo.toml).package; | ||
in pkgs.rustPlatform.buildRustPackage rec { | ||
pname = "geni"; | ||
version = manifest.version; | ||
cargoLock.lockFile = ./Cargo.lock; | ||
src = pkgs.lib.sources.cleanSource ./.; | ||
# The test is running before we build nix | ||
doCheck = false; | ||
|
||
buildPhase = '' | ||
cargo build --release --locked | ||
''; | ||
|
||
installPhase = '' | ||
mkdir -p $out/bin | ||
cp target/release/geni $out/bin/ | ||
''; | ||
|
||
meta = with pkgs.lib; { | ||
description = manifest.description; | ||
longDescription = '' | ||
Standalone database migration tool which works for Postgres, MariaDB, MySQL, Sqlite and LibSQL(Turso). | ||
''; | ||
homepage = manifest.repository; | ||
changelog = "${manifest.repository}/releases/tag/v${version}"; | ||
license = licenses.mit; | ||
maintainers = [ maintainers.emilpriver ]; | ||
platforms = platforms.all; | ||
}; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
description = "A very basic flake"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # We want to use packages from the binary cache | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
}; | ||
|
||
outputs = inputs@{ self, nixpkgs, flake-utils, ... }: | ||
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: let | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
in rec { | ||
packages.geni = pkgs.callPackage ./default.nix { }; | ||
|
||
legacyPackages = packages; | ||
|
||
defaultPackage = packages.geni; | ||
|
||
devShell = pkgs.mkShell { | ||
CARGO_INSTALL_ROOT = "${toString ./.}/.cargo"; | ||
|
||
buildInputs = with pkgs; [ cargo rustc git ]; | ||
}; | ||
}); | ||
} |