templates: add a minimal flake-parts template

This commit is contained in:
a-kenji
2024-11-08 11:42:42 +01:00
parent 4e4e89166d
commit f845dec656
5 changed files with 82 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
result
.direnv/

View 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;
};
}

View File

@@ -0,0 +1,11 @@
{ inputs, ... }:
{
imports = [
inputs.clan.flakeModules.default
];
clan = {
specialArgs = {
inherit inputs;
};
};
}

View File

@@ -0,0 +1,17 @@
_: {
perSystem =
{
pkgs,
inputs',
...
}:
{
devShells = {
default = pkgs.mkShellNoCC {
packages = [
inputs'.clan.packages.default
];
};
};
};
}

View 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
];
}
);
}