mirror of
https://github.com/genebean/dots.git
synced 2026-03-27 09:27:44 -04:00
Move Darwin code to library
This commit is contained in:
parent
dc7552396f
commit
ce3a1b5e20
3 changed files with 46 additions and 49 deletions
53
flake.nix
53
flake.nix
|
|
@ -76,44 +76,7 @@
|
||||||
}; # end inputs
|
}; # end inputs
|
||||||
outputs = inputs@{ self, ... }: let
|
outputs = inputs@{ self, ... }: let
|
||||||
# Functions that setup systems
|
# Functions that setup systems
|
||||||
localLib = import ./lib { inherit inputs; };
|
localLib = import ./lib { inherit inputs; };
|
||||||
|
|
||||||
# creates a macOS system config
|
|
||||||
darwinHostConfig = { system, hostname, username, additionalModules, additionalSpecialArgs }: inputs.nix-darwin.lib.darwinSystem {
|
|
||||||
pkgs = import inputs.nixpkgs {
|
|
||||||
inherit system;
|
|
||||||
config = {
|
|
||||||
allowUnfree = true;
|
|
||||||
permittedInsecurePackages = [ "olm-3.2.16" "python-2.7.18.7" ];
|
|
||||||
};
|
|
||||||
overlays = [ inputs.nixpkgs-terraform.overlays.default ];
|
|
||||||
};
|
|
||||||
specialArgs = { inherit inputs hostname username; } // additionalSpecialArgs;
|
|
||||||
modules = [
|
|
||||||
inputs.nix-homebrew.darwinModules.nix-homebrew {
|
|
||||||
nix-homebrew = {
|
|
||||||
enable = true; # Install Homebrew under the default prefix
|
|
||||||
user = "${username}"; # User owning the Homebrew prefix
|
|
||||||
autoMigrate = true; # Automatically migrate existing Homebrew installations
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
inputs.home-manager.darwinModules.home-manager {
|
|
||||||
home-manager = {
|
|
||||||
extraSpecialArgs = { inherit inputs username; };
|
|
||||||
useGlobalPkgs = true;
|
|
||||||
useUserPackages = true;
|
|
||||||
users.${username}.imports = [
|
|
||||||
inputs.sops-nix.homeManagerModule # user-level secrets management
|
|
||||||
./modules/home-manager/hosts/${hostname}/${username}.nix
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
./modules/system/common/all-darwin.nix # system-wide stuff
|
|
||||||
./modules/hosts/darwin/${hostname} # host specific stuff
|
|
||||||
] ++ additionalModules; # end modules
|
|
||||||
}; # end darwinSystem
|
|
||||||
|
|
||||||
linuxHomeConfig = { system, hostname, username, additionalModules, additionalSpecialArgs }: inputs.home-manager.lib.homeManagerConfiguration {
|
linuxHomeConfig = { system, hostname, username, additionalModules, additionalSpecialArgs }: inputs.home-manager.lib.homeManagerConfiguration {
|
||||||
extraSpecialArgs = { inherit inputs hostname username;
|
extraSpecialArgs = { inherit inputs hostname username;
|
||||||
|
|
@ -141,26 +104,18 @@
|
||||||
in {
|
in {
|
||||||
# Darwin (macOS) hosts
|
# Darwin (macOS) hosts
|
||||||
darwinConfigurations = {
|
darwinConfigurations = {
|
||||||
AirPuppet = darwinHostConfig {
|
AirPuppet = localLib.mkDarwinHost {
|
||||||
system = "x86_64-darwin";
|
system = "x86_64-darwin";
|
||||||
hostname = "AirPuppet";
|
hostname = "AirPuppet";
|
||||||
username = "gene";
|
|
||||||
additionalModules = [];
|
|
||||||
additionalSpecialArgs = {};
|
|
||||||
};
|
};
|
||||||
Blue-Rock = darwinHostConfig {
|
Blue-Rock = localLib.mkDarwinHost {
|
||||||
system = "x86_64-darwin";
|
system = "x86_64-darwin";
|
||||||
hostname = "Blue-Rock";
|
hostname = "Blue-Rock";
|
||||||
username = "gene.liverman";
|
username = "gene.liverman";
|
||||||
additionalModules = [];
|
|
||||||
additionalSpecialArgs = {};
|
|
||||||
};
|
};
|
||||||
mightymac = darwinHostConfig {
|
mightymac = localLib.mkDarwinHost {
|
||||||
system = "aarch64-darwin";
|
|
||||||
hostname = "mightymac";
|
hostname = "mightymac";
|
||||||
username = "gene.liverman";
|
username = "gene.liverman";
|
||||||
additionalModules = [];
|
|
||||||
additionalSpecialArgs = {};
|
|
||||||
};
|
};
|
||||||
}; # end darwinConfigurations
|
}; # end darwinConfigurations
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
{ inputs, ... }: let
|
{ inputs, ... }: let
|
||||||
|
mkDarwinHost = import ./mkDarwinHost.nix { inherit inputs; };
|
||||||
mkNixosHost = import ./mkNixosHost.nix { inherit inputs; };
|
mkNixosHost = import ./mkNixosHost.nix { inherit inputs; };
|
||||||
in {
|
in {
|
||||||
|
inherit (mkDarwinHost)
|
||||||
|
mkDarwinHost
|
||||||
|
;
|
||||||
inherit (mkNixosHost)
|
inherit (mkNixosHost)
|
||||||
mkNixosHost
|
mkNixosHost
|
||||||
;
|
;
|
||||||
|
|
|
||||||
38
lib/mkDarwinHost.nix
Normal file
38
lib/mkDarwinHost.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
{ inputs, ... }: {
|
||||||
|
mkDarwinHost = {
|
||||||
|
system ? "aarch64-darwin",
|
||||||
|
hostname,
|
||||||
|
username ? "gene",
|
||||||
|
additionalModules ? [],
|
||||||
|
additionalSpecialArgs ? {}
|
||||||
|
}: inputs.nix-darwin.lib.darwinSystem {
|
||||||
|
inherit system;
|
||||||
|
specialArgs = { inherit inputs hostname username; } // additionalSpecialArgs;
|
||||||
|
modules = [
|
||||||
|
./nixpkgs-settings.nix
|
||||||
|
|
||||||
|
inputs.nix-homebrew.darwinModules.nix-homebrew {
|
||||||
|
nix-homebrew = {
|
||||||
|
enable = true; # Install Homebrew under the default prefix
|
||||||
|
user = "${username}"; # User owning the Homebrew prefix
|
||||||
|
autoMigrate = true; # Automatically migrate existing Homebrew installations
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
inputs.home-manager.darwinModules.home-manager {
|
||||||
|
home-manager = {
|
||||||
|
extraSpecialArgs = { inherit inputs username; };
|
||||||
|
useGlobalPkgs = true;
|
||||||
|
useUserPackages = true;
|
||||||
|
users.${username}.imports = [
|
||||||
|
inputs.sops-nix.homeManagerModule # user-level secrets management
|
||||||
|
../modules/home-manager/hosts/${hostname}/${username}.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
../modules/system/common/all-darwin.nix # system-wide stuff
|
||||||
|
../modules/hosts/darwin/${hostname} # host specific stuff
|
||||||
|
] ++ additionalModules; # end modules
|
||||||
|
}; # end darwinSystem
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue