59 lines
1.5 KiB
Nix
59 lines
1.5 KiB
Nix
#let
|
|
# pkgs = import ( builtins.fetchTarball {
|
|
# name = "nixos-25.05";
|
|
# url = "https://github.com/NixOS/nixpkgs/archive/nixos-25.05.tar.gz";
|
|
# sha256 = "sha256:0v6bd1xk8a2aal83karlvc853x44dg1n4nk08jg3dajqyy0s98np";
|
|
# }) {};
|
|
#in
|
|
{ pkgs ? import <nixpkgs> { }
|
|
, pkgsLinux ? import <nixpkgs> { system = "x86_64-linux"; }
|
|
}:
|
|
pkgs.stdenv.mkDerivation {
|
|
pname = "xrforge";
|
|
version = "0.1.0";
|
|
|
|
# Fetch the matching cosmopolitan source tree
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "jart";
|
|
repo = "cosmopolitan";
|
|
# We use the version that matches the pinned nixpkgs package release
|
|
rev = pkgs.cosmopolitan.version;
|
|
hash = pkgs.cosmopolitan.src.outputHash;
|
|
};
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
gnumake
|
|
unzip
|
|
curl
|
|
cosmopolitan.cosmocc
|
|
];
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
|
|
# cosmocc knows exactly where the include/ and lib/ files are
|
|
# from the base package. Just pass it the source and tell it to compile.
|
|
# build once run anywhere using linux
|
|
export CC=cosmocc
|
|
export CXX=cosmocc
|
|
#sed -i 's/^SHELL/#SHELL/g' Makefile
|
|
#make -j8 #o//tool/net/redbean.o
|
|
cosmocc -O2 -I. tool/net/redbean.c -o redbean.com
|
|
|
|
runHook postBuild
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
#mkdir -p $out/bin
|
|
#cp redbean.com $out/bin/xrforge.com
|
|
|
|
## Run your local enhancement script
|
|
#bash ${./util/xrforge.sh} $out/bin/xrforge.com
|
|
|
|
#chmod +x $out/bin/xrforge.com
|
|
|
|
runHook postInstall
|
|
'';
|
|
}
|