Commit edf608d

HPCesia <me@hpcesia.com>
2025-09-30 16:48:38
refactor: migrate shell config
1 parent 0cc4396
Changed files (8)
home
base
core
tui
starship
modules
os-modules
home/base/core/shells/default.nix
@@ -1,36 +0,0 @@
-{
-  pkgs,
-  programsdb,
-  ...
-}: {
-  programs.bash = {
-    enable = true;
-    enableCompletion = true;
-  };
-
-  programs.fish = {
-    enable = true;
-    plugins = with pkgs.fishPlugins; [
-      {
-        inherit (puffer) src;
-        name = "puffer";
-      }
-      {
-        inherit (autopair) src;
-        name = "autopair";
-      }
-    ];
-  };
-
-  programs.nushell = {
-    enable = true;
-    settings = {
-      show_banner = false;
-    };
-  };
-
-  home.file.".nix-defexpr/channels/nixpkgs/programs.sqlite" = {
-    source = programsdb.packages.${pkgs.system}.programs-sqlite;
-    force = true;
-  };
-}
home/base/tui/starship/default.nix
@@ -1,11 +0,0 @@
-{...}: {
-  programs.starship = {
-    enable = true;
-
-    enableBashIntegration = true;
-    enableFishIntegration = true;
-    enableNushellIntegration = true;
-
-    settings = builtins.fromTOML (builtins.readFile ./starship.toml);
-  };
-}
modules/core/shell/starship/default.nix
@@ -0,0 +1,13 @@
+{
+  flake.modules.homeManager.core = _: {
+    programs.starship = {
+      enable = true;
+
+      enableBashIntegration = true;
+      enableFishIntegration = true;
+
+      # Read from file because I'm too lazy to convert it to Nix expr.
+      settings = builtins.fromTOML (builtins.readFile ./starship.toml);
+    };
+  };
+}
home/base/tui/starship/starship.toml → modules/core/shell/starship/starship.toml
File renamed without changes
modules/core/shell/bash.nix
@@ -0,0 +1,12 @@
+{
+  flake.modules.nixos.core = _: {
+    programs.bash.enable = true;
+  };
+
+  flake.modules.homeManager.core = _: {
+    programs.bash = {
+      enable = true;
+      enableCompletion = true;
+    };
+  };
+}
modules/core/shell/fish.nix
@@ -0,0 +1,36 @@
+{inputs, ...}: {
+  flake.modules.nixos.core = _: {
+    programs.fish.enable = true;
+  };
+
+  flake.modules.homeManager.core = {
+    pkgs,
+    config,
+    osConfig,
+    ...
+  }: {
+    programs.fish = {
+      enable = true;
+      generateCompletions = true;
+      plugins = with pkgs.fishPlugins; [
+        {
+          inherit (puffer) src;
+          name = "puffer";
+        }
+        {
+          inherit (autopair) src;
+          name = "autopair";
+        }
+      ];
+    };
+
+    home.file."${
+      if osConfig.nix.settings.use-xdg-base-directories
+      then "${config.xdg.stateHome}/nix/"
+      else ".nix-"
+    }defexpr/channels/nixpkgs/programs.sqlite" = {
+      source = inputs.programsdb.packages.${pkgs.system}.programs-sqlite;
+      force = true;
+    };
+  };
+}
modules/core/shell/nushell.nix
@@ -0,0 +1,14 @@
+{
+  flake.modules.nixos.core = {pkgs, ...}: {
+    environment.systemPackages = [pkgs.nushell];
+  };
+
+  flake.modules.homeManager.core = _: {
+    programs.nushell = {
+      enable = true;
+      settings = {
+        show_banner = false;
+      };
+    };
+  };
+}
os-modules/base/system-packages.nix
@@ -34,8 +34,6 @@
     btop
   ];
 
-  programs.fish.enable = true;
-
   services.aria2 = {
     enable = true;
     rpcSecretFile = config.sops.secrets.aria2-rpc-secret.path;