diff --git a/dagger/README.md b/dagger/README.md new file mode 100644 index 0000000..e4d109a --- /dev/null +++ b/dagger/README.md @@ -0,0 +1,24 @@ +# dagger + +This directory contains the Nix package for a pinned dev build of `dagger`, the CLI for [Dagger](https://dagger.io). + +Source: [`github.com/dagger/dagger`](https://github.com/dagger/dagger) + +## Usage + +```bash +dagger version +dagger --help +``` + +## Updating + +This package follows Dagger's dev-build endpoint, but pins a concrete commit and hashes for reproducibility. + +Fetch the latest dev-build checksums: + +```bash +curl -fsSL https://dl.dagger.io/dagger/main/head/checksums.txt +``` + +Then update `commit` and the platform hashes in `default.nix`. diff --git a/dagger/default.nix b/dagger/default.nix new file mode 100644 index 0000000..4f48528 --- /dev/null +++ b/dagger/default.nix @@ -0,0 +1,75 @@ +{ + lib, + stdenvNoCC, + fetchurl, + installShellFiles, +}: + +let + # Latest Dagger dev build from https://dl.dagger.io/dagger/main/head/checksums.txt + # Update this commit and the hashes together when you want a newer unreleased build. + commit = "499b5fc3d15f6b9c8a196b81436a805cc6ec7f4e"; + version = "1.0.0-dev-${lib.substring 0 8 commit}"; + + sources = { + x86_64-linux = { + os = "linux"; + arch = "amd64"; + hash = "sha256-nHfqWGeqbOdHG7JR2wlK6mcejLTX0zXF7frMZj7+nyU="; + }; + aarch64-linux = { + os = "linux"; + arch = "arm64"; + hash = "sha256-ekV6V90Rx4ZgCwcOiwnT6sGeyF8MEvf1Gt3iyhAezzA="; + }; + x86_64-darwin = { + os = "darwin"; + arch = "amd64"; + hash = "sha256-GuLWq2z82Z3Rw4iEW3koC+edvUwiA+Aba3WzfPJgrts="; + }; + aarch64-darwin = { + os = "darwin"; + arch = "arm64"; + hash = "sha256-acPG+9uirdZBjzF7RMFhtgQmlp9M+e6MQ7/+S+9JoUU="; + }; + }; + + source = sources.${stdenvNoCC.hostPlatform.system} or (throw "Unsupported system: ${stdenvNoCC.hostPlatform.system}"); +in +stdenvNoCC.mkDerivation { + pname = "dagger"; + inherit version; + + src = fetchurl { + url = "https://dl.dagger.io/dagger/main/${commit}/dagger_${commit}_${source.os}_${source.arch}.tar.gz"; + inherit (source) hash; + }; + + sourceRoot = "."; + + nativeBuildInputs = [ installShellFiles ]; + + installPhase = '' + runHook preInstall + + install -Dm755 dagger $out/bin/dagger + + runHook postInstall + ''; + + postInstall = '' + installShellCompletion --cmd dagger \ + --bash <($out/bin/dagger completion bash) \ + --zsh <($out/bin/dagger completion zsh) \ + --fish <($out/bin/dagger completion fish) + ''; + + meta = { + description = "Dagger CLI dev build from main"; + homepage = "https://github.com/dagger/dagger"; + license = lib.licenses.asl20; + mainProgram = "dagger"; + sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; + platforms = builtins.attrNames sources; + }; +} diff --git a/devenv.nix b/devenv.nix index 0c44ab4..187082b 100644 --- a/devenv.nix +++ b/devenv.nix @@ -4,13 +4,15 @@ }: let - tang = pkgs.callPackage ./tangled-cli/tang.nix { }; + dagger = pkgs.callPackage ./dagger { }; + tang = pkgs.callPackage ./tangled-cli { }; devenvSummary = pkgs.callPackage ./devenv.custom-code.nix { }; in { # https://devenv.sh/packages/ packages = [ pkgs.docker-compose # used by application + dagger # dagger CLI dev build (until 1.0) pkgs.skills # used to manage .agents/skills tang # tangled.org cli ]; @@ -20,6 +22,7 @@ in title = "RSSBase devenv:"; rows = [ { pkg = pkgs.docker-compose; } + { pkg = dagger; } { pkg = pkgs.skills; } { pkg = tang; } ]; diff --git a/tangled-cli/tang.nix b/tangled-cli/default.nix similarity index 100% rename from tangled-cli/tang.nix rename to tangled-cli/default.nix