File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -254,6 +254,20 @@ jobs:
254254
255255 - name : Build Flake and show celq version
256256 run : nix run github:IvanIsCoding/celq -- --version
257+
258+ test-nix-flake-latest :
259+ name : Test Nix flake (latest) validity and run
260+ runs-on : ubuntu-24.04
261+ steps :
262+ - name : Install Nix
263+ uses : cachix/install-nix-action@v26
264+ with :
265+ nix_path : nixpkgs=channel:nixos-unstable
266+ extra_nix_config : |
267+ experimental-features = nix-command flakes
268+
269+ - name : Build Flake with latest version and show celq version
270+ run : nix run github:IvanIsCoding/celq#latest -- --version
257271
258272 test-freebsd-install :
259273 name : Test FreeBSD 14.3 (x86_64)
Original file line number Diff line number Diff line change 2222 {
2323 # Compiles from source with Cargo and installs celq. That part I understood!
2424 default = pkgs . callPackage ./nix/celq.nix { } ;
25+ # Latest version from HEAD
26+ latest = pkgs . callPackage ./nix/celq_latest.nix { } ;
2527 } ) ;
2628 } ;
2729}
Original file line number Diff line number Diff line change 1+ {
2+ lib ,
3+ rustPlatform ,
4+ fetchCrate ,
5+ versionCheckHook ,
6+ runCommand ,
7+ } :
8+
9+ let
10+ cargoToml = builtins . fromTOML ( builtins . readFile ../Cargo.toml ) ;
11+ in
12+
13+ rustPlatform . buildRustPackage ( finalAttrs : {
14+ pname = "celq" ;
15+ version = cargoToml . package . version ;
16+
17+ # Fetch from HEAD
18+ src = lib . cleanSource ../. ;
19+
20+ cargoLock = {
21+ lockFile = ../Cargo.lock ;
22+ allowBuiltinFetchGit = true ;
23+ } ;
24+
25+ nativeInstallCheckInputs = [
26+ versionCheckHook
27+ ] ;
28+
29+ passthru = {
30+ tests . simple =
31+ runCommand "celq-test"
32+ {
33+ nativeBuildInputs = [ finalAttrs . finalPackage ] ;
34+ }
35+ ''
36+ set -o pipefail
37+
38+ # Test the command `celq -n "1 > 0"`, which should return exit code 0
39+ if ! celq -n "1 > 0"; then
40+ echo "Test failed: celq can't execute simple expression"
41+ exit 1
42+ else
43+ echo "Test passed: celq executed simple expression successfully"
44+ fi
45+ '' ;
46+ } ;
47+
48+ meta = {
49+ description = "celq - A Common Expression Language (CEL) CLI Tool" ;
50+ homepage = "https://github.com/IvanIsCoding/celq" ;
51+ license = lib . licenses . mit ;
52+ mainProgram = "celq" ;
53+ platforms = lib . platforms . unix ;
54+ } ;
55+ } )
You can’t perform that action at this time.
0 commit comments