initial working proof of concept
This commit is contained in:
49
flake.nix
Normal file
49
flake.nix
Normal file
@ -0,0 +1,49 @@
|
||||
{
|
||||
description = "PLACEHOLDER";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
poetry2nix-lib = {
|
||||
url = "github:nix-community/poetry2nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
poetry2nix-lib,
|
||||
}: let
|
||||
supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
|
||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
|
||||
poetry2nix = forAllSystems (system: poetry2nix-lib.lib.mkPoetry2Nix {pkgs = pkgs.${system};});
|
||||
in {
|
||||
# `nix build`
|
||||
packages = forAllSystems (system: {
|
||||
default = poetry2nix.${system}.mkPoetryApplication {
|
||||
projectDir = self;
|
||||
};
|
||||
});
|
||||
|
||||
# `nix fmt`
|
||||
formatter = forAllSystems (system: pkgs.${system}.alejandra);
|
||||
|
||||
# `nix develop`
|
||||
devShells = forAllSystems (system: {
|
||||
default = let
|
||||
poetryEnv =
|
||||
if builtins.pathExists ./poetry.lock
|
||||
then poetry2nix.${system}.mkPoetryEnv {projectDir = self;}
|
||||
else null;
|
||||
in
|
||||
pkgs.${system}.mkShellNoCC {
|
||||
packages = with pkgs.${system};
|
||||
[
|
||||
poetry
|
||||
]
|
||||
++ [poetryEnv];
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user