forked from tailscale-dev/tclip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
85 lines (74 loc) · 2.27 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{
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-FC7tuo5zpiTyt0oxZRd1nhT3qx22nCpRTXlVdaP1DnI=";
};
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";
};
}) // {};
}