diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..6dd9753 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1713537308, + "narHash": "sha256-XtTSSIB2DA6tOv+l0FhvfDMiyCmhoRbNB+0SeInZkbk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5c24cf2f0a12ad855f444c30b2421d044120c66f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e37a5cc --- /dev/null +++ b/flake.nix @@ -0,0 +1,44 @@ +{ + description = "A Hyprland version of wayland-scanner in and for C++"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + systems.url = "github:nix-systems/default-linux"; + }; + + outputs = { + self, + nixpkgs, + systems, + }: let + inherit (nixpkgs) lib; + eachSystem = lib.genAttrs (import systems); + pkgsFor = eachSystem (system: + import nixpkgs { + localSystem.system = system; + overlays = with self.overlays; [hyprwayland-scanner]; + }); + mkDate = longDate: (lib.concatStringsSep "-" [ + (builtins.substring 0 4 longDate) + (builtins.substring 4 2 longDate) + (builtins.substring 6 2 longDate) + ]); + in { + overlays = { + default = self.overlays.hpyrwayland-scanner; + hyprwayland-scanner = final: prev: { + hyprwayland-scanner = final.callPackage ./nix/default.nix { + stdenv = final.gcc13Stdenv; + version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); + }; + }; + }; + + packages = eachSystem (system: { + default = self.packages.${system}.hyprwayland-scanner; + inherit (pkgsFor.${system}) hyprwayland-scanner; + }); + + formatter = eachSystem (system: pkgsFor.${system}.alejandra); + }; +} diff --git a/nix/default.nix b/nix/default.nix new file mode 100644 index 0000000..1488c7f --- /dev/null +++ b/nix/default.nix @@ -0,0 +1,27 @@ +{ + lib, + stdenv, + cmake, + pkg-config, + pugixml, + version ? "git", + doCheck ? false, +}: +stdenv.mkDerivation { + pname = "hyprwayland-scanner"; + inherit version doCheck; + src = ../.; + + nativeBuildInputs = [ + cmake + pkg-config + pugixml + ]; + + meta = with lib; { + homepage = "https://github.com/hyprwm/hyprwayland-scanner"; + description = "A Hyprland version of wayland-scanner in and for C++"; + license = licenses.bsd3; + platforms = platforms.linux; + }; +}