forked from ublue-os/fleek
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
66 lines (61 loc) · 1.88 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
{
description = "Fleek - 'Home as Code' for Humans";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/master";
};
outputs = { self, nixpkgs }: let
# Current version
version = "0.10.5";
# Supported systems
systems = [
"aarch64-linux" # 64-bit ARM Linux
"x86_64-linux" # 64-bit Intel/AMD Linux
"aarch64-darwin" # 64-bit ARM macOS
"x86_64-darwin" # 64-bit Intel macOS
];
overlays = [
(self: super: rec {
go = super.go_1_21;
buildGoModule = super.buildGo121Module;
})
];
# Helper for providing per-supported-system outputs
forEachSystem = f: nixpkgs.lib.genAttrs systems (system: f {
pkgs = import nixpkgs { inherit overlays system; };
});
in {
# Output Fleek as a Nix package so that others can easily install it using Nix:
#
# nix run github:ublue-os/fleek -- --help
packages = forEachSystem ({ pkgs }: {
default = pkgs.buildGoModule {
pname = "fleek";
inherit version;
src = ./.;
nativeBuildInputs = with pkgs; [
installShellFiles # Shell completion helper function (see postInstall below)
];
subPackages = [ "cmd/fleek" ];
vendorSha256 = null;
CGO_ENABLED = 0;
ldflags = [
"-s"
"-w"
"-X github.com/ublue-os/fleek/internal/build.Version=${version}"
"-X github.com/ublue-os/fleek/internal/build.Commit=${self.rev}"
"-X github.com/ublue-os/fleek/internal/build.CommitDate=1970-01-01T00:00:00Z"
"-extldflags=-static"
];
tags = [
"netgo"
];
postInstall = ''
installShellCompletion --cmd fleek \
--bash <($out/bin/fleek completion bash) \
--fish <($out/bin/fleek completion fish) \
--zsh <($out/bin/fleek completion zsh)
'';
};
});
};
}