diff --git a/homes/x86_64-linux/christopher@cobalt/config/appearance.nix b/homes/x86_64-linux/christopher@cobalt/config/appearance.nix index d7655cc..6f0229e 100644 --- a/homes/x86_64-linux/christopher@cobalt/config/appearance.nix +++ b/homes/x86_64-linux/christopher@cobalt/config/appearance.nix @@ -1,15 +1,34 @@ -{pkgs, ...}: { +{ + lib, + pkgs, + ... +}: { home.packages = with pkgs; [ - rose-pine-cursor lxappearance ]; gtk = { enable = true; + iconTheme.name = "breeze-dark"; cursorTheme = { - name = "BreezeX-RoséPine"; + name = "BreezeX-RosePineDawn-Linux"; package = pkgs.rose-pine-cursor; + size = 32; + }; + + gtk2.extraConfig = lib._elements.selfReferencedString {sep = "#";} '' + gtk-enable-animations = 1 + gtk-primary-button-warps-slider = 1 + gtk-toolbar-style = 3 + gtk-menu-images = 1 + gtk-button-images = 1 + gtk-sound-theme-name = "freedesktop" + ''; + + font = { + name = "Noto Sans"; + size = 10; }; gtk3.extraConfig.gtk-application-prefer-dark-theme = 1; diff --git a/homes/x86_64-linux/christopher@cobalt/config/cron.nix b/homes/x86_64-linux/christopher@cobalt/config/cron.nix index cf1fd47..8b3c7c6 100644 --- a/homes/x86_64-linux/christopher@cobalt/config/cron.nix +++ b/homes/x86_64-linux/christopher@cobalt/config/cron.nix @@ -4,7 +4,7 @@ ... }: let bin = '' - #/usr/bin/env bash + #!/usr/bin/env bash ORG="hausgold" OUTPUT_FILE="/home/christopher/.gh/$ORG-repos" diff --git a/homes/x86_64-linux/christopher@cobalt/misc/everything.nix b/homes/x86_64-linux/christopher@cobalt/misc/everything.nix index 10d1d10..56f1010 100644 --- a/homes/x86_64-linux/christopher@cobalt/misc/everything.nix +++ b/homes/x86_64-linux/christopher@cobalt/misc/everything.nix @@ -34,6 +34,7 @@ vcv-rack # Eurorack simulator davinci-resolve # Video editor cider-2 # Apple music player + todoist-electron # To-Do List app xarchiver # Archive viewer/extractor zathura # Document viewer diff --git a/lib/default.nix b/lib/default.nix index f984900..2094aaa 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,10 +1,18 @@ -{lib, ...} @ all: { +{lib, ...} @ all: rec { rootPath = ./..; secret = name: ./../secrets/${name}; commonHomeModule = module: ./../homes/common + "/${module}"; writeNushellApplication = import ./writeNushellApplication.nix {inherit lib;}; + # Determines the file location of the passed in attr set (e.g. `{ sep = "#"; }) + # and prepends the string with it. This allows to add references to the source + # file that wrote any setting to generated application configurations for debugging. + selfReferencedString = {sep} @ attrs: str: let + ref = builtins.unsafeGetAttrPos "sep" attrs; + in + "${sep} ${ref.file}:${builtins.toString ref.line}\n" + str; + enabled = {enable = true;}; disabled = {enable = false;}; diff --git a/modules/home/common/terminal/default.nix b/modules/home/common/terminal/default.nix index 031bb96..a0d27c8 100644 --- a/modules/home/common/terminal/default.nix +++ b/modules/home/common/terminal/default.nix @@ -1,5 +1,4 @@ {config, ...}: let - data = config.xdg.dataHome; conf = config.xdg.configHome; cache = config.xdg.cacheHome; in { @@ -7,7 +6,8 @@ in { ./programs ./shell/aliases.nix ./shell/prompt.nix - # ./shell/nu + ./shell/fish.nix + ./shell/nu.nix ]; # add environment variables diff --git a/modules/home/common/terminal/programs/cli.nix b/modules/home/common/terminal/programs/cli.nix index 11bb949..d46ad95 100644 --- a/modules/home/common/terminal/programs/cli.nix +++ b/modules/home/common/terminal/programs/cli.nix @@ -1,4 +1,8 @@ -{pkgs, ...}: { +{ + pkgs, + config, + ... +}: { home.packages = with pkgs; [ # Shell software fzf # Fuzzy finding @@ -15,7 +19,25 @@ ]; programs = { - atuin.enable = true; # Better shell history - atuin.enableNushellIntegration = true; + atuin = { + # Better (and synchronized) shell history + enable = true; + enableNushellIntegration = config.programs.nushell.enable; + enableFishIntegration = config.programs.fish.enable; + }; + + zoxide = { + # Quick-jump to folders + enable = true; + enableNushellIntegration = config.programs.nushell.enable; + enableFishIntegration = config.programs.fish.enable; + }; + + carapace = { + # Shell completions + enable = true; + enableNushellIntegration = config.programs.nushell.enable; + enableFishIntegration = config.programs.fish.enable; + }; }; } diff --git a/modules/home/common/terminal/programs/tmux.nix b/modules/home/common/terminal/programs/tmux.nix index 0f04b8c..2a68ade 100644 --- a/modules/home/common/terminal/programs/tmux.nix +++ b/modules/home/common/terminal/programs/tmux.nix @@ -1,7 +1,15 @@ -{pkgs, ...}: { +{ + lib, + pkgs, + ... +}: let + tmuxConfigFile = ".tmux.inspect.conf"; +in { home.packages = [pkgs.tmux]; - home.file.".tmux.inspect.conf".text = '' + home.shellAliases.inspect = "tmux -f ~/${tmuxConfigFile} new-session ssh inspect"; + + home.file.${tmuxConfigFile}.text = lib._elements.selfReferencedString {sep = "#";} '' set -g status-position top set-option -g status-bg default set -g 'status-format[0]' '#[fill=colour202 bg=colour202 fg=colour231 bold]Danger! HAUSGOLD Inspector ' diff --git a/modules/home/common/terminal/shell/aliases.nix b/modules/home/common/terminal/shell/aliases.nix index 0b30614..816199f 100644 --- a/modules/home/common/terminal/shell/aliases.nix +++ b/modules/home/common/terminal/shell/aliases.nix @@ -1,10 +1,7 @@ {lib, ...}: { home.shellAliases = { elements = "just -f /nix/elements/Justfile -d /nix/elements"; - elm = "elements"; - g = "git"; copy = lib.mkDefault "wl-copy"; - inspect = "tmux -f ~/.tmux.inspect.conf new-session ssh inspect"; ansi = "sed -r \"s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g\""; calc = "numbat --pretty-print never -e"; pcalc = "numbat --pretty-print always -e"; diff --git a/modules/home/common/terminal/shell/fish.nix b/modules/home/common/terminal/shell/fish.nix new file mode 100644 index 0000000..6ad1482 --- /dev/null +++ b/modules/home/common/terminal/shell/fish.nix @@ -0,0 +1,37 @@ +{ + lib, + pkgs, + config, + ... +}: let + env = + lib.concatMapAttrsStringSep + "\n" + (name: value: "set -gx ${name} ${lib.escapeShellArg value}") + config.home.sessionVariables; +in { + programs.fish = { + enable = true; + + shellAliases = config.home.shellAliases; + shellInit = lib._elements.selfReferencedString {sep = "#";} '' + # Set global environment variables. + ${env} + ''; + + functions = { + agx = { + wraps = "ag"; + description = "Runs ag on the given string and returns a list of selectable references of the result. The selection is then opened in the editor."; + body = '' + hx (ag $search $argv[2..] | fzf | cut -d : -f 1,2) + ''; + }; + }; + + preferAbbrs = true; + shellAbbrs = { + elm = "elements"; + }; + }; +} diff --git a/modules/home/common/terminal/shell/nu/default.nix b/modules/home/common/terminal/shell/nu.nix similarity index 89% rename from modules/home/common/terminal/shell/nu/default.nix rename to modules/home/common/terminal/shell/nu.nix index ddb6d95..cdd1df8 100644 --- a/modules/home/common/terminal/shell/nu/default.nix +++ b/modules/home/common/terminal/shell/nu.nix @@ -1,27 +1,22 @@ { + lib, pkgs, config, ... }: { - programs.zoxide.enable = true; - programs.zoxide.enableNushellIntegration = true; - programs.nushell = { enable = true; shellAliases = config.home.shellAliases; + environmentVariables = config.home.sessionVariables; plugins = with pkgs; [ nushellPlugins.query nushellPlugins.gstat nushellPlugins.skim - # nushellPlugins.net - # nushellPlugins.units ]; - environmentVariables = config.home.sessionVariables; - - extraConfig = '' + extraConfig = lib._elements.selfReferencedString {sep = "#";} '' let carapace_completer = { |spans| carapace $spans.0 nushell ...$spans | from json @@ -77,7 +72,7 @@ } ''; - envFile.text = '' + envFile.text = lib._elements.selfReferencedString {sep = "#";} '' $env.PATH = ( $env.PATH | split row (char esep) @@ -88,10 +83,4 @@ ) ''; }; - - # Shell completions - programs.carapace = { - enable = true; - enableNushellIntegration = true; - }; } diff --git a/modules/home/common/terminal/shell/prompt.nix b/modules/home/common/terminal/shell/prompt.nix index b46331a..ab07e8a 100644 --- a/modules/home/common/terminal/shell/prompt.nix +++ b/modules/home/common/terminal/shell/prompt.nix @@ -1,10 +1,10 @@ -{...}: let +{config, ...}: let unicode = code: builtins.fromJSON ''"${code}" ''; in { programs.oh-my-posh = { enable = true; - enableNushellIntegration = true; - enableFishIntegration = true; + enableNushellIntegration = config.programs.nushell.enable; + enableFishIntegration = config.programs.fish.enable; # Original settings taken from `catppuccin_frappe`, and adjusted to my # likings and usage. diff --git a/packages/scripts/git-delete-stale/default.nix b/packages/scripts/git-delete-stale/default.nix index 0cdc08b..4a6ed6e 100644 --- a/packages/scripts/git-delete-stale/default.nix +++ b/packages/scripts/git-delete-stale/default.nix @@ -1,12 +1,13 @@ -{pkgs, ...}: -pkgs.writeTextFile rec { +{ + lib, + pkgs, + ... +}: +lib._elements.writeNushellApplication pkgs { name = "git-delete-stale"; - destination = "/bin/${name}"; - executable = true; + runtimeInputs = with pkgs; [git]; text = '' - #!${pkgs.nushell}/bin/nu - let localBranches = ( git branch | lines