zsh: port to sane.programs
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
|
||||
sane.roles.client = true;
|
||||
sane.roles.handheld = true;
|
||||
sane.zsh.showDeadlines = false; # unlikely to act on them when in shell
|
||||
sane.programs.zsh.config.showDeadlines = false; # unlikely to act on them when in shell
|
||||
sane.services.wg-home.enable = true;
|
||||
sane.services.wg-home.ip = config.sane.hosts.by-name."moby".wg-home.ip;
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
};
|
||||
|
||||
sane.roles.build-machine.enable = true;
|
||||
sane.zsh.showDeadlines = false; # ~/knowledge doesn't always exist
|
||||
sane.programs.zsh.config.showDeadlines = false; # ~/knowledge doesn't always exist
|
||||
sane.programs.consoleUtils.suggestedPrograms = [
|
||||
"consoleMediaUtils" # notably, for go2tv / casting
|
||||
"pcConsoleUtils"
|
||||
|
@@ -19,27 +19,28 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf mkMerge mkOption types;
|
||||
cfg = config.sane.zsh;
|
||||
cfg = config.sane.programs.zsh;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./starship.nix
|
||||
];
|
||||
options = {
|
||||
# TODO: port to sane.programs options
|
||||
sane.zsh = {
|
||||
showDeadlines = mkOption {
|
||||
|
||||
sane.programs.zsh = {
|
||||
configOption = with lib; mkOption {
|
||||
default = {};
|
||||
type = types.submodule {
|
||||
options.showDeadlines = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "show upcoming deadlines (from my PKM) upon shell init";
|
||||
};
|
||||
starship = mkOption {
|
||||
options.starship = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "enable starship prompt";
|
||||
};
|
||||
guiIntegrations = mkOption {
|
||||
options.guiIntegrations = mkOption {
|
||||
type = types.bool;
|
||||
default = config.sane.programs.guiApps.enabled;
|
||||
description = ''
|
||||
@@ -50,9 +51,6 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
({
|
||||
sane.programs.zsh = {
|
||||
sandbox.enable = false; # TODO: i could at least sandbox the prompt (starship)!
|
||||
persist.byStore.private = [
|
||||
# we don't need to full zsh dir -- just the history file --
|
||||
@@ -63,7 +61,7 @@ in
|
||||
fs.".config/zsh/.zshrc".symlink.text = ''
|
||||
# zsh/prezto complains if zshrc doesn't exist or is empty;
|
||||
# preserve this comment to prevent that from ever happening.
|
||||
'' + lib.optionalString cfg.showDeadlines ''
|
||||
'' + lib.optionalString cfg.config.showDeadlines ''
|
||||
${pkgs.sane-scripts.deadlines}/bin/sane-deadlines
|
||||
'' + ''
|
||||
|
||||
@@ -109,12 +107,12 @@ in
|
||||
test -e ~/.profile && source ~/.profile
|
||||
'';
|
||||
};
|
||||
})
|
||||
(mkIf config.sane.programs.zsh.enabled {
|
||||
# enable zsh completions
|
||||
environment.pathsToLink = [ "/share/zsh" ];
|
||||
|
||||
programs.zsh = {
|
||||
|
||||
# enable zsh completions
|
||||
environment.pathsToLink = lib.mkIf cfg.enabled [ "/share/zsh" ];
|
||||
|
||||
programs.zsh = lib.mkIf cfg.enabled {
|
||||
enable = true;
|
||||
shellAliases = {
|
||||
":q" = "exit";
|
||||
@@ -193,12 +191,10 @@ in
|
||||
'';
|
||||
|
||||
syntaxHighlighting.enable = true;
|
||||
vteIntegration = cfg.guiIntegrations;
|
||||
vteIntegration = cfg.config.guiIntegrations;
|
||||
};
|
||||
|
||||
# enable a command-not-found hook to show nix packages that might provide the binary typed.
|
||||
# programs.nix-index.enableZshIntegration = true;
|
||||
programs.command-not-found.enable = false;
|
||||
})
|
||||
];
|
||||
# programs.nix-index.enableZshIntegration = lib.mkIf cfg.enabled true;
|
||||
programs.command-not-found.enable = lib.mkIf cfg.enabled false;
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@
|
||||
{ config, lib, pkgs, ...}:
|
||||
|
||||
let
|
||||
enabled = config.sane.zsh.starship;
|
||||
enabled = config.sane.programs.zsh.config.starship;
|
||||
toml = pkgs.formats.toml {};
|
||||
colors = {
|
||||
# colors sorted by the order they appear in the status bar
|
||||
@@ -16,12 +16,11 @@ let
|
||||
_06_blue = "#33658A";
|
||||
};
|
||||
in {
|
||||
config = lib.mkIf config.sane.zsh.starship {
|
||||
sane.programs.zsh = lib.mkIf enabled {
|
||||
fs.".config/zsh/.zshrc".symlink.text = ''
|
||||
sane.programs.zsh.fs = lib.mkIf enabled {
|
||||
".config/zsh/.zshrc".symlink.text = ''
|
||||
eval "$(${pkgs.starship}/bin/starship init zsh)"
|
||||
'';
|
||||
fs.".config/starship.toml".symlink.target = toml.generate "starship.toml" {
|
||||
".config/starship.toml".symlink.target = toml.generate "starship.toml" {
|
||||
format = builtins.concatStringsSep "" [
|
||||
"[](${colors._01_purple})"
|
||||
"$os"
|
||||
@@ -97,5 +96,4 @@ in {
|
||||
status.format = "[$symbol]($style)";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user