Nix: init

This commit is contained in:
Mihai Fufezan 2024-07-01 10:52:16 +03:00
parent cef415f033
commit 19c19d36e9
Signed by: fufexan
SSH Key Fingerprint: SHA256:SdnKmEpJrDu1+2UO1QpB/Eg4HKcdDi6n+xSRqFNJVpg
3 changed files with 211 additions and 0 deletions

91
flake.lock Normal file
View File

@ -0,0 +1,91 @@
{
"nodes": {
"hyprutils": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"systems": [
"systems"
]
},
"locked": {
"lastModified": 1719593398,
"narHash": "sha256-OC3ciW8JmQwFyWl2v5aCNx1Qtbqzglv2nAqqX0pu0xk=",
"owner": "hyprwm",
"repo": "hyprutils",
"rev": "7e1b6610a21b451ca8aacf5b22c95f4139df43d6",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprutils",
"type": "github"
}
},
"hyprwayland-scanner": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"systems": [
"systems"
]
},
"locked": {
"lastModified": 1719440676,
"narHash": "sha256-7J5P78kH+Sg7LaKYOqnJtOKOF+NB2z/8bhm622FULPI=",
"owner": "hyprwm",
"repo": "hyprwayland-scanner",
"rev": "55c78a56c0f6831a62945f8d3edc62ed827c575c",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprwayland-scanner",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1719506693,
"narHash": "sha256-C8e9S7RzshSdHB7L+v9I51af1gDM5unhJ2xO1ywxNH8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b2852eb9365c6de48ffb0dc2c9562591f652242a",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"hyprutils": "hyprutils",
"hyprwayland-scanner": "hyprwayland-scanner",
"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
}

62
flake.nix Normal file
View File

@ -0,0 +1,62 @@
{
description = "A very light linux rendering backend library";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default-linux";
hyprutils = {
url = "github:hyprwm/hyprutils";
inputs.nixpkgs.follows = "nixpkgs";
inputs.systems.follows = "systems";
};
hyprwayland-scanner = {
url = "github:hyprwm/hyprwayland-scanner";
inputs.nixpkgs.follows = "nixpkgs";
inputs.systems.follows = "systems";
};
};
outputs = {
self,
nixpkgs,
systems,
...
} @ inputs: let
inherit (nixpkgs) lib;
eachSystem = lib.genAttrs (import systems);
pkgsFor = eachSystem (system:
import nixpkgs {
localSystem.system = system;
overlays = with self.overlays; [aquamarine];
});
mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
in {
overlays = {
default = self.overlays.aquamarine;
aquamarine = lib.composeManyExtensions [
inputs.hyprutils.overlays.default
inputs.hyprwayland-scanner.overlays.default
(final: prev: {
aquamarine = final.callPackage ./nix/default.nix {
stdenv = final.gcc13Stdenv;
version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
};
aquamarine-with-tests = final.aquamarine.override {doCheck = true;};
})
];
};
packages = eachSystem (system: {
default = self.packages.${system}.aquamarine;
inherit (pkgsFor.${system}) aquamarine aquamarine-with-tests;
});
formatter = eachSystem (system: pkgsFor.${system}.alejandra);
};
}

58
nix/default.nix Normal file
View File

@ -0,0 +1,58 @@
{
lib,
stdenv,
cmake,
hyprutils,
hyprwayland-scanner,
libdisplay-info,
libdrm,
libffi,
libinput,
libseat,
mesa,
pixman,
pkg-config,
udev,
wayland,
wayland-protocols,
version ? "git",
doCheck ? false,
}:
stdenv.mkDerivation {
pname = "aquamarine";
inherit version doCheck;
src = ../.;
nativeBuildInputs = [
cmake
hyprwayland-scanner
pkg-config
];
buildInputs = [
hyprutils
libdisplay-info
libdrm
libffi
libinput
libseat
mesa
pixman
udev
wayland
wayland-protocols
];
outputs = ["out" "dev"];
cmakeBuildType = "RelWithDebInfo";
dontStrip = true;
meta = {
homepage = "https://github.com/hyprwm/aquamarine";
description = "A very light linux rendering backend library";
license = lib.licenses.bsd3;
platforms = lib.platforms.linux;
};
}