diff --git a/flake.lock b/flake.lock index 9e0cbd1..704b528 100644 --- a/flake.lock +++ b/flake.lock @@ -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": { diff --git a/flake.nix b/flake.nix index f8cc0cb..c77e98d 100644 --- a/flake.nix +++ b/flake.nix @@ -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; + }); }; } diff --git a/nix/package.nix b/nix/package.nix new file mode 100644 index 0000000..10d2387 --- /dev/null +++ b/nix/package.nix @@ -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]; + }; + } diff --git a/shell.nix b/shell.nix index 987fb41..e6e3354 100644 --- a/shell.nix +++ b/shell.nix @@ -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; }