tclip/flake.nix
Gabriel Simmer 8f33e31756
All checks were successful
Nix build / build-docker-arm (push) Successful in 9m20s
Nix build / build-docker (push) Successful in 11m37s
Correct ghcr image name
2024-03-30 16:53:53 +00:00

86 lines
2.3 KiB
Nix

{
description = "A self-hostable pastebin for your tailnet";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils }:
utils.lib.eachSystem [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
] (system:
let
version = builtins.substring 0 8 self.lastModifiedDate;
pkgs = import nixpkgs { inherit system; };
in {
packages = rec {
tclipd = pkgs.buildGo122Module {
pname = "tclipd";
version = "0.1.0-${version}";
go = pkgs.go;
src = ./.;
subPackages = "cmd/tclipd";
vendorHash = "sha256-7iOEp0NrcmvBNrxl5kjrJOAhVfKYPNpI4ssNxaf6g3M=";
};
tclip = pkgs.buildGo122Module {
pname = "tclip";
inherit (tclipd) src version vendorHash;
subPackages = "cmd/tclip";
go = pkgs.go;
CGO_ENABLED = "0";
};
docker = pkgs.dockerTools.buildLayeredImage {
name = "ghcr.io/gmemstr/tclip";
tag = "latest";
config.Cmd = [ "${tclipd}/bin/tclipd" ];
contents = [ pkgs.cacert ];
};
portable-service = let
web-service = pkgs.substituteAll {
name = "tclip.service";
src = ./run/portable-service/tclip.service.in;
inherit tclipd;
};
in pkgs.portableService {
inherit (tclipd) version;
pname = "tclip";
description = "The tclip service";
homepage = "https://github.com/tailscale-dev/tclip";
units = [ web-service ];
symlinks = [{
object = "${pkgs.cacert}/etc/ssl";
symlink = "/etc/ssl";
}];
};
default = docker;
};
apps.default =
utils.lib.mkApp { drv = self.packages.${system}.default; };
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
go
gopls
gotools
go-tools
sqlite-interactive
yarn
nodejs
];
TSNET_HOSTNAME = "paste-devel";
};
}) // {};
}