From 253fd2f2f0391f680f62ca08953f2b37a2355e13 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 25 Sep 2022 17:49:59 +0200 Subject: [PATCH] packages/ircbot: build --- packages/projects.nix | 1 + packages/servers/ircbot/project.nix | 32 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 packages/servers/ircbot/project.nix diff --git a/packages/projects.nix b/packages/projects.nix index 22dd73b..c4a782a 100644 --- a/packages/projects.nix +++ b/packages/projects.nix @@ -27,6 +27,7 @@ ./modules/devshell.nix ./build-support + ./servers/ircbot/project.nix ./websites/landing/project.nix ./websites/stop-using-nix-env/project.nix ]; diff --git a/packages/servers/ircbot/project.nix b/packages/servers/ircbot/project.nix new file mode 100644 index 0000000..e9240ba --- /dev/null +++ b/packages/servers/ircbot/project.nix @@ -0,0 +1,32 @@ +{ inputs, pkgs, ... }: + +let + python = pkgs.python3; +in +{ + packages.ircbot = with pkgs; stdenvNoCC.mkDerivation { + pname = "ircbot"; + version = "0.0.0"; + + src = with inputs.nix-filter.lib; filter { + root = ./.; + include = [ + (matchExt "py") + (inDirectory "hooks") + ]; + }; + installPhase = '' + mkdir -p $out/bin $out/lib + + cp -r $src/ $out/lib/ircbot + + cat <$out/bin/ircbot + #!${runtimeShell} + export PYTHONNOUSERSITE=true + export PYTHONPATH="$out/lib/ircbot" + exec ${python.interpreter} $out/lib/ircbot/main.py "$@" + EOF + chmod +x $out/bin/ircbot + ''; + }; +}