add multi user and host support
This commit is contained in:
39
flake.nix
39
flake.nix
@@ -36,10 +36,12 @@
|
|||||||
host1 = {
|
host1 = {
|
||||||
hostname = "swaphb-mba";
|
hostname = "swaphb-mba";
|
||||||
arch = "aarch64-darwin";
|
arch = "aarch64-darwin";
|
||||||
|
homeDirectory = "/Users/stephen";
|
||||||
};
|
};
|
||||||
host2 = {
|
host2 = {
|
||||||
hostname = "example";
|
hostname = "example";
|
||||||
arch = "aarch64-darwin";
|
arch = "aarch64-darwin";
|
||||||
|
homeDirectory = "/Users/example";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -67,6 +69,8 @@
|
|||||||
{
|
{
|
||||||
nixpkgs.hostPlatform = hostVars.${hostKey}.arch;
|
nixpkgs.hostPlatform = hostVars.${hostKey}.arch;
|
||||||
|
|
||||||
|
system.stateVersion = 5;
|
||||||
|
|
||||||
nix.extraOptions = ''
|
nix.extraOptions = ''
|
||||||
experimental-features = nix-command flakes
|
experimental-features = nix-command flakes
|
||||||
'';
|
'';
|
||||||
@@ -88,11 +92,11 @@
|
|||||||
in
|
in
|
||||||
nix-darwin.lib.darwinSystem {
|
nix-darwin.lib.darwinSystem {
|
||||||
modules = [
|
modules = [
|
||||||
host1Base,
|
host1Base
|
||||||
./modules/darwin/homebrew.nix,
|
./modules/darwin/homebrew.nix
|
||||||
./modules/darwin/services.nix,
|
./modules/darwin/services.nix
|
||||||
./modules/darwin/nixpackages.nix,
|
./modules/darwin/nixpackages.nix
|
||||||
inputs.nix-homebrew.darwinModules.nix-homebrew,
|
inputs.nix-homebrew.darwinModules.nix-homebrew
|
||||||
{
|
{
|
||||||
nix-homebrew = {
|
nix-homebrew = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -106,14 +110,16 @@
|
|||||||
autoMigrate = true;
|
autoMigrate = true;
|
||||||
mutableTaps = false;
|
mutableTaps = false;
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
home-manager.darwinModules.home-manager {
|
home-manager.darwinModules.home-manager {
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
home-manager.verbose = true;
|
home-manager.verbose = true;
|
||||||
|
|
||||||
home-manager.users.${userVars.userA.username} = {
|
home-manager.users.${userVars.userA.username} = { pkgs, lib, ... }:
|
||||||
home.homeDirectory = userVars.userA.homeDirectory;
|
{
|
||||||
|
home.stateVersion = "24.05";
|
||||||
|
home.homeDirectory = lib.mkForce (userVars.userA.homeDirectory);
|
||||||
programs.zsh.enable = (userVars.userA.shell == "zsh");
|
programs.zsh.enable = (userVars.userA.shell == "zsh");
|
||||||
programs.fish.enable = (userVars.userA.shell == "fish");
|
programs.fish.enable = (userVars.userA.shell == "fish");
|
||||||
imports = [
|
imports = [
|
||||||
@@ -132,17 +138,19 @@
|
|||||||
in
|
in
|
||||||
nix-darwin.lib.darwinSystem {
|
nix-darwin.lib.darwinSystem {
|
||||||
modules = [
|
modules = [
|
||||||
host2Base,
|
host2Base
|
||||||
./modules/darwin/homebrew.nix,
|
./modules/darwin/homebrew.nix
|
||||||
./modules/darwin/services.nix,
|
./modules/darwin/services.nix
|
||||||
./modules/darwin/nixpackages.nix,
|
./modules/darwin/nixpackages.nix
|
||||||
home-manager.darwinModules.home-manager {
|
home-manager.darwinModules.home-manager {
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
home-manager.verbose = true;
|
home-manager.verbose = true;
|
||||||
|
|
||||||
home-manager.users.${userVars.userB.username} = {
|
home-manager.users.${userVars.userB.username} = { pkgs, lib, ... }:
|
||||||
home.homeDirectory = userVars.userB.homeDirectory;
|
{
|
||||||
|
home.stateVersion = "24.05";
|
||||||
|
home.homeDirectory = lib.mkForce (userVars.userB.homeDirectory);
|
||||||
programs.zsh.enable = (userVars.userB.shell == "zsh");
|
programs.zsh.enable = (userVars.userB.shell == "zsh");
|
||||||
programs.fish.enable = (userVars.userB.shell == "fish");
|
programs.fish.enable = (userVars.userB.shell == "fish");
|
||||||
imports = [
|
imports = [
|
||||||
@@ -160,5 +168,6 @@
|
|||||||
"${hostVars.host1.hostname}" = self.darwinConfigurations."${hostVars.host1.hostname}".pkgs;
|
"${hostVars.host1.hostname}" = self.darwinConfigurations."${hostVars.host1.hostname}".pkgs;
|
||||||
"${hostVars.host2.hostname}" = self.darwinConfigurations."${hostVars.host2.hostname}".pkgs;
|
"${hostVars.host2.hostname}" = self.darwinConfigurations."${hostVars.host2.hostname}".pkgs;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user