From 10e39717520fd5e0775717fd1e7e06a4b776a62c Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Sat, 24 Dec 2022 00:59:07 +0200 Subject: [PATCH] nix: init --- flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 34 ++++++++++++++++++++++++++++++++++ nix/default.nix | 22 ++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 nix/default.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..bb9feaa --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1669969257, + "narHash": "sha256-mOS13sK3v+kfgP+1Mh56ohiG8uVhLHAo7m/q9kqAehc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b72b8b94cf0c012b0252a9100a636cad69696666", + "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..bb44649 --- /dev/null +++ b/flake.nix @@ -0,0 +1,34 @@ +{ + description = "Hyprland Protocols"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + outputs = { + self, + nixpkgs, + ... + }: let + inherit (nixpkgs) lib; + genSystems = lib.genAttrs [ + "aarch64-linux" + "x86_64-linux" + ]; + pkgsFor = nixpkgs.legacyPackages; + mkDate = longDate: (lib.concatStringsSep "-" [ + (builtins.substring 0 4 longDate) + (builtins.substring 4 2 longDate) + (builtins.substring 6 2 longDate) + ]); + version = "0.1" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); + in { + overlays.default = _: prev: { + hyprland-protocols = prev.callPackage ./nix/default.nix {inherit version;}; + }; + + packages = genSystems (system: + (self.overlays.default null pkgsFor.${system}) + // {default = self.packages.${system}.hyprland-protocols;}); + + formatter = genSystems (system: pkgsFor.${system}.alejandra); + }; +} diff --git a/nix/default.nix b/nix/default.nix new file mode 100644 index 0000000..62b7ed4 --- /dev/null +++ b/nix/default.nix @@ -0,0 +1,22 @@ +{ + lib, + stdenv, + meson, + ninja, + version, +}: +stdenv.mkDerivation { + pname = "hyprland-protocols"; + inherit version; + + src = ../.; + + nativeBuildInputs = [meson ninja]; + + meta = { + homepage = "https://github.com/hyprwm/hyprland-protocols"; + description = "Wayland protocol extensions for Hyprland"; + license = lib.licenses.bsd3; + platforms = lib.platforms.linux; + }; +}