fix: Format with nixpkgs-fmt

This commit is contained in:
Malte Neuss 2024-04-14 22:02:47 +02:00 committed by Phillip Cloud
parent 023a0e045a
commit 5a625725eb
No known key found for this signature in database
GPG key ID: D908212070FD785E
2 changed files with 61 additions and 50 deletions

View file

@ -14,14 +14,16 @@
};
};
outputs = {
self,
nixpkgs,
flake-utils,
nix-github-actions,
treefmt-nix,
systems,
}: let
outputs =
{ self
, nixpkgs
, flake-utils
, nix-github-actions
, treefmt-nix
, systems
,
}:
let
eachSystem = f: nixpkgs.lib.genAttrs (import systems) (system: f nixpkgs.legacyPackages.${system});
treefmtEval = eachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./dev/treefmt.nix);
in
@ -29,7 +31,8 @@
overlays.default = nixpkgs.lib.composeManyExtensions [ (import ./overlay.nix) ];
lib.mkPoetry2Nix = { pkgs }: import ./default.nix { inherit pkgs; };
githubActions = let
githubActions =
let
mkPkgs = system:
import nixpkgs {
config = {
@ -42,7 +45,8 @@
in
nix-github-actions.lib.mkGithubMatrix {
checks = {
x86_64-linux = let
x86_64-linux =
let
pkgs = mkPkgs "x86_64-linux";
in
import ./tests { inherit pkgs; }
@ -50,11 +54,13 @@
formatting = treefmtEval.x86_64-linux.config.build.check self;
};
x86_64-darwin = let
x86_64-darwin =
let
pkgs = mkPkgs "x86_64-darwin";
inherit (pkgs) lib;
tests = import ./tests { inherit pkgs; };
in {
in
{
# Aggregate all tests into one derivation so that only one GHA runner is scheduled for all darwin jobs
aggregate =
pkgs.runCommand "darwin-aggregate"
@ -73,7 +79,8 @@
default = self.templates.app;
};
}
// (flake-utils.lib.eachDefaultSystem (system: let
// (flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowAliases = false;
@ -81,7 +88,8 @@
poetry2nix = import ./default.nix { inherit pkgs; };
p2nix-tools = pkgs.callPackage ./tools { inherit poetry2nix; };
in rec {
in
rec {
formatter = treefmtEval.${system}.config.build.wrapper;
packages = {

View file

@ -26,12 +26,15 @@
let
inherit (pyproject-nix.lib) pypa;
selectWheel = files: lib.take 1 (let
selectWheel = files: lib.take 1 (
let
wheelFiles = builtins.filter (fileEntry: pypa.isWheelFileName fileEntry.file) files;
# Group wheel files by their file name
wheelFilesByFileName = lib.listToAttrs (map (fileEntry: lib.nameValuePair fileEntry.file fileEntry) wheelFiles);
selectedWheels = pypa.selectWheels python.stdenv.targetPlatform python (map (fileEntry: pypa.parseWheelFileName fileEntry.file) wheelFiles);
in map (wheel: wheelFilesByFileName.${wheel.filename}) selectedWheels);
in
map (wheel: wheelFilesByFileName.${wheel.filename}) selectedWheels
);
in