aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
blob: c6c582239f81ab9e904bfca1d46bebd63d39d95e (plain) (blame)
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
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.05";
    home-manager.url = "github:rycee/home-manager/release-21.05";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";
  };
  outputs = { self, nixpkgs, home-manager }: {
    lib.enableSwaybar = { config, pkgs, ... }:
      let
        colors = config.colors;
        background = "#${colors.base00}";
        brite_bg = "#${colors.base01}";
        dim = "#${colors.base04}";
        fg = "#${colors.base05}";
        brite = "#${colors.base07}";
      in {
        wayland.windowManager.sway.config.bars = [{
          colors.background = background;
          colors.statusline = fg;
          colors.activeWorkspace.background = background;
          colors.activeWorkspace.border = background;
          colors.activeWorkspace.text = fg;
          colors.focusedWorkspace.background = background;
          colors.focusedWorkspace.border = background;
          colors.focusedWorkspace.text = brite;
          colors.inactiveWorkspace.background = background;
          colors.inactiveWorkspace.border = background;
          colors.inactiveWorkspace.text = dim;
          colors.urgentWorkspace.background = fg;
          colors.urgentWorkspace.border = background;
          colors.urgentWorkspace.text = background;
          fonts = {
            names = [ config.font-name "Symbola"];
            style = "Condensed";
            size = config.font-size - 4.0;
          };
          position = "top";
          statusCommand = "${self.defaultPackage.x86_64-linux}/bin/swaybar";
        }];
      };

    defaultPackage.x86_64-linux =
      nixpkgs.legacyPackages.x86_64-linux.rustPlatform.buildRustPackage {
        pname = "swaybar";
        version = "0.1.0";

        src = ./.;

        cargoSha256 = "YiNaEyiKfiBIWzRXNIoqeWzoD/AGYNXYyy33Tj3a61g=";

        meta = with nixpkgs.lib; {
          description = "My personal code for swaybar";
          homepage = "https://sr.ht/rprospero/swaybar";
          license = licenses.unlicense;
          maintainers = [ maintainers.rprospero ];
        };
      };
  };
}