summaryrefslogtreecommitdiff
path: root/flake.nix
blob: 44823efb55906f4b6d0764699980fa4b762dd9bf (about) (plain)
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
{
  description = "HTTP service to control monitor brightness";

  outputs = { self, nixpkgs, ... }:
    let system = "x86_64-linux";
    in {
      packages.${system} = {
        default = nixpkgs.legacyPackages.${system}.callPackage
          ({ lib, go, buildGoModule }:
            buildGoModule rec {
              pname = "ddcutil-daemon";
              version = "0.0.1";
              src = ./.;
              # preConfigure phase to compile a statically linked executable
              preConfigure = ''
                export CGO_ENABLED=0
                export GOOS=linux
                export GOARCH=amd64
              '';
              ldflags = let t = "github.com/kitnil/ddcutil-daemon";
              in [
                "-s" # stripped binary
                "-X ${t}.Version=${version}"
                "-X ${t}.Branch=unknown"
                "-X ${t}.BuildUser=nix@nixpkgs"
                "-X ${t}.BuildDate=unknown"
                "-X ${t}.GoVersion=${lib.getVersion go}"
              ];
              vendorSha256 = null;
              meta = with lib; {
                description = "HTTP service to control monitor brightness.";
                homepage = "https://github.com/kitnil/ddcutil-daemon";
                license = licenses.asl20;
                platforms = platforms.unix;
              };
            }) { };
      };
    };
}