nix: init

This commit is contained in:
Mihai Fufezan 2022-12-24 00:59:07 +02:00
parent 301733ae46
commit 10e3971752
No known key found for this signature in database
GPG Key ID: 5899325F2F120900
3 changed files with 83 additions and 0 deletions

27
flake.lock Normal file
View File

@ -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
}

34
flake.nix Normal file
View File

@ -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);
};
}

22
nix/default.nix Normal file
View File

@ -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;
};
}