This commit is contained in:
Fernando Ayats 2023-03-29 09:57:23 +02:00
parent cdebc72b48
commit 42b9a56256
4 changed files with 172 additions and 1 deletions

4
.gitignore vendored
View File

@ -31,4 +31,6 @@
*.out
*.app
.vscode/
.vscode/
# Nix
*result*

112
flake.lock Normal file
View File

@ -0,0 +1,112 @@
{
"nodes": {
"hyprland": {
"inputs": {
"hyprland-protocols": "hyprland-protocols",
"nixpkgs": "nixpkgs",
"wlroots": "wlroots",
"xdph": "xdph"
},
"locked": {
"lastModified": 1680031067,
"narHash": "sha256-kwywAAnHTx3IohvHDbhgsQjrHdN6ewE/vX+E/9oWmFc=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "d6241a3086c4abfd21e91e23c83c97c3f80123d4",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "Hyprland",
"type": "github"
}
},
"hyprland-protocols": {
"inputs": {
"nixpkgs": [
"hyprland",
"nixpkgs"
]
},
"locked": {
"lastModified": 1671839510,
"narHash": "sha256-+PY1qqJfmZzzROgcIY4I7AkCwpnC+qBIYk2eFoA9RWc=",
"owner": "hyprwm",
"repo": "hyprland-protocols",
"rev": "b8f55e02a328c47ed373133c52483bbfa20a1b75",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-protocols",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1679172431,
"narHash": "sha256-XEh5gIt5otaUbEAPUY5DILUTyWe1goAyeqQtmwaFPyI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1603d11595a232205f03d46e635d919d1e1ec5b9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"hyprland": "hyprland"
}
},
"wlroots": {
"flake": false,
"locked": {
"host": "gitlab.freedesktop.org",
"lastModified": 1679340088,
"narHash": "sha256-/1KiYoBivDj8HC/eVK2Tr2WYkVdKJxq2Lb0tQs0qqJo=",
"owner": "wlroots",
"repo": "wlroots",
"rev": "1d64e12391a638201c679e71d4e22bb45e5faa8e",
"type": "gitlab"
},
"original": {
"host": "gitlab.freedesktop.org",
"owner": "wlroots",
"repo": "wlroots",
"type": "gitlab"
}
},
"xdph": {
"inputs": {
"hyprland-protocols": [
"hyprland",
"hyprland-protocols"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
]
},
"locked": {
"lastModified": 1673116118,
"narHash": "sha256-eR0yDSkR2XYMesfdRWJs25kAdXET2mbNNHu5t+KUcKA=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "d479c846531fd0e1d2357c9588b8310a2b859ef2",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

18
flake.nix Normal file
View File

@ -0,0 +1,18 @@
{
inputs.hyprland.url = "github:hyprwm/Hyprland";
outputs = {
self,
hyprland,
}: let
inherit (hyprland.inputs) nixpkgs;
withPkgsFor = fn: nixpkgs.lib.genAttrs (builtins.attrNames hyprland.packages) (system: fn system nixpkgs.legacyPackages.${system});
in {
packages = withPkgsFor (system: pkgs: {
hyprbars = pkgs.callPackage ./hyprbars {
inherit (hyprland.packages.${system}) hyprland;
wlroots = hyprland.packages.${system}.wlroots-hyprland;
};
});
};
}

39
hyprbars/default.nix Normal file
View File

@ -0,0 +1,39 @@
{
stdenv,
hyprland,
pkg-config,
pixman,
libdrm,
wlroots,
}:
stdenv.mkDerivation {
name = "hyprbars";
src = ./.;
preConfigure = "rm Makefile";
nativeBuildInputs = [
pkg-config
];
buildInputs = [
pixman
libdrm
wlroots
];
buildPhase = ''
trap "set +x" err
set -xeu
$CXX --no-gnu-unique -shared \
-std=c++23 \
$(pkg-config --cflags pixman-1) \
$(pkg-config --cflags libdrm) \
$(pkg-config --cflags wlroots) \
-I${hyprland.src}/ \
main.cpp barDeco.cpp \
-o $out
set +x
'';
}