-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: make legacy darwinConfigurations running well
- Loading branch information
Showing
12 changed files
with
181 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,99 @@ | ||
{ ... }: | ||
{ self, withSystem, inputs, ... }: | ||
|
||
let | ||
sharedModules = [ | ||
../shared/darwin/gpg.nix | ||
../shared/darwin/homebrew.nix | ||
../shared/darwin/network.nix | ||
../shared/darwin/packages.nix | ||
../shared/darwin/system.nix | ||
]; | ||
inherit (inputs.nixpkgs.lib) attrValues; | ||
|
||
mkDarwin = name: { system ? "aarch64-darwin", user ? self.users.default, stateVersion ? 4, homeManagerStateVersion ? "23.05", modules ? [ ] }: withSystem system (ctx: | ||
inputs.darwin.lib.darwinSystem { | ||
inherit inputs; | ||
inherit (ctx) system; | ||
|
||
modules = attrValues self.commonModules | ||
++ attrValues self.darwinModules | ||
++ [ | ||
# Composed home-manager configuration. | ||
inputs.home.darwinModules.home-manager | ||
({ pkgs, ... }: { | ||
inherit (ctx) nix; | ||
_module.args = ctx.extraModuleArgs; | ||
nixpkgs = removeAttrs ctx.nixpkgs [ "hostPlatform" ]; | ||
system.stateVersion = stateVersion; | ||
users.primaryUser = user; | ||
networking.hostName = name; | ||
networking.computerName = name; | ||
environment.systemPackages = ctx.basePackagesFor pkgs; | ||
# `home-manager` config | ||
users.users.${user.username} = { | ||
home = "/Users/${user.username}"; | ||
shell = pkgs.fish; | ||
}; | ||
home-manager.useGlobalPkgs = true; | ||
home-manager.useUserPackages = true; | ||
home-manager.users.${user.username} = { | ||
imports = attrValues self.homeManagerModules ++ [ inputs.sops.homeManagerModule ]; | ||
home.stateVersion = homeManagerStateVersion; | ||
home.user-info = user; | ||
home.packages = [ pkgs.sops ]; | ||
sops.gnupg.home = "~/.gnupg"; | ||
sops.gnupg.sshKeyPaths = [ ]; | ||
sops.defaultSopsFile = ../secrets/secret.yaml; | ||
# git diff integrations | ||
programs.git.extraConfig.diff.sopsdiffer.textconv = "sops -d"; | ||
}; | ||
}) | ||
] ++ modules; | ||
} | ||
); | ||
|
||
mkDarwinConfigurations = configurations: builtins.mapAttrs (name: opt: mkDarwin name opt) configurations; | ||
in | ||
|
||
{ | ||
# nix-darwin configurations | ||
parts.darwinConfigurations = { | ||
# Apple M1 | ||
eR17x = { | ||
system = "aarch64-darwin"; | ||
stateVersion = 4; | ||
modules = sharedModules; | ||
flake.users = { | ||
default = rec { | ||
username = "r17"; | ||
fullName = "Rin"; | ||
email = "hi@rin.rocks"; | ||
nixConfigDirectory = "/Users/${username}/.config/nixpkgs"; | ||
within = { | ||
neovim.enable = true; | ||
gpg.enable = true; | ||
pass.enable = true; | ||
}; | ||
}; | ||
}; | ||
|
||
# NixOS configurations | ||
# parts.nixosConfigurations = { | ||
# linuxBased = { | ||
# system = "x86_64-linux"; | ||
# stateVersion = "23.05"; | ||
|
||
# modules = []; | ||
# }; | ||
# wsl2 = { | ||
# system = "x86_64-linux"; | ||
# stateVersion = "22.05"; # only change this if you know what you are doing. | ||
# wsl = true; | ||
|
||
# modules = [ ]; | ||
# }; | ||
#}; | ||
flake.commonModules = { | ||
system-shells = import ../shared/shells.nix; | ||
users-primaryUser = import ../shared/user.nix; | ||
programs-nix-index = import ../shared/nix-index.nix; | ||
}; | ||
flake.darwinModules = { | ||
system-darwin = import ../shared/darwin/system.nix; | ||
system-darwin-packages = import ../shared/darwin/packages.nix; | ||
system-darwin-gpg = import ../shared/darwin/gpg.nix; | ||
system-darwin-window-manager = import ../shared/darwin/mouseless.nix; | ||
system-darwin-homebrew = import ../shared/darwin/homebrew.nix; | ||
system-darwin-network = import ../shared/darwin/network.nix; | ||
}; | ||
# `home-manager` modules | ||
flake.homeManagerModules = { | ||
r17-alacritty = import ../home/alacritty.nix; | ||
r17-activation = import ../home/activation.nix; | ||
r17-packages = import ../home/packages.nix; | ||
r17-shell = import ../home/shells.nix; | ||
r17-git = import ../home/git.nix; | ||
r17-tmux = import ../home/tmux.nix; | ||
r17-neovim = import ../home/neovim.nix; | ||
gpg = import ../home/gpg.nix; | ||
pass = import ../home/pass.nix; | ||
home-user-info = { lib, ... }: { | ||
options.home.user-info = | ||
(self.commonModules.users-primaryUser { inherit lib; }).options.users.primaryUser; | ||
}; | ||
}; | ||
# nix-darwin configurations | ||
flake.darwinConfigurations = mkDarwinConfigurations { | ||
eR17 = { }; | ||
eR17x = { }; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.