Merge pull request #127 from drupol/add-formatter-attribute

Add `formatter` attribute with `nixpkgs-fmt`
This commit is contained in:
Jörg Thalheim 2022-12-31 13:48:22 +00:00 committed by GitHub
commit 9eb755db43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 14 deletions

17
.github/workflows/nix-fmt-checks.yaml vendored Normal file
View File

@ -0,0 +1,17 @@
name: Nix formatter checks
on:
pull_request:
jobs:
lockfile:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v18
- name: Run nix formatter tool
run: nix fmt . -- --check

View File

@ -1,5 +1,5 @@
{ pkgs ? import <nixpkgs> {},
src ? ./.
{ pkgs ? import <nixpkgs> { }
, src ? ./.
}:
@ -26,7 +26,9 @@ python3.pkgs.buildPythonApplication rec {
mypy --no-warn-unused-ignores --strict nix_update tests
'';
makeWrapperArgs = [
"--prefix PATH" ":" (lib.makeBinPath [ pkgs.nixVersions.stable or nix_2_4 nixpkgs-fmt nixpkgs-review ])
"--prefix PATH"
":"
(lib.makeBinPath [ pkgs.nixVersions.stable or nix_2_4 nixpkgs-fmt nixpkgs-review ])
];
shellHook = ''
# workaround because `python setup.py develop` breaks for me

View File

@ -6,9 +6,14 @@
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system: {
packages.nix-update = nixpkgs.legacyPackages.${system}.callPackage self {
src = self;
formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt;
packages = {
default = self.packages.${system}.nix-update;
nix-update = nixpkgs.legacyPackages.${system}.callPackage self {
src = self;
};
};
defaultPackage = self.packages.${system}.nix-update;
});
}

View File

@ -1,10 +1,10 @@
{ pkgs ? import <nixpkgs> {} }:
{ pkgs ? import <nixpkgs> { } }:
{
crate = pkgs.callPackage ./crate.nix {};
github = pkgs.callPackage ./github.nix {};
gitlab = pkgs.callPackage ./gitlab.nix {};
pypi = pkgs.python3.pkgs.callPackage ./pypi.nix {};
sourcehut = pkgs.python3.pkgs.callPackage ./sourcehut.nix {};
savanna = pkgs.python3.pkgs.callPackage ./savanna.nix {};
npm = pkgs.callPackage ./npm.nix {};
crate = pkgs.callPackage ./crate.nix { };
github = pkgs.callPackage ./github.nix { };
gitlab = pkgs.callPackage ./gitlab.nix { };
pypi = pkgs.python3.pkgs.callPackage ./pypi.nix { };
sourcehut = pkgs.python3.pkgs.callPackage ./sourcehut.nix { };
savanna = pkgs.python3.pkgs.callPackage ./savanna.nix { };
npm = pkgs.callPackage ./npm.nix { };
}