Files
censtablo/flake.nix
bluepython508 5930ffd357 Initial Commit
2026-02-10 14:19:40 +00:00

126 lines
3.9 KiB
Nix

{
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.river = {
url = "git+https://codeberg.org/river/river.git?ref=main";
flake = false;
};
outputs = {
self,
nixpkgs,
river,
}: let
systems = ["x86_64-linux" "aarch64-linux"];
eachSystem = f:
nixpkgs.lib.genAttrs systems (system:
f {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
});
in {
devShells = eachSystem ({
pkgs,
system,
...
}: {
default = pkgs.mkShell (let
libxkbcommon = pkgs.libxkbcommon.overrideAttrs {
version = "1.12.0";
src = pkgs.fetchFromGitHub {
owner = "xkbcommon";
repo = "libxkbcommon";
tag = "xkbcommon-1.12.0";
hash = "sha256-QO3snl7NiyS2ao2MF3eT/lkNmVBjijr3JdTyrPn/2MQ=";
};
patches = [];
doCheck = false;
};
in {
packages = let
janet-pm = pkgs.stdenv.mkDerivation rec {
pname = "janet-pm";
version = "1.1.1";
src = pkgs.fetchFromGitHub {
owner = "janet-lang";
repo = "spork";
rev = "v${version}";
hash = "sha256-0L2G7flzNzi8w1nkGcQrtKjGl/D2uC8xSRgsBuLgRxM=";
};
patches = [
(pkgs.fetchpatch {
url = "https://github.com/tw4452852/spork/commit/304ff781565d9bac21bef450770a312182730727.patch";
hash = "sha256-9hTY3s3GphAg07we7gOF8vAPAYaWOjVkaspt8wP5KOU=";
})
(pkgs.fetchpatch {
url = "https://patch-diff.githubusercontent.com/raw/janet-lang/spork/pull/269.patch";
hash = "sha256-HMvqmiZR+a2yE54PqlLji2Vi6zoUcQ8eD5HFcqAPxEo=";
})
];
nativeBuildInputs = [pkgs.janet];
buildPhase = ''
export JANET_PATH=$out
mkdir $JANET_PATH
janet --install .
'';
};
river-pkg = pkgs.stdenv.mkDerivation (finalAttrs: {
name = "river";
version = "0.4";
src = river;
deps = pkgs.callPackage ./river.build.zig.zon.nix {};
zigBuildFlags = ["--system" "${finalAttrs.deps}" "-Dxwayland"];
nativeBuildInputs = with pkgs; [pkg-config wayland-scanner xwayland zig_0_15.hook];
buildInputs = with pkgs; [
libGL
libevdev
libinput
pixman
udev
wayland
wayland-protocols
wlroots_0_19
libx11
libxkbcommon
];
dontConfigure = true;
});
repl = pkgs.writeScriptBin "censtablo-repl" ''
#!/usr/bin/env janet
(import spork/netrepl)
(netrepl/client :unix (string (os/getenv "XDG_RUNTIME_DIR") "/censtablo-" (os/getenv "WAYLAND_DISPLAY")))
'';
in [pkgs.janet janet-pm river-pkg repl];
nativeBuildInputs = [pkgs.pkg-config];
buildInputs = [
(pkgs.wayland.overrideAttrs (final: prev: {
patches =
prev.patches
++ [
(pkgs.fetchpatch {
url = "https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/485.patch";
hash = "sha256-gd5BRE/ioFMM86Q8HLSzdvuwDDaqws0b3HiInC0nNgQ=";
})
];
}))
pkgs.wayland-scanner
pkgs.wayland-protocols
libxkbcommon
];
RIVER_PROTOCOLS = "${river}/protocol/";
shellHook = ''
export JANET_PATH="$PWD/.jpm"
mkdir -p $JANET_PATH
# Put this at the end so that installing spork in a local environment _doesn't_ override the janet-pm we're providing with patches so that pkg-config doesn't get `with-path`
export PATH="$PATH:$JANET_PATH/bin/"
'';
});
});
};
}