erpnext-nix/flake.nix

51 lines
2 KiB
Nix
Raw Normal View History

2023-05-18 13:57:22 +00:00
{
description = "Dev Setup";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.pip2nix = {
url = "github:nix-community/pip2nix";
flake = false;
# inputs.nixpkgs.follows = "nixpkgs";
# inputs.flake-utils.follows = "flake-utils";
};
outputs = {nixpkgs, flake-utils, pip2nix, ...}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system;
config.allowBroken = true;
};
2023-05-20 21:36:21 +00:00
#attrsets = pkgs.lib.attrsets;
#overrideFiles = (attrsets.filterAttrs (f: type: type == "regular") (builtins.readDir ./python));
#overridePackageNames = attrsets.mapAttrsToList (f: _: builtins.replaceStrings [".nix"] [""] f) overrideFiles;
py = pkgs.callPackage ./python.nix { inherit pkgs; };
# packageOverrides = pself: psuper:
# attrsets.genAttrs overridePackageNames (o: pself.callPackage ./python/${o}.nix {});
#});
#newversion = python3.pkgs.newversion.overrideAttrs(old: {
# propagatedBuildInputs = old.propagatedBuildInputs ++ [python3.pkgs.setuptools];
#});
2023-05-21 15:55:26 +00:00
penv = py.buildEnv.override {
extraLibs = [ py.pkgs.frappe py.pkgs.erpnext ];
};
runErpNext = pkgs.writeShellScriptBin "runErpNext" ''
export PYTHON_PATH=${penv}/${py.sitePackages}
${penv}/bin/gunicorn --bind=0.0.0.0:9090 --threads=4 --workers=2 --worker-class=gthread --worker-tmp-dir=/dev/shm --timeout=120 --preload frappe.app:application
'';
2023-05-18 13:57:22 +00:00
in rec {
packages = {
devEnv = pkgs.buildEnv {
name = "erpnext-nix-dev-env";
paths = [
pkgs.dasel
];
};
2023-05-21 15:55:26 +00:00
inherit pkgs runErpNext;
2023-05-18 13:57:22 +00:00
pip2nix = import "${pip2nix}/default.nix" { inherit pkgs; pythonPackages = "python310Packages"; };
2023-05-20 21:36:21 +00:00
erpnext = py.pkgs.erpnext;
pythonPkgs = py.pkgs;
2023-05-18 13:57:22 +00:00
};
});
}