summaryrefslogtreecommitdiff
path: root/flake.nix
blob: 8b8f739b17c83f407877cc0091d0dd666e1eb2e1 (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
{
  inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

  outputs = {
    self,
    nixpkgs,
  }: let
    inherit (builtins) replaceStrings readFile;
    readVer = file: replaceStrings ["\n"] [""] (readFile file);

    system = "x86_64-linux"; # TODO: other architectures
    pkgs = nixpkgs.legacyPackages.${system};

    mkPkg = name: src: inputs:
      pkgs.stdenv.mkDerivation {
        nativeBuildInputs = with pkgs; [
          wrapGAppsHook
          gobject-introspection
          meson
          pkg-config
          ninja
          vala
          wayland
          wayland-scanner
        ];
        propagatedBuildInputs = [pkgs.glib] ++ inputs;
        pname = name;
        version = readVer "${src}/version";
        src = src;
        outputs = ["out" "dev"];
      };
  in {
    devShells.${system} = import ./nix/devshell.nix {
      inherit self pkgs;
    };

    lib = {
      mkLuaPackage = import ./nix/lua.nix {
        inherit pkgs;
        astal = self;
      };
    };

    packages.${system} = with pkgs; {
      docs = import ./docs {inherit self pkgs;};
      default = self.packages.${system}.astal;

      astal = mkPkg "astal" ./core [gtk3 gtk-layer-shell];
      apps = mkPkg "astal-apps" ./lib/apps [json-glib];
      auth = mkPkg "astal-auth" ./lib/auth [pam];
      battery = mkPkg "astal-battery" ./lib/battery [json-glib];
      bluetooth = mkPkg "astal-bluetooth" ./lib/bluetooth [];
      hyprland = mkPkg "astal-hyprland" ./lib/hyprland [json-glib];
      mpris = mkPkg "astal-mpris" ./lib/mpris [gvfs json-glib];
      network = mkPkg "astal-network" ./lib/network [networkmanager];
      notifd = mkPkg "astal-notifd" ./lib/notifd [json-glib gdk-pixbuf];
      powerprofiles = mkPkg "astal-power-profiles" ./lib/powerprofiles [json-glib];
      river = mkPkg "astal-river" ./lib/river [json-glib];
      tray = mkPkg "astal-tray" ./lib/tray [gtk3 gdk-pixbuf libdbusmenu-gtk3 json-glib];
      wireplumber = mkPkg "astal-wireplumber" ./lib/wireplumber [wireplumber];
    };
  };
}