Skip to content

Commit

Permalink
Add Dagger package (#3)
Browse files Browse the repository at this point in the history
* add dagger package

Signed-off-by: Mark Sagi-Kazar <[email protected]>

* add usage example to readme

Signed-off-by: Mark Sagi-Kazar <[email protected]>

---------

Signed-off-by: Mark Sagi-Kazar <[email protected]>
  • Loading branch information
sagikazarmark authored Oct 27, 2023
1 parent 86e9e57 commit d70cc95
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
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"
];
};
}

0 comments on commit d70cc95

Please sign in to comment.