aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
blob: 2e67bbfdcb483c45147dd717d411ad82a6664d0f (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
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
{
description = "hypr-wellbeing - An app usage logger for hyprland and niri";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

outputs = { self, nixpkgs }:
  let
    systems = [ "x86_64-linux" ];
    forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
  in
  {
    packages = forAllSystems (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};

        version = "0.0.9";

        binaryName = {
          "x86_64-linux"  = "hypr-wellbeing";
        }.${system};

        sha256 = {
          "x86_64-linux" = "sha256-LSG+PQpbbunRCeBHyd1A7X+wAPsX942I5aZnIz8cL2I=";
        }.${system};

      in
      {
        hypr-wellbeing = pkgs.stdenvNoCC.mkDerivation {
          pname = "hypr-wellbeing";
          inherit version;

          src = pkgs.fetchurl {
            url = "https://github.com/DemonKingSwarn/hypr-wellbeing/releases/download/${version}/${binaryName}";
            inherit sha256;
          };

          dontUnpack = true;
          dontBuild = true;

          nativeBuildInputs = [ pkgs.makeWrapper ];

          propagatedBuildInputs = with pkgs; [ ];

          installPhase = ''
            install -Dm755 $src $out/bin/hypr-wellbeing
          '';

          meta = with pkgs.lib; {
            description = "An app usage logger for hyprland and niri";
            homepage    = "https://github.com/DemonKingSwarn/hypr-wellbeing";
            license     = licenses.gpl3Only;
            maintainers = [ ];
            platforms   = [ "x86_64-linux" ];
            mainProgram = "hypr-wellbeing";
          };
        };

        default = self.packages.${system}.hypr-wellbeing;
      }
    );

    apps = forAllSystems (system: {
      default = {
        type    = "app";
        program = "${self.packages.${system}.hypr-wellbeing}/bin/hypr-wellbeing";
      };
    });
  };
}