Split prompt and desktop

This allows for headless configurations to be marginally easier.
This commit is contained in:
Spotlight 2023-09-10 22:39:18 -05:00
parent 6c9d93a2c8
commit 7f1c17f151
2 changed files with 18 additions and 11 deletions

View file

@ -13,7 +13,13 @@
outputs = { nixpkgs, home-manager, ... }:
let
homeManager = { system, specialArgs ? {
dotfilesOnly = false;
# Whether to configure the zsh prompt.
prompt = true;
# Whether to also install several useful cli tools and desktop applications.
#
# (This primarily focuses around macOS - please use and adopt at your own risk.)
desktop = false;
} }:
home-manager.lib.homeManagerConfiguration {
modules = [
@ -28,7 +34,6 @@
# require dotfiles. For now, this is mostly true :)
x86_64-linux.homeConfigurations.spotlight = homeManager {
system = "x86_64-linux";
specialArgs.dotfilesOnly = true;
};
# Similarly (as of writing), all aarch64 Linux devices are headless
@ -36,15 +41,16 @@
# This should likely be dealt with in the future!
aarch64-linux.homeConfigurations.spotlight = homeManager {
system = "aarch64-linux";
specialArgs.dotfilesOnly = true;
};
# For all architecture variants of Darwin, we don't want only dotfiles.
aarch64-darwin.homeConfigurations.spot = homeManager {
system = "aarch64-darwin";
specialArgs.desktop = true;
};
x86_64-darwin.homeConfigurations.spot = homeManager {
system = "x86_64-darwin";
specialArgs.desktop = true;
};
};
};

View file

@ -1,7 +1,8 @@
{ config, lib, pkgs, specialArgs, ... }:
let
dotfilesOnly = specialArgs.dotfilesOnly;
prompt = specialArgs.prompt or false;
desktop = specialArgs.desktop or false;
in {
# It's standard convention that Darwin has the username
# "spot" - "spotlight" was reserved by the system at some point.
@ -24,8 +25,8 @@ in {
userName = "Spotlight";
userEmail = "spotlight@joscomputing.space";
# Only specify signing if GPG is otherwise being pulled in;
# i.e. not in a dotfiles only configuration.
signing = lib.mkIf (!dotfilesOnly) {
# i.e. in a prompt configuration.
signing = lib.mkIf (prompt) {
key = "6EF6CBB6420B81DA3CCACFEA874AA355B3209BDC";
signByDefault = true;
};
@ -38,14 +39,14 @@ in {
};
# Only include the desktop configuration if not dotfiles only.
imports = [
# zsh, etc
./editor.nix
imports = (lib.optional (prompt) (
# vim, etc
./editor.nix
# zsh, etc
./prompt.nix
] ++ (lib.optional (!dotfilesOnly)
)) ++ (lib.optional (desktop)
./desktop.nix
);
) ++ [];
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage