mirror of
https://github.com/hercules-ci/flake-parts.git
synced 2025-03-05 08:27:02 +00:00
dev: Add pre-commit-hooks.nix
This commit is contained in:
parent
3fe766e50c
commit
fcf9d5234b
4 changed files with 68 additions and 10 deletions
|
@ -1,9 +1,12 @@
|
||||||
let
|
let
|
||||||
flake = builtins.getFlake (toString ./.);
|
flake = builtins.getFlake (toString ./.);
|
||||||
fmc-lib = import ../lib.nix { inherit (flake.inputs.nixpkgs) lib; };
|
fmc-lib = import ../lib.nix { inherit (flake.inputs.nixpkgs) lib; };
|
||||||
self = { inherit (flake) inputs; } //
|
self = {
|
||||||
fmc-lib.evalFlakeModule
|
inherit (flake) inputs;
|
||||||
{ inherit self; }
|
outPath = ../.; # used by pre-commit module, etc
|
||||||
./flake-module.nix;
|
} //
|
||||||
|
fmc-lib.evalFlakeModule
|
||||||
|
{ inherit self; }
|
||||||
|
./flake-module.nix;
|
||||||
in
|
in
|
||||||
self.config.flake // { inherit (flake) inputs; }
|
self.config.flake // { inherit (flake) inputs; }
|
||||||
|
|
|
@ -1,14 +1,28 @@
|
||||||
flakeModuleArgs@{ config, lib, ... }:
|
flakeModuleArgs@{ config, lib, inputs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
inputs.pre-commit-hooks-nix.flakeModule
|
||||||
];
|
];
|
||||||
systems = [ "x86_64-linux" "aarch64-darwin" ];
|
systems = [ "x86_64-linux" "aarch64-darwin" ];
|
||||||
perSystem = system: { config, self', inputs', pkgs, ... }: {
|
perSystem = system: { config, self', inputs', pkgs, ... }: {
|
||||||
_module.args.pkgs = inputs'.nixpkgs.legacyPackages;
|
_module.args.pkgs = inputs'.nixpkgs.legacyPackages;
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
nativeBuildInputs = [ pkgs.nixpkgs-fmt ];
|
nativeBuildInputs = [
|
||||||
|
pkgs.nixpkgs-fmt
|
||||||
|
pkgs.pre-commit
|
||||||
|
];
|
||||||
|
shellHook = ''
|
||||||
|
${config.pre-commit.installationScript}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
pre-commit = {
|
||||||
|
inherit pkgs; # should make this default to the one it can get via follows
|
||||||
|
settings = {
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
packages = {
|
packages = {
|
||||||
inherit (pkgs.nixosOptionsDoc { inherit (flakeModuleArgs) options; })
|
inherit (pkgs.nixosOptionsDoc { inherit (flakeModuleArgs) options; })
|
||||||
optionsDocBook;
|
optionsDocBook;
|
||||||
|
|
46
dev/flake.lock
generated
46
dev/flake.lock
generated
|
@ -1,12 +1,27 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1619345332,
|
||||||
|
"narHash": "sha256-qHnQkEp1uklKTpx3MvKtY6xzgcqXDsz5nLilbbuL+3A=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "2ebf2558e5bf978c7fb8ea927dfaed8fefab2e28",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1652425756,
|
"lastModified": 1652734403,
|
||||||
"narHash": "sha256-3+5j3ZU43oC5PxRfGDQ6xs5sYnypS5GBhVP6uf7PVGM=",
|
"narHash": "sha256-pIp7mRuYQd4JY2Ih4QaDjKVFgu7f1yHRRAvpb/rU9Mg=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "81a0a8be297a88f338ee0fd90c330cd94b4a55bd",
|
"rev": "0b02135d3bdf49f9154f60e7a4c9d54d5e0ee70d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -16,9 +31,32 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"pre-commit-hooks-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1638351750,
|
||||||
|
"narHash": "sha256-90OHC+11DIHD1QyMIPUuM3n6zjH5Mhc8RBZa0h8969A=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "pre-commit-hooks.nix",
|
||||||
|
"rev": "3bb289628867ac40fc9e7c514f8266b1ce8c0910",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"ref": "flakeModule",
|
||||||
|
"repo": "pre-commit-hooks.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs",
|
||||||
|
"pre-commit-hooks-nix": "pre-commit-hooks-nix"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
# Flakes don't give us a good way to depend on .., so we don't.
|
# Flakes don't give us a good way to depend on .., so we don't.
|
||||||
# This has drastic consequences of course.
|
# This has drastic consequences of course.
|
||||||
nixpkgs.url = "github:hercules-ci/nixpkgs/functionTo-properly";
|
nixpkgs.url = "github:hercules-ci/nixpkgs/functionTo-properly";
|
||||||
|
|
||||||
|
pre-commit-hooks-nix.url = "github:hercules-ci/pre-commit-hooks.nix/flakeModule";
|
||||||
|
pre-commit-hooks-nix.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, ... }:
|
outputs = { self, ... }:
|
||||||
|
|
Loading…
Add table
Reference in a new issue