From f2bfefca39727b1294709c153d3e08291c31c39d Mon Sep 17 00:00:00 2001 From: Ashhhleyyy Date: Sun, 18 Feb 2024 13:22:54 +0000 Subject: [PATCH] feat(backend): janky (broken) cross compile/build setup using nix --- flake.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/flake.nix b/flake.nix index d338329..149a76b 100644 --- a/flake.nix +++ b/flake.nix @@ -39,6 +39,32 @@ WorkingDir = "/state"; }; }; + + cross = flake-utils.lib.eachDefaultSystem (crossSystem: + let + pkgs = import nixpkgs { + localSystem = system; + inherit crossSystem; + }; + in + { + default = pkgs.python311Packages.buildPythonApplication { + pname = "aci-backend"; + inherit version; + propagatedBuildInputs = dependencies pkgs.python311Packages; + src = ./backend; + }; + + docker = pkgs.dockerTools.buildLayeredImage { + name = self.packages.${system}.cross.default.${crossSystem}.pname; + tag = "latest"; + contents = [ self.packages.${system}.cross.default.${crossSystem} pkgs.busybox ]; + config = { + Cmd = [ "/bin/app.py" ]; + WorkingDir = "/state"; + }; + }; + }); }; devShells.default = pkgs.mkShell { nativeBuildInputs = with pkgs; [