erpnext-nix/flake.nix
2023-05-18 15:57:22 +02:00

45 lines
1.6 KiB
Nix

{
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;
};
attrsets = pkgs.lib.attrsets;
overrideFiles = (attrsets.filterAttrs (f: type: type == "regular") (builtins.readDir ./python));
overridePackageNames = attrsets.mapAttrsToList (f: _: builtins.replaceStrings [".nix"] [""] f) overrideFiles;
python3 = pkgs.python3.override ({
packageOverrides = pself: psuper:
attrsets.genAttrs overridePackageNames (o: pself.callPackage ./python/${o}.nix {});
});
newversion = python3.pkgs.newversion.overrideAttrs(old: {
propagatedBuildInputs = old.propagatedBuildInputs ++ [python3.pkgs.setuptools];
});
in rec {
packages = {
devEnv = pkgs.buildEnv {
name = "erpnext-nix-dev-env";
paths = [
newversion
pkgs.dasel
];
};
inherit pkgs;
pip2nix = import "${pip2nix}/default.nix" { inherit pkgs; pythonPackages = "python310Packages"; };
erpnext = python3.pkgs.erpnext;
pythonPkgs = python3.pkgs;
};
});
}