-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
84 lines (69 loc) · 2.26 KB
/
Copy pathflake.nix
File metadata and controls
84 lines (69 loc) · 2.26 KB
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
{
description = "A flake for interacting with bunny-dev platform";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs {inherit system;};
# Basic dependencies needed for the environment
common-app-buildInputs = with pkgs; [
bash
curl
jq
age
ssh-to-age
sops
];
renew-tailscale-token-buildInputs = with pkgs; [
bash
curl
jq
sops
];
# Script name
renew-tailscale-token-name = "renew-tailscale-token";
renew-tailscale-token-version ="0.1.0";
# Create the script
renew-tailscale-token-script = (pkgs.writeScriptBin renew-tailscale-token-name (builtins.readFile ./scripts/renew-tailscale-token.sh)).overrideAttrs (old: {
buildCommand = "${old.buildCommand}\n patchShebangs $out";
});
in rec {
defaultPackage = packages.app-script;
packages = {
renew-tailscale-token-script = pkgs.symlinkJoin {
name = renew-tailscale-token-name;
paths = [renew-tailscale-token-script] ++ renew-tailscale-token-buildInputs;
buildInputs = [pkgs.makeWrapper];
postBuild = ''
wrapProgram $out/bin/${renew-tailscale-token-name} \
--set VERSION "${renew-tailscale-token-version}"
'';
};
renew-tailscale-token-docker = pkgs.dockerTools.buildLayeredImage {
name = "bunny-dev/tailscale-token-renewer";
tag = "latest";
contents = [renew-tailscale-token-script] ++ renew-tailscale-token-buildInputs;
config = {
Env = [ ];
Entrypoint = ["${defaultPackage}/bin/${renew-tailscale-token-name}"];
};
};
};
devShell = pkgs.mkShell {
buildInputs = common-app-buildInputs ++ [
renew-tailscale-token-script
];
shellHook = ''
echo "Bunny Dev Platform Environment Ready!"
'';
};
}
);
}