add basic python

This commit is contained in:
Sam W 2026-07-03 10:19:14 +01:00
parent 4f2a047eb4
commit 547d252ad2
3 changed files with 48 additions and 0 deletions

View File

@ -21,6 +21,10 @@
path = ./devshell; path = ./devshell;
description = "A basic devshell setup"; description = "A basic devshell setup";
}; };
python = {
path = ./python;
description = "A basic python setup";
};
}; };
} }
// utils.lib.eachDefaultSystem (system: let // utils.lib.eachDefaultSystem (system: let

39
python/flake.nix Normal file
View File

@ -0,0 +1,39 @@
{
description = "Python spaghetti from samw";
inputs = {
treefmt-nix.url = "github:numtide/treefmt-nix";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
{
self,
nixpkgs,
treefmt-nix,
...
}:
let
systems = [
"aarch64-darwin"
"x86_64-linux"
];
eachSystem = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
treefmtEval = eachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix);
in
{
devShells = eachSystem (pkgs: {
default = pkgs.mkShellNoCC {
buildInputs = with pkgs; [
uv
ty
];
};
});
formatter = eachSystem (pkgs: treefmtEval.${pkgs.stdenv.hostPlatform.system}.config.build.wrapper);
# for `nix flake check`
checks = eachSystem (pkgs: {
formatting = treefmtEval.${pkgs.system}.config.build.check self;
});
};
}

5
python/treefmt.nix Normal file
View File

@ -0,0 +1,5 @@
{ pkgs, ... }: {
projectRootFile = "flake.nix";
programs.nixfmt.enable = true;
programs.ruff.enable = true;
}