diff --git a/.gitignore b/.gitignore index f45eb5bbb..d24d0e6db 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ CTestTestfile.cmake _deps build/ +result /.vscode/ *.o @@ -17,4 +18,4 @@ build/ *-protocol.h .ccls-cache -hyprctl/hyprctl \ No newline at end of file +hyprctl/hyprctl diff --git a/Makefile b/Makefile index bcf3a10c8..b185eb90a 100644 --- a/Makefile +++ b/Makefile @@ -97,19 +97,20 @@ all: install: make all - mkdir -p /usr/share/wayland-sessions - cp ./example/hyprland.desktop /usr/share/wayland-sessions/ - cp ./build/Hyprland /usr/bin - cp ./hyprctl/hyprctl /usr/bin - mkdir -p /usr/share/hyprland - cp ./assets/wall_2K.png /usr/share/hyprland - cp ./assets/wall_4K.png /usr/share/hyprland - cp ./assets/wall_8K.png /usr/share/hyprland + mkdir -p ${PREFIX}/share/wayland-sessions + cp ./example/hyprland.desktop ${PREFIX}/share/wayland-sessions/ + mkdir -p ${PREFIX}/bin + cp ./build/Hyprland ${PREFIX}/bin + cp ./hyprctl/hyprctl ${PREFIX}/bin + mkdir -p ${PREFIX}/share/hyprland + cp ./assets/wall_2K.png ${PREFIX}/share/hyprland + cp ./assets/wall_4K.png ${PREFIX}/share/hyprland + cp ./assets/wall_8K.png ${PREFIX}/share/hyprland uninstall: - rm -f /usr/share/wayland-sessions/hyprland.desktop - rm -f /usr/bin/Hyprland - rm -f /usr/bin/hyprctl - rm -rf /usr/share/hyprland + rm -f ${PREFIX}/share/wayland-sessions/hyprland.desktop + rm -f ${PREFIX}/bin/Hyprland + rm -f ${PREFIX}/bin/hyprctl + rm -rf ${PREFIX}/share/hyprland config: xdg-shell-protocol.o wlr-layer-shell-unstable-v1-protocol.o wlr-screencopy-unstable-v1-protocol.o idle-protocol.o ext-workspace-unstable-v1-protocol.o pointer-constraints-unstable-v1-protocol.o diff --git a/default.nix b/default.nix new file mode 100644 index 000000000..e15f9174f --- /dev/null +++ b/default.nix @@ -0,0 +1,60 @@ +{ lib, stdenv, fetchFromGitHub, src, pkg-config, cmake, ninja, libdrm, libinput +, libxcb, libxkbcommon, mesa, mount, pango, wayland, wayland-protocols +, wayland-scanner, wlroots, xcbutilwm, xwayland, enableXWayland ? true }: + +stdenv.mkDerivation rec { + pname = "hyprland"; + version = "git"; + inherit src; + + nativeBuildInputs = [ cmake ninja pkg-config wayland ] + ++ lib.optional enableXWayland xwayland; + + buildInputs = [ + libdrm + libinput + libxcb + libxkbcommon + mesa + pango + wayland-protocols + wayland-scanner + wlroots + (wlroots.override { inherit enableXWayland; }) + xcbutilwm + ]; + + cmakeFlags = [ "-DCMAKE_BUILD_TYPE=Release" ] + ++ lib.optional (!enableXWayland) "-DNO_XWAYLAND=true"; + + prePatch = '' + make config + ''; + + postBuild = '' + pushd ../hyprctl + make all + popd + ''; + + installPhase = '' + cd ../ + mkdir -p $out/share/wayland-sessions + cp ./example/hyprland.desktop $out/share/wayland-sessions/ + mkdir -p $out/bin + cp ./build/Hyprland $out/bin + cp ./hyprctl/hyprctl $out/bin + mkdir -p $out/share/hyprland + cp ./assets/wall_2K.png $out/share/hyprland + cp ./assets/wall_4K.png $out/share/hyprland + cp ./assets/wall_8K.png $out/share/hyprland + ''; + + meta = with lib; { + homepage = "https://github.com/vaxerski/Hyprland"; + description = + "A dynamic tiling Wayland compositor that doesn't sacrifice on its looks"; + license = licenses.bsd3; + platforms = platforms.linux; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..de779e0be --- /dev/null +++ b/flake.lock @@ -0,0 +1,162 @@ +{ + "nodes": { + "cachix": { + "locked": { + "lastModified": 1651865313, + "narHash": "sha256-fLnmcBaVpJukNIzXZETxtJKLSSTf4LnBCWa/DwyGJBU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "ad667404474314806d8071eec4c8ec0db95c17e4", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-21.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1649676176, + "narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "lib-aggregate": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1652011770, + "narHash": "sha256-ZX+aDa9db1lNbLI44KK0EjTV2X6gyIqpcuN9RUCy9iI=", + "owner": "nix-community", + "repo": "lib-aggregate", + "rev": "89056ca8a9c74ea4440dc53bebcd9c74fc0e1f15", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "lib-aggregate", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1651927509, + "narHash": "sha256-fGVGUdEsriuAL1vkUh29FlOQmEkPRnSfRGImWYaVjos=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2fdb6f2e08e7989b03a2a1aa8538d99e3eeea881", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1651970744, + "narHash": "sha256-3X/96C8I5alTCP0FHEx01/YOIvVmjkYoUPX/1Y4Bdsw=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "da23418cffc1763e30dba3383eac541afe3e4e70", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-wayland": { + "inputs": { + "cachix": "cachix", + "flake-compat": "flake-compat", + "lib-aggregate": "lib-aggregate", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1652015544, + "narHash": "sha256-YFjSavZSf6NZFRt2QB5mBccPYd8wrJGKHVH9p75vZtM=", + "owner": "nix-community", + "repo": "nixpkgs-wayland", + "rev": "2d9bc7f3261cc1c2a46d121f94ed483f35d194c2", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs-wayland", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1651726670, + "narHash": "sha256-dSGdzB49SEvdOJvrQWfQYkAefewXraHIV08Vz6iDXWQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c777cdf5c564015d5f63b09cc93bef4178b19b01", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "nixpkgs-wayland": "nixpkgs-wayland", + "utils": "utils" + } + }, + "utils": { + "locked": { + "lastModified": 1649676176, + "narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..002bf09bd --- /dev/null +++ b/flake.nix @@ -0,0 +1,27 @@ +# Based on fortuneteller2k's (https://github.com/fortuneteller2k/nixpkgs-f2k) package repo +{ + description = + "Hyprland is a dynamic tiling Wayland compositor that doesn't sacrifice on its looks."; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + utils.url = "github:numtide/flake-utils"; + nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland"; + }; + + outputs = { self, nixpkgs, utils, nixpkgs-wayland }: + utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in rec { + packages = { + hyprland = pkgs.callPackage self { + src = self; + inherit (nixpkgs-wayland.packages.${system}) wlroots; + }; + }; + defaultPackage = packages.hyprland; + apps.hyprland = utils.lib.mkApp { drv = packages.hyprland; }; + defaultApp = apps.hyprland; + apps.default = + utils.lib.mkApp { drv = self.packages."${system}".default; }; + }); +}