refactor: migrate darwin configurations to flake-parts

This commit is contained in:
Michael Thomas 2024-06-27 18:52:51 -04:00
parent bf813fab5b
commit 573020d857
6 changed files with 67 additions and 47 deletions

18
darwin/default.nix Normal file
View File

@ -0,0 +1,18 @@
{
inputs,
inputs',
lib,
...
}: {
imports =
[
inputs.agenix.darwinModules.default
inputs.home-manager.darwinModules.home-manager
../common
]
++ lib.my.getModules [./.];
hm.imports = [./home.nix];
environment.systemPackages = [inputs'.agenix.packages.default];
}

3
darwin/home.nix Normal file
View File

@ -0,0 +1,3 @@
{lib, ...}: {
imports = lib.my.getHmModules [./.];
}

View File

@ -42,33 +42,9 @@
...
}:
flake-parts.lib.mkFlake {inherit inputs;} {
flake = let
baseHomeModule = {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = {inherit inputs;};
};
in {
flake = {
overlays = import ./overlays {inherit inputs;};
darwinConfigurations = {
mac = darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = {inherit inputs;};
modules = [
self.overlaysModule
home-manager.darwinModules.home-manager
baseHomeModule
{
home-manager.users.michael = import ./user/environments/mac/home.nix;
}
./modules/yabai.nix
./machines/mac/configuration.nix
];
};
};
homeConfigurations = {
nixos = inputs.home-manager.lib.homeManagerConfiguration {
system = "x86_64-linux";

44
flakes/darwin.nix Normal file
View File

@ -0,0 +1,44 @@
{
inputs,
withSystem,
...
}: let
mkDarwin = {
system ? "aarch64-darwin",
modules ? [],
}:
withSystem system (
{
inputs',
lib,
pkgs,
system,
...
}:
inputs.darwin.lib.darwinSystem {
inherit system;
specialArgs = {
inherit
inputs
inputs'
lib
pkgs
;
};
modules = [../darwin] ++ modules;
}
);
in {
flake.darwinConfigurations = {
mac = mkDarwin {
modules = [
{
hm = import ../user/environments/mac/home.nix;
}
../modules/yabai.nix
../machines/mac/configuration.nix
];
};
};
}

View File

@ -1,7 +1,7 @@
{
imports = [
./lib.nix
# ./darwin.nix
./darwin.nix
./nixos.nix
./packages.nix
# ./home-manager.nix

View File

@ -56,27 +56,6 @@
nix-daemon.enable = true;
};
nixpkgs = {
# Workaround for pyopenssl being marked broken
config.allowBroken = true;
};
nix = {
package = pkgs.nix;
gc = {
automatic = true;
interval.Day = 7;
options = "--delete-older-than 7d";
};
extraOptions = ''
experimental-features = nix-command flakes
'';
settings = {
auto-optimise-store = false;
trusted-users = ["root" "michael"];
};
};
system = {
# Since it's not possible to declare default shell, run this command after build
activationScripts.postActivation.text = ''sudo chsh -s ${pkgs.zsh}/bin/zsh'';