61 lines
1.5 KiB
Nix
61 lines
1.5 KiB
Nix
{
|
|
description = "Reproducible";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
poetry2nix = {
|
|
url = "github:nix-community/poetry2nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs = inputs @ {
|
|
self,
|
|
nixpkgs,
|
|
flake-parts,
|
|
poetry2nix,
|
|
...
|
|
} : flake-parts.lib.mkFlake { inherit inputs; } {
|
|
flake = {
|
|
};
|
|
systems = [
|
|
"x86_64-linux"
|
|
"x86_64-darwin"
|
|
];
|
|
perSystem = { system, ... }: let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
config = {
|
|
allowUnfree = true;
|
|
cudaSupport = true;
|
|
};
|
|
};
|
|
poetryLib = poetry2nix.lib.mkPoetry2Nix { inherit pkgs; };
|
|
common = {
|
|
python = pkgs.python311;
|
|
projectDir = ./.;
|
|
preferWheels = true;
|
|
overrides = poetryLib.defaultPoetryOverrides;
|
|
};
|
|
application = poetryLib.mkPoetryApplication common;
|
|
env = poetryLib.mkPoetryEnv (common // {
|
|
editablePackageSources = let project_dir = builtins.getEnv "PROJECT_DIR"; in
|
|
{
|
|
reproducible = if project_dir == "" then ./. else "${project_dir}";
|
|
};
|
|
});
|
|
in rec {
|
|
packages = {
|
|
default = application;
|
|
};
|
|
devShells.default = pkgs.mkShell {
|
|
packages = [ env ];
|
|
};
|
|
#devShells.default = env.overrideAttrs (oldAttrs: {
|
|
# buildInputs = [ args.python ];
|
|
#});
|
|
};
|
|
};
|
|
}
|