proof of concept qotd server
This commit is contained in:
54
nix/package.nix
Normal file
54
nix/package.nix
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
lib
|
||||
, uiua
|
||||
, stdenvNoCC
|
||||
, runtimeShell
|
||||
}:
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "qotd";
|
||||
version = "unstable";
|
||||
|
||||
src = builtins.filterSource (path: type: let
|
||||
baseName = baseNameOf (toString path);
|
||||
in !(lib.any (b: b) [
|
||||
(!(lib.cleanSourceFilter path type))
|
||||
(type == "directory" && lib.elem baseName [
|
||||
".direnv"
|
||||
".git"
|
||||
".jj"
|
||||
"target"
|
||||
"result"
|
||||
])
|
||||
(type == "regular" && lib.elem baseName [
|
||||
"flake.nix"
|
||||
"flake.lock"
|
||||
"default.nix"
|
||||
"module.nix"
|
||||
".envrc"
|
||||
])
|
||||
(type == "regular" && lib.hasSuffix ".uasm" baseName)
|
||||
])) ./..;
|
||||
|
||||
nativeBuildInputs = [ uiua ];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
uiua build --output .main.uasm main.ua
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
wrapper = ''
|
||||
#!${runtimeShell}
|
||||
"${uiua}"/bin/uiua run ${placeholder "out"}/bin/.main.uasm
|
||||
'';
|
||||
|
||||
passAsFile = [ "wrapper" ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -Dm444 .main.uasm -t "$out"/bin
|
||||
install -Dm555 "$wrapperPath" "$out"/bin/qotd
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user