Skip to content

Commit

Permalink
Use nix
Browse files Browse the repository at this point in the history
  • Loading branch information
n8henrie committed Jul 7, 2024
1 parent 60b6ac3 commit 6bad8af
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 65 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
description = "Flake for https://github.com/n8henrie/fastcli";

inputs.nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
outputs =
{ self, nixpkgs }:
let
systems = [
"aarch64-darwin"
"x86_64-darwin"
"x86_64-linux"
"aarch64-linux"
];
eachSystem =
with nixpkgs.lib;
f: foldAttrs mergeAttrs { } (map (s: mapAttrs (_: v: { ${s} = v; }) (f s)) systems);
in
eachSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
pname = "fastcli";
in
{
packages = {
default = pkgs.python311.withPackages (_: [ self.packages.${system}.${pname} ]);
${pname} = pkgs.callPackage (
{ lib, python3Packages }:
python3Packages.buildPythonPackage {
inherit pname;
version = builtins.elemAt (lib.splitString "\"" (
lib.findSingle (val: builtins.match "^__version__ = \".*\"$" val != null) (abort "none")
(abort "multiple")
(lib.splitString "\n" (builtins.readFile ./${pname}/__init__.py))
)) 1;
src = lib.cleanSource ./.;
pyproject = true;
nativeBuildInputs = with python3Packages; [ pythonRelaxDepsHook ];
build-system = [ python3Packages.setuptools-scm ];
dependencies = with python3Packages; [ aiohttp ];
pythonRelaxDeps = [ "aiohttp" ];
}
) { };
};

devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [
python38
python39
python310
python311
(python312.withPackages (
ps:
propagatedBuildInputs
++ (with ps; [
mypy
pytest
tox
])
))
];
};
}
);
}

0 comments on commit 6bad8af

Please sign in to comment.