mirror of
https://github.com/oddlama/nixos-extra-modules.git
synced 2025-10-10 22:00:39 +02:00
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"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils": {
|
"flake-parts": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems"
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1731533236,
|
"lastModified": 1738453229,
|
||||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
"narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=",
|
||||||
"owner": "numtide",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-parts",
|
||||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
"rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "numtide",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-parts",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -104,6 +104,18 @@
|
||||||
"type": "github"
|
"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": {
|
"pre-commit-hooks": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
|
@ -129,26 +141,11 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"devshell": "devshell",
|
"devshell": "devshell",
|
||||||
"flake-utils": "flake-utils",
|
"flake-parts": "flake-parts",
|
||||||
"lib-net": "lib-net",
|
"lib-net": "lib-net",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"pre-commit-hooks": "pre-commit-hooks"
|
"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",
|
"root": "root",
|
||||||
|
|
117
flake.nix
117
flake.nix
|
@ -7,7 +7,7 @@
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
|
|
||||||
lib-net = {
|
lib-net = {
|
||||||
url = "https://gist.github.com/duairc/5c9bb3c922e5d501a1edb9e7b3b845ba/archive/3885f7cd9ed0a746a9d675da6f265d41e9fd6704.tar.gz";
|
url = "https://gist.github.com/duairc/5c9bb3c922e5d501a1edb9e7b3b845ba/archive/3885f7cd9ed0a746a9d675da6f265d41e9fd6704.tar.gz";
|
||||||
|
@ -22,63 +22,68 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs =
|
||||||
self,
|
{ self, ... }@inputs:
|
||||||
nixpkgs,
|
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
||||||
flake-utils,
|
imports = [
|
||||||
devshell,
|
inputs.devshell.flakeModule
|
||||||
pre-commit-hooks,
|
inputs.pre-commit-hooks.flakeModule
|
||||||
...
|
];
|
||||||
} @ inputs:
|
systems = [
|
||||||
{
|
"x86_64-linux"
|
||||||
nixosModules.nixos-extra-modules = import ./modules;
|
"aarch64-linux"
|
||||||
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 {
|
|
||||||
inherit system;
|
|
||||||
overlays = [
|
|
||||||
devshell.overlays.default
|
|
||||||
self.overlays.default
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# `nix flake check`
|
flake.modules = {
|
||||||
checks.pre-commit-hooks = pre-commit-hooks.lib.${system}.run {
|
nixos = {
|
||||||
src = nixpkgs.lib.cleanSource ./.;
|
nixos-extra-modules = import ./modules;
|
||||||
hooks = {
|
default = self.modules.nixos.nixos-extra-modules;
|
||||||
alejandra.enable = true;
|
};
|
||||||
deadnix.enable = true;
|
home-manager = {
|
||||||
statix.enable = true;
|
nixos-extra-modules = import ./hm-modules;
|
||||||
|
default = self.modules.home-manager.nixos-extra-modules;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
flake.overlays = {
|
||||||
# `nix fmt`
|
nixos-extra-modules = import ./overlay.nix inputs;
|
||||||
formatter = pkgs.alejandra;
|
default = self.overlays.nixos-extra-modules;
|
||||||
|
|
||||||
# `nix develop`
|
|
||||||
devShells.default = pkgs.devshell.mkShell {
|
|
||||||
name = "nixos-extra-modules";
|
|
||||||
commands = with pkgs; [
|
|
||||||
{
|
|
||||||
package = alejandra;
|
|
||||||
help = "Format nix code";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
package = statix;
|
|
||||||
help = "Lint nix code";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
package = deadnix;
|
|
||||||
help = "Find unused expressions in nix code";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
devshell.startup.pre-commit.text = self.checks.${system}.pre-commit-hooks.shellHook;
|
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
perSystem =
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
system,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
_module.args.pkgs = import inputs.nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
overlays = [
|
||||||
|
self.overlays.default
|
||||||
|
];
|
||||||
|
};
|
||||||
|
# `nix flake check`
|
||||||
|
pre-commit.settings.hooks = {
|
||||||
|
nixfmt-rfc-style.enable = true;
|
||||||
|
deadnix.enable = true;
|
||||||
|
statix.enable = true;
|
||||||
|
};
|
||||||
|
formatter = pkgs.nixfmt-rfc-style;
|
||||||
|
devshells.default = {
|
||||||
|
commands = with pkgs; [
|
||||||
|
{
|
||||||
|
package = statix;
|
||||||
|
help = "Lint nix code";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
package = deadnix;
|
||||||
|
help = "Find unused expressions in nix code";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
devshell.startup.pre-commit.text = config.pre-commit.installationScript;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue