diff --git a/flake.nix b/flake.nix index c411194..a9ea313 100755 --- a/flake.nix +++ b/flake.nix @@ -55,10 +55,10 @@ nixos = nixpkgs.lib.nixosSystem { specialArgs = { self = self; - import-tree = import-tree; - home-manager = home-manager; nixpkgs = nixpkgs; nixpkgs-unstable = nixpkgs-unstable; + import-tree = import-tree; + home-manager = home-manager; }; modules = [ ./hosts/nixos/overlays.nix @@ -93,9 +93,10 @@ (import-tree ./hosts/darwin/system) ] ++ [ - (import-tree ./hosts/darwin/overlays) - home-manager.darwinModules.home-manager + (import-tree ./overlays/darwin) + (import-tree ./modules/system/darwin) + home-manager.darwinModules.home-manager (import-tree ./hosts/common) (import-tree ./hosts/darwin/home) ]; diff --git a/hosts/darwin/home/alistreaza.nix b/hosts/darwin/home/alistreaza.nix index 1ba63c2..0c599ff 100644 --- a/hosts/darwin/home/alistreaza.nix +++ b/hosts/darwin/home/alistreaza.nix @@ -1,9 +1,9 @@ -{ import-tree, pkgs, ... }: +{ import-tree, ... }: { home-manager.users.alistreaza = { imports = [ - pkgs.paneru.homeModules.paneru (import-tree ../../../modules/home/common) + (import-tree ./partials) ]; home = { @@ -30,10 +30,6 @@ targets.darwin.linkApps.enable = false; targets.darwin.copyApps.enable = false; - services.paneru = { - enable = true; - }; - # The state version is required and should stay at the version you # originally installed. home.stateVersion = "25.11"; diff --git a/hosts/darwin/home/partials/paneru.nix b/hosts/darwin/home/partials/paneru.nix new file mode 100644 index 0000000..39a80f6 --- /dev/null +++ b/hosts/darwin/home/partials/paneru.nix @@ -0,0 +1,37 @@ +{ ... }: +{ + services.paneru = { + enable = true; + # Equivalent to what you would put into `~/.paneru` (See Configuration options below). + settings = { + options = { + preset_column_widths = [ + 0.25 + 0.33 + 0.5 + 0.66 + 0.75 + ]; + swipe_gesture_fingers = 4; + animation_speed = 4000; + }; + bindings = { + window_focus_west = "cmd - h"; + window_focus_east = "cmd - l"; + window_focus_north = "cmd - k"; + window_focus_south = "cmd - j"; + window_swap_west = "alt - h"; + window_swap_east = "alt - l"; + window_swap_first = "alt + shift - h"; + window_swap_last = "alt + shift - l"; + window_center = "alt - c"; + window_resize = "alt - r"; + window_fullwidth = "alt - f"; + window_manage = "ctrl + alt - t"; + window_stack = "alt - ]"; + window_unstack = "alt + shift - ]"; + quit = "ctrl + alt - q"; + }; + }; + }; +} diff --git a/hosts/darwin/overlays/paneru.nix b/hosts/darwin/overlays/paneru.nix deleted file mode 100644 index b251fd9..0000000 --- a/hosts/darwin/overlays/paneru.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: -{ - nixpkgs.overlays = [ - (final: prev: { - paneru = prev.callPackage ../packages/paneru.nix { }; - }) - ]; -} diff --git a/hosts/darwin/packages/paneru.nix b/hosts/darwin/packages/paneru.nix deleted file mode 100644 index d8abbe4..0000000 --- a/hosts/darwin/packages/paneru.nix +++ /dev/null @@ -1,125 +0,0 @@ -{ - self, - fetchFromGitHub, - nixpkgs, -}: -let - pkgs = import nixpkgs { system = "aarch64-darwin"; }; - package = pkgs.rustPlatform.buildRustPackage { - pname = "paneru"; - src = fetchFromGitHub { - owner = "karinushka"; - repo = "paneru"; - sha256 = "sha256-ZPnuAjieJM+C/ebNEr04ZN3Iw+J/mquHekJXXMNHelI="; - }; - postPatch = '' - substituteInPlace build.rs --replace-fail \ - 'let sdk_dir = "/Library/Developer/CommandLineTools/SDKs";' \ - 'let sdk_dir = "${pkgs.apple-sdk}/Platforms/MacOSX.platform/Developer/SDKs";' - ''; - cargoLock.lockFile = ./Cargo.lock; - buildInputs = [ - pkgs.apple-sdk.privateFrameworksHook - ]; - }; -in -{ - packages.aarch64-darwin.default = self.packages.aarch64-darwin.paneru; - packages.aarch64-darwin.paneru = package; - homeModules.paneru = - { config, lib, ... }: - let - cfg = config.services.paneru; - tomlFormat = pkgs.formats.toml { }; - in - { - options.services.paneru = { - enable = lib.mkEnableOption '' - Install paneru and configure the launchd agent. - - The first time this is enabled, macOS will prompt you to allow this background - item in System Settings. - - You can verify the service is running correctly from your terminal. - Run: `launchctl list | grep paneru` - - In case of failure, check the logs with `cat /tmp/paneru.err.log`. - ''; - - package = lib.mkOption { - type = lib.types.package; - default = package; - description = "The paneru package to use."; - }; - - settings = lib.mkOption { - type = lib.types.nullOr lib.types.attrs; - default = null; - description = "Configuration to put in `~/.paneru.toml`."; - example = { - options = { - focus_follows_mouse = true; - preset_column_widths = [ - 0.25 - 0.33 - 0.5 - 0.66 - 0.75 - ]; - swipe_gesture_fingers = 4; - animation_speed = 4000; - }; - bindings = { - window_focus_west = "cmd - h"; - window_focus_east = "cmd - l"; - window_focus_north = "cmd - k"; - window_focus_south = "cmd - j"; - window_swap_west = "alt - h"; - window_swap_east = "alt - l"; - window_swap_first = "alt + shift - h"; - window_swap_last = "alt + shift - l"; - window_center = "alt - c"; - window_resize = "alt - r"; - window_manage = "ctrl + alt - t"; - window_stack = "alt - ]"; - window_unstack = "alt + shift - ]"; - quit = "ctrl + alt - q"; - }; - }; - }; - }; - - config = lib.mkIf cfg.enable { - assertions = [ (lib.hm.assertions.assertPlatform "services.paneru" pkgs lib.platforms.darwin) ]; - launchd.agents.paneru = { - enable = true; - config = { - KeepAlive = { - Crashed = true; - SuccessfulExit = false; - }; - Label = "Paneru"; - Nice = -20; - ProcessType = "Interactive"; - EnvironmentVariables = { - NO_COLOR = "1"; - XDG_CONFIG_HOME = - if config.xdg.enable then config.xdg.configHome else "${config.home.homeDirectory}/.config"; - }; - RunAtLoad = true; - StandardOutPath = "/tmp/paneru.log"; - StandardErrorPath = "/tmp/paneru.err.log"; - Program = cfg.package + /bin/paneru; - }; - }; - - xdg.configFile."paneru/paneru.toml" = lib.mkIf (config.xdg.enable && cfg.settings != null) { - source = tomlFormat.generate "paneru.toml" cfg.settings; - }; - - home.file.".paneru.toml" = lib.mkIf (!config.xdg.enable && cfg.settings != null) { - source = tomlFormat.generate ".paneru.toml" cfg.settings; - }; - }; - }; -} diff --git a/modules/home/darwin/paneru.nix b/modules/home/darwin/paneru.nix new file mode 100644 index 0000000..3b45324 --- /dev/null +++ b/modules/home/darwin/paneru.nix @@ -0,0 +1,100 @@ +{ + pkgs, + config, + lib, + ... +}: +let + cfg = config.services.paneru; + tomlFormat = pkgs.formats.toml { }; +in +{ + options.services.paneru = { + enable = lib.mkEnableOption '' + Install paneru and configure the launchd agent. + + The first time this is enabled, macOS will prompt you to allow this background + item in System Settings. + + You can verify the service is running correctly from your terminal. + Run: `launchctl list | grep paneru` + + In case of failure, check the logs with `cat /tmp/paneru.err.log`. + ''; + + package = lib.mkOption { + type = lib.types.package; + default = pkgs.paneru; + description = "The paneru package to use."; + }; + + settings = lib.mkOption { + type = lib.types.nullOr lib.types.attrs; + default = null; + description = "Configuration to put in `~/.paneru.toml`."; + example = { + options = { + focus_follows_mouse = true; + preset_column_widths = [ + 0.25 + 0.33 + 0.5 + 0.66 + 0.75 + ]; + swipe_gesture_fingers = 4; + animation_speed = 4000; + }; + bindings = { + window_focus_west = "cmd - h"; + window_focus_east = "cmd - l"; + window_focus_north = "cmd - k"; + window_focus_south = "cmd - j"; + window_swap_west = "alt - h"; + window_swap_east = "alt - l"; + window_swap_first = "alt + shift - h"; + window_swap_last = "alt + shift - l"; + window_center = "alt - c"; + window_resize = "alt - r"; + window_manage = "ctrl + alt - t"; + window_stack = "alt - ]"; + window_unstack = "alt + shift - ]"; + quit = "ctrl + alt - q"; + }; + }; + }; + }; + + config = lib.mkIf cfg.enable { + assertions = [ (lib.hm.assertions.assertPlatform "services.paneru" pkgs lib.platforms.darwin) ]; + launchd.agents.paneru = { + enable = true; + config = { + KeepAlive = { + Crashed = true; + SuccessfulExit = false; + }; + Label = "Paneru"; + Nice = -20; + ProcessType = "Interactive"; + EnvironmentVariables = { + NO_COLOR = "1"; + XDG_CONFIG_HOME = + if config.xdg.enable then config.xdg.configHome else "${config.home.homeDirectory}/.config"; + }; + RunAtLoad = true; + StandardOutPath = "/tmp/paneru.log"; + StandardErrorPath = "/tmp/paneru.err.log"; + Program = cfg.package + /bin/paneru; + }; + }; + + xdg.configFile."paneru/paneru.toml" = lib.mkIf (config.xdg.enable && cfg.settings != null) { + source = tomlFormat.generate "paneru.toml" cfg.settings; + }; + + home.file.".paneru.toml" = lib.mkIf (!config.xdg.enable && cfg.settings != null) { + source = tomlFormat.generate ".paneru.toml" cfg.settings; + }; + }; +} diff --git a/modules/home/nixos/jetbrains/clion.nix b/modules/home/nixos/jetbrains/clion.nix deleted file mode 100644 index ff9b3bd..0000000 --- a/modules/home/nixos/jetbrains/clion.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - lib, - pkgs, - config, - ... -}: -with lib; -let - cfg = config.home.ide.jetbrains.clion; -in -{ - options.home.ide.jetbrains.clion = { - enable = mkEnableOption "JetBrains options"; - }; - config = mkIf cfg.enable { - - home.packages = with pkgs.unstable; [ - jetbrains.clion - ]; - - }; -} diff --git a/modules/home/nixos/jetbrains/datagrip.nix b/modules/home/nixos/jetbrains/datagrip.nix deleted file mode 100644 index 94c4391..0000000 --- a/modules/home/nixos/jetbrains/datagrip.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - lib, - pkgs, - config, - ... -}: -with lib; -let - cfg = config.home.ide.jetbrains.datagrip; -in -{ - options.home.ide.jetbrains.datagrip = { - enable = mkEnableOption "JetBrains options"; - }; - config = mkIf cfg.enable { - - home.packages = with pkgs.unstable; [ - jetbrains.datagrip - ]; - - }; -} diff --git a/modules/home/nixos/jetbrains/dataspell.nix b/modules/home/nixos/jetbrains/dataspell.nix deleted file mode 100644 index ed47a25..0000000 --- a/modules/home/nixos/jetbrains/dataspell.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - lib, - pkgs, - config, - ... -}: -with lib; -let - cfg = config.home.ide.jetbrains.dataspell; -in -{ - options.home.ide.jetbrains.dataspell = { - enable = mkEnableOption "JetBrains options"; - }; - config = mkIf cfg.enable { - - home.packages = with pkgs.unstable; [ - jetbrains.dataspell - ]; - - }; -} diff --git a/modules/home/nixos/jetbrains/goland.nix b/modules/home/nixos/jetbrains/goland.nix deleted file mode 100644 index b8cafc9..0000000 --- a/modules/home/nixos/jetbrains/goland.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - lib, - pkgs, - config, - ... -}: -with lib; -let - cfg = config.home.ide.jetbrains.goland; -in -{ - options.home.ide.jetbrains.goland = { - enable = mkEnableOption "JetBrains options"; - }; - config = mkIf cfg.enable { - - home.packages = with pkgs.unstable; [ - jetbrains.goland - ]; - - }; -} diff --git a/modules/home/nixos/jetbrains/idea.nix b/modules/home/nixos/jetbrains/idea.nix deleted file mode 100644 index 37da7ee..0000000 --- a/modules/home/nixos/jetbrains/idea.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - lib, - pkgs, - config, - ... -}: -with lib; -let - cfg = config.home.ide.jetbrains.idea; -in -{ - options.home.ide.jetbrains.idea = { - enable = mkEnableOption "JetBrains options"; - }; - config = mkIf cfg.enable { - - home.packages = with pkgs.unstable; [ - jetbrains.idea - ]; - - }; -} diff --git a/modules/home/nixos/jetbrains/phpstorm.nix b/modules/home/nixos/jetbrains/phpstorm.nix deleted file mode 100644 index 51785af..0000000 --- a/modules/home/nixos/jetbrains/phpstorm.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - lib, - pkgs, - config, - ... -}: -with lib; -let - cfg = config.home.ide.jetbrains.phpstorm; -in -{ - options.home.ide.jetbrains.phpstorm = { - enable = mkEnableOption "JetBrains options"; - }; - config = mkIf cfg.enable { - - home.packages = with pkgs.unstable; [ - jetbrains.phpstorm - ]; - - }; -} diff --git a/modules/home/nixos/jetbrains/pycharm.nix b/modules/home/nixos/jetbrains/pycharm.nix deleted file mode 100644 index a1391c2..0000000 --- a/modules/home/nixos/jetbrains/pycharm.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - lib, - pkgs, - config, - ... -}: -with lib; -let - cfg = config.home.ide.jetbrains.pycharm; -in -{ - options.home.ide.jetbrains.pycharm = { - enable = mkEnableOption "JetBrains options"; - }; - config = mkIf cfg.enable { - - home.packages = with pkgs.unstable; [ - jetbrains.pycharm - ]; - - }; -} diff --git a/modules/home/nixos/jetbrains/rider.nix b/modules/home/nixos/jetbrains/rider.nix deleted file mode 100644 index de69e34..0000000 --- a/modules/home/nixos/jetbrains/rider.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - lib, - pkgs, - config, - ... -}: -with lib; -let - cfg = config.home.ide.jetbrains.rider; -in -{ - options.home.ide.jetbrains.rider = { - enable = mkEnableOption "JetBrains options"; - }; - config = mkIf cfg.enable { - - home.packages = with pkgs.unstable; [ - jetbrains.rider - ]; - - }; -} diff --git a/modules/home/nixos/jetbrains/rubymine.nix b/modules/home/nixos/jetbrains/rubymine.nix deleted file mode 100644 index 56d5040..0000000 --- a/modules/home/nixos/jetbrains/rubymine.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - lib, - pkgs, - config, - ... -}: -with lib; -let - cfg = config.home.ide.jetbrains.rubymine; -in -{ - options.home.ide.jetbrains.rubymine = { - enable = mkEnableOption "JetBrains options"; - }; - config = mkIf cfg.enable { - - home.packages = with pkgs.unstable; [ - jetbrains.ruby-mine - ]; - - }; -} diff --git a/modules/home/nixos/jetbrains/rustrover.nix b/modules/home/nixos/jetbrains/rustrover.nix deleted file mode 100644 index 3e17982..0000000 --- a/modules/home/nixos/jetbrains/rustrover.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - lib, - pkgs, - config, - ... -}: -with lib; -let - cfg = config.home.ide.jetbrains.rustrover; -in -{ - options.home.ide.jetbrains.rustrover = { - enable = mkEnableOption "JetBrains options"; - }; - config = mkIf cfg.enable { - - home.packages = with pkgs.unstable; [ - jetbrains.rust-rover - ]; - - }; -} diff --git a/modules/home/nixos/jetbrains/webstorm.nix b/modules/home/nixos/jetbrains/webstorm.nix deleted file mode 100644 index b6e7e89..0000000 --- a/modules/home/nixos/jetbrains/webstorm.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - lib, - pkgs, - config, - ... -}: -with lib; -let - cfg = config.home.ide.jetbrains.webstorm; -in -{ - options.home.ide.jetbrains.webstorm = { - enable = mkEnableOption "JetBrains options"; - }; - config = mkIf cfg.enable { - - home.packages = with pkgs.unstable; [ - jetbrains.webstorm - ]; - - }; -} diff --git a/overlays/darwin/paneru.nix b/overlays/darwin/paneru.nix new file mode 100644 index 0000000..37d299e --- /dev/null +++ b/overlays/darwin/paneru.nix @@ -0,0 +1,31 @@ +{ pkgs, ... }: +let + package = pkgs.rustPlatform.buildRustPackage { + pname = "paneru"; + version = "0.3.0"; + src = pkgs.fetchFromGitHub { + owner = "karinushka"; + repo = "paneru"; + rev = "66c94493cc99ee7715b4beb1e5cf455ada60213a"; + sha256 = "sha256-VyKzfnXfnIkyjbg1RQTDaIbMdPQjNBD5dxVL6OZQf2U="; + }; + cargoHash = "sha256-nVOhtPbX7pN5K/xqv0Nlx7MZDg9ASTxfgdTy/Kagui8="; + postPatch = '' + substituteInPlace build.rs --replace-fail \ + 'let sdk_dir = "/Library/Developer/CommandLineTools/SDKs";' \ + 'let sdk_dir = "${pkgs.apple-sdk}/Platforms/MacOSX.platform/Developer/SDKs";' + ''; + buildInputs = [ pkgs.apple-sdk.privateFrameworksHook ]; + doCheck = false; + meta = { + platforms = [ "aarch64-darwin" ]; + }; + }; +in +{ + nixpkgs.overlays = [ + (final: prev: { + paneru = package; + }) + ]; +}