templates: add a minimal flake-parts template
This commit is contained in:
2
templates/minimal-flake-parts/.gitignore
vendored
Normal file
2
templates/minimal-flake-parts/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
result
|
||||
.direnv/
|
||||
22
templates/minimal-flake-parts/checks.nix
Normal file
22
templates/minimal-flake-parts/checks.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{ self, ... }:
|
||||
{
|
||||
perSystem =
|
||||
{
|
||||
self',
|
||||
lib,
|
||||
system,
|
||||
...
|
||||
}:
|
||||
{
|
||||
checks =
|
||||
let
|
||||
nixosMachines = lib.mapAttrs' (
|
||||
name: config: lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel
|
||||
) ((lib.filterAttrs (_: config: config.pkgs.system == system)) self.nixosConfigurations);
|
||||
|
||||
packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self'.packages;
|
||||
devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells;
|
||||
in
|
||||
nixosMachines // packages // devShells;
|
||||
};
|
||||
}
|
||||
11
templates/minimal-flake-parts/clan.nix
Normal file
11
templates/minimal-flake-parts/clan.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
inputs.clan.flakeModules.default
|
||||
];
|
||||
clan = {
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
};
|
||||
};
|
||||
}
|
||||
17
templates/minimal-flake-parts/devshells.nix
Normal file
17
templates/minimal-flake-parts/devshells.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
_: {
|
||||
perSystem =
|
||||
{
|
||||
pkgs,
|
||||
inputs',
|
||||
...
|
||||
}:
|
||||
{
|
||||
devShells = {
|
||||
default = pkgs.mkShellNoCC {
|
||||
packages = [
|
||||
inputs'.clan.packages.default
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
30
templates/minimal-flake-parts/flake.nix
Normal file
30
templates/minimal-flake-parts/flake.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
|
||||
clan.url = "git+https://git.clan.lol/clan/clan-core?shallow=1";
|
||||
clan.inputs.nixpkgs.follows = "nixpkgs";
|
||||
clan.inputs.flake-parts.follows = "flake-parts";
|
||||
|
||||
flake-parts.url = "github:hercules-ci/flake-parts?shallow=1";
|
||||
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||
|
||||
};
|
||||
|
||||
outputs =
|
||||
inputs@{ flake-parts, ... }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } (
|
||||
{ ... }:
|
||||
{
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
];
|
||||
|
||||
imports = [
|
||||
./checks.nix
|
||||
./clan.nix
|
||||
./devshells.nix
|
||||
];
|
||||
}
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user