mirror of
https://github.com/smg1024/nix-darwin.git
synced 2026-05-22 20:32:59 +09:00
refactor: migrate nix-darwin config to a flake-parts dendritic layout
This commit is contained in:
parent
f80b0b0d4f
commit
09801ac429
84 changed files with 1029 additions and 687 deletions
82
flake.nix
82
flake.nix
|
|
@ -1,32 +1,25 @@
|
|||
{
|
||||
description = "Nix for Poby's MacOS";
|
||||
|
||||
# TODO: is this necessary?
|
||||
# nixConfig = {
|
||||
# substituters = [
|
||||
# "https://nix-community.cachix.org"
|
||||
# "https://cache.nixos.org"
|
||||
# ];
|
||||
# };
|
||||
|
||||
inputs = {
|
||||
# nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-unstable"; # comment out for unstable version
|
||||
nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-25.11-darwin";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-25.11-darwin";
|
||||
nixpkgs-darwin.follows = "nixpkgs";
|
||||
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
import-tree.url = "github:vic/import-tree";
|
||||
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager/release-25.11";
|
||||
inputs.nixpkgs.follows = "nixpkgs-darwin";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
darwin = {
|
||||
url = "github:nix-darwin/nix-darwin/nix-darwin-25.11";
|
||||
inputs.nixpkgs.follows = "nixpkgs-darwin";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# Homebrew
|
||||
nix-homebrew.url = "github:zhaofengli/nix-homebrew";
|
||||
|
||||
# Optional: Declarative tap management
|
||||
homebrew-core = {
|
||||
url = "github:homebrew/homebrew-core";
|
||||
flake = false;
|
||||
|
|
@ -36,61 +29,32 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
# NVF for neovim
|
||||
nvf = {
|
||||
url = "github:notashelf/nvf";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# sops-nix for secrets
|
||||
sops-nix = {
|
||||
url = "github:Mic92/sops-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs-darwin";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = inputs @ {
|
||||
self,
|
||||
nixpkgs,
|
||||
darwin,
|
||||
home-manager,
|
||||
nvf,
|
||||
sops-nix,
|
||||
nix-homebrew,
|
||||
...
|
||||
}: let
|
||||
system = "aarch64-darwin";
|
||||
username = "poby";
|
||||
useremail = "smg981024@gmail.com";
|
||||
hostname = "fenrir"; # TODO break down to multiple hosts
|
||||
|
||||
specialArgs =
|
||||
inputs
|
||||
// {
|
||||
inherit username useremail hostname;
|
||||
};
|
||||
in {
|
||||
darwinConfigurations."${hostname}" = darwin.lib.darwinSystem {
|
||||
inherit system specialArgs;
|
||||
modules = [
|
||||
./hosts
|
||||
nix-homebrew.darwinModules.nix-homebrew
|
||||
home-manager.darwinModules.home-manager
|
||||
{
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
backupFileExtension = "backup";
|
||||
extraSpecialArgs = specialArgs;
|
||||
sharedModules = [
|
||||
nvf.homeManagerModules.nvf
|
||||
sops-nix.homeManagerModules.sops
|
||||
];
|
||||
users.${username} = import ./home;
|
||||
};
|
||||
}
|
||||
outputs = inputs @ {flake-parts, ...}:
|
||||
flake-parts.lib.mkFlake {inherit inputs;} {
|
||||
imports = [
|
||||
inputs.flake-parts.flakeModules.modules
|
||||
./modules/flake
|
||||
(inputs.import-tree ./modules/aspects)
|
||||
(inputs.import-tree ./hosts)
|
||||
];
|
||||
|
||||
systems = [
|
||||
"aarch64-darwin"
|
||||
];
|
||||
|
||||
perSystem = {pkgs, ...}: {
|
||||
formatter = pkgs.alejandra;
|
||||
};
|
||||
};
|
||||
formatter.${system} = nixpkgs.legacyPackages.${system}.alejandra;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue