diff --git a/README.md b/README.md index c3e6a3e..c149d35 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,85 @@ # dotfiles -My personal NixOS configurations designed with focus on usability, aesthetics and productivity :) +My personal nix configurations designed with focus on usability, aesthetics and productivity :) \ +Includes configurations for desktop NixOS, server NixOS, nix-darwin, and home-manager following the [dendritic pattern](https://discourse.nixos.org/t/the-dendritic-pattern/61271) using [flake-parts](https://github.com/hercules-ci/flake-parts) + [import-tree](https://github.com/vic/import-tree). -## Install instructions +## Architecture -To get these configurations running, first set up a NixOS system with a user account. \ -Then copy your age key to `~/.config/sops/age/keys.txt`. This is needed in order to decrypt the secrets which are used in the system and the home configuration. \ -Now we can start actually installing the configurations. Go into a shell with `git` installed: +`import-tree` auto-imports every `.nix` file under `components/` into the flake. No manual registration needed when adding new modules.\ +Modules are namespaced by flake-parts module class and accessed via `self.modules..`: + +| Class | Used for | +|-------|---------| +| `nixos` | NixOS system modules | +| `homeManager` | Home Manager modules | +| `darwin` | nix-darwin system modules | +| `generic` | host-specific configs (usable in any namespace) | +| `system` | cross-platform modules for the use in NixOS and Darwin | + +### `resolveSystemModules` + +`system`-class modules can't be passed directly to `nixosSystem`/`darwinSystem` (wrong `_class`).\ +`self.lib.resolveSystemModules` maps over a module list and converts `system` → target class + +### pkgs via `perSystem` / `withSystem` + +`nixpkgs` is instantiated once in `perSystem` (with overlays, `allowUnfree`, etc.). The hosts consume the appropriate pkgs set via `withSystem` in their system and home-manager configs — ensuring consistent `nixpkgs` across multiple hosts. + +### Hosts + +Each host lives in `components/hosts//` and consists of: + +| File | Purpose | +|------|---------| +| `_settings-base.nix` | Pure attrset for top-level settings | +| `settings.nix` | Flake module: exposes `nixos.hostSystemConfig` + `generic.hostUserConfig` | +| `default.nix` | Wires `nixosConfigurations` / `homeConfigurations` together | +| `_hardware-configuration.nix` | Machine-specific hardware config | +| `extra-config.nix` | Optional host-specific overrides | + +## Secrets + +Secrets are managed with [sops-nix](https://github.com/Mic92/sops-nix). The AGE key must be present at `~/.config/sops/age/keys.txt` before activating any configuration that uses secrets. + +## Installation + +**1. Bootstrap NixOS and clone:** ```bash nix-shell -p git +git clone https://github.com/leon-erd/dotfiles.git ~/dotfiles +cd ~/dotfiles ``` -Then clone the repo: +**2. Copy AGE key** (needed for sops-nix secrets): ```bash -git clone https://github.com/leon-erd/dotfiles.git ~/dotfiles +mkdir -p ~/.config/sops/age +cp /path/to/keys.txt ~/.config/sops/age/keys.txt ``` -To get the hardware configuration on a new system, either copy from `/etc/nixos/hardware-configuration.nix` or run: +**3. Generate hardware config** (if new machine): ```bash cd ~/dotfiles -sudo nixos-generate-config --show-hardware-config > hosts//hardware-configuration.nix +sudo nixos-generate-config --show-hardware-config \ + > components/hosts//_hardware-configuration.nix ``` -Make sure to update the `systemSettings` and `userSettings` in `hosts//flakeConfiguration.nix` to your needs: -```nix -... -let - systemSettings = { - hostname = "leon-inspiron"; - timezone = "Europe/Vienna"; - defaultLocale = "en_US.UTF-8"; -... -``` - -Once the variables are set, switch into the system configuration by running: +**4. Build system configuration:** ```bash cd ~/dotfiles sudo nixos-rebuild switch --flake ./# ``` -where `systemConfigurationName` corresponds to the value set in `hosts//flakeConfiguration.nix`. -The home-manager configuration can be installed with (might need to logout/login once before): +**5. Build home configuration** (might need logout/login once): ```bash cd ~/dotfiles home-manager switch --flake ./# ``` + +## Raspberry Pi + +The raspberrypi has its own `flake.nix` + `flake.lock` for independent `nixpkgs` update cycles (server stability). Build from its subdirectory: +```bash +cd components/hosts/raspberrypi +sudo nixos-rebuild switch --flake .#raspberrypi +home-manager switch --flake .#leon@raspberrypi +``` \ No newline at end of file diff --git a/components/config-options.nix b/components/config-options.nix new file mode 100644 index 0000000..7a7d5a6 --- /dev/null +++ b/components/config-options.nix @@ -0,0 +1,192 @@ +{ ... }: + +{ + flake.modules.generic.configSystemOptions = + { lib, ... }: + + let + inherit (lib.types) + listOf + str + submodule + ; + inherit (lib.options) mkOption; + in + { + options.mySystemConfig = { + hostname = mkOption { + type = str; + description = "Hostname, unique identifier for building the flake"; + example = "inspiron-laptop"; + }; + timezone = mkOption { + type = str; + default = "Europe/Vienna"; + }; + defaultLocale = mkOption { + type = str; + default = "en_US.UTF-8"; + }; + extraLocale = mkOption { + type = str; + default = "de_AT.UTF-8"; + description = "Extra locale (for measurement, numeric, time, …)"; + }; + kblayout = mkOption { + type = str; + default = "de"; + description = "Keyboard layout"; + }; + localIp = mkOption { + type = str; + description = "Local IP address of the machine"; + example = "192.168.179.200"; + }; + acmeEmail = mkOption { + type = str; + description = "Email address for ACME/Let's Encrypt certificates"; + }; + nextcloud = { + drives = { + main = mkOption { + type = str; + description = "udev disk ID for the main Nextcloud drive"; + example = "usb-TOSHIBA_External_USB_3.0_20200714006512F-0:0-part1"; + }; + backup = mkOption { + type = str; + description = "udev disk ID for the Nextcloud backup drive"; + example = "usb-Intenso_External_USB_3.0_20161230160B8-0:0-part1"; + }; + }; + hostName = mkOption { + type = str; + description = "Public hostname for the Nextcloud instance"; + example = "cloud.example.com"; + }; + trustedDomains = mkOption { + type = listOf str; + description = "Additional trusted domains for Nextcloud"; + example = [ "192.168.179.200" ]; + }; + }; + pihole = { + hosts = mkOption { + type = listOf str; + default = [ ]; + description = "Extra host entries for Pi-hole"; + example = [ "192.168.179.200 raspberry.pi" ]; + }; + }; + wireguard = { + externalInterface = mkOption { + type = str; + description = "Network interface facing the internet (use `ip a`)"; + example = "enu1u1u1"; + }; + clientPeers = mkOption { + type = listOf (submodule { + options = { + name = mkOption { type = str; }; + publicKey = mkOption { type = str; }; + allowedIPs = mkOption { type = listOf str; }; + }; + }); + default = [ ]; + description = "WireGuard client peers"; + example = [ + { + name = "laptop"; + publicKey = "dLHb13EIwUM1HJoEPojOskp18c87Ciu/ZYUZmIkQMBA="; + allowedIPs = [ "10.100.0.2/32" ]; + } + ]; + }; + }; + }; + }; + + flake.modules.generic.configUserOptions = + { lib, config, ... }: + + let + inherit (lib.types) + listOf + path + str + submodule + ; + inherit (lib.options) mkOption; + + user = submodule { + options = { + username = mkOption { + type = str; + }; + systemConfigurationName = mkOption { + type = str; + description = "Name of the NixOS configuration this user belongs to"; + }; + userConfigurationName = mkOption { + type = str; + description = "Key used in homeConfigurations, typically username@systemConfigurationName"; + default = "${config.username}@${config.systemConfigurationName}"; + defaultText = lib.literalExpression ''"''${config.username}@''${config.systemConfigurationName}"''; + }; + name = mkOption { + type = str; + description = "Display name, used for e.g. git"; + }; + email = mkOption { + type = str; + description = "Email address, used for e.g. git"; + }; + extraGroups = mkOption { + type = listOf str; + default = [ + "networkmanager" + "wheel" + "video" + "libvirtd" + ]; + }; + kblayout = mkOption { + type = str; + default = "de"; + description = "Keyboard layout"; + }; + flakeDirectory = mkOption { + type = str; + description = "Absolute path to the dotfiles flake on the machine"; + example = "/home/leon/dotfiles"; + }; + wallpaperFolder = mkOption { + type = str; + description = "Absolute path to the wallpaper folder"; + example = "/home/leon/Nextcloud/Pictures"; + }; + wireguardConfig = mkOption { + type = path; + description = "Path to the WireGuard client config file"; + example = lib.literalExpression "../secrets/files/wireguard_clients/my-wireguard.conf"; + }; + }; + }; + in + { + options.myUsers = mkOption { + type = listOf user; + description = "List of users"; + }; + }; + + flake.modules.homeManager.configCurrentUserOptions = + { config, lib, ... }: + { + options.myUserConfig = lib.mkOption { + type = lib.types.unspecified; + description = "The user config of the current user, automatically set by the home manager configuration"; + }; + config.myUserConfig = lib.mkDefault (lib.head config.myUsers); + }; +} diff --git a/hosts/barbara-laptop/hardware-configuration.nix b/components/hosts/barbara-laptop/_hardware-configuration.nix similarity index 89% rename from hosts/barbara-laptop/hardware-configuration.nix rename to components/hosts/barbara-laptop/_hardware-configuration.nix index f071590..cdb79b2 100644 --- a/hosts/barbara-laptop/hardware-configuration.nix +++ b/components/hosts/barbara-laptop/_hardware-configuration.nix @@ -43,6 +43,6 @@ { device = "/dev/disk/by-uuid/2d14d1e5-3db7-402c-a272-9a2d2e380106"; } ]; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + # nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; # nixpkgs.hostPlatform is derived from pkgs by readOnlyPkgs hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hosts/barbara-laptop/mamas-packages.nix b/components/hosts/barbara-laptop/_mamas-packages.nix similarity index 100% rename from hosts/barbara-laptop/mamas-packages.nix rename to components/hosts/barbara-laptop/_mamas-packages.nix diff --git a/components/hosts/barbara-laptop/_settings-base.nix b/components/hosts/barbara-laptop/_settings-base.nix new file mode 100644 index 0000000..cb5a9d5 --- /dev/null +++ b/components/hosts/barbara-laptop/_settings-base.nix @@ -0,0 +1,8 @@ +rec { + system = "x86_64-linux"; # system arch (see hardware-configuration.nix -> nixpkgs.hostPlatform); + hostname = "mamas-laptop"; + systemConfigurationName = hostname; + + username = "barbara"; + userConfigurationName = "${username}@${systemConfigurationName}"; +} diff --git a/components/hosts/barbara-laptop/default.nix b/components/hosts/barbara-laptop/default.nix new file mode 100644 index 0000000..b6e8979 --- /dev/null +++ b/components/hosts/barbara-laptop/default.nix @@ -0,0 +1,110 @@ +{ + self, + withSystem, + inputs, + ... +}: +let + hostSettings = import ./_settings-base.nix; + inherit (self.lib) resolveSystemModules; +in +{ + flake.nixosConfigurations.${hostSettings.systemConfigurationName} = inputs.nixpkgs.lib.nixosSystem { + modules = resolveSystemModules "nixos" ( + with self.modules; + [ + # setup pkgs: use preconfigured pkgs for the current system + inputs.nixpkgs.nixosModules.readOnlyPkgs + { + nixpkgs.pkgs = withSystem hostSettings.system ( + { pkgs, ... }: pkgs # perSystem module arguments + ); + } + + ./_hardware-configuration.nix + nixos.hostBarbaraLaptopSystemConfig + nixos.hostBarbaraLaptopSystemExtra + + # base + nixos.locale + nixos.nh + system.settings + nixos.settings + nixos.users + + # boot + nixos.grub + + # desktop + nixos.fonts + nixos.hyprland + nixos.kde + nixos.sddm + + # hardware + nixos.acceleratedVideoPlayback + nixos.automount + nixos.bluetooth + nixos.intel + nixos.networking + nixos.pipewire + nixos.printing + nixos.remote + + # security + nixos.locationInformation + nixos.runBinaries + + # shell + system.cliApps + nixos.cliApps + + nixos.virtualisation + ] + ); + specialArgs = { + inherit inputs; + }; + }; + + flake.homeConfigurations.${hostSettings.userConfigurationName} = + inputs.home-manager.lib.homeManagerConfiguration + { + pkgs = withSystem hostSettings.system ( + { pkgs, ... }: pkgs # perSystem module arguments + ); + modules = with self.modules.homeManager; [ + self.modules.generic.hostBarbaraLaptopUserConfig + configCurrentUserOptions + hostBarbaraLaptopHmExtra + ./_mamas-packages.nix + + # apps + firefox + thunderbird + office + qtApps + messenger + + # base + base + + # desktop + hyprland + kde + theming + + # devel + alacritty + git + vscode + wezterm + + # shell + shell + ]; + extraSpecialArgs = { + inherit inputs; + }; + }; +} diff --git a/components/hosts/barbara-laptop/extra-config.nix b/components/hosts/barbara-laptop/extra-config.nix new file mode 100644 index 0000000..1cadb91 --- /dev/null +++ b/components/hosts/barbara-laptop/extra-config.nix @@ -0,0 +1,32 @@ +{ ... }: +{ + flake.modules.nixos.hostBarbaraLaptopSystemExtra = + { pkgs, ... }: + { + boot.kernelPackages = pkgs.linuxPackages_latest; + system.stateVersion = "23.11"; # Do not modify + }; + + flake.modules.homeManager.hostBarbaraLaptopHmExtra = + { lib, config, ... }: + { + programs.firefox.profiles.${config.myUserConfig.username} = { + bookmarks = lib.mkForce { }; + }; + + wayland.windowManager.hyprland.settings = { + monitor = lib.mkForce ", preferred, auto, 1.25"; + }; + + services.network-manager-applet.enable = true; + services.blueman-applet.enable = true; + + home.activation = { + myScripts = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + run ln -Tsf ${config.myUserConfig.flakeDirectory}/components/scripts ~/scripts + ''; + }; + + home.stateVersion = "23.11"; # Do not modify + }; +} diff --git a/components/hosts/barbara-laptop/settings.nix b/components/hosts/barbara-laptop/settings.nix new file mode 100644 index 0000000..435328a --- /dev/null +++ b/components/hosts/barbara-laptop/settings.nix @@ -0,0 +1,39 @@ +{ self, ... }: +let + settings = import ./_settings-base.nix; +in +{ + flake.modules.nixos.hostBarbaraLaptopSystemConfig = + { ... }: + { + imports = with self.modules.generic; [ + configSystemOptions + hostBarbaraLaptopUserConfig + ]; + + mySystemConfig = { + hostname = settings.hostname; + defaultLocale = "de_AT.UTF-8"; + }; + }; + + flake.modules.generic.hostBarbaraLaptopUserConfig = + { ... }: + { + imports = with self.modules.generic; [ + configUserOptions + ]; + + myUsers = [ + { + username = settings.username; + name = "Leon"; + email = "leonvincenterd@web.de"; + flakeDirectory = "/home/${settings.username}/dotfiles"; + systemConfigurationName = settings.systemConfigurationName; + userConfigurationName = settings.userConfigurationName; + wallpaperFolder = "/home/${settings.username}/Bilder/Wallpaper"; + } + ]; + }; +} diff --git a/hosts/inspiron-laptop/hardware-configuration.nix b/components/hosts/inspiron-laptop/_hardware-configuration.nix similarity index 92% rename from hosts/inspiron-laptop/hardware-configuration.nix rename to components/hosts/inspiron-laptop/_hardware-configuration.nix index 4361039..07bf36e 100644 --- a/hosts/inspiron-laptop/hardware-configuration.nix +++ b/components/hosts/inspiron-laptop/_hardware-configuration.nix @@ -49,6 +49,6 @@ # networking.interfaces.enp3s0u2u3.useDHCP = lib.mkDefault true; # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + # nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; # nixpkgs.hostPlatform is derived from pkgs by readOnlyPkgs hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/components/hosts/inspiron-laptop/_settings-base.nix b/components/hosts/inspiron-laptop/_settings-base.nix new file mode 100644 index 0000000..2da01e6 --- /dev/null +++ b/components/hosts/inspiron-laptop/_settings-base.nix @@ -0,0 +1,8 @@ +rec { + system = "x86_64-linux"; # system arch (see hardware-configuration.nix -> nixpkgs.hostPlatform); + hostname = "inspiron-laptop"; + systemConfigurationName = hostname; + + username = "leon"; + userConfigurationName = "${username}@${systemConfigurationName}"; +} diff --git a/components/hosts/inspiron-laptop/default.nix b/components/hosts/inspiron-laptop/default.nix new file mode 100644 index 0000000..129eac8 --- /dev/null +++ b/components/hosts/inspiron-laptop/default.nix @@ -0,0 +1,113 @@ +{ + self, + withSystem, + inputs, + ... +}: +let + hostSettings = import ./_settings-base.nix; + inherit (self.lib) resolveSystemModules; +in +{ + flake.nixosConfigurations.${hostSettings.systemConfigurationName} = inputs.nixpkgs.lib.nixosSystem { + modules = resolveSystemModules "nixos" ( + with self.modules; + [ + # setup pkgs: use preconfigured pkgs for the current system + inputs.nixpkgs.nixosModules.readOnlyPkgs + { + nixpkgs.pkgs = withSystem hostSettings.system ( + { pkgs, ... }: pkgs # perSystem module arguments + ); + } + + ./_hardware-configuration.nix + nixos.hostInspironLaptopSystemConfig + nixos.hostInspironLaptopSystemExtra + + # base + nixos.base + + # boot + nixos.grub + + # desktop + nixos.fonts + nixos.hyprland + nixos.kde + nixos.sddm + + # hardware + nixos.acceleratedVideoPlayback + nixos.automount + nixos.bluetooth + nixos.intel + nixos.networking + nixos.pipewire + nixos.printing + nixos.remote + + # security + nixos.locationInformation + nixos.runBinaries + + # shell + system.cliApps + nixos.cliApps + + nixos.virtualisation + ] + ); + specialArgs = { + inherit inputs; + }; + }; + + flake.homeConfigurations.${hostSettings.userConfigurationName} = + inputs.home-manager.lib.homeManagerConfiguration + { + # setup pkgs: use preconfigured pkgs for the current system + pkgs = withSystem hostSettings.system ( + { pkgs, ... }: pkgs # perSystem module arguments + ); + modules = with self.modules.homeManager; [ + self.modules.generic.hostInspironLaptopUserConfig + configCurrentUserOptions + + # apps + media + firefox + thunderbird + office + qtApps + messenger + appsMisc + + # base + base + + # desktop + hyprland + kde + theming + + # devel + alacritty + git + latex + python + vscode + wezterm + + # shell + shell + wireguardClient + + virtualisation + hostInspironLaptopHmExtra + ]; + extraSpecialArgs = { + inherit inputs; + }; + }; +} diff --git a/components/hosts/inspiron-laptop/extra-config.nix b/components/hosts/inspiron-laptop/extra-config.nix new file mode 100644 index 0000000..86f3e3a --- /dev/null +++ b/components/hosts/inspiron-laptop/extra-config.nix @@ -0,0 +1,41 @@ +{ self, ... }: +{ + flake.modules.nixos.hostInspironLaptopSystemExtra = + { ... }: + { + # for compiling through emulated system for raspberrypi + boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; + system.stateVersion = "23.11"; # Do not modify + }; + + flake.modules.homeManager.hostInspironLaptopHmExtra = + { + lib, + pkgs, + config, + ... + }: + { + home.sessionVariables = { + DEPLOY_FLAKE = "${config.myUserConfig.flakeDirectory}/components/hosts/raspberrypi"; + DEPLOY_USER = "leon"; + DEPLOY_HOST = "raspberry.pi"; + DEPLOY_USER_CONFIG_NAME = "leon@raspberrypi"; + DEPLOY_SYSTEM_CONFIG_NAME = "raspberrypi"; + }; + + home.packages = with pkgs; [ + self.packages.${pkgs.stdenv.hostPlatform.system}.remoteDeploymentSystem + self.packages.${pkgs.stdenv.hostPlatform.system}.remoteDeploymentHome + claude-code + ]; + + home.activation = { + myScripts = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + run ln -Tsf ${config.myUserConfig.flakeDirectory}/components/scripts ~/scripts + ''; + }; + + home.stateVersion = "23.11"; + }; +} diff --git a/components/hosts/inspiron-laptop/settings.nix b/components/hosts/inspiron-laptop/settings.nix new file mode 100644 index 0000000..671ea3e --- /dev/null +++ b/components/hosts/inspiron-laptop/settings.nix @@ -0,0 +1,37 @@ +{ self, ... }: +let + settings = import ./_settings-base.nix; +in +{ + flake.modules.nixos.hostInspironLaptopSystemConfig = + { ... }: + { + imports = with self.modules.generic; [ + configSystemOptions + hostInspironLaptopUserConfig + ]; + + mySystemConfig.hostname = settings.hostname; + }; + + flake.modules.generic.hostInspironLaptopUserConfig = + { ... }: + { + imports = with self.modules.generic; [ + configUserOptions + ]; + + myUsers = [ + { + username = settings.username; + name = "Leon"; + email = "leonvincenterd@web.de"; + flakeDirectory = "/home/${settings.username}/dotfiles"; + systemConfigurationName = settings.systemConfigurationName; + userConfigurationName = settings.userConfigurationName; + wallpaperFolder = "/home/${settings.username}/Nextcloud/Pictures/Geordnet"; + wireguardConfig = ../../secrets/files/wireguard_clients/inspiron-laptop.conf; + } + ]; + }; +} diff --git a/hosts/raspberrypi/create_sd_image/flake.nix b/components/hosts/raspberrypi/_create_sd_image/flake.nix similarity index 100% rename from hosts/raspberrypi/create_sd_image/flake.nix rename to components/hosts/raspberrypi/_create_sd_image/flake.nix diff --git a/hosts/raspberrypi/hardware-configuration.nix b/components/hosts/raspberrypi/_hardware-configuration.nix similarity index 90% rename from hosts/raspberrypi/hardware-configuration.nix rename to components/hosts/raspberrypi/_hardware-configuration.nix index 206cdf5..fbf103b 100644 --- a/hosts/raspberrypi/hardware-configuration.nix +++ b/components/hosts/raspberrypi/_hardware-configuration.nix @@ -34,5 +34,5 @@ # networking.interfaces.enu1u1u1.useDHCP = lib.mkDefault true; # networking.interfaces.wlan0.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; + # nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; # nixpkgs.hostPlatform is derived from pkgs by readOnlyPkgs } diff --git a/components/hosts/raspberrypi/_settings-base.nix b/components/hosts/raspberrypi/_settings-base.nix new file mode 100644 index 0000000..f07415c --- /dev/null +++ b/components/hosts/raspberrypi/_settings-base.nix @@ -0,0 +1,8 @@ +rec { + system = "aarch64-linux"; # system arch (see hardware-configuration.nix -> nixpkgs.hostPlatform); + hostname = "raspberrypi"; + systemConfigurationName = hostname; + + username = "leon"; + userConfigurationName = "${username}@${systemConfigurationName}"; +} diff --git a/components/hosts/raspberrypi/default.nix b/components/hosts/raspberrypi/default.nix new file mode 100644 index 0000000..d4fc8cc --- /dev/null +++ b/components/hosts/raspberrypi/default.nix @@ -0,0 +1,71 @@ +{ + self, + withSystem, + inputs, + ... +}: +let + hostSettings = import ./_settings-base.nix; + inherit (self.lib) resolveSystemModules; +in +{ + flake.nixosConfigurations.${hostSettings.systemConfigurationName} = inputs.nixpkgs.lib.nixosSystem { + modules = resolveSystemModules "nixos" ( + with self.modules; + [ + # setup pkgs: use preconfigured pkgs for the current system + inputs.nixpkgs.nixosModules.readOnlyPkgs + { + nixpkgs.pkgs = withSystem hostSettings.system ( + { pkgs, ... }: pkgs # perSystem module arguments + ); + } + + ./_hardware-configuration.nix + nixos.hostRaspberrypiSystemConfig + nixos.hostRaspberrypiSystemExtra + + # base + nixos.base + + # server + nixos.fail2ban + nixos.nextcloud + nixos.pihole + nixos.wireguardServer + + # shell + system.cliApps + nixos.cliApps + ] + ); + specialArgs = { + inherit inputs; + }; + }; + + flake.homeConfigurations.${hostSettings.userConfigurationName} = + inputs.home-manager.lib.homeManagerConfiguration + { + pkgs = withSystem hostSettings.system ( + { pkgs, ... }: pkgs # perSystem module arguments + ); + modules = with self.modules.homeManager; [ + self.modules.generic.hostRaspberrypiUserConfig + configCurrentUserOptions + hostRaspberrypiHmExtra + + # base + base + + # devel + git + + # shell + shell + ]; + extraSpecialArgs = { + inherit inputs; + }; + }; +} diff --git a/components/hosts/raspberrypi/extra-config.nix b/components/hosts/raspberrypi/extra-config.nix new file mode 100644 index 0000000..2fc1945 --- /dev/null +++ b/components/hosts/raspberrypi/extra-config.nix @@ -0,0 +1,69 @@ +{ ... }: +{ + flake.modules.nixos.hostRaspberrypiSystemExtra = + { config, ... }: + let + username = (builtins.head config.myUsers).username; + in + { + # SSH access for remote deployment from leon@inspiron-laptop + users.users.${username} = { + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM22vgwjJ9HTFLvJTyQcyq4sgEFzI6jAS2FX6aB7AXVK leon@inspiron-laptop" + ]; + }; + nix.settings.trusted-users = [ username ]; + + services.openssh = { + enable = true; + settings = { + PermitRootLogin = "no"; + AllowUsers = [ username ]; + PasswordAuthentication = false; + }; + }; + + # Use extlinux bootloader (NixOS wants to enable GRUB by default) + boot.loader.grub.enable = false; + # Enables the generation of /boot/extlinux/extlinux.conf + boot.loader.generic-extlinux-compatible.enable = true; + + # Networking configuration + networking.hostName = config.mySystemConfig.hostname; + networking.wireless.enable = false; + + # Static IP configuration + networking.interfaces.enu1u1u1 = { + useDHCP = false; + ipv4.addresses = [ + { + address = config.mySystemConfig.localIp; + prefixLength = 24; + } + ]; + }; + networking.defaultGateway = { + address = "192.168.179.1"; + interface = "enu1u1u1"; + }; + networking.nameservers = [ + "1.1.1.1" + "8.8.8.8" + ]; + + swapDevices = [ + { + device = "/swapfile"; + size = 4096; # size in MB + } + ]; + + system.stateVersion = "24.11"; # Do not modify + }; + + flake.modules.homeManager.hostRaspberrypiHmExtra = + { ... }: + { + home.stateVersion = "24.11"; # Do not modify + }; +} diff --git a/hosts/raspberrypi/flake.lock b/components/hosts/raspberrypi/flake.lock similarity index 53% rename from hosts/raspberrypi/flake.lock rename to components/hosts/raspberrypi/flake.lock index cab0da3..7e026c0 100644 --- a/hosts/raspberrypi/flake.lock +++ b/components/hosts/raspberrypi/flake.lock @@ -1,5 +1,23 @@ { "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1775087534, + "narHash": "sha256-91qqW8lhL7TLwgQWijoGBbiD4t7/q75KTi8NxjVmSmA=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "3107b77cd68437b9a76194f0f7f9c55f2329ca5b", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -21,6 +39,21 @@ "type": "github" } }, + "import-tree": { + "locked": { + "lastModified": 1773693634, + "narHash": "sha256-BtZ2dtkBdSUnFPPFc+n0kcMbgaTxzFNPv2iaO326Ffg=", + "owner": "vic", + "repo": "import-tree", + "rev": "c41e7d58045f9057880b0d85e1152d6a4430dbf1", + "type": "github" + }, + "original": { + "owner": "vic", + "repo": "import-tree", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1764242076, @@ -36,9 +69,26 @@ "type": "indirect" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1774748309, + "narHash": "sha256-+U7gF3qxzwD5TZuANzZPeJTZRHS29OFQgkQ2kiTJBIQ=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "333c4e0545a6da976206c74db8773a1645b5870a", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "root": { "inputs": { + "flake-parts": "flake-parts", "home-manager": "home-manager", + "import-tree": "import-tree", "nixpkgs": "nixpkgs", "sops-nix": "sops-nix" } diff --git a/components/hosts/raspberrypi/flake.nix b/components/hosts/raspberrypi/flake.nix new file mode 100644 index 0000000..8671669 --- /dev/null +++ b/components/hosts/raspberrypi/flake.nix @@ -0,0 +1,44 @@ +{ + outputs = + { self, ... }@inputs: + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ + "aarch64-linux" + ]; + + imports = [ + inputs.flake-parts.flakeModules.modules + inputs.home-manager.flakeModules.home-manager + (inputs.import-tree.matchNot ".*/flake\\.(nix|lock)" ../../../components) + ]; + + # configure nixpkgs for all systems + perSystem = + { system, ... }: + { + _module.args.pkgs = import inputs.nixpkgs { + inherit system; + config = { + allowUnfree = true; + }; + }; + }; + }; + + inputs = { + nixpkgs.url = "nixpkgs/nixos-unstable"; + + home-manager = { + url = "github:nix-community/home-manager/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + flake-parts.url = "github:hercules-ci/flake-parts"; + import-tree.url = "github:vic/import-tree"; + + sops-nix = { + url = "github:Mic92/sops-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; +} diff --git a/components/hosts/raspberrypi/settings.nix b/components/hosts/raspberrypi/settings.nix new file mode 100644 index 0000000..03f1597 --- /dev/null +++ b/components/hosts/raspberrypi/settings.nix @@ -0,0 +1,66 @@ +{ self, ... }: +let + settings = import ./_settings-base.nix; +in +{ + flake.modules.nixos.hostRaspberrypiSystemConfig = + { ... }: + { + imports = with self.modules.generic; [ + configSystemOptions + hostRaspberrypiUserConfig + ]; + + mySystemConfig = { + hostname = settings.hostname; + localIp = "192.168.179.200"; + acmeEmail = "leonvincenterd@web.de"; + nextcloud = { + drives = { + main = "usb-TOSHIBA_External_USB_3.0_20200714006512F-0:0-part1"; + backup = "usb-Intenso_External_USB_3.0_20161230160B8-0:0-part1"; + }; + hostName = "amysweinhaus.ddnss.de"; + trustedDomains = [ "192.168.179.200" ]; + }; + pihole.hosts = [ + "192.168.179.200 raspberry.pi" + "192.168.179.200 amysweinhaus.ddnss.de" + ]; + wireguard = { + externalInterface = "enu1u1u1"; + clientPeers = [ + { + name = "inspiron-laptop"; + publicKey = "dLHb13EIwUM1HJoEPojOskp18c87Ciu/ZYUZmIkQMBA="; + allowedIPs = [ "10.100.0.2/32" ]; + } + { + name = "leon-handy"; + publicKey = "ahgGz2HSN6L0SaA85tEUccSogdu/6XCOJKsS0XyI238="; + allowedIPs = [ "10.100.0.3/32" ]; + } + ]; + }; + }; + }; + + flake.modules.generic.hostRaspberrypiUserConfig = + { ... }: + { + imports = with self.modules.generic; [ + configUserOptions + ]; + + myUsers = [ + { + username = settings.username; + name = "Leon"; + email = "leonvincenterd@web.de"; + flakeDirectory = "/home/${settings.username}/dotfiles/components/hosts/raspberrypi"; + systemConfigurationName = settings.systemConfigurationName; + userConfigurationName = settings.userConfigurationName; + } + ]; + }; +} diff --git a/hosts/zollsoft-mac/hm-copy-apps.nix b/components/hosts/zollsoft-mac/_hm-copy-apps.nix similarity index 100% rename from hosts/zollsoft-mac/hm-copy-apps.nix rename to components/hosts/zollsoft-mac/_hm-copy-apps.nix diff --git a/components/hosts/zollsoft-mac/_settings-base.nix b/components/hosts/zollsoft-mac/_settings-base.nix new file mode 100644 index 0000000..9b8bcb7 --- /dev/null +++ b/components/hosts/zollsoft-mac/_settings-base.nix @@ -0,0 +1,8 @@ +rec { + system = "aarch64-darwin"; # system arch + hostname = "zollsoft-mac"; + systemConfigurationName = hostname; + + username = "leon.erd"; + userConfigurationName = "${username}@${systemConfigurationName}"; +} diff --git a/components/hosts/zollsoft-mac/default.nix b/components/hosts/zollsoft-mac/default.nix new file mode 100644 index 0000000..fb2ec63 --- /dev/null +++ b/components/hosts/zollsoft-mac/default.nix @@ -0,0 +1,75 @@ +{ + self, + withSystem, + inputs, + ... +}: +let + hostSettings = import ./_settings-base.nix; + inherit (self.lib) resolveSystemModules; +in +{ + flake.darwinConfigurations.${hostSettings.systemConfigurationName} = + inputs.nix-darwin.lib.darwinSystem + { + modules = resolveSystemModules "darwin" ( + with self.modules; + [ + # setup pkgs: use preconfigured pkgs for the current system + { + nixpkgs.pkgs = withSystem hostSettings.system ( + { pkgs, ... }: pkgs # perSystem module arguments + ); + } + + darwin.hostZollsoftMacSystemConfig + darwin.hostZollsoftMacSystemExtra + + # base + darwin.macosSettings + system.settings + + # shell + system.cliApps + ] + ); + specialArgs = { + inherit inputs; + }; + }; + + flake.homeConfigurations.${hostSettings.userConfigurationName} = + inputs.home-manager.lib.homeManagerConfiguration + { + pkgs = withSystem hostSettings.system ( + { pkgs, ... }: pkgs # perSystem module arguments + ); + modules = with self.modules.homeManager; [ + self.modules.generic.hostZollsoftMacUserConfig + configCurrentUserOptions + hostZollsoftMacHmExtra + + # apps + firefox + thunderbird + appsMisc + + # desktop + aerospace + karabiner + autoraise + + # devel + git + python + vscode + wezterm + + # shell + shell + ]; + extraSpecialArgs = { + inherit inputs; + }; + }; +} diff --git a/components/hosts/zollsoft-mac/extra-config.nix b/components/hosts/zollsoft-mac/extra-config.nix new file mode 100644 index 0000000..ea662c1 --- /dev/null +++ b/components/hosts/zollsoft-mac/extra-config.nix @@ -0,0 +1,128 @@ +{ self, ... }: +{ + flake.modules.darwin.hostZollsoftMacSystemExtra = + { + inputs, + pkgs, + config, + ... + }: + let + username = (builtins.head config.myUsers).username; + in + { + imports = [ + inputs.nix-homebrew.darwinModules.nix-homebrew + ]; + + nix-homebrew = { + enable = true; + enableRosetta = true; # for Apple Silicon + user = username; + # declarative tap management + taps = { }; + mutableTaps = true; # with mutableTaps disabled, taps can no longer be added imperatively with `brew tap` + autoMigrate = true; + }; + + homebrew = { + enable = true; + brews = [ + "rbenv" # better as brew than nix package because brew package has all dependencies included that we need for "gem install" + "gettext" + "ktlint" + ]; + casks = [ + "claude-code" + "gather" + "jetbrains-toolbox" + "karabiner-elements" + "keka" + "libreoffice" + "middleclick" + "nextcloud" + "openvpn-connect" + "postman" + "scroll-reverser" + "teamviewer" + "ukelele" + ]; + onActivation = { + cleanup = "zap"; + upgrade = true; + autoUpdate = true; + }; + }; + + # development tools + environment.systemPackages = with pkgs; [ + acli + docker-compose + docker-credential-helpers + fvm + glab + pgcli + podman + ]; + + fonts.packages = with pkgs.nerd-fonts; [ + hack + jetbrains-mono + ]; + + system.primaryUser = username; + + # Set Git commit hash for darwin-version. + system.configurationRevision = self.rev or self.dirtyRev or null; + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 6; + }; + + flake.modules.homeManager.hostZollsoftMacHmExtra = + { + lib, + pkgs, + config, + ... + }: + { + imports = [ ./_hm-copy-apps.nix ]; + + home.username = config.myUserConfig.username; + home.homeDirectory = "/Users/${config.myUserConfig.username}"; + xdg.enable = true; + programs.home-manager.enable = true; + + programs.firefox.profiles.${config.myUserConfig.username} = { + settings = lib.mkForce { + "browser.toolbars.bookmarks.visibility" = "never"; + }; + bookmarks = lib.mkForce { }; + }; + + programs.zsh.initContent = '' + export PATH="/opt/homebrew/bin:$PATH" + export PATH="$PATH:/usr/local/bin" + export PATH="$PATH:$HOME/.pub-cache/bin" + ## [Completion] + ## Completion scripts setup. Remove the following line to uninstall + [[ -f /Users/${config.myUserConfig.username}/.dart-cli-completion/zsh-config.zsh ]] && . /Users/${config.myUserConfig.username}/.dart-cli-completion/zsh-config.zsh || true + ## [/Completion] + eval "$(rbenv init - zsh)" + export LANG=en_US.UTF-8 + ''; + + home.packages = with pkgs; [ + appcleaner + autoraise + betterdisplay + slack + spotify + telegram-desktop + ]; + + home.stateVersion = "25.05"; # Do not modify + }; +} diff --git a/components/hosts/zollsoft-mac/settings.nix b/components/hosts/zollsoft-mac/settings.nix new file mode 100644 index 0000000..4113589 --- /dev/null +++ b/components/hosts/zollsoft-mac/settings.nix @@ -0,0 +1,35 @@ +{ self, ... }: +let + settings = import ./_settings-base.nix; +in +{ + flake.modules.darwin.hostZollsoftMacSystemConfig = + { ... }: + { + imports = with self.modules.generic; [ + configSystemOptions + hostZollsoftMacUserConfig + ]; + + mySystemConfig.hostname = settings.hostname; + }; + + flake.modules.generic.hostZollsoftMacUserConfig = + { ... }: + { + imports = with self.modules.generic; [ + configUserOptions + ]; + + myUsers = [ + { + username = settings.username; + name = "Leon Erd"; + email = "leon.erd@zollsoft.de"; + flakeDirectory = "/Users/${settings.username}/dotfiles"; + systemConfigurationName = settings.systemConfigurationName; + userConfigurationName = settings.userConfigurationName; + } + ]; + }; +} diff --git a/components/lib.nix b/components/lib.nix new file mode 100644 index 0000000..a3ba7a5 --- /dev/null +++ b/components/lib.nix @@ -0,0 +1,30 @@ +{ ... }: + +let + validSystemClasses = [ + "nixos" + "darwin" + ]; + + asClass = + targetClass: module: args: + (module args) // { _class = targetClass; }; + + resolveSystemModules = + targetClass: modules: + if !(builtins.elem targetClass validSystemClasses) then + throw "resolveSystemModules: targetClass must be one of ${builtins.toJSON validSystemClasses}, got '${targetClass}'" + else + map ( + m: + let + class = if builtins.isFunction m then ((m { })._class or null) else (m._class or null); + in + if class == "system" then asClass targetClass m else m + ) modules; +in +{ + flake.lib = { + inherit asClass resolveSystemModules; + }; +} diff --git a/modules/home-manager/apps/config_files/dolphinrc b/components/modules/apps/config_files/dolphinrc similarity index 100% rename from modules/home-manager/apps/config_files/dolphinrc rename to components/modules/apps/config_files/dolphinrc diff --git a/modules/home-manager/apps/config_files/katerc b/components/modules/apps/config_files/katerc similarity index 100% rename from modules/home-manager/apps/config_files/katerc rename to components/modules/apps/config_files/katerc diff --git a/modules/home-manager/apps/config_files/kwriterc b/components/modules/apps/config_files/kwriterc similarity index 100% rename from modules/home-manager/apps/config_files/kwriterc rename to components/modules/apps/config_files/kwriterc diff --git a/modules/home-manager/apps/config_files/okularrc b/components/modules/apps/config_files/okularrc similarity index 100% rename from modules/home-manager/apps/config_files/okularrc rename to components/modules/apps/config_files/okularrc diff --git a/modules/home-manager/apps/config_files/xournalpp_settings.xml b/components/modules/apps/config_files/xournalpp_settings.xml similarity index 100% rename from modules/home-manager/apps/config_files/xournalpp_settings.xml rename to components/modules/apps/config_files/xournalpp_settings.xml diff --git a/components/modules/apps/firefox.nix b/components/modules/apps/firefox.nix new file mode 100644 index 0000000..19e11a5 --- /dev/null +++ b/components/modules/apps/firefox.nix @@ -0,0 +1,137 @@ +{ ... }: + +{ + flake.modules.homeManager.firefox = + { pkgs, config, ... }: + + { + programs.firefox = { + enable = true; + profiles.${config.myUserConfig.username} = { + search = { + default = "ddg"; # DuckDuckGo + force = true; + }; + settings = { + "browser.startup.page" = 3; # resume previous session + "signon.rememberSignons" = false; # don't ask to save passwords + "extensions.activeThemeID" = "firefox-compact-light@mozilla.org"; # light theme + "extensions.autoDisableScopes" = 0; # automatically enable extensions installed with home-manager + "browser.toolbars.bookmarks.visibility" = "always"; # toolbar always visible + "browser.download.always_ask_before_handling_new_types" = true; # ask whether to "open" or to "save" + "browser.download.start_downloads_in_tmp_dir" = true; # if "open" selected: save in tmp dir + "browser.download.useDownloadDir" = false; # if "save" selected: ask where to save + # Privacy + "app.shield.optoutstudies.enabled" = false; + "privacy.donottrackheader.enabled" = true; + "privacy.globalprivacycontrol.enabled" = true; + "privacy.trackingprotection.enabled" = true; + "dom.private-attribution.submission.enabled" = false; + "datareporting.healthreport.uploadEnabled" = false; + }; + extensions = { + force = true; + packages = with pkgs.nur.repos.rycee.firefox-addons; [ + betterttv + bitwarden + duckduckgo-privacy-essentials + grammarly + ublock-origin + videospeed + vimium-c + ]; + # to find the settings in firefox: + # 1. make desired changes to the extension + # 2. go to + # about:debugging#/runtime/this-firefox + # 3. find the Extension ID and inspect the extension + # 4. try the following commands in the console: + # await browser.storage.sync.get(null); + # await browser.storage.local.get(null); + settings = { + "vimium-c@gdh1995.cn" = { + settings = { + exclusionRules = [ + { + passKeys = ""; + pattern = "^https?://[^/]*twitch.tv/"; + } + { + passKeys = ""; + pattern = "^https?://[^/]*kick.com/"; + } + { + passKeys = ""; + pattern = "^https?://[^/]*youtube.com/watch"; + } + ]; + }; + }; + "uBlock0@raymondhill.net" = { + settings = { + # https://github.com/pixeltris/TwitchAdSolutions?tab=readme-ov-file#applying-a-script-ublock-origin + # https://raw.githubusercontent.com/pixeltris/TwitchAdSolutions/master/video-swap-new/video-swap-new-ublock-origin.js + # + # If block doesn't work, try manually unsetting userResourcesLocation and setting it back to the URL + "user-filters" = "twitch.tv##+js(twitch-videoad)"; + hiddenSettings = { + userResourcesLocation = "https://raw.githubusercontent.com/pixeltris/TwitchAdSolutions/master/video-swap-new/video-swap-new-ublock-origin.js"; + }; + }; + }; + }; + }; + bookmarks = { + force = true; + settings = [ + { + toolbar = true; + bookmarks = [ + { + name = "Fast.com"; + url = "https://fast.com"; + } + { + name = "Amy's Weinhaus"; + url = "https://amysweinhaus.ddnss.de"; + } + { + name = "Pihole"; + url = "https://pi.hole:8443"; + } + { + name = "Github"; + url = "https://github.com/"; + } + { + name = "Twitch"; + url = "https://twitch.tv/directory/following"; + } + { + name = "Youtube"; + url = "https://youtube.com"; + } + { + name = "ChatGPT"; + url = "https://chat.openai.com"; + } + { + name = "T3 Chat"; + url = "https://t3.chat/"; + } + { + name = "Noogle"; + url = "https://noogle.dev/"; + } + ]; + } + ]; + }; + }; + }; + + home.sessionVariables = { + MOZ_USE_XINPUT2 = 1; # better touch support + }; + }; +} diff --git a/components/modules/apps/media.nix b/components/modules/apps/media.nix new file mode 100644 index 0000000..0b785f9 --- /dev/null +++ b/components/modules/apps/media.nix @@ -0,0 +1,16 @@ +{ ... }: + +{ + flake.modules.homeManager.media = + { pkgs, ... }: + + { + home.packages = with pkgs; [ + gthumb + mpv + qpwgraph + spotify + vlc + ]; + }; +} diff --git a/components/modules/apps/messenger.nix b/components/modules/apps/messenger.nix new file mode 100644 index 0000000..54cf7ea --- /dev/null +++ b/components/modules/apps/messenger.nix @@ -0,0 +1,16 @@ +{ ... }: + +{ + flake.modules.homeManager.messenger = + { pkgs, ... }: + + { + home.packages = with pkgs; [ + signal-desktop + slack + telegram-desktop + discord + wasistlos # whatsapp-for-linux + ]; + }; +} diff --git a/components/modules/apps/misc.nix b/components/modules/apps/misc.nix new file mode 100644 index 0000000..5ce1b06 --- /dev/null +++ b/components/modules/apps/misc.nix @@ -0,0 +1,28 @@ +{ ... }: + +{ + flake.modules.homeManager.appsMisc = + { pkgs, lib, ... }: + + let + config = { + home.packages = with pkgs; [ + bitwarden-desktop + meld + ]; + }; + + linuxConfig = { + services.nextcloud-client = { + enable = true; + startInBackground = true; + }; + }; + + in + + lib.mkMerge [ + config + (lib.mkIf pkgs.stdenv.isLinux linuxConfig) + ]; +} diff --git a/components/modules/apps/office.nix b/components/modules/apps/office.nix new file mode 100644 index 0000000..d56ee68 --- /dev/null +++ b/components/modules/apps/office.nix @@ -0,0 +1,31 @@ +{ ... }: + +{ + flake.modules.homeManager.office = + { + pkgs, + lib, + config, + ... + }: + + { + home.packages = with pkgs; [ + qalculate-gtk + xournalpp + ]; + + programs.onlyoffice.enable = true; + + home.activation = { + myXorunalppSettings = + let + symlinkDir = "${config.xdg.configHome}/xournalpp"; + targetDirectory = "${config.myUserConfig.flakeDirectory}/components/modules/apps/config_files"; + in + lib.hm.dag.entryAfter [ "writeBoundary" ] '' + run ln -sf ${targetDirectory}/xournalpp_settings.xml ${symlinkDir}/settings.xml + ''; + }; + }; +} diff --git a/components/modules/apps/qt-apps.nix b/components/modules/apps/qt-apps.nix new file mode 100644 index 0000000..f1b8800 --- /dev/null +++ b/components/modules/apps/qt-apps.nix @@ -0,0 +1,51 @@ +{ ... }: + +{ + flake.modules.homeManager.qtApps = + { + config, + lib, + pkgs, + ... + }: + + # you can also set the following in ~/.config/kdeglobals instead of the individual rc files: + # [UiSettings] + # ColorScheme=LayanDark + + # [Icons] + # Theme=Tela + + { + home.packages = with pkgs; [ + kdePackages.ark + kdePackages.dolphin + kdePackages.dolphin-plugins + kdePackages.kio-extras # mtp support for dolphin + kdePackages.filelight + kdePackages.kate + kdePackages.okular + qalculate-qt + ]; + + # https://github.com/NixOS/nixpkgs/issues/409986 + # https://discourse.nixos.org/t/dolphin-does-not-have-mime-associations/48985/7 + # if not working, try clearing cache + xdg.configFile."menus/applications.menu".source = + "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu"; + + home.activation = { + myQtRcFiles = + let + symlinkDir = config.xdg.configHome; + targetDirectory = "${config.myUserConfig.flakeDirectory}/components/modules/apps/config_files"; + in + lib.hm.dag.entryAfter [ "writeBoundary" ] '' + run ln -sf ${targetDirectory}/dolphinrc ${symlinkDir}/dolphinrc + run ln -sf ${targetDirectory}/katerc ${symlinkDir}/katerc + run ln -sf ${targetDirectory}/kwriterc ${symlinkDir}/kwriterc + run ln -sf ${targetDirectory}/okularrc ${symlinkDir}/okularrc + ''; + }; + }; +} diff --git a/components/modules/apps/steam.nix b/components/modules/apps/steam.nix new file mode 100644 index 0000000..d64d396 --- /dev/null +++ b/components/modules/apps/steam.nix @@ -0,0 +1,20 @@ +{ ... }: + +{ + flake.modules.nixos.steam = + { pkgs, ... }: + + { + programs.steam = { + enable = true; + gamescopeSession.enable = true; # with `gamescope %command%` in games launch options: start game in optimised microcompositor (may help if game has problems with resolutions) + }; + + environment.systemPackages = with pkgs; [ + mangohud # with `mangohud %command%` in games launch options: show performance overlay + protonplus + ]; + + programs.gamemode.enable = true; # with `gamemoderun %command%` in games launch options: improve game performance with a set of optimizations + }; +} diff --git a/components/modules/apps/thunderbird.nix b/components/modules/apps/thunderbird.nix new file mode 100644 index 0000000..d892fb9 --- /dev/null +++ b/components/modules/apps/thunderbird.nix @@ -0,0 +1,18 @@ +{ ... }: + +{ + flake.modules.homeManager.thunderbird = + { config, ... }: + + { + programs.thunderbird = { + enable = true; + profiles.${config.myUserConfig.username} = { + isDefault = true; + settings = { + "extensions.activeThemeID" = "thunderbird-compact-light@mozilla.org"; + }; + }; + }; + }; +} diff --git a/components/modules/base/default.nix b/components/modules/base/default.nix new file mode 100644 index 0000000..890bda4 --- /dev/null +++ b/components/modules/base/default.nix @@ -0,0 +1,41 @@ +{ self, ... }: + +{ + flake.modules.nixos.base = + { ... }: + let + inherit (self.lib) resolveSystemModules; + in + { + imports = resolveSystemModules "nixos" ( + with self.modules; + [ + nixos.kernel + nixos.locale + nixos.nh + system.settings + nixos.settings + nixos.sops + nixos.users + ] + ); + }; + + flake.modules.homeManager.base = + { config, ... }: + + { + imports = with self.modules.homeManager; [ + sops + ]; + + # Home Manager needs a bit of information about you and the paths it should + # manage. + home.username = config.myUserConfig.username; + home.homeDirectory = "/home/${config.myUserConfig.username}"; + xdg.enable = true; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + }; +} diff --git a/components/modules/base/kernel.nix b/components/modules/base/kernel.nix new file mode 100644 index 0000000..cedf563 --- /dev/null +++ b/components/modules/base/kernel.nix @@ -0,0 +1,10 @@ +{ ... }: + +{ + flake.modules.nixos.kernel = + { pkgs, ... }: + + { + boot.kernelPackages = pkgs.linuxPackages; + }; +} diff --git a/components/modules/base/locale.nix b/components/modules/base/locale.nix new file mode 100644 index 0000000..ac04e84 --- /dev/null +++ b/components/modules/base/locale.nix @@ -0,0 +1,25 @@ +{ ... }: + +{ + flake.modules.nixos.locale = + { config, ... }: + + { + console.keyMap = config.mySystemConfig.kblayout; # tty keyboard layout + + # set locales + time.timeZone = config.mySystemConfig.timezone; + i18n.defaultLocale = config.mySystemConfig.defaultLocale; + i18n.extraLocaleSettings = { + LC_ADDRESS = config.mySystemConfig.extraLocale; + LC_IDENTIFICATION = config.mySystemConfig.extraLocale; + LC_MEASUREMENT = config.mySystemConfig.extraLocale; + LC_MONETARY = config.mySystemConfig.extraLocale; + LC_NAME = config.mySystemConfig.extraLocale; + LC_NUMERIC = config.mySystemConfig.extraLocale; + LC_PAPER = config.mySystemConfig.extraLocale; + LC_TELEPHONE = config.mySystemConfig.extraLocale; + LC_TIME = config.mySystemConfig.extraLocale; + }; + }; +} diff --git a/components/modules/base/macos-settings.nix b/components/modules/base/macos-settings.nix new file mode 100644 index 0000000..cd7e427 --- /dev/null +++ b/components/modules/base/macos-settings.nix @@ -0,0 +1,40 @@ +{ ... }: + +{ + flake.modules.darwin.macosSettings = + { ... }: + + { + nix.gc = { + automatic = true; + options = "--delete-older-than 7d"; + }; + + security.pam.services.sudo_local.touchIdAuth = true; + + system.defaults = { + dock = { + tilesize = 30; + static-only = true; + orientation = "left"; + }; + finder = { + ShowPathbar = true; + ShowStatusBar = true; + NewWindowTarget = "Home"; + FXPreferredViewStyle = "clmv"; + AppleShowAllExtensions = true; + }; + trackpad = { + Dragging = true; + Clicking = true; + TrackpadRightClick = true; + }; + }; + + # Manual configurations + # setup Scroll Reverser and MiddleClick + # Desktop & Dock -> Desktop & Stage Manager -> Click wallpaper to reveal desktop - Only in Stage Manager + # defaults write -g NSWindowShouldDragOnGesture -bool true # Now, you can move windows by holding ctrl + cmd and dragging any part of the window (not necessarily the window title) + }; +} diff --git a/components/modules/base/nh.nix b/components/modules/base/nh.nix new file mode 100644 index 0000000..2f2c4a3 --- /dev/null +++ b/components/modules/base/nh.nix @@ -0,0 +1,18 @@ +{ ... }: + +{ + flake.modules.nixos.nh = + { ... }: + + { + programs.nh = { + # nix helper for basic nix commands with added functionality + enable = true; + clean = { + enable = true; + dates = "weekly"; + extraArgs = "--keep-since=7d --keep=5"; + }; + }; + }; +} diff --git a/components/modules/base/settings.nix b/components/modules/base/settings.nix new file mode 100644 index 0000000..d9eaf1a --- /dev/null +++ b/components/modules/base/settings.nix @@ -0,0 +1,32 @@ +{ ... }: + +{ + flake.modules.system.settings = + { pkgs, ... }: + + { + # set some important things + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; + nix.channel.enable = false; + nix.optimise.automatic = true; # optimise nix store disk space by hard linking identical files + + # set zsh as default shell + programs.zsh.enable = true; + environment.pathsToLink = [ "/share/zsh" ]; # needed for completion for system packages + + # install home-manager + environment.systemPackages = with pkgs; [ + home-manager + ]; + }; + + flake.modules.nixos.settings = + { pkgs, ... }: + { + hardware.enableAllFirmware = true; + users.defaultUserShell = pkgs.zsh; + }; +} diff --git a/components/modules/base/sops.nix b/components/modules/base/sops.nix new file mode 100644 index 0000000..5f6a28b --- /dev/null +++ b/components/modules/base/sops.nix @@ -0,0 +1,46 @@ +{ ... }: + +{ + flake.modules.nixos.sops = + { + config, + lib, + inputs, + ... + }: + + { + imports = [ inputs.sops-nix.nixosModules.sops ]; + + sops = { + age.keyFile = "/home/${(lib.head config.myUsers).username}/.config/sops/age/keys.txt"; + defaultSopsFile = ../../secrets/secrets.yaml; + defaultSopsFormat = "yaml"; + }; + + # set up ssh keys for users + sops.secrets = builtins.listToAttrs ( + map (user: { + name = "ssh/private_keys/${user.username}@${config.mySystemConfig.hostname}"; + value = { + owner = user.username; + mode = "600"; + path = "/home/${user.username}/.ssh/id_ed25519"; + }; + }) config.myUsers + ); + }; + + flake.modules.homeManager.sops = + { config, inputs, ... }: + + { + imports = [ inputs.sops-nix.homeManagerModules.sops ]; + + sops = { + age.keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt"; + defaultSopsFile = ../../secrets/secrets.yaml; + defaultSopsFormat = "yaml"; + }; + }; +} diff --git a/components/modules/base/users.nix b/components/modules/base/users.nix new file mode 100644 index 0000000..158c40c --- /dev/null +++ b/components/modules/base/users.nix @@ -0,0 +1,20 @@ +{ ... }: + +{ + flake.modules.nixos.users = + { config, ... }: + + { + # create users + users.users = builtins.listToAttrs ( + map (user: { + name = user.username; + value = { + isNormalUser = true; + description = user.name; + extraGroups = user.extraGroups; + }; + }) config.myUsers + ); + }; +} diff --git a/components/modules/boot/grub.nix b/components/modules/boot/grub.nix new file mode 100644 index 0000000..f735d7e --- /dev/null +++ b/components/modules/boot/grub.nix @@ -0,0 +1,30 @@ +{ ... }: + +{ + flake.modules.nixos.grub = + { inputs, ... }: + + { + imports = [ + inputs.grub2-themes.nixosModules.default + ]; + + # Bootloader + boot.loader = { + efi.canTouchEfiVariables = true; + grub = { + enable = true; + efiSupport = true; + device = "nodev"; + useOSProber = true; + }; + grub2-theme = { + # checkout https://github.com/vinceliuice/grub2-themes/blob/master/flake.nix for more options + enable = true; + theme = "tela"; + icon = "color"; + splashImage = ../../wallpaper/animated/mountains-in-clouds.jpg; + }; + }; + }; +} diff --git a/components/modules/boot/plymouth.nix b/components/modules/boot/plymouth.nix new file mode 100644 index 0000000..993ff67 --- /dev/null +++ b/components/modules/boot/plymouth.nix @@ -0,0 +1,13 @@ +{ ... }: + +{ + flake.modules.nixos.plymouth = + { ... }: + + { + boot.plymouth = { + enable = true; + theme = "solar"; + }; + }; +} diff --git a/components/modules/desktop/aerospace/default.nix b/components/modules/desktop/aerospace/default.nix new file mode 100644 index 0000000..531e003 --- /dev/null +++ b/components/modules/desktop/aerospace/default.nix @@ -0,0 +1,134 @@ +{ ... }: + +{ + flake.modules.homeManager.aerospace = + { lib, pkgs, ... }: + + let + mainMod = "ctrl-alt"; + in + { + programs.aerospace = { + enable = true; + launchd.enable = true; + settings = { + after-startup-command = [ + "exec-and-forget ${lib.getExe pkgs.jankyborders} active_color=0xff00ff99 inactive_color=0xaa444444 width=5.0" + "exec-and-forget ${lib.getExe pkgs.autoraise} -delay 0" + ]; + automatically-unhide-macos-hidden-apps = true; + default-root-container-layout = "tiles"; + default-root-container-orientation = "auto"; + enable-normalization-flatten-containers = true; + enable-normalization-opposite-orientation-for-nested-containers = true; + exec-on-workspace-change = [ ]; # sketchybar + gaps = { + inner = { + horizontal = 3; + vertical = 3; + }; + outer = { + left = 5; + bottom = 5; + top = 5; + right = 5; + }; + }; + on-focus-changed = [ "move-mouse monitor-lazy-center" ]; + on-focused-monitor-changed = [ "move-mouse monitor-lazy-center" ]; + exec.env-vars.PATH = "\${PATH}:\${HOME}/.nix-profile/bin:/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin"; + key-mapping = { + preset = "qwerty"; + key-notation-to-key-code = { + y = "z"; + z = "y"; + minus = "slash"; + plus = "rightSquareBracket"; + backtick = "equal"; + }; + }; + mode.main.binding = { + "cmd-alt-t" = "exec-and-forget \${HOME}/Applications/Home\\ Manager\\ Apps/WezTerm.app/wezterm-gui"; + "cmd-alt-s" = "exec-and-forget ${lib.getExe pkgs.flameshot} gui"; + "${mainMod}-b" = "exec-and-forget ${./scratchpad.sh} --command btop"; + "${mainMod}-a" = "exec-and-forget ${./scratchpad.sh} --app-name \"Activity Monitor\""; + "${mainMod}-e" = "exec-and-forget ${./scratchpad.sh} --app-name Finder"; + "${mainMod}-s" = "exec-and-forget ${./scratchpad.sh} --app-name Spotify"; + "alt-f4" = "close --quit-if-last-window"; + "alt-tab" = "focus dfs-next --boundaries-action wrap-around-the-workspace"; + "${mainMod}-f" = "layout floating tiling"; + "${mainMod}-m" = "fullscreen --no-outer-gaps"; + "${mainMod}-t" = "layout tiles horizontal vertical"; + "${mainMod}-plus" = "resize smart +50"; + "${mainMod}-minus" = "resize smart -50"; + "${mainMod}-left" = "move left"; + "${mainMod}-down" = "move down"; + "${mainMod}-up" = "move up"; + "${mainMod}-right" = "move right"; + "${mainMod}-shift-left" = "join-with left"; + "${mainMod}-shift-down" = "join-with down"; + "${mainMod}-shift-up" = "join-with up"; + "${mainMod}-shift-right" = "join-with right"; + "${mainMod}-cmd-left" = "move-workspace-to-monitor left"; + "${mainMod}-cmd-down" = "move-workspace-to-monitor up"; + "${mainMod}-cmd-up" = "move-workspace-to-monitor down"; + "${mainMod}-cmd-right" = "move-workspace-to-monitor right"; + "${mainMod}-1" = "workspace 1"; + "${mainMod}-2" = "workspace 2"; + "${mainMod}-3" = "workspace 3"; + "${mainMod}-4" = "workspace 4"; + "${mainMod}-5" = "workspace 5"; + "${mainMod}-6" = "workspace 6"; + "${mainMod}-7" = "workspace 7"; + "${mainMod}-8" = "workspace 8"; + "${mainMod}-9" = "workspace 9"; + "${mainMod}-0" = "workspace 10"; + "${mainMod}-tab" = "workspace-back-and-forth"; + "${mainMod}-shift-1" = "move-node-to-workspace 1"; + "${mainMod}-shift-2" = "move-node-to-workspace 2"; + "${mainMod}-shift-3" = "move-node-to-workspace 3"; + "${mainMod}-shift-4" = "move-node-to-workspace 4"; + "${mainMod}-shift-5" = "move-node-to-workspace 5"; + "${mainMod}-shift-6" = "move-node-to-workspace 6"; + "${mainMod}-shift-7" = "move-node-to-workspace 7"; + "${mainMod}-shift-8" = "move-node-to-workspace 8"; + "${mainMod}-shift-9" = "move-node-to-workspace 9"; + "${mainMod}-shift-0" = "move-node-to-workspace 10"; + # alt-e = '' + # exec-and-forget osascript -e ' + # tell application "Finder" + # make new Finder window to home + # activate + # end tell' + # ''; + }; + on-window-detected = [ + { + "if".app-id = "com.google.android.studio"; + run = "move-node-to-workspace 3"; + } + { + "if".app-id = "com.zollsoft.air"; + run = "move-node-to-workspace 4"; + } + { + "if".app-id = "org.nixos.firefox"; + run = "move-node-to-workspace 5"; + } + { + "if".app-id = "com.tinyspeck.slackmacgap"; + run = "move-node-to-workspace 9"; + } + { + "if".app-id = "com.gather.Gather"; + run = "move-node-to-workspace 9"; + } + { + "if".app-id = "com.zollsoft.arzeko"; + run = "move-node-to-workspace 10"; + } + ]; + }; + }; + }; +} diff --git a/modules/home-manager/wm/aerospace/scratchpad.sh b/components/modules/desktop/aerospace/scratchpad.sh similarity index 100% rename from modules/home-manager/wm/aerospace/scratchpad.sh rename to components/modules/desktop/aerospace/scratchpad.sh diff --git a/components/modules/desktop/fonts/fonts.nix b/components/modules/desktop/fonts/fonts.nix new file mode 100644 index 0000000..d8731c7 --- /dev/null +++ b/components/modules/desktop/fonts/fonts.nix @@ -0,0 +1,32 @@ +{ ... }: + +{ + flake.modules.nixos.fonts = + { pkgs, lib, ... }: + + # install all nerd fonts except Iosevka and its variants because they are huge and not needed + let + allNerdFontsNames = builtins.attrNames pkgs.nerd-fonts; + dropIosevka = builtins.filter (name: lib.hasPrefix "iosevka" name) allNerdFontsNames; + customNerdFonts = builtins.removeAttrs pkgs.nerd-fonts dropIosevka; + customNerdFontsDerivations = builtins.filter lib.attrsets.isDerivation ( + builtins.attrValues customNerdFonts + ); + in + + { + fonts.packages = [ + + ] + ++ customNerdFontsDerivations; + + fonts.fontDir.enable = true; + + fonts.fontconfig.defaultFonts = { + monospace = [ + "Hack Nerd Font Mono" + "JetBrainsMono Nerd Font" + ]; + }; + }; +} diff --git a/components/modules/desktop/gnome-keyring.nix b/components/modules/desktop/gnome-keyring.nix new file mode 100644 index 0000000..de49dd4 --- /dev/null +++ b/components/modules/desktop/gnome-keyring.nix @@ -0,0 +1,12 @@ +{ ... }: + +{ + flake.modules.nixos.gnomeKeyring = + { pkgs, ... }: + + { + services.gnome.gnome-keyring.enable = true; + programs.seahorse.enable = true; + programs.ssh.askPassword = pkgs.lib.mkForce "${pkgs.seahorse.out}/libexec/seahorse/ssh-askpass"; + }; +} diff --git a/components/modules/desktop/hyprland/caelestia-shell/default.nix b/components/modules/desktop/hyprland/caelestia-shell/default.nix new file mode 100644 index 0000000..85cdd15 --- /dev/null +++ b/components/modules/desktop/hyprland/caelestia-shell/default.nix @@ -0,0 +1,237 @@ +{ self, ... }: + +{ + flake.modules.homeManager.caelestiaShell = + { + inputs, + lib, + pkgs, + config, + ... + }: + + let + system = pkgs.stdenv.hostPlatform.system; + + # Fix for makeBinaryWrapper set_env_prefix reading past null terminator when + # the prefix sits at the end of the existing value (no trailing separator). + # This corrupts NIXPKGS_QT6_QML_IMPORT_PATH, causing Firefox to crash when + # launched from caelestia (Rust's std::env::vars() panics on non-UTF-8 env vars). + # + # makeBinaryWrapper uses makeSetupHook -> runCommand, which has no patchPhase. + # The fix must be applied via buildCommand post-processing using sed. + fixedMakeBinaryWrapper = pkgs.makeBinaryWrapper.overrideAttrs (old: { + buildCommand = old.buildCommand + '' + # Fix: when prefix is at end of existing value (no trailing sep), + # n_before must not include the leading sep, and the tail pointer + # must point to the null terminator rather than past it. + sed -i \ + 's@int n_before = existing_prefix - existing_env;@int n_before = existing_prefix - existing_env - (*(existing_prefix + prefix_len) ? 0 : (int)sep_len);@' \ + $out/nix-support/setup-hook + sed -i \ + 's@existing_prefix + prefix_len + sep_len));@*(existing_prefix + prefix_len) ? existing_prefix + prefix_len + sep_len : existing_prefix + prefix_len));@' \ + $out/nix-support/setup-hook + ''; + }); + + fixedWrapQt6AppsHook = pkgs.qt6Packages.wrapQtAppsHook.override { + makeBinaryWrapper = fixedMakeBinaryWrapper; + }; + + # Rebuild quickshell from caelestia-shell's pinned flake input with the fixed hook. + # caelestia-shell uses inputs.quickshell.packages directly (not pkgs.quickshell), + # so user overlays do not affect it — we must patch it explicitly here. + caelestia-quickshell = + (inputs.caelestia-shell.inputs.quickshell.packages.${system}.default.override { + withX11 = false; + withI3 = false; + }).overrideAttrs + (old: { + nativeBuildInputs = map ( + x: if builtins.isAttrs x && x.name == "wrap-qt6-apps-hook" then fixedWrapQt6AppsHook else x + ) (old.nativeBuildInputs or [ ]); + }); + + caelestia-patched = inputs.caelestia-shell.packages.${system}.with-cli.override { + quickshell = caelestia-quickshell; + }; + in + + { + imports = [ inputs.caelestia-shell.homeManagerModules.default ]; + + programs.caelestia = { + enable = true; + package = caelestia-patched; + # https://github.com/caelestia-dots/shell/issues/390 + systemd.environment = [ "QT_QPA_PLATFORMTHEME=gtk3" ]; + cli = { + enable = true; + settings = { + theme = { + enableTerm = false; + enableHypr = false; + enableDiscord = false; + enableSpicetify = false; + enableFuzzel = false; + enableBtop = false; + enableGtk = false; + enableQt = false; + }; + }; + }; + settings = { + appearance = { + font.family = { + mono = "NotoMonoNerdFont"; + sans = "NotoSansNerdFont"; + }; + transparency = { + enabled = true; + base = 0.75; + layers = 0.5; + }; + }; + general = { + apps.terminal = [ "${lib.getExe pkgs.alacritty}" ]; + idle.timeouts = [ + # { + # timeout = 180; + # idleAction = "lock"; + # } + ]; + }; + background = { + desktopClock.enabled = false; + visualiser.enabled = true; + }; + paths = { + mediaGif = ./gifs/moose.gif; + sessionGif = ./gifs/lightning.gif; + wallpaperDir = config.myUserConfig.wallpaperFolder; + }; + bar = { + clock.showIcon = false; + entries = [ + { + id = "logo"; + enabled = false; + } + { + id = "clock"; + enabled = true; + } + { + id = "activeWindow"; + enabled = true; + } + { + id = "spacer"; + enabled = true; + } + { + id = "workspaces"; + enabled = true; + } + { + id = "spacer"; + enabled = true; + } + { + id = "tray"; + enabled = true; + } + { + id = "statusIcons"; + enabled = true; + } + { + id = "power"; + enabled = true; + } + ]; + status = { + showAudio = true; + showMicrophone = true; + }; + tray = { + background = true; + }; + workspaces = { + showWindows = false; + label = ""; + activeLabel = ""; + occupiedLabel = ""; + shown = 10; + activeTrail = true; + }; + }; + border = { + thickness = 1; + rounding = 20; + }; + launcher = { + showOnHover = false; + actionPrefix = "/"; + }; + osd.enableMicrophone = true; + }; + }; + + wayland.windowManager.hyprland.settings = { + bindr = [ + "$mainMod, $mainMod_L, exec, caelestia shell drawers toggle launcher" + "$mainMod, L, exec, caelestia shell lock lock" + ]; + + bind = [ + "$mainMod, N, exec, caelestia shell drawers toggle sidebar" + "$mainMod, D, exec, caelestia shell drawers toggle dashboard" + ", Print, exec, caelestia screenshot --region --freeze" + "CTRL + ALT, S, exec, ${pkgs.wl-clipboard}/bin/wl-paste | ${lib.getExe pkgs.swappy} -f -" + # https://github.com/caelestia-dots/shell/issues/390 + "CTRL + ALT, B, exec, caelestia shell -k; QT_QPA_PLATFORMTHEME=gtk3 caelestia shell -d" + "CTRL + ALT, W, exec, ${ + self.packages.${system}.selectWallpaperImage + } ${config.myUserConfig.wallpaperFolder} && ${ + self.packages.${system}.updateWallpaperCaelestia + } --fallback ${../../../../wallpaper/fallback.jpg}" + ]; + + # Media controls + bindl = [ + ", XF86AudioPlay, global, caelestia:mediaToggle" + ", XF86AudioStop, global, caelestia:mediaStop" + ", XF86AudioPrev, global, caelestia:mediaPrev" + ", XF86AudioNext, global, caelestia:mediaNext" + "CTRL, left, global, caelestia:mediaPrev" + "CTRL, right, global, caelestia:mediaNext" + ]; + + bindle = [ + # Audio controls + ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + ", XF86AudioRaiseVolume, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ 0; wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 0.05+" + ", XF86AudioLowerVolume, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ 0; wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05-" + "SHIFT, XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" + "SHIFT, XF86AudioRaiseVolume, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ 0; wpctl set-volume -l 1 @DEFAULT_AUDIO_SOURCE@ 0.05+" + "SHIFT, XF86AudioLowerVolume, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ 0; wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 0.05-" + # Brightness controls + ", XF86MonBrightnessUp, global, caelestia:brightnessUp" + ", XF86MonBrightnessDown, global, caelestia:brightnessDown" + ]; + + layerrule = [ + "match:namespace caelestia-.*, blur on, blur_popups on, ignore_alpha 0.1" + "match:namespace qs-.*, blur on" + ]; + + permission = [ + "/nix/store/[a-z0-9]{32}-quickshell-wrapped-[0-9.]*/bin/.quickshell-wrapped, screencopy, allow" + ]; + + general.gaps_out = lib.mkForce 10; + decoration.rounding = lib.mkForce 10; + }; + }; +} diff --git a/modules/home-manager/wm/hyprland/caelestia-shell/gifs/bird.gif b/components/modules/desktop/hyprland/caelestia-shell/gifs/bird.gif similarity index 100% rename from modules/home-manager/wm/hyprland/caelestia-shell/gifs/bird.gif rename to components/modules/desktop/hyprland/caelestia-shell/gifs/bird.gif diff --git a/modules/home-manager/wm/hyprland/caelestia-shell/gifs/blob.gif b/components/modules/desktop/hyprland/caelestia-shell/gifs/blob.gif similarity index 100% rename from modules/home-manager/wm/hyprland/caelestia-shell/gifs/blob.gif rename to components/modules/desktop/hyprland/caelestia-shell/gifs/blob.gif diff --git a/modules/home-manager/wm/hyprland/caelestia-shell/gifs/eyes.gif b/components/modules/desktop/hyprland/caelestia-shell/gifs/eyes.gif similarity index 100% rename from modules/home-manager/wm/hyprland/caelestia-shell/gifs/eyes.gif rename to components/modules/desktop/hyprland/caelestia-shell/gifs/eyes.gif diff --git a/modules/home-manager/wm/hyprland/caelestia-shell/gifs/heart.gif b/components/modules/desktop/hyprland/caelestia-shell/gifs/heart.gif similarity index 100% rename from modules/home-manager/wm/hyprland/caelestia-shell/gifs/heart.gif rename to components/modules/desktop/hyprland/caelestia-shell/gifs/heart.gif diff --git a/modules/home-manager/wm/hyprland/caelestia-shell/gifs/lightning.gif b/components/modules/desktop/hyprland/caelestia-shell/gifs/lightning.gif similarity index 100% rename from modules/home-manager/wm/hyprland/caelestia-shell/gifs/lightning.gif rename to components/modules/desktop/hyprland/caelestia-shell/gifs/lightning.gif diff --git a/modules/home-manager/wm/hyprland/caelestia-shell/gifs/lightning_sphere.gif b/components/modules/desktop/hyprland/caelestia-shell/gifs/lightning_sphere.gif similarity index 100% rename from modules/home-manager/wm/hyprland/caelestia-shell/gifs/lightning_sphere.gif rename to components/modules/desktop/hyprland/caelestia-shell/gifs/lightning_sphere.gif diff --git a/modules/home-manager/wm/hyprland/caelestia-shell/gifs/moose.gif b/components/modules/desktop/hyprland/caelestia-shell/gifs/moose.gif similarity index 100% rename from modules/home-manager/wm/hyprland/caelestia-shell/gifs/moose.gif rename to components/modules/desktop/hyprland/caelestia-shell/gifs/moose.gif diff --git a/modules/home-manager/wm/hyprland/caelestia-shell/gifs/power_light.gif b/components/modules/desktop/hyprland/caelestia-shell/gifs/power_light.gif similarity index 100% rename from modules/home-manager/wm/hyprland/caelestia-shell/gifs/power_light.gif rename to components/modules/desktop/hyprland/caelestia-shell/gifs/power_light.gif diff --git a/components/modules/desktop/hyprland/default.nix b/components/modules/desktop/hyprland/default.nix new file mode 100644 index 0000000..d629a0d --- /dev/null +++ b/components/modules/desktop/hyprland/default.nix @@ -0,0 +1,60 @@ +{ self, ... }: + +{ + flake.modules.nixos.hyprland = + { pkgs, ... }: + + { + imports = [ + self.modules.nixos.gnomeKeyring + ]; + + nix.settings = { + substituters = [ "https://hyprland.cachix.org" ]; + trusted-substituters = [ "https://hyprland.cachix.org" ]; + trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ]; + }; + + programs.hyprland = { + enable = true; + }; + + xdg.portal = { + extraPortals = [ + (pkgs.xdg-desktop-portal-wlr.overrideAttrs (previousAttrs: { + src = pkgs.fetchFromGitHub { + owner = "leon-erd"; + repo = "xdg-desktop-portal-wlr"; + rev = "424287fa0b2c59096e38534efdbd9a6bec13aead"; + sha256 = "sha256-4igGdq8CpWbTmDVVKZwIs76eOTESDrGO5qa0m/BhYP4="; + }; + buildInputs = previousAttrs.buildInputs ++ [ pkgs.libxkbcommon ]; + })) + ]; + }; + + # Optional, hint electron apps to use wayland: + environment.sessionVariables = { + NIXOS_OZONE_WL = "1"; + }; + }; + + flake.modules.homeManager.hyprland = + { ... }: + + { + imports = with self.modules.homeManager; [ + caelestiaShell + hyprlandConfigDefault + hyprlandPluginsDefault + hyprsunset + hypridle + hyprpolkit + + cliphist + myKanshiPlus + kdeconnect + nwgDisplays + ]; + }; +} diff --git a/components/modules/desktop/hyprland/hypridle.nix b/components/modules/desktop/hyprland/hypridle.nix new file mode 100644 index 0000000..d2e200e --- /dev/null +++ b/components/modules/desktop/hyprland/hypridle.nix @@ -0,0 +1,34 @@ +{ ... }: + +{ + flake.modules.homeManager.hypridle = + { ... }: + let + # hyprlockCmd = "pgrep hyprlock || hyprlock"; + # hyprlockCmd = "pgrep hyprlock || ${./hyprlock_with_apps/hyprlock.sh}"; + hyprlockCmd = "caelestia shell lock lock"; + in + { + services.hypridle = { + enable = true; + settings = { + general = { + lock_cmd = hyprlockCmd; + before_sleep_cmd = hyprlockCmd; + after_sleep_cmd = "hyprctl dispatch dpms on"; + }; + listener = [ + { + timeout = 300; + on-timeout = hyprlockCmd; + } + { + timeout = 600; + on-timeout = "hyprctl dispatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; + } + ]; + }; + }; + }; +} diff --git a/components/modules/desktop/hyprland/hyprland-conf/bindings.nix b/components/modules/desktop/hyprland/hyprland-conf/bindings.nix new file mode 100644 index 0000000..e5bebac --- /dev/null +++ b/components/modules/desktop/hyprland/hyprland-conf/bindings.nix @@ -0,0 +1,88 @@ +{ ... }: + +{ + flake.modules.homeManager.hyprlandBindings = + { ... }: + + { + wayland.windowManager.hyprland.settings = { + "$mainMod" = "SUPER"; + + bind = [ + # GENERAL + "ALT, F4 , killactive," + "$mainMod, F, togglefloating," + "$mainMod, G, togglegroup" + "$mainMod, M, fullscreen," + "$mainMod, E, exec, dolphin" + "CTRL + ALT, T, exec, wezterm" + + # SPECIAL KEYS + ", XF86Calculator , exec, qalculate-qt" + + # WINDOWS + "$mainMod + SHIFT, left, movewindoworgroup, l" + "$mainMod + SHIFT, right, movewindoworgroup, r" + "$mainMod + SHIFT, up, movewindoworgroup, u" + "$mainMod + SHIFT, down, movewindoworgroup, d" + "$mainMod + CTRL, left, movecurrentworkspacetomonitor, l" + "$mainMod + CTRL, right, movecurrentworkspacetomonitor, r" + "$mainMod + CTRL, up, movecurrentworkspacetomonitor, u" + "$mainMod + CTRL, down, movecurrentworkspacetomonitor, d" + "$mainMod, RETURN, layoutmsg, swapwithmaster" + "$mainMod + SHIFT, RETURN, layoutmsg, addmaster" + "$mainMod + SHIFT + CTRL, RETURN, layoutmsg, removemaster" + "ALT, Tab, layoutmsg, cyclenext" + "ALT + CTRL, Tab, changegroupactive" + + # WORKSPACES + # Switch workspaces with mainMod + [0-9] + "$mainMod, 1, workspace, 1" + "$mainMod, 2, workspace, 2" + "$mainMod, 3, workspace, 3" + "$mainMod, 4, workspace, 4" + "$mainMod, 5, workspace, 5" + "$mainMod, 6, workspace, 6" + "$mainMod, 7, workspace, 7" + "$mainMod, 8, workspace, 8" + "$mainMod, 9, workspace, 9" + "$mainMod, 0, workspace, 10" + "$mainMod, Tab, workspace, previous_per_monitor" + + # Move active window to a workspace with mainMod + SHIFT + [0-9] + "$mainMod SHIFT, 1, movetoworkspacesilent, 1" + "$mainMod SHIFT, 2, movetoworkspacesilent, 2" + "$mainMod SHIFT, 3, movetoworkspacesilent, 3" + "$mainMod SHIFT, 4, movetoworkspacesilent, 4" + "$mainMod SHIFT, 5, movetoworkspacesilent, 5" + "$mainMod SHIFT, 6, movetoworkspacesilent, 6" + "$mainMod SHIFT, 7, movetoworkspacesilent, 7" + "$mainMod SHIFT, 8, movetoworkspacesilent, 8" + "$mainMod SHIFT, 9, movetoworkspacesilent, 9" + "$mainMod SHIFT, 0, movetoworkspacesilent, 10" + + # Scroll through existing workspaces with mainMod + scroll + "$mainMod, mouse_down, workspace, e+1" + "$mainMod, mouse_up, workspace, e-1" + ]; + + binde = [ + # WINDOWS + "$mainMod, left, resizeactive, -30 0" + "$mainMod, right, resizeactive, 30 0" + "$mainMod, up, resizeactive, 0 -30" + "$mainMod, down, resizeactive, 0 30" + ]; + + bindm = [ + # WINDOWS + # Move/resize windows with mainMod + LMB/RMB and dragging + "$mainMod, mouse:272, movewindow" + "$mainMod, mouse:273, resizewindow" + ]; + + # Cycle workspaces with mainMod + Tab + binds.allow_workspace_cycles = true; + }; + }; +} diff --git a/components/modules/desktop/hyprland/hyprland-conf/default.nix b/components/modules/desktop/hyprland/hyprland-conf/default.nix new file mode 100644 index 0000000..4445182 --- /dev/null +++ b/components/modules/desktop/hyprland/hyprland-conf/default.nix @@ -0,0 +1,28 @@ +{ self, ... }: + +{ + flake.modules.homeManager.hyprlandConfigDefault = + { ... }: + + { + imports = with self.modules.homeManager; [ + hyprlandBindings + hyprlandExecOnce + hyprlandGraphics + hyprlandInput + hyprlandLayouts + hyprlandMisc + hyprlandMonitors + hyprlandScratchpads + hyprlandWindowrules + hyprlandWorkspacerules + ]; + + wayland.windowManager.hyprland = { + enable = true; + systemd.variables = [ "--all" ]; + package = null; + portalPackage = null; + }; + }; +} diff --git a/components/modules/desktop/hyprland/hyprland-conf/exec-once.nix b/components/modules/desktop/hyprland/hyprland-conf/exec-once.nix new file mode 100644 index 0000000..7538102 --- /dev/null +++ b/components/modules/desktop/hyprland/hyprland-conf/exec-once.nix @@ -0,0 +1,16 @@ +{ self, ... }: + +{ + flake.modules.homeManager.hyprlandExecOnce = + { pkgs, ... }: + + { + wayland.windowManager.hyprland.settings = { + # Execute at launch + exec-once = with self.packages.${pkgs.stdenv.hostPlatform.system}; [ + "sleep 5 && ${hibernateOnLowBattery}" + "sleep 5 && ${restartFailedSystemdUserServices}" + ]; + }; + }; +} diff --git a/components/modules/desktop/hyprland/hyprland-conf/graphics.nix b/components/modules/desktop/hyprland/hyprland-conf/graphics.nix new file mode 100644 index 0000000..7055ef5 --- /dev/null +++ b/components/modules/desktop/hyprland/hyprland-conf/graphics.nix @@ -0,0 +1,45 @@ +{ ... }: + +{ + flake.modules.homeManager.hyprlandGraphics = + { ... }: + + { + wayland.windowManager.hyprland.settings = { + general = { + gaps_in = 3; + gaps_out = 3; + border_size = 2; + "col.active_border" = "rgba(33ccffff) rgba(00ff99ff) 45deg"; + "col.inactive_border" = "rgba(444444aa)"; + }; + group = { + "col.border_inactive" = "rgba(444444aa)"; + "col.border_active" = "rgba(8800ffff) rgba(aa0055ff) 45deg"; + groupbar = { + "col.active" = "rgba(6600ccee)"; + "col.inactive" = "rgba(6600cc99)"; + }; + }; + + bezier = [ + "linear, 0, 0, 1, 1" + ]; + + animation = [ + "borderangle, 1, 40, linear, loop" + "layers, 1, 5, default, popin" + ]; + + decoration = { + rounding = 5; + blur = { + size = 4; + passes = 4; + ignore_opacity = true; + popups = true; + }; + }; + }; + }; +} diff --git a/components/modules/desktop/hyprland/hyprland-conf/input.nix b/components/modules/desktop/hyprland/hyprland-conf/input.nix new file mode 100644 index 0000000..82b9929 --- /dev/null +++ b/components/modules/desktop/hyprland/hyprland-conf/input.nix @@ -0,0 +1,39 @@ +{ ... }: + +{ + flake.modules.homeManager.hyprlandInput = + { config, ... }: + + { + wayland.windowManager.hyprland.settings = { + input = { + kb_layout = config.myUserConfig.kblayout; + kb_options = "ctrl:nocaps"; # remap Caps lock to Ctrl (https://wiki.hypr.land/Configuring/Uncommon-tips--tricks/#remapping-caps-lock) + numlock_by_default = true; + touchpad = { + natural_scroll = true; + drag_lock = true; + }; + }; + + device = { + name = "cust0000:00-04f3:2a4a-stylus"; + output = "eDP-1"; + }; + + cursor = { + no_hardware_cursors = 1; + }; + + gesture = [ + "3, horizontal, workspace" + "3, vertical, scale:1.5, fullscreen" + "4, swipe, resize" + ]; + gestures = { + workspace_swipe_forever = true; + workspace_swipe_touch = true; + }; + }; + }; +} diff --git a/components/modules/desktop/hyprland/hyprland-conf/layouts.nix b/components/modules/desktop/hyprland/hyprland-conf/layouts.nix new file mode 100644 index 0000000..67e75b2 --- /dev/null +++ b/components/modules/desktop/hyprland/hyprland-conf/layouts.nix @@ -0,0 +1,17 @@ +{ ... }: + +{ + flake.modules.homeManager.hyprlandLayouts = + { ... }: + + { + wayland.windowManager.hyprland.settings = { + dwindle = { + # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more + pseudotile = true; # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = true; # you probably want this + force_split = 2; + }; + }; + }; +} diff --git a/components/modules/desktop/hyprland/hyprland-conf/misc.nix b/components/modules/desktop/hyprland/hyprland-conf/misc.nix new file mode 100644 index 0000000..3226234 --- /dev/null +++ b/components/modules/desktop/hyprland/hyprland-conf/misc.nix @@ -0,0 +1,31 @@ +{ ... }: + +{ + flake.modules.homeManager.hyprlandMisc = + { ... }: + + { + wayland.windowManager.hyprland.settings = { + general = { + snap.enabled = true; + resize_on_border = true; + layout = "master"; + }; + misc = { + animate_manual_resizes = true; + animate_mouse_windowdragging = true; + focus_on_activate = true; + force_default_wallpaper = 0; + initial_workspace_tracking = false; + mouse_move_enables_dpms = true; + vrr = 3; + }; + render.new_render_scheduling = true; + debug = { + disable_logs = false; + full_cm_proto = true; # https://github.com/hyprwm/Hyprland/discussions/10860#discussioncomment-13736256 + }; + ecosystem.enforce_permissions = true; + }; + }; +} diff --git a/components/modules/desktop/hyprland/hyprland-conf/monitors.nix b/components/modules/desktop/hyprland/hyprland-conf/monitors.nix new file mode 100644 index 0000000..d753700 --- /dev/null +++ b/components/modules/desktop/hyprland/hyprland-conf/monitors.nix @@ -0,0 +1,13 @@ +{ ... }: + +{ + flake.modules.homeManager.hyprlandMonitors = + { ... }: + + { + wayland.windowManager.hyprland.settings = { + # Fallback rule + monitor = ", preferred, auto, 1"; + }; + }; +} diff --git a/components/modules/desktop/hyprland/hyprland-conf/scratchpads.nix b/components/modules/desktop/hyprland/hyprland-conf/scratchpads.nix new file mode 100644 index 0000000..c03be20 --- /dev/null +++ b/components/modules/desktop/hyprland/hyprland-conf/scratchpads.nix @@ -0,0 +1,26 @@ +{ ... }: + +{ + flake.modules.homeManager.hyprlandScratchpads = + { lib, pkgs, ... }: + + { + wayland.windowManager.hyprland.settings = { + workspace = [ + "special:btop, on-created-empty:[fullscreen] ${lib.getExe pkgs.alacritty} -e btop" + "special:htop, border:false, on-created-empty:[float; size 100% 35%; move 0% 65%] ${lib.getExe pkgs.alacritty} -e htop" + "special:spotify, on-created-empty:[fullscreen] spotify" + "special:terminal, on-created-empty:[fullscreen] ${lib.getExe pkgs.alacritty}" + ]; + bind = [ + "$mainMod, B, togglespecialworkspace, btop" + "$mainMod, H, togglespecialworkspace, htop" + "$mainMod, S, togglespecialworkspace, spotify" + "$mainMod, T, togglespecialworkspace, terminal" + ]; + animation = [ + "specialWorkspace, 1, 5, default, slidefadevert" + ]; + }; + }; +} diff --git a/components/modules/desktop/hyprland/hyprland-conf/windowrules.nix b/components/modules/desktop/hyprland/hyprland-conf/windowrules.nix new file mode 100644 index 0000000..686382d --- /dev/null +++ b/components/modules/desktop/hyprland/hyprland-conf/windowrules.nix @@ -0,0 +1,32 @@ +{ ... }: + +{ + flake.modules.homeManager.hyprlandWindowrules = + { ... }: + + { + wayland.windowManager.hyprland.settings = { + windowrule = [ + "match:class ^(org.kde.polkit-kde-authentication-agent-1)$, float on" + + "match:class ^(code)$, tag +vscode" + "match:class ^(codium)$, tag +vscode" + "match:tag vscode, opacity 0.85, workspace 1" + "match:tag vscode, match:title .*\.pdf.*, opacity 1.00" + + "match:class ^(firefox), workspace 5$" + + "tag +social, match:class ^(discord)$" + "tag +social, match:class ^(org.telegram.desktop)$" + "tag +social, match:class ^(signal)$" + "tag +social, match:class ^(Slack)$" + "tag +social, match:class ^(thunderbird)$" + "tag +social, match:class ^(wasistlos)$" + "match:tag social, workspace 9" + + # KDE CONNECT Presentation Mode + "match:class ^(org.kde.kdeconnect.daemon)$, no_blur on, border_size 0, no_shadow on, no_anim on, no_focus on, suppress_event fullscreen, float on, move 0 0, size 100% 100%" + ]; + }; + }; +} diff --git a/components/modules/desktop/hyprland/hyprland-conf/workspacerules.nix b/components/modules/desktop/hyprland/hyprland-conf/workspacerules.nix new file mode 100644 index 0000000..8c4bf34 --- /dev/null +++ b/components/modules/desktop/hyprland/hyprland-conf/workspacerules.nix @@ -0,0 +1,15 @@ +{ ... }: + +{ + flake.modules.homeManager.hyprlandWorkspacerules = + { ... }: + + { + wayland.windowManager.hyprland.settings = { + workspace = [ + "2, on-created-empty:dolphin" + "5, on-created-empty:firefox" + ]; + }; + }; +} diff --git a/components/modules/desktop/hyprland/hyprland-plugins/default.nix b/components/modules/desktop/hyprland/hyprland-plugins/default.nix new file mode 100644 index 0000000..ada69e7 --- /dev/null +++ b/components/modules/desktop/hyprland/hyprland-plugins/default.nix @@ -0,0 +1,12 @@ +{ self, ... }: + +{ + flake.modules.homeManager.hyprlandPluginsDefault = + { ... }: + + { + imports = with self.modules.homeManager; [ + hyprDynamicCursors + ]; + }; +} diff --git a/components/modules/desktop/hyprland/hyprland-plugins/hypr-dynamic-cursors.nix b/components/modules/desktop/hyprland/hyprland-plugins/hypr-dynamic-cursors.nix new file mode 100644 index 0000000..4026aec --- /dev/null +++ b/components/modules/desktop/hyprland/hyprland-plugins/hypr-dynamic-cursors.nix @@ -0,0 +1,25 @@ +{ ... }: + +{ + flake.modules.homeManager.hyprDynamicCursors = + { pkgs, ... }: + + let + inherit (pkgs.hyprlandPlugins) hypr-dynamic-cursors; + in + { + wayland.windowManager.hyprland = { + plugins = [ + hypr-dynamic-cursors + ]; + settings = { + plugin.dynamic-cursors = { + mode = "tilt"; + }; + permission = [ + "${hypr-dynamic-cursors}/lib/libhypr-dynamic-cursors.so, plugin, allow" + ]; + }; + }; + }; +} diff --git a/components/modules/desktop/hyprland/hyprland-plugins/hyprexpo.nix b/components/modules/desktop/hyprland/hyprland-plugins/hyprexpo.nix new file mode 100644 index 0000000..c71b2f7 --- /dev/null +++ b/components/modules/desktop/hyprland/hyprland-plugins/hyprexpo.nix @@ -0,0 +1,32 @@ +{ ... }: + +{ + flake.modules.homeManager.hyprexpo = + { pkgs, ... }: + + let + inherit (pkgs.hyprlandPlugins) hyprexpo; + in + { + wayland.windowManager.hyprland = { + plugins = [ + hyprexpo + ]; + settings = { + plugin.hyprexpo = { + columns = 3; + gap_size = 5; + bg_col = "rgb(111111)"; + workspace_method = "first 1"; # [center/first] [workspace] e.g. first 1 or center m+1 + enable_gesture = true; # laptop touchpad, 4 fingers + gesture_distance = 300; # how far is the "max" + gesture_positive = false; # positive = swipe down. Negative = swipe up. + }; + bind = [ "$mainMod, W, hyprexpo:expo, toggle" ]; + permission = [ + "${hyprexpo}/lib/libhyprexpo.so, plugin, allow" + ]; + }; + }; + }; +} diff --git a/components/modules/desktop/hyprland/hyprlock.nix b/components/modules/desktop/hyprland/hyprlock.nix new file mode 100644 index 0000000..1b2dfe8 --- /dev/null +++ b/components/modules/desktop/hyprland/hyprlock.nix @@ -0,0 +1,98 @@ +{ ... }: + +{ + flake.modules.homeManager.hyprlock = + { + lib, + config, + ... + }: + let + #walColor = (builtins.fromJSON (builtins.readFile ./colors-rgb.json)).colors.color1; + labelColor = "rgba(255, 255, 255, 1)"; + in + { + programs.hyprlock = { + enable = true; + settings = { + general = { + grace = 3; + hide_cursor = true; + }; + background = [ + { + path = "screenshot"; + blur_size = 4; + blur_passes = 4; + } + ]; + input-field = [ + { + placeholder_text = ''Input Password...''; + size = "200, 50"; + outline_thickness = 1; + dots_spacing = 0.3; + inner_color = "rgba(0, 0, 0, 0)"; + outer_color = "rgba(0, 0, 0, 0)"; + font_color = "rgba(255, 255, 255, 1)"; + capslock_color = "rgba(130, 0, 255, 1)"; + fade_on_empty = false; + hide_input = false; + fail_text = ''$FAIL ($ATTEMPTS)''; + position = "0, -30"; + halign = "center"; + valign = "center"; + } + ]; + label = [ + { + text = ''cmd[update:500] echo "$(date +'%H:%M:%S')"''; + font_size = 50; + font_family = "NotoMonoNerdFont"; + color = labelColor; + position = "0, 250"; + halign = "center"; + valign = "center"; + shadow_passes = 1; + } + { + text = ''cmd[update:10000] echo "$(date +'%a %d. %b')"''; + font_size = 15; + font_family = "NotoSansNerdFont"; + color = labelColor; + position = "0, 330"; + halign = "center"; + valign = "center"; + shadow_passes = 1; + } + { + text = ''󱁕 Hey $USER 󱁕''; + font_size = 25; + font_family = "NotoSansNerdFont"; + color = labelColor; + position = "0, 30"; + halign = "center"; + valign = "center"; + shadow_passes = 1; + } + { + text = ""; + font_size = 25; + color = labelColor; + position = "0, 80"; + halign = "center"; + valign = "center"; + shadow_passes = 1; + } + ]; + }; + }; + + wayland.windowManager.hyprland.settings = { + bindr = [ "$mainMod, L, exec, hyprlock --immediate" ]; + permission = [ + "${lib.escapeRegex (lib.getExe config.programs.hyprlock.package)}, screencopy, allow" + ]; + }; + }; +} diff --git a/components/modules/desktop/hyprland/hyprlock_with_apps/default.nix b/components/modules/desktop/hyprland/hyprlock_with_apps/default.nix new file mode 100644 index 0000000..67241be --- /dev/null +++ b/components/modules/desktop/hyprland/hyprlock_with_apps/default.nix @@ -0,0 +1,144 @@ +{ ... }: + +{ + flake.modules.homeManager.hyprlockWithApps = + { + pkgs, + config, + lib, + ... + }: + let + #walColor = (builtins.fromJSON (builtins.readFile ./colors-rgb.json)).colors.color1; + labelColor = "rgba(255, 255, 255, 1)"; + in + { + programs.hyprlock = { + enable = true; + settings = { + general = { + grace = 3; + hide_cursor = true; + }; + background = [ + { + monitor = "HDMI-A-1"; + path = ../../../../wallpaper/fallback.jpg; + blur_size = 4; + blur_passes = 4; + } + { + monitor = "DP-2"; + path = ../../../../wallpaper/fallback.jpg; + blur_size = 4; + blur_passes = 4; + } + { + monitor = "eDP-1"; + color = "rgba(0, 0, 0, 0)"; + path = ""; + blur_passes = 0; + } + ]; + input-field = [ + { + placeholder_text = ''Input Password...''; + size = "200, 50"; + outline_thickness = 1; + dots_spacing = 0.3; + inner_color = "rgba(0, 0, 0, 0)"; + outer_color = "rgba(0, 0, 0, 0)"; + font_color = "rgba(255, 255, 255, 1)"; + capslock_color = "rgba(130, 0, 255, 1)"; + fade_on_empty = false; + hide_input = false; + fail_text = ''$FAIL ($ATTEMPTS)''; + position = "0, -30"; + halign = "center"; + valign = "center"; + } + ]; + label = [ + { + text = ''cmd[update:500] echo "$(date +'%H:%M:%S')"''; + font_size = 50; + font_family = "NotoMonoNerdFont"; + color = labelColor; + position = "0, 250"; + halign = "center"; + valign = "center"; + shadow_passes = 1; + } + { + text = ''cmd[update:10000] echo "$(date +'%a %d. %b')"''; + font_size = 15; + font_family = "NotoSansNerdFont"; + color = labelColor; + position = "0, 330"; + halign = "center"; + valign = "center"; + shadow_passes = 1; + } + { + text = ''󱁕 Hey $USER 󱁕''; + font_size = 25; + font_family = "NotoSansNerdFont"; + color = labelColor; + position = "0, 30"; + halign = "center"; + valign = "center"; + shadow_passes = 1; + } + { + text = ""; + font_size = 25; + color = labelColor; + position = "0, 80"; + halign = "center"; + valign = "center"; + shadow_passes = 1; + } + ]; + }; + }; + + wayland.windowManager.hyprland.settings = { + bindr = [ "$mainMod, L, exec, ${./hyprlock.sh}" ]; + workspace = [ + "name:hyprlock, monitor:eDP-1" + "name:hyprlock, decorate:false" + "name:hyprlock, border:false" + "name:hyprlock, shadow:false" + "special:hyprlock, monitor:eDP-1" + "special:hyprlock, decorate:false" + "special:hyprlock, border:false" + "special:hyprlock, shadow:false" + ]; + permission = [ + "${lib.escapeRegex (lib.getExe config.programs.hyprlock.package)}, screencopy, allow" + ]; + misc.session_lock_xray = true; + }; + + home.packages = with pkgs; [ + alacritty + cmatrix + asciiquarium-transparent + ]; + + programs.cava = { + enable = true; + settings.color = { + gradient = 1; + gradient_color_1 = "'#59cc33'"; + gradient_color_2 = "'#80cc33'"; + gradient_color_3 = "'#a6cc33'"; + gradient_color_4 = "'#cccc33'"; + gradient_color_5 = "'#cca633'"; + gradient_color_6 = "'#cc8033'"; + gradient_color_7 = "'#cc5933'"; + gradient_color_8 = "'#cc3333'"; + }; + }; + }; +} diff --git a/modules/home-manager/wm/hyprland/hyprlock_with_apps/hyprlock.sh b/components/modules/desktop/hyprland/hyprlock_with_apps/hyprlock.sh similarity index 100% rename from modules/home-manager/wm/hyprland/hyprlock_with_apps/hyprlock.sh rename to components/modules/desktop/hyprland/hyprlock_with_apps/hyprlock.sh diff --git a/components/modules/desktop/hyprland/hyprpolkit.nix b/components/modules/desktop/hyprland/hyprpolkit.nix new file mode 100644 index 0000000..bcdb672 --- /dev/null +++ b/components/modules/desktop/hyprland/hyprpolkit.nix @@ -0,0 +1,10 @@ +{ ... }: + +{ + flake.modules.homeManager.hyprpolkit = + { ... }: + + { + services.hyprpolkitagent.enable = true; + }; +} diff --git a/components/modules/desktop/hyprland/hyprsunset/default.nix b/components/modules/desktop/hyprland/hyprsunset/default.nix new file mode 100644 index 0000000..193049f --- /dev/null +++ b/components/modules/desktop/hyprland/hyprsunset/default.nix @@ -0,0 +1,70 @@ +{ ... }: + +{ + flake.modules.homeManager.hyprsunset = + { + pkgs, + lib, + config, + ... + }: + + let + myHyprsunsetTemperature = pkgs.writers.writePython3Bin "myHyprsunsetTemperature" { + libraries = with pkgs.python3Packages; [ + astral + dbus-python + tzlocal + ]; + flakeIgnore = [ "E501" ]; + } ./script.py; + in + { + systemd.user.services = { + hyprsunset = { + Install = { + WantedBy = [ config.wayland.systemd.target ]; + }; + + Unit = { + ConditionEnvironment = "WAYLAND_DISPLAY"; + Description = "hyprsunset - Hyprland's blue-light filter"; + After = [ config.wayland.systemd.target ]; + PartOf = [ config.wayland.systemd.target ]; + }; + + Service = { + ExecStart = "${lib.getExe pkgs.hyprsunset}"; + Restart = "always"; + RestartSec = "10"; + }; + }; + + myHyprsunsetTemperature = { + Install = { + WantedBy = [ "hyprsunset.service" ]; + }; + + Unit = { + Description = "Custom hyprsunset temperature adjustment service"; + ConditionEnvironment = "WAYLAND_DISPLAY"; + After = [ "hyprsunset.service" ]; + PartOf = [ "hyprsunset.service" ]; + Requires = [ "hyprsunset.service" ]; + }; + + Service = { + ExecStart = "${lib.getExe myHyprsunsetTemperature}"; + Restart = "on-failure"; + RestartSec = "5s"; + Environment = "PYTHONUNBUFFERED=1"; # print statements will go to journalctl immediately + }; + }; + }; + + home.sessionVariables = { + HYPRSUNSET_DAY_TEMP = "6000"; + HYPRSUNSET_NIGHT_TEMP = "3000"; + }; + }; +} diff --git a/modules/home-manager/wm/hyprland/hyprsunset/script.py b/components/modules/desktop/hyprland/hyprsunset/script.py similarity index 100% rename from modules/home-manager/wm/hyprland/hyprsunset/script.py rename to components/modules/desktop/hyprland/hyprsunset/script.py diff --git a/components/modules/desktop/kde/default.nix b/components/modules/desktop/kde/default.nix new file mode 100644 index 0000000..bbc91ae --- /dev/null +++ b/components/modules/desktop/kde/default.nix @@ -0,0 +1,31 @@ +{ self, ... }: + +{ + flake.modules.nixos.kde = + { ... }: + + { + imports = [ + self.modules.nixos.xserver + ]; + + services.desktopManager.plasma6.enable = true; + # the plasma6 module sets itself as the default session which I don't want + services.displayManager.defaultSession = null; + }; + + flake.modules.homeManager.kde = + { inputs, ... }: + + { + imports = [ inputs.plasma-manager.homeModules.plasma-manager ]; + + # https://github.com/nix-community/stylix/issues/267#issuecomment-2314636091 + programs.plasma = { + enable = true; + configFile.kded5rc = { + "Module-gtkconfig"."autoload" = false; + }; + }; + }; +} diff --git a/components/modules/desktop/sddm.nix b/components/modules/desktop/sddm.nix new file mode 100644 index 0000000..7baa88c --- /dev/null +++ b/components/modules/desktop/sddm.nix @@ -0,0 +1,47 @@ +{ self, ... }: + +{ + flake.modules.nixos.sddm = + { pkgs, ... }: + + { + imports = [ + self.modules.nixos.xserver + ]; + + environment.systemPackages = with pkgs; [ + ( + (sddm-astronaut.override { + embeddedTheme = "pixel_sakura"; + themeConfig = { + Background = "Backgrounds/my_background.mp4"; + HideVirtualKeyboard = false; + HideSystemButtons = false; + }; + }).overrideAttrs + (prevAttrs: { + installPhase = prevAttrs.installPhase + '' + chmod u+w $out/share/sddm/themes/sddm-astronaut-theme/Backgrounds/ + cp ${../../wallpaper/animated/mountains-in-clouds.mp4} $out/share/sddm/themes/sddm-astronaut-theme/Backgrounds/my_background.mp4 + ''; + }) + ) + ]; + + services.displayManager.sddm = { + enable = true; + # package = pkgs.kdePackages.sddm; + extraPackages = with pkgs; [ + kdePackages.qtmultimedia + ]; + # to find theme name check out /etc/sddm.conf for "ThemeDir" + # and then "ls " + # probably "ls /run/current-system/sw/share/sddm/themes" + theme = "sddm-astronaut-theme"; + wayland = { + enable = true; # This is still experimental + compositor = "kwin"; + }; + }; + }; +} diff --git a/modules/home-manager/theming/configs/Kvantum/Layan/Layan.kvconfig b/components/modules/desktop/theming/configs/Kvantum/Layan/Layan.kvconfig similarity index 100% rename from modules/home-manager/theming/configs/Kvantum/Layan/Layan.kvconfig rename to components/modules/desktop/theming/configs/Kvantum/Layan/Layan.kvconfig diff --git a/modules/home-manager/theming/configs/Kvantum/Layan/Layan.svg b/components/modules/desktop/theming/configs/Kvantum/Layan/Layan.svg similarity index 100% rename from modules/home-manager/theming/configs/Kvantum/Layan/Layan.svg rename to components/modules/desktop/theming/configs/Kvantum/Layan/Layan.svg diff --git a/modules/home-manager/theming/configs/Kvantum/Layan/LayanDark.kvconfig b/components/modules/desktop/theming/configs/Kvantum/Layan/LayanDark.kvconfig similarity index 100% rename from modules/home-manager/theming/configs/Kvantum/Layan/LayanDark.kvconfig rename to components/modules/desktop/theming/configs/Kvantum/Layan/LayanDark.kvconfig diff --git a/modules/home-manager/theming/configs/Kvantum/Layan/LayanDark.svg b/components/modules/desktop/theming/configs/Kvantum/Layan/LayanDark.svg similarity index 100% rename from modules/home-manager/theming/configs/Kvantum/Layan/LayanDark.svg rename to components/modules/desktop/theming/configs/Kvantum/Layan/LayanDark.svg diff --git a/modules/home-manager/theming/configs/Kvantum/LayanSolid/LayanSolid.kvconfig b/components/modules/desktop/theming/configs/Kvantum/LayanSolid/LayanSolid.kvconfig similarity index 100% rename from modules/home-manager/theming/configs/Kvantum/LayanSolid/LayanSolid.kvconfig rename to components/modules/desktop/theming/configs/Kvantum/LayanSolid/LayanSolid.kvconfig diff --git a/modules/home-manager/theming/configs/Kvantum/LayanSolid/LayanSolid.svg b/components/modules/desktop/theming/configs/Kvantum/LayanSolid/LayanSolid.svg similarity index 100% rename from modules/home-manager/theming/configs/Kvantum/LayanSolid/LayanSolid.svg rename to components/modules/desktop/theming/configs/Kvantum/LayanSolid/LayanSolid.svg diff --git a/modules/home-manager/theming/configs/Kvantum/LayanSolid/LayanSolidDark.kvconfig b/components/modules/desktop/theming/configs/Kvantum/LayanSolid/LayanSolidDark.kvconfig similarity index 100% rename from modules/home-manager/theming/configs/Kvantum/LayanSolid/LayanSolidDark.kvconfig rename to components/modules/desktop/theming/configs/Kvantum/LayanSolid/LayanSolidDark.kvconfig diff --git a/modules/home-manager/theming/configs/Kvantum/LayanSolid/LayanSolidDark.svg b/components/modules/desktop/theming/configs/Kvantum/LayanSolid/LayanSolidDark.svg similarity index 100% rename from modules/home-manager/theming/configs/Kvantum/LayanSolid/LayanSolidDark.svg rename to components/modules/desktop/theming/configs/Kvantum/LayanSolid/LayanSolidDark.svg diff --git a/modules/home-manager/theming/configs/Kvantum/kvantum.kvconfig b/components/modules/desktop/theming/configs/Kvantum/kvantum.kvconfig similarity index 100% rename from modules/home-manager/theming/configs/Kvantum/kvantum.kvconfig rename to components/modules/desktop/theming/configs/Kvantum/kvantum.kvconfig diff --git a/modules/home-manager/theming/configs/color-schemes/Layan.colors b/components/modules/desktop/theming/configs/color-schemes/Layan.colors similarity index 100% rename from modules/home-manager/theming/configs/color-schemes/Layan.colors rename to components/modules/desktop/theming/configs/color-schemes/Layan.colors diff --git a/modules/home-manager/theming/configs/color-schemes/LayanLight.colors b/components/modules/desktop/theming/configs/color-schemes/LayanLight.colors similarity index 100% rename from modules/home-manager/theming/configs/color-schemes/LayanLight.colors rename to components/modules/desktop/theming/configs/color-schemes/LayanLight.colors diff --git a/components/modules/desktop/theming/theming.nix b/components/modules/desktop/theming/theming.nix new file mode 100644 index 0000000..aa2d181 --- /dev/null +++ b/components/modules/desktop/theming/theming.nix @@ -0,0 +1,68 @@ +{ ... }: + +{ + flake.modules.homeManager.theming = + { pkgs, config, ... }: + + { + gtk = { + enable = true; + theme = { + package = pkgs.layan-gtk-theme; + name = "Layan-Dark"; + }; + cursorTheme = { + package = pkgs.kdePackages.breeze-gtk; + name = "breeze_cursors"; + size = 24; + }; + iconTheme = { + package = pkgs.tela-icon-theme; + name = "Tela"; + }; + font = { + name = "NotoSansNerdFont"; + size = 10; + }; + gtk4.theme = config.gtk.theme; + }; + + qt = { + enable = true; + platformTheme.name = "qtct"; + # style.name = "kvantum"; # this sets QT_STYLE_OVERRIDE=kvantum which fucks up plasma6. Disable this line if you want to use kde *) + style.package = with pkgs; [ + libsForQt5.qtstyleplugin-kvantum + qt6Packages.qtstyleplugin-kvantum + ]; + }; + + xdg.configFile = { + "Kvantum" = { + source = ./configs/Kvantum; + recursive = true; + }; + "qt5ct/qt5ct.conf".text = '' + [Appearance] + custom_palette=false + icon_theme=Tela + standard_dialogs=default + style=kvantum + ''; + }; + + # [Colors:View] BackgroundAlternate overridden for dolphin + xdg.dataFile = { + "color-schemes/Layan.colors".source = ./configs/color-schemes/Layan.colors; + "color-schemes/LayanLight.colors".source = ./configs/color-schemes/LayanLight.colors; + }; + + wayland.windowManager.hyprland.settings = { + env = [ + "XCURSOR_THEME, breeze_cursors" + "XCURSOR_SIZE, 24" + "QT_STYLE_OVERRIDE, kvantum" # *) set QT_STYLE_OVERRIDE for hyprland only + ]; + }; + }; +} diff --git a/components/modules/desktop/useful-utilities/autoraise.nix b/components/modules/desktop/useful-utilities/autoraise.nix new file mode 100644 index 0000000..be16c84 --- /dev/null +++ b/components/modules/desktop/useful-utilities/autoraise.nix @@ -0,0 +1,15 @@ +{ ... }: + +{ + flake.modules.homeManager.autoraise = + { pkgs, ... }: + + { + home.packages = with pkgs; [ + autoraise + ]; + + # never raise + xdg.configFile."AutoRaise".text = "delay=0"; + }; +} diff --git a/components/modules/desktop/useful-utilities/blueman-applet.nix b/components/modules/desktop/useful-utilities/blueman-applet.nix new file mode 100644 index 0000000..faf0166 --- /dev/null +++ b/components/modules/desktop/useful-utilities/blueman-applet.nix @@ -0,0 +1,14 @@ +{ ... }: + +{ + flake.modules.homeManager.bluemanApplet = + { ... }: + + { + services.blueman-applet.enable = true; + + wayland.windowManager.hyprland.settings.exec-once = [ + "sleep 10 && systemctl --user restart blueman-applet.service" + ]; + }; +} diff --git a/components/modules/desktop/useful-utilities/cliphist/default.nix b/components/modules/desktop/useful-utilities/cliphist/default.nix new file mode 100644 index 0000000..98ddf25 --- /dev/null +++ b/components/modules/desktop/useful-utilities/cliphist/default.nix @@ -0,0 +1,21 @@ +{ ... }: + +{ + flake.modules.homeManager.cliphist = + { pkgs, lib, ... }: + + { + home.packages = with pkgs; [ + wl-clipboard + ]; + + services.cliphist.enable = true; + + wayland.windowManager.hyprland.settings = { + bind = [ + # "$mainMod, V, exec, cliphist list | ${lib.getExe pkgs.rofi-wayland} -dmenu -theme ${./spotlight-dark.rasi} | cliphist decode | ${pkgs.wl-clipboard}/bin/wl-copy && ${lib.getExe pkgs.wtype} -M ctrl v -m ctrl" + "$mainMod, V, exec, [float; size 60% 60%; center; animation slide; dimaround] ${lib.getExe pkgs.alacritty} -e ${pkgs.cliphist}/bin/cliphist-fzf && ${lib.getExe pkgs.wtype} -M ctrl v -m ctrl" + ]; + }; + }; +} diff --git a/modules/home-manager/wm/useful_utilities/cliphist/spotlight-dark.rasi b/components/modules/desktop/useful-utilities/cliphist/spotlight-dark.rasi similarity index 100% rename from modules/home-manager/wm/useful_utilities/cliphist/spotlight-dark.rasi rename to components/modules/desktop/useful-utilities/cliphist/spotlight-dark.rasi diff --git a/components/modules/desktop/useful-utilities/gammastep.nix b/components/modules/desktop/useful-utilities/gammastep.nix new file mode 100644 index 0000000..f7b3e8f --- /dev/null +++ b/components/modules/desktop/useful-utilities/gammastep.nix @@ -0,0 +1,14 @@ +{ ... }: + +{ + flake.modules.homeManager.gammastep = + { ... }: + + { + services.gammastep = { + enable = true; + provider = "geoclue2"; + tray = true; + }; + }; +} diff --git a/components/modules/desktop/useful-utilities/kanshi.nix b/components/modules/desktop/useful-utilities/kanshi.nix new file mode 100644 index 0000000..a060dc5 --- /dev/null +++ b/components/modules/desktop/useful-utilities/kanshi.nix @@ -0,0 +1,74 @@ +{ ... }: + +{ + flake.modules.homeManager.kanshi = + { ... }: + + { + services.kanshi = { + enable = true; + systemdTarget = "graphical-session.target"; + profiles = { + default.outputs = [ + { + criteria = "eDP-1"; + mode = "1920x1080"; + scale = 1.0; + } + ]; + home_1.outputs = [ + { + criteria = "Dell Inc. DELL P2412H TTMDG2AQ15EU"; + mode = "1920x1080"; + scale = 1.0; + position = "0,0"; + } + { + criteria = "eDP-1"; + mode = "1920x1080"; + scale = 1.0; + position = "1920,0"; + } + ]; + home_2.outputs = [ + { + criteria = "Dell Inc. DELL P2412H TTMDG2AQ15EU"; + mode = "1920x1080"; + scale = 1.0; + position = "0,0"; + } + { + criteria = "LG Electronics E2210 205NDMT1D051"; + mode = "1680x1050"; + scale = 1.0; + position = "1920,0"; + } + { + criteria = "eDP-1"; + mode = "1920x1080"; + scale = 1.0; + position = "3600,0"; + } + ]; + office.outputs = [ + { + criteria = "eDP-1"; + mode = "1920x1080"; + scale = 1.0; + position = "0,0"; + } + { + criteria = "Acer Technologies CB271HU T85EE0018511"; + mode = "2560x1440"; + scale = 1.0; + position = "1920,0"; + } + ]; + }; + }; + + wayland.windowManager.hyprland.settings = { + bind = [ "$mainMod + SHIFT, P, exec, pkill -HUP kanshi" ]; + }; + }; +} diff --git a/components/modules/desktop/useful-utilities/karabiner/default.nix b/components/modules/desktop/useful-utilities/karabiner/default.nix new file mode 100644 index 0000000..8c031ba --- /dev/null +++ b/components/modules/desktop/useful-utilities/karabiner/default.nix @@ -0,0 +1,26 @@ +{ ... }: + +{ + flake.modules.homeManager.karabiner = + # karabiner-elements needs to be installed via brew because it needs to be in /Applications for the permissions to work + { + lib, + config, + ... + }: + + { + home.activation = { + myKarabinerConfig = + let + karabinerPath = "$XDG_CONFIG_HOME/karabiner"; + targetDir = "${config.myUserConfig.flakeDirectory}/components/modules/desktop/useful-utilities/karabiner/karabiner"; + in + # Somehow karabiner-elements creates a new symlink in its folder so we want to remove it here + lib.hm.dag.entryAfter [ "writeBoundary" ] '' + run ln -sf ${targetDir} ${karabinerPath} + run rm -f ${karabinerPath}/karabiner + ''; + }; + }; +} diff --git a/modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20251017.json b/components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20251017.json similarity index 100% rename from modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20251017.json rename to components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20251017.json diff --git a/modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20251018.json b/components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20251018.json similarity index 100% rename from modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20251018.json rename to components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20251018.json diff --git a/modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20251021.json b/components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20251021.json similarity index 100% rename from modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20251021.json rename to components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20251021.json diff --git a/modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20251029.json b/components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20251029.json similarity index 100% rename from modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20251029.json rename to components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20251029.json diff --git a/modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20251030.json b/components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20251030.json similarity index 100% rename from modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20251030.json rename to components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20251030.json diff --git a/modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20251102.json b/components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20251102.json similarity index 100% rename from modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20251102.json rename to components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20251102.json diff --git a/modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20251103.json b/components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20251103.json similarity index 100% rename from modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20251103.json rename to components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20251103.json diff --git a/modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20251217.json b/components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20251217.json similarity index 100% rename from modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20251217.json rename to components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20251217.json diff --git a/modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20251224.json b/components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20251224.json similarity index 100% rename from modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20251224.json rename to components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20251224.json diff --git a/modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20260201.json b/components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20260201.json similarity index 100% rename from modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20260201.json rename to components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20260201.json diff --git a/modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20260302.json b/components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20260302.json similarity index 100% rename from modules/home-manager/wm/useful_utilities/karabiner/karabiner/automatic_backups/karabiner_20260302.json rename to components/modules/desktop/useful-utilities/karabiner/karabiner/automatic_backups/karabiner_20260302.json diff --git a/modules/home-manager/wm/useful_utilities/karabiner/karabiner/karabiner.json b/components/modules/desktop/useful-utilities/karabiner/karabiner/karabiner.json similarity index 100% rename from modules/home-manager/wm/useful_utilities/karabiner/karabiner/karabiner.json rename to components/modules/desktop/useful-utilities/karabiner/karabiner/karabiner.json diff --git a/components/modules/desktop/useful-utilities/kdeconnect.nix b/components/modules/desktop/useful-utilities/kdeconnect.nix new file mode 100644 index 0000000..918a22d --- /dev/null +++ b/components/modules/desktop/useful-utilities/kdeconnect.nix @@ -0,0 +1,13 @@ +{ ... }: + +{ + flake.modules.homeManager.kdeconnect = + { ... }: + + { + services.kdeconnect = { + enable = true; + indicator = true; + }; + }; +} diff --git a/components/modules/desktop/useful-utilities/media-controls.nix b/components/modules/desktop/useful-utilities/media-controls.nix new file mode 100644 index 0000000..067d2a5 --- /dev/null +++ b/components/modules/desktop/useful-utilities/media-controls.nix @@ -0,0 +1,46 @@ +{ ... }: + +{ + flake.modules.nixos.mediaControls = + { pkgs, ... }: + { + services.udev.packages = [ pkgs.swayosd ]; + }; + + flake.modules.homeManager.mediaControls = + { pkgs, ... }: + + { + home.packages = with pkgs; [ + pamixer + playerctl + ]; + + services.swayosd = { + enable = true; + }; + + wayland.windowManager.hyprland.settings = { + bindl = [ + ", XF86AudioMute, exec, swayosd-client --output-volume mute-toggle" + ", XF86AudioPlay, exec, playerctl play-pause" + ", XF86AudioStop, exec, playerctl stop" + ", XF86AudioPrev, exec, playerctl previous" + ", XF86AudioNext, exec, playerctl next" + "CTRL, left, exec, playerctl previous" + "CTRL, right, exec, playerctl next" + ]; + + bindle = [ + ", XF86AudioRaiseVolume, exec, pamixer --unmute; swayosd-client --output-volume raise" + ", XF86MonBrightnessUp, exec, swayosd-client --brightness raise" + ", XF86MonBrightnessDown, exec, swayosd-client --brightness lower" + ", XF86AudioLowerVolume, exec, pamixer --unmute; swayosd-client --output-volume lower" + ]; + + layerrule = [ + "match:namespace swayosd, blur on, ignore_alpha" + ]; + }; + }; +} diff --git a/components/modules/desktop/useful-utilities/myKanshiPlus/default.nix b/components/modules/desktop/useful-utilities/myKanshiPlus/default.nix new file mode 100644 index 0000000..e802a2c --- /dev/null +++ b/components/modules/desktop/useful-utilities/myKanshiPlus/default.nix @@ -0,0 +1,52 @@ +{ self, ... }: + +{ + flake.modules.homeManager.myKanshiPlus = + { ... }: + + { + imports = [ self.modules.homeManager.myKanshiPlusModule ]; + + programs.myKanshiPlus = { + enable = true; + profiles = { + default.monitors."LG Display 0x0637" = { }; + home_1.monitors = { + "LG Display 0x0637" = { }; + "Dell Inc. DELL P2412H TTMDG2AQ15EU".position = "1920x0"; + }; + home_2 = { + monitors = { + "LG Display 0x0637" = { }; + "Dell Inc. DELL P2412H TTMDG2AQ15EU".position = "1920x0"; + "LG Electronics E2210 205NDMT1D051".position = "3840x0"; + }; + workspaces = { + "1" = "monitor:desc:Dell Inc. DELL P2412H TTMDG2AQ15EU, default:true"; + "2" = "monitor:desc:LG Electronics E2210 205NDMT1D051, default:true"; + "10" = "monitor:desc:LG Display 0x0637, default:true"; + }; + }; + office = { + monitors = { + "LG Display 0x0637" = { }; + "Acer Technologies CB271HU T85EE0018511".position = "1920x0"; + }; + workspaces = { + "1" = "monitor:desc:LG Display 0x0637, default:true"; + "2" = "monitor:desc:Acer Technologies CB271HU T85EE0018511"; + "5" = "monitor:desc:Acer Technologies CB271HU T85EE0018511, default:true"; + "9" = "monitor:desc:Acer Technologies CB271HU T85EE0018511"; + }; + }; + tv.monitors = { + "LG Display 0x0637" = { }; + "Samsung Electric Company SAMSUNG" = { + position = "auto"; + mirror = "LG Display 0x0637"; + }; + }; + }; + }; + }; +} diff --git a/components/modules/desktop/useful-utilities/myKanshiPlus/module.nix b/components/modules/desktop/useful-utilities/myKanshiPlus/module.nix new file mode 100644 index 0000000..7c49904 --- /dev/null +++ b/components/modules/desktop/useful-utilities/myKanshiPlus/module.nix @@ -0,0 +1,145 @@ +{ ... }: + +{ + flake.modules.homeManager.myKanshiPlusModule = + { + config, + lib, + pkgs, + ... + }: + + let + myKanshiPlus = pkgs.writers.writePython3Bin "myKanshiPlus" { + libraries = [ ]; + flakeIgnore = [ "E501" ]; + } ./script.py; + + cfg = config.programs.myKanshiPlus; + inherit (lib.types) + attrsOf + enum + float + int + nullOr + oneOf + submodule + str + ; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.modules) mkIf; + + monitor = submodule { + options = { + resolution = mkOption { + type = str; + default = "preferred"; + example = "1920x1080"; + description = "resolution of the monitor or preferred for preferred resolution of the monitor"; + }; + position = mkOption { + type = str; + default = "0x0"; + example = "auto"; + description = "either x (from top-left corner) or auto (next to the previous monitor)"; + }; + scale = mkOption { + type = oneOf [ + int + float + (enum [ "auto" ]) + ]; + default = 1; + example = "auto"; + description = "scale the monitor or let hyprland decide with auto"; + }; + mirror = mkOption { + type = nullOr str; + default = null; + example = "LG Display 0x0637"; + description = "description of the monitor to mirror"; + }; + transform = mkOption { + type = nullOr int; + default = null; + example = 2; + description = "see https://wiki.hyprland.org/Configuring/Monitors/#rotating"; + }; + }; + }; + + profile = submodule { + options = { + monitors = mkOption { + type = attrsOf monitor; + default = { }; + example = { + "Dell Inc. DELL P2412H TTMDG2AQ15EU" = { }; + "LG Electronics E2210 205NDMT1D051" = { + resolution = "1680x1050"; + position = "1920x0"; + }; + }; + description = "Attribute set of monitor configurations. The keys are the monitor descriptions and the values are attribute sets of the monitor configuration."; + }; + workspaces = mkOption { + type = attrsOf str; + default = { }; + example = { + "5" = "monitor:desc:Acer Technologies CB271HU T85EE0018511, default:true, on-created-empty:firefox"; + "name:test" = "rounding:false, border:false"; + }; + description = "Attribute set of workspace configurations. The keys are the workspace identifiers and the values are one (or more) rule(s) to apply to the workspace."; + }; + }; + }; + in + + { + options.programs.myKanshiPlus = { + enable = mkEnableOption "myKanshiPlus"; + profiles = mkOption { + description = "Attribute set of monitor profiles"; + type = attrsOf profile; + default = { }; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ myKanshiPlus ]; + + xdg.configFile."myKanshiPlus/config.json".text = builtins.toJSON cfg.profiles; + + systemd.user.services.myKanshiPlus = { + Unit = { + Description = "Dynamic display configuration"; + After = [ config.wayland.systemd.target ]; + PartOf = [ config.wayland.systemd.target ]; + Requires = [ config.wayland.systemd.target ]; + }; + Service = { + ExecStart = "${lib.getExe myKanshiPlus}"; + Restart = "always"; + RestartSec = 10; + Environment = "PYTHONUNBUFFERED=1"; # print statements will go to journalctl immediately + }; + Install = { + WantedBy = [ config.wayland.systemd.target ]; + }; + }; + + wayland.windowManager.hyprland.settings = { + source = [ + "./monitors.conf" + "./workspaces.conf" + ]; + }; + + home.activation.myKanshiPlus = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + run [ -f ~/.config/hypr/monitors.conf ] || touch ~/.config/hypr/monitors.conf + run [ -f ~/.config/hypr/workspaces.conf ] || touch ~/.config/hypr/workspaces.conf + ''; + }; + + }; +} diff --git a/modules/home-manager/wm/useful_utilities/myKanshiPlus/script.py b/components/modules/desktop/useful-utilities/myKanshiPlus/script.py similarity index 100% rename from modules/home-manager/wm/useful_utilities/myKanshiPlus/script.py rename to components/modules/desktop/useful-utilities/myKanshiPlus/script.py diff --git a/components/modules/desktop/useful-utilities/nm-applet.nix b/components/modules/desktop/useful-utilities/nm-applet.nix new file mode 100644 index 0000000..34c3d36 --- /dev/null +++ b/components/modules/desktop/useful-utilities/nm-applet.nix @@ -0,0 +1,10 @@ +{ ... }: + +{ + flake.modules.homeManager.nmApplet = + { ... }: + + { + services.network-manager-applet.enable = true; + }; +} diff --git a/components/modules/desktop/useful-utilities/nwg-displays.nix b/components/modules/desktop/useful-utilities/nwg-displays.nix new file mode 100644 index 0000000..90ab832 --- /dev/null +++ b/components/modules/desktop/useful-utilities/nwg-displays.nix @@ -0,0 +1,26 @@ +{ ... }: + +{ + flake.modules.homeManager.nwgDisplays = + { lib, pkgs, ... }: + + { + home.packages = with pkgs; [ + nwg-displays + wlr-randr + ]; + + wayland.windowManager.hyprland.settings = { + source = [ + "./monitors.conf" + "./workspaces.conf" + ]; + bind = [ "$mainMod, P, exec, nwg-displays" ]; + }; + + home.activation.myNwgDisplay = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + run [ -f ~/.config/hypr/monitors.conf ] || touch ~/.config/hypr/monitors.conf + run [ -f ~/.config/hypr/workspaces.conf ] || touch ~/.config/hypr/workspaces.conf + ''; + }; +} diff --git a/components/modules/desktop/useful-utilities/screenshot.nix b/components/modules/desktop/useful-utilities/screenshot.nix new file mode 100644 index 0000000..c0fc0e1 --- /dev/null +++ b/components/modules/desktop/useful-utilities/screenshot.nix @@ -0,0 +1,23 @@ +{ ... }: + +{ + flake.modules.homeManager.screenshot = + { pkgs, lib, ... }: + + { + wayland.windowManager.hyprland.settings = { + bind = [ + "CTRL + ALT, S, exec, ${pkgs.wl-clipboard}/bin/wl-paste | ${lib.getExe pkgs.swappy} -f -" + ", Print, exec, ${lib.getExe pkgs.grimblast} --notify --freeze copy area" + ]; + layerrule = [ + "match:namespace hyprpicker, no_anim on" + "match:namespace selection, no_anim on" + ]; + permission = [ + "${lib.getExe pkgs.grim}, screencopy, allow" + "${lib.getExe pkgs.hyprpicker}, screencopy, allow" # required for freezing the screen when selecting area + ]; + }; + }; +} diff --git a/modules/home-manager/wm/useful_utilities/swaync/configs/config.json b/components/modules/desktop/useful-utilities/swaync/configs/config.json similarity index 100% rename from modules/home-manager/wm/useful_utilities/swaync/configs/config.json rename to components/modules/desktop/useful-utilities/swaync/configs/config.json diff --git a/modules/home-manager/wm/useful_utilities/swaync/configs/configSchema.json b/components/modules/desktop/useful-utilities/swaync/configs/configSchema.json similarity index 100% rename from modules/home-manager/wm/useful_utilities/swaync/configs/configSchema.json rename to components/modules/desktop/useful-utilities/swaync/configs/configSchema.json diff --git a/modules/home-manager/wm/useful_utilities/swaync/configs/style.css b/components/modules/desktop/useful-utilities/swaync/configs/style.css similarity index 100% rename from modules/home-manager/wm/useful_utilities/swaync/configs/style.css rename to components/modules/desktop/useful-utilities/swaync/configs/style.css diff --git a/modules/home-manager/wm/useful_utilities/swaync/configs/style.css.orig b/components/modules/desktop/useful-utilities/swaync/configs/style.css.orig similarity index 100% rename from modules/home-manager/wm/useful_utilities/swaync/configs/style.css.orig rename to components/modules/desktop/useful-utilities/swaync/configs/style.css.orig diff --git a/components/modules/desktop/useful-utilities/swaync/default.nix b/components/modules/desktop/useful-utilities/swaync/default.nix new file mode 100644 index 0000000..38e53d3 --- /dev/null +++ b/components/modules/desktop/useful-utilities/swaync/default.nix @@ -0,0 +1,26 @@ +{ ... }: + +{ + flake.modules.homeManager.swaync = + { pkgs, ... }: + + { + home.packages = [ + pkgs.swaynotificationcenter + ]; + + wayland.windowManager.hyprland.settings = { + bind = [ "$mainMod, N, exec, swaync-client -t -sw" ]; + exec-once = [ "swaync" ]; + layerrule = [ + "match:namespace swaync-control-center, blur on, ignore_alpha, animation popin 90%" + "match:namespace swaync-notification-window, blur on, ignore_alpha, animation popin" + ]; + }; + + xdg.configFile."swaync" = { + source = ./configs; + recursive = true; + }; + }; +} diff --git a/components/modules/desktop/useful-utilities/swww.nix b/components/modules/desktop/useful-utilities/swww.nix new file mode 100644 index 0000000..2e44f5a --- /dev/null +++ b/components/modules/desktop/useful-utilities/swww.nix @@ -0,0 +1,25 @@ +{ self, ... }: + +{ + flake.modules.homeManager.swww = + { pkgs, config, ... }: + + { + home.packages = [ pkgs.swww ]; + wayland.windowManager.hyprland.settings = { + bind = [ + "CTRL + ALT, W, exec, ${ + self.packages.${pkgs.stdenv.hostPlatform.system}.selectWallpaperImage + } ${config.myUserConfig.wallpaperFolder} && ${ + self.packages.${pkgs.stdenv.hostPlatform.system}.updateWallpaperSwww + } --fallback ${../../../wallpaper/fallback.jpg}" + ]; + exec-once = [ + "sleep 1 && swww-daemon" + "sleep 2 && ${ + self.packages.${pkgs.stdenv.hostPlatform.system}.updateWallpaperSwww + } --fallback ${../../../wallpaper/fallback.jpg}" + ]; + }; + }; +} diff --git a/components/modules/desktop/useful-utilities/tofi.nix b/components/modules/desktop/useful-utilities/tofi.nix new file mode 100644 index 0000000..ab8078c --- /dev/null +++ b/components/modules/desktop/useful-utilities/tofi.nix @@ -0,0 +1,49 @@ +{ ... }: + +{ + flake.modules.homeManager.tofi = + { ... }: + + { + programs.tofi = { + enable = true; + settings = { + # General + font = "/run/current-system/sw/share/X11/fonts/NotoSansNerdFont-Regular.ttf"; + font-size = 14; + background-color = "#00000099"; + border-color = "#6400c8"; + prompt-text = ''" run: "''; + min-input-width = 120; + result-spacing = 15; + + # Dmenu + # anchor = "top"; + # width = "100%"; + # height = 36; + # horizontal = true; + # outline-width = 0; + # border-width = 0; + # padding-top = 5; + # padding-bottom = 0; + # padding-left = 0; + # padding-right = 0; + + # Rofi + width = "50%"; + height = "50%"; + outline-width = 2; + border-width = 2; + corner-radius = 15; + }; + }; + + wayland.windowManager.hyprland.settings = { + bindr = [ "$mainMod, $mainMod_L, exec, pkill --exact tofi-drun || tofi-drun --drun-launch=true" ]; + exec-once = [ "rm ~/.cache/tofi-drun" ]; + layerrule = [ + "match:namespace launcher, blur on, animation slide" + ]; + }; + }; +} diff --git a/components/modules/desktop/useful-utilities/waybar/default.nix b/components/modules/desktop/useful-utilities/waybar/default.nix new file mode 100644 index 0000000..c529db7 --- /dev/null +++ b/components/modules/desktop/useful-utilities/waybar/default.nix @@ -0,0 +1,39 @@ +{ self, ... }: + +{ + flake.modules.homeManager.waybar = + { pkgs, ... }: + + { + imports = with self.modules.homeManager; [ + waybarModules + waybarSettings + ]; + + home.packages = with pkgs; [ + pavucontrol + pywal + ]; + + programs.waybar = { + enable = true; + package = ( + pkgs.waybar.override { + withMediaPlayer = true; + } + ); + style = ./style.css; + }; + + wayland.windowManager.hyprland.settings = { + bind = [ + "CTRL + ALT, B, exec, ${./launch_waybar.sh}" + "CTRL + ALT, W, exec, ${./launch_waybar.sh}" + ]; + exec-once = [ "sleep 2 && ${./launch_waybar.sh}" ]; + layerrule = [ + "match:namespace waybar, blur on, blur_popups on, ignore_alpha 0.1" + ]; + }; + }; +} diff --git a/modules/home-manager/wm/useful_utilities/waybar/launch_waybar.sh b/components/modules/desktop/useful-utilities/waybar/launch_waybar.sh similarity index 100% rename from modules/home-manager/wm/useful_utilities/waybar/launch_waybar.sh rename to components/modules/desktop/useful-utilities/waybar/launch_waybar.sh diff --git a/components/modules/desktop/useful-utilities/waybar/modules.nix b/components/modules/desktop/useful-utilities/waybar/modules.nix new file mode 100644 index 0000000..e96f260 --- /dev/null +++ b/components/modules/desktop/useful-utilities/waybar/modules.nix @@ -0,0 +1,241 @@ +{ ... }: + +{ + flake.modules.homeManager.waybarModules = + { + config, + lib, + pkgs, + ... + }: + + { + xdg.configFile."waybar/modules.json".text = '' + { + // Workspaces + "hyprland/workspaces": { + "on-click": "activate", + "active-only": false, + "all-outputs": true, + "format": "{}", + "format-icons": { + "urgent": "", + "active": "", + "default": "" + }, + "persistent_workspaces": { + + } + }, + // Taskbar + "wlr/taskbar": { + "format": "{icon}", + "icon-size": 20, + "tooltip-format": "{title}", + "on-click": "activate", + "on-click-middle": "close", + }, + // Hyprland Window + "hyprland/window": { + "rewrite": { + "(.*) — Mozilla Firefox": "🌎 $1", + }, + "separate-outputs": true + }, + // Pulseaudio + "pulseaudio": { + "format": "{icon} {volume}%", + "format-bluetooth": " {icon} {volume}%", + "format-bluetooth-muted": "   ", + "format-muted": "  ", + "format-icons": { + "headphone": "", + "hands-free": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": [ + "󰕿", + "󰖀", + "󰕾" + ] + }, + "scroll-step": 1, + "reverse-scrolling": true, + "on-click-right": "pavucontrol", + "on-click": "pamixer -t", + "on-scroll-up": "pamixer -i 1", + "on-scroll-down": "pamixer -d 1", + }, + "pulseaudio#microphone": { + "format": "{format_source}", + "format-source": " {volume}%", + "format-source-muted": "  ", + "scroll-step": 1, + "reverse-scrolling": true, + "on-click-right": "pavucontrol", + "on-click": "pamixer --default-source -t", + "on-scroll-up": "pamixer --default-source -i 1", + "on-scroll-down": "pamixer --default-source -d 1", + }, + // Cliphist + "custom/cliphist": { + "format": "", + "on-click": "sleep 0.1 && ~/dotfiles/scripts/cliphist.sh", + "on-click-right": "sleep 0.1 && ~/dotfiles/scripts/cliphist.sh d", + "on-click-middle": "sleep 0.1 && ~/dotfiles/scripts/cliphist.sh w", + "tooltip": false + }, + // Keyboard State + "keyboard-state": { + "numlock": true, + "capslock": true, + "format": "{name} {icon}", + "format-icons": { + "locked": "", + "unlocked": "" + } + }, + // System tray + "tray": { + "icon-size": 20, + "spacing": 10 + }, + // Clock + "clock": { + "tooltip-format": "{:%Y %B}\n{calendar}", + "format-alt": "{:%Y-%m-%d}" + }, + // CPU + "cpu": { + "interval": 1, + "format": "C {usage}% / ", + "on-click": "${lib.getExe pkgs.alacritty} -e htop" + }, + // Memory + "memory": { + "interval": 1, + "format": "M {percentage}% / ", + "on-click": "${lib.getExe pkgs.alacritty} -e htop" + }, + // Temperature + "temperature": { + "thermal-zone": 6, + "format": "T {temperatureC}°C", + "interval": 1, + "on-click": "${lib.getExe pkgs.alacritty} -e htop" + }, + // Group hardware + "group/hardware": { + "orientation": "horizontal", + "modules": [ + "memory", + "cpu", + "temperature" + ] + }, + // Network + "network": { + "interval": 1, + "format": "{ifname}", + "format-wifi": " {signalStrength}%", + "format-ethernet": "", + "format-disconnected": "", //An empty format will hide the module. + "tooltip-format": "{ifname} via {gwaddri}", + "tooltip-format-wifi": " {essid} ({signalStrength}%)", + "tooltip-format-ethernet": " {ifname} ({ipaddr}/{cidr})", + "tooltip-format-disconnected": "Disconnected", + "max-length": 50 + }, + // Battery + "battery": { + "interval": 1, + "states": { + "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{icon} {capacity}%", + "format-charging": "  {capacity}%", + "format-plugged": " {capacity}%", + "format-full": " {capacity}%", + "format-alt": "{icon} {time}", + "format-icons": [ + " ", + " ", + " ", + " ", + " " + ] + }, + // Bluetooth + "bluetooth": { + "format-disabled": "", + "format-off": "", + "interval": 30, + "on-click-right": "blueman-manager" + }, + // Idle Inhibitor + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": " ", + "deactivated": " " + } + }, + // Backlight + "backlight": { + "device": "intel_backlight", + "format": "{icon} {percent}%", + "format-icons": [ + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "reverse-scrolling": true, + }, + // Custom media + "custom/media": { + "format": "{icon} {}", + "return-type": "json", + "max-length": 40, + "format-icons": { + "spotify": "", + "default": "🎜" + }, + "escape": true, + // "exec": "${config.programs.waybar.package}/bin/waybar-mediaplayer.py 2> /dev/null" // Script in resources folder + "exec": "${config.programs.waybar.package}/bin/waybar-mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name + }, + //Custom notification + "custom/notification": { + "tooltip": false, + "format": "{icon} ", + "format-icons": { + "notification": "", + "none": "", + "dnd-notification": "", + "dnd-none": "", + "inhibited-notification": "", + "inhibited-none": "", + "dnd-inhibited-notification": "", + "dnd-inhibited-none": "" + }, + "return-type": "json", + "exec-if": "which swaync-client", + "exec": "swaync-client -swb", + "on-click": "sleep 0.2 && swaync-client -t -sw", + "on-click-right": "swaync-client -d -sw", + "escape": true + }, + } + ''; + }; +} diff --git a/components/modules/desktop/useful-utilities/waybar/settings.nix b/components/modules/desktop/useful-utilities/waybar/settings.nix new file mode 100644 index 0000000..ade766b --- /dev/null +++ b/components/modules/desktop/useful-utilities/waybar/settings.nix @@ -0,0 +1,38 @@ +{ ... }: + +{ + flake.modules.homeManager.waybarSettings = + { ... }: + + { + programs.waybar.settings.mainBar = { + layer = "top"; # Waybar at top layer + # position = "bottom"; # Waybar position (top|bottom|left|right) + height = 30; # Waybar height (to be removed for auto height) + # width = 1280; # Waybar width + spacing = 4; # Gaps between modules (4px) + + # Load modules + include = [ "~/.config/waybar/modules.json" ]; + # include = ["~/.config/waybar/modules.json.orig"]; + + # Choose the order of the modules + modules-left = [ + "wlr/taskbar" + "hyprland/window" + "custom/media" + ]; + modules-center = [ "hyprland/workspaces" ]; + modules-right = [ + "tray" + "idle_inhibitor" + "pulseaudio" + "pulseaudio#microphone" + "backlight" + "battery" + "clock" + "custom/notification" + ]; + }; + }; +} diff --git a/modules/home-manager/wm/useful_utilities/waybar/style.css b/components/modules/desktop/useful-utilities/waybar/style.css similarity index 100% rename from modules/home-manager/wm/useful_utilities/waybar/style.css rename to components/modules/desktop/useful-utilities/waybar/style.css diff --git a/components/modules/desktop/xserver.nix b/components/modules/desktop/xserver.nix new file mode 100644 index 0000000..2eabf76 --- /dev/null +++ b/components/modules/desktop/xserver.nix @@ -0,0 +1,14 @@ +{ ... }: + +{ + flake.modules.nixos.xserver = + { config, ... }: + + { + # Enable the X11 windowing system and configure keymap in X11 + services.xserver = { + enable = true; + xkb.layout = config.mySystemConfig.kblayout; + }; + }; +} diff --git a/components/modules/devel/alacritty.nix b/components/modules/devel/alacritty.nix new file mode 100644 index 0000000..13dc1e0 --- /dev/null +++ b/components/modules/devel/alacritty.nix @@ -0,0 +1,21 @@ +{ ... }: + +{ + flake.modules.homeManager.alacritty = + { ... }: + + { + programs.alacritty = { + enable = true; + settings = { + cursor.style = { + blinking = "On"; + shape = "Beam"; + }; + selection.save_to_clipboard = true; + window.opacity = 0.75; + font.normal.family = "Hack Nerd Font Mono"; + }; + }; + }; +} diff --git a/components/modules/devel/git.nix b/components/modules/devel/git.nix new file mode 100644 index 0000000..c12c6ad --- /dev/null +++ b/components/modules/devel/git.nix @@ -0,0 +1,26 @@ +{ ... }: + +{ + flake.modules.homeManager.git = + { config, pkgs, ... }: + + { + home.packages = with pkgs; [ + glab + ]; + + programs.git = { + enable = true; + settings = { + user = { + name = config.myUserConfig.name; + email = config.myUserConfig.email; + }; + fetch.prune = true; + }; + signing.format = "openpgp"; + }; + + programs.gh.enable = true; + }; +} diff --git a/components/modules/devel/latex.nix b/components/modules/devel/latex.nix new file mode 100644 index 0000000..9081a91 --- /dev/null +++ b/components/modules/devel/latex.nix @@ -0,0 +1,19 @@ +{ ... }: + +{ + flake.modules.homeManager.latex = + { pkgs, ... }: + + { + home.packages = with pkgs; [ + ipe + # jabref + pympress + ]; + + programs.texlive = { + enable = true; + extraPackages = (tpkgs: { inherit (tpkgs) scheme-full; }); + }; + }; +} diff --git a/components/modules/devel/python.nix b/components/modules/devel/python.nix new file mode 100644 index 0000000..9cc4423 --- /dev/null +++ b/components/modules/devel/python.nix @@ -0,0 +1,16 @@ +{ ... }: + +{ + flake.modules.homeManager.python = + { pkgs, ... }: + + { + home.packages = with pkgs; [ + micromamba + ]; + + programs.zsh = { + initContent = "eval \"$(micromamba shell hook --shell zsh)\""; + }; + }; +} diff --git a/components/modules/devel/vscode/default.nix b/components/modules/devel/vscode/default.nix new file mode 100644 index 0000000..629a6dc --- /dev/null +++ b/components/modules/devel/vscode/default.nix @@ -0,0 +1,64 @@ +{ ... }: + +{ + flake.modules.homeManager.vscode = + { + config, + lib, + pkgs, + ... + }: + + let + vscodePackage = if pkgs.stdenv.isLinux then pkgs.vscode-fhs else pkgs.vscode; + in + { + programs.vscode = { + enable = true; + package = vscodePackage; + profiles.default.extensions = + with (pkgs.forVSCodeVersion vscodePackage.version).vscode-marketplace; [ + aaron-bond.better-comments + charliermarsh.ruff + corker.vscode-micromamba + # github.copilot # install copilot manually (will fetch correct version of copilot-chat) + # github.copilot-chat + gruntfuggly.todo-tree + james-yu.latex-workshop + jnoortheen.nix-ide + k--kato.intellij-idea-keybindings + ms-python.python + ms-python.vscode-pylance + # ms-toolsai.jupyter # you have to install jupyter manually for some reason + # ms-toolsai.jupyter-keymap + # ms-toolsai.jupyter-renderers + # ms-toolsai.vscode-jupyter-cell-tags + # ms-toolsai.vscode-jupyter-slideshow + naumovs.color-highlight + njpwerner.autodocstring + patbenatar.advanced-new-file + pkief.material-icon-theme + # valentjn.vscode-ltex # install ltex manually (it wants to download the language server but fails when attempting to write to read-only /nix/store) + ]; + }; + + home.packages = with pkgs; [ + nixd # language server + nixfmt-rfc-style # formatter + ]; + + home.activation = { + myVscodeFiles = + let + vscodePath = + if pkgs.stdenv.isLinux then "~/.config/Code" else "~/Library/Application\\ Support/Code"; + targetDirectory = "${config.myUserConfig.flakeDirectory}/components/modules/devel/vscode"; + in + lib.hm.dag.entryAfter [ "writeBoundary" ] '' + run mkdir -p ${vscodePath}/User + run ln -sf ${targetDirectory}/keybindings.json ${vscodePath}/User/keybindings.json + run ln -sf ${targetDirectory}/settings.json ${vscodePath}/User/settings.json + ''; + }; + }; +} diff --git a/modules/home-manager/devel/vscode/keybindings.json b/components/modules/devel/vscode/keybindings.json similarity index 100% rename from modules/home-manager/devel/vscode/keybindings.json rename to components/modules/devel/vscode/keybindings.json diff --git a/modules/home-manager/devel/vscode/settings.json b/components/modules/devel/vscode/settings.json similarity index 96% rename from modules/home-manager/devel/vscode/settings.json rename to components/modules/devel/vscode/settings.json index dab9d8c..ce11974 100644 --- a/modules/home-manager/devel/vscode/settings.json +++ b/components/modules/devel/vscode/settings.json @@ -68,4 +68,6 @@ "update.mode": "none", "workbench.enableExperiments": false, "workbench.settings.enableNaturalLanguageSearch": false, + "chat.viewSessions.orientation": "stacked", + "claudeCode.preferredLocation": "panel", } diff --git a/components/modules/devel/vscode/test_vsextensions_with_nix4vscode/extensions/default.nix b/components/modules/devel/vscode/test_vsextensions_with_nix4vscode/extensions/default.nix new file mode 100644 index 0000000..05f5784 --- /dev/null +++ b/components/modules/devel/vscode/test_vsextensions_with_nix4vscode/extensions/default.nix @@ -0,0 +1,41 @@ +{ ... }: + +{ + flake.modules.homeManager.default = + with import { + overlays = [ + (import (fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz")) + ]; + }; + + let + rustPlatform = makeRustPlatform { + cargo = rust-bin.selectLatestNightlyWith (toolchain: toolchain.default); + rustc = rust-bin.selectLatestNightlyWith (toolchain: toolchain.default); + }; + in + + rustPlatform.buildRustPackage rec { + pname = "nix4vscode"; + version = "unstable-2024-03-18"; + + src = fetchFromGitHub { + owner = "nix-community"; + repo = pname; + rev = "06e9ed7c9dcf0e5594647bd7d1a94b0023d11b31"; + hash = "sha256-7RiMkuDO0GlzM3+oHUM/3HQBZWY5j+/9SEqCunIceYE="; + }; + + cargoHash = "sha256-LB1yOnVqeCamZSm0YNjvoeiClxuXTiIZ64D6vZ0Un8w="; + + doCheck = false; + + meta = with lib; { + description = "A tool generate nix expression from config.toml"; + homepage = "https://github.com/nix-community/nix4vscode"; + mainProgram = "nix4vscode"; + platforms = platforms.linux; + }; + + }; +} diff --git a/components/modules/devel/vscode/test_vsextensions_with_nix4vscode/extensions/extensions.nix b/components/modules/devel/vscode/test_vsextensions_with_nix4vscode/extensions/extensions.nix new file mode 100644 index 0000000..47e994b --- /dev/null +++ b/components/modules/devel/vscode/test_vsextensions_with_nix4vscode/extensions/extensions.nix @@ -0,0 +1,202 @@ +{ ... }: + +{ + flake.modules.homeManager.extensions = + { pkgs, lib }: + + let + inherit (pkgs.stdenv) + isDarwin + isLinux + isi686 + isx86_64 + isAarch32 + isAarch64 + ; + vscode-utils = pkgs.vscode-utils; + merge = lib.attrsets.recursiveUpdate; + in + merge + (merge + (merge + (merge + { + "ms-python"."python" = vscode-utils.extensionFromVscodeMarketplace { + name = "python"; + publisher = "ms-python"; + version = "2024.3.10742127"; + sha256 = "187x6j7300wgvcxh2lcic6ivvavsllzhq0cayqiji943pw3z3k2r"; + }; + "ms-toolsai"."jupyter-keymap" = vscode-utils.extensionFromVscodeMarketplace { + name = "jupyter-keymap"; + publisher = "ms-toolsai"; + version = "1.1.2"; + sha256 = "02rb4r5zspicj2c7ffrr6xj6dmk0948lnl2f8f89xlfrkh2z44pl"; + }; + "ms-toolsai"."jupyter-renderers" = vscode-utils.extensionFromVscodeMarketplace { + name = "jupyter-renderers"; + publisher = "ms-toolsai"; + version = "1.0.17"; + sha256 = "1c065s2cllf2x90i174qs2qyzywrlsjkc6agcc9qvdsb426c6r9l"; + }; + "ms-toolsai"."vscode-jupyter-cell-tags" = vscode-utils.extensionFromVscodeMarketplace { + name = "vscode-jupyter-cell-tags"; + publisher = "ms-toolsai"; + version = "0.1.8"; + sha256 = "14zzr0dyr110yn53d984bk6hdn0mgva4jxvxzihvsn6lv6kg50yj"; + }; + "ms-toolsai"."vscode-jupyter-slideshow" = vscode-utils.extensionFromVscodeMarketplace { + name = "vscode-jupyter-slideshow"; + publisher = "ms-toolsai"; + version = "0.1.5"; + sha256 = "1p6r5vkzvwvxif3wxqi9599vplabzig27fzzz0bx9z0awfglzyi7"; + }; + "pkief"."material-icon-theme" = vscode-utils.extensionFromVscodeMarketplace { + name = "material-icon-theme"; + publisher = "pkief"; + version = "4.34.0"; + sha256 = "1ahshxw66436mc9jpiyfac0hinnqm3s0g3akybjrda13yd9884y7"; + }; + "github"."copilot" = vscode-utils.extensionFromVscodeMarketplace { + name = "copilot"; + publisher = "github"; + version = "1.174.0"; + sha256 = "1id269bhgczb9m6lml6zaihglyz5l88y48xrs8v1hgqk32z30gza"; + }; + "njpwerner"."autodocstring" = vscode-utils.extensionFromVscodeMarketplace { + name = "autodocstring"; + publisher = "njpwerner"; + version = "0.6.1"; + sha256 = "11vsvr3pggr6xn7hnljins286x6f5am48lx4x8knyg8r7dp1r39l"; + }; + "github"."copilot-chat" = vscode-utils.extensionFromVscodeMarketplace { + name = "copilot-chat"; + publisher = "github"; + version = "0.13.2024022301"; + sha256 = "0bwg242sr1wi6dv7h8509xz499bg2vqk9p3z9jmai0vb8wn27njr"; + }; + "naumovs"."color-highlight" = vscode-utils.extensionFromVscodeMarketplace { + name = "color-highlight"; + publisher = "naumovs"; + version = "2.8.0"; + sha256 = "14capk3b7rs105ij4pjz42zsysdfnkwfjk9lj2cawnqxa7b8ygcr"; + }; + "aaron-bond"."better-comments" = vscode-utils.extensionFromVscodeMarketplace { + name = "better-comments"; + publisher = "aaron-bond"; + version = "3.0.2"; + sha256 = "15w1ixvp6vn9ng6mmcmv9ch0ngx8m85i1yabxdfn6zx3ypq802c5"; + }; + "james-yu"."latex-workshop" = vscode-utils.extensionFromVscodeMarketplace { + name = "latex-workshop"; + publisher = "james-yu"; + version = "9.19.1"; + sha256 = "15k0kd12kkgsxgdr8rw3379gbgffdcxw6hb2fzsca9n32bkwym1i"; + }; + "k--kato"."intellij-idea-keybindings" = vscode-utils.extensionFromVscodeMarketplace { + name = "intellij-idea-keybindings"; + publisher = "k--kato"; + version = "1.6.0"; + sha256 = "0sq9ga1xnnkzrvvnw54a3lqb1cy45b78v86j5mrx3g8jmqqnr03n"; + }; + "patbenatar"."advanced-new-file" = vscode-utils.extensionFromVscodeMarketplace { + name = "advanced-new-file"; + publisher = "patbenatar"; + version = "1.2.2"; + sha256 = "09a6yldbaz9d7gn9ywkqd96l3pkc0y30b6b02nv2qigli6aihm6g"; + }; + "znck"."grammarly" = vscode-utils.extensionFromVscodeMarketplace { + name = "grammarly"; + publisher = "znck"; + version = "0.25.0"; + sha256 = "048bahfaha3i6sz1b5jkyhfd2aiwgpkmyy2i7hlzc45g1289827z"; + }; + "jnoortheen"."nix-ide" = vscode-utils.extensionFromVscodeMarketplace { + name = "nix-ide"; + publisher = "jnoortheen"; + version = "0.3.1"; + sha256 = "1cpfckh6zg8byi6x1llkdls24w9b0fvxx4qybi9zfcy5gc60r6nk"; + }; + "corker"."vscode-micromamba" = vscode-utils.extensionFromVscodeMarketplace { + name = "vscode-micromamba"; + publisher = "corker"; + version = "0.1.20"; + sha256 = "0y0382wgyn1rvzgn9f8fsr34zbw3w4ynp6xll3fgz299nz9rr0gz"; + }; + } + ( + lib.attrsets.optionalAttrs (isLinux && (isi686 || isx86_64)) { + "ms-toolsai"."jupyter" = vscode-utils.extensionFromVscodeMarketplace { + name = "jupyter"; + publisher = "ms-toolsai"; + version = "2024.2.2024022602"; + sha256 = "1j61qbbskq9pjxkis042k6ainmsmc2vc70wyxrk298n1a94mfqsy"; + arch = "linux-x64"; + }; + "charliermarsh"."ruff" = vscode-utils.extensionFromVscodeMarketplace { + name = "ruff"; + publisher = "charliermarsh"; + version = "2024.16.0"; + sha256 = "1qha198h9zp95wf6fqd7zagk0pcd5vxxx4n7n1kqb29n78zk56yr"; + arch = "linux-x64"; + }; + } + ) + ) + ( + lib.attrsets.optionalAttrs (isLinux && (isAarch32 || isAarch64)) { + "ms-toolsai"."jupyter" = vscode-utils.extensionFromVscodeMarketplace { + name = "jupyter"; + publisher = "ms-toolsai"; + version = "2024.2.2024022602"; + sha256 = "1709nsasjcpjcjhyvjimyz1q1sq1f3zi6276d7pxpysivpz0h4jz"; + arch = "linux-arm64"; + }; + "charliermarsh"."ruff" = vscode-utils.extensionFromVscodeMarketplace { + name = "ruff"; + publisher = "charliermarsh"; + version = "2024.16.0"; + sha256 = "1b3zrm58zjr4v7n1gfklx6n8w2ywhgr5l1g596qpa1fab0pljkz3"; + arch = "linux-arm64"; + }; + } + ) + ) + ( + lib.attrsets.optionalAttrs (isDarwin && (isi686 || isx86_64)) { + "ms-toolsai"."jupyter" = vscode-utils.extensionFromVscodeMarketplace { + name = "jupyter"; + publisher = "ms-toolsai"; + version = "2024.2.2024022602"; + sha256 = "0am5837rfzwc1j3zy01lmmd8803x498k88gyp7ibl0jqpkqk8wl1"; + arch = "darwin-x64"; + }; + "charliermarsh"."ruff" = vscode-utils.extensionFromVscodeMarketplace { + name = "ruff"; + publisher = "charliermarsh"; + version = "2024.16.0"; + sha256 = "0cvh1bk0kb1xp3b733fn6ny0zyv5fk744yccw3kaa15gk7c05v6q"; + arch = "darwin-x64"; + }; + } + ) + ) + ( + lib.attrsets.optionalAttrs (isDarwin && (isAarch32 || isAarch64)) { + "ms-toolsai"."jupyter" = vscode-utils.extensionFromVscodeMarketplace { + name = "jupyter"; + publisher = "ms-toolsai"; + version = "2024.2.2024022602"; + sha256 = "0h1l3nidzq8n3d8z5jingbdv5hckb8wg1609cmn89hyjnafwvmwy"; + arch = "darwin-arm64"; + }; + "charliermarsh"."ruff" = vscode-utils.extensionFromVscodeMarketplace { + name = "ruff"; + publisher = "charliermarsh"; + version = "2024.16.0"; + sha256 = "042nf94k66kkhr6ydb8kx5b00v45wnly8vvpyn8z0c2lbxc74hbk"; + arch = "darwin-arm64"; + }; + } + ); +} diff --git a/modules/home-manager/devel/vscode/test_vsextensions_with_nix4vscode/extensions/extensions.toml b/components/modules/devel/vscode/test_vsextensions_with_nix4vscode/extensions/extensions.toml similarity index 100% rename from modules/home-manager/devel/vscode/test_vsextensions_with_nix4vscode/extensions/extensions.toml rename to components/modules/devel/vscode/test_vsextensions_with_nix4vscode/extensions/extensions.toml diff --git a/modules/home-manager/devel/vscode/test_vsextensions_with_nix4vscode/extensions/nix4vscode b/components/modules/devel/vscode/test_vsextensions_with_nix4vscode/extensions/nix4vscode similarity index 100% rename from modules/home-manager/devel/vscode/test_vsextensions_with_nix4vscode/extensions/nix4vscode rename to components/modules/devel/vscode/test_vsextensions_with_nix4vscode/extensions/nix4vscode diff --git a/components/modules/devel/vscode/test_vsextensions_with_nix4vscode/extensions/pylance.nix b/components/modules/devel/vscode/test_vsextensions_with_nix4vscode/extensions/pylance.nix new file mode 100644 index 0000000..202d068 --- /dev/null +++ b/components/modules/devel/vscode/test_vsextensions_with_nix4vscode/extensions/pylance.nix @@ -0,0 +1,18 @@ +{ ... }: + +{ + flake.modules.homeManager.pylance = + { pkgs, lib }: + + let + vscode-utils = pkgs.vscode-utils; + in + { + "ms-python"."vscode-pylance" = vscode-utils.extensionFromVscodeMarketplace { + name = "vscode-pylance"; + publisher = "ms-python"; + version = "2023.6.40"; + sha256 = "sha256-J5nRoQjUVKaMqs0QJFY0vzutjWZ9dH6O7FXI+ZZIaBQ="; + }; + }; +} diff --git a/components/modules/devel/vscode/test_vsextensions_with_nix4vscode/vscodium.nix b/components/modules/devel/vscode/test_vsextensions_with_nix4vscode/vscodium.nix new file mode 100644 index 0000000..32c7d07 --- /dev/null +++ b/components/modules/devel/vscode/test_vsextensions_with_nix4vscode/vscodium.nix @@ -0,0 +1,61 @@ +{ ... }: + +{ + flake.modules.homeManager.vscodium = + { + lib, + pkgs, + inputs, + config, + ... + }: + + let + # configure extensions + myExtensions = pkgs.callPackage ./extensions/extensions.nix { }; + myPylance = pkgs.callPackage ./extensions/pylance.nix { }; + vscodePackage = pkgs.vscodium-fhs; + in + { + programs.vscode = { + enable = true; + package = vscodePackage; + extensions = with myExtensions; [ + aaron-bond.better-comments + charliermarsh.ruff + corker.vscode-micromamba + github.copilot + github.copilot-chat + james-yu.latex-workshop + jnoortheen.nix-ide + k--kato.intellij-idea-keybindings + ms-python.python + myPylance.ms-python.vscode-pylance + ms-toolsai.jupyter + ms-toolsai.jupyter-keymap + ms-toolsai.jupyter-renderers + ms-toolsai.vscode-jupyter-cell-tags + ms-toolsai.vscode-jupyter-slideshow + naumovs.color-highlight + njpwerner.autodocstring + patbenatar.advanced-new-file + pkief.material-icon-theme + znck.grammarly + ]; + }; + + home.activation = { + myVscodeFiles = + let + vscodePath = "~/.config/VSCodium"; + targetDirectory = "${config.myUserConfig.flakeDirectory}/modules/home-manager/devel/vscodium"; + in + lib.hm.dag.entryAfter [ "writeBoundary" ] '' + run mkdir -p ${vscodePath}/User + run ln -sf ${targetDirectory}/product.json ${vscodePath}/product.json + run ln -sf ${targetDirectory}/keybindings.json ${vscodePath}/User/keybindings.json + run ln -sf ${targetDirectory}/settings.json ${vscodePath}/User/settings.json + ''; + }; + }; +} diff --git a/components/modules/devel/wezterm.nix b/components/modules/devel/wezterm.nix new file mode 100644 index 0000000..996c906 --- /dev/null +++ b/components/modules/devel/wezterm.nix @@ -0,0 +1,58 @@ +{ ... }: + +{ + flake.modules.homeManager.wezterm = + { pkgs, ... }: + let + fontSize = if pkgs.stdenv.isLinux then "11" else "13"; + in + { + programs.wezterm = { + enable = true; + extraConfig = '' + -- Pull in the wezterm API + local wezterm = require 'wezterm' + + -- This will hold the configuration. + local config = wezterm.config_builder() + + -- This is where you actually apply your config choices. + + config.font_size = ${fontSize} + config.font = wezterm.font "JetBrainsMono Nerd Font" + config.hide_tab_bar_if_only_one_tab = true + config.window_background_opacity = 0.75 + config.macos_window_background_blur = 100 + config.kde_window_background_blur = true + config.default_cursor_style = "BlinkingBar" + config.cursor_blink_rate = 500 + config.enable_scroll_bar = true + + config.keys = { + -- Rebind OPT-Left, OPT-Right as ALT-b, ALT-f respectively + { + key = 'LeftArrow', + mods = 'OPT', + action = wezterm.action.SendKey { + key = 'b', + mods = 'ALT', + }, + }, + { + key = 'RightArrow', + mods = 'OPT', + action = wezterm.action.SendKey { key = 'f', mods = 'ALT' }, + }, + { + key = 'Enter', + mods = 'ALT', + action = wezterm.action.DisableDefaultAssignment, + }, + } + + -- Finally, return the configuration to wezterm: + return config + ''; + }; + }; +} diff --git a/components/modules/hardware/accelerated-video-playback.nix b/components/modules/hardware/accelerated-video-playback.nix new file mode 100644 index 0000000..00c72e2 --- /dev/null +++ b/components/modules/hardware/accelerated-video-playback.nix @@ -0,0 +1,15 @@ +{ ... }: + +{ + flake.modules.nixos.acceleratedVideoPlayback = + { pkgs, ... }: + + # https://wiki.nixos.org/wiki/Accelerated_Video_Playback + { + hardware.graphics = { + extraPackages = with pkgs; [ + libvdpau-va-gl + ]; + }; + }; +} diff --git a/components/modules/hardware/automount.nix b/components/modules/hardware/automount.nix new file mode 100644 index 0000000..0b813fb --- /dev/null +++ b/components/modules/hardware/automount.nix @@ -0,0 +1,15 @@ +{ ... }: + +{ + flake.modules.nixos.automount = + { pkgs, ... }: + + { + services.devmon.enable = true; + services.gvfs.enable = true; + services.udisks2.enable = true; + environment.systemPackages = with pkgs; [ + ntfs3g + ]; + }; +} diff --git a/components/modules/hardware/bluetooth.nix b/components/modules/hardware/bluetooth.nix new file mode 100644 index 0000000..0a4e103 --- /dev/null +++ b/components/modules/hardware/bluetooth.nix @@ -0,0 +1,12 @@ +{ ... }: + +{ + flake.modules.nixos.bluetooth = + { ... }: + + { + # Bluetooth + hardware.bluetooth.enable = true; + services.blueman.enable = true; + }; +} diff --git a/components/modules/hardware/intel.nix b/components/modules/hardware/intel.nix new file mode 100644 index 0000000..61ba427 --- /dev/null +++ b/components/modules/hardware/intel.nix @@ -0,0 +1,26 @@ +{ ... }: + +{ + flake.modules.nixos.intel = + { pkgs, ... }: + + # https://wiki.nixos.org/wiki/Accelerated_Video_Playback + { + hardware.graphics = { + extraPackages = with pkgs; [ + intel-media-driver # LIBVA_DRIVER_NAME=iHD + intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) + + # OpenCL support (needed for hashcat) + intel-ocl + intel-compute-runtime + pocl + ocl-icd + ]; + }; + + environment.sessionVariables = { + LIBVA_DRIVER_NAME = "iHD"; + }; # Force intel-media-driver + }; +} diff --git a/components/modules/hardware/location-information.nix b/components/modules/hardware/location-information.nix new file mode 100644 index 0000000..2f872f2 --- /dev/null +++ b/components/modules/hardware/location-information.nix @@ -0,0 +1,10 @@ +{ ... }: + +{ + flake.modules.nixos.locationInformation = + { ... }: + + { + services.geoclue2.enable = true; + }; +} diff --git a/components/modules/hardware/networking.nix b/components/modules/hardware/networking.nix new file mode 100644 index 0000000..2d7c692 --- /dev/null +++ b/components/modules/hardware/networking.nix @@ -0,0 +1,16 @@ +{ ... }: + +{ + flake.modules.nixos.networking = + { pkgs, config, ... }: + + { + # Enable networking + networking.hostName = config.mySystemConfig.hostname; # Define your hostname. + networking.networkmanager.enable = true; + environment.systemPackages = [ pkgs.networkmanagerapplet ]; + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + services.resolved.enable = true; # needed for wireguard + }; +} diff --git a/components/modules/hardware/pipewire.nix b/components/modules/hardware/pipewire.nix new file mode 100644 index 0000000..11aeda4 --- /dev/null +++ b/components/modules/hardware/pipewire.nix @@ -0,0 +1,24 @@ +{ ... }: + +{ + flake.modules.nixos.pipewire = + { ... }: + + { + # Enable sound with pipewire. + services.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + + # use the example session manager (no others are packaged yet so this is enabled by default, + # no need to redefine it in your config for now) + #media-session.enable = true; + }; + }; +} diff --git a/components/modules/hardware/power.nix b/components/modules/hardware/power.nix new file mode 100644 index 0000000..b4ee968 --- /dev/null +++ b/components/modules/hardware/power.nix @@ -0,0 +1,37 @@ +{ ... }: + +{ + flake.modules.nixos.power = + { ... }: + + { + #services.auto-cpufreq.enable = true; + #services.auto-cpufreq.settings = { + # charger = { + # governor = "performance"; + # turbo = "auto"; + # }; + # battery = { + # governor = "schedutil"; + # scaling_max_freq = 3800000; + # turbo = "never"; + # }; + #}; + services.tlp = { + enable = true; + settings = { + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "schedutil"; + + CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; + CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; + + CPU_MIN_PERF_ON_AC = 0; + CPU_MAX_PERF_ON_AC = 100; + CPU_MIN_PERF_ON_BAT = 0; + CPU_MAX_PERF_ON_BAT = 80; + }; + }; + + }; +} diff --git a/components/modules/hardware/printing.nix b/components/modules/hardware/printing.nix new file mode 100644 index 0000000..a34c7cb --- /dev/null +++ b/components/modules/hardware/printing.nix @@ -0,0 +1,20 @@ +{ ... }: + +{ + flake.modules.nixos.printing = + { pkgs, ... }: + + { + # Enable CUPS to print documents + avahi for scanner detection + services.printing.enable = true; + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + environment.systemPackages = with pkgs; [ + cups-filters + system-config-printer + ]; + }; +} diff --git a/components/modules/security/remote.nix b/components/modules/security/remote.nix new file mode 100644 index 0000000..4949829 --- /dev/null +++ b/components/modules/security/remote.nix @@ -0,0 +1,12 @@ +{ ... }: + +{ + flake.modules.nixos.remote = + { ... }: + + { + services.teamviewer = { + enable = true; + }; + }; +} diff --git a/components/modules/security/run-binaries.nix b/components/modules/security/run-binaries.nix new file mode 100644 index 0000000..09eb1c5 --- /dev/null +++ b/components/modules/security/run-binaries.nix @@ -0,0 +1,19 @@ +{ ... }: + +{ + flake.modules.nixos.runBinaries = + # https://unix.stackexchange.com/questions/522822/different-methods-to-run-a-non-nixos-executable-on-nixos + # https://github.com/thiagokokada/nix-alien + { pkgs, options, ... }: + + { + programs.nix-ld = { + enable = true; + libraries = + options.programs.nix-ld.libraries.default + ++ (with pkgs; [ + # Add any missing dynamic libraries for unpackaged programs here, NOT in environment.systemPackages + ]); + }; + }; +} diff --git a/components/modules/server/fail2ban.nix b/components/modules/server/fail2ban.nix new file mode 100644 index 0000000..1b20ac9 --- /dev/null +++ b/components/modules/server/fail2ban.nix @@ -0,0 +1,24 @@ +{ ... }: + +{ + flake.modules.nixos.fail2ban = + { ... }: + + { + services.fail2ban = { + enable = true; + ignoreIP = [ ]; + bantime = "10m"; + maxretry = 5; + bantime-increment = { + enable = true; + maxtime = "168h"; + }; + # defaults that cannot be set as module options go here (module options are transformed to DEFAULT.settings options) + jails.DEFAULT.settings = { + findtime = "10m"; + dbpurgeage = "30d"; + }; + }; + }; +} diff --git a/modules/system/server/nextcloud/README.md b/components/modules/server/nextcloud/README.md similarity index 100% rename from modules/system/server/nextcloud/README.md rename to components/modules/server/nextcloud/README.md diff --git a/modules/system/server/nextcloud/cloud_scripts/cloudbackup.py b/components/modules/server/nextcloud/cloud_scripts/cloudbackup.py similarity index 100% rename from modules/system/server/nextcloud/cloud_scripts/cloudbackup.py rename to components/modules/server/nextcloud/cloud_scripts/cloudbackup.py diff --git a/modules/system/server/nextcloud/cloud_scripts/preview_generator.py b/components/modules/server/nextcloud/cloud_scripts/preview_generator.py similarity index 100% rename from modules/system/server/nextcloud/cloud_scripts/preview_generator.py rename to components/modules/server/nextcloud/cloud_scripts/preview_generator.py diff --git a/modules/system/server/nextcloud/cloud_scripts/send_telegram_message.py b/components/modules/server/nextcloud/cloud_scripts/send_telegram_message.py similarity index 100% rename from modules/system/server/nextcloud/cloud_scripts/send_telegram_message.py rename to components/modules/server/nextcloud/cloud_scripts/send_telegram_message.py diff --git a/modules/system/server/nextcloud/cloud_scripts/stdout_assert.py b/components/modules/server/nextcloud/cloud_scripts/stdout_assert.py similarity index 100% rename from modules/system/server/nextcloud/cloud_scripts/stdout_assert.py rename to components/modules/server/nextcloud/cloud_scripts/stdout_assert.py diff --git a/components/modules/server/nextcloud/default.nix b/components/modules/server/nextcloud/default.nix new file mode 100644 index 0000000..df34000 --- /dev/null +++ b/components/modules/server/nextcloud/default.nix @@ -0,0 +1,262 @@ +{ ... }: + +{ + flake.modules.nixos.nextcloud = + { + pkgs, + config, + lib, + ... + }: + + # IMPORTANT: + # When updating the Nextcloud package, also update the preview generator app + + let + mainDriveMountPoint = "/media/nextcloud/main_drive"; + backupDriveMountPoint = "/media/nextcloud/backup_drive"; + myCloudScripts = + with pkgs.python3Packages; + buildPythonPackage { + name = "my-cloud-scripts"; + src = ./.; + propagatedBuildInputs = [ requests ]; + pyproject = true; + build-system = [ setuptools ]; + }; + in + + { + environment.systemPackages = with pkgs; [ + myCloudScripts + borgbackup + ]; + + ### load needed secrets ### + sops.secrets = { + "nextcloud/adminpass" = { + owner = "nextcloud"; + }; + "telegram/api_key" = { + owner = "nextcloud"; + }; + "telegram/main_chat_id" = { + owner = "nextcloud"; + }; + }; + + ### mount main and backup drives ### + fileSystems."${mainDriveMountPoint}" = { + device = "/dev/disk/by-id/${config.mySystemConfig.nextcloud.drives.main}"; + fsType = "ext4"; + options = [ + # "defaults" + "nofail" + "noatime" + "noauto" + "x-systemd.automount" + ]; + }; + fileSystems."${backupDriveMountPoint}" = { + device = "/dev/disk/by-id/${config.mySystemConfig.nextcloud.drives.backup}"; + fsType = "ext4"; + options = [ + # "defaults" + "nofail" + "noatime" + "noauto" + "x-systemd.automount" + "x-systemd.idle-timeout=10min" + ]; + }; + + ### CONFIGURE NEXTCLOUD ### + services.nextcloud = { + enable = true; + + ### package setup ### + # remember you can only upgrade Nextcloud to the next major version + # if you want to upgrade to a newer version, change the nextcloud package (and customcss package) here + package = pkgs.nextcloud32; + extraApps = { + inherit (config.services.nextcloud.package.packages.apps) + calendar + contacts + notes + previewgenerator + tasks + ; + theming_customcss = pkgs.fetchNextcloudApp { + url = "https://github.com/nextcloud/theming_customcss/archive/refs/tags/v1.19.0.tar.gz"; + sha256 = "sha256-YX4hJ8TuhCI+Bzb2mQBczfclXORlrYPvV2MWjc1zajc="; + license = "agpl3Plus"; + }; + }; + appstoreEnable = false; + autoUpdateApps = { + enable = true; + startAt = "07:00:00"; + }; + + ### main settings ### + hostName = config.mySystemConfig.nextcloud.hostName; + home = "/var/lib/nextcloud"; + datadir = mainDriveMountPoint; + config = { + dbuser = "nextcloud"; + dbtype = "mysql"; + dbname = "nextcloud"; + adminuser = "admin"; + adminpassFile = config.sops.secrets."nextcloud/adminpass".path; + }; + database.createLocally = true; + + ### use Redis for all caching except local memcache ### + caching = { + apcu = true; + redis = true; + }; + configureRedis = true; + + ### config.php settings ### + enableImagemagick = true; + settings = { + enabledPreviewProviders = [ + # default providers + "OC\\Preview\\BMP" + "OC\\Preview\\GIF" + "OC\\Preview\\JPEG" + "OC\\Preview\\Krita" + "OC\\Preview\\MarkDown" + "OC\\Preview\\MP3" + "OC\\Preview\\OpenDocument" + "OC\\Preview\\PNG" + "OC\\Preview\\TXT" + "OC\\Preview\\XBitmap" + # additional providers + "OC\\Preview\\HEIC" + ]; + log_type = "file"; + maintenance_window_start = 2; # run non time-sensitive tasks at 2:00am for up to 4 hours + trusted_domains = config.mySystemConfig.nextcloud.trustedDomains; + overwriteprotocol = "https"; + preview_max_x = 2048; + preview_max_y = 2048; + jpeg_quality = 60; + }; + + ### php.ini settings ### + phpOptions = { + "opcache.interned_strings_buffer" = 16; + # we allow uploads of up to 8GB (it seems that this is only neccessary for WebDAV uploads (e.g. FolderSync); large file uploads from the web interface or nextcloud client also work with low limits) but we do not want the PHP memory limit to be that high for low resource setups (the nixos module sets it to maxUploadSize by default) + "memory_limit" = lib.mkForce "512M"; + }; + maxUploadSize = "8G"; + + ### php-fpm.conf settings (reduce overhead for low resource setups) ### + poolSettings = { + pm = "ondemand"; + "pm.max_children" = 12; + "pm.process_idle_timeout" = "1m"; + "pm.max_requests" = 500; + }; + + ### Use HTTPS for generated links ### + https = true; + + ### notify push settings ### + notify_push.enable = false; + }; + + ### CONFIGURE NGINX and ACME ### + security.acme.acceptTerms = true; + security.acme.defaults.email = config.mySystemConfig.acmeEmail; + services.nginx.recommendedTlsSettings = true; + services.nginx.recommendedOptimisation = true; + services.nginx.virtualHosts.${config.services.nextcloud.hostName} = { + forceSSL = true; + enableACME = true; + }; + + ### open ports in firewall ### + networking.firewall.allowedTCPPorts = [ + 80 + 443 + ]; + + ### CONFIGURE SYSTEMD SERVICES AND TIMERS ### + systemd.timers."nextcloud-preview-generator" = { + wantedBy = [ "timers.target" ]; + after = [ "nextcloud-setup.service" ]; + timerConfig = { + OnCalendar = "*-*-* 00:00:00"; + Persistent = true; + }; + }; + systemd.services."nextcloud-preview-generator" = { + after = [ "nextcloud-setup.service" ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "/run/current-system/sw/bin/my_nextcloud_preview_generator"; + User = "nextcloud"; + }; + }; + + systemd.timers."nextcloud-cloudbackup" = { + wantedBy = [ "timers.target" ]; + after = [ "nextcloud-setup.service" ]; + timerConfig = { + OnCalendar = "*-*-* 04:00:00"; + Persistent = true; + }; + }; + systemd.services."nextcloud-cloudbackup" = { + after = [ "nextcloud-setup.service" ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "/run/current-system/sw/bin/my_nextcloud_cloudbackup"; + User = "nextcloud"; + }; + }; + + systemd.timers."nextcloud-scheduled-reboot" = { + wantedBy = [ "timers.target" ]; + after = [ "nextcloud-setup.service" ]; + timerConfig = { + OnCalendar = "Mon *-*-* 12:00:00"; + }; + }; + systemd.services."nextcloud-scheduled-reboot" = { + after = [ "nextcloud-setup.service" ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "/run/current-system/sw/bin/reboot"; + }; + }; + + ### CONFIGURE FAIL2BAN ### + # https://docs.nextcloud.com/server/latest/admin_manual/installation/harden_server.html#fail2ban-introduction + environment.etc = { + "fail2ban/filter.d/nextcloud.conf".text = '' + [Definition] + _groupsre = (?:(?:,?\s*"\w+":(?:"[^"]+"|\w+))*) + failregex = ^\{%(_groupsre)s,?\s*"remoteAddr":""%(_groupsre)s,?\s*"message":"Login failed: + ^\{%(_groupsre)s,?\s*"remoteAddr":""%(_groupsre)s,?\s*"message":"Two-factor challenge failed: + ^\{%(_groupsre)s,?\s*"remoteAddr":""%(_groupsre)s,?\s*"message":"Trusted domain error. + datepattern = ,?\s*"time"\s*:\s*"%%Y-%%m-%%d[T ]%%H:%%M:%%S(%%z)?" + ''; + }; + services.fail2ban.jails = { + nextcloud.settings = { + backend = "auto"; + enabled = true; + port = "80,443"; + protocol = "tcp"; + filter = "nextcloud"; + logpath = "${mainDriveMountPoint}/data/nextcloud.log"; + }; + nginx-bad-request.settings.enabled = true; + nginx-botsearch.settings.enabled = true; + }; + }; +} diff --git a/modules/system/server/nextcloud/setup.py b/components/modules/server/nextcloud/setup.py similarity index 100% rename from modules/system/server/nextcloud/setup.py rename to components/modules/server/nextcloud/setup.py diff --git a/components/modules/server/pihole.nix b/components/modules/server/pihole.nix new file mode 100644 index 0000000..d84202d --- /dev/null +++ b/components/modules/server/pihole.nix @@ -0,0 +1,63 @@ +{ ... }: + +{ + flake.modules.nixos.pihole = + { + lib, + pkgs, + config, + ... + }: + + { + services.pihole-ftl = { + enable = true; + openFirewallDNS = true; + openFirewallDHCP = true; + openFirewallWebserver = true; + lists = [ + { + url = "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"; + } + { + url = "https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/pro.txt"; + } + ]; + settings = { + dns = { + upstreams = [ + # DNS.WATCH + "84.200.69.80" + "84.200.70.40" + "2001:1608:10:25:0:0:1c04:b12f" + "2001:1608:10:25:0:0:9249:d69b" + # Cloudflare (with Malware Blocking and DNSSEC Validation) + "9.9.9.9" + "149.112.112.112" + "2620:fe::fe" + "2620:fe::9" + ]; + # Array of custom DNS records each one in HOSTS form: "IP HOSTNAME" + hosts = config.mySystemConfig.pihole.hosts; + }; + webserver = { + paths = { + webroot = lib.mkForce "${pkgs.runCommand "pihole-web-under-admin" { } '' + mkdir -p $out + ln -sf ${pkgs.pihole-web}/share $out/admin + ''}"; + webhome = lib.mkForce "/admin/"; + }; + }; + }; + }; + + services.pihole-web = { + enable = true; + ports = [ + "8080r" + "8443s" + ]; + }; + }; +} diff --git a/components/modules/server/wireguard-server.nix b/components/modules/server/wireguard-server.nix new file mode 100644 index 0000000..cd80d05 --- /dev/null +++ b/components/modules/server/wireguard-server.nix @@ -0,0 +1,47 @@ +{ ... }: + +{ + flake.modules.nixos.wireguardServer = + { + pkgs, + config, + ... + }: + + { + sops.secrets = { + "wireguard/server/private_key" = { + }; + }; + + networking.nat.enable = true; + networking.nat.externalInterface = config.mySystemConfig.wireguard.externalInterface; + networking.nat.internalInterfaces = [ "wg0" ]; + networking.firewall = { + allowedUDPPorts = [ 51820 ]; + }; + + networking.wireguard.interfaces = { + wg0 = { + ips = [ "10.100.0.1/24" ]; + listenPort = 51820; + privateKeyFile = config.sops.secrets."wireguard/server/private_key".path; + + # For this to work you have to set the dnsserver IP of your router (or dnsserver of choice) in your clients + postSetup = '' + ${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o ${config.mySystemConfig.wireguard.externalInterface} -j MASQUERADE + ${pkgs.iptables}/bin/iptables -A FORWARD -i wg0 -o ${config.mySystemConfig.wireguard.externalInterface} -j ACCEPT + ${pkgs.iptables}/bin/iptables -A FORWARD -i wg0 -o wg0 -j ACCEPT + ''; + + postShutdown = '' + ${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -o ${config.mySystemConfig.wireguard.externalInterface} -j MASQUERADE + ${pkgs.iptables}/bin/iptables -D FORWARD -i wg0 -o ${config.mySystemConfig.wireguard.externalInterface} -j ACCEPT + ${pkgs.iptables}/bin/iptables -D FORWARD -i wg0 -o wg0 -j ACCEPT + ''; + + peers = config.mySystemConfig.wireguard.clientPeers; + }; + }; + }; +} diff --git a/components/modules/shell/cli-apps.nix b/components/modules/shell/cli-apps.nix new file mode 100644 index 0000000..7cb6950 --- /dev/null +++ b/components/modules/shell/cli-apps.nix @@ -0,0 +1,54 @@ +{ ... }: + +{ + flake.modules.system.cliApps = + { pkgs, ... }: + { + # Collection of useful CLI apps + environment.systemPackages = with pkgs; [ + bat + btop + curl + delta + eza + fastfetch + ffmpeg + file + fzf + gnugrep + gnused + htop + imagemagick + jq + killall + libnotify + nano + nh + pandoc + pciutils + ripgrep + rsync + tldr + sops + unzip + usbutils + wget + ]; + + programs.tmux = { + enable = true; + extraConfig = '' + set -g mouse on + ''; + }; + }; + + flake.modules.nixos.cliApps = + { pkgs, ... }: + { + environment.systemPackages = with pkgs; [ + acpi + efibootmgr + ]; + }; +} diff --git a/modules/home-manager/devel/shell/lessfilter b/components/modules/shell/lessfilter similarity index 100% rename from modules/home-manager/devel/shell/lessfilter rename to components/modules/shell/lessfilter diff --git a/components/modules/shell/shell.nix b/components/modules/shell/shell.nix new file mode 100644 index 0000000..d27f2af --- /dev/null +++ b/components/modules/shell/shell.nix @@ -0,0 +1,171 @@ +{ ... }: + +{ + flake.modules.homeManager.shell = + { + config, + lib, + pkgs, + ... + }: + + let + myAliases = { + clearswap = "sudo swapoff -a; sudo swapon -a"; + conda = "micromamba"; + fhs = "nix-shell -E 'with import {}; (pkgs.buildFHSUserEnv { name = \"fhs\"; runScript = \"zsh\"; }).env'"; + get-temp = '' + paste <(cat /sys/class/thermal/thermal_zone*/type) \ + <(cat /sys/class/thermal/thermal_zone*/temp) | \ + awk -F'\t' '{printf "%s\t%.1f°C\n", $1, $2/1000}' | \ + column -s $'\t' -t + ''; + git-branch-collect-garbage = "git branch -vv | grep ': gone]' | awk '{print $1}' | xargs git branch -D"; + homie = "nh home switch --configuration ${config.myUserConfig.userConfigurationName}"; + nixie = "nh os switch --hostname ${config.myUserConfig.systemConfigurationName}"; + darwie = "nh darwin switch --hostname ${config.myUserConfig.systemConfigurationName}"; + neofetch = "nix run nixpkgs\#fastfetch -- --config examples/7.jsonc"; + root-shell = "sudo env \"HOME=/home/$USER\" zsh --login"; + tree = "eza --tree"; + venv = "source venv/bin/activate"; + }; + + myLessfilter = pkgs.writeShellApplication { + name = "my-lessfilter"; + + runtimeInputs = with pkgs; [ + bat + chafa + eza + file + gnused + hr + poppler-utils + ]; + + text = builtins.readFile ./lessfilter; + }; + in + { + programs.zsh = { + enable = true; + dotDir = "${config.xdg.configHome}/zsh"; + autocd = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + shellAliases = myAliases; + oh-my-zsh = { + enable = true; + theme = ""; # "robbyrussell"; # use custom starship theme below + custom = "$XDG_CONFIG_HOME/oh-my-zsh/custom"; + plugins = [ + "alias-finder" + # https://github.com/NixOS/nixpkgs/issues/171054 + # https://blog.nobbz.dev/blog/2023-02-27-nixos-flakes-command-not-found/ + # sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos && sudo nix-channel --update + "command-not-found" + "eza" + "fzf" + "git" + "pip" + "rsync" + "sudo" + ]; + }; + plugins = [ + { + name = "fzf-tab"; + src = "${pkgs.zsh-fzf-tab}/share/fzf-tab"; + } + ]; + initContent = '' + # clear screen with ctrl-k (instead of zsh's default behavior of just moving the prompt to the top) + bindkey -s '^K' 'clear\n' + + # shift-tab to accept autosuggestions + bindkey '^[[Z' autosuggest-accept + + # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/alias-finder + zstyle ':omz:plugins:alias-finder' autoload yes + + # https://github.com/Aloxaf/fzf-tab?tab=readme-ov-file#configure + zstyle ':completion:*:git-checkout:*' sort false + zstyle ':completion:*:descriptions' format '[%d]' + zstyle ':completion:*' list-colors ''${(s.:.)LS_COLORS} + zstyle ':completion:*' menu no + zstyle ':fzf-tab:*' fzf-flags --bind=tab:accept --style=full --height=20 #--height=-2 + zstyle ':fzf-tab:*' switch-group '<' '>' + + # https://github.com/Aloxaf/fzf-tab/wiki/Preview + # preview for systemctl + zstyle ':fzf-tab:complete:systemctl-*:*' fzf-preview 'SYSTEMD_COLORS=1 systemctl status $word' + # preview for env vars + zstyle ':fzf-tab:complete:(-command-|-parameter-|-brace-parameter-|export|unset|expand):*' fzf-preview 'echo ''${(P)word}' + # disable preview for command options and subcommands + zstyle ':fzf-tab:complete:*:options' fzf-preview + zstyle ':fzf-tab:complete:*:argument-1' fzf-preview + # use less with custom lessfilter for anything else + zstyle ':fzf-tab:complete:*:*' fzf-preview 'less ''${(Q)realpath}' + export LESSOPEN='|${lib.getExe myLessfilter} %s' + + bindkey -s '\e[1;3A' 'cd ..\n' + ''; + }; + + # https://github.com/NixOS/nixpkgs/pull/416425 + programs.command-not-found.enable = true; + + programs.starship = { + enable = true; + settings = { + add_newline = false; + format = "$all"; + character = { + success_symbol = "[➜](fg:green)"; + error_symbol = "[➜](fg:red)"; + }; + conda.disabled = true; # conda has its own prompt modifier, you could also disable that instead with `conda config --set changeps1 False` + line_break.disabled = true; + directory.format = "[$path]($style) [$read_only]($read_only_style)"; + git_status = { + style = "bold purple"; + format = "([\\($all_status$ahead_behind\\)]($style) )"; + }; + hostname = { + ssh_symbol = "🌐"; + style = "bold blue"; + }; + username.style_user = "bold blue"; + }; + }; + + programs.bash = { + enable = true; + shellAliases = myAliases; + }; + + programs.zoxide = { + enable = true; + options = [ + "--cmd cd" + ]; + }; + + programs.eza = { + enable = true; + icons = "auto"; + extraOptions = [ + "--color-scale=all" + "--group" + "--group-directories-first" + "--header" + "--hyperlink" + ]; + }; + + home.sessionVariables = { + FLAKE = config.myUserConfig.flakeDirectory; + NH_FLAKE = config.myUserConfig.flakeDirectory; + }; + }; +} diff --git a/components/modules/shell/wireguard-client.nix b/components/modules/shell/wireguard-client.nix new file mode 100644 index 0000000..74ccd8b --- /dev/null +++ b/components/modules/shell/wireguard-client.nix @@ -0,0 +1,31 @@ +{ ... }: + +{ + flake.modules.homeManager.wireguardClient = + { + config, + pkgs, + inputs, + ... + }: + { + imports = [ inputs.sops-nix.homeManagerModules.sops ]; + + sops.secrets."wireguard.conf" = { + format = "binary"; + sopsFile = config.myUserConfig.wireguardConfig; + }; + + home.packages = [ pkgs.wireguard-tools ]; + + programs.zsh.shellAliases = { + vpn_pi_on = "wg-quick up ${config.sops.secrets."wireguard.conf".path}"; + vpn_pi_off = "wg-quick down ${config.sops.secrets."wireguard.conf".path}"; + }; + + programs.bash.shellAliases = { + vpn_pi_on = "wg-quick up ${config.sops.secrets."wireguard.conf".path}"; + vpn_pi_off = "wg-quick down ${config.sops.secrets."wireguard.conf".path}"; + }; + }; +} diff --git a/components/modules/virtualisation.nix b/components/modules/virtualisation.nix new file mode 100644 index 0000000..5beb552 --- /dev/null +++ b/components/modules/virtualisation.nix @@ -0,0 +1,39 @@ +{ ... }: + +{ + flake.modules.nixos.virtualisation = + { ... }: + + { + # https://wiki.nixos.org/wiki/Virt-manager + virtualisation.libvirtd.enable = true; + programs.virt-manager.enable = true; + virtualisation.spiceUSBRedirection.enable = true; + + # https://wiki.nixos.org/wiki/Podman + virtualisation.containers.enable = true; + virtualisation = { + podman = { + enable = true; + + # Create a `docker` alias for podman, to use it as a drop-in replacement + dockerCompat = true; + + # Required for containers under podman-compose to be able to talk to each other. + defaultNetwork.settings.dns_enabled = true; + }; + }; + + # https://wiki.nixos.org/wiki/Flatpak + # services.flatpak.enable = true; + }; + + flake.modules.homeManager.virtualisation = + { ... }: + { + programs.distrobox = { + enable = true; + containers = { }; + }; + }; +} diff --git a/components/overlays/default.nix b/components/overlays/default.nix new file mode 100644 index 0000000..b059bf3 --- /dev/null +++ b/components/overlays/default.nix @@ -0,0 +1,33 @@ +{ ... }: +{ + flake.overlays.default = final: prev: { + autoraise = prev.autoraise.overrideAttrs { + version = "5.6"; + + src = prev.fetchFromGitHub { + owner = "sbmpost"; + repo = "AutoRaise"; + rev = "304b05d18a8aa71dc95aa94ed80eab644bcbf701"; + hash = "sha256-QmKGptrqzv7PKNpBVZVZhkJwA5U4ir3m21Hw3Kq2FYM="; + }; + + # build with EXPERIMENTAL_FOCUS_FIRST to focusing the hovered window before actually raising it + buildPhase = '' + runHook preBuild + $CXX -std=c++03 -fobjc-arc -D"NS_FORMAT_ARGUMENT(A)=" -D"SKYLIGHT_AVAILABLE=1" -DEXPERIMENTAL_FOCUS_FIRST -o AutoRaise AutoRaise.mm -framework AppKit -framework SkyLight + bash create-app-bundle.sh + runHook postBuild + ''; + }; + + nix-output-monitor = prev.nix-output-monitor.overrideAttrs { + version = "2.1.8-unstable-2025-11-09"; + src = prev.fetchFromGitHub { + owner = "maralorn"; + repo = "nix-output-monitor"; + rev = "698e6f3afdc9d68dd65d84df7b030499dbfaf84b"; + hash = "sha256-QwEVaUxvXEdx5icIZZYQQjvJO5j0+GeWtJvCJ/LZwpA="; + }; + }; + }; +} diff --git a/components/packages/default.nix b/components/packages/default.nix new file mode 100644 index 0000000..cb6615e --- /dev/null +++ b/components/packages/default.nix @@ -0,0 +1,42 @@ +{ ... }: + +{ + perSystem = + { pkgs, ... }: + { + packages = { + remoteDeploymentSystem = pkgs.writeShellApplication { + name = "remote-deployment-system"; + text = builtins.readFile ../scripts/remote-deployment-system.sh; + }; + remoteDeploymentHome = pkgs.writeShellApplication { + name = "remote-deployment-home"; + text = builtins.readFile ../scripts/remote-deployment-home.sh; + }; + hibernateOnLowBattery = pkgs.writeShellApplication { + name = "hibernate-on-low-battery"; + text = builtins.readFile ../scripts/hibernate_on_low_battery.sh; + }; + restartFailedSystemdUserServices = pkgs.writeShellApplication { + name = "restart-failed-systemd-user-services"; + text = builtins.readFile ../scripts/restart_failed_systemd_user_services.sh; + }; + selectWallpaperImage = pkgs.writeShellApplication { + name = "select-wallpaper-image"; + runtimeInputs = with pkgs; [ + imagemagick + coreutils + ]; + text = builtins.readFile ../scripts/select_wallpaper_image.sh; + }; + updateWallpaperCaelestia = pkgs.writeShellApplication { + name = "update-wallpaper-caelestia"; + text = builtins.readFile ../scripts/update_wallpaper_caelestia.sh; + }; + updateWallpaperSwww = pkgs.writeShellApplication { + name = "update-wallpaper-swww"; + text = builtins.readFile ../scripts/update_wallpaper_swww.sh; + }; + }; + }; +} diff --git a/scripts/hibernate_on_low_battery.sh b/components/scripts/hibernate_on_low_battery.sh similarity index 100% rename from scripts/hibernate_on_low_battery.sh rename to components/scripts/hibernate_on_low_battery.sh diff --git a/scripts/lock_monitors.sh b/components/scripts/hyprland_lock_monitors.sh similarity index 100% rename from scripts/lock_monitors.sh rename to components/scripts/hyprland_lock_monitors.sh diff --git a/scripts/remote-deployment-home.sh b/components/scripts/remote-deployment-home.sh similarity index 100% rename from scripts/remote-deployment-home.sh rename to components/scripts/remote-deployment-home.sh diff --git a/scripts/remote-deployment-system.sh b/components/scripts/remote-deployment-system.sh similarity index 100% rename from scripts/remote-deployment-system.sh rename to components/scripts/remote-deployment-system.sh diff --git a/scripts/restart_failed_systemd_user_services.sh b/components/scripts/restart_failed_systemd_user_services.sh similarity index 83% rename from scripts/restart_failed_systemd_user_services.sh rename to components/scripts/restart_failed_systemd_user_services.sh index c136410..67d2860 100755 --- a/scripts/restart_failed_systemd_user_services.sh +++ b/components/scripts/restart_failed_systemd_user_services.sh @@ -8,5 +8,5 @@ if [ -n "$failed_services" ]; then systemctl --user restart "$service" done notify-send "Systemd restart script" "Restarted the following failed user services: \n$failed_services" - echo "Restarted the following failed user services: \n$failed_services" + printf "Restarted the following failed user services:\n%s\n" "$failed_services" fi diff --git a/scripts/wallpaper/select_image.sh b/components/scripts/select_wallpaper_image.sh similarity index 100% rename from scripts/wallpaper/select_image.sh rename to components/scripts/select_wallpaper_image.sh diff --git a/scripts/trim-generations.sh b/components/scripts/trim-generations.sh similarity index 100% rename from scripts/trim-generations.sh rename to components/scripts/trim-generations.sh diff --git a/scripts/wallpaper/update_wallpaper_caelestia.sh b/components/scripts/update_wallpaper_caelestia.sh similarity index 54% rename from scripts/wallpaper/update_wallpaper_caelestia.sh rename to components/scripts/update_wallpaper_caelestia.sh index b857357..6bd66dc 100755 --- a/scripts/wallpaper/update_wallpaper_caelestia.sh +++ b/components/scripts/update_wallpaper_caelestia.sh @@ -1,15 +1,29 @@ #! /usr/bin/env bash wallpaper_path="${XDG_CONFIG_HOME:-$HOME/.config}/myWallpaper/selected_image.txt" +fallback_wallpaper="" + +while [[ $# -gt 0 ]]; do + case $1 in + --fallback) + fallback_wallpaper="$2" + shift 2 + ;; + *) + echo "Unknown option: $1" >&2 + exit 1 + ;; + esac +done # Read the path into a variable if [[ -f "$wallpaper_path" ]]; then wallpaper="$(<"$wallpaper_path")" echo "The selected image is: $wallpaper" else - wallpaper="$(dirname "$(realpath "$0")")/wallpaper.jpg" + wallpaper="$fallback_wallpaper" echo "No image selected, using fallback: $wallpaper" fi # Set wallpaper -caelestia wallpaper -f $wallpaper \ No newline at end of file +caelestia wallpaper -f "$wallpaper" \ No newline at end of file diff --git a/scripts/wallpaper/update_wallpaper_swww.sh b/components/scripts/update_wallpaper_swww.sh similarity index 72% rename from scripts/wallpaper/update_wallpaper_swww.sh rename to components/scripts/update_wallpaper_swww.sh index f828b19..b1b2ad7 100755 --- a/scripts/wallpaper/update_wallpaper_swww.sh +++ b/components/scripts/update_wallpaper_swww.sh @@ -1,13 +1,27 @@ #! /usr/bin/env bash wallpaper_path="${XDG_CONFIG_HOME:-$HOME/.config}/myWallpaper/selected_image.txt" +fallback_wallpaper="" + +while [[ $# -gt 0 ]]; do + case $1 in + --fallback) + fallback_wallpaper="$2" + shift 2 + ;; + *) + echo "Unknown option: $1" >&2 + exit 1 + ;; + esac +done # Read the path into a variable if [[ -f "$wallpaper_path" ]]; then wallpaper="$(<"$wallpaper_path")" echo "The selected image is: $wallpaper" else - wallpaper="$(dirname "$(realpath "$0")")/wallpaper.jpg" + wallpaper="$fallback_wallpaper" echo "No image selected, using fallback: $wallpaper" fi diff --git a/secrets/files/wireguard_clients/inspiron-laptop.conf b/components/secrets/files/wireguard_clients/inspiron-laptop.conf similarity index 100% rename from secrets/files/wireguard_clients/inspiron-laptop.conf rename to components/secrets/files/wireguard_clients/inspiron-laptop.conf diff --git a/secrets/files/wireguard_clients/leon-handy.conf b/components/secrets/files/wireguard_clients/leon-handy.conf similarity index 100% rename from secrets/files/wireguard_clients/leon-handy.conf rename to components/secrets/files/wireguard_clients/leon-handy.conf diff --git a/secrets/secrets.yaml b/components/secrets/secrets.yaml similarity index 100% rename from secrets/secrets.yaml rename to components/secrets/secrets.yaml diff --git a/scripts/wallpaper/animated/cloudscape.jpg b/components/wallpaper/animated/cloudscape.jpg similarity index 100% rename from scripts/wallpaper/animated/cloudscape.jpg rename to components/wallpaper/animated/cloudscape.jpg diff --git a/scripts/wallpaper/animated/cloudscape.mp4 b/components/wallpaper/animated/cloudscape.mp4 similarity index 100% rename from scripts/wallpaper/animated/cloudscape.mp4 rename to components/wallpaper/animated/cloudscape.mp4 diff --git a/scripts/wallpaper/animated/irlandbeach.jpg b/components/wallpaper/animated/irlandbeach.jpg similarity index 100% rename from scripts/wallpaper/animated/irlandbeach.jpg rename to components/wallpaper/animated/irlandbeach.jpg diff --git a/scripts/wallpaper/animated/irlandbeach.mp4 b/components/wallpaper/animated/irlandbeach.mp4 similarity index 100% rename from scripts/wallpaper/animated/irlandbeach.mp4 rename to components/wallpaper/animated/irlandbeach.mp4 diff --git a/scripts/wallpaper/animated/mountain-rain-landscape.jpg b/components/wallpaper/animated/mountain-rain-landscape.jpg similarity index 100% rename from scripts/wallpaper/animated/mountain-rain-landscape.jpg rename to components/wallpaper/animated/mountain-rain-landscape.jpg diff --git a/scripts/wallpaper/animated/mountain-rain-landscape.mp4 b/components/wallpaper/animated/mountain-rain-landscape.mp4 similarity index 100% rename from scripts/wallpaper/animated/mountain-rain-landscape.mp4 rename to components/wallpaper/animated/mountain-rain-landscape.mp4 diff --git a/scripts/wallpaper/animated/mountains-in-clouds.jpg b/components/wallpaper/animated/mountains-in-clouds.jpg similarity index 100% rename from scripts/wallpaper/animated/mountains-in-clouds.jpg rename to components/wallpaper/animated/mountains-in-clouds.jpg diff --git a/scripts/wallpaper/animated/mountains-in-clouds.mp4 b/components/wallpaper/animated/mountains-in-clouds.mp4 similarity index 100% rename from scripts/wallpaper/animated/mountains-in-clouds.mp4 rename to components/wallpaper/animated/mountains-in-clouds.mp4 diff --git a/scripts/wallpaper/animated/snowfall-in-forest.jpg b/components/wallpaper/animated/snowfall-in-forest.jpg similarity index 100% rename from scripts/wallpaper/animated/snowfall-in-forest.jpg rename to components/wallpaper/animated/snowfall-in-forest.jpg diff --git a/scripts/wallpaper/animated/snowfall-in-forest.mp4 b/components/wallpaper/animated/snowfall-in-forest.mp4 similarity index 100% rename from scripts/wallpaper/animated/snowfall-in-forest.mp4 rename to components/wallpaper/animated/snowfall-in-forest.mp4 diff --git a/scripts/wallpaper/animated/wukong-foggy-forest.jpg b/components/wallpaper/animated/wukong-foggy-forest.jpg similarity index 100% rename from scripts/wallpaper/animated/wukong-foggy-forest.jpg rename to components/wallpaper/animated/wukong-foggy-forest.jpg diff --git a/scripts/wallpaper/animated/wukong-foggy-forest.mp4 b/components/wallpaper/animated/wukong-foggy-forest.mp4 similarity index 100% rename from scripts/wallpaper/animated/wukong-foggy-forest.mp4 rename to components/wallpaper/animated/wukong-foggy-forest.mp4 diff --git a/scripts/wallpaper/wallpaper.jpg b/components/wallpaper/fallback.jpg similarity index 100% rename from scripts/wallpaper/wallpaper.jpg rename to components/wallpaper/fallback.jpg diff --git a/flake.lock b/flake.lock index fb287e7..a78e74c 100644 --- a/flake.lock +++ b/flake.lock @@ -113,6 +113,24 @@ } }, "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1775087534, + "narHash": "sha256-91qqW8lhL7TLwgQWijoGBbiD4t7/q75KTi8NxjVmSmA=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "3107b77cd68437b9a76194f0f7f9c55f2329ca5b", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { "inputs": { "nixpkgs-lib": [ "nur", @@ -515,6 +533,21 @@ "type": "github" } }, + "import-tree": { + "locked": { + "lastModified": 1773693634, + "narHash": "sha256-BtZ2dtkBdSUnFPPFc+n0kcMbgaTxzFNPv2iaO326Ffg=", + "owner": "vic", + "repo": "import-tree", + "rev": "c41e7d58045f9057880b0d85e1152d6a4430dbf1", + "type": "github" + }, + "original": { + "owner": "vic", + "repo": "import-tree", + "type": "github" + } + }, "nix-darwin": { "inputs": { "nixpkgs": [ @@ -589,6 +622,21 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1774748309, + "narHash": "sha256-+U7gF3qxzwD5TZuANzZPeJTZRHS29OFQgkQ2kiTJBIQ=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "333c4e0545a6da976206c74db8773a1645b5870a", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1774709303, @@ -599,9 +647,10 @@ "type": "github" }, "original": { - "id": "nixpkgs", + "owner": "NixOS", "ref": "nixos-unstable", - "type": "indirect" + "repo": "nixpkgs", + "type": "github" } }, "nixpkgs_3": { @@ -622,7 +671,7 @@ }, "nur": { "inputs": { - "flake-parts": "flake-parts", + "flake-parts": "flake-parts_2", "nixpkgs": "nixpkgs_3" }, "locked": { @@ -709,9 +758,11 @@ "root": { "inputs": { "caelestia-shell": "caelestia-shell", + "flake-parts": "flake-parts", "grub2-themes": "grub2-themes", "home-manager": "home-manager", "hyprland": "hyprland", + "import-tree": "import-tree", "nix-darwin": "nix-darwin", "nix-homebrew": "nix-homebrew", "nix-vscode-extensions": "nix-vscode-extensions", diff --git a/flake.nix b/flake.nix index 1d1b28c..cbb17a9 100644 --- a/flake.nix +++ b/flake.nix @@ -1,37 +1,57 @@ { - description = "Leons Flake for NixOS and Home Manager configuration"; - outputs = { self, ... }@inputs: - let - inspiron-laptop = import ./hosts/inspiron-laptop/flakeConfiguration.nix inputs; - zollsoft-mac = import ./hosts/zollsoft-mac/flakeConfiguration.nix inputs; - barbara-laptop = import ./hosts/barbara-laptop/flakeConfiguration.nix inputs; - in - { - # insert other configurations by merging (need to be imported in let/in) - nixosConfigurations = inspiron-laptop // barbara-laptop; # // ; - darwinConfigurations = zollsoft-mac; # // ; - homeConfigurations = inspiron-laptop // zollsoft-mac // barbara-laptop; # // ; + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ + "x86_64-linux" + "aarch64-darwin" + ]; + + imports = [ + inputs.flake-parts.flakeModules.modules + inputs.home-manager.flakeModules.home-manager + (inputs.import-tree.matchNot ".*/hosts/raspberrypi(/.*)?$" ./components) + ]; + + # configure nixpkgs for all systems + perSystem = + { system, ... }: + { + _module.args.pkgs = import inputs.nixpkgs { + inherit system; + overlays = [ + self.overlays.default + inputs.nur.overlays.default + inputs.nix-vscode-extensions.overlays.default + ]; + config = { + allowUnfree = true; + }; + }; + }; }; inputs = { #nixpkgsLocal.url = "git+file:///home/leon/Downloads/nixpkgs"; #nixpkgsStable.url = "nixpkgs/nixos-24.05"; - nixpkgs.url = "nixpkgs/nixos-unstable"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nix-darwin = { url = "github:nix-darwin/nix-darwin"; inputs.nixpkgs.follows = "nixpkgs"; }; - #home-managerStable = { - # url = "github:nix-community/home-manager/release-24.05"; - # inputs.nixpkgs.follows = "nixpkgsStable"; - #}; home-manager = { url = "github:nix-community/home-manager/master"; inputs.nixpkgs.follows = "nixpkgs"; }; + #home-managerStable = { + # url = "github:nix-community/home-manager/release-24.05"; + # inputs.nixpkgs.follows = "nixpkgsStable"; + #}; + + flake-parts.url = "github:hercules-ci/flake-parts"; + import-tree.url = "github:vic/import-tree"; nur.url = "github:nix-community/NUR"; diff --git a/hosts/barbara-laptop/configuration.nix b/hosts/barbara-laptop/configuration.nix deleted file mode 100644 index 93b30c5..0000000 --- a/hosts/barbara-laptop/configuration.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ inputs, pkgs, ... }: - -{ - imports = [ - inputs.sops-nix.nixosModules.sops - ./hardware-configuration.nix - ../../modules/system/basic/locale.nix - ../../modules/system/basic/nh.nix - ../../modules/system/basic/settings.nix - ../../modules/system/basic/users.nix - ../../modules/system/apps/cli-apps.nix - ../../modules/system/apps/virtualisation.nix - ../../modules/system/boot/grub.nix - ../../modules/system/fonts/fonts.nix - ../../modules/system/hardware/accelerated_video_playback.nix - ../../modules/system/hardware/automount.nix - ../../modules/system/hardware/bluetooth.nix - ../../modules/system/hardware/intel.nix - ../../modules/system/hardware/networking.nix - ../../modules/system/hardware/pipewire.nix - ../../modules/system/hardware/printing.nix - ../../modules/system/security/remote.nix - ../../modules/system/security/location_information.nix - ../../modules/system/security/run_binaries.nix - ../../modules/system/wm/sddm.nix - ../../modules/system/wm/hyprland.nix - ../../modules/system/wm/kde.nix # home-managers qt theming (in theming.nix) will fuck up plasma6 so you need to disable it if you want to try plasma6 - ]; - - boot.kernelPackages = pkgs.linuxPackages_latest; - - system.stateVersion = "23.11"; # Do not modify -} diff --git a/hosts/barbara-laptop/flakeConfiguration.nix b/hosts/barbara-laptop/flakeConfiguration.nix deleted file mode 100644 index 9e9475c..0000000 --- a/hosts/barbara-laptop/flakeConfiguration.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ self, ... }@inputs: - -let - systemSettings = { - hostname = "mamas-laptop"; # hostname, unique identifier for building the flake - timezone = "Europe/Vienna"; # timezone - defaultLocale = "de_AT.UTF-8"; # default locale - extraLocale = "de_AT.UTF-8"; # extra locale (for measurement, numeric, time, ...) - kblayout = "de"; # keyboard layout - users = { - "1" = { - username = userSettings1.username; # username - name = userSettings1.name; - extraGroups = [ - "networkmanager" - "scanner" - "wheel" - "video" - "libvirtd" - ]; - }; - }; - }; - - userSettings1 = rec { - username = "barbara"; # username - name = "Leon"; # name/identifier (used for certain configurations i.e. git) - email = "leonvincenterd@web.de"; # email (used for certain configurations i.e. git) - flakeDirectory = "/home/${username}/dotfiles"; - kblayout = "de"; - systemConfigurationName = systemSettings.hostname; - userConfigurationName = "${username}@${systemConfigurationName}"; - isLinux = myPkgs.stdenv.isLinux; - wallpaperFolder = "/home/${username}/Bilder/Wallpaper"; - }; - - myPkgs = import inputs.nixpkgs { - overlays = [ - inputs.nur.overlays.default - inputs.nix-vscode-extensions.overlays.default - (import ../../overlays) - ]; - system = "x86_64-linux"; # system arch (checkout hardware-configuration.nix -> nixpkgs.hostPlatform); - config.allowUnfree = true; - }; - - #pkgsLocal = import inputs.nixpkgsLocal { - # system = "x86_64-linux"; # system arch (checkout hardware-configuration.nix -> nixpkgs.hostPlatform); - # config.allowUnfree = true; - #}; -in - -{ - ${systemSettings.hostname} = inputs.nixpkgs.lib.nixosSystem { - modules = [ ./configuration.nix ]; - specialArgs = { - inherit inputs; - inherit myPkgs; - inherit systemSettings; - }; - }; - - ${userSettings1.userConfigurationName} = inputs.home-manager.lib.homeManagerConfiguration { - pkgs = myPkgs; - modules = [ ./home.nix ]; - extraSpecialArgs = { - # pass config variables from above - inherit inputs; - userSettings = userSettings1; - #inherit pkgsLocal; - }; - }; -} diff --git a/hosts/barbara-laptop/home.nix b/hosts/barbara-laptop/home.nix deleted file mode 100644 index 6726a75..0000000 --- a/hosts/barbara-laptop/home.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ - lib, - inputs, - userSettings, - ... -}: - -{ - imports = [ - inputs.sops-nix.homeManagerModules.sops - ./mamas-packages.nix - ../../modules/home-manager/basic/basic.nix - ../../modules/home-manager/apps/office.nix - ../../modules/home-manager/apps/qt-apps.nix - ../../modules/home-manager/apps/social.nix - ../../modules/home-manager/apps/submodules/firefox.nix - ../../modules/home-manager/devel/alacritty.nix - ../../modules/home-manager/devel/shell - ../../modules/home-manager/devel/git.nix - ../../modules/home-manager/devel/vscode - ../../modules/home-manager/devel/wezterm.nix - ../../modules/home-manager/theming/theming.nix - ../../modules/home-manager/wm/hyprland # needs hyprland.nix import in configuration.nix - ../../modules/home-manager/wm/kde - ]; - - home.activation = { - myScripts = lib.hm.dag.entryAfter [ "writeBoundary" ] '' - run ln -Tsf ${userSettings.flakeDirectory}/scripts ~/scripts - ''; - }; - - programs.firefox.profiles.${userSettings.username} = { - bookmarks = lib.mkForce { }; - }; - - services.network-manager-applet.enable = true; - services.blueman-applet.enable = true; - - wayland.windowManager.hyprland.settings = { - # Fallback rule - monitor = lib.mkForce ", preferred, auto, 1.25"; - }; - - home.stateVersion = "23.11"; # Do not modify -} diff --git a/hosts/inspiron-laptop/configuration.nix b/hosts/inspiron-laptop/configuration.nix deleted file mode 100644 index a6b789c..0000000 --- a/hosts/inspiron-laptop/configuration.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ inputs, ... }: - -{ - imports = [ - inputs.sops-nix.nixosModules.sops - ./hardware-configuration.nix - ../../modules/system/basic - ../../modules/system/apps/cli-apps.nix - # ../../modules/system/apps/steam.nix - ../../modules/system/apps/virtualisation.nix - ../../modules/system/boot/grub.nix - #../../modules/system/boot/plymouth.nix - ../../modules/system/fonts/fonts.nix - ../../modules/system/hardware/accelerated_video_playback.nix - ../../modules/system/hardware/automount.nix - ../../modules/system/hardware/bluetooth.nix - ../../modules/system/hardware/intel.nix - ../../modules/system/hardware/networking.nix - ../../modules/system/hardware/pipewire.nix - #../../modules/system/hardware/power.nix - ../../modules/system/hardware/printing.nix - ../../modules/system/security/remote.nix - ../../modules/system/security/location_information.nix - ../../modules/system/security/run_binaries.nix - ../../modules/system/wm/sddm.nix - ../../modules/system/wm/hyprland.nix - ../../modules/system/wm/kde.nix # home-managers qt theming (in theming.nix) will fuck up plasma6 so you need to disable it if you want to try plasma6 - ]; - - # for compiling through emulated system for raspberrypi - boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; - - system.stateVersion = "23.11"; # Do not modify -} diff --git a/hosts/inspiron-laptop/flakeConfiguration.nix b/hosts/inspiron-laptop/flakeConfiguration.nix deleted file mode 100644 index be401cd..0000000 --- a/hosts/inspiron-laptop/flakeConfiguration.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ self, ... }@inputs: - -let - systemSettings = { - hostname = "inspiron-laptop"; # hostname, unique identifier for building the flake - timezone = "Europe/Vienna"; # timezone - defaultLocale = "en_US.UTF-8"; # default locale - extraLocale = "de_AT.UTF-8"; # extra locale (for measurement, numeric, time, ...) - kblayout = "de"; # keyboard layout - users = { - "1" = { - username = userSettings1.username; # username - name = userSettings1.name; - extraGroups = [ - "networkmanager" - "wheel" - "video" - "libvirtd" - ]; - }; - }; - }; - - userSettings1 = rec { - username = "leon"; # username - name = "Leon"; # name/identifier (used for certain configurations i.e. git) - email = "leonvincenterd@web.de"; # email (used for certain configurations i.e. git) - flakeDirectory = "/home/${username}/dotfiles"; - kblayout = "de"; - systemConfigurationName = systemSettings.hostname; - userConfigurationName = "${username}@${systemConfigurationName}"; - wireguardConfig = ../../secrets/files/wireguard_clients/inspiron-laptop.conf; - isLinux = myPkgs.stdenv.isLinux; - wallpaperFolder = "/home/${username}/Nextcloud/Pictures/Geordnet"; - }; - - myPkgs = import inputs.nixpkgs { - overlays = [ - inputs.nur.overlays.default - inputs.nix-vscode-extensions.overlays.default - (import ../../overlays) - ]; - system = "x86_64-linux"; # system arch (checkout hardware-configuration.nix -> nixpkgs.hostPlatform); - config.allowUnfree = true; - }; - - #pkgsLocal = import inputs.nixpkgsLocal { - # system = "x86_64-linux"; # system arch (checkout hardware-configuration.nix -> nixpkgs.hostPlatform); - # config.allowUnfree = true; - #}; -in - -{ - ${systemSettings.hostname} = inputs.nixpkgs.lib.nixosSystem { - modules = [ ./configuration.nix ]; - specialArgs = { - inherit inputs; - inherit myPkgs; - inherit systemSettings; - }; - }; - - ${userSettings1.userConfigurationName} = inputs.home-manager.lib.homeManagerConfiguration { - pkgs = myPkgs; - modules = [ ./home.nix ]; - extraSpecialArgs = { - # pass config variables from above - inherit inputs; - userSettings = userSettings1; - #inherit pkgsLocal; - }; - }; -} diff --git a/hosts/inspiron-laptop/home.nix b/hosts/inspiron-laptop/home.nix deleted file mode 100644 index fed2b0a..0000000 --- a/hosts/inspiron-laptop/home.nix +++ /dev/null @@ -1,64 +0,0 @@ -{ - lib, - pkgs, - inputs, - userSettings, - ... -}: - -let - remote-deployment-home-script = builtins.readFile ../../scripts/remote-deployment-home.sh; - remote-deployment-system-script = builtins.readFile ../../scripts/remote-deployment-system.sh; - - remoteDeploymentHome = pkgs.writeShellApplication { - name = "remote-deployment-home"; - text = remote-deployment-home-script; - }; - remoteDeploymentSystem = pkgs.writeShellApplication { - name = "remote-deployment-system"; - text = remote-deployment-system-script; - }; -in - -{ - imports = [ - inputs.sops-nix.homeManagerModules.sops - ../../modules/home-manager/basic - ../../modules/home-manager/apps/media.nix - ../../modules/home-manager/apps/office.nix - ../../modules/home-manager/apps/qt-apps.nix - ../../modules/home-manager/apps/social.nix - ../../modules/home-manager/apps/misc.nix - ../../modules/home-manager/devel/alacritty.nix - ../../modules/home-manager/devel/shell - ../../modules/home-manager/devel/git.nix - ../../modules/home-manager/devel/latex.nix - ../../modules/home-manager/devel/python.nix - ../../modules/home-manager/devel/vscode - ../../modules/home-manager/devel/wezterm.nix - ../../modules/home-manager/theming/theming.nix - ../../modules/home-manager/wm/hyprland # needs hyprland.nix import in configuration.nix - ../../modules/home-manager/wm/kde - ]; - - home.sessionVariables = { - DEPLOY_FLAKE = "${userSettings.flakeDirectory}/hosts/raspberrypi"; - DEPLOY_USER = "leon"; - DEPLOY_HOST = "raspberry.pi"; - DEPLOY_USER_CONFIG_NAME = "leon@raspberrypi"; - DEPLOY_SYSTEM_CONFIG_NAME = "raspberrypi"; - }; - - home.packages = [ - remoteDeploymentHome - remoteDeploymentSystem - ]; - - home.activation = { - myScripts = lib.hm.dag.entryAfter [ "writeBoundary" ] '' - run ln -Tsf ${userSettings.flakeDirectory}/scripts ~/scripts - ''; - }; - - home.stateVersion = "23.11"; # Do not modify -} diff --git a/hosts/raspberrypi/configuration.nix b/hosts/raspberrypi/configuration.nix deleted file mode 100644 index 6480ffd..0000000 --- a/hosts/raspberrypi/configuration.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ inputs, systemSettings, ... }: - -{ - imports = [ - inputs.sops-nix.nixosModules.sops - ./hardware-configuration.nix - ../../modules/system/apps/cli-apps.nix - ../../modules/system/basic - ../../modules/system/server/nextcloud - ../../modules/system/server/pihole.nix - ../../modules/system/server/wireguard.nix - ../../modules/system/server/fail2ban.nix - ]; - - # Setup ssh and remote deployment from leon@inspiron-laptop - users.users.${systemSettings.users."1".username} = { - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM22vgwjJ9HTFLvJTyQcyq4sgEFzI6jAS2FX6aB7AXVK leon@inspiron-laptop" - ]; - }; - nix.settings.trusted-users = [ systemSettings.users."1".username ]; - services.openssh = { - enable = true; - settings = { - PermitRootLogin = "no"; - AllowUsers = [ systemSettings.users."1".username ]; - PasswordAuthentication = false; - }; - }; - - # Use the extlinux boot loader. (NixOS wants to enable GRUB by default) - boot.loader.grub.enable = false; - # Enables the generation of /boot/extlinux/extlinux.conf - boot.loader.generic-extlinux-compatible.enable = true; - - # Networking configuration - networking.hostName = systemSettings.hostname; - networking.wireless.enable = false; # Enables wireless support via wpa_supplicant. - - # Static IP configuration - networking.interfaces.enu1u1u1 = { - useDHCP = false; - ipv4.addresses = [ - { - address = systemSettings.localIp; - prefixLength = 24; - } - ]; - }; - networking.defaultGateway = { - address = "192.168.179.1"; - interface = "enu1u1u1"; - }; - networking.nameservers = [ - "1.1.1.1" - "8.8.8.8" - ]; - - swapDevices = [ - { - device = "/swapfile"; - size = 4096; # size in MB - } - ]; - - system.stateVersion = "24.11"; # Do not modify -} diff --git a/hosts/raspberrypi/flake.nix b/hosts/raspberrypi/flake.nix deleted file mode 100644 index 837a8d3..0000000 --- a/hosts/raspberrypi/flake.nix +++ /dev/null @@ -1,106 +0,0 @@ -{ - description = "Leons Flake for Raspberry Pi Server"; - - outputs = - { self, ... }@inputs: - - let - systemSettings = rec { - hostname = "raspberrypi"; # hostname, unique identifier for building the flake - timezone = "Europe/Vienna"; # timezone - defaultLocale = "en_US.UTF-8"; # default locale - extraLocale = "de_AT.UTF-8"; # extra locale (for measurement, numeric, time, ...) - kblayout = "de"; # keyboard layout - users = { - "1" = { - username = userSettings1.username; # username - name = userSettings1.name; - }; - }; - localIp = "192.168.179.200"; - nextcloud = { - drives = { - main = "usb-TOSHIBA_External_USB_3.0_20200714006512F-0:0-part1"; - backup = "usb-Intenso_External_USB_3.0_20161230160B8-0:0-part1"; - }; - hostName = "amysweinhaus.ddnss.de"; - trusted_domains = [ - localIp - ]; - }; - acmeEmail = "leonvincenterd@web.de"; - pihole.hosts = [ - "${localIp} raspberry.pi" - "${localIp} ${nextcloud.hostName}" - ]; - wireguard = { - externalInterface = "enu1u1u1"; # use "ip a" - clientPeers = [ - { - name = "inspiron-laptop"; - publicKey = "dLHb13EIwUM1HJoEPojOskp18c87Ciu/ZYUZmIkQMBA="; - allowedIPs = [ "10.100.0.2/32" ]; - } - { - name = "leon-handy"; - publicKey = "ahgGz2HSN6L0SaA85tEUccSogdu/6XCOJKsS0XyI238="; - allowedIPs = [ "10.100.0.3/32" ]; - } - ]; - }; - }; - - userSettings1 = rec { - username = "leon"; # username - name = "Leon"; # name/identifier (used for certain configurations i.e. git) - email = "leonvincenterd@web.de"; # email (used for certain configurations i.e. git) - flakeDirectory = "/home/${username}/dotfiles/hosts/raspberrypi"; - kblayout = "de"; - systemConfigurationName = systemSettings.hostname; - userConfigurationName = "${username}@${systemConfigurationName}"; - }; - - myPkgs = import inputs.nixpkgs { - system = "aarch64-linux"; # system arch (checkout hardware-configuration.nix -> nixpkgs.hostPlatform); - config.allowUnfree = true; - }; - in - - { - nixosConfigurations.${systemSettings.hostname} = inputs.nixpkgs.lib.nixosSystem { - modules = [ ./configuration.nix ]; - specialArgs = { - inherit inputs; - inherit myPkgs; - inherit systemSettings; - }; - }; - - homeConfigurations.${userSettings1.userConfigurationName} = - inputs.home-manager.lib.homeManagerConfiguration - { - pkgs = myPkgs; - modules = [ ./home.nix ]; - extraSpecialArgs = { - # pass config variables from above - inherit inputs; - userSettings = userSettings1; - #inherit pkgsLocal; - }; - }; - }; - - inputs = { - nixpkgs.url = "nixpkgs/nixos-unstable"; - - home-manager = { - url = "github:nix-community/home-manager/master"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - sops-nix = { - url = "github:Mic92/sops-nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - }; -} diff --git a/hosts/raspberrypi/home.nix b/hosts/raspberrypi/home.nix deleted file mode 100644 index b999c63..0000000 --- a/hosts/raspberrypi/home.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ inputs, ... }: - -{ - imports = [ - inputs.sops-nix.homeManagerModules.sops - ../../modules/home-manager/basic.nix - ../../modules/home-manager/devel/shell - ../../modules/home-manager/devel/git.nix - # ../../modules/home-manager/devel/python.nix - ]; - - home.stateVersion = "24.11"; # Do not modify -} diff --git a/hosts/zollsoft-mac/configuration.nix b/hosts/zollsoft-mac/configuration.nix deleted file mode 100644 index 10b9b79..0000000 --- a/hosts/zollsoft-mac/configuration.nix +++ /dev/null @@ -1,72 +0,0 @@ -{ pkgs, inputs, ... }: - -let - primaryUser = "leon.erd"; -in -{ - imports = [ - ../../modules/system/apps/cli-apps.nix - ../../modules/system/basic/settings.nix - ../../modules/system/basic/macos-settings.nix - inputs.nix-homebrew.darwinModules.nix-homebrew - ]; - - nix-homebrew = { - enable = true; - enableRosetta = true; # for Apple Silicon - user = primaryUser; - # declarative tap management - taps = { }; - mutableTaps = true; # with mutableTaps disabled, taps can no longer be added imperatively with `brew tap` - autoMigrate = true; - }; - - homebrew = { - enable = true; - brews = [ - "rbenv" # better as brew than nix package because brew package has all dependencies included that we need for "gem install" - "gettext" - "ktlint" - ]; - casks = [ - "claude-code" - "gather" - "jetbrains-toolbox" - "karabiner-elements" - "keka" - "libreoffice" - "middleclick" - "nextcloud" - "openvpn-connect" - "postman" - "scroll-reverser" - "teamviewer" - "ukelele" - ]; - onActivation = { - cleanup = "zap"; - upgrade = true; - autoUpdate = true; - }; - }; - - # development tools - environment.systemPackages = with pkgs; [ - docker-compose - docker-credential-helpers - fvm - glab - podman - ]; - - fonts.packages = with pkgs.nerd-fonts; [ - hack - jetbrains-mono - ]; - - system.primaryUser = primaryUser; - - # Used for backwards compatibility, please read the changelog before changing. - # $ darwin-rebuild changelog - system.stateVersion = 6; -} diff --git a/hosts/zollsoft-mac/flakeConfiguration.nix b/hosts/zollsoft-mac/flakeConfiguration.nix deleted file mode 100644 index 7ad760c..0000000 --- a/hosts/zollsoft-mac/flakeConfiguration.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ self, ... }@inputs: - -let - myPkgs = import inputs.nixpkgs { - overlays = [ - inputs.nur.overlays.default - inputs.nix-vscode-extensions.overlays.default - (import ../../overlays) - ]; - system = "aarch64-darwin"; - config.allowUnfree = true; - }; - - #pkgsLocal = import inputs.nixpkgsLocal { - # system = "aarch64-darwin"; - # config.allowUnfree = true; - #}; - - userSettings1 = rec { - username = "leon.erd"; # username - name = "Leon Erd"; # name/identifier (used for certain configurations i.e. git) - email = "leon.erd@zollsoft.de"; # email (used for certain configurations i.e. git) - flakeDirectory = "/Users/${username}/dotfiles"; - systemConfigurationName = "zollsoft-mac"; - userConfigurationName = "${username}@zollsoft-mac"; - isLinux = myPkgs.stdenv.isLinux; - }; -in - -{ - zollsoft-mac = inputs.nix-darwin.lib.darwinSystem { - modules = [ - ./configuration.nix - { - # Set Git commit hash for darwin-version. - system.configurationRevision = self.rev or self.dirtyRev or null; - } - ]; - specialArgs = { - inherit inputs; - inherit myPkgs; - }; - }; - - ${userSettings1.userConfigurationName} = inputs.home-manager.lib.homeManagerConfiguration { - pkgs = myPkgs; - modules = [ ./home.nix ]; - extraSpecialArgs = { - # pass config variables from above - inherit inputs; - userSettings = userSettings1; - #inherit pkgsLocal; - }; - }; -} diff --git a/hosts/zollsoft-mac/home.nix b/hosts/zollsoft-mac/home.nix deleted file mode 100644 index 405160a..0000000 --- a/hosts/zollsoft-mac/home.nix +++ /dev/null @@ -1,66 +0,0 @@ -{ - lib, - pkgs, - userSettings, - ... -}: - -{ - imports = [ - ./hm-copy-apps.nix # https://github.com/nix-darwin/nix-darwin/pull/1396#issuecomment-2745290935 - ../../modules/home-manager/apps/misc.nix - ../../modules/home-manager/apps/submodules/thunderbird.nix - ../../modules/home-manager/devel/shell - ../../modules/home-manager/devel/git.nix - ../../modules/home-manager/devel/python.nix - ../../modules/home-manager/devel/vscode - ../../modules/home-manager/devel/wezterm.nix - ../../modules/home-manager/wm/aerospace - ../../modules/home-manager/wm/useful_utilities/autoraise.nix - ../../modules/home-manager/wm/useful_utilities/karabiner - ]; - - # Home Manager needs a bit of information about you and the paths it should - # manage. - home.username = userSettings.username; - home.homeDirectory = "/Users/${userSettings.username}"; - xdg.enable = true; - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; - - # dont manage toolbar bookmarks - programs.firefox.profiles.${userSettings.username} = { - settings = lib.mkForce { - "browser.toolbars.bookmarks.visibility" = "never"; - }; - bookmarks = lib.mkForce { }; - }; - - # custom init contents from client and server setup according to ZiWi - programs.zsh.initContent = '' - export PATH="/opt/homebrew/bin:$PATH" - export PATH="$PATH:/usr/local/bin" - export PATH="$PATH:$HOME/.pub-cache/bin" - ## [Completion] - ## Completion scripts setup. Remove the following line to uninstall - [[ -f /Users/leon.erd/.dart-cli-completion/zsh-config.zsh ]] && . /Users/leon.erd/.dart-cli-completion/zsh-config.zsh || true - ## [/Completion] - eval "$(rbenv init - zsh)" - export LANG=en_US.UTF-8 - ''; - - # If spotlight doens't show some apps, try rebuilding its index - # https://support.apple.com/en-us/102321 - - home.packages = with pkgs; [ - appcleaner - autoraise - betterdisplay - slack - spotify - telegram-desktop - ]; - - home.stateVersion = "25.05"; # Do not modify -} diff --git a/modules/home-manager/apps/media.nix b/modules/home-manager/apps/media.nix deleted file mode 100644 index 99dd475..0000000 --- a/modules/home-manager/apps/media.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, ... }: - -{ - home.packages = with pkgs; [ - gthumb - mpv - qpwgraph - spotify - vlc - ]; -} diff --git a/modules/home-manager/apps/misc.nix b/modules/home-manager/apps/misc.nix deleted file mode 100644 index 4c2b980..0000000 --- a/modules/home-manager/apps/misc.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ - pkgs, - lib, - userSettings, - ... -}: - -let - - allConfig = { - home.packages = with pkgs; [ - bitwarden-desktop - meld - ]; - }; - - linuxConfig = { - services.nextcloud-client = { - enable = true; - startInBackground = true; - }; - - programs.distrobox = { - enable = true; - containers = { }; - }; - }; - -in -{ - imports = [ - ./submodules/firefox.nix - ]; -} -// lib.mkMerge [ - allConfig - (lib.optionalAttrs userSettings.isLinux linuxConfig) -] diff --git a/modules/home-manager/apps/office.nix b/modules/home-manager/apps/office.nix deleted file mode 100644 index 7a35a01..0000000 --- a/modules/home-manager/apps/office.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - pkgs, - lib, - config, - userSettings, - ... -}: - -{ - home.packages = with pkgs; [ - qalculate-gtk - xournalpp - ]; - - programs.onlyoffice.enable = true; - - home.activation = { - myXorunalppSettings = - let - symlinkDir = "${config.xdg.configHome}/xournalpp"; - targetDirectory = "${userSettings.flakeDirectory}/modules/home-manager/apps/config_files"; - in - lib.hm.dag.entryAfter [ "writeBoundary" ] '' - run ln -sf ${targetDirectory}/xournalpp_settings.xml ${symlinkDir}/settings.xml - ''; - }; -} diff --git a/modules/home-manager/apps/qt-apps.nix b/modules/home-manager/apps/qt-apps.nix deleted file mode 100644 index 3b2e5aa..0000000 --- a/modules/home-manager/apps/qt-apps.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ - lib, - pkgs, - userSettings, - config, - ... -}: - -# you can also set the following in ~/.config/kdeglobals instead of the individual rc files: -# [UiSettings] -# ColorScheme=LayanDark - -# [Icons] -# Theme=Tela - -{ - home.packages = with pkgs; [ - kdePackages.ark - kdePackages.dolphin - kdePackages.dolphin-plugins - kdePackages.kio-extras # mtp support for dolphin - kdePackages.filelight - kdePackages.kate - kdePackages.okular - qalculate-qt - ]; - - # https://github.com/NixOS/nixpkgs/issues/409986 - # https://discourse.nixos.org/t/dolphin-does-not-have-mime-associations/48985/7 - # if not working, try clearing cache - xdg.configFile."menus/applications.menu".source = - "${pkgs.kdePackages.plasma-workspace}/etc/xdg/menus/plasma-applications.menu"; - - home.activation = { - myQtRcFiles = - let - symlinkDir = config.xdg.configHome; - targetDirectory = "${userSettings.flakeDirectory}/modules/home-manager/apps/config_files"; - in - lib.hm.dag.entryAfter [ "writeBoundary" ] '' - run ln -sf ${targetDirectory}/dolphinrc ${symlinkDir}/dolphinrc - run ln -sf ${targetDirectory}/katerc ${symlinkDir}/katerc - run ln -sf ${targetDirectory}/kwriterc ${symlinkDir}/kwriterc - run ln -sf ${targetDirectory}/okularrc ${symlinkDir}/okularrc - ''; - }; -} diff --git a/modules/home-manager/apps/social.nix b/modules/home-manager/apps/social.nix deleted file mode 100644 index d3f41fa..0000000 --- a/modules/home-manager/apps/social.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ pkgs, ... }: - -{ - imports = [ - ./submodules/thunderbird.nix - ]; - - home.packages = with pkgs; [ - signal-desktop - slack - telegram-desktop - discord - wasistlos # whatsapp-for-linux - ]; -} diff --git a/modules/home-manager/apps/submodules/firefox.nix b/modules/home-manager/apps/submodules/firefox.nix deleted file mode 100644 index 5b8afff..0000000 --- a/modules/home-manager/apps/submodules/firefox.nix +++ /dev/null @@ -1,132 +0,0 @@ -{ pkgs, userSettings, ... }: - -{ - programs.firefox = { - enable = true; - profiles.${userSettings.username} = { - search = { - default = "ddg"; # DuckDuckGo - force = true; - }; - settings = { - "browser.startup.page" = 3; # resume previous session - "signon.rememberSignons" = false; # don't ask to save passwords - "extensions.activeThemeID" = "firefox-compact-light@mozilla.org"; # light theme - "extensions.autoDisableScopes" = 0; # automatically enable extensions installed with home-manager - "browser.toolbars.bookmarks.visibility" = "always"; # toolbar always visible - "browser.download.always_ask_before_handling_new_types" = true; # ask whether to "open" or to "save" - "browser.download.start_downloads_in_tmp_dir" = true; # if "open" selected: save in tmp dir - "browser.download.useDownloadDir" = false; # if "save" selected: ask where to save - # Privacy - "app.shield.optoutstudies.enabled" = false; - "privacy.donottrackheader.enabled" = true; - "privacy.globalprivacycontrol.enabled" = true; - "privacy.trackingprotection.enabled" = true; - "dom.private-attribution.submission.enabled" = false; - "datareporting.healthreport.uploadEnabled" = false; - }; - extensions = { - force = true; - packages = with pkgs.nur.repos.rycee.firefox-addons; [ - betterttv - bitwarden - duckduckgo-privacy-essentials - grammarly - ublock-origin - videospeed - vimium-c - ]; - # to find the settings in firefox: - # 1. make desired changes to the extension - # 2. go to - # about:debugging#/runtime/this-firefox - # 3. find the Extension ID and inspect the extension - # 4. try the following commands in the console: - # await browser.storage.sync.get(null); - # await browser.storage.local.get(null); - settings = { - "vimium-c@gdh1995.cn" = { - settings = { - exclusionRules = [ - { - passKeys = ""; - pattern = "^https?://[^/]*twitch.tv/"; - } - { - passKeys = ""; - pattern = "^https?://[^/]*kick.com/"; - } - { - passKeys = ""; - pattern = "^https?://[^/]*youtube.com/watch"; - } - ]; - }; - }; - "uBlock0@raymondhill.net" = { - settings = { - # https://github.com/pixeltris/TwitchAdSolutions?tab=readme-ov-file#applying-a-script-ublock-origin - # https://raw.githubusercontent.com/pixeltris/TwitchAdSolutions/master/video-swap-new/video-swap-new-ublock-origin.js - # - # If block doesn't work, try manually unsetting userResourcesLocation and setting it back to the URL - "user-filters" = "twitch.tv##+js(twitch-videoad)"; - hiddenSettings = { - userResourcesLocation = "https://raw.githubusercontent.com/pixeltris/TwitchAdSolutions/master/video-swap-new/video-swap-new-ublock-origin.js"; - }; - }; - }; - }; - }; - bookmarks = { - force = true; - settings = [ - { - toolbar = true; - bookmarks = [ - { - name = "Fast.com"; - url = "https://fast.com"; - } - { - name = "Amy's Weinhaus"; - url = "https://amysweinhaus.ddnss.de"; - } - { - name = "Pihole"; - url = "https://pi.hole:8443"; - } - { - name = "Github"; - url = "https://github.com/"; - } - { - name = "Twitch"; - url = "https://twitch.tv/directory/following"; - } - { - name = "Youtube"; - url = "https://youtube.com"; - } - { - name = "ChatGPT"; - url = "https://chat.openai.com"; - } - { - name = "T3 Chat"; - url = "https://t3.chat/"; - } - { - name = "Noogle"; - url = "https://noogle.dev/"; - } - ]; - } - ]; - }; - }; - }; - - home.sessionVariables = { - MOZ_USE_XINPUT2 = 1; # better touch support - }; -} diff --git a/modules/home-manager/apps/submodules/thunderbird.nix b/modules/home-manager/apps/submodules/thunderbird.nix deleted file mode 100644 index 031e4d9..0000000 --- a/modules/home-manager/apps/submodules/thunderbird.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ userSettings, ... }: - -{ - programs.thunderbird = { - enable = true; - profiles.${userSettings.username} = { - isDefault = true; - settings = { - "extensions.activeThemeID" = "thunderbird-compact-light@mozilla.org"; - }; - }; - }; -} diff --git a/modules/home-manager/basic/basic.nix b/modules/home-manager/basic/basic.nix deleted file mode 100644 index a33e9f3..0000000 --- a/modules/home-manager/basic/basic.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ userSettings, ... }: - -{ - # Home Manager needs a bit of information about you and the paths it should - # manage. - home.username = userSettings.username; - home.homeDirectory = "/home/${userSettings.username}"; - xdg.enable = true; - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; -} diff --git a/modules/home-manager/basic/default.nix b/modules/home-manager/basic/default.nix deleted file mode 100644 index 0ec9701..0000000 --- a/modules/home-manager/basic/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: - -{ - imports = [ - ./basic.nix - ./sops.nix - ]; -} diff --git a/modules/home-manager/basic/sops.nix b/modules/home-manager/basic/sops.nix deleted file mode 100644 index 53cdb15..0000000 --- a/modules/home-manager/basic/sops.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, ... }: - -{ - sops = { - age.keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt"; - defaultSopsFile = ../../secrets/secrets.yaml; - defaultSopsFormat = "yaml"; - }; -} diff --git a/modules/home-manager/devel/alacritty.nix b/modules/home-manager/devel/alacritty.nix deleted file mode 100644 index 12f99ec..0000000 --- a/modules/home-manager/devel/alacritty.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ ... }: - -{ - programs.alacritty = { - enable = true; - settings = { - cursor.style = { - blinking = "On"; - shape = "Beam"; - }; - selection.save_to_clipboard = true; - window.opacity = 0.75; - font.normal.family = "Hack Nerd Font Mono"; - }; - }; -} diff --git a/modules/home-manager/devel/git.nix b/modules/home-manager/devel/git.nix deleted file mode 100644 index 2c370e4..0000000 --- a/modules/home-manager/devel/git.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ userSettings, pkgs, ... }: - -{ - home.packages = with pkgs; [ - glab - ]; - - programs.git = { - enable = true; - settings = { - user = { - name = userSettings.name; - email = userSettings.email; - }; - fetch.prune = true; - }; - signing.format = "openpgp"; - }; - - programs.gh.enable = true; -} diff --git a/modules/home-manager/devel/latex.nix b/modules/home-manager/devel/latex.nix deleted file mode 100644 index 3fb7e52..0000000 --- a/modules/home-manager/devel/latex.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ pkgs, ... }: - -{ - home.packages = with pkgs; [ - ipe - # jabref - pympress - ]; - - programs.texlive = { - enable = true; - extraPackages = (tpkgs: { inherit (tpkgs) scheme-full; }); - }; -} diff --git a/modules/home-manager/devel/python.nix b/modules/home-manager/devel/python.nix deleted file mode 100644 index bea0a0b..0000000 --- a/modules/home-manager/devel/python.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, ... }: - -{ - home.packages = with pkgs; [ - micromamba - ]; - - programs.zsh = { - initContent = "eval \"$(micromamba shell hook --shell zsh)\""; - }; -} diff --git a/modules/home-manager/devel/shell/default.nix b/modules/home-manager/devel/shell/default.nix deleted file mode 100644 index a3e0a69..0000000 --- a/modules/home-manager/devel/shell/default.nix +++ /dev/null @@ -1,188 +0,0 @@ -{ - config, - lib, - pkgs, - userSettings, - ... -}: - -let - hasWireguardConfig = userSettings ? wireguardConfig; - - vpnPiAliases = lib.optionalAttrs hasWireguardConfig { - vpn_pi_on = "wg-quick up ${config.sops.secrets."wireguard.conf".path}"; - vpn_pi_off = "wg-quick down ${config.sops.secrets."wireguard.conf".path}"; - }; - - myAliases = { - clearswap = "sudo swapoff -a; sudo swapon -a"; - conda = "micromamba"; - fhs = "nix-shell -E 'with import {}; (pkgs.buildFHSUserEnv { name = \"fhs\"; runScript = \"zsh\"; }).env'"; - get-temp = '' - paste <(cat /sys/class/thermal/thermal_zone*/type) \ - <(cat /sys/class/thermal/thermal_zone*/temp) | \ - awk -F'\t' '{printf "%s\t%.1f°C\n", $1, $2/1000}' | \ - column -s $'\t' -t - ''; - git-branch-collect-garbage = "git branch -vv | grep ': gone]' | awk '{print $1}' | xargs git branch -D"; - homie = "nh home switch --configuration ${userSettings.userConfigurationName}"; - nixie = "nh os switch --hostname ${userSettings.systemConfigurationName}"; - darwie = "nh darwin switch --hostname ${userSettings.systemConfigurationName}"; - neofetch = "nix run nixpkgs\#fastfetch -- --config examples/7.jsonc"; - root-shell = "sudo env \"HOME=/home/$USER\" zsh --login"; - tree = "eza --tree"; - venv = "source venv/bin/activate"; - } - // vpnPiAliases; - - myLessfilter = pkgs.writeShellApplication { - name = "my-lessfilter"; - - runtimeInputs = with pkgs; [ - bat - chafa - eza - file - gnused - hr - poppler-utils - ]; - - text = builtins.readFile ./lessfilter; - }; -in -{ - # packages for vpn aliases - home.packages = with pkgs; [ - wireguard-tools - ]; - - programs.zsh = { - enable = true; - dotDir = "${config.xdg.configHome}/zsh"; - autocd = true; - autosuggestion.enable = true; - syntaxHighlighting.enable = true; - shellAliases = myAliases; - oh-my-zsh = { - enable = true; - theme = ""; # "robbyrussell"; # use custom starship theme below - custom = "$XDG_CONFIG_HOME/oh-my-zsh/custom"; - plugins = [ - "alias-finder" - # https://github.com/NixOS/nixpkgs/issues/171054 - # https://blog.nobbz.dev/blog/2023-02-27-nixos-flakes-command-not-found/ - # sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos && sudo nix-channel --update - "command-not-found" - "eza" - "fzf" - "git" - "pip" - "rsync" - "sudo" - ]; - }; - plugins = [ - { - name = "fzf-tab"; - src = "${pkgs.zsh-fzf-tab}/share/fzf-tab"; - } - ]; - initContent = '' - # clear screen with ctrl-k (instead of zsh's default behavior of just moving the prompt to the top) - bindkey -s '^K' 'clear\n' - - # shift-tab to accept autosuggestions - bindkey '^[[Z' autosuggest-accept - - # https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/alias-finder - zstyle ':omz:plugins:alias-finder' autoload yes - - # https://github.com/Aloxaf/fzf-tab?tab=readme-ov-file#configure - zstyle ':completion:*:git-checkout:*' sort false - zstyle ':completion:*:descriptions' format '[%d]' - zstyle ':completion:*' list-colors ''${(s.:.)LS_COLORS} - zstyle ':completion:*' menu no - zstyle ':fzf-tab:*' fzf-flags --bind=tab:accept --style=full --height=20 #--height=-2 - zstyle ':fzf-tab:*' switch-group '<' '>' - - # https://github.com/Aloxaf/fzf-tab/wiki/Preview - # preview for systemctl - zstyle ':fzf-tab:complete:systemctl-*:*' fzf-preview 'SYSTEMD_COLORS=1 systemctl status $word' - # preview for env vars - zstyle ':fzf-tab:complete:(-command-|-parameter-|-brace-parameter-|export|unset|expand):*' fzf-preview 'echo ''${(P)word}' - # disable preview for command options and subcommands - zstyle ':fzf-tab:complete:*:options' fzf-preview - zstyle ':fzf-tab:complete:*:argument-1' fzf-preview - # use less with custom lessfilter for anything else - zstyle ':fzf-tab:complete:*:*' fzf-preview 'less ''${(Q)realpath}' - export LESSOPEN='|${lib.getExe myLessfilter} %s' - - bindkey -s '\e[1;3A' 'cd ..\n' - ''; - }; - - # https://github.com/NixOS/nixpkgs/pull/416425 - programs.command-not-found.enable = true; - - programs.starship = { - enable = true; - settings = { - add_newline = false; - format = "$all"; - character = { - success_symbol = "[➜](fg:green)"; - error_symbol = "[➜](fg:red)"; - }; - conda.disabled = true; # conda has its own prompt modifier, you could also disable that instead with `conda config --set changeps1 False` - line_break.disabled = true; - directory.format = "[$path]($style) [$read_only]($read_only_style)"; - git_status = { - style = "bold purple"; - format = "([\\($all_status$ahead_behind\\)]($style) )"; - }; - hostname = { - ssh_symbol = "🌐"; - style = "bold blue"; - }; - username.style_user = "bold blue"; - }; - }; - - programs.bash = { - enable = true; - shellAliases = myAliases; - }; - - programs.zoxide = { - enable = true; - options = [ - "--cmd cd" - ]; - }; - - programs.eza = { - enable = true; - icons = "auto"; - extraOptions = [ - "--color-scale=all" - "--group" - "--group-directories-first" - "--header" - "--hyperlink" - ]; - }; - - home.sessionVariables = { - FLAKE = userSettings.flakeDirectory; - NH_FLAKE = userSettings.flakeDirectory; - }; -} -// lib.optionalAttrs hasWireguardConfig { - sops.secrets = { - "wireguard.conf" = { - format = "binary"; - sopsFile = userSettings.wireguardConfig; - }; - }; -} diff --git a/modules/home-manager/devel/vscode/default.nix b/modules/home-manager/devel/vscode/default.nix deleted file mode 100644 index fdf0bf5..0000000 --- a/modules/home-manager/devel/vscode/default.nix +++ /dev/null @@ -1,59 +0,0 @@ -{ - lib, - pkgs, - userSettings, - ... -}: - -let - vscodePackage = if userSettings.isLinux then pkgs.vscode-fhs else pkgs.vscode; -in -{ - programs.vscode = { - enable = true; - package = vscodePackage; - profiles.default.extensions = - with (pkgs.forVSCodeVersion vscodePackage.version).vscode-marketplace; [ - aaron-bond.better-comments - charliermarsh.ruff - corker.vscode-micromamba - # github.copilot # install copilot manually (will fetch correct version of copilot-chat) - # github.copilot-chat - gruntfuggly.todo-tree - james-yu.latex-workshop - jnoortheen.nix-ide - k--kato.intellij-idea-keybindings - ms-python.python - ms-python.vscode-pylance - # ms-toolsai.jupyter # you have to install jupyter manually for some reason - # ms-toolsai.jupyter-keymap - # ms-toolsai.jupyter-renderers - # ms-toolsai.vscode-jupyter-cell-tags - # ms-toolsai.vscode-jupyter-slideshow - naumovs.color-highlight - njpwerner.autodocstring - patbenatar.advanced-new-file - pkief.material-icon-theme - # valentjn.vscode-ltex # install ltex manually (it wants to download the language server but fails when attempting to write to read-only /nix/store) - ]; - }; - - home.packages = with pkgs; [ - nixd # language server - nixfmt-rfc-style # formatter - ]; - - home.activation = { - myVscodeFiles = - let - vscodePath = - if userSettings.isLinux then "~/.config/Code" else "~/Library/Application\\ Support/Code"; - targetDirectory = "${userSettings.flakeDirectory}/modules/home-manager/devel/vscode"; - in - lib.hm.dag.entryAfter [ "writeBoundary" ] '' - run mkdir -p ${vscodePath}/User - run ln -sf ${targetDirectory}/keybindings.json ${vscodePath}/User/keybindings.json - run ln -sf ${targetDirectory}/settings.json ${vscodePath}/User/settings.json - ''; - }; -} diff --git a/modules/home-manager/devel/vscode/test_vsextensions_with_nix4vscode/extensions/default.nix b/modules/home-manager/devel/vscode/test_vsextensions_with_nix4vscode/extensions/default.nix deleted file mode 100644 index d203af2..0000000 --- a/modules/home-manager/devel/vscode/test_vsextensions_with_nix4vscode/extensions/default.nix +++ /dev/null @@ -1,36 +0,0 @@ -with import { - overlays = [ - (import (fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz")) - ]; -}; - -let - rustPlatform = makeRustPlatform { - cargo = rust-bin.selectLatestNightlyWith (toolchain: toolchain.default); - rustc = rust-bin.selectLatestNightlyWith (toolchain: toolchain.default); - }; -in - -rustPlatform.buildRustPackage rec { - pname = "nix4vscode"; - version = "unstable-2024-03-18"; - - src = fetchFromGitHub { - owner = "nix-community"; - repo = pname; - rev = "06e9ed7c9dcf0e5594647bd7d1a94b0023d11b31"; - hash = "sha256-7RiMkuDO0GlzM3+oHUM/3HQBZWY5j+/9SEqCunIceYE="; - }; - - cargoHash = "sha256-LB1yOnVqeCamZSm0YNjvoeiClxuXTiIZ64D6vZ0Un8w="; - - doCheck = false; - - meta = with lib; { - description = "A tool generate nix expression from config.toml"; - homepage = "https://github.com/nix-community/nix4vscode"; - mainProgram = "nix4vscode"; - platforms = platforms.linux; - }; - -} diff --git a/modules/home-manager/devel/vscode/test_vsextensions_with_nix4vscode/extensions/extensions.nix b/modules/home-manager/devel/vscode/test_vsextensions_with_nix4vscode/extensions/extensions.nix deleted file mode 100644 index eac96f3..0000000 --- a/modules/home-manager/devel/vscode/test_vsextensions_with_nix4vscode/extensions/extensions.nix +++ /dev/null @@ -1,197 +0,0 @@ -{ pkgs, lib }: - -let - inherit (pkgs.stdenv) - isDarwin - isLinux - isi686 - isx86_64 - isAarch32 - isAarch64 - ; - vscode-utils = pkgs.vscode-utils; - merge = lib.attrsets.recursiveUpdate; -in -merge - (merge - (merge - (merge - { - "ms-python"."python" = vscode-utils.extensionFromVscodeMarketplace { - name = "python"; - publisher = "ms-python"; - version = "2024.3.10742127"; - sha256 = "187x6j7300wgvcxh2lcic6ivvavsllzhq0cayqiji943pw3z3k2r"; - }; - "ms-toolsai"."jupyter-keymap" = vscode-utils.extensionFromVscodeMarketplace { - name = "jupyter-keymap"; - publisher = "ms-toolsai"; - version = "1.1.2"; - sha256 = "02rb4r5zspicj2c7ffrr6xj6dmk0948lnl2f8f89xlfrkh2z44pl"; - }; - "ms-toolsai"."jupyter-renderers" = vscode-utils.extensionFromVscodeMarketplace { - name = "jupyter-renderers"; - publisher = "ms-toolsai"; - version = "1.0.17"; - sha256 = "1c065s2cllf2x90i174qs2qyzywrlsjkc6agcc9qvdsb426c6r9l"; - }; - "ms-toolsai"."vscode-jupyter-cell-tags" = vscode-utils.extensionFromVscodeMarketplace { - name = "vscode-jupyter-cell-tags"; - publisher = "ms-toolsai"; - version = "0.1.8"; - sha256 = "14zzr0dyr110yn53d984bk6hdn0mgva4jxvxzihvsn6lv6kg50yj"; - }; - "ms-toolsai"."vscode-jupyter-slideshow" = vscode-utils.extensionFromVscodeMarketplace { - name = "vscode-jupyter-slideshow"; - publisher = "ms-toolsai"; - version = "0.1.5"; - sha256 = "1p6r5vkzvwvxif3wxqi9599vplabzig27fzzz0bx9z0awfglzyi7"; - }; - "pkief"."material-icon-theme" = vscode-utils.extensionFromVscodeMarketplace { - name = "material-icon-theme"; - publisher = "pkief"; - version = "4.34.0"; - sha256 = "1ahshxw66436mc9jpiyfac0hinnqm3s0g3akybjrda13yd9884y7"; - }; - "github"."copilot" = vscode-utils.extensionFromVscodeMarketplace { - name = "copilot"; - publisher = "github"; - version = "1.174.0"; - sha256 = "1id269bhgczb9m6lml6zaihglyz5l88y48xrs8v1hgqk32z30gza"; - }; - "njpwerner"."autodocstring" = vscode-utils.extensionFromVscodeMarketplace { - name = "autodocstring"; - publisher = "njpwerner"; - version = "0.6.1"; - sha256 = "11vsvr3pggr6xn7hnljins286x6f5am48lx4x8knyg8r7dp1r39l"; - }; - "github"."copilot-chat" = vscode-utils.extensionFromVscodeMarketplace { - name = "copilot-chat"; - publisher = "github"; - version = "0.13.2024022301"; - sha256 = "0bwg242sr1wi6dv7h8509xz499bg2vqk9p3z9jmai0vb8wn27njr"; - }; - "naumovs"."color-highlight" = vscode-utils.extensionFromVscodeMarketplace { - name = "color-highlight"; - publisher = "naumovs"; - version = "2.8.0"; - sha256 = "14capk3b7rs105ij4pjz42zsysdfnkwfjk9lj2cawnqxa7b8ygcr"; - }; - "aaron-bond"."better-comments" = vscode-utils.extensionFromVscodeMarketplace { - name = "better-comments"; - publisher = "aaron-bond"; - version = "3.0.2"; - sha256 = "15w1ixvp6vn9ng6mmcmv9ch0ngx8m85i1yabxdfn6zx3ypq802c5"; - }; - "james-yu"."latex-workshop" = vscode-utils.extensionFromVscodeMarketplace { - name = "latex-workshop"; - publisher = "james-yu"; - version = "9.19.1"; - sha256 = "15k0kd12kkgsxgdr8rw3379gbgffdcxw6hb2fzsca9n32bkwym1i"; - }; - "k--kato"."intellij-idea-keybindings" = vscode-utils.extensionFromVscodeMarketplace { - name = "intellij-idea-keybindings"; - publisher = "k--kato"; - version = "1.6.0"; - sha256 = "0sq9ga1xnnkzrvvnw54a3lqb1cy45b78v86j5mrx3g8jmqqnr03n"; - }; - "patbenatar"."advanced-new-file" = vscode-utils.extensionFromVscodeMarketplace { - name = "advanced-new-file"; - publisher = "patbenatar"; - version = "1.2.2"; - sha256 = "09a6yldbaz9d7gn9ywkqd96l3pkc0y30b6b02nv2qigli6aihm6g"; - }; - "znck"."grammarly" = vscode-utils.extensionFromVscodeMarketplace { - name = "grammarly"; - publisher = "znck"; - version = "0.25.0"; - sha256 = "048bahfaha3i6sz1b5jkyhfd2aiwgpkmyy2i7hlzc45g1289827z"; - }; - "jnoortheen"."nix-ide" = vscode-utils.extensionFromVscodeMarketplace { - name = "nix-ide"; - publisher = "jnoortheen"; - version = "0.3.1"; - sha256 = "1cpfckh6zg8byi6x1llkdls24w9b0fvxx4qybi9zfcy5gc60r6nk"; - }; - "corker"."vscode-micromamba" = vscode-utils.extensionFromVscodeMarketplace { - name = "vscode-micromamba"; - publisher = "corker"; - version = "0.1.20"; - sha256 = "0y0382wgyn1rvzgn9f8fsr34zbw3w4ynp6xll3fgz299nz9rr0gz"; - }; - } - ( - lib.attrsets.optionalAttrs (isLinux && (isi686 || isx86_64)) { - "ms-toolsai"."jupyter" = vscode-utils.extensionFromVscodeMarketplace { - name = "jupyter"; - publisher = "ms-toolsai"; - version = "2024.2.2024022602"; - sha256 = "1j61qbbskq9pjxkis042k6ainmsmc2vc70wyxrk298n1a94mfqsy"; - arch = "linux-x64"; - }; - "charliermarsh"."ruff" = vscode-utils.extensionFromVscodeMarketplace { - name = "ruff"; - publisher = "charliermarsh"; - version = "2024.16.0"; - sha256 = "1qha198h9zp95wf6fqd7zagk0pcd5vxxx4n7n1kqb29n78zk56yr"; - arch = "linux-x64"; - }; - } - ) - ) - ( - lib.attrsets.optionalAttrs (isLinux && (isAarch32 || isAarch64)) { - "ms-toolsai"."jupyter" = vscode-utils.extensionFromVscodeMarketplace { - name = "jupyter"; - publisher = "ms-toolsai"; - version = "2024.2.2024022602"; - sha256 = "1709nsasjcpjcjhyvjimyz1q1sq1f3zi6276d7pxpysivpz0h4jz"; - arch = "linux-arm64"; - }; - "charliermarsh"."ruff" = vscode-utils.extensionFromVscodeMarketplace { - name = "ruff"; - publisher = "charliermarsh"; - version = "2024.16.0"; - sha256 = "1b3zrm58zjr4v7n1gfklx6n8w2ywhgr5l1g596qpa1fab0pljkz3"; - arch = "linux-arm64"; - }; - } - ) - ) - ( - lib.attrsets.optionalAttrs (isDarwin && (isi686 || isx86_64)) { - "ms-toolsai"."jupyter" = vscode-utils.extensionFromVscodeMarketplace { - name = "jupyter"; - publisher = "ms-toolsai"; - version = "2024.2.2024022602"; - sha256 = "0am5837rfzwc1j3zy01lmmd8803x498k88gyp7ibl0jqpkqk8wl1"; - arch = "darwin-x64"; - }; - "charliermarsh"."ruff" = vscode-utils.extensionFromVscodeMarketplace { - name = "ruff"; - publisher = "charliermarsh"; - version = "2024.16.0"; - sha256 = "0cvh1bk0kb1xp3b733fn6ny0zyv5fk744yccw3kaa15gk7c05v6q"; - arch = "darwin-x64"; - }; - } - ) - ) - ( - lib.attrsets.optionalAttrs (isDarwin && (isAarch32 || isAarch64)) { - "ms-toolsai"."jupyter" = vscode-utils.extensionFromVscodeMarketplace { - name = "jupyter"; - publisher = "ms-toolsai"; - version = "2024.2.2024022602"; - sha256 = "0h1l3nidzq8n3d8z5jingbdv5hckb8wg1609cmn89hyjnafwvmwy"; - arch = "darwin-arm64"; - }; - "charliermarsh"."ruff" = vscode-utils.extensionFromVscodeMarketplace { - name = "ruff"; - publisher = "charliermarsh"; - version = "2024.16.0"; - sha256 = "042nf94k66kkhr6ydb8kx5b00v45wnly8vvpyn8z0c2lbxc74hbk"; - arch = "darwin-arm64"; - }; - } - ) diff --git a/modules/home-manager/devel/vscode/test_vsextensions_with_nix4vscode/extensions/pylance.nix b/modules/home-manager/devel/vscode/test_vsextensions_with_nix4vscode/extensions/pylance.nix deleted file mode 100644 index f799de5..0000000 --- a/modules/home-manager/devel/vscode/test_vsextensions_with_nix4vscode/extensions/pylance.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ pkgs, lib }: - -let - vscode-utils = pkgs.vscode-utils; -in -{ - "ms-python"."vscode-pylance" = vscode-utils.extensionFromVscodeMarketplace { - name = "vscode-pylance"; - publisher = "ms-python"; - version = "2023.6.40"; - sha256 = "sha256-J5nRoQjUVKaMqs0QJFY0vzutjWZ9dH6O7FXI+ZZIaBQ="; - }; -} diff --git a/modules/home-manager/devel/vscode/test_vsextensions_with_nix4vscode/vscodium.nix b/modules/home-manager/devel/vscode/test_vsextensions_with_nix4vscode/vscodium.nix deleted file mode 100644 index a627189..0000000 --- a/modules/home-manager/devel/vscode/test_vsextensions_with_nix4vscode/vscodium.nix +++ /dev/null @@ -1,56 +0,0 @@ -{ - lib, - pkgs, - inputs, - userSettings, - ... -}: - -let - # configure extensions - myExtensions = pkgs.callPackage ./extensions/extensions.nix { }; - myPylance = pkgs.callPackage ./extensions/pylance.nix { }; - vscodePackage = pkgs.vscodium-fhs; -in -{ - programs.vscode = { - enable = true; - package = vscodePackage; - extensions = with myExtensions; [ - aaron-bond.better-comments - charliermarsh.ruff - corker.vscode-micromamba - github.copilot - github.copilot-chat - james-yu.latex-workshop - jnoortheen.nix-ide - k--kato.intellij-idea-keybindings - ms-python.python - myPylance.ms-python.vscode-pylance - ms-toolsai.jupyter - ms-toolsai.jupyter-keymap - ms-toolsai.jupyter-renderers - ms-toolsai.vscode-jupyter-cell-tags - ms-toolsai.vscode-jupyter-slideshow - naumovs.color-highlight - njpwerner.autodocstring - patbenatar.advanced-new-file - pkief.material-icon-theme - znck.grammarly - ]; - }; - - home.activation = { - myVscodeFiles = - let - vscodePath = "~/.config/VSCodium"; - targetDirectory = "${userSettings.flakeDirectory}/modules/home-manager/devel/vscodium"; - in - lib.hm.dag.entryAfter [ "writeBoundary" ] '' - run mkdir -p ${vscodePath}/User - run ln -sf ${targetDirectory}/product.json ${vscodePath}/product.json - run ln -sf ${targetDirectory}/keybindings.json ${vscodePath}/User/keybindings.json - run ln -sf ${targetDirectory}/settings.json ${vscodePath}/User/settings.json - ''; - }; -} diff --git a/modules/home-manager/devel/wezterm.nix b/modules/home-manager/devel/wezterm.nix deleted file mode 100644 index 3f74c06..0000000 --- a/modules/home-manager/devel/wezterm.nix +++ /dev/null @@ -1,53 +0,0 @@ -{ userSettings, ... }: -let - fontSize = if userSettings.isLinux then "11" else "13"; -in -{ - programs.wezterm = { - enable = true; - extraConfig = '' - -- Pull in the wezterm API - local wezterm = require 'wezterm' - - -- This will hold the configuration. - local config = wezterm.config_builder() - - -- This is where you actually apply your config choices. - - config.font_size = ${fontSize} - config.font = wezterm.font "JetBrainsMono Nerd Font" - config.hide_tab_bar_if_only_one_tab = true - config.window_background_opacity = 0.75 - config.macos_window_background_blur = 100 - config.kde_window_background_blur = true - config.default_cursor_style = "BlinkingBar" - config.cursor_blink_rate = 500 - config.enable_scroll_bar = true - - config.keys = { - -- Rebind OPT-Left, OPT-Right as ALT-b, ALT-f respectively - { - key = 'LeftArrow', - mods = 'OPT', - action = wezterm.action.SendKey { - key = 'b', - mods = 'ALT', - }, - }, - { - key = 'RightArrow', - mods = 'OPT', - action = wezterm.action.SendKey { key = 'f', mods = 'ALT' }, - }, - { - key = 'Enter', - mods = 'ALT', - action = wezterm.action.DisableDefaultAssignment, - }, - } - - -- Finally, return the configuration to wezterm: - return config - ''; - }; -} diff --git a/modules/home-manager/theming/theming.nix b/modules/home-manager/theming/theming.nix deleted file mode 100644 index b2abf1b..0000000 --- a/modules/home-manager/theming/theming.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ pkgs, config, ... }: - -{ - gtk = { - enable = true; - theme = { - package = pkgs.layan-gtk-theme; - name = "Layan-Dark"; - }; - cursorTheme = { - package = pkgs.kdePackages.breeze-gtk; - name = "breeze_cursors"; - size = 24; - }; - iconTheme = { - package = pkgs.tela-icon-theme; - name = "Tela"; - }; - font = { - name = "NotoSansNerdFont"; - size = 10; - }; - gtk4.theme = config.gtk.theme; - }; - - qt = { - enable = true; - platformTheme.name = "qtct"; - # style.name = "kvantum"; # this sets QT_STYLE_OVERRIDE=kvantum which fucks up plasma6. Disable this line if you want to use kde *) - style.package = with pkgs; [ - libsForQt5.qtstyleplugin-kvantum - qt6Packages.qtstyleplugin-kvantum - ]; - }; - - xdg.configFile = { - "Kvantum" = { - source = ./configs/Kvantum; - recursive = true; - }; - "qt5ct/qt5ct.conf".text = '' - [Appearance] - custom_palette=false - icon_theme=Tela - standard_dialogs=default - style=kvantum - ''; - }; - - # [Colors:View] BackgroundAlternate overridden for dolphin - xdg.dataFile = { - "color-schemes/Layan.colors".source = ./configs/color-schemes/Layan.colors; - "color-schemes/LayanLight.colors".source = ./configs/color-schemes/LayanLight.colors; - }; - - wayland.windowManager.hyprland.settings = { - env = [ - "XCURSOR_THEME, breeze_cursors" - "XCURSOR_SIZE, 24" - "QT_STYLE_OVERRIDE, kvantum" # *) set QT_STYLE_OVERRIDE for hyprland only - ]; - }; -} diff --git a/modules/home-manager/wm/aerospace/default.nix b/modules/home-manager/wm/aerospace/default.nix deleted file mode 100644 index 7e44cbd..0000000 --- a/modules/home-manager/wm/aerospace/default.nix +++ /dev/null @@ -1,129 +0,0 @@ -{ lib, pkgs, ... }: - -let - mainMod = "ctrl-alt"; -in -{ - programs.aerospace = { - enable = true; - launchd.enable = true; - settings = { - after-startup-command = [ - "exec-and-forget ${lib.getExe pkgs.jankyborders} active_color=0xff00ff99 inactive_color=0xaa444444 width=5.0" - "exec-and-forget ${lib.getExe pkgs.autoraise} -delay 0" - ]; - automatically-unhide-macos-hidden-apps = true; - default-root-container-layout = "tiles"; - default-root-container-orientation = "auto"; - enable-normalization-flatten-containers = true; - enable-normalization-opposite-orientation-for-nested-containers = true; - exec-on-workspace-change = [ ]; # sketchybar - gaps = { - inner = { - horizontal = 3; - vertical = 3; - }; - outer = { - left = 5; - bottom = 5; - top = 5; - right = 5; - }; - }; - on-focus-changed = [ "move-mouse monitor-lazy-center" ]; - on-focused-monitor-changed = [ "move-mouse monitor-lazy-center" ]; - exec.env-vars.PATH = "\${PATH}:\${HOME}/.nix-profile/bin:/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin"; - key-mapping = { - preset = "qwerty"; - key-notation-to-key-code = { - y = "z"; - z = "y"; - minus = "slash"; - plus = "rightSquareBracket"; - backtick = "equal"; - }; - }; - mode.main.binding = { - "cmd-alt-t" = "exec-and-forget \${HOME}/Applications/Home\\ Manager\\ Apps/WezTerm.app/wezterm-gui"; - "cmd-alt-s" = "exec-and-forget ${lib.getExe pkgs.flameshot} gui"; - "${mainMod}-b" = "exec-and-forget ${./scratchpad.sh} --command btop"; - "${mainMod}-a" = "exec-and-forget ${./scratchpad.sh} --app-name \"Activity Monitor\""; - "${mainMod}-e" = "exec-and-forget ${./scratchpad.sh} --app-name Finder"; - "${mainMod}-s" = "exec-and-forget ${./scratchpad.sh} --app-name Spotify"; - "alt-f4" = "close --quit-if-last-window"; - "alt-tab" = "focus dfs-next --boundaries-action wrap-around-the-workspace"; - "${mainMod}-f" = "layout floating tiling"; - "${mainMod}-m" = "fullscreen --no-outer-gaps"; - "${mainMod}-t" = "layout tiles horizontal vertical"; - "${mainMod}-plus" = "resize smart +50"; - "${mainMod}-minus" = "resize smart -50"; - "${mainMod}-left" = "move left"; - "${mainMod}-down" = "move down"; - "${mainMod}-up" = "move up"; - "${mainMod}-right" = "move right"; - "${mainMod}-shift-left" = "join-with left"; - "${mainMod}-shift-down" = "join-with down"; - "${mainMod}-shift-up" = "join-with up"; - "${mainMod}-shift-right" = "join-with right"; - "${mainMod}-cmd-left" = "move-workspace-to-monitor left"; - "${mainMod}-cmd-down" = "move-workspace-to-monitor up"; - "${mainMod}-cmd-up" = "move-workspace-to-monitor down"; - "${mainMod}-cmd-right" = "move-workspace-to-monitor right"; - "${mainMod}-1" = "workspace 1"; - "${mainMod}-2" = "workspace 2"; - "${mainMod}-3" = "workspace 3"; - "${mainMod}-4" = "workspace 4"; - "${mainMod}-5" = "workspace 5"; - "${mainMod}-6" = "workspace 6"; - "${mainMod}-7" = "workspace 7"; - "${mainMod}-8" = "workspace 8"; - "${mainMod}-9" = "workspace 9"; - "${mainMod}-0" = "workspace 10"; - "${mainMod}-tab" = "workspace-back-and-forth"; - "${mainMod}-shift-1" = "move-node-to-workspace 1"; - "${mainMod}-shift-2" = "move-node-to-workspace 2"; - "${mainMod}-shift-3" = "move-node-to-workspace 3"; - "${mainMod}-shift-4" = "move-node-to-workspace 4"; - "${mainMod}-shift-5" = "move-node-to-workspace 5"; - "${mainMod}-shift-6" = "move-node-to-workspace 6"; - "${mainMod}-shift-7" = "move-node-to-workspace 7"; - "${mainMod}-shift-8" = "move-node-to-workspace 8"; - "${mainMod}-shift-9" = "move-node-to-workspace 9"; - "${mainMod}-shift-0" = "move-node-to-workspace 10"; - # alt-e = '' - # exec-and-forget osascript -e ' - # tell application "Finder" - # make new Finder window to home - # activate - # end tell' - # ''; - }; - on-window-detected = [ - { - "if".app-id = "com.google.android.studio"; - run = "move-node-to-workspace 3"; - } - { - "if".app-id = "com.zollsoft.air"; - run = "move-node-to-workspace 4"; - } - { - "if".app-id = "org.nixos.firefox"; - run = "move-node-to-workspace 5"; - } - { - "if".app-id = "com.tinyspeck.slackmacgap"; - run = "move-node-to-workspace 9"; - } - { - "if".app-id = "com.gather.Gather"; - run = "move-node-to-workspace 9"; - } - { - "if".app-id = "com.zollsoft.arzeko"; - run = "move-node-to-workspace 10"; - } - ]; - }; - }; -} diff --git a/modules/home-manager/wm/hyprland/caelestia-shell/default.nix b/modules/home-manager/wm/hyprland/caelestia-shell/default.nix deleted file mode 100644 index a92e19a..0000000 --- a/modules/home-manager/wm/hyprland/caelestia-shell/default.nix +++ /dev/null @@ -1,228 +0,0 @@ -{ - inputs, - lib, - pkgs, - userSettings, - ... -}: - -let - system = pkgs.stdenv.hostPlatform.system; - - # Fix for makeBinaryWrapper set_env_prefix reading past null terminator when - # the prefix sits at the end of the existing value (no trailing separator). - # This corrupts NIXPKGS_QT6_QML_IMPORT_PATH, causing Firefox to crash when - # launched from caelestia (Rust's std::env::vars() panics on non-UTF-8 env vars). - # - # makeBinaryWrapper uses makeSetupHook -> runCommand, which has no patchPhase. - # The fix must be applied via buildCommand post-processing using sed. - fixedMakeBinaryWrapper = pkgs.makeBinaryWrapper.overrideAttrs (old: { - buildCommand = old.buildCommand + '' - # Fix: when prefix is at end of existing value (no trailing sep), - # n_before must not include the leading sep, and the tail pointer - # must point to the null terminator rather than past it. - sed -i \ - 's@int n_before = existing_prefix - existing_env;@int n_before = existing_prefix - existing_env - (*(existing_prefix + prefix_len) ? 0 : (int)sep_len);@' \ - $out/nix-support/setup-hook - sed -i \ - 's@existing_prefix + prefix_len + sep_len));@*(existing_prefix + prefix_len) ? existing_prefix + prefix_len + sep_len : existing_prefix + prefix_len));@' \ - $out/nix-support/setup-hook - ''; - }); - - fixedWrapQt6AppsHook = pkgs.qt6Packages.wrapQtAppsHook.override { - makeBinaryWrapper = fixedMakeBinaryWrapper; - }; - - # Rebuild quickshell from caelestia-shell's pinned flake input with the fixed hook. - # caelestia-shell uses inputs.quickshell.packages directly (not pkgs.quickshell), - # so user overlays do not affect it — we must patch it explicitly here. - caelestia-quickshell = - (inputs.caelestia-shell.inputs.quickshell.packages.${system}.default.override { - withX11 = false; - withI3 = false; - }).overrideAttrs - (old: { - nativeBuildInputs = map ( - x: if builtins.isAttrs x && x.name == "wrap-qt6-apps-hook" then fixedWrapQt6AppsHook else x - ) (old.nativeBuildInputs or [ ]); - }); - - caelestia-patched = inputs.caelestia-shell.packages.${system}.with-cli.override { - quickshell = caelestia-quickshell; - }; -in - -{ - imports = [ inputs.caelestia-shell.homeManagerModules.default ]; - - programs.caelestia = { - enable = true; - package = caelestia-patched; - # https://github.com/caelestia-dots/shell/issues/390 - systemd.environment = [ "QT_QPA_PLATFORMTHEME=gtk3" ]; - cli = { - enable = true; - settings = { - theme = { - enableTerm = false; - enableHypr = false; - enableDiscord = false; - enableSpicetify = false; - enableFuzzel = false; - enableBtop = false; - enableGtk = false; - enableQt = false; - }; - }; - }; - settings = { - appearance = { - font.family = { - mono = "NotoMonoNerdFont"; - sans = "NotoSansNerdFont"; - }; - transparency = { - enabled = true; - base = 0.75; - layers = 0.5; - }; - }; - general = { - apps.terminal = [ "${lib.getExe pkgs.alacritty}" ]; - idle.timeouts = [ - # { - # timeout = 180; - # idleAction = "lock"; - # } - ]; - }; - background = { - desktopClock.enabled = false; - visualiser.enabled = true; - }; - paths = { - mediaGif = ./gifs/moose.gif; - sessionGif = ./gifs/lightning.gif; - wallpaperDir = "/home/leon/Nextcloud/Pictures/Geordnet"; - }; - bar = { - clock.showIcon = false; - entries = [ - { - id = "logo"; - enabled = false; - } - { - id = "clock"; - enabled = true; - } - { - id = "activeWindow"; - enabled = true; - } - { - id = "spacer"; - enabled = true; - } - { - id = "workspaces"; - enabled = true; - } - { - id = "spacer"; - enabled = true; - } - { - id = "tray"; - enabled = true; - } - { - id = "statusIcons"; - enabled = true; - } - { - id = "power"; - enabled = true; - } - ]; - status = { - showAudio = true; - showMicrophone = true; - }; - tray = { - background = true; - }; - workspaces = { - showWindows = false; - label = ""; - activeLabel = ""; - occupiedLabel = ""; - shown = 10; - activeTrail = true; - }; - }; - border = { - thickness = 1; - rounding = 20; - }; - launcher = { - showOnHover = false; - actionPrefix = "/"; - }; - osd.enableMicrophone = true; - }; - }; - - wayland.windowManager.hyprland.settings = { - bindr = [ - "$mainMod, $mainMod_L, exec, caelestia shell drawers toggle launcher" - "$mainMod, L, exec, caelestia shell lock lock" - ]; - - bind = [ - "$mainMod, N, exec, caelestia shell drawers toggle sidebar" - "$mainMod, D, exec, caelestia shell drawers toggle dashboard" - ", Print, exec, caelestia screenshot --region --freeze" - "CTRL + ALT, S, exec, ${pkgs.wl-clipboard}/bin/wl-paste | ${lib.getExe pkgs.swappy} -f -" - # https://github.com/caelestia-dots/shell/issues/390 - "CTRL + ALT, B, exec, caelestia shell -k; QT_QPA_PLATFORMTHEME=gtk3 caelestia shell -d" - "CTRL + ALT, W, exec, ~/scripts/wallpaper/select_image.sh ${userSettings.wallpaperFolder} && ~/scripts/wallpaper/update_wallpaper_caelestia.sh" - ]; - - # Media controls - bindl = [ - ", XF86AudioPlay, global, caelestia:mediaToggle" - ", XF86AudioStop, global, caelestia:mediaStop" - ", XF86AudioPrev, global, caelestia:mediaPrev" - ", XF86AudioNext, global, caelestia:mediaNext" - "CTRL, left, global, caelestia:mediaPrev" - "CTRL, right, global, caelestia:mediaNext" - ]; - - bindle = [ - # Audio controls - ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" - ", XF86AudioRaiseVolume, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ 0; wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 0.05+" - ", XF86AudioLowerVolume, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ 0; wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05-" - "SHIFT, XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" - "SHIFT, XF86AudioRaiseVolume, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ 0; wpctl set-volume -l 1 @DEFAULT_AUDIO_SOURCE@ 0.05+" - "SHIFT, XF86AudioLowerVolume, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ 0; wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 0.05-" - # Brightness controls - ", XF86MonBrightnessUp, global, caelestia:brightnessUp" - ", XF86MonBrightnessDown, global, caelestia:brightnessDown" - ]; - - layerrule = [ - "match:namespace caelestia-.*, blur on, blur_popups on, ignore_alpha 0.1" - "match:namespace qs-.*, blur on" - ]; - - permission = [ - "/nix/store/[a-z0-9]{32}-quickshell-wrapped-[0-9.]*/bin/.quickshell-wrapped, screencopy, allow" - ]; - - general.gaps_out = lib.mkForce 10; - decoration.rounding = lib.mkForce 10; - }; -} diff --git a/modules/home-manager/wm/hyprland/default.nix b/modules/home-manager/wm/hyprland/default.nix deleted file mode 100644 index 8fa5f4e..0000000 --- a/modules/home-manager/wm/hyprland/default.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ ... }: - -{ - imports = [ - ./caelestia-shell - ./hyprland_conf - ./hyprland_plugins - # ./hyprlock_with_apps - ./hyprsunset - ./hypridle.nix - # ./hyprlock.nix - ./hyprpolkit.nix - - ../useful_utilities/cliphist - ../useful_utilities/myKanshiPlus - # ../useful_utilities/swaync - # ../useful_utilities/waybar - # ../useful_utilities/blueman-applet.nix - # ../useful_utilities/gammastep.nix - # ../useful_utilities/kanshi.nix - ../useful_utilities/kdeconnect.nix - # ../useful_utilities/media_controls.nix - # ../useful_utilities/nm-applet.nix - ../useful_utilities/nwg-displays.nix - # ../useful_utilities/screenshot.nix - # ../useful_utilities/swww.nix - # ../useful_utilities/tofi.nix - ]; -} diff --git a/modules/home-manager/wm/hyprland/hypridle.nix b/modules/home-manager/wm/hyprland/hypridle.nix deleted file mode 100644 index 751e9fc..0000000 --- a/modules/home-manager/wm/hyprland/hypridle.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ ... }: -let - # hyprlockCmd = "pgrep hyprlock || hyprlock"; - # hyprlockCmd = "pgrep hyprlock || ${./hyprlock_with_apps/hyprlock.sh}"; - hyprlockCmd = "caelestia shell lock lock"; -in -{ - services.hypridle = { - enable = true; - settings = { - general = { - lock_cmd = hyprlockCmd; - before_sleep_cmd = hyprlockCmd; - after_sleep_cmd = "hyprctl dispatch dpms on"; - }; - listener = [ - { - timeout = 300; - on-timeout = hyprlockCmd; - } - { - timeout = 600; - on-timeout = "hyprctl dispatch dpms off"; - on-resume = "hyprctl dispatch dpms on"; - } - ]; - }; - }; -} diff --git a/modules/home-manager/wm/hyprland/hyprland_conf/bindings.nix b/modules/home-manager/wm/hyprland/hyprland_conf/bindings.nix deleted file mode 100644 index 326886d..0000000 --- a/modules/home-manager/wm/hyprland/hyprland_conf/bindings.nix +++ /dev/null @@ -1,83 +0,0 @@ -{ ... }: - -{ - wayland.windowManager.hyprland.settings = { - "$mainMod" = "SUPER"; - - bind = [ - # GENERAL - "ALT, F4 , killactive," - "$mainMod, F, togglefloating," - "$mainMod, G, togglegroup" - "$mainMod, M, fullscreen," - "$mainMod, E, exec, dolphin" - "CTRL + ALT, T, exec, wezterm" - - # SPECIAL KEYS - ", XF86Calculator , exec, qalculate-qt" - - # WINDOWS - "$mainMod + SHIFT, left, movewindoworgroup, l" - "$mainMod + SHIFT, right, movewindoworgroup, r" - "$mainMod + SHIFT, up, movewindoworgroup, u" - "$mainMod + SHIFT, down, movewindoworgroup, d" - "$mainMod + CTRL, left, movecurrentworkspacetomonitor, l" - "$mainMod + CTRL, right, movecurrentworkspacetomonitor, r" - "$mainMod + CTRL, up, movecurrentworkspacetomonitor, u" - "$mainMod + CTRL, down, movecurrentworkspacetomonitor, d" - "$mainMod, RETURN, layoutmsg, swapwithmaster" - "$mainMod + SHIFT, RETURN, layoutmsg, addmaster" - "$mainMod + SHIFT + CTRL, RETURN, layoutmsg, removemaster" - "ALT, Tab, layoutmsg, cyclenext" - "ALT + CTRL, Tab, changegroupactive" - - # WORKSPACES - # Switch workspaces with mainMod + [0-9] - "$mainMod, 1, workspace, 1" - "$mainMod, 2, workspace, 2" - "$mainMod, 3, workspace, 3" - "$mainMod, 4, workspace, 4" - "$mainMod, 5, workspace, 5" - "$mainMod, 6, workspace, 6" - "$mainMod, 7, workspace, 7" - "$mainMod, 8, workspace, 8" - "$mainMod, 9, workspace, 9" - "$mainMod, 0, workspace, 10" - "$mainMod, Tab, workspace, previous_per_monitor" - - # Move active window to a workspace with mainMod + SHIFT + [0-9] - "$mainMod SHIFT, 1, movetoworkspacesilent, 1" - "$mainMod SHIFT, 2, movetoworkspacesilent, 2" - "$mainMod SHIFT, 3, movetoworkspacesilent, 3" - "$mainMod SHIFT, 4, movetoworkspacesilent, 4" - "$mainMod SHIFT, 5, movetoworkspacesilent, 5" - "$mainMod SHIFT, 6, movetoworkspacesilent, 6" - "$mainMod SHIFT, 7, movetoworkspacesilent, 7" - "$mainMod SHIFT, 8, movetoworkspacesilent, 8" - "$mainMod SHIFT, 9, movetoworkspacesilent, 9" - "$mainMod SHIFT, 0, movetoworkspacesilent, 10" - - # Scroll through existing workspaces with mainMod + scroll - "$mainMod, mouse_down, workspace, e+1" - "$mainMod, mouse_up, workspace, e-1" - ]; - - binde = [ - # WINDOWS - "$mainMod, left, resizeactive, -30 0" - "$mainMod, right, resizeactive, 30 0" - "$mainMod, up, resizeactive, 0 -30" - "$mainMod, down, resizeactive, 0 30" - ]; - - bindm = [ - # WINDOWS - # Move/resize windows with mainMod + LMB/RMB and dragging - "$mainMod, mouse:272, movewindow" - "$mainMod, mouse:273, resizewindow" - ]; - - # Cycle workspaces with mainMod + Tab - binds.allow_workspace_cycles = true; - }; -} diff --git a/modules/home-manager/wm/hyprland/hyprland_conf/default.nix b/modules/home-manager/wm/hyprland/hyprland_conf/default.nix deleted file mode 100644 index 821e132..0000000 --- a/modules/home-manager/wm/hyprland/hyprland_conf/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ ... }: - -{ - imports = [ - ./bindings.nix - ./exec-once.nix - ./graphics.nix - ./input.nix - ./layouts.nix - ./misc.nix - ./monitors.nix - ./scratchpads.nix - ./windowrules.nix - ./workspacerules.nix - ]; - - wayland.windowManager.hyprland = { - enable = true; - systemd.variables = [ "--all" ]; - package = null; - portalPackage = null; - }; -} diff --git a/modules/home-manager/wm/hyprland/hyprland_conf/exec-once.nix b/modules/home-manager/wm/hyprland/hyprland_conf/exec-once.nix deleted file mode 100644 index d6c3c0f..0000000 --- a/modules/home-manager/wm/hyprland/hyprland_conf/exec-once.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ ... }: - -{ - wayland.windowManager.hyprland.settings = { - # Execute at launch - exec-once = [ - "sleep 5 && ${../../../../../scripts/hibernate_on_low_battery.sh}" - "sleep 5 && ${../../../../../scripts/restart_failed_systemd_user_services.sh}" - ]; - }; -} diff --git a/modules/home-manager/wm/hyprland/hyprland_conf/graphics.nix b/modules/home-manager/wm/hyprland/hyprland_conf/graphics.nix deleted file mode 100644 index 6d393d7..0000000 --- a/modules/home-manager/wm/hyprland/hyprland_conf/graphics.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ ... }: - -{ - wayland.windowManager.hyprland.settings = { - general = { - gaps_in = 3; - gaps_out = 3; - border_size = 2; - "col.active_border" = "rgba(33ccffff) rgba(00ff99ff) 45deg"; - "col.inactive_border" = "rgba(444444aa)"; - }; - group = { - "col.border_inactive" = "rgba(444444aa)"; - "col.border_active" = "rgba(8800ffff) rgba(aa0055ff) 45deg"; - groupbar = { - "col.active" = "rgba(6600ccee)"; - "col.inactive" = "rgba(6600cc99)"; - }; - }; - - bezier = [ - "linear, 0, 0, 1, 1" - ]; - - animation = [ - "borderangle, 1, 40, linear, loop" - "layers, 1, 5, default, popin" - ]; - - decoration = { - rounding = 5; - blur = { - size = 4; - passes = 4; - ignore_opacity = true; - popups = true; - }; - }; - }; -} diff --git a/modules/home-manager/wm/hyprland/hyprland_conf/input.nix b/modules/home-manager/wm/hyprland/hyprland_conf/input.nix deleted file mode 100644 index eb1e35b..0000000 --- a/modules/home-manager/wm/hyprland/hyprland_conf/input.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ userSettings, ... }: - -{ - wayland.windowManager.hyprland.settings = { - input = { - kb_layout = userSettings.kblayout; - kb_options = "ctrl:nocaps"; # remap Caps lock to Ctrl (https://wiki.hypr.land/Configuring/Uncommon-tips--tricks/#remapping-caps-lock) - numlock_by_default = true; - touchpad = { - natural_scroll = true; - drag_lock = true; - }; - }; - - device = { - name = "cust0000:00-04f3:2a4a-stylus"; - output = "eDP-1"; - }; - - cursor = { - no_hardware_cursors = 1; - }; - - gesture = [ - "3, horizontal, workspace" - "3, vertical, scale:1.5, fullscreen" - "4, swipe, resize" - ]; - gestures = { - workspace_swipe_forever = true; - workspace_swipe_touch = true; - }; - }; -} diff --git a/modules/home-manager/wm/hyprland/hyprland_conf/layouts.nix b/modules/home-manager/wm/hyprland/hyprland_conf/layouts.nix deleted file mode 100644 index 806d759..0000000 --- a/modules/home-manager/wm/hyprland/hyprland_conf/layouts.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ ... }: - -{ - wayland.windowManager.hyprland.settings = { - dwindle = { - # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more - pseudotile = true; # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below - preserve_split = true; # you probably want this - force_split = 2; - }; - }; -} diff --git a/modules/home-manager/wm/hyprland/hyprland_conf/misc.nix b/modules/home-manager/wm/hyprland/hyprland_conf/misc.nix deleted file mode 100644 index 43d640b..0000000 --- a/modules/home-manager/wm/hyprland/hyprland_conf/misc.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ ... }: - -{ - wayland.windowManager.hyprland.settings = { - general = { - snap.enabled = true; - resize_on_border = true; - layout = "master"; - }; - misc = { - animate_manual_resizes = true; - animate_mouse_windowdragging = true; - focus_on_activate = true; - force_default_wallpaper = 0; - initial_workspace_tracking = false; - mouse_move_enables_dpms = true; - vrr = 3; - }; - render.new_render_scheduling = true; - debug = { - disable_logs = false; - full_cm_proto = true; # https://github.com/hyprwm/Hyprland/discussions/10860#discussioncomment-13736256 - }; - ecosystem.enforce_permissions = true; - }; -} diff --git a/modules/home-manager/wm/hyprland/hyprland_conf/monitors.nix b/modules/home-manager/wm/hyprland/hyprland_conf/monitors.nix deleted file mode 100644 index 8f8ec0b..0000000 --- a/modules/home-manager/wm/hyprland/hyprland_conf/monitors.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: - -{ - wayland.windowManager.hyprland.settings = { - # Fallback rule - monitor = ", preferred, auto, 1"; - }; -} diff --git a/modules/home-manager/wm/hyprland/hyprland_conf/scratchpads.nix b/modules/home-manager/wm/hyprland/hyprland_conf/scratchpads.nix deleted file mode 100644 index 0cc82ab..0000000 --- a/modules/home-manager/wm/hyprland/hyprland_conf/scratchpads.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ lib, pkgs, ... }: - -{ - wayland.windowManager.hyprland.settings = { - workspace = [ - "special:btop, on-created-empty:[fullscreen] ${lib.getExe pkgs.alacritty} -e btop" - "special:htop, border:false, on-created-empty:[float; size 100% 35%; move 0% 65%] ${lib.getExe pkgs.alacritty} -e htop" - "special:spotify, on-created-empty:[fullscreen] spotify" - "special:terminal, on-created-empty:[fullscreen] ${lib.getExe pkgs.alacritty}" - ]; - bind = [ - "$mainMod, B, togglespecialworkspace, btop" - "$mainMod, H, togglespecialworkspace, htop" - "$mainMod, S, togglespecialworkspace, spotify" - "$mainMod, T, togglespecialworkspace, terminal" - ]; - animation = [ - "specialWorkspace, 1, 5, default, slidefadevert" - ]; - }; -} diff --git a/modules/home-manager/wm/hyprland/hyprland_conf/windowrules.nix b/modules/home-manager/wm/hyprland/hyprland_conf/windowrules.nix deleted file mode 100644 index bf8bc17..0000000 --- a/modules/home-manager/wm/hyprland/hyprland_conf/windowrules.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ ... }: - -{ - wayland.windowManager.hyprland.settings = { - windowrule = [ - "match:class ^(org.kde.polkit-kde-authentication-agent-1)$, float on" - - "match:class ^(code)$, tag +vscode" - "match:class ^(codium)$, tag +vscode" - "match:tag vscode, opacity 0.85, workspace 1" - "match:tag vscode, match:title .*\.pdf.*, opacity 1.00" - - "match:class ^(firefox), workspace 5$" - - "tag +social, match:class ^(discord)$" - "tag +social, match:class ^(org.telegram.desktop)$" - "tag +social, match:class ^(signal)$" - "tag +social, match:class ^(Slack)$" - "tag +social, match:class ^(thunderbird)$" - "tag +social, match:class ^(wasistlos)$" - "match:tag social, workspace 9" - - # KDE CONNECT Presentation Mode - "match:class ^(org.kde.kdeconnect.daemon)$, no_blur on, border_size 0, no_shadow on, no_anim on, no_focus on, suppress_event fullscreen, float on, move 0 0, size 100% 100%" - ]; - }; -} diff --git a/modules/home-manager/wm/hyprland/hyprland_conf/workspacerules.nix b/modules/home-manager/wm/hyprland/hyprland_conf/workspacerules.nix deleted file mode 100644 index b8e7e60..0000000 --- a/modules/home-manager/wm/hyprland/hyprland_conf/workspacerules.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ ... }: - -{ - wayland.windowManager.hyprland.settings = { - workspace = [ - "2, on-created-empty:dolphin" - "5, on-created-empty:firefox" - ]; - }; -} diff --git a/modules/home-manager/wm/hyprland/hyprland_plugins/default.nix b/modules/home-manager/wm/hyprland/hyprland_plugins/default.nix deleted file mode 100644 index 05d87a7..0000000 --- a/modules/home-manager/wm/hyprland/hyprland_plugins/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: - -{ - imports = [ - ./hypr-dynamic-cursors.nix - # ./hyprexpo.nix - ]; -} diff --git a/modules/home-manager/wm/hyprland/hyprland_plugins/hypr-dynamic-cursors.nix b/modules/home-manager/wm/hyprland/hyprland_plugins/hypr-dynamic-cursors.nix deleted file mode 100644 index 47fd767..0000000 --- a/modules/home-manager/wm/hyprland/hyprland_plugins/hypr-dynamic-cursors.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ pkgs, ... }: - -let - inherit (pkgs.hyprlandPlugins) hypr-dynamic-cursors; -in -{ - wayland.windowManager.hyprland = { - plugins = [ - hypr-dynamic-cursors - ]; - settings = { - plugin.dynamic-cursors = { - mode = "tilt"; - }; - permission = [ - "${hypr-dynamic-cursors}/lib/libhypr-dynamic-cursors.so, plugin, allow" - ]; - }; - }; -} diff --git a/modules/home-manager/wm/hyprland/hyprland_plugins/hyprexpo.nix b/modules/home-manager/wm/hyprland/hyprland_plugins/hyprexpo.nix deleted file mode 100644 index 34b07a4..0000000 --- a/modules/home-manager/wm/hyprland/hyprland_plugins/hyprexpo.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ pkgs, ... }: - -let - inherit (pkgs.hyprlandPlugins) hyprexpo; -in -{ - wayland.windowManager.hyprland = { - plugins = [ - hyprexpo - ]; - settings = { - plugin.hyprexpo = { - columns = 3; - gap_size = 5; - bg_col = "rgb(111111)"; - workspace_method = "first 1"; # [center/first] [workspace] e.g. first 1 or center m+1 - enable_gesture = true; # laptop touchpad, 4 fingers - gesture_distance = 300; # how far is the "max" - gesture_positive = false; # positive = swipe down. Negative = swipe up. - }; - bind = [ "$mainMod, W, hyprexpo:expo, toggle" ]; - permission = [ - "${hyprexpo}/lib/libhyprexpo.so, plugin, allow" - ]; - }; - }; -} diff --git a/modules/home-manager/wm/hyprland/hyprlock.nix b/modules/home-manager/wm/hyprland/hyprlock.nix deleted file mode 100644 index dbbd99e..0000000 --- a/modules/home-manager/wm/hyprland/hyprlock.nix +++ /dev/null @@ -1,94 +0,0 @@ -{ - lib, - config, - ... -}: -let - #walColor = (builtins.fromJSON (builtins.readFile ./colors-rgb.json)).colors.color1; - labelColor = "rgba(255, 255, 255, 1)"; -in -{ - programs.hyprlock = { - enable = true; - settings = { - general = { - grace = 3; - hide_cursor = true; - }; - background = [ - { - path = "~/scripts/wallpaper/wallpaper.jpg"; - # path = "screenshot"; - blur_size = 4; - blur_passes = 4; - } - ]; - input-field = [ - { - placeholder_text = ''Input Password...''; - size = "200, 50"; - outline_thickness = 1; - dots_spacing = 0.3; - inner_color = "rgba(0, 0, 0, 0)"; - outer_color = "rgba(0, 0, 0, 0)"; - font_color = "rgba(255, 255, 255, 1)"; - capslock_color = "rgba(130, 0, 255, 1)"; - fade_on_empty = false; - hide_input = false; - fail_text = ''$FAIL ($ATTEMPTS)''; - position = "0, -30"; - halign = "center"; - valign = "center"; - } - ]; - label = [ - { - text = ''cmd[update:500] echo "$(date +'%H:%M:%S')"''; - font_size = 50; - font_family = "NotoMonoNerdFont"; - color = labelColor; - position = "0, 250"; - halign = "center"; - valign = "center"; - shadow_passes = 1; - } - { - text = ''cmd[update:10000] echo "$(date +'%a %d. %b')"''; - font_size = 15; - font_family = "NotoSansNerdFont"; - color = labelColor; - position = "0, 330"; - halign = "center"; - valign = "center"; - shadow_passes = 1; - } - { - text = ''󱁕 Hey $USER 󱁕''; - font_size = 25; - font_family = "NotoSansNerdFont"; - color = labelColor; - position = "0, 30"; - halign = "center"; - valign = "center"; - shadow_passes = 1; - } - { - text = ""; - font_size = 25; - color = labelColor; - position = "0, 80"; - halign = "center"; - valign = "center"; - shadow_passes = 1; - } - ]; - }; - }; - - wayland.windowManager.hyprland.settings = { - bindr = [ "$mainMod, L, exec, hyprlock --immediate" ]; - permission = [ - "${lib.escapeRegex (lib.getExe config.programs.hyprlock.package)}, screencopy, allow" - ]; - }; -} diff --git a/modules/home-manager/wm/hyprland/hyprlock_with_apps/default.nix b/modules/home-manager/wm/hyprland/hyprlock_with_apps/default.nix deleted file mode 100644 index 3a55130..0000000 --- a/modules/home-manager/wm/hyprland/hyprlock_with_apps/default.nix +++ /dev/null @@ -1,139 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: -let - #walColor = (builtins.fromJSON (builtins.readFile ./colors-rgb.json)).colors.color1; - labelColor = "rgba(255, 255, 255, 1)"; -in -{ - programs.hyprlock = { - enable = true; - settings = { - general = { - grace = 3; - hide_cursor = true; - }; - background = [ - { - monitor = "HDMI-A-1"; - path = "~/scripts/wallpaper/wallpaper.jpg"; - blur_size = 4; - blur_passes = 4; - } - { - monitor = "DP-2"; - path = "~/scripts/wallpaper/wallpaper.jpg"; - blur_size = 4; - blur_passes = 4; - } - { - monitor = "eDP-1"; - color = "rgba(0, 0, 0, 0)"; - path = ""; - blur_passes = 0; - } - ]; - input-field = [ - { - placeholder_text = ''Input Password...''; - size = "200, 50"; - outline_thickness = 1; - dots_spacing = 0.3; - inner_color = "rgba(0, 0, 0, 0)"; - outer_color = "rgba(0, 0, 0, 0)"; - font_color = "rgba(255, 255, 255, 1)"; - capslock_color = "rgba(130, 0, 255, 1)"; - fade_on_empty = false; - hide_input = false; - fail_text = ''$FAIL ($ATTEMPTS)''; - position = "0, -30"; - halign = "center"; - valign = "center"; - } - ]; - label = [ - { - text = ''cmd[update:500] echo "$(date +'%H:%M:%S')"''; - font_size = 50; - font_family = "NotoMonoNerdFont"; - color = labelColor; - position = "0, 250"; - halign = "center"; - valign = "center"; - shadow_passes = 1; - } - { - text = ''cmd[update:10000] echo "$(date +'%a %d. %b')"''; - font_size = 15; - font_family = "NotoSansNerdFont"; - color = labelColor; - position = "0, 330"; - halign = "center"; - valign = "center"; - shadow_passes = 1; - } - { - text = ''󱁕 Hey $USER 󱁕''; - font_size = 25; - font_family = "NotoSansNerdFont"; - color = labelColor; - position = "0, 30"; - halign = "center"; - valign = "center"; - shadow_passes = 1; - } - { - text = ""; - font_size = 25; - color = labelColor; - position = "0, 80"; - halign = "center"; - valign = "center"; - shadow_passes = 1; - } - ]; - }; - }; - - wayland.windowManager.hyprland.settings = { - bindr = [ "$mainMod, L, exec, ${./hyprlock.sh}" ]; - workspace = [ - "name:hyprlock, monitor:eDP-1" - "name:hyprlock, decorate:false" - "name:hyprlock, border:false" - "name:hyprlock, shadow:false" - "special:hyprlock, monitor:eDP-1" - "special:hyprlock, decorate:false" - "special:hyprlock, border:false" - "special:hyprlock, shadow:false" - ]; - permission = [ - "${lib.escapeRegex (lib.getExe config.programs.hyprlock.package)}, screencopy, allow" - ]; - misc.session_lock_xray = true; - }; - - home.packages = with pkgs; [ - alacritty - cmatrix - asciiquarium-transparent - ]; - - programs.cava = { - enable = true; - settings.color = { - gradient = 1; - gradient_color_1 = "'#59cc33'"; - gradient_color_2 = "'#80cc33'"; - gradient_color_3 = "'#a6cc33'"; - gradient_color_4 = "'#cccc33'"; - gradient_color_5 = "'#cca633'"; - gradient_color_6 = "'#cc8033'"; - gradient_color_7 = "'#cc5933'"; - gradient_color_8 = "'#cc3333'"; - }; - }; -} diff --git a/modules/home-manager/wm/hyprland/hyprpolkit.nix b/modules/home-manager/wm/hyprland/hyprpolkit.nix deleted file mode 100644 index 0e95a66..0000000 --- a/modules/home-manager/wm/hyprland/hyprpolkit.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ ... }: - -{ - services.hyprpolkitagent.enable = true; -} diff --git a/modules/home-manager/wm/hyprland/hyprsunset/default.nix b/modules/home-manager/wm/hyprland/hyprsunset/default.nix deleted file mode 100644 index b5f606a..0000000 --- a/modules/home-manager/wm/hyprland/hyprsunset/default.nix +++ /dev/null @@ -1,65 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: - -let - myHyprsunsetTemperature = pkgs.writers.writePython3Bin "myHyprsunsetTemperature" { - libraries = with pkgs.python3Packages; [ - astral - dbus-python - tzlocal - ]; - flakeIgnore = [ "E501" ]; - } ./script.py; -in -{ - systemd.user.services = { - hyprsunset = { - Install = { - WantedBy = [ config.wayland.systemd.target ]; - }; - - Unit = { - ConditionEnvironment = "WAYLAND_DISPLAY"; - Description = "hyprsunset - Hyprland's blue-light filter"; - After = [ config.wayland.systemd.target ]; - PartOf = [ config.wayland.systemd.target ]; - }; - - Service = { - ExecStart = "${lib.getExe pkgs.hyprsunset}"; - Restart = "always"; - RestartSec = "10"; - }; - }; - - myHyprsunsetTemperature = { - Install = { - WantedBy = [ "hyprsunset.service" ]; - }; - - Unit = { - Description = "Custom hyprsunset temperature adjustment service"; - ConditionEnvironment = "WAYLAND_DISPLAY"; - After = [ "hyprsunset.service" ]; - PartOf = [ "hyprsunset.service" ]; - Requires = [ "hyprsunset.service" ]; - }; - - Service = { - ExecStart = "${lib.getExe myHyprsunsetTemperature}"; - Restart = "on-failure"; - RestartSec = "5s"; - Environment = "PYTHONUNBUFFERED=1"; # print statements will go to journalctl immediately - }; - }; - }; - - home.sessionVariables = { - HYPRSUNSET_DAY_TEMP = "6000"; - HYPRSUNSET_NIGHT_TEMP = "3000"; - }; -} diff --git a/modules/home-manager/wm/kde/default.nix b/modules/home-manager/wm/kde/default.nix deleted file mode 100644 index b7b491b..0000000 --- a/modules/home-manager/wm/kde/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ inputs, ... }: - -{ - imports = [ inputs.plasma-manager.homeModules.plasma-manager ]; - - # https://github.com/nix-community/stylix/issues/267#issuecomment-2314636091 - programs.plasma = { - enable = true; - configFile.kded5rc = { - "Module-gtkconfig"."autoload" = false; - }; - }; -} diff --git a/modules/home-manager/wm/useful_utilities/autoraise.nix b/modules/home-manager/wm/useful_utilities/autoraise.nix deleted file mode 100644 index 0be9d12..0000000 --- a/modules/home-manager/wm/useful_utilities/autoraise.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ pkgs, ... }: - -{ - home.packages = with pkgs; [ - autoraise - ]; - - # never raise - xdg.configFile."AutoRaise".text = "delay=0"; -} diff --git a/modules/home-manager/wm/useful_utilities/blueman-applet.nix b/modules/home-manager/wm/useful_utilities/blueman-applet.nix deleted file mode 100644 index 60931ed..0000000 --- a/modules/home-manager/wm/useful_utilities/blueman-applet.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: - -{ - services.blueman-applet.enable = true; - - wayland.windowManager.hyprland.settings.exec-once = [ - "sleep 10 && systemctl --user restart blueman-applet.service" - ]; -} diff --git a/modules/home-manager/wm/useful_utilities/cliphist/default.nix b/modules/home-manager/wm/useful_utilities/cliphist/default.nix deleted file mode 100644 index fb33082..0000000 --- a/modules/home-manager/wm/useful_utilities/cliphist/default.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ pkgs, lib, ... }: - -{ - home.packages = with pkgs; [ - wl-clipboard - ]; - - services.cliphist.enable = true; - - wayland.windowManager.hyprland.settings = { - bind = [ - # "$mainMod, V, exec, cliphist list | ${lib.getExe pkgs.rofi-wayland} -dmenu -theme ${./spotlight-dark.rasi} | cliphist decode | ${pkgs.wl-clipboard}/bin/wl-copy && ${lib.getExe pkgs.wtype} -M ctrl v -m ctrl" - "$mainMod, V, exec, [float; size 60% 60%; center; animation slide; dimaround] ${lib.getExe pkgs.alacritty} -e ${pkgs.cliphist}/bin/cliphist-fzf && ${lib.getExe pkgs.wtype} -M ctrl v -m ctrl" - ]; - }; -} diff --git a/modules/home-manager/wm/useful_utilities/gammastep.nix b/modules/home-manager/wm/useful_utilities/gammastep.nix deleted file mode 100644 index 86806f2..0000000 --- a/modules/home-manager/wm/useful_utilities/gammastep.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: - -{ - services.gammastep = { - enable = true; - provider = "geoclue2"; - tray = true; - }; -} diff --git a/modules/home-manager/wm/useful_utilities/kanshi.nix b/modules/home-manager/wm/useful_utilities/kanshi.nix deleted file mode 100644 index 953bf5d..0000000 --- a/modules/home-manager/wm/useful_utilities/kanshi.nix +++ /dev/null @@ -1,69 +0,0 @@ -{ ... }: - -{ - services.kanshi = { - enable = true; - systemdTarget = "graphical-session.target"; - profiles = { - default.outputs = [ - { - criteria = "eDP-1"; - mode = "1920x1080"; - scale = 1.0; - } - ]; - home_1.outputs = [ - { - criteria = "Dell Inc. DELL P2412H TTMDG2AQ15EU"; - mode = "1920x1080"; - scale = 1.0; - position = "0,0"; - } - { - criteria = "eDP-1"; - mode = "1920x1080"; - scale = 1.0; - position = "1920,0"; - } - ]; - home_2.outputs = [ - { - criteria = "Dell Inc. DELL P2412H TTMDG2AQ15EU"; - mode = "1920x1080"; - scale = 1.0; - position = "0,0"; - } - { - criteria = "LG Electronics E2210 205NDMT1D051"; - mode = "1680x1050"; - scale = 1.0; - position = "1920,0"; - } - { - criteria = "eDP-1"; - mode = "1920x1080"; - scale = 1.0; - position = "3600,0"; - } - ]; - office.outputs = [ - { - criteria = "eDP-1"; - mode = "1920x1080"; - scale = 1.0; - position = "0,0"; - } - { - criteria = "Acer Technologies CB271HU T85EE0018511"; - mode = "2560x1440"; - scale = 1.0; - position = "1920,0"; - } - ]; - }; - }; - - wayland.windowManager.hyprland.settings = { - bind = [ "$mainMod + SHIFT, P, exec, pkill -HUP kanshi" ]; - }; -} diff --git a/modules/home-manager/wm/useful_utilities/karabiner/default.nix b/modules/home-manager/wm/useful_utilities/karabiner/default.nix deleted file mode 100644 index 4d84663..0000000 --- a/modules/home-manager/wm/useful_utilities/karabiner/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -# karabiner-elements needs to be installed via brew because it needs to be in /Applications for the permissions to work -{ - lib, - userSettings, - ... -}: - -{ - home.activation = { - myKarabinerConfig = - let - karabinerPath = "$XDG_CONFIG_HOME/karabiner"; - targetDir = "${userSettings.flakeDirectory}/modules/home-manager/wm/useful_utilities/karabiner/karabiner"; - in - # Somehow karabiner-elements creates a new symlink in its folder so we want to remove it here - lib.hm.dag.entryAfter [ "writeBoundary" ] '' - run ln -sf ${targetDir} ${karabinerPath} - run rm -f ${karabinerPath}/karabiner - ''; - }; -} diff --git a/modules/home-manager/wm/useful_utilities/kdeconnect.nix b/modules/home-manager/wm/useful_utilities/kdeconnect.nix deleted file mode 100644 index e615178..0000000 --- a/modules/home-manager/wm/useful_utilities/kdeconnect.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: - -{ - services.kdeconnect = { - enable = true; - indicator = true; - }; -} diff --git a/modules/home-manager/wm/useful_utilities/media_controls.nix b/modules/home-manager/wm/useful_utilities/media_controls.nix deleted file mode 100644 index 42e81c3..0000000 --- a/modules/home-manager/wm/useful_utilities/media_controls.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ pkgs, ... }: - -{ - home.packages = with pkgs; [ - pamixer - playerctl - ]; - - services.swayosd = { - enable = true; - }; - - wayland.windowManager.hyprland.settings = { - bindl = [ - ", XF86AudioMute, exec, swayosd-client --output-volume mute-toggle" - ", XF86AudioPlay, exec, playerctl play-pause" - ", XF86AudioStop, exec, playerctl stop" - ", XF86AudioPrev, exec, playerctl previous" - ", XF86AudioNext, exec, playerctl next" - "CTRL, left, exec, playerctl previous" - "CTRL, right, exec, playerctl next" - ]; - - bindle = [ - ", XF86AudioRaiseVolume, exec, pamixer --unmute; swayosd-client --output-volume raise" - ", XF86MonBrightnessUp, exec, swayosd-client --brightness raise" - ", XF86MonBrightnessDown, exec, swayosd-client --brightness lower" - ", XF86AudioLowerVolume, exec, pamixer --unmute; swayosd-client --output-volume lower" - ]; - - layerrule = [ - "match:namespace swayosd, blur on, ignore_alpha" - ]; - }; -} diff --git a/modules/home-manager/wm/useful_utilities/myKanshiPlus/default.nix b/modules/home-manager/wm/useful_utilities/myKanshiPlus/default.nix deleted file mode 100644 index 0f22216..0000000 --- a/modules/home-manager/wm/useful_utilities/myKanshiPlus/default.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ ... }: - -{ - imports = [ ./module.nix ]; - - programs.myKanshiPlus = { - enable = true; - profiles = { - default.monitors."LG Display 0x0637" = { }; - home_1.monitors = { - "LG Display 0x0637" = { }; - "Dell Inc. DELL P2412H TTMDG2AQ15EU".position = "1920x0"; - }; - home_2 = { - monitors = { - "LG Display 0x0637" = { }; - "Dell Inc. DELL P2412H TTMDG2AQ15EU".position = "1920x0"; - "LG Electronics E2210 205NDMT1D051".position = "3840x0"; - }; - workspaces = { - "1" = "monitor:desc:Dell Inc. DELL P2412H TTMDG2AQ15EU, default:true"; - "2" = "monitor:desc:LG Electronics E2210 205NDMT1D051, default:true"; - "10" = "monitor:desc:LG Display 0x0637, default:true"; - }; - }; - office = { - monitors = { - "LG Display 0x0637" = { }; - "Acer Technologies CB271HU T85EE0018511".position = "1920x0"; - }; - workspaces = { - "1" = "monitor:desc:LG Display 0x0637, default:true"; - "2" = "monitor:desc:Acer Technologies CB271HU T85EE0018511"; - "5" = "monitor:desc:Acer Technologies CB271HU T85EE0018511, default:true"; - "9" = "monitor:desc:Acer Technologies CB271HU T85EE0018511"; - }; - }; - tv.monitors = { - "LG Display 0x0637" = { }; - "Samsung Electric Company SAMSUNG" = { - position = "auto"; - mirror = "LG Display 0x0637"; - }; - }; - }; - }; -} diff --git a/modules/home-manager/wm/useful_utilities/myKanshiPlus/module.nix b/modules/home-manager/wm/useful_utilities/myKanshiPlus/module.nix deleted file mode 100644 index 58fd1a8..0000000 --- a/modules/home-manager/wm/useful_utilities/myKanshiPlus/module.nix +++ /dev/null @@ -1,140 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: - -let - myKanshiPlus = pkgs.writers.writePython3Bin "myKanshiPlus" { - libraries = [ ]; - flakeIgnore = [ "E501" ]; - } ./script.py; - - cfg = config.programs.myKanshiPlus; - inherit (lib.types) - attrsOf - enum - float - int - nullOr - oneOf - submodule - str - ; - inherit (lib.options) mkEnableOption mkOption; - inherit (lib.modules) mkIf; - - monitor = submodule { - options = { - resolution = mkOption { - type = str; - default = "preferred"; - example = "1920x1080"; - description = "resolution of the monitor or preferred for preferred resolution of the monitor"; - }; - position = mkOption { - type = str; - default = "0x0"; - example = "auto"; - description = "either x (from top-left corner) or auto (next to the previous monitor)"; - }; - scale = mkOption { - type = oneOf [ - int - float - (enum [ "auto" ]) - ]; - default = 1; - example = "auto"; - description = "scale the monitor or let hyprland decide with auto"; - }; - mirror = mkOption { - type = nullOr str; - default = null; - example = "LG Display 0x0637"; - description = "description of the monitor to mirror"; - }; - transform = mkOption { - type = nullOr int; - default = null; - example = 2; - description = "see https://wiki.hyprland.org/Configuring/Monitors/#rotating"; - }; - }; - }; - - profile = submodule { - options = { - monitors = mkOption { - type = attrsOf monitor; - default = { }; - example = { - "Dell Inc. DELL P2412H TTMDG2AQ15EU" = { }; - "LG Electronics E2210 205NDMT1D051" = { - resolution = "1680x1050"; - position = "1920x0"; - }; - }; - description = "Attribute set of monitor configurations. The keys are the monitor descriptions and the values are attribute sets of the monitor configuration."; - }; - workspaces = mkOption { - type = attrsOf str; - default = { }; - example = { - "5" = "monitor:desc:Acer Technologies CB271HU T85EE0018511, default:true, on-created-empty:firefox"; - "name:test" = "rounding:false, border:false"; - }; - description = "Attribute set of workspace configurations. The keys are the workspace identifiers and the values are one (or more) rule(s) to apply to the workspace."; - }; - }; - }; -in - -{ - options.programs.myKanshiPlus = { - enable = mkEnableOption "myKanshiPlus"; - profiles = mkOption { - description = "Attribute set of monitor profiles"; - type = attrsOf profile; - default = { }; - }; - }; - - config = mkIf cfg.enable { - home.packages = [ myKanshiPlus ]; - - xdg.configFile."myKanshiPlus/config.json".text = builtins.toJSON cfg.profiles; - - systemd.user.services.myKanshiPlus = { - Unit = { - Description = "Dynamic display configuration"; - After = [ config.wayland.systemd.target ]; - PartOf = [ config.wayland.systemd.target ]; - Requires = [ config.wayland.systemd.target ]; - }; - Service = { - ExecStart = "${lib.getExe myKanshiPlus}"; - Restart = "always"; - RestartSec = 10; - Environment = "PYTHONUNBUFFERED=1"; # print statements will go to journalctl immediately - }; - Install = { - WantedBy = [ config.wayland.systemd.target ]; - }; - }; - - wayland.windowManager.hyprland.settings = { - source = [ - "./monitors.conf" - "./workspaces.conf" - ]; - }; - - home.activation.myKanshiPlus = lib.hm.dag.entryAfter [ "writeBoundary" ] '' - run [ -f ~/.config/hypr/monitors.conf ] || touch ~/.config/hypr/monitors.conf - run [ -f ~/.config/hypr/workspaces.conf ] || touch ~/.config/hypr/workspaces.conf - ''; - }; - -} diff --git a/modules/home-manager/wm/useful_utilities/nm-applet.nix b/modules/home-manager/wm/useful_utilities/nm-applet.nix deleted file mode 100644 index 5a57943..0000000 --- a/modules/home-manager/wm/useful_utilities/nm-applet.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ ... }: - -{ - services.network-manager-applet.enable = true; -} diff --git a/modules/home-manager/wm/useful_utilities/nwg-displays.nix b/modules/home-manager/wm/useful_utilities/nwg-displays.nix deleted file mode 100644 index 6579108..0000000 --- a/modules/home-manager/wm/useful_utilities/nwg-displays.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ lib, pkgs, ... }: - -{ - home.packages = with pkgs; [ - nwg-displays - wlr-randr - ]; - - wayland.windowManager.hyprland.settings = { - source = [ - "./monitors.conf" - "./workspaces.conf" - ]; - bind = [ "$mainMod, P, exec, nwg-displays" ]; - }; - - home.activation.myNwgDisplay = lib.hm.dag.entryAfter [ "writeBoundary" ] '' - run [ -f ~/.config/hypr/monitors.conf ] || touch ~/.config/hypr/monitors.conf - run [ -f ~/.config/hypr/workspaces.conf ] || touch ~/.config/hypr/workspaces.conf - ''; -} diff --git a/modules/home-manager/wm/useful_utilities/screenshot.nix b/modules/home-manager/wm/useful_utilities/screenshot.nix deleted file mode 100644 index c42d16a..0000000 --- a/modules/home-manager/wm/useful_utilities/screenshot.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ pkgs, lib, ... }: - -{ - wayland.windowManager.hyprland.settings = { - bind = [ - "CTRL + ALT, S, exec, ${pkgs.wl-clipboard}/bin/wl-paste | ${lib.getExe pkgs.swappy} -f -" - ", Print, exec, ${lib.getExe pkgs.grimblast} --notify --freeze copy area" - ]; - layerrule = [ - "match:namespace hyprpicker, no_anim on" - "match:namespace selection, no_anim on" - ]; - permission = [ - "${lib.getExe pkgs.grim}, screencopy, allow" - "${lib.getExe pkgs.hyprpicker}, screencopy, allow" # required for freezing the screen when selecting area - ]; - }; -} diff --git a/modules/home-manager/wm/useful_utilities/swaync/default.nix b/modules/home-manager/wm/useful_utilities/swaync/default.nix deleted file mode 100644 index 1f84298..0000000 --- a/modules/home-manager/wm/useful_utilities/swaync/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ pkgs, ... }: - -{ - home.packages = [ - pkgs.swaynotificationcenter - ]; - - wayland.windowManager.hyprland.settings = { - bind = [ "$mainMod, N, exec, swaync-client -t -sw" ]; - exec-once = [ "swaync" ]; - layerrule = [ - "match:namespace swaync-control-center, blur on, ignore_alpha, animation popin 90%" - "match:namespace swaync-notification-window, blur on, ignore_alpha, animation popin" - ]; - }; - - xdg.configFile."swaync" = { - source = ./configs; - recursive = true; - }; -} diff --git a/modules/home-manager/wm/useful_utilities/swww.nix b/modules/home-manager/wm/useful_utilities/swww.nix deleted file mode 100644 index 46da654..0000000 --- a/modules/home-manager/wm/useful_utilities/swww.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ pkgs, userSettings, ... }: - -{ - home.packages = [ pkgs.swww ]; - wayland.windowManager.hyprland.settings = { - bind = [ - "CTRL + ALT, W, exec, ~/scripts/wallpaper/select_image.sh ${userSettings.wallpaperFolder} && ~/scripts/wallpaper/update_wallpaper_swww.sh" - ]; - exec-once = [ - "sleep 1 && swww-daemon" - "sleep 2 && ~/scripts/wallpaper/update_wallpaper_swww.sh" - ]; - }; -} diff --git a/modules/home-manager/wm/useful_utilities/tofi.nix b/modules/home-manager/wm/useful_utilities/tofi.nix deleted file mode 100644 index ab38384..0000000 --- a/modules/home-manager/wm/useful_utilities/tofi.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ ... }: - -{ - programs.tofi = { - enable = true; - settings = { - # General - font = "/run/current-system/sw/share/X11/fonts/NotoSansNerdFont-Regular.ttf"; - font-size = 14; - background-color = "#00000099"; - border-color = "#6400c8"; - prompt-text = ''" run: "''; - min-input-width = 120; - result-spacing = 15; - - # Dmenu - # anchor = "top"; - # width = "100%"; - # height = 36; - # horizontal = true; - # outline-width = 0; - # border-width = 0; - # padding-top = 5; - # padding-bottom = 0; - # padding-left = 0; - # padding-right = 0; - - # Rofi - width = "50%"; - height = "50%"; - outline-width = 2; - border-width = 2; - corner-radius = 15; - }; - }; - - wayland.windowManager.hyprland.settings = { - bindr = [ "$mainMod, $mainMod_L, exec, pkill --exact tofi-drun || tofi-drun --drun-launch=true" ]; - exec-once = [ "rm ~/.cache/tofi-drun" ]; - layerrule = [ - "match:namespace launcher, blur on, animation slide" - ]; - }; -} diff --git a/modules/home-manager/wm/useful_utilities/waybar/default.nix b/modules/home-manager/wm/useful_utilities/waybar/default.nix deleted file mode 100644 index 6723e66..0000000 --- a/modules/home-manager/wm/useful_utilities/waybar/default.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ pkgs, ... }: - -{ - imports = [ - ./modules.nix - ./settings.nix - ]; - - home.packages = with pkgs; [ - pavucontrol - pywal - ]; - - programs.waybar = { - enable = true; - package = ( - pkgs.waybar.override { - withMediaPlayer = true; - } - ); - style = ./style.css; - }; - - wayland.windowManager.hyprland.settings = { - bind = [ - "CTRL + ALT, B, exec, ${./launch_waybar.sh}" - "CTRL + ALT, W, exec, ${./launch_waybar.sh}" - ]; - exec-once = [ "sleep 2 && ${./launch_waybar.sh}" ]; - layerrule = [ - "match:namespace waybar, blur on, blur_popups on, ignore_alpha 0.1" - ]; - }; -} diff --git a/modules/home-manager/wm/useful_utilities/waybar/modules.nix b/modules/home-manager/wm/useful_utilities/waybar/modules.nix deleted file mode 100644 index ae5d5c7..0000000 --- a/modules/home-manager/wm/useful_utilities/waybar/modules.nix +++ /dev/null @@ -1,236 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: - -{ - xdg.configFile."waybar/modules.json".text = '' - { - // Workspaces - "hyprland/workspaces": { - "on-click": "activate", - "active-only": false, - "all-outputs": true, - "format": "{}", - "format-icons": { - "urgent": "", - "active": "", - "default": "" - }, - "persistent_workspaces": { - - } - }, - // Taskbar - "wlr/taskbar": { - "format": "{icon}", - "icon-size": 20, - "tooltip-format": "{title}", - "on-click": "activate", - "on-click-middle": "close", - }, - // Hyprland Window - "hyprland/window": { - "rewrite": { - "(.*) — Mozilla Firefox": "🌎 $1", - }, - "separate-outputs": true - }, - // Pulseaudio - "pulseaudio": { - "format": "{icon} {volume}%", - "format-bluetooth": " {icon} {volume}%", - "format-bluetooth-muted": "   ", - "format-muted": "  ", - "format-icons": { - "headphone": "", - "hands-free": "", - "headset": "", - "phone": "", - "portable": "", - "car": "", - "default": [ - "󰕿", - "󰖀", - "󰕾" - ] - }, - "scroll-step": 1, - "reverse-scrolling": true, - "on-click-right": "pavucontrol", - "on-click": "pamixer -t", - "on-scroll-up": "pamixer -i 1", - "on-scroll-down": "pamixer -d 1", - }, - "pulseaudio#microphone": { - "format": "{format_source}", - "format-source": " {volume}%", - "format-source-muted": "  ", - "scroll-step": 1, - "reverse-scrolling": true, - "on-click-right": "pavucontrol", - "on-click": "pamixer --default-source -t", - "on-scroll-up": "pamixer --default-source -i 1", - "on-scroll-down": "pamixer --default-source -d 1", - }, - // Cliphist - "custom/cliphist": { - "format": "", - "on-click": "sleep 0.1 && ~/dotfiles/scripts/cliphist.sh", - "on-click-right": "sleep 0.1 && ~/dotfiles/scripts/cliphist.sh d", - "on-click-middle": "sleep 0.1 && ~/dotfiles/scripts/cliphist.sh w", - "tooltip": false - }, - // Keyboard State - "keyboard-state": { - "numlock": true, - "capslock": true, - "format": "{name} {icon}", - "format-icons": { - "locked": "", - "unlocked": "" - } - }, - // System tray - "tray": { - "icon-size": 20, - "spacing": 10 - }, - // Clock - "clock": { - "tooltip-format": "{:%Y %B}\n{calendar}", - "format-alt": "{:%Y-%m-%d}" - }, - // CPU - "cpu": { - "interval": 1, - "format": "C {usage}% / ", - "on-click": "${lib.getExe pkgs.alacritty} -e htop" - }, - // Memory - "memory": { - "interval": 1, - "format": "M {percentage}% / ", - "on-click": "${lib.getExe pkgs.alacritty} -e htop" - }, - // Temperature - "temperature": { - "thermal-zone": 6, - "format": "T {temperatureC}°C", - "interval": 1, - "on-click": "${lib.getExe pkgs.alacritty} -e htop" - }, - // Group hardware - "group/hardware": { - "orientation": "horizontal", - "modules": [ - "memory", - "cpu", - "temperature" - ] - }, - // Network - "network": { - "interval": 1, - "format": "{ifname}", - "format-wifi": " {signalStrength}%", - "format-ethernet": "", - "format-disconnected": "", //An empty format will hide the module. - "tooltip-format": "{ifname} via {gwaddri}", - "tooltip-format-wifi": " {essid} ({signalStrength}%)", - "tooltip-format-ethernet": " {ifname} ({ipaddr}/{cidr})", - "tooltip-format-disconnected": "Disconnected", - "max-length": 50 - }, - // Battery - "battery": { - "interval": 1, - "states": { - "good": 95, - "warning": 30, - "critical": 15 - }, - "format": "{icon} {capacity}%", - "format-charging": "  {capacity}%", - "format-plugged": " {capacity}%", - "format-full": " {capacity}%", - "format-alt": "{icon} {time}", - "format-icons": [ - " ", - " ", - " ", - " ", - " " - ] - }, - // Bluetooth - "bluetooth": { - "format-disabled": "", - "format-off": "", - "interval": 30, - "on-click-right": "blueman-manager" - }, - // Idle Inhibitor - "idle_inhibitor": { - "format": "{icon}", - "format-icons": { - "activated": " ", - "deactivated": " " - } - }, - // Backlight - "backlight": { - "device": "intel_backlight", - "format": "{icon} {percent}%", - "format-icons": [ - "", - "", - "", - "", - "", - "", - "", - "", - "" - ], - "reverse-scrolling": true, - }, - // Custom media - "custom/media": { - "format": "{icon} {}", - "return-type": "json", - "max-length": 40, - "format-icons": { - "spotify": "", - "default": "🎜" - }, - "escape": true, - // "exec": "${config.programs.waybar.package}/bin/waybar-mediaplayer.py 2> /dev/null" // Script in resources folder - "exec": "${config.programs.waybar.package}/bin/waybar-mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name - }, - //Custom notification - "custom/notification": { - "tooltip": false, - "format": "{icon} ", - "format-icons": { - "notification": "", - "none": "", - "dnd-notification": "", - "dnd-none": "", - "inhibited-notification": "", - "inhibited-none": "", - "dnd-inhibited-notification": "", - "dnd-inhibited-none": "" - }, - "return-type": "json", - "exec-if": "which swaync-client", - "exec": "swaync-client -swb", - "on-click": "sleep 0.2 && swaync-client -t -sw", - "on-click-right": "swaync-client -d -sw", - "escape": true - }, - } - ''; -} diff --git a/modules/home-manager/wm/useful_utilities/waybar/settings.nix b/modules/home-manager/wm/useful_utilities/waybar/settings.nix deleted file mode 100644 index 6c5bf60..0000000 --- a/modules/home-manager/wm/useful_utilities/waybar/settings.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ ... }: - -{ - programs.waybar.settings.mainBar = { - layer = "top"; # Waybar at top layer - # position = "bottom"; # Waybar position (top|bottom|left|right) - height = 30; # Waybar height (to be removed for auto height) - # width = 1280; # Waybar width - spacing = 4; # Gaps between modules (4px) - - # Load modules - include = [ "~/.config/waybar/modules.json" ]; - # include = ["~/.config/waybar/modules.json.orig"]; - - # Choose the order of the modules - modules-left = [ - "wlr/taskbar" - "hyprland/window" - "custom/media" - ]; - modules-center = [ "hyprland/workspaces" ]; - modules-right = [ - "tray" - "idle_inhibitor" - "pulseaudio" - "pulseaudio#microphone" - "backlight" - "battery" - "clock" - "custom/notification" - ]; - }; -} diff --git a/modules/system/apps/cli-apps.nix b/modules/system/apps/cli-apps.nix deleted file mode 100644 index 3a75624..0000000 --- a/modules/system/apps/cli-apps.nix +++ /dev/null @@ -1,60 +0,0 @@ -{ - pkgs, - lib, - myPkgs, - ... -}: - -let - allConfig = { - # Collection of useful CLI apps - environment.systemPackages = with pkgs; [ - bat - btop - curl - delta - eza - fastfetch - ffmpeg - file - fzf - gnugrep - gnused - htop - imagemagick - jq - killall - libnotify - nano - nh - pandoc - pciutils - ripgrep - rsync - tldr - sops - unzip - usbutils - wget - ]; - - programs.tmux = { - enable = true; - extraConfig = '' - set -g mouse on - ''; - }; - }; - - linuxConfig = { - environment.systemPackages = with pkgs; [ - acpi - efibootmgr - ]; - }; -in - -lib.mkMerge [ - allConfig - (lib.optionalAttrs myPkgs.stdenv.isLinux linuxConfig) -] diff --git a/modules/system/apps/steam.nix b/modules/system/apps/steam.nix deleted file mode 100644 index 58c6220..0000000 --- a/modules/system/apps/steam.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ pkgs, ... }: - -{ - programs.steam = { - enable = true; - gamescopeSession.enable = true; # with `gamescope %command%` in games launch options: start game in optimised microcompositor (may help if game has problems with resolutions) - }; - - environment.systemPackages = with pkgs; [ - mangohud # with `mangohud %command%` in games launch options: show performance overlay - protonplus - ]; - - programs.gamemode.enable = true; # with `gamemoderun %command%` in games launch options: improve game performance with a set of optimizations -} diff --git a/modules/system/apps/virtualisation.nix b/modules/system/apps/virtualisation.nix deleted file mode 100644 index b4ce35b..0000000 --- a/modules/system/apps/virtualisation.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ ... }: - -{ - # https://wiki.nixos.org/wiki/Virt-manager - virtualisation.libvirtd.enable = true; - programs.virt-manager.enable = true; - virtualisation.spiceUSBRedirection.enable = true; - - # https://wiki.nixos.org/wiki/Podman - virtualisation.containers.enable = true; - virtualisation = { - podman = { - enable = true; - - # Create a `docker` alias for podman, to use it as a drop-in replacement - dockerCompat = true; - - # Required for containers under podman-compose to be able to talk to each other. - defaultNetwork.settings.dns_enabled = true; - }; - }; - - # https://wiki.nixos.org/wiki/Flatpak - # services.flatpak.enable = true; -} diff --git a/modules/system/basic/default.nix b/modules/system/basic/default.nix deleted file mode 100644 index af3dcd3..0000000 --- a/modules/system/basic/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ ... }: - -{ - imports = [ - ./kernel.nix - ./locale.nix - ./nh.nix - ./settings.nix - ./sops.nix - ./users.nix - ]; -} diff --git a/modules/system/basic/kernel.nix b/modules/system/basic/kernel.nix deleted file mode 100644 index f5a88d3..0000000 --- a/modules/system/basic/kernel.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ pkgs, ... }: - -{ - boot.kernelPackages = pkgs.linuxPackages; -} diff --git a/modules/system/basic/locale.nix b/modules/system/basic/locale.nix deleted file mode 100644 index 41292c2..0000000 --- a/modules/system/basic/locale.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ systemSettings, ... }: - -{ - console.keyMap = systemSettings.kblayout; # tty keyboard layout - - # set locales - time.timeZone = systemSettings.timezone; - i18n.defaultLocale = systemSettings.defaultLocale; - i18n.extraLocaleSettings = { - LC_ADDRESS = systemSettings.extraLocale; - LC_IDENTIFICATION = systemSettings.extraLocale; - LC_MEASUREMENT = systemSettings.extraLocale; - LC_MONETARY = systemSettings.extraLocale; - LC_NAME = systemSettings.extraLocale; - LC_NUMERIC = systemSettings.extraLocale; - LC_PAPER = systemSettings.extraLocale; - LC_TELEPHONE = systemSettings.extraLocale; - LC_TIME = systemSettings.extraLocale; - }; -} diff --git a/modules/system/basic/macos-settings.nix b/modules/system/basic/macos-settings.nix deleted file mode 100644 index 0c125a7..0000000 --- a/modules/system/basic/macos-settings.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ ... }: - -{ - nix.gc = { - automatic = true; - options = "--delete-older-than 7d"; - }; - - security.pam.services.sudo_local.touchIdAuth = true; - - system.defaults = { - dock = { - tilesize = 30; - static-only = true; - orientation = "left"; - }; - finder = { - ShowPathbar = true; - ShowStatusBar = true; - NewWindowTarget = "Home"; - FXPreferredViewStyle = "clmv"; - AppleShowAllExtensions = true; - }; - trackpad = { - Dragging = true; - Clicking = true; - TrackpadRightClick = true; - }; - }; - - # Manual configurations - # setup Scroll Reverser and MiddleClick - # Desktop & Dock -> Desktop & Stage Manager -> Click wallpaper to reveal desktop - Only in Stage Manager - # defaults write -g NSWindowShouldDragOnGesture -bool true # Now, you can move windows by holding ctrl + cmd and dragging any part of the window (not necessarily the window title) -} diff --git a/modules/system/basic/nh.nix b/modules/system/basic/nh.nix deleted file mode 100644 index a5cbf96..0000000 --- a/modules/system/basic/nh.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ ... }: - -{ - programs.nh = { - # nix helper for basic nix commands with added functionality - enable = true; - clean = { - enable = true; - dates = "weekly"; - extraArgs = "--keep-since=7d --keep=5"; - }; - }; -} diff --git a/modules/system/basic/settings.nix b/modules/system/basic/settings.nix deleted file mode 100644 index 2799035..0000000 --- a/modules/system/basic/settings.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ - lib, - pkgs, - myPkgs, - ... -}: - -let - allConfig = { - # set some important things - nixpkgs.pkgs = myPkgs; - nix.settings.experimental-features = [ - "nix-command" - "flakes" - ]; - nix.channel.enable = false; - nix.optimise.automatic = true; # optimise nix store disk space by hard linking identical files - - # set zsh as default shell - programs.zsh.enable = true; - environment.pathsToLink = [ "/share/zsh" ]; # needed for completion for system packages - - # install home-manager - environment.systemPackages = with pkgs; [ - home-manager - ]; - }; - - linuxConfig = { - hardware.enableAllFirmware = true; - users.defaultUserShell = pkgs.zsh; - }; -in -lib.mkMerge [ - allConfig - (lib.optionalAttrs myPkgs.stdenv.isLinux linuxConfig) -] diff --git a/modules/system/basic/sops.nix b/modules/system/basic/sops.nix deleted file mode 100644 index b151918..0000000 --- a/modules/system/basic/sops.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ systemSettings, ... }: - -{ - sops = { - age.keyFile = "/home/${systemSettings.users."1".username}/.config/sops/age/keys.txt"; - defaultSopsFile = ../../../secrets/secrets.yaml; - defaultSopsFormat = "yaml"; - }; - - # set up ssh keys for users - sops.secrets = builtins.listToAttrs ( - builtins.map (user: { - name = "ssh/private_keys/${user.username}@${systemSettings.hostname}"; - value = { - owner = user.username; - mode = "600"; - path = "/home/${user.username}/.ssh/id_ed25519"; - }; - }) (builtins.attrValues systemSettings.users) - ); -} diff --git a/modules/system/basic/users.nix b/modules/system/basic/users.nix deleted file mode 100644 index b119efb..0000000 --- a/modules/system/basic/users.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ systemSettings, ... }: - -{ - # create users - users.users = builtins.listToAttrs ( - builtins.map (user: { - name = user.username; - value = { - isNormalUser = true; - description = user.name; - extraGroups = - user.extraGroups or [ - "networkmanager" - "wheel" - ]; - }; - }) (builtins.attrValues systemSettings.users) - ); -} diff --git a/modules/system/boot/grub.nix b/modules/system/boot/grub.nix deleted file mode 100644 index 294b696..0000000 --- a/modules/system/boot/grub.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ inputs, ... }: - -{ - imports = [ - inputs.grub2-themes.nixosModules.default - ]; - - # Bootloader - boot.loader = { - efi.canTouchEfiVariables = true; - grub = { - enable = true; - efiSupport = true; - device = "nodev"; - useOSProber = true; - }; - grub2-theme = { - # checkout https://github.com/vinceliuice/grub2-themes/blob/master/flake.nix for more options - enable = true; - theme = "tela"; - icon = "color"; - splashImage = ../../../scripts/wallpaper/animated/mountains-in-clouds.jpg; - }; - }; -} diff --git a/modules/system/boot/plymouth.nix b/modules/system/boot/plymouth.nix deleted file mode 100644 index 95c6a1e..0000000 --- a/modules/system/boot/plymouth.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: - -{ - boot.plymouth = { - enable = true; - theme = "solar"; - }; -} diff --git a/modules/system/fonts/fonts.nix b/modules/system/fonts/fonts.nix deleted file mode 100644 index cefee83..0000000 --- a/modules/system/fonts/fonts.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ pkgs, lib, ... }: - -# install all nerd fonts except Iosevka and its variants because they are huge and not needed -let - allNerdFontsNames = builtins.attrNames pkgs.nerd-fonts; - dropIosevka = builtins.filter (name: lib.hasPrefix "iosevka" name) allNerdFontsNames; - customNerdFonts = builtins.removeAttrs pkgs.nerd-fonts dropIosevka; - customNerdFontsDerivations = builtins.filter lib.attrsets.isDerivation ( - builtins.attrValues customNerdFonts - ); -in - -{ - fonts.packages = [ - - ] - ++ customNerdFontsDerivations; - - fonts.fontDir.enable = true; - - fonts.fontconfig.defaultFonts = { - monospace = [ - "Hack Nerd Font Mono" - "JetBrainsMono Nerd Font" - ]; - }; -} diff --git a/modules/system/hardware/accelerated_video_playback.nix b/modules/system/hardware/accelerated_video_playback.nix deleted file mode 100644 index 3463308..0000000 --- a/modules/system/hardware/accelerated_video_playback.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ pkgs, ... }: - -# https://wiki.nixos.org/wiki/Accelerated_Video_Playback -{ - hardware.graphics = { - extraPackages = with pkgs; [ - libvdpau-va-gl - ]; - }; -} diff --git a/modules/system/hardware/automount.nix b/modules/system/hardware/automount.nix deleted file mode 100644 index 26b2999..0000000 --- a/modules/system/hardware/automount.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ pkgs, ... }: - -{ - services.devmon.enable = true; - services.gvfs.enable = true; - services.udisks2.enable = true; - environment.systemPackages = with pkgs; [ - ntfs3g - ]; -} diff --git a/modules/system/hardware/bluetooth.nix b/modules/system/hardware/bluetooth.nix deleted file mode 100644 index 82cc112..0000000 --- a/modules/system/hardware/bluetooth.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: - -{ - # Bluetooth - hardware.bluetooth.enable = true; - services.blueman.enable = true; -} diff --git a/modules/system/hardware/intel.nix b/modules/system/hardware/intel.nix deleted file mode 100644 index 050c1d9..0000000 --- a/modules/system/hardware/intel.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ pkgs, ... }: - -# https://wiki.nixos.org/wiki/Accelerated_Video_Playback -{ - hardware.graphics = { - extraPackages = with pkgs; [ - intel-media-driver # LIBVA_DRIVER_NAME=iHD - intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) - - # OpenCL support (needed for hashcat) - intel-ocl - intel-compute-runtime - pocl - ocl-icd - ]; - }; - - environment.sessionVariables = { - LIBVA_DRIVER_NAME = "iHD"; - }; # Force intel-media-driver -} diff --git a/modules/system/hardware/networking.nix b/modules/system/hardware/networking.nix deleted file mode 100644 index 1859909..0000000 --- a/modules/system/hardware/networking.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, systemSettings, ... }: - -{ - # Enable networking - networking.hostName = systemSettings.hostname; # Define your hostname. - networking.networkmanager.enable = true; - environment.systemPackages = [ pkgs.networkmanagerapplet ]; - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - services.resolved.enable = true; # needed for wireguard -} diff --git a/modules/system/hardware/pipewire.nix b/modules/system/hardware/pipewire.nix deleted file mode 100644 index 63c061b..0000000 --- a/modules/system/hardware/pipewire.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ ... }: - -{ - # Enable sound with pipewire. - services.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - # If you want to use JACK applications, uncomment this - #jack.enable = true; - - # use the example session manager (no others are packaged yet so this is enabled by default, - # no need to redefine it in your config for now) - #media-session.enable = true; - }; -} diff --git a/modules/system/hardware/power.nix b/modules/system/hardware/power.nix deleted file mode 100644 index eef4d28..0000000 --- a/modules/system/hardware/power.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ ... }: - -{ - #services.auto-cpufreq.enable = true; - #services.auto-cpufreq.settings = { - # charger = { - # governor = "performance"; - # turbo = "auto"; - # }; - # battery = { - # governor = "schedutil"; - # scaling_max_freq = 3800000; - # turbo = "never"; - # }; - #}; - services.tlp = { - enable = true; - settings = { - CPU_SCALING_GOVERNOR_ON_AC = "performance"; - CPU_SCALING_GOVERNOR_ON_BAT = "schedutil"; - - CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; - CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; - - CPU_MIN_PERF_ON_AC = 0; - CPU_MAX_PERF_ON_AC = 100; - CPU_MIN_PERF_ON_BAT = 0; - CPU_MAX_PERF_ON_BAT = 80; - }; - }; - -} diff --git a/modules/system/hardware/printing.nix b/modules/system/hardware/printing.nix deleted file mode 100644 index 407f23a..0000000 --- a/modules/system/hardware/printing.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ pkgs, ... }: - -{ - # Enable CUPS to print documents + avahi for scanner detection - services.printing.enable = true; - services.avahi = { - enable = true; - nssmdns4 = true; - openFirewall = true; - }; - environment.systemPackages = with pkgs; [ - cups-filters - system-config-printer - ]; -} diff --git a/modules/system/security/location_information.nix b/modules/system/security/location_information.nix deleted file mode 100644 index ee56b84..0000000 --- a/modules/system/security/location_information.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ ... }: - -{ - services.geoclue2.enable = true; -} diff --git a/modules/system/security/remote.nix b/modules/system/security/remote.nix deleted file mode 100644 index 56cb283..0000000 --- a/modules/system/security/remote.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: - -{ - services.teamviewer = { - enable = true; - }; -} diff --git a/modules/system/security/run_binaries.nix b/modules/system/security/run_binaries.nix deleted file mode 100644 index f17ebda..0000000 --- a/modules/system/security/run_binaries.nix +++ /dev/null @@ -1,14 +0,0 @@ -# https://unix.stackexchange.com/questions/522822/different-methods-to-run-a-non-nixos-executable-on-nixos -# https://github.com/thiagokokada/nix-alien -{ pkgs, options, ... }: - -{ - programs.nix-ld = { - enable = true; - libraries = - options.programs.nix-ld.libraries.default - ++ (with pkgs; [ - # Add any missing dynamic libraries for unpackaged programs here, NOT in environment.systemPackages - ]); - }; -} diff --git a/modules/system/server/fail2ban.nix b/modules/system/server/fail2ban.nix deleted file mode 100644 index 6703aa1..0000000 --- a/modules/system/server/fail2ban.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ ... }: - -{ - services.fail2ban = { - enable = true; - ignoreIP = [ ]; - bantime = "10m"; - maxretry = 5; - bantime-increment = { - enable = true; - maxtime = "168h"; - }; - # defaults that cannot be set as module options go here (module options are transformed to DEFAULT.settings options) - jails.DEFAULT.settings = { - findtime = "10m"; - dbpurgeage = "30d"; - }; - }; -} diff --git a/modules/system/server/nextcloud/default.nix b/modules/system/server/nextcloud/default.nix deleted file mode 100644 index 2e27838..0000000 --- a/modules/system/server/nextcloud/default.nix +++ /dev/null @@ -1,258 +0,0 @@ -{ - pkgs, - config, - lib, - systemSettings, - ... -}: - -# IMPORTANT: -# When updating the Nextcloud package, also update the preview generator app - -let - mainDriveMountPoint = "/media/nextcloud/main_drive"; - backupDriveMountPoint = "/media/nextcloud/backup_drive"; - myCloudScripts = - with pkgs.python3Packages; - buildPythonPackage { - name = "my-cloud-scripts"; - src = ./.; - propagatedBuildInputs = [ requests ]; - pyproject = true; - build-system = [ setuptools ]; - }; -in - -{ - environment.systemPackages = with pkgs; [ - myCloudScripts - borgbackup - ]; - - ### load needed secrets ### - sops.secrets = { - "nextcloud/adminpass" = { - owner = "nextcloud"; - }; - "telegram/api_key" = { - owner = "nextcloud"; - }; - "telegram/main_chat_id" = { - owner = "nextcloud"; - }; - }; - - ### mount main and backup drives ### - fileSystems."${mainDriveMountPoint}" = { - device = "/dev/disk/by-id/${systemSettings.nextcloud.drives.main}"; - fsType = "ext4"; - options = [ - # "defaults" - "nofail" - "noatime" - "noauto" - "x-systemd.automount" - ]; - }; - fileSystems."${backupDriveMountPoint}" = { - device = "/dev/disk/by-id/${systemSettings.nextcloud.drives.backup}"; - fsType = "ext4"; - options = [ - # "defaults" - "nofail" - "noatime" - "noauto" - "x-systemd.automount" - "x-systemd.idle-timeout=10min" - ]; - }; - - ### CONFIGURE NEXTCLOUD ### - services.nextcloud = { - enable = true; - - ### package setup ### - # remember you can only upgrade Nextcloud to the next major version - # if you want to upgrade to a newer version, change the nextcloud package (and customcss package) here - package = pkgs.nextcloud32; - extraApps = { - inherit (config.services.nextcloud.package.packages.apps) - calendar - contacts - notes - previewgenerator - tasks - ; - theming_customcss = pkgs.fetchNextcloudApp { - url = "https://github.com/nextcloud/theming_customcss/archive/refs/tags/v1.19.0.tar.gz"; - sha256 = "sha256-YX4hJ8TuhCI+Bzb2mQBczfclXORlrYPvV2MWjc1zajc="; - license = "agpl3Plus"; - }; - }; - appstoreEnable = false; - autoUpdateApps = { - enable = true; - startAt = "07:00:00"; - }; - - ### main settings ### - hostName = systemSettings.nextcloud.hostName; - home = "/var/lib/nextcloud"; - datadir = mainDriveMountPoint; - config = { - dbuser = "nextcloud"; - dbtype = "mysql"; - dbname = "nextcloud"; - adminuser = "admin"; - adminpassFile = config.sops.secrets."nextcloud/adminpass".path; - }; - database.createLocally = true; - - ### use Redis for all caching except local memcache ### - caching = { - apcu = true; - redis = true; - }; - configureRedis = true; - - ### config.php settings ### - enableImagemagick = true; - settings = { - enabledPreviewProviders = [ - # default providers - "OC\\Preview\\BMP" - "OC\\Preview\\GIF" - "OC\\Preview\\JPEG" - "OC\\Preview\\Krita" - "OC\\Preview\\MarkDown" - "OC\\Preview\\MP3" - "OC\\Preview\\OpenDocument" - "OC\\Preview\\PNG" - "OC\\Preview\\TXT" - "OC\\Preview\\XBitmap" - # additional providers - "OC\\Preview\\HEIC" - ]; - log_type = "file"; - maintenance_window_start = 2; # run non time-sensitive tasks at 2:00am for up to 4 hours - trusted_domains = systemSettings.nextcloud.trusted_domains; - overwriteprotocol = "https"; - preview_max_x = 2048; - preview_max_y = 2048; - jpeg_quality = 60; - }; - - ### php.ini settings ### - phpOptions = { - "opcache.interned_strings_buffer" = 16; - # we allow uploads of up to 8GB (it seems that this is only neccessary for WebDAV uploads (e.g. FolderSync); large file uploads from the web interface or nextcloud client also work with low limits) but we do not want the PHP memory limit to be that high for low resource setups (the nixos module sets it to maxUploadSize by default) - "memory_limit" = lib.mkForce "512M"; - }; - maxUploadSize = "8G"; - - ### php-fpm.conf settings (reduce overhead for low resource setups) ### - poolSettings = { - pm = "ondemand"; - "pm.max_children" = 12; - "pm.process_idle_timeout" = "1m"; - "pm.max_requests" = 500; - }; - - ### Use HTTPS for generated links ### - https = true; - - ### notify push settings ### - notify_push.enable = false; - }; - - ### CONFIGURE NGINX and ACME ### - security.acme.acceptTerms = true; - security.acme.defaults.email = systemSettings.acmeEmail; - services.nginx.recommendedTlsSettings = true; - services.nginx.recommendedOptimisation = true; - services.nginx.virtualHosts.${config.services.nextcloud.hostName} = { - forceSSL = true; - enableACME = true; - }; - - ### open ports in firewall ### - networking.firewall.allowedTCPPorts = [ - 80 - 443 - ]; - - ### CONFIGURE SYSTEMD SERVICES AND TIMERS ### - systemd.timers."nextcloud-preview-generator" = { - wantedBy = [ "timers.target" ]; - after = [ "nextcloud-setup.service" ]; - timerConfig = { - OnCalendar = "*-*-* 00:00:00"; - Persistent = true; - }; - }; - systemd.services."nextcloud-preview-generator" = { - after = [ "nextcloud-setup.service" ]; - serviceConfig = { - Type = "oneshot"; - ExecStart = "/run/current-system/sw/bin/my_nextcloud_preview_generator"; - User = "nextcloud"; - }; - }; - - systemd.timers."nextcloud-cloudbackup" = { - wantedBy = [ "timers.target" ]; - after = [ "nextcloud-setup.service" ]; - timerConfig = { - OnCalendar = "*-*-* 04:00:00"; - Persistent = true; - }; - }; - systemd.services."nextcloud-cloudbackup" = { - after = [ "nextcloud-setup.service" ]; - serviceConfig = { - Type = "oneshot"; - ExecStart = "/run/current-system/sw/bin/my_nextcloud_cloudbackup"; - User = "nextcloud"; - }; - }; - - systemd.timers."nextcloud-scheduled-reboot" = { - wantedBy = [ "timers.target" ]; - after = [ "nextcloud-setup.service" ]; - timerConfig = { - OnCalendar = "Mon *-*-* 12:00:00"; - }; - }; - systemd.services."nextcloud-scheduled-reboot" = { - after = [ "nextcloud-setup.service" ]; - serviceConfig = { - Type = "oneshot"; - ExecStart = "/run/current-system/sw/bin/reboot"; - }; - }; - - ### CONFIGURE FAIL2BAN ### - # https://docs.nextcloud.com/server/latest/admin_manual/installation/harden_server.html#fail2ban-introduction - environment.etc = { - "fail2ban/filter.d/nextcloud.conf".text = '' - [Definition] - _groupsre = (?:(?:,?\s*"\w+":(?:"[^"]+"|\w+))*) - failregex = ^\{%(_groupsre)s,?\s*"remoteAddr":""%(_groupsre)s,?\s*"message":"Login failed: - ^\{%(_groupsre)s,?\s*"remoteAddr":""%(_groupsre)s,?\s*"message":"Two-factor challenge failed: - ^\{%(_groupsre)s,?\s*"remoteAddr":""%(_groupsre)s,?\s*"message":"Trusted domain error. - datepattern = ,?\s*"time"\s*:\s*"%%Y-%%m-%%d[T ]%%H:%%M:%%S(%%z)?" - ''; - }; - services.fail2ban.jails = { - nextcloud.settings = { - backend = "auto"; - enabled = true; - port = "80,443"; - protocol = "tcp"; - filter = "nextcloud"; - logpath = "${mainDriveMountPoint}/data/nextcloud.log"; - }; - nginx-bad-request.settings.enabled = true; - nginx-botsearch.settings.enabled = true; - }; -} diff --git a/modules/system/server/pihole.nix b/modules/system/server/pihole.nix deleted file mode 100644 index 650eef3..0000000 --- a/modules/system/server/pihole.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ - lib, - pkgs, - systemSettings, - ... -}: - -{ - services.pihole-ftl = { - enable = true; - openFirewallDNS = true; - openFirewallDHCP = true; - openFirewallWebserver = true; - lists = [ - { - url = "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"; - } - { - url = "https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/pro.txt"; - } - ]; - settings = { - dns = { - upstreams = [ - # DNS.WATCH - "84.200.69.80" - "84.200.70.40" - "2001:1608:10:25:0:0:1c04:b12f" - "2001:1608:10:25:0:0:9249:d69b" - # Cloudflare (with Malware Blocking and DNSSEC Validation) - "9.9.9.9" - "149.112.112.112" - "2620:fe::fe" - "2620:fe::9" - ]; - # Array of custom DNS records each one in HOSTS form: "IP HOSTNAME" - hosts = lib.mkIf (systemSettings ? pihole.hosts) systemSettings.pihole.hosts; - }; - webserver = { - paths = { - webroot = lib.mkForce "${pkgs.runCommand "pihole-web-under-admin" { } '' - mkdir -p $out - ln -sf ${pkgs.pihole-web}/share $out/admin - ''}"; - webhome = lib.mkForce "/admin/"; - }; - }; - }; - }; - - services.pihole-web = { - enable = true; - ports = [ - "8080r" - "8443s" - ]; - }; -} diff --git a/modules/system/server/wireguard.nix b/modules/system/server/wireguard.nix deleted file mode 100644 index ba3ecd3..0000000 --- a/modules/system/server/wireguard.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ - pkgs, - config, - systemSettings, - ... -}: - -{ - sops.secrets = { - "wireguard/server/private_key" = { - }; - }; - - networking.nat.enable = true; - networking.nat.externalInterface = systemSettings.wireguard.externalInterface; - networking.nat.internalInterfaces = [ "wg0" ]; - networking.firewall = { - allowedUDPPorts = [ 51820 ]; - }; - - networking.wireguard.interfaces = { - wg0 = { - ips = [ "10.100.0.1/24" ]; - listenPort = 51820; - privateKeyFile = config.sops.secrets."wireguard/server/private_key".path; - - # For this to work you have to set the dnsserver IP of your router (or dnsserver of choice) in your clients - postSetup = '' - ${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o ${systemSettings.wireguard.externalInterface} -j MASQUERADE - ${pkgs.iptables}/bin/iptables -A FORWARD -i wg0 -o ${systemSettings.wireguard.externalInterface} -j ACCEPT - ${pkgs.iptables}/bin/iptables -A FORWARD -i wg0 -o wg0 -j ACCEPT - ''; - - postShutdown = '' - ${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -o ${systemSettings.wireguard.externalInterface} -j MASQUERADE - ${pkgs.iptables}/bin/iptables -D FORWARD -i wg0 -o ${systemSettings.wireguard.externalInterface} -j ACCEPT - ${pkgs.iptables}/bin/iptables -D FORWARD -i wg0 -o wg0 -j ACCEPT - ''; - - peers = systemSettings.wireguard.clientPeers; - }; - }; -} diff --git a/modules/system/wm/gnome-keyring.nix b/modules/system/wm/gnome-keyring.nix deleted file mode 100644 index 6e5b67c..0000000 --- a/modules/system/wm/gnome-keyring.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ pkgs, ... }: - -{ - services.gnome.gnome-keyring.enable = true; - programs.seahorse.enable = true; - programs.ssh.askPassword = pkgs.lib.mkForce "${pkgs.seahorse.out}/libexec/seahorse/ssh-askpass"; -} diff --git a/modules/system/wm/hyprland.nix b/modules/system/wm/hyprland.nix deleted file mode 100644 index aced256..0000000 --- a/modules/system/wm/hyprland.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ pkgs, inputs, ... }: - -{ - imports = [ - ./gnome-keyring.nix - ]; - - nix.settings = { - substituters = [ "https://hyprland.cachix.org" ]; - trusted-substituters = [ "https://hyprland.cachix.org" ]; - trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ]; - }; - - programs.hyprland = { - enable = true; - # package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; - # portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland; - }; - - xdg.portal = { - extraPortals = [ - (pkgs.xdg-desktop-portal-wlr.overrideAttrs (previousAttrs: { - src = pkgs.fetchFromGitHub { - owner = "leon-erd"; - repo = "xdg-desktop-portal-wlr"; - rev = "424287fa0b2c59096e38534efdbd9a6bec13aead"; - sha256 = "sha256-4igGdq8CpWbTmDVVKZwIs76eOTESDrGO5qa0m/BhYP4="; - }; - buildInputs = previousAttrs.buildInputs ++ [ pkgs.libxkbcommon ]; - })) - ]; - }; - - # Optional, hint electron apps to use wayland: - environment.sessionVariables = { - NIXOS_OZONE_WL = "1"; - }; - - # udev rules for swayosd - services.udev.packages = [ pkgs.swayosd ]; -} diff --git a/modules/system/wm/kde.nix b/modules/system/wm/kde.nix deleted file mode 100644 index f542512..0000000 --- a/modules/system/wm/kde.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ ... }: - -{ - imports = [ - ./xserver.nix - ]; - - services.desktopManager.plasma6.enable = true; - # the plasma6 module sets itself as the default session which I don't want - services.displayManager.defaultSession = null; -} diff --git a/modules/system/wm/sddm.nix b/modules/system/wm/sddm.nix deleted file mode 100644 index 604363c..0000000 --- a/modules/system/wm/sddm.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ pkgs, ... }: - -{ - imports = [ - ./xserver.nix - ]; - - environment.systemPackages = with pkgs; [ - ( - (sddm-astronaut.override { - embeddedTheme = "pixel_sakura"; - themeConfig = { - Background = "Backgrounds/my_background.mp4"; - HideVirtualKeyboard = false; - HideSystemButtons = false; - }; - }).overrideAttrs - (prevAttrs: { - installPhase = prevAttrs.installPhase + '' - chmod u+w $out/share/sddm/themes/sddm-astronaut-theme/Backgrounds/ - cp ${../../../scripts/wallpaper/animated/mountains-in-clouds.mp4} $out/share/sddm/themes/sddm-astronaut-theme/Backgrounds/my_background.mp4 - ''; - }) - ) - ]; - - services.displayManager.sddm = { - enable = true; - # package = pkgs.kdePackages.sddm; - extraPackages = with pkgs; [ - kdePackages.qtmultimedia - ]; - # to find theme name check out /etc/sddm.conf for "ThemeDir" - # and then "ls " - # probably "ls /run/current-system/sw/share/sddm/themes" - theme = "sddm-astronaut-theme"; - wayland = { - enable = true; # This is still experimental - compositor = "kwin"; - }; - }; -} diff --git a/modules/system/wm/xserver.nix b/modules/system/wm/xserver.nix deleted file mode 100644 index 933813e..0000000 --- a/modules/system/wm/xserver.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ systemSettings, ... }: - -{ - # Enable the X11 windowing system and configure keymap in X11 - services.xserver = { - enable = true; - xkb.layout = systemSettings.kblayout; - }; -} diff --git a/overlays/default.nix b/overlays/default.nix deleted file mode 100644 index 25bc2f6..0000000 --- a/overlays/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -final: prev: { - autoraise = prev.autoraise.overrideAttrs rec { - version = "5.6"; - - src = prev.fetchFromGitHub { - owner = "sbmpost"; - repo = "AutoRaise"; - rev = "v${version}"; - hash = "sha256-DQyXHZPM/5rt6Vhmyhb/ienvk0ZXzg6zbVAmUYeaOVA="; - }; - - # build with EXPERIMENTAL_FOCUS_FIRST to focusing the hovered window before actually raising it - buildPhase = '' - runHook preBuild - $CXX -std=c++03 -fobjc-arc -D"NS_FORMAT_ARGUMENT(A)=" -D"SKYLIGHT_AVAILABLE=1" -DEXPERIMENTAL_FOCUS_FIRST -o AutoRaise AutoRaise.mm -framework AppKit -framework SkyLight - bash create-app-bundle.sh - runHook postBuild - ''; - }; - - nix-output-monitor = prev.nix-output-monitor.overrideAttrs { - version = "2.1.8-unstable-2025-11-09"; - src = prev.fetchFromGitHub { - owner = "maralorn"; - repo = "nix-output-monitor"; - rev = "698e6f3afdc9d68dd65d84df7b030499dbfaf84b"; - hash = "sha256-QwEVaUxvXEdx5icIZZYQQjvJO5j0+GeWtJvCJ/LZwpA="; - }; - }; -} diff --git a/scripts/wallpaper/selected_image.txt b/scripts/wallpaper/selected_image.txt deleted file mode 100644 index 386fbcd..0000000 --- a/scripts/wallpaper/selected_image.txt +++ /dev/null @@ -1 +0,0 @@ -/home/leon/scripts/wallpaper/wallpaper.jpg