Skip to content

Commit

Permalink
Merge pull request #434 from GaetanLepage/flake-update
Browse files Browse the repository at this point in the history
flake update
  • Loading branch information
Mic92 authored Dec 12, 2024
2 parents 907925d + 032eca4 commit 378b56c
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 58 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- run: nix build
- run: nix develop -c pytest -s .
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- run: nix build
- run: nix develop -c pytest -s .
build-flake:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: List flake structure
run: nix flake show
- run: nix flake check -vL
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: List flake structure
run: nix flake show
- run: nix flake check -vL
32 changes: 19 additions & 13 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,19 @@ python3.pkgs.buildPythonApplication {
nativeBuildInputs = [ installShellFiles ] ++ lib.optional withAutocomplete python3.pkgs.argcomplete;
propagatedBuildInputs = [ python3.pkgs.argcomplete ];

nativeCheckInputs = [
python3.pkgs.setuptools
python3.pkgs.pylint
glibcLocales
nativeCheckInputs =
[
python3.pkgs.setuptools
python3.pkgs.pylint
glibcLocales

# needed for interactive unittests
python3.pkgs.pytest
pkgs.nixVersions.stable or nix_2_4
git
] ++ lib.optional withSandboxSupport bubblewrap ++ lib.optional withNom' nix-output-monitor;
# needed for interactive unittests
python3.pkgs.pytest
pkgs.nixVersions.stable or nix_2_4
git
]
++ lib.optional withSandboxSupport bubblewrap
++ lib.optional withNom' nix-output-monitor;

checkPhase = ''
echo -e "\x1b[32m## run nixpkgs-review --help\x1b[0m"
Expand All @@ -36,10 +39,13 @@ python3.pkgs.buildPythonApplication {
'';
makeWrapperArgs =
let
binPath = [
pkgs.nixVersions.stable or nix_2_4
git
] ++ lib.optional withSandboxSupport bubblewrap ++ lib.optional withNom' nix-output-monitor;
binPath =
[
pkgs.nixVersions.stable or nix_2_4
git
]
++ lib.optional withSandboxSupport bubblewrap
++ lib.optional withNom' nix-output-monitor;
in
[
"--prefix PATH : ${lib.makeBinPath binPath}"
Expand Down
18 changes: 9 additions & 9 deletions flake.lock

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

7 changes: 4 additions & 3 deletions nixpkgs_review/cli/comments.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import argparse
import string
from dataclasses import dataclass, field
from datetime import datetime
from typing import Any
Expand All @@ -8,10 +9,10 @@


def comments_query(pr: int) -> str:
return """
return string.Template("""
{
repository(owner: "NixOS", name: "nixpkgs") {
pullRequest(number: %d) {
pullRequest(number: $pr) {
author { login }
body
createdAt
Expand Down Expand Up @@ -46,7 +47,7 @@ def comments_query(pr: int) -> str:
}
}
}
""" % (pr)
""").substitute(pr=pr)


@dataclass
Expand Down
7 changes: 4 additions & 3 deletions nixpkgs_review/cli/pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ def pr_command(args: argparse.Namespace) -> str:
allow = AllowedFeatures(args.allow)

builddir = None
with Buildenv(
allow.aliases, args.extra_nixpkgs_config
) as nixpkgs_config, ExitStack() as stack:
with (
Buildenv(allow.aliases, args.extra_nixpkgs_config) as nixpkgs_config,
ExitStack() as stack,
):
review = None
for pr in prs:
builddir = stack.enter_context(Builddir(f"pr-{pr}"))
Expand Down
36 changes: 21 additions & 15 deletions treefmt.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{ lib, inputs, ... }:
{
inputs,
...
}:
{
imports = [
inputs.treefmt-nix.flakeModule
Expand All @@ -11,20 +14,23 @@
# Used to find the project root
projectRootFile = "flake.lock";

programs.deno.enable =
pkgs.lib.meta.availableOn pkgs.stdenv.hostPlatform pkgs.deno && !pkgs.deno.meta.broken;
programs.ruff.format = true;
programs.ruff.check = true;
programs.mypy.enable = true;
programs.nixfmt.enable = pkgs.lib.meta.availableOn pkgs.stdenv.buildPlatform pkgs.nixfmt-rfc-style.compiler;
programs.deadnix.enable = true;

programs.mypy.directories = {
"." = {
directory = ".";
extraPythonPackages = [
pkgs.python3.pkgs.pytest
];
programs = {
deno.enable =
pkgs.lib.meta.availableOn pkgs.stdenv.hostPlatform pkgs.deno && !pkgs.deno.meta.broken;
ruff = {
format = true;
check = true;
};
mypy.enable = true;
nixfmt.enable = pkgs.lib.meta.availableOn pkgs.stdenv.buildPlatform pkgs.nixfmt-rfc-style.compiler;
deadnix.enable = true;
mypy.directories = {
"." = {
directory = ".";
extraPythonPackages = [
pkgs.python3Packages.pytest
];
};
};
};
};
Expand Down

0 comments on commit 378b56c

Please sign in to comment.