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: youwen5
GPG key ID: 865658ED1FE61EC3
2 changed files with 79 additions and 41 deletions

View file

@ -45,7 +45,7 @@
"viminal",
"fenix"
],
"flake-parts": "flake-parts_3",
"flake-parts": "flake-parts_4",
"nixpkgs": [
"viminal",
"nixpkgs"
@ -400,6 +400,24 @@
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1727826117,
"narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"lanzaboote",
@ -420,7 +438,7 @@
"type": "github"
}
},
"flake-parts_2": {
"flake-parts_3": {
"inputs": {
"nixpkgs-lib": [
"viminal",
@ -444,9 +462,9 @@
"type": "github"
}
},
"flake-parts_3": {
"flake-parts_4": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
"nixpkgs-lib": "nixpkgs-lib_2"
},
"locked": {
"lastModified": 1727826117,
@ -684,7 +702,7 @@
"inputs": {
"crane": "crane",
"flake-compat": "flake-compat_2",
"flake-parts": "flake-parts",
"flake-parts": "flake-parts_2",
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
@ -937,7 +955,7 @@
"devenv",
"flake-compat"
],
"flake-parts": "flake-parts_2",
"flake-parts": "flake-parts_3",
"libgit2": "libgit2",
"nixpkgs": "nixpkgs_4",
"nixpkgs-23-11": "nixpkgs-23-11",
@ -1000,6 +1018,18 @@
"url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz"
}
},
"nixpkgs-lib_2": {
"locked": {
"lastModified": 1727825735,
"narHash": "sha256-0xHYkMkeLVQAMa7gvkddbPqpxph+hDzdu1XdGPJR+Os=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz"
}
},
"nixpkgs-regression": {
"locked": {
"lastModified": 1643052045,
@ -1312,6 +1342,7 @@
"apple-firmware": "apple-firmware",
"apple-silicon": "apple-silicon",
"catppuccin": "catppuccin",
"flake-parts": "flake-parts",
"home-manager": "home-manager",
"homebrew-cask": "homebrew-cask",
"homebrew-core": "homebrew-core",

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