v0.2.0
ready-to-use pipeline and jobs for Nix projects.
Attributes
Includes Deno configuration
Current version released
a year ago
Nix Pipeline
A ready-to-use Nix pipeline for building projects with Nix.
🚀 Usage
Quick start:
import { GitLab } from "https://deno.land/x/nix_installer_pipeline/mod.ts";
const { pipeline } = GitLab;
pipeline.write(); // Write the pipeline to the file .gitlab-ci.yml
It will generate the following .gitlab-ci.yml
file:
# Do not edit this file directly. It is generated by Fluent GitLab CI
image: ubuntu:latest
before_script:
- apt update -y
- apt install curl -y
- curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install linux --extra-conf "sandbox = false" --init none --no-confirm
- export PATH="${PATH}:/nix/var/nix/profiles/default/bin"
- nix run nixpkgs#hello
This package also provides a Nix Installer for Dagger pipelines:
import Client, { connect } from "https://esm.sh/@dagger.io/dagger@0.6.3";
import { Dagger } from "https://deno.land/x/nix_installer_pipeline/mod.ts";
const { withNix } = Dagger;
connect(async (client: Client) => {
const ctr = withNix(
client
.pipeline("nix-installer")
.container()
.from("alpine")
.withExec(["apk", "add", "curl"])
);
const result = await ctr.stdout();
console.log(result);
});
🧪 Advanced Usage
You can also setup devbox, devenv or flox by importing withDevbox
, withDevenv
or withFlox
from nix_installer_pipeline
:
import Client, { connect } from "@dagger.io/dagger";
import { Dagger } from "https://deno.land/x/nix_installer_pipeline/mod.ts";
const { withDevbox, withNix } = Dagger;
connect(async (client: Client) => {
// you can use withDevbox, withDevenv or withFlox
const ctr = withDevbox(
withNix(
client
.pipeline("nix-installer")
.container()
.from("alpine")
.withExec(["apk", "add", "curl", "bash"])
)
);
const result = await ctr.stdout();
console.log(result);
});