From da817da3b9e85d9b37ad74c3781740ff49dca2cf Mon Sep 17 00:00:00 2001
From: Matei Adriel <rafaeladriel11@gmail.com>
Date: Sun, 5 Feb 2023 04:01:18 +0100
Subject: [PATCH] Satellite dev module (+ other changes probably, including eww
 install)

---
 flake.nix                                     |  1 -
 home/adrielus/features/cli/default.nix        |  3 +--
 home/adrielus/features/cli/exa.nix            |  6 +++++
 home/adrielus/features/cli/fish.nix           |  1 -
 .../features/desktop/common/eww/default.nix   |  4 +++
 home/adrielus/features/desktop/xmonad.nix     |  1 +
 home/adrielus/features/neovim/default.nix     | 13 ++--------
 home/adrielus/tethys.nix                      |  2 ++
 modules/home-manager/default.nix              |  1 +
 modules/home-manager/satellite-dev.nix        | 25 +++++++++++++++++++
 10 files changed, 42 insertions(+), 15 deletions(-)
 create mode 100644 home/adrielus/features/cli/exa.nix
 create mode 100644 home/adrielus/features/desktop/common/eww/default.nix
 create mode 100644 modules/home-manager/satellite-dev.nix

diff --git a/flake.nix b/flake.nix
index 308c376..d47014f 100644
--- a/flake.nix
+++ b/flake.nix
@@ -50,7 +50,6 @@
 
       specialArgs = {
         inherit inputs outputs;
-        paths.dotfiles = "/home/adrielus/Projects/satellite/dotfiles";
       };
     in
     rec {
diff --git a/home/adrielus/features/cli/default.nix b/home/adrielus/features/cli/default.nix
index 9268a0b..494c2d5 100644
--- a/home/adrielus/features/cli/default.nix
+++ b/home/adrielus/features/cli/default.nix
@@ -1,5 +1,5 @@
 { pkgs, ... }: {
-  imports = [ ./bat.nix ./ssh.nix ./fish.nix ./tmux ./git.nix ./starship.nix ./direnv.nix ];
+  imports = [ ./exa.nix ./bat.nix ./ssh.nix ./fish.nix ./tmux ./git.nix ./starship.nix ./direnv.nix ];
 
   # Enable bash
   programs.bash.enable = true;
@@ -11,7 +11,6 @@
     comma # Intstall and run programs by sticking a , before them
     bc # Calculator
     ncdu # TUI disk usage
-    exa # Better ls
     ripgrep # Better grep
     fd # Better find
     httpie # Better curl
diff --git a/home/adrielus/features/cli/exa.nix b/home/adrielus/features/cli/exa.nix
new file mode 100644
index 0000000..3382300
--- /dev/null
+++ b/home/adrielus/features/cli/exa.nix
@@ -0,0 +1,6 @@
+{
+    programs.exa = {
+enable = true;
+enableAliases = true;
+      };
+  }
diff --git a/home/adrielus/features/cli/fish.nix b/home/adrielus/features/cli/fish.nix
index e213df4..053d137 100644
--- a/home/adrielus/features/cli/fish.nix
+++ b/home/adrielus/features/cli/fish.nix
@@ -4,7 +4,6 @@
     enable = true;
 
     shellAbbrs = {
-      ls = "exa -la";
       cat = "bat";
     };
 
diff --git a/home/adrielus/features/desktop/common/eww/default.nix b/home/adrielus/features/desktop/common/eww/default.nix
new file mode 100644
index 0000000..b3a3b1e
--- /dev/null
+++ b/home/adrielus/features/desktop/common/eww/default.nix
@@ -0,0 +1,4 @@
+{ config, ... }: {
+  programs.eww.enable = true;
+  programs.eww.configDir = config.satellite-dev.path "home/adrielus/features/desktop/common/eww/widgets";
+}
diff --git a/home/adrielus/features/desktop/xmonad.nix b/home/adrielus/features/desktop/xmonad.nix
index 4fc22fd..0fc65f1 100644
--- a/home/adrielus/features/desktop/xmonad.nix
+++ b/home/adrielus/features/desktop/xmonad.nix
@@ -2,6 +2,7 @@
   imports = [
     ./common/rofi
     ./common/polybar
+    ./common/eww
     ./common/fonts.nix
     ./common/xresources.nix
     ./common/xwallpaper.nix
diff --git a/home/adrielus/features/neovim/default.nix b/home/adrielus/features/neovim/default.nix
index 45fb573..7a4433b 100644
--- a/home/adrielus/features/neovim/default.nix
+++ b/home/adrielus/features/neovim/default.nix
@@ -1,6 +1,5 @@
 { pkgs, lib, config, paths, ... }:
 let
-  devMode = true;
   extraPackages = with pkgs; [
     # Language servers
     nodePackages.typescript-language-server # typescript
@@ -40,13 +39,9 @@ let
   ];
 in
 let
-  symlink = config.lib.file.mkOutOfStoreSymlink;
-
   extraRuntime = env: [
     # Snippets
-    (if devMode
-    then symlink "${paths.dotfiles}/vscode-snippets"
-    else ../../../../dotfiles/vscode-snippets)
+    (config.satellite-dev.path "dotfiles/vscode-snippets")
 
     # Base16 theme
     (pkgs.writeTextDir
@@ -95,11 +90,7 @@ in
   # Do not manage neovim via nix
   programs.neovim.enable = false;
 
-  home.file.".config/nvim".source =
-    if devMode then
-      symlink "${paths.dotfiles}/neovim" else
-      ../../../../dotfiles/neovim;
-
+  home.file.".config/nvim".source = config.satellite-dev.path "dotfiles/neovim";
   home.sessionVariables.EDITOR = "nvim";
 
   home.packages = [
diff --git a/home/adrielus/tethys.nix b/home/adrielus/tethys.nix
index 1297778..88c6bfa 100644
--- a/home/adrielus/tethys.nix
+++ b/home/adrielus/tethys.nix
@@ -19,4 +19,6 @@
     # obs-studio # video recorder
     # lmms # music software
   ];
+
+  satellite-dev.enable = true;
 }
diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix
index 83e43d5..d490d62 100644
--- a/modules/home-manager/default.nix
+++ b/modules/home-manager/default.nix
@@ -5,4 +5,5 @@
   discord = import ./discord.nix;
   fonts = import ./fonts.nix;
   firefox = import ./firefox;
+  satellite-dev = import ./satellite-dev.nix;
 }
diff --git a/modules/home-manager/satellite-dev.nix b/modules/home-manager/satellite-dev.nix
new file mode 100644
index 0000000..d5f3bf6
--- /dev/null
+++ b/modules/home-manager/satellite-dev.nix
@@ -0,0 +1,25 @@
+{ lib, config, ... }: {
+  options.satellite-dev = {
+    enable = lib.mkOption {
+      type = lib.types.bool;
+      default = false;
+      description = "While true, makes out of store symlinks for files in dev mode";
+    };
+
+    root = lib.mkOption {
+      type = lib.types.str;
+      default = "~/Projects/satellite";
+      description = "Where the satellite repo is cloned";
+    };
+
+    path = lib.mkOption {
+      type = lib.types.functionTo lib.types.path;
+      description = "The function used to conditionally symlink in or out of store based on the above paths";
+    };
+  };
+
+  config.satellite-dev.path = path:
+    if config.satellite-dev.enable then
+      config.lib.file.mkOutOfStoreSymlink "${config.satellite-dev.root}/${path}"
+    else "${../..}/${path}";
+}