Skip to main content
The Deno 2 Release Candidate is here
Learn more

Nix Pipeline

deno module deno compatibility

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);
});