Commit e1ce8bb5bb60

Vincent Demeester <vincent@sbr.pm>
2018-11-01 21:26:22
profiles: move fish to a module `profiles.fish`…
… enabled by default 🎉 Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent dc87131
machine/honshu.nix
@@ -7,7 +7,6 @@
     ../hardware/dell-latitude-e6540.nix
     ../profiles/server.nix
     ../profiles/dev.nix
-    ../profiles/fish.nix
     ../profiles/avahi.nix
     ../profiles/containerd.nix
     ../profiles/syncthing.nix
fish/fish_prompt.fish → modules/profiles/assets/fish/fish_prompt.fish
File renamed without changes
fish/fish_right_prompt.fish → modules/profiles/assets/fish/fish_right_prompt.fish
File renamed without changes
modules/profiles/fish.nix
@@ -0,0 +1,28 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+let
+  cfg = config.profiles.fish;
+in
+{
+  options = {
+    profiles.fish = {
+      enable = mkOption {
+        default = true;
+        description = "Enable fish profile";
+        type = types.bool;
+      };
+    };
+  };
+  config = mkIf cfg.enable {
+    programs.fish = {
+      enable = true;
+      promptInit = ''
+        source /etc/fish/functions/fish_prompt.fish
+        source /etc/fish/functions/fish_right_prompt.fish
+      '';
+    };
+    environment.etc."fish/functions/fish_prompt.fish".source = ./assets/fish/fish_prompt.fish;
+    environment.etc."fish/functions/fish_right_prompt.fish".source = ./assets/fish/fish_right_prompt.fish;
+  };
+}
modules/module-list.nix
@@ -2,6 +2,9 @@
 
 {
   imports = [
+    ./profiles/fish.nix
+    #./profiles/desktop.nix
+    #./profiles/laptop.nix
     ./programs/podman.nix
     ./services/wireguard.client.nix
     ./virtualisation/buildkit.nix
profiles/default.nix
@@ -4,7 +4,6 @@
   imports = [
     ./users.nix
     ./overlays.nix
-    ../modules/module-list.nix
   ];
   boot.loader.systemd-boot.enable = true;
   environment = {
profiles/desktop.nix
@@ -7,7 +7,6 @@
     ./scanning.nix
     ./avahi.nix
     ./syncthing.nix
-    ./fish.nix
   ];
 
   boot.loader.efi.canTouchEfiVariables = true;
profiles/fish.nix
@@ -1,13 +0,0 @@
-{ configs, pkgs, ...}:
-
-{
-  programs.fish = {
-    enable = true;
-    promptInit = ''
-      source /etc/fish/functions/fish_prompt.fish
-      source /etc/fish/functions/fish_right_prompt.fish
-    '';
-  };
-  environment.etc."fish/functions/fish_prompt.fish".source = ../fish/fish_prompt.fish;
-  environment.etc."fish/functions/fish_right_prompt.fish".source = ../fish/fish_right_prompt.fish;
-}
configuration.nix
@@ -12,6 +12,7 @@ rec {
     # Generated hardware configuration
     ./hardware-configuration.nix
     # Default profile with default configuration
+    ./modules/module-list.nix
     ./profiles/default.nix
     # Machine specific configuration files
     (./machine + "/${hostName}.nix")