refactor: use flake-parts for configuration

This commit is contained in:
Youwen Wu 2024-10-24 19:34:08 -07:00
parent 67590e5cc6
commit 01b1b13b6a
Signed by: youwen
GPG key ID: 865658ED1FE61EC3
2 changed files with 79 additions and 41 deletions

View file

@ -45,6 +45,8 @@
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts.url = "github:hercules-ci/flake-parts";
apple-silicon = {
url = "github:tpwrules/nixos-apple-silicon";
inputs.nixpkgs.follows = "nixpkgs";
@ -82,54 +84,59 @@
};
outputs =
{
inputs@{
nixpkgs,
nix-darwin,
flake-parts,
...
}@inputs:
let
in
{
formatter = with nixpkgs.legacyPackages; {
x86_64-linux = x86_64-linux.nixfmt-rfc-style;
aarch64-linux = aarch64-linux.nixfmt-rfc-style;
aarch64-darwin = aarch64-darwin.nixfmt-rfc-style;
};
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
flake = {
nixosConfigurations = {
demeter = nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs;
};
modules = [
./hosts/demeter
];
};
nixosConfigurations = {
demeter = nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs;
callisto = nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs;
};
modules = [
./hosts/callisto
];
};
adrastea = nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs;
};
modules = [
./hosts/adrastea
];
};
modules = [
./hosts/demeter
];
};
callisto = nixpkgs.lib.nixosSystem {
darwinConfigurations.phobos = nix-darwin.lib.darwinSystem {
specialArgs = {
inherit inputs;
};
modules = [
./hosts/callisto
];
};
adrastea = nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs;
};
modules = [
./hosts/adrastea
./hosts/phobos
];
};
};
darwinConfigurations.phobos = nix-darwin.lib.darwinSystem {
specialArgs = {
inherit inputs;
perSystem =
{ pkgs, ... }:
{
formatter = pkgs.nixfmt-rfc-style;
};
modules = [
./hosts/phobos
];
};
};
}