Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dagger package #3

Merged
merged 2 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,28 @@

<!-- Remove this if you don't use github actions -->
![Build and populate cache](https://github.com/dagger/nix/workflows/Build%20and%20populate%20cache/badge.svg)

## Usage

### As flake

```nix
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
dagger.url = "github:dagger/nix";
dagger.inputs.nixpkgs.follows = "nixpkgs";
};

outputs = { self, nixpkgs, flake-utils, dagger, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in {
devShell = pkgs.mkShell {
buildInputs = [ dagger.packages.dagger ];
};
});
}
```
2 changes: 2 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@
lib = import ./lib { inherit pkgs; }; # functions
modules = import ./modules; # NixOS modules
overlays = import ./overlays; # nixpkgs overlays

dagger = pkgs.callPackage ./pkgs/dagger { };
}
62 changes: 62 additions & 0 deletions pkgs/dagger/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# This file was generated by GoReleaser. DO NOT EDIT.
# vim: set ft=nix ts=2 sw=2 sts=2 et sta
{ system ? builtins.currentSystem
, pkgs
, lib
, fetchurl
, installShellFiles
}:
let
shaMap = {
x86_64-linux = "sha256-eDRJko8SRX2mba2RwJt2dxF4i3OW5YFLfFoXenSdQrU=";
aarch64-linux = "sha256-slUkiu7gv/6tp613yee2ess2+SPlbIcaCQwfzIvUk5E=";
x86_64-darwin = "sha256-VP1G70aoXcLeXjyAy/t5MOet9LpORIHiwu1t0Q/7f0g=";
aarch64-darwin = "sha256-2zlxEVrY0uRmtq80/xCWEEFyCSngSNSNqrjQEb8cZmY=";
};

urlMap = {
x86_64-linux = "https://dl.dagger.io/dagger/releases/0.9.1/dagger_v0.9.1_linux_amd64.tar.gz";
aarch64-linux = "https://dl.dagger.io/dagger/releases/0.9.1/dagger_v0.9.1_linux_arm64.tar.gz";
x86_64-darwin = "https://dl.dagger.io/dagger/releases/0.9.1/dagger_v0.9.1_darwin_amd64.tar.gz";
aarch64-darwin = "https://dl.dagger.io/dagger/releases/0.9.1/dagger_v0.9.1_darwin_arm64.tar.gz";
};
in
pkgs.stdenv.mkDerivation {
pname = "dagger";
version = "0.9.1";
src = fetchurl {
url = urlMap.${system};
sha256 = shaMap.${system};
};

sourceRoot = ".";

nativeBuildInputs = [ installShellFiles ];

installPhase = ''
mkdir -p $out/bin
cp dagger $out/bin/
'';

postInstall = ''
installShellCompletion --cmd dagger \
--bash <($out/bin/dagger completion bash) \
--fish <($out/bin/dagger completion fish) \
--zsh <($out/bin/dagger completion zsh)
'';

system = system;

meta = {
description = "A programmable CI/CD engine that runs your pipelines in containers";
homepage = "https://dagger.io";
license = lib.licenses.asl20;

platforms = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
};
}