diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..0eaf66d --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1658826464, + "narHash": "sha256-94ZTF0uIX/iZdiD4RJ5f933ak/OM4XLl7hF+gCa4Iuk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ce49cb7792a7ffd65ef352dda1110a4e4a204eac", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..2a440b6 --- /dev/null +++ b/flake.nix @@ -0,0 +1,38 @@ +{ + description = "Hyprpaper is a blazing fast Wayland wallpaper utility with IPC controls"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + outputs = { + self, + nixpkgs, + ... + }: let + inherit (nixpkgs) lib; + genSystems = lib.genAttrs [ + # Add more systems if they are supported + "x86_64-linux" + ]; + pkgsFor = nixpkgs.legacyPackages; + mkDate = longDate: (lib.concatStringsSep "-" [ + (__substring 0 4 longDate) + (__substring 4 2 longDate) + (__substring 6 2 longDate) + ]); + in { + overlays.default = _: prev: rec { + hyprpaper = prev.callPackage ./nix/default.nix { + stdenv = prev.gcc12Stdenv; + version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); + inherit (prev.xorg) libXdmcp; + }; + hyprpaper-debug = hyprpaper.override {debug = true;}; + }; + + packages = genSystems (system: + (self.overlays.default null pkgsFor.${system}) + // {default = self.packages.${system}.hyprpaper;}); + + formatter = genSystems (system: pkgsFor.${system}.alejandra); + }; +} diff --git a/nix/default.nix b/nix/default.nix new file mode 100644 index 0000000..449c2b3 --- /dev/null +++ b/nix/default.nix @@ -0,0 +1,86 @@ +{ + lib, + stdenv, + pkg-config, + cmake, + ninja, + cairo, + fribidi, + libdatrie, + libjpeg, + libselinux, + libsepol, + libthai, + pango, + pcre, + utillinux, + wayland, + wayland-protocols, + wayland-scanner, + libXdmcp, + debug ? false, + version ? "git", +}: +stdenv.mkDerivation { + pname = "hyprpaper" + lib.optionalString debug "-debug"; + inherit version; + src = ../.; + + nativeBuildInputs = [ + cmake + ninja + pkg-config + ]; + + buildInputs = [ + cairo + fribidi + libdatrie + libjpeg + libselinux + libsepol + libthai + pango + pcre + wayland + wayland-protocols + wayland-scanner + libXdmcp + utillinux + ]; + + configurePhase = '' + runHook preConfigure + + make protocols + + runHook postConfigure + ''; + + buildPhase = '' + runHook preBuild + + make release + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/{bin,share/licenses} + + install -Dm755 build/hyprpaper -t $out/bin + install -Dm644 LICENSE -t $out/share/licenses/hyprpaper + + runHook postInstall + ''; + + meta = with lib; { + homepage = "https://github.com/hyprwm/hyprpaper"; + description = "A blazing fast wayland wallpaper utility with IPC controls"; + license = licenses.bsd3; + platforms = platforms.linux; + mainProgram = "hyprpaper"; + }; +}