ctucx.git: nixfiles

ctucx' nixfiles

commit 04da9a400f225341251845c82365b9b695bea006
parent 065ca6a118a2a6d414dcdb7ddd3a87948c388989
Author: Leah (ctucx) <git@ctu.cx>
Date: Sat, 17 Jun 2023 10:39:11 +0200

configurations/darwin: some refactoring
12 files changed, 221 insertions(+), 120 deletions(-)
M
configurations/darwin/appSettings.nix
|
75
---------------------------------------------------------------------------
M
configurations/darwin/default.nix
|
10
+++++++---
M
configurations/darwin/homebrew.nix
|
42
------------------------------------------
A
configurations/darwin/macAppStore.nix
|
24
++++++++++++++++++++++++
A
configurations/darwin/programs/coconutBattery.nix
|
20
++++++++++++++++++++
A
configurations/darwin/programs/default.nix
|
18
++++++++++++++++++
A
configurations/darwin/programs/firefox.nix
|
13
+++++++++++++
A
configurations/darwin/programs/hot.nix
|
26
++++++++++++++++++++++++++
A
configurations/darwin/programs/iTerm.nix
|
23
+++++++++++++++++++++++
A
configurations/darwin/programs/iina.nix
|
38
++++++++++++++++++++++++++++++++++++++
A
configurations/darwin/programs/java.nix
|
32
++++++++++++++++++++++++++++++++
A
configurations/darwin/programs/rectangle.nix
|
20
++++++++++++++++++++
diff --git a/configurations/darwin/appSettings.nix b/configurations/darwin/appSettings.nix
@@ -26,81 +26,6 @@
       PlainTextEncoding = 4;
       PlainTextEncodingForWrite = 4;
     };
-
-
-    #
-    # iTerm
-    #
-    "com.googlecode.iterm2" = {
-      # Disable iTerm's annoying promt when quitting it
-      PromptOnQuit = false;
-
-      # Use 'Minimal' Theme
-      TabStyleWithAutomaticOption = 5;
-    };
-
-
-
-    #
-    # coconutBattery.app
-    #
-    "com.coconut-flavour.coconutBattery" = {
-      # don't check for updates
-      SUEnableAutomaticChecks = 0;
-    };
-
-
-    #
-    # Rectangle.app
-    #
-    "com.knollsoft.Rectangle" = {
-      # don't check for updates
-      SUEnableAutomaticChecks = 0;
-    };
-
-
-
-    #
-    # Hot.app
-    #
-    "com.xs-labs.Hot" = {
-      # don't check for updates
-      automaticallyCheckForUpdates = false;
-
-      # Disable icon in applet
-      hideStatusIcon = true;
-
-      # set refresh-intervall to 10 sec
-      refreshInterval = 10;
-    };
-
-
-    #
-    # IINA.app
-    #
-    "com.colliderli.iina" = {
-      # disable "music-mode"
-      autoSwitchToMusicMode = false;
-
-      # show file picker on start
-      actionAfterLaunch = 1;
-
-      # close window on end of file
-      keepOpenOnFileEnd = false;
-
-      # don't continue on last playback position
-      resumeLastPosition = false;
-
-      # set osd-layout to "bottom"
-      oscPosition = 2;
-
-      # quit app when all windows closed
-      quitWhenNoOpenedWindow = true;
-
-      # set path to youtube-dl provided via nix
-      ytdlSearchPath = "/etc/profiles/per-user/leah/bin/youtube-dl";
-    };
-
   };
 
 }
diff --git a/configurations/darwin/default.nix b/configurations/darwin/default.nix
@@ -7,13 +7,17 @@
     ./appSettings.nix
     ./keyboard.nix
     ./trackpad.nix
-    ./homebrew.nix
     ./finder.nix
+    ./dock.nix
+
     ./skhd.nix
     ./syncthing.nix
-    ./dock.nix
-    ./locationchanger.nix
     ./uhubDaemon.nix
+    ./syncthing.nix
+
+    ./homebrew.nix
+    ./macAppStore.nix
+    ./programs
 
     ../common/programs/gpg.nix
     ../common/programs/password-store.nix
