feat: switch to flake-parts
This commit is contained in:
parent
86bb6fb118
commit
f1a3f0303b
2 changed files with 83 additions and 81 deletions
47
flake.lock
generated
47
flake.lock
generated
|
@ -36,21 +36,21 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"lastModified": 1738453229,
|
||||
"narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
|
@ -104,6 +104,18 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1738452942,
|
||||
"narHash": "sha256-vJzFZGaCpnmo7I6i416HaBLpC+hvcURh/BQwROcGIp8=",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
|
@ -129,26 +141,11 @@
|
|||
"root": {
|
||||
"inputs": {
|
||||
"devshell": "devshell",
|
||||
"flake-utils": "flake-utils",
|
||||
"flake-parts": "flake-parts",
|
||||
"lib-net": "lib-net",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"pre-commit-hooks": "pre-commit-hooks"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
83
flake.nix
83
flake.nix
|
@ -7,7 +7,7 @@
|
|||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
|
||||
lib-net = {
|
||||
url = "https://gist.github.com/duairc/5c9bb3c922e5d501a1edb9e7b3b845ba/archive/3885f7cd9ed0a746a9d675da6f265d41e9fd6704.tar.gz";
|
||||
|
@ -22,52 +22,57 @@
|
|||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
devshell,
|
||||
pre-commit-hooks,
|
||||
...
|
||||
} @ inputs:
|
||||
outputs =
|
||||
{ self, ... }@inputs:
|
||||
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
imports = [
|
||||
inputs.devshell.flakeModule
|
||||
inputs.pre-commit-hooks.flakeModule
|
||||
];
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
|
||||
flake.modules = {
|
||||
nixos = {
|
||||
nixos-extra-modules = import ./modules;
|
||||
default = self.modules.nixos.nixos-extra-modules;
|
||||
};
|
||||
home-manager = {
|
||||
nixos-extra-modules = import ./hm-modules;
|
||||
default = self.modules.home-manager.nixos-extra-modules;
|
||||
};
|
||||
};
|
||||
flake.overlays = {
|
||||
nixos-extra-modules = import ./overlay.nix inputs;
|
||||
default = self.overlays.nixos-extra-modules;
|
||||
};
|
||||
|
||||
perSystem =
|
||||
{
|
||||
nixosModules.nixos-extra-modules = import ./modules;
|
||||
nixosModules.default = self.nixosModules.nixos-extra-modules;
|
||||
homeManagerModules.nixos-extra-modules = import ./hm-modules;
|
||||
homeManagerModules.default = self.homeManagerModules.nixos-extra-modules;
|
||||
overlays.nixos-extra-modules = import ./overlay.nix inputs;
|
||||
overlays.default = self.overlays.nixos-extra-modules;
|
||||
}
|
||||
// flake-utils.lib.eachDefaultSystem (system: rec {
|
||||
pkgs = import nixpkgs {
|
||||
pkgs,
|
||||
system,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
_module.args.pkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
overlays = [
|
||||
devshell.overlays.default
|
||||
self.overlays.default
|
||||
];
|
||||
};
|
||||
|
||||
# `nix flake check`
|
||||
checks.pre-commit-hooks = pre-commit-hooks.lib.${system}.run {
|
||||
src = nixpkgs.lib.cleanSource ./.;
|
||||
hooks = {
|
||||
alejandra.enable = true;
|
||||
pre-commit.settings.hooks = {
|
||||
nixfmt-rfc-style.enable = true;
|
||||
deadnix.enable = true;
|
||||
statix.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
# `nix fmt`
|
||||
formatter = pkgs.alejandra;
|
||||
|
||||
# `nix develop`
|
||||
devShells.default = pkgs.devshell.mkShell {
|
||||
name = "nixos-extra-modules";
|
||||
formatter = pkgs.nixfmt-rfc-style;
|
||||
devshells.default = {
|
||||
commands = with pkgs; [
|
||||
{
|
||||
package = alejandra;
|
||||
help = "Format nix code";
|
||||
}
|
||||
{
|
||||
package = statix;
|
||||
help = "Lint nix code";
|
||||
|
@ -77,8 +82,8 @@
|
|||
help = "Find unused expressions in nix code";
|
||||
}
|
||||
];
|
||||
|
||||
devshell.startup.pre-commit.text = self.checks.${system}.pre-commit-hooks.shellHook;
|
||||
devshell.startup.pre-commit.text = config.pre-commit.installationScript;
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue