Skip to content

Commit 20b4b09

Browse files
authored
Merge pull request #55 from zachspar/spar/feat/nix-pkg
chore: nix flake + package + dev shell
2 parents 17034c6 + 2b759a0 commit 20b4b09

3 files changed

Lines changed: 124 additions & 1 deletion

File tree

‎.gitignore‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@ test.bash
55
.idea
66
.vscode
77
*.test.yaml
8+
.history
9+
result
10+
result-*
811

9-
switch.sh
12+
switch.sh

‎flake.lock‎

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎flake.nix‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
description = "Ctrlplane CLI (ctrlc)";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { self, nixpkgs, flake-utils }:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
let
12+
pkgs = nixpkgs.legacyPackages.${system};
13+
14+
version =
15+
if (self ? rev)
16+
then self.shortRev
17+
else "dev";
18+
in
19+
{
20+
packages = {
21+
ctrlc = pkgs.buildGoModule {
22+
pname = "ctrlc";
23+
inherit version;
24+
src = ./.;
25+
26+
vendorHash = "sha256-n/yfb1cCeQmfECyKsjsdsEYJM/rTip3d5mzMHXOHEDY=";
27+
28+
subPackages = [ "cmd/ctrlc" ];
29+
30+
env.CGO_ENABLED = "0";
31+
32+
tags = [ "containers_image_openpgp" ];
33+
34+
ldflags = [
35+
"-s" "-w"
36+
"-X github.com/ctrlplanedev/cli/cmd/ctrlc/root/version.Version=${version}"
37+
"-X github.com/ctrlplanedev/cli/cmd/ctrlc/root/version.GitCommit=${self.rev or "dirty"}"
38+
"-X github.com/ctrlplanedev/cli/cmd/ctrlc/root/version.BuildDate=1970-01-01T00:00:00Z"
39+
];
40+
41+
meta = with pkgs.lib; {
42+
description = "CLI for Ctrlplane - manage deployments, resources, and jobs";
43+
homepage = "https://github.com/ctrlplanedev/cli";
44+
mainProgram = "ctrlc";
45+
};
46+
};
47+
48+
default = self.packages.${system}.ctrlc;
49+
};
50+
51+
devShells.default = pkgs.mkShell {
52+
buildInputs = with pkgs; [
53+
go_1_24
54+
golangci-lint
55+
goreleaser
56+
];
57+
};
58+
});
59+
}

0 commit comments

Comments
 (0)