nix: init (#7)

This commit is contained in:
Mihai Fufezan 2022-08-23 20:58:33 +03:00 committed by GitHub
parent 571f495e88
commit 0faf740541
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 151 additions and 0 deletions

27
flake.lock Normal file
View file

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

38
flake.nix Normal file
View file

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

86
nix/default.nix Normal file
View file

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