This commit is contained in:
Morten Olsen
2025-12-27 00:02:02 +01:00
parent e384cc4829
commit 7f087bc39e
16 changed files with 257 additions and 213 deletions

175
flake.nix
View File

@@ -28,88 +28,103 @@
};
};
outputs = {
self,
nixpkgs,
home-manager,
nix-darwin,
...
} @ inputs: let
# Default username - can be overridden per-host if needed
username = "alice";
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;
# Common special args passed to all modules
specialArgs = { inherit inputs username; };
in
forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
default = pkgs.mkShell {
packages = with pkgs; [
nixfmt-rfc-style
nil # Nix LSP
{
# 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
];
};
}
);
};
}