mirror of
https://github.com/nmasur/dotfiles
synced 2025-03-14 12:17:05 +00:00
consolidate build functions
This commit is contained in:
parent
bf273925ad
commit
bdf163a50a
78
flake.nix
78
flake.nix
@ -255,45 +255,45 @@
|
||||
rec {
|
||||
|
||||
inherit lib;
|
||||
# inherit buildDarwin pkgsBySystem;
|
||||
#
|
||||
# # Contains my full system builds, including home-manager
|
||||
# # nixos-rebuild switch --flake .#tempest
|
||||
# nixosConfigurations =
|
||||
# (builtins.mapAttrs (
|
||||
# name: module:
|
||||
# buildNixos {
|
||||
# pkgs = pkgsBySystem.x86_64-linux;
|
||||
# modules = [ module ];
|
||||
# }
|
||||
# ) x86_64-linux-hosts)
|
||||
# // (builtins.mapAttrs (
|
||||
# name: module:
|
||||
# buildNixos {
|
||||
# pkgs = pkgsBySystem.aarch64-linux;
|
||||
# modules = [ module ];
|
||||
# }
|
||||
# ) aarch64-linux-hosts);
|
||||
#
|
||||
# # Contains my full Mac system builds, including home-manager
|
||||
# # darwin-rebuild switch --flake .#lookingglass
|
||||
# darwinConfigurations = builtins.mapAttrs (
|
||||
# name: module:
|
||||
# buildDarwin {
|
||||
# pkgs = pkgsBySystem.aarch64-darwin;
|
||||
# modules = [ module ];
|
||||
# }
|
||||
# ) aarch64-darwin-hosts;
|
||||
#
|
||||
# # For quickly applying home-manager settings with:
|
||||
# # home-manager switch --flake .#tempest
|
||||
# homeConfigurations = builtins.mapAttrs (
|
||||
# name: module:
|
||||
# buildHome {
|
||||
# pkgs = pkgsBySystem.x86_64-linux;
|
||||
# module = [ module ];
|
||||
# }
|
||||
# ) nixosModules;
|
||||
|
||||
nixosConfigurations = builtins.mapAttrs (
|
||||
system: hosts:
|
||||
builtins.mapAttrs (
|
||||
name: module:
|
||||
lib.buildNixos {
|
||||
inherit system module;
|
||||
specialArgs = { inherit (globals) hostnames; };
|
||||
}
|
||||
) hosts
|
||||
) lib.linuxHosts;
|
||||
|
||||
darwinConfigurations = builtins.mapAttrs (
|
||||
system: hosts:
|
||||
builtins.mapAttrs (
|
||||
name: module:
|
||||
lib.buildDarwin {
|
||||
inherit system module;
|
||||
}
|
||||
) hosts
|
||||
) lib.darwinHosts;
|
||||
|
||||
homeModules = builtins.mapAttrs (
|
||||
system: hosts:
|
||||
builtins.mapAttrs (
|
||||
name: module: (builtins.head (lib.attrsToList module.home-manager.users)).value
|
||||
) hosts
|
||||
) lib.hosts;
|
||||
|
||||
homeConfigurations = builtins.mapAttrs (
|
||||
system: hosts:
|
||||
builtins.mapAttrs (
|
||||
name: module:
|
||||
lib.buildHome {
|
||||
inherit system module;
|
||||
specialArgs = { inherit (globals) hostnames; };
|
||||
}
|
||||
) hosts
|
||||
) homeModules;
|
||||
|
||||
# Disk formatting, only used once
|
||||
diskoConfigurations = {
|
||||
|
@ -7,6 +7,7 @@ in
|
||||
lib
|
||||
// rec {
|
||||
|
||||
# Returns all files in a directory matching a suffix
|
||||
filesInDirectoryWithSuffix =
|
||||
directory: suffix:
|
||||
lib.pipe (lib.filesystem.listFilesRecursive directory) [
|
||||
@ -103,49 +104,54 @@ lib
|
||||
|
||||
buildHome =
|
||||
{
|
||||
pkgs,
|
||||
modules,
|
||||
system,
|
||||
module,
|
||||
specialArgs,
|
||||
}:
|
||||
inputs.home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs;
|
||||
modules = modules ++ [
|
||||
pkgs = pkgsBySystem.${system};
|
||||
modules = [
|
||||
../platforms/home-manager
|
||||
module
|
||||
];
|
||||
extraSpecialArgs = {
|
||||
inherit colorscheme;
|
||||
} // specialArgs;
|
||||
};
|
||||
|
||||
buildNixos =
|
||||
{
|
||||
pkgs,
|
||||
modules,
|
||||
system,
|
||||
module,
|
||||
specialArgs,
|
||||
}:
|
||||
inputs.nixpkgs.lib.nixosSystem {
|
||||
inherit pkgs;
|
||||
modules = modules ++ [
|
||||
pkgs = pkgsBySystem.${system};
|
||||
modules = [
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
inputs.disko.nixosModules.disko
|
||||
inputs.wsl.nixosModules.wsl
|
||||
../platforms/nixos
|
||||
module
|
||||
{
|
||||
home-manager.extraSpecialArgs = {
|
||||
hostnames = globals.hostnames;
|
||||
inherit colorscheme;
|
||||
};
|
||||
} // specialArgs;
|
||||
}
|
||||
];
|
||||
specialArgs = {
|
||||
hostnames = globals.hostnames;
|
||||
};
|
||||
} // specialArgs;
|
||||
};
|
||||
|
||||
buildDarwin =
|
||||
{ pkgs, modules }:
|
||||
{ system, module }:
|
||||
inputs.darwin.lib.darwinSystem {
|
||||
inherit pkgs;
|
||||
modules = modules ++ [
|
||||
pkgs = pkgsBySystem.${system};
|
||||
modules = [
|
||||
inputs.home-manager.darwinModules.home-manager
|
||||
inputs.mac-app-util.darwinModules.default
|
||||
./platforms/nix-darwin
|
||||
module
|
||||
];
|
||||
};
|
||||
|
||||
|
@ -13,6 +13,10 @@ in
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
home.username = config.nmasur.settings.username;
|
||||
home.homeDirectory =
|
||||
if pkgs.stdenv.isDarwin then "/Users/${config.home.username}" else "/home/${config.home.username}";
|
||||
|
||||
home.packages = [
|
||||
pkgs.dig # DNS lookup
|
||||
pkgs.fd # find
|
||||
|
@ -14,6 +14,9 @@ in
|
||||
options.nmasur.profiles.darwin-base.enable = lib.mkEnableOption "Base macOS home-manager config";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
home.homeDirectory = lib.mkForce "/Users/${config.home.username}";
|
||||
|
||||
# Default shell setting doesn't work
|
||||
home.sessionVariables = {
|
||||
SHELL = "${pkgs.fish}/bin/fish";
|
||||
|
Loading…
x
Reference in New Issue
Block a user