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", "viminal",
"fenix" "fenix"
], ],
"flake-parts": "flake-parts_3", "flake-parts": "flake-parts_4",
"nixpkgs": [ "nixpkgs": [
"viminal", "viminal",
"nixpkgs" "nixpkgs"
@ -400,6 +400,24 @@
} }
}, },
"flake-parts": { "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": { "inputs": {
"nixpkgs-lib": [ "nixpkgs-lib": [
"lanzaboote", "lanzaboote",
@ -420,7 +438,7 @@
"type": "github" "type": "github"
} }
}, },
"flake-parts_2": { "flake-parts_3": {
"inputs": { "inputs": {
"nixpkgs-lib": [ "nixpkgs-lib": [
"viminal", "viminal",
@ -444,9 +462,9 @@
"type": "github" "type": "github"
} }
}, },
"flake-parts_3": { "flake-parts_4": {
"inputs": { "inputs": {
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib_2"
}, },
"locked": { "locked": {
"lastModified": 1727826117, "lastModified": 1727826117,
@ -684,7 +702,7 @@
"inputs": { "inputs": {
"crane": "crane", "crane": "crane",
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_2",
"flake-parts": "flake-parts", "flake-parts": "flake-parts_2",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
@ -937,7 +955,7 @@
"devenv", "devenv",
"flake-compat" "flake-compat"
], ],
"flake-parts": "flake-parts_2", "flake-parts": "flake-parts_3",
"libgit2": "libgit2", "libgit2": "libgit2",
"nixpkgs": "nixpkgs_4", "nixpkgs": "nixpkgs_4",
"nixpkgs-23-11": "nixpkgs-23-11", "nixpkgs-23-11": "nixpkgs-23-11",
@ -1000,6 +1018,18 @@
"url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" "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": { "nixpkgs-regression": {
"locked": { "locked": {
"lastModified": 1643052045, "lastModified": 1643052045,
@ -1312,6 +1342,7 @@
"apple-firmware": "apple-firmware", "apple-firmware": "apple-firmware",
"apple-silicon": "apple-silicon", "apple-silicon": "apple-silicon",
"catppuccin": "catppuccin", "catppuccin": "catppuccin",
"flake-parts": "flake-parts",
"home-manager": "home-manager", "home-manager": "home-manager",
"homebrew-cask": "homebrew-cask", "homebrew-cask": "homebrew-cask",
"homebrew-core": "homebrew-core", "homebrew-core": "homebrew-core",

View file

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