nix: add packaging; update devshell

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I9f1ddf6dbd141b5a85b4b5a36c2c9a586a6a6964
This commit is contained in:
raf 2026-01-03 12:36:04 +03:00
commit d402e6e300
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
4 changed files with 83 additions and 10 deletions

6
flake.lock generated
View file

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1767428044,
"narHash": "sha256-w28Bmw3xM8NIva6RirQxcRE/PajQwGcSCgtrOQmLlE4=",
"lastModified": 1768665130,
"narHash": "sha256-N9eZwqdrubgKRDICaJ92Q5UMghBR1nbHnokSgZ21EJI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6ff4ad3ef7624ff9cddbee962b1d1852e7fa6f40",
"rev": "c444f4a39d8efbf5e07d678ffde3e661735e1d7e",
"type": "github"
},
"original": {

View file

@ -1,7 +1,11 @@
{
description = "Wayland Wallpaper Daemon";
description = "Super-fast, lightweight and efficient wallpaper daemon for Wayland compositors";
inputs.nixpkgs.url = "github:NixOS/nixpkgs?ref?nixos-unstable";
outputs = {nixpkgs, ...}: let
outputs = {
nixpkgs,
self,
...
}: let
systems = ["x86_64-linux" "aarch64-linux"];
forAllSystems = f:
builtins.listToAttrs (map (system: {
@ -17,5 +21,12 @@
in {
default = pkgs.callPackage ./shell.nix {};
});
packages = forAllSystems (system: let
pkgs = pkgsFor system;
in {
chroma = pkgs.callPackage ./nix/package.nix {};
default = self.packages.${system}.chroma;
});
};
}

65
nix/package.nix Normal file
View file

@ -0,0 +1,65 @@
{
lib,
stdenv,
wayland,
wayland-protocols,
wayland-scanner,
libxkbcommon,
libGL,
mesa,
glibc,
pkg-config,
}: let
fs = lib.fileset;
s = ../.;
in
stdenv.mkDerivation {
pname = "chroma";
version = "1.0.0";
src = fs.toSource {
root = s;
fileset = fs.unions [
(s + /include)
(s + /protocols)
(s + /src)
(s + /Makefile)
];
};
buildInputs = [
# Wayland libraries
wayland.dev
wayland-protocols
wayland-scanner
libxkbcommon
# EGL/OpenGL libraries
libGL
mesa
# System libraries
glibc.dev
];
nativeBuildInputs = [
pkg-config
];
makeFlags = [
"PREFIX=$(out)"
"SYSTEMD_DIR=$(out)/lib/systemd/system"
];
postInstall = ''
install -Dm755 ${../chroma.conf.sample} $out/share/chroma.conf.sample
'';
meta = {
description = "Super-fast, lightweight and efficient wallpaper daemon for Wayland compositors";
license = lib.licenses.mpl20;
mainProgram = "chroma";
maintainers = with lib.maitainers; [NotAShelf];
};
}

View file

@ -27,7 +27,7 @@ pkgs.mkShell {
glibc.dev
# For Tests
(python313.withPackages (ps: with ps; [matplotlib pyplot numpy]))
(python313.withPackages (ps: with ps; [matplotlib numpy]))
];
nativeBuildInputs = with pkgs; [
@ -47,8 +47,5 @@ pkgs.mkShell {
'';
# Environment variables for the build system
env = {
CHROMA_VERSION = "1.0.0";
WAYLAND_DEBUG = 1;
};
env.WAYLAND_DEBUG = 1;
}