diff --git a/configurations/darwin/homebrew.nix b/configurations/darwin/homebrew.nix
@@ -15,8 +15,6 @@
     };
 
     brews   = [
-      "mas"
-      "openjdk"
       "blueutil"
       {
         name            = "sleepwatcher";

@@ -25,59 +23,19 @@
     ];
 
     casks   = [
-      "iterm2"
-      "firefox"
       "thunderbird"
       "libreoffice"
-      "iina"
       "spotify"
-#      "polymc"
       "moneymoney"
 
       "utm"
       "wireshark"
 
-      "rectangle"
-
-      "coconutbattery"
-      "swiftbar"
-      "hot"
       "hiddenbar"
       "keepingyouawake"
-      "topnotch"
       "monitorcontrol"
       "eqmac"
     ];
-
-    masApps = {
-      Numbers       = 409203825;
-      Pages         = 409201541;
-      Navigator     = 1590354537;
-      "ICE Buddy"   = 1595947689;
-      Telegram      = 747648890;
-      "AusweisApp2" = 948660805;
-      Mona          = 1659154653;
-    };
-
   };
 
-  system.activationScripts.postActivation.text = ''
-    # Link the homebrew openjdk so that macos can use it
-    ${if pkgs.system == "aarch64-darwin" then ''
-    HOMEBREW_JAVAVM="/opt/homebrew/opt/openjdk/libexec/openjdk.jdk"
-    '' else ''
-    HOMEBREW_JAVAVM="/usr/local/opt/openjdk/libexec/openjdk.jdk"
-    ''}
-    MACOS_JAVAVM="/Library/Java/JavaVirtualMachines/openjdk.jdk"
-    if [ -d "$HOMEBREW_JAVAVM" ]; then
-      if [ ! -e "MACOS_JAVAVM" ]; then
-        ln -sfn $HOMEBREW_JAVAVM $MACOS_JAVAVM;
-      fi
-    else
-      if [ ! -e "$MACOS_JAVAVM" ]; then
-        rm $MACOS_JAVAVM;
-      fi
-    fi
-  '';
-
 }
diff --git a/configurations/darwin/macAppStore.nix b/configurations/darwin/macAppStore.nix
@@ -0,0 +1,24 @@
+{ pkgs, ... }:
+
+{
+
+  homebrew = {
+    enable  = true;
+
+    brews   = [
+      "mas"
+    ];
+
+    masApps = {
+      Numbers       = 409203825;
+      Pages         = 409201541;
+      Navigator     = 1590354537;
+      "ICE Buddy"   = 1595947689;
+      Telegram      = 747648890;
+      "AusweisApp2" = 948660805;
+      Mona          = 1659154653;
+    };
+
+  };
+
+}
diff --git a/configurations/darwin/programs/coconutBattery.nix b/configurations/darwin/programs/coconutBattery.nix
@@ -0,0 +1,20 @@
+{ pkgs, ... }:
+
+{
+
+  system.defaults.CustomUserPreferences = {
+    "com.coconut-flavour.coconutBattery" = {
+      # don't check for updates
+      SUEnableAutomaticChecks = 0;
+    };
+  };
+
+  homebrew = {
+    enable  = true;
+
+    casks   = [
+      "coconutbattery"
+    ];
+  };
+
+}
diff --git a/configurations/darwin/programs/default.nix b/configurations/darwin/programs/default.nix
@@ -0,0 +1,18 @@
+{ ... }:
+
+{
+
+  imports = [
+    ./firefox.nix
+    ./iTerm.nix
+
+    ./iina.nix
+
+    ./coconutBattery.nix
+    ./rectangle.nix
+    ./hot.nix
+
+    ./java.nix
+  ];
+
+}
diff --git a/configurations/darwin/programs/firefox.nix b/configurations/darwin/programs/firefox.nix
@@ -0,0 +1,13 @@
+{ pkgs, ... }:
+
+{
+
+  homebrew = {
+    enable  = true;
+
+    casks   = [
+      "firefox"
+    ];
+  };
+
+}
diff --git a/configurations/darwin/programs/hot.nix b/configurations/darwin/programs/hot.nix
@@ -0,0 +1,26 @@
+{ pkgs, ... }:
+
+{
+
+  system.defaults.CustomUserPreferences = {
+    "com.xs-labs.Hot" = {
+      # don't check for updates
+      automaticallyCheckForUpdates = false;
+
+      # Disable icon in applet
+      hideStatusIcon = true;
+
+      # set refresh-intervall to 10 sec
+      refreshInterval = 10;
+    };
+  };
+
+  homebrew = {
+    enable  = true;
+
+    casks   = [
+      "hot"
+    ];
+  };
+
+}
diff --git a/configurations/darwin/programs/iTerm.nix b/configurations/darwin/programs/iTerm.nix
@@ -0,0 +1,23 @@
+{ pkgs, ... }:
+
+{
+
+  system.defaults.CustomUserPreferences = {
+    "com.googlecode.iterm2" = {
+      # Disable iTerm's annoying promt when quitting it
+      PromptOnQuit = false;
+
+      # Use 'Minimal' Theme
+      TabStyleWithAutomaticOption = 5;
+    };
+  };
+
+  homebrew = {
+    enable  = true;
+
+    casks   = [
+      "iterm2"
+    ];
+  };
+
+}
diff --git a/configurations/darwin/programs/iina.nix b/configurations/darwin/programs/iina.nix
@@ -0,0 +1,38 @@
+{ pkgs, ... }:
+
+{
+
+  system.defaults.CustomUserPreferences = {
+    "com.colliderli.iina" = {
+      # disable "music-mode"
+      autoSwitchToMusicMode = false;
+
+      # show file picker on start
+      actionAfterLaunch = 1;
+
+      # close window on end of file
+      keepOpenOnFileEnd = false;
+
+      # don't continue on last playback position
+      resumeLastPosition = false;
+
+      # set osd-layout to "bottom"
+      oscPosition = 2;
+
+      # quit app when all windows closed
+      quitWhenNoOpenedWindow = true;
+
+      # set path to youtube-dl provided via nix
+      ytdlSearchPath = "/etc/profiles/per-user/leah/bin/youtube-dl";
+    };
+  };
+
+  homebrew = {
+    enable  = true;
+
+    casks   = [
+      "iina"
+    ];
+  };
+
+}
diff --git a/configurations/darwin/programs/java.nix b/configurations/darwin/programs/java.nix
@@ -0,0 +1,32 @@
+{ pkgs, ... }:
+
+{
+
+  homebrew = {
+    enable  = true;
+
+    brews   = [
+      "openjdk"
+    ];
+  };
+
+  system.activationScripts.postActivation.text = ''
+    # Link the homebrew openjdk so that macos can use it
+    ${if pkgs.system == "aarch64-darwin" then ''
+    HOMEBREW_JAVAVM="/opt/homebrew/opt/openjdk/libexec/openjdk.jdk"
+    '' else ''
+    HOMEBREW_JAVAVM="/usr/local/opt/openjdk/libexec/openjdk.jdk"
+    ''}
+    MACOS_JAVAVM="/Library/Java/JavaVirtualMachines/openjdk.jdk"
+    if [ -d "$HOMEBREW_JAVAVM" ]; then
+      if [ ! -e "MACOS_JAVAVM" ]; then
+        ln -sfn $HOMEBREW_JAVAVM $MACOS_JAVAVM;
+      fi
+    else
+      if [ ! -e "$MACOS_JAVAVM" ]; then
+        rm $MACOS_JAVAVM;
+      fi
+    fi
+  '';
+
+}
diff --git a/configurations/darwin/programs/rectangle.nix b/configurations/darwin/programs/rectangle.nix
@@ -0,0 +1,20 @@
+{ pkgs, ... }:
+
+{
+
+  system.defaults.CustomUserPreferences = {
+    "com.knollsoft.Rectangle" = {
+      # don't check for updates
+      SUEnableAutomaticChecks = 0;
+    };
+  };
+
+  homebrew = {
+    enable  = true;
+
+    casks   = [
+      "rectangle"
+    ];
+  };
+
+}