tclip/flake.nix

86 lines
2.3 KiB
Nix
Raw Normal View History

{
description = "A self-hostable pastebin for your tailnet";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
};
2024-03-30 16:34:22 +00:00
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;
2024-03-30 16:34:22 +00:00
pkgs = import nixpkgs { inherit system; };
in {
packages = rec {
2024-03-30 16:34:22 +00:00
tclipd = pkgs.buildGo122Module {
2023-09-19 17:09:17 +01:00
pname = "tclipd";
version = "0.1.0-${version}";
2024-03-30 13:56:02 +00:00
go = pkgs.go;
src = ./.;
2023-09-19 17:09:17 +01:00
subPackages = "cmd/tclipd";
2024-07-15 13:12:59 +01:00
vendorHash = "sha256-FC7tuo5zpiTyt0oxZRd1nhT3qx22nCpRTXlVdaP1DnI=";
};
2024-03-30 16:34:22 +00:00
tclip = pkgs.buildGo122Module {
pname = "tclip";
2024-03-30 16:34:22 +00:00
inherit (tclipd) src version vendorHash;
subPackages = "cmd/tclip";
2024-03-30 13:56:02 +00:00
go = pkgs.go;
CGO_ENABLED = "0";
};
docker = pkgs.dockerTools.buildLayeredImage {
2024-03-30 16:49:51 +00:00
name = "ghcr.io/gmemstr/tclip";
tag = "latest";
2023-09-19 17:09:17 +01:00
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;
2023-09-19 17:09:17 +01:00
inherit tclipd;
};
in pkgs.portableService {
2023-09-19 17:09:17 +01:00
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
2023-08-22 17:43:17 +01:00
yarn
nodejs
];
TSNET_HOSTNAME = "paste-devel";
};
}) // {};
}