Add package.nix and cleanup build process

This commit is contained in:
2026-07-07 12:09:06 +01:00
parent 2930d71889
commit 10e0de5b05
4 changed files with 88 additions and 7 deletions
Generated
+27
View File
@@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1783148766,
"narHash": "sha256-uslt2pqShTIXDdAHRHv2QkYLsVdY8Oqwz0EA48/RSM8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a50de1b7d8a586adc18d2395c19de7d6058e6030",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-26.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
+7 -2
View File
@@ -1,7 +1,7 @@
{ {
description = "kutu wm environment"; description = "kutu wm environment";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
outputs = { self, nixpkgs }: outputs = { self, nixpkgs }:
let let
@@ -12,17 +12,22 @@
in { in {
devShells.${system}.default = pkgs.mkShell { devShells.${system}.default = pkgs.mkShell {
packages = with pkgs; [ packages = with pkgs; [
ruby (ruby.withPackages (ps: [
ps.ffi
]))
gcc gcc
pkg-config pkg-config
xorg.libxcb xorg.libxcb
xorg.xcbutilwm xorg.xcbutilwm
xorg.xrandr
xorg.xprop
]; ];
shellHook = '' shellHook = ''
echo "kutu dev shell" echo "kutu dev shell"
''; '';
}; };
packages.${system}.default = pkgs.callPackage ./package.nix {};
}; };
} }
+54
View File
@@ -0,0 +1,54 @@
{ stdenv
, ruby
, makeWrapper
, pkg-config
, xorg
, rubyPackages
, gcc
, lib
}:
stdenv.mkDerivation {
pname = "kutu";
version = "0.1.0";
src = ./.;
nativeBuildInputs = [
pkg-config
makeWrapper
gcc
];
buildInputs = [
(ruby.withPackages (ps: [
ps.ffi
]))
xorg.libxcb
xorg.xcbutilwm
xorg.xrandr
xorg.xprop
];
buildPhase = ''
./setup.sh
'';
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/build
mkdir -p $out/src
cp bin/kutu.rb $out/bin/kutu.rb
cp bin/kutu-run.rb $out/bin/kutu-run.rb
cp build/X-kutu.so $out/build/
cp -r src $out/src
wrapProgram $out/bin/kutu.rb \
--prefix PATH : ${lib.makeBinPath [
xorg.xrandr
xorg.xprop
]}
'';
}
-5
View File
@@ -28,9 +28,4 @@ for f in "$DIR/bin/"* "$DIR/src/shell/"*; do
} }
done done
if ! command -v kutu.rb >/dev/null 2>&1 || ! command -v kutu-run.rb >/dev/null 2>&1; then
echo "Tip: Add $DIR/bin to your PATH to run 'kutu.rb' and 'kutu-run.rb' from anywhere:"
echo "export PATH=\"\$PATH:$DIR/bin\""
fi
echo -e "\e[32mAll done! Build successful.\e[0m" echo -e "\e[32mAll done! Build successful.\e[0m"