Remove flake-utils dependency

This commit is contained in:
2026-06-09 16:41:23 -07:00
parent a5d8ba6709
commit 274ae3fb07
2 changed files with 53 additions and 75 deletions

View File

@@ -3,54 +3,66 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
python = pkgs.python3;
# Define the application package
piratsApp = python.pkgs.buildPythonApplication {
pname = "pirats";
version = "0.1.0";
src = ./.;
format = "pyproject";
outputs = { self, nixpkgs, ... }:
let
# Systems to support
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
# Helper to generate an attrset for all supported systems
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
in
{
packages = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
python = pkgs.python3;
in
{
default = python.pkgs.buildPythonApplication {
pname = "pirats";
version = "0.1.0";
src = ./.;
format = "pyproject";
nativeBuildInputs = with python.pkgs; [
setuptools
wheel
];
nativeBuildInputs = with python.pkgs; [
setuptools
wheel
];
propagatedBuildInputs = with python.pkgs; [
fastapi
sqlmodel
uvicorn
jinja2
python-multipart
];
propagatedBuildInputs = with python.pkgs; [
fastapi
sqlmodel
uvicorn
jinja2
python-multipart
];
nativeCheckInputs = with python.pkgs; [
pytestCheckHook
];
nativeCheckInputs = with python.pkgs; [
pytestCheckHook
];
pythonImportsCheck = [ "pirats" ];
};
in
{
packages.default = piratsApp;
packages.pirats = piratsApp;
pythonImportsCheck = [ "pirats" ];
};
pirats = self.packages.${system}.default;
}
);
devShells = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.default ];
packages = with pkgs; [
pkgs.python3.pkgs.pytest
];
};
}
);
devShells.default = pkgs.mkShell {
inputsFrom = [ piratsApp ];
packages = with pkgs; [
python.pkgs.pytest
];
};
}
) // {
# NixOS Module to run the application as a service
nixosModules.default = { config, lib, pkgs, ... }:
let