2024-04-10 16:26:38 +00:00
|
|
|
{
|
|
|
|
description = "PLACEHOLDER";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
|
|
poetry2nix-lib = {
|
|
|
|
url = "github:nix-community/poetry2nix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2024-04-11 19:11:05 +00:00
|
|
|
microvm = {
|
|
|
|
url = "github:astro/microvm.nix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2024-04-10 16:26:38 +00:00
|
|
|
};
|
|
|
|
|
2024-04-11 19:11:05 +00:00
|
|
|
outputs = {self, ...} @ inputs: let
|
2024-04-10 16:26:38 +00:00
|
|
|
supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
|
2024-04-11 19:11:05 +00:00
|
|
|
forAllSystems = inputs.nixpkgs.lib.genAttrs supportedSystems;
|
|
|
|
pkgs = forAllSystems (system: inputs.nixpkgs.legacyPackages.${system});
|
|
|
|
poetry2nix = forAllSystems (system: inputs.poetry2nix-lib.lib.mkPoetry2Nix {pkgs = pkgs.${system};});
|
2024-04-10 16:26:38 +00:00
|
|
|
in {
|
|
|
|
# `nix build`
|
|
|
|
packages = forAllSystems (system: {
|
|
|
|
default = poetry2nix.${system}.mkPoetryApplication {
|
|
|
|
projectDir = self;
|
|
|
|
};
|
2024-04-11 19:11:05 +00:00
|
|
|
vm = self.nixosConfigurations.vm.config.microvm.declaredRunner;
|
|
|
|
});
|
|
|
|
|
|
|
|
# `nix run`
|
|
|
|
apps = forAllSystems (system: {
|
|
|
|
default = {
|
|
|
|
program = "${self.packages.${system}.default}/bin/testdata";
|
|
|
|
type = "app";
|
|
|
|
};
|
2024-04-10 16:26:38 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
# `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];
|
|
|
|
};
|
|
|
|
});
|
2024-04-11 19:11:05 +00:00
|
|
|
|
|
|
|
# NixOS Module
|
|
|
|
nixosModules.default = import ./nix/module.nix inputs;
|
2024-04-10 16:26:38 +00:00
|
|
|
};
|
|
|
|
}
|