From 2342b6a10f1f7d238e60a4ff1c33a0ab0dee0e39 Mon Sep 17 00:00:00 2001
From: Tanish2002 <tanishkhare@gmail.com>
Date: Sun, 8 May 2022 22:53:49 +0530
Subject: [PATCH] remove patch and move default.nix

---
 .gitignore                  |  2 +-
 Makefile                    |  2 +-
 default.nix                 |  3 ---
 flake.nix                   |  2 +-
 nix-build/default.nix       | 42 -------------------------------------
 nix-build/fix-makefile.diff | 36 -------------------------------
 6 files changed, 3 insertions(+), 84 deletions(-)
 delete mode 100644 nix-build/default.nix
 delete mode 100644 nix-build/fix-makefile.diff

diff --git a/.gitignore b/.gitignore
index 7beae642..d24d0e6d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,7 +10,7 @@ CTestTestfile.cmake
 _deps
 
 build/
-result/
+result
 /.vscode/
 
 *.o
diff --git a/Makefile b/Makefile
index ce5e53f3..0d04bd8f 100644
--- a/Makefile
+++ b/Makefile
@@ -97,7 +97,7 @@ all:
 
 install:
 	make all
-	mkdir -p /usr/share/wayland-sessions
+	mkdir -p ${PREFIX}/share/wayland-sessions
 	cp ./example/hyprland.desktop ${PREFIX}/share/wayland-sessions/
 	cp ./build/Hyprland ${PREFIX}/bin
 	cp ./hyprctl/hyprctl ${PREFIX}/bin
diff --git a/default.nix b/default.nix
index 42a8191d..b958c3e2 100644
--- a/default.nix
+++ b/default.nix
@@ -25,10 +25,7 @@ stdenv.mkDerivation {
   dontBuild = true;
   dontInstall = true;
 
-  patches = [ ./fix-makefile.diff ];
-
   postPatch = ''
-    mkdir -p $out/bin
     make install PREFIX=$out
   '';
 
diff --git a/flake.nix b/flake.nix
index 39a76179..b8a461ba 100644
--- a/flake.nix
+++ b/flake.nix
@@ -15,7 +15,7 @@
         version = "git";
       in rec {
         packages = {
-          hyprland = pkgs.callPackage ./nix-build {
+          hyprland = pkgs.callPackage self {
             inherit version;
             src = self;
             inherit (nixpkgs-wayland.packages.${system}) wlroots;
diff --git a/nix-build/default.nix b/nix-build/default.nix
deleted file mode 100644
index 42a8191d..00000000
--- a/nix-build/default.nix
+++ /dev/null
@@ -1,42 +0,0 @@
-{ lib, stdenv, fetchFromGitHub, src, version, pkg-config, cmake, ninja, libdrm
-, libinput, libxcb, libxkbcommon, mesa, mount, pango, wayland, wayland-protocols
-, wayland-scanner, wlroots, xcbutilwm, xwayland, xwaylandSupport ? true }:
-
-stdenv.mkDerivation {
-  pname = "hyprland";
-  inherit src version;
-
-  nativeBuildInputs = [ cmake ninja pkg-config wayland ]
-    ++ lib.optional xwaylandSupport xwayland;
-
-  buildInputs = [
-    libdrm
-    libinput
-    libxcb
-    libxkbcommon
-    mesa
-    pango
-    wayland-protocols
-    wayland-scanner
-    wlroots
-    xcbutilwm
-  ];
-
-  dontBuild = true;
-  dontInstall = true;
-
-  patches = [ ./fix-makefile.diff ];
-
-  postPatch = ''
-    mkdir -p $out/bin
-    make install PREFIX=$out
-  '';
-
-  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/nix-build/fix-makefile.diff b/nix-build/fix-makefile.diff
deleted file mode 100644
index 036dafad..00000000
--- a/nix-build/fix-makefile.diff
+++ /dev/null
@@ -1,36 +0,0 @@
-diff --git a/Makefile b/Makefile
-index bcf3a10..0a5b335 100644
---- a/Makefile
-+++ b/Makefile
-@@ -97,14 +97,14 @@ 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/
-+	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
-diff --git a/config.mk b/config.mk
-index 91aca81..c40930e 100644
---- a/config.mk
-+++ b/config.mk
-@@ -1,4 +1,4 @@
--PREFIX = /usr/local
-+PREFIX = @out@
- CFLAGS ?= -g -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare -Wno-unused-function -Wno-unused-variable -Wno-unused-result -Wdeclaration-after-statement
- CFLAGS += -DXWAYLAND