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

34
flake.lock generated
View File

@@ -1,23 +1,5 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1780749050,
@@ -36,24 +18,8 @@
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

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;
outputs = { self, nixpkgs, ... }:
let
# Systems to support
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
# Define the application package
piratsApp = python.pkgs.buildPythonApplication {
pname = "pirats";
version = "0.1.0";
src = ./.;
format = "pyproject";
# 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