flake: use flake-parts
This commit is contained in:
Generated
+4
@@ -247,6 +247,10 @@
|
|||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"clan-core": "clan-core",
|
"clan-core": "clan-core",
|
||||||
|
"flake-parts": [
|
||||||
|
"clan-core",
|
||||||
|
"flake-parts"
|
||||||
|
],
|
||||||
"nixos-mailserver": "nixos-mailserver",
|
"nixos-mailserver": "nixos-mailserver",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"clan-core",
|
"clan-core",
|
||||||
|
|||||||
@@ -7,13 +7,16 @@
|
|||||||
inputs.nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-26.05";
|
inputs.nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-26.05";
|
||||||
inputs.nixos-mailserver.inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixos-mailserver.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
|
inputs.flake-parts.follows = "clan-core/flake-parts";
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
{
|
inputs@{
|
||||||
self,
|
self,
|
||||||
clan-core,
|
clan-core,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
|
flake-parts,
|
||||||
...
|
...
|
||||||
}@inputs:
|
}:
|
||||||
let
|
let
|
||||||
# Usage see: https://docs.clan.lol
|
# Usage see: https://docs.clan.lol
|
||||||
clan = clan-core.lib.clan {
|
clan = clan-core.lib.clan {
|
||||||
@@ -36,38 +39,31 @@
|
|||||||
"age-plugin-fido2-hmac"
|
"age-plugin-fido2-hmac"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
in
|
||||||
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||||
systems = [
|
systems = [
|
||||||
"x86_64-linux"
|
"x86_64-linux"
|
||||||
"aarch64-linux"
|
"aarch64-linux"
|
||||||
"aarch64-darwin"
|
"aarch64-darwin"
|
||||||
"x86_64-darwin"
|
"x86_64-darwin"
|
||||||
];
|
];
|
||||||
forAllSystems = nixpkgs.lib.genAttrs systems;
|
|
||||||
pkgsFor = system: clan-core.inputs.nixpkgs.legacyPackages.${system};
|
|
||||||
treefmtFor = system: inputs.treefmt-nix.lib.evalModule (pkgsFor system) ./fmt.nix;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
inherit (clan.config) nixosConfigurations nixosModules clanInternals;
|
|
||||||
clan = clan.config;
|
|
||||||
|
|
||||||
# `nix fmt` and the `nix flake check` formatting gate.
|
flake = {
|
||||||
formatter = forAllSystems (system: (treefmtFor system).config.build.wrapper);
|
inherit (clan.config) nixosConfigurations nixosModules clanInternals;
|
||||||
checks = forAllSystems (system: {
|
clan = clan.config;
|
||||||
formatting = (treefmtFor system).config.build.check self;
|
};
|
||||||
});
|
|
||||||
|
|
||||||
# Add the Clan cli tool to the dev shell.
|
perSystem =
|
||||||
# Use "nix develop" to enter the dev shell.
|
{ system, ... }:
|
||||||
devShells = forAllSystems (
|
|
||||||
system:
|
|
||||||
let
|
let
|
||||||
|
pkgs = clan-core.inputs.nixpkgs.legacyPackages.${system};
|
||||||
|
treefmtEval = inputs.treefmt-nix.lib.evalModule pkgs ./fmt.nix;
|
||||||
clanCli = clan-core.packages.${system}.clan-cli;
|
clanCli = clan-core.packages.${system}.clan-cli;
|
||||||
# `clan machines update a b c` normally runs machines in parallel,
|
# `clan machines update a b c` normally runs machines in parallel,
|
||||||
# which interleaves their output and buries the YubiKey PIN prompts.
|
# which interleaves their output and buries the YubiKey PIN prompts.
|
||||||
# This wrapper (first in PATH) runs them one at a time instead; any
|
# This wrapper (first in PATH) runs them one at a time instead; any
|
||||||
# flags fall through to the real CLI untouched.
|
# flags fall through to the real CLI untouched.
|
||||||
clanSequential = (pkgsFor system).writeShellScriptBin "clan" ''
|
clanSequential = pkgs.writeShellScriptBin "clan" ''
|
||||||
if [ "$#" -gt 3 ] && [ "$1" = machines ] && [ "$2" = update ]; then
|
if [ "$#" -gt 3 ] && [ "$1" = machines ] && [ "$2" = update ]; then
|
||||||
shift 2
|
shift 2
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
@@ -84,14 +80,19 @@
|
|||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
default = (pkgsFor system).mkShell {
|
# `nix fmt` and the `nix flake check` formatting gate.
|
||||||
|
formatter = treefmtEval.config.build.wrapper;
|
||||||
|
checks.formatting = treefmtEval.config.build.check self;
|
||||||
|
|
||||||
|
# Add the Clan cli tool to the dev shell.
|
||||||
|
# Use "nix develop" to enter the dev shell.
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
packages = [
|
packages = [
|
||||||
clanSequential
|
clanSequential
|
||||||
clanCli
|
clanCli
|
||||||
(treefmtFor system).config.build.wrapper
|
treefmtEval.config.build.wrapper
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user