178 lines
5.5 KiB
Nix
178 lines
5.5 KiB
Nix
{
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
|
|
inputs.river = {
|
|
url = "git+https://codeberg.org/river/river.git?ref=main";
|
|
flake = false;
|
|
};
|
|
|
|
outputs = inputs @ {
|
|
self,
|
|
nixpkgs,
|
|
river,
|
|
}: let
|
|
systems = ["x86_64-linux" "aarch64-linux"];
|
|
eachSystem = f:
|
|
nixpkgs.lib.genAttrs systems (system:
|
|
f {
|
|
inherit system;
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
ownPkgs = self.packages.${system};
|
|
});
|
|
in {
|
|
packages = eachSystem ({
|
|
pkgs,
|
|
system,
|
|
...
|
|
}: 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;
|
|
};
|
|
spork = pkgs.fetchFromGitHub {
|
|
owner = "janet-lang";
|
|
repo = "spork";
|
|
rev = "master";
|
|
hash = "sha256-gFUyrqkcjD34LZ9G7igaDwHnfIUUN9MzbvwEk9uWl1w=";
|
|
};
|
|
janet-pm = pkgs.stdenv.mkDerivation {
|
|
pname = "janet-pm";
|
|
version = "1.1.1";
|
|
src = spork;
|
|
buildInputs = [pkgs.janet];
|
|
|
|
buildPhase = ''
|
|
export JANET_PATH=$out
|
|
mkdir $JANET_PATH
|
|
janet --install .
|
|
'';
|
|
};
|
|
river = pkgs.stdenv.mkDerivation (finalAttrs: {
|
|
name = "river";
|
|
version = "0.4";
|
|
src = inputs.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;
|
|
});
|
|
default = pkgs.stdenv.mkDerivation {
|
|
pname = "censtablo";
|
|
version = "0.1.0";
|
|
src = ./.;
|
|
nativeBuildInputs = [pkgs.pkg-config janet-pm];
|
|
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
|
|
pkgs.janet
|
|
];
|
|
|
|
RIVER_PROTOCOLS = "${inputs.river}/protocol/";
|
|
deps = [
|
|
"${pkgs.fetchFromGitHub {
|
|
owner = "janet-lang";
|
|
repo = "pkgs";
|
|
rev = "master";
|
|
hash = "sha256-VPzMcRq8oerlHwDegKaqP6MpOMsUprDAAzyqrI7YEY8=";
|
|
}}:git__https___github.com_janet-lang_pkgs.git"
|
|
"${spork}:git__https___github.com_janet-lang_spork"
|
|
"${pkgs.fetchFromGitHub {
|
|
owner = "pyrmont";
|
|
repo = "lemongrass";
|
|
rev = "master";
|
|
hash = "sha256-OUqK57EYh6McnxnbvqoPm92eBMYM5iNaPuN6R0yZHA4=";
|
|
}}:git__https___github.com_pyrmont_lemongrass"
|
|
"${pkgs.fetchFromGitea {
|
|
domain = "codeberg.org";
|
|
owner = "ifreund";
|
|
repo = "janet-wayland";
|
|
rev = "189eb3b2e3a87a676b7f682d8cf1764bb6eb457f";
|
|
hash = "sha256-dIGjPeBL8/enIwwrSMqNdSOtBWnyo1ioHSLcL1VN2uI=";
|
|
}}:git__https___codeberg.org_ifreund_janet-wayland"
|
|
"${pkgs.fetchFromGitea {
|
|
domain = "codeberg.org";
|
|
owner = "ifreund";
|
|
repo = "janet-xkbcommon";
|
|
rev = "main";
|
|
hash = "sha256-W7X1ABu1v2+sqZ29OICiYYaFixxXo4uclYfsF4OMAPE=";
|
|
}}:git__https___codeberg.org_ifreund_janet-xkbcommon"
|
|
];
|
|
|
|
buildPhase = ''
|
|
export JANET_OFFLINE=1
|
|
export JANET_PATH=$PWD/janet-path
|
|
export JANET_BUILD_DIR=$(mktemp -d)
|
|
mkdir -p $JANET_PATH/.cache
|
|
cd $JANET_PATH/.cache
|
|
for dep in $deps; do
|
|
echo $dep
|
|
cp -r --no-preserve=mode $(tr ':' ' ' <<<"$dep")
|
|
f=$(sed -e 's/.*://' <<<"$dep")/bundle/info.jdn
|
|
[ -f "$f" ] && sed -ie 's/:(jpm-)?dependencies @\[.*\]//' $f
|
|
done
|
|
cd -
|
|
janet-pm install https://github.com/janet-lang/spork
|
|
janet-pm install https://github.com/pyrmont/lemongrass
|
|
janet-pm install https://codeberg.org/ifreund/janet-wayland
|
|
janet-pm install https://codeberg.org/ifreund/janet-xkbcommon
|
|
janet-pm install
|
|
'';
|
|
|
|
installPhase = ''
|
|
install -D -t $out/bin/ ./janet-path/bin/censtablo{,-repl}
|
|
'';
|
|
};
|
|
in {
|
|
inherit default janet-pm river;
|
|
});
|
|
devShells = eachSystem ({
|
|
pkgs,
|
|
system,
|
|
ownPkgs,
|
|
...
|
|
}: {
|
|
default = pkgs.mkShell {
|
|
inputsFrom = [ownPkgs.default];
|
|
inherit (ownPkgs.default) RIVER_PROTOCOLS;
|
|
packages = [ownPkgs.janet-pm];
|
|
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/"
|
|
'';
|
|
};
|
|
});
|
|
};
|
|
}
|