Skip to content
Snippets Groups Projects
Commit be9aaae5 authored by Eduardo Trujillo's avatar Eduardo Trujillo
Browse files

feat(nix): Switch to Nix for builds

parent a1d200d6
No related branches found
No related tags found
1 merge request!5feat(nix): Switch to Nix for builds
Pipeline #645 failed
......@@ -5,15 +5,15 @@ stages:
- test
.rust_template: &rust_template
tags:
- nix
before_script:
- export CARGO_HOME="$CI_PROJECT_DIR/cargo"
- rustup --version
- rustc --version
- cargo --version
- nix develop -c rustc --version
- nix develop -c cargo --version
rust-nightly:
stage: build
image: rustlang/rust:nightly
needs: []
cache:
key: "$CI_COMMIT_REF_SLUG"
......@@ -22,11 +22,10 @@ rust-nightly:
- target/
<<: *rust_template
script:
- cargo build --verbose
- nix develop -c cargo build --verbose
rust-nightly-test:
stage: test
image: rustlang/rust:nightly
needs:
- rust-nightly
cache:
......@@ -37,11 +36,10 @@ rust-nightly-test:
policy: pull
<<: *rust_template
script:
- cargo test --verbose -j 1
- nix develop -c cargo test --verbose -j 1
rust-nightly-fmt:
stage: format
image: rustlang/rust:nightly
needs: []
cache:
key: "$CI_COMMIT_REF_SLUG"
......@@ -51,11 +49,10 @@ rust-nightly-fmt:
policy: pull
<<: *rust_template
script:
- cargo fmt --all --verbose -- --check
- nix develop -c cargo fmt --all --verbose -- --check
rust-nightly-clippy:
stage: lint
image: rustlang/rust:nightly
needs:
- rust-nightly
cache:
......@@ -65,11 +62,10 @@ rust-nightly-clippy:
- target/
<<: *rust_template
script:
- cargo clippy --all --tests --verbose -- -D warnings
- nix develop -c cargo clippy --all --tests --verbose -- -D warnings
pages:
stage: build
image: rustlang/rust:nightly
needs:
- rust-nightly
cache:
......@@ -80,10 +76,10 @@ pages:
policy: pull
<<: *rust_template
script:
- cargo doc --no-deps
- nix develop -c cargo doc --no-deps
- rm -rf public
- mkdir public
- cp -R target/doc/* public
artifacts:
paths:
- public
\ No newline at end of file
- public
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"naersk": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1736429655,
"narHash": "sha256-BwMekRuVlSB9C0QgwKMICiJ5EVbLGjfe4qyueyNQyGI=",
"owner": "nix-community",
"repo": "naersk",
"rev": "0621e47bd95542b8e1ce2ee2d65d6a1f887a13ce",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "naersk",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1737370608,
"narHash": "sha256-hFA6SmioeqvGW/XvZa9bxniAeulksCOcj3kokdNT/YE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "300081d0cc72df578b02d914df941b8ec62240e6",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1737299813,
"narHash": "sha256-Qw2PwmkXDK8sPQ5YQ/y/icbQ+TYgbxfjhgnkNJyT1X8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "107d5ef05c0b1119749e381451389eded30fb0d5",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"naersk": "naersk",
"nixpkgs": "nixpkgs_2"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
};
outputs = {
self,
flake-utils,
naersk,
nixpkgs,
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = (import nixpkgs) {
inherit system;
};
naersk' = pkgs.callPackage naersk {};
in {
defaultPackage = naersk'.buildPackage {
src = ./.;
buildInputs = with pkgs; [];
nativeBuildInputs = with pkgs; [ pkg-config ];
};
devShell = pkgs.mkShell {
buildInputs = with pkgs; [];
nativeBuildInputs = with pkgs; [
rustc
cargo
rustfmt
rust-analyzer
pkg-config
clippy
cargo-tarpaulin
];
};
formatter = nixpkgs.legacyPackages.${system}.alejandra;
}
);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment