diff --git a/.albatros b/.albatros index ee444c8..b0a061c 100755 --- a/.albatros +++ b/.albatros @@ -1,6 +1,3 @@ -#!/usr/bin/env nix-shell -#!nix-shell -i bash -p go -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/4d2b37a84fad1091b9de401eb450aae66f1a741e.tar.gz -set -euxo pipefail - -go build -echo "done" >&2 +#!/usr/bin/env bash +nix build .#docker.albatros +nix develop --command "executor --force --destination dxflrs/albatros:${COMMIT} --context dir://`pwd` --verbosity=debug" diff --git a/.gitignore b/.gitignore index f491ecd..2a89112 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ albatros +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..01ee37a --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1678964307, + "narHash": "sha256-POV15raLJzwns6U84W4aWNSeSJRXTz7xWQW6IcrWQns=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fd4f7832961053e6095af8de8d6a57b5ad402f19", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ef53797 --- /dev/null +++ b/flake.nix @@ -0,0 +1,46 @@ +{ + description = "Albatros"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + }; + + outputs = { self, nixpkgs }: + let + system = "x86_64-linux"; + nixuniverse = import (builtins.fetchGit { + url = "https://git.deuxfleurs.fr/quentin/nixuniverse.git"; + ref = "main"; + rev = "fd2922cc97599172851f0817abc84ead2ba54cdb"; + }); + pkgs = import nixpkgs { + inherit system; + overlays = [ nixuniverse ]; + }; + albatros = pkgs.buildGoModule rec { + pname = "albatros"; + version = "0.9"; + src = ./.; + vendorSha256 = "sha256-Q7gImRoJqtcORpHLQoF3TRK2WJu3tKSjSE3Sno6lNNk="; + checkPhase = "true"; + meta = with pkgs.lib; { + description = "albatros is a CI for Nomad"; + homepage = "https://git.deuxfleurs.fr/quentin/albatros"; + license = licenses.agpl3; + platforms = platforms.linux; + }; + }; + docker = pkgs.dockerTools.buildImage { + name = "dxflrs/albatros"; + config = { + Cmd = [ "${albatros}/bin/albatros" ]; + }; + }; + in + { + packages.x86_64-linux.albatros = albatros; + packages.x86_64-linux.docker.albatros = docker; + packages.x86_64-linux.default = self.packages.x86_64-linux.albatros; + + devShell.x86_64-linux = pkgs.mkShell { buildInputs = [ pkgs.kaniko pkgs.manifest-tool ]; }; + }; +}