init
This commit is contained in:
105
flake.nix
Normal file
105
flake.nix
Normal file
@@ -0,0 +1,105 @@
|
||||
{
|
||||
description = "Home Manager configuration with nix-darwin support";
|
||||
|
||||
inputs = {
|
||||
# Core dependencies - using unstable for latest packages
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
|
||||
# Home Manager for user environment management
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# nix-darwin for macOS system configuration
|
||||
nix-darwin = {
|
||||
url = "github:LnL7/nix-darwin";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
nix-darwin,
|
||||
...
|
||||
} @ inputs: let
|
||||
# Default username - can be overridden per-host if needed
|
||||
username = "alice";
|
||||
|
||||
# Common special args passed to all modules
|
||||
specialArgs = {inherit inputs username;};
|
||||
in {
|
||||
# Darwin (macOS) system configurations
|
||||
darwinConfigurations = {
|
||||
# Personal machine configuration
|
||||
"personal" = nix-darwin.lib.darwinSystem {
|
||||
system = "aarch64-darwin";
|
||||
inherit specialArgs;
|
||||
modules = [
|
||||
# Host-specific darwin configuration
|
||||
./hosts/personal
|
||||
|
||||
# Home Manager as a darwin module
|
||||
home-manager.darwinModules.home-manager
|
||||
{
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
extraSpecialArgs = specialArgs;
|
||||
users.${username} = {...}: {
|
||||
imports = [
|
||||
./home
|
||||
./home/personal.nix
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Work machine configuration
|
||||
"work" = nix-darwin.lib.darwinSystem {
|
||||
system = "aarch64-darwin";
|
||||
inherit specialArgs;
|
||||
modules = [
|
||||
# Host-specific darwin configuration
|
||||
./hosts/work
|
||||
|
||||
# Home Manager as a darwin module
|
||||
home-manager.darwinModules.home-manager
|
||||
{
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
extraSpecialArgs = specialArgs;
|
||||
users.${username} = {...}: {
|
||||
imports = [
|
||||
./home
|
||||
./home/work.nix
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Development shell for working on this repository
|
||||
devShells = let
|
||||
systems = ["aarch64-darwin" "x86_64-darwin"];
|
||||
forAllSystems = nixpkgs.lib.genAttrs systems;
|
||||
in
|
||||
forAllSystems (system: let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
nixfmt-rfc-style
|
||||
nil # Nix LSP
|
||||
];
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user