diff --git a/flake.lock b/flake.lock index e7ea30e..e6e382d 100755 --- a/flake.lock +++ b/flake.lock @@ -46,6 +46,24 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1778716662, + "narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -67,6 +85,21 @@ "type": "github" } }, + "import-tree": { + "locked": { + "lastModified": 1778781969, + "narHash": "sha256-Jjuz5CmSkur8KvLDoGa+vylEp+RkQtv4mt/qcMznpH0=", + "owner": "vic", + "repo": "import-tree", + "rev": "d321337efd0f23a9eb14a42adb7b2c29313ab274", + "type": "github" + }, + "original": { + "owner": "vic", + "repo": "import-tree", + "type": "github" + } + }, "microPlugins-vivify": { "flake": false, "locked": { @@ -117,6 +150,21 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1777168982, + "narHash": "sha256-GOkGPcboWE9BmGCRMLX3worL4EMnsnG8MyKmXNeYuhQ=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "f5901329dade4a6ea039af1433fb087bd9c1fe14", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "nixpkgs-unstable": { "locked": { "lastModified": 1779414690, @@ -173,7 +221,9 @@ "root": { "inputs": { "caelestia-shell": "caelestia-shell", + "flake-parts": "flake-parts", "home-manager": "home-manager", + "import-tree": "import-tree", "microPlugins-vivify": "microPlugins-vivify", "nixos-grub-themes": "nixos-grub-themes", "nixpkgs": "nixpkgs_2", diff --git a/flake.nix b/flake.nix index 0ba02c0..76307f2 100644 --- a/flake.nix +++ b/flake.nix @@ -18,14 +18,13 @@ url = "git+https://codeberg.org/gibbert/micro-vivify"; flake = false; }; + flake-parts = { + url = "github:hercules-ci/flake-parts"; + }; + import-tree.url = "github:vic/import-tree"; # imports ./modules recursively }; - outputs = { - nixpkgs, - nixpkgs-unstable, - ... - } @ inputs: let - system = "x86_64-linux"; - + outputs = inputs @ { flake-parts, ... }: + /*@ inputs: let unfreePkgs = [ "hplip" "vivify.vim" @@ -40,27 +39,7 @@ config.allowUnfreePredicate = mkUnfreePredicate; }; - in { - nixosConfigurations = { - laptop = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs pkgs-unstable;}; - modules = [ - ./hosts/laptop/configuration.nix - # solves evaluation warning - /* - You have set specialArgs.pkgs, which means that options like nixpkgs.config - and nixpkgs.overlays will be ignored. If you wish to reuse an already created - pkgs, which you know is configured correctly for this NixOS configuration, - please import the `nixosModules.readOnlyPkgs` module from the nixpkgs flake or - `(modulesPath + "/misc/nixpkgs/read-only.nix"), and set `{ nixpkgs.pkgs = ; }`. - This properly disables the ignored options to prevent future surprises. - */ - { - nixpkgs.config.allowUnfreePredicate = mkUnfreePredicate; - } - ]; - }; - }; - # we use home-manager directly inside of configuration.nix - }; -} + in */ + flake-parts.lib.mkFlake { inherit inputs; } + (inputs.import-tree ./modules); + } diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix deleted file mode 100755 index 8280067..0000000 --- a/hosts/laptop/configuration.nix +++ /dev/null @@ -1,55 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). -{ - # nixd says that those attributes are not used. The are used in the imported file. Do not remove. - inputs, - ... -}: { - imports = [ - # Include the results of the hardware scan. - ./hardware-configuration.nix - inputs.home-manager.nixosModules.default - ../../hostsModules/laptop/nixos/battery.nix - #../../modules/nixos/ly.nix - ../../modules/nixos/ly.nix - ../../modules/nixos/anki.nix - ../../modules/nixos/nixUtils.nix - ../../hostsModules/laptop/nixos/nixUtils.nix - ../../hostsModules/laptop/nixos/udev.nix - ../../modules/nixos/disk.nix - ../../hostsModules/laptop/nixos/disk.nix - ../../modules/nixos/printer.nix - ../../hostsModules/laptop/nixos/ollama.nix # llm config - ../../modules/nixos/mullvad.nix # vpn config - ../../hostsModules/laptop/nixos/autoUpdate.nix # auto update the flakes. Handles notification via libnotify and matrix-commander-rs - ../../hostsModules/laptop/nixos/autoCleanup.nix # uses alexandra deadnix and statix to clean the whole config - ../../hostsModules/laptop/nixos/bootloader.nix - ../../hostsModules/laptop/nixos/networking.nix # firewall, ssh, networkmanager, etc. - ../../modules/nixos/bluetooth.nix - ../../modules/nixos/audioAndMedia.nix - ../../modules/nixos/windowManager.nix - ../../modules/nixos/documentation.nix - ../../modules/nixos/IO.nix - ../../modules/nixos/fonts.nix - ../../modules/nixos/latex.nix - ../../modules/nixos/development.nix - ../../modules/nixos/user.nix - ../../hostsModules/laptop/nixos/user.nix - ../../modules/nixos/notifications.nix - ../../modules/nixos/browser.nix - ../../modules/nixos/theme.nix # install theming packages and some quickshell stuff - ../../hostsModules/laptop/nixos/hardwareUtils.nix - ../../modules/nixos/otherUtils.nix - ../../modules/nixos/office.nix - ../../modules/nixos/games.nix - ]; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "25.11"; # Did you read the comment? -} diff --git a/hosts/laptop/hardware-configuration.nix b/hosts/laptop/hardware-configuration.nix deleted file mode 100755 index b5be1ea..0000000 --- a/hosts/laptop/hardware-configuration.nix +++ /dev/null @@ -1,34 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ - config, - lib, - modulesPath, - ... -}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "usbhid" "sd_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-amd"]; - boot.extraModulePackages = []; - - fileSystems."/" = { - device = "/dev/disk/by-uuid/6aa664c2-8b23-4e20-b6e9-1806bf0f8df2"; - fsType = "ext4"; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/A59A-7AFA"; - fsType = "vfat"; - options = ["fmask=0077" "dmask=0077"]; - }; - - swapDevices = []; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/hosts/laptop/home.nix b/hosts/laptop/home.nix deleted file mode 100755 index 580a71c..0000000 --- a/hosts/laptop/home.nix +++ /dev/null @@ -1,58 +0,0 @@ -{inputs, ...}: { - # every import imports a specific module for an app. This module contains the enabling of this app and its settings. - # So if you want to add an home-manager app create a module which enables it and configures it and import it. - imports = [ - # app modules - ../../modules/home-manager/kitty.nix # terminal # use absolute path with --impure flag or go back to /etc/nixos and use relative - ../../modules/home-manager/zoxide.nix # better cd - ../../modules/home-manager/zsh.nix # better bash - ../../hostsModules/laptop/home-manager/zsh.nix # some things are hosts dependant. - ../../modules/home-manager/gtk.nix # some config for gtk themed apps - ../../modules/home-manager/git.nix - ../../modules/home-manager/ssh.nix - ../../modules/home-manager/fastfetch.nix - ../../modules/home-manager/hyprland.nix - ../../hostsModules/laptop/home-manager/hyprland.nix - #../../modules/home-manager/wlogout.nix # logout utility - ../../modules/home-manager/rofi.nix # used for keybinds and for clipboard - #notifications are now manager with quickshell../../modules/home-manager/swaync.nix # notification daemon - ../../modules/home-manager/neovim.nix # dont use nixvim. broken - #../../modules/home-manager/neovim2.nix # ./neovim2.nix uses vim plug instead of the nix repository as with ./neovim.nix see the begining of neovim2 for an explanation - ../../modules/home-manager/rclone.nix - #../../modules/home-manager/waybar.nix - #../../modules/home-manager/quickshell.nix # used for widgets, waybar and notifications # i migrated to caelestia-shell - inputs.caelestia-shell.homeManagerModules.default - ../../modules/home-manager/caelestia.nix # caelestia shell is based on quickshell - #../../modules/home-manager/oh-my-posh.nix # zsh customizer - ../../modules/home-manager/oh-my-zsh.nix # another zsh customizer - #../../modules/home-manager/hypridle.nix - #../../modules/home-manager/swaylock.nix - ../../modules/home-manager/anki.nix # we use only for some settings. see ../../modules/nixos/anki.nix for activating - ../../modules/home-manager/librewolf.nix # privacy browser - ../../modules/home-manager/cursor.nix # cursor (the icon not the app) - ../../modules/home-manager/ripgrep.nix # better grep - #../../modules/home-manager/obsidian.nix obsidian was replaced with a custom solution - ../../modules/home-manager/thunderbird.nix # email client - ../../modules/home-manager/eza.nix # ls replacement - ../../modules/home-manager/vivify.nix # neovim markdown viewer (has also config for qutebrowser - #../../modules/home-manager/micro.nix # micro text editor. Not main editor (used for testing for notewrapper) - ../../modules/home-manager/sbb-tui.nix # cff TUI app - ../../modules/home-manager/mullvad.nix # mullvad vpn - - ../../modules/home-manager/other/desktopEntries.nix # creates .desktop files - ../../modules/home-manager/other/user.nix - ]; - - # Required for Home Manager - home.stateVersion = "25.11"; # match your Home Manager release - # This value determines the Home Manager release that your configuration is - # compatible with. This helps avoid breakage when a new Home Manager release - # introduces backwards incompatible changes. - # - # You should not change this value, even if you update Home Manager. If you do - # want to update the value, then make sure to first check the Home Manager - # release notes. - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; -} diff --git a/hostsModules/README.md b/hostsModules/README.md deleted file mode 100644 index 1fd26b2..0000000 --- a/hostsModules/README.md +++ /dev/null @@ -1 +0,0 @@ -For modules that are hosts specific. diff --git a/hostsModules/laptop/home-manager/hyprland.nix b/hostsModules/laptop/home-manager/hyprland.nix deleted file mode 100644 index bac5d9b..0000000 --- a/hostsModules/laptop/home-manager/hyprland.nix +++ /dev/null @@ -1,10 +0,0 @@ -_: { - wayland.windowManager.hyprland.settings = { - exec-once = [ - "qtbatticon" # custom battery tray - ]; - monitor = [ - "eDP-1, highres@highrr, 0x0, 1" - ]; - }; -} diff --git a/hostsModules/laptop/home-manager/zsh.nix b/hostsModules/laptop/home-manager/zsh.nix deleted file mode 100644 index a21f803..0000000 --- a/hostsModules/laptop/home-manager/zsh.nix +++ /dev/null @@ -1,8 +0,0 @@ -_: { - programs.zsh = { - shellAliases = { - snrt = "git -C ~/nixos add -A && time sudo nixos-rebuild test --flake ~/nixos/#laptop && pkill shell || true && pkill caelestia-shell || true && caelestia-shell -n > /dev/null 2>&1 & disown"; - snrs = "git -C ~/nixos add -A && time sudo nixos-rebuild switch --flake ~/nixos/#laptop && pkill shell || true && pkill caelestia-shell || true && caelestia-shell -n > /dev/null 2>&1 & disown"; - }; - }; -} diff --git a/hostsModules/laptop/nixos/autoCleanup.nix b/hostsModules/laptop/nixos/autoCleanup.nix deleted file mode 100644 index 8d0de9e..0000000 --- a/hostsModules/laptop/nixos/autoCleanup.nix +++ /dev/null @@ -1,45 +0,0 @@ -{pkgs, ...}: { - # Ensure your script is available system-wide - environment.systemPackages = [ - (pkgs.callPackage ../scripts/cleanNix.nix {}) - ]; - users.users.tomasr = { - linger = true; # lingering is required - }; - - systemd.user.services.custom-cleanNix = { - description = "NixOS configuration auto cleanup"; - - serviceConfig = { - Type = "oneshot"; - - ExecStart = "/run/current-system/sw/bin/custom-cleanNix"; - - # safety for long rebuilds - TimeoutStartSec = "45min"; - TimeoutStopSec = "10min"; - - # avoid overlap - RemainAfterExit = true; - - # tweaks that should make the system run normally during the rebuilds - Nice = 10; - IOSchedulingClass = "best-effort"; - IOSchedulingPriority = 7; - }; - }; - - # Systemd USER timer - systemd.user.timers.custom-cleanNix = { - wantedBy = ["timers.target"]; - - timerConfig = { - OnCalendar = "Sat *-*-* 20:00:00"; # runs saturday night. If for whatever reason something breaks. I have whole sunday to fix it. - - Persistent = true; # if it happens during shutted down - - # avoids thundering herd on boot - RandomizedDelaySec = "2h"; - }; - }; -} diff --git a/hostsModules/laptop/nixos/autoUpdate.nix b/hostsModules/laptop/nixos/autoUpdate.nix deleted file mode 100644 index 4919da4..0000000 --- a/hostsModules/laptop/nixos/autoUpdate.nix +++ /dev/null @@ -1,45 +0,0 @@ -{pkgs, ...}: { - # Ensure your script is available system-wide - environment.systemPackages = [ - (pkgs.callPackage ../scripts/autoUpdate.nix {}) - ]; - users.users.tomasr = { - linger = true; # lingering is required - }; - - systemd.user.services.custom-autoupdate = { - description = "NixOS flake auto update"; - - serviceConfig = { - Type = "oneshot"; - - ExecStart = "/run/current-system/sw/bin/custom-autoupdate"; - - # safety for long rebuilds - TimeoutStartSec = "45min"; - TimeoutStopSec = "10min"; - - # avoid overlap - RemainAfterExit = true; - - # tweaks that should make the system run normally during the rebuilds - Nice = 10; - IOSchedulingClass = "best-effort"; - IOSchedulingPriority = 7; - }; - }; - - # Systemd USER timer - systemd.user.timers.custom-autoupdate = { - wantedBy = ["timers.target"]; - - timerConfig = { - OnCalendar = "Fri *-*-* 20:00:00"; # runs friday night. If for whatever reason something breaks. I have whole week-end to fix it. - - Persistent = true; # if it happens during shutted down - - # avoids thundering herd on boot - RandomizedDelaySec = "2h"; - }; - }; -} diff --git a/hostsModules/laptop/nixos/battery.nix b/hostsModules/laptop/nixos/battery.nix deleted file mode 100644 index d334045..0000000 --- a/hostsModules/laptop/nixos/battery.nix +++ /dev/null @@ -1,54 +0,0 @@ -# https://discourse.nixos.org/t/what-is-the-best-option-for-power-management/63406/2 -{ - lib, - config, - ... -}: -# we just activate tlp unconditonally -#let -# cfg = config.custom; -#hasBattery = -# lib.any (x: lib.strings.hasPrefix "BAT" x) -# (builtins.attrNames (builtins.readDir "/sys/class/power_supply")); -#in -{ - # options.custom = { - # battery.enable = lib.mkOption { - # default = hasBattery; - # description = "Enable better battery support"; - # type = lib.types.bool; - # }; - # }; - - # config = lib.mkIf cfg.battery.enable { - powerManagement.powertop.enable = true; # enable powertop auto tuning on startup. - # Acording to https://community.frame.work/t/solved-keys-stick-and-repeat-after-being-released/51153/12 - # Some powertop bug is responsable for the problem of the random keypress being stuck - # fix: from https://git.gabbie.blue/blue/nixconf/src/commit/2d1bc6dad4684c019b6b3e894408e76e2734806c/hosts/gabbielaptop/configuration.nix#L68 - powerManagement.powertop.postStart = '' - ${lib.getExe' config.systemd.package "udevadm"} trigger -c bind -s usb -a idVendor=32ac -a idProduct=0018 - # Retrigger macropad udev rules - ${lib.getExe' config.systemd.package "udevadm"} trigger -c bind -s usb -a idVendor=32ac -a idProduct=0013 - ''; - services.system76-scheduler.settings.cfsProfiles.enable = true; # Better scheduling for CPU cycles - thanks System76!!! - services.thermald.enable = true; # Enable thermald, the temperature management daemon. (only necessary if on Intel CPUs) - services.power-profiles-daemon.enable = false; # Disable GNOMEs power management - services.tlp = { - enable = true; # Enable TLP (better than gnomes internal power manager) - settings = { - CPU_BOOST_ON_AC = 1; - CPU_BOOST_ON_BAT = 1; - CPU_HWP_DYN_BOOST_ON_AC = 1; - CPU_HWP_DYN_BOOST_ON_BAT = 1; - CPU_SCALING_GOVERNOR_ON_AC = "performance"; - CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; - CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; - CPU_ENERGY_PERF_POLICY_ON_BAT = "balance_power"; - PLATFORM_PROFILE_ON_AC = "performance"; - PLATFORM_PROFILE_ON_BAT = "balanced"; - START_CHARGE_THRESH_BAT1 = 75; - STOP_CHARGE_THRESH_BAT1 = 85; - }; - }; - # }; -} diff --git a/hostsModules/laptop/nixos/bootloader.nix b/hostsModules/laptop/nixos/bootloader.nix deleted file mode 100644 index c36b37f..0000000 --- a/hostsModules/laptop/nixos/bootloader.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - inputs, - pkgs, - ... -}: { - # grub theme - boot.loader.grub = { - theme = inputs.nixos-grub-themes.packages.${pkgs.system}.nixos; # if you want to use nixos grub theme - }; - - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; -} diff --git a/hostsModules/laptop/nixos/disk.nix b/hostsModules/laptop/nixos/disk.nix deleted file mode 100644 index 1781598..0000000 --- a/hostsModules/laptop/nixos/disk.nix +++ /dev/null @@ -1,10 +0,0 @@ -_: { - # i found swap necessary when running nixpkgs review - swapDevices = [ - { - device = "/swapfile"; - size = 16384; # 16 GB - } - ]; - boot.kernel.sysctl."vm.swappiness" = 10; -} diff --git a/hostsModules/laptop/nixos/hardwareUtils.nix b/hostsModules/laptop/nixos/hardwareUtils.nix deleted file mode 100644 index 6edd5a9..0000000 --- a/hostsModules/laptop/nixos/hardwareUtils.nix +++ /dev/null @@ -1,8 +0,0 @@ -{pkgs, ...}: { - environment.systemPackages = with pkgs; [ - # used for the framework 16 laptop - framework-tool - framework-tool-tui - vial # Open-source GUI and QMK fork for configuring your keyboard in real time - ]; -} diff --git a/hostsModules/laptop/nixos/networking.nix b/hostsModules/laptop/nixos/networking.nix deleted file mode 100644 index 3fff075..0000000 --- a/hostsModules/laptop/nixos/networking.nix +++ /dev/null @@ -1,25 +0,0 @@ -{pkgs, ...}: { - environment.systemPackages = with pkgs; [ - wget - networkmanagerapplet # NetworkManager control applet - inetutils # collections of network programs such as telnet - ]; - #networking.Name = "nixos"; # Define your hostname. - #networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # Configure network proxy if necessary - #networking.proxy.default = "http://user:password@proxy:port/"; - #networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Enable networking - networking.networkmanager.enable = true; - - # Enable the OpenSSH daemon. - # services.openssh.enable = true; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - networking.firewall.enable = false; -} diff --git a/hostsModules/laptop/nixos/nixUtils.nix b/hostsModules/laptop/nixos/nixUtils.nix deleted file mode 100644 index df13ddd..0000000 --- a/hostsModules/laptop/nixos/nixUtils.nix +++ /dev/null @@ -1,5 +0,0 @@ -_: { - # nixpkgs-review crashed my laptop multiple times. - nix.settings.max-jobs = 2; - nix.settings.cores = 2; -} diff --git a/hostsModules/laptop/nixos/ollama.nix b/hostsModules/laptop/nixos/ollama.nix deleted file mode 100644 index b879210..0000000 --- a/hostsModules/laptop/nixos/ollama.nix +++ /dev/null @@ -1,25 +0,0 @@ -{pkgs-unstable, ...}: { - services.ollama = { - enable = true; - package = pkgs-unstable.ollama-vulkan; - #port = 11434; - #host = "127.0.0.1:11434"; - # loadModels load them directly into ram at startup. Doesn't download them. - #loadModels = [ "mistral:7b" ]; # don't forget the :xxxxx for ex: "mixtral" don't work - #syncModels = true; - }; - systemd.services.ollama.serviceConfig.ExecStartPost = [ - # use this to auto download models - "${pkgs-unstable.ollama-vulkan}/bin/ollama pull mistral:7b" - ]; - /* - services.open-webui = { - enable = true; - port = 8080; - environment = { - OLLAMA_BASE_URL = "http://127.0.0.1:11434"; - WEBUI_AUTH = "True"; - }; - }; - */ -} diff --git a/hostsModules/laptop/nixos/udev.nix b/hostsModules/laptop/nixos/udev.nix deleted file mode 100644 index e5600b2..0000000 --- a/hostsModules/laptop/nixos/udev.nix +++ /dev/null @@ -1,20 +0,0 @@ -_: { - # udev with only the necessary rules. See udev.nix to get all the rules - services.udev.extraRules = '' - # adapted from here https://wiki.nixos.org/wiki/Keychron_M6 - KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="32ac", MODE="0660", GROUP="users", TAG+="uaccess" - - - # taken from here - SUBSYSTEMS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0013", TAG+="uaccess" - SUBSYSTEMS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0018", TAG+="uaccess" - - # acording to https://community.frame.work/t/solved-keys-stick-and-repeat-after-being-released/51153/12 - # the random keypress stuck comes from conflict between powertop and udev - # fix from: https://git.gabbie.blue/blue/nixconf/src/commit/2d1bc6dad4684c019b6b3e894408e76e2734806c/hosts/gabbielaptop/configuration.nix#L68 - # disable USB auto suspend for framework keyboard - ACTION=="bind", SUBSYSTEM=="usb", ATTR{idVendor}=="32ac", ATTR{idProduct}=="0018", TEST=="power/control", ATTR{power/control}="on" - # disable USB auto suspend for framework macropad - ACTION=="bind", SUBSYSTEM=="usb", ATTR{idVendor}=="32ac", ATTR{idProduct}=="0013", TEST=="power/control", ATTR{power/control}="on" - ''; -} diff --git a/hostsModules/laptop/nixos/user.nix b/hostsModules/laptop/nixos/user.nix deleted file mode 100644 index f28310a..0000000 --- a/hostsModules/laptop/nixos/user.nix +++ /dev/null @@ -1,4 +0,0 @@ -# configuration is in ../../../modules/nixos/user.nix -_: { - home-manager.users.tomasr = ../../../hosts/laptop/home.nix; -} diff --git a/hostsModules/laptop/qt/qtbatticon.nix b/hostsModules/laptop/qt/qtbatticon.nix deleted file mode 100644 index a91eb2a..0000000 --- a/hostsModules/laptop/qt/qtbatticon.nix +++ /dev/null @@ -1,175 +0,0 @@ -# because cbatticon, batticonplus and other things didn't work. -# chatGpt did this. -# https://chatgpt.com/c/69da11b3-ba24-8331-b7b0-a58a72e69d42 -# at your risk and perils -# click on the icon to get a notification with state, percentage and wattage -{ - stdenv, - qt6, - pkg-config, - pkgs, -}: -stdenv.mkDerivation { - pname = "qtbatticon"; - version = "1.0"; - - src = pkgs.writeTextFile { - name = "qtbatticon.cpp"; - text = '' - #include - #include - #include - #include - #include - #include - #include - #include - #include - - QString readFile(const QString &path) { - QFile f(path); - if (!f.open(QIODevice::ReadOnly)) return ""; - QTextStream in(&f); - return in.readAll().trimmed(); - } - - int readInt(const QString &path) { - return readFile(path).toInt(); - } - - double readDouble(const QString &path) { - QFile f(path); - if (!f.open(QIODevice::ReadOnly)) return 0; - QTextStream in(&f); - return in.readAll().trimmed().toDouble(); - } - - int toStep(int capacity) { - return (capacity / 10) * 10; - } - - QString pad3(int n) { - return QString("%1").arg(n, 3, 10, QChar('0')); - } - - double getPowerW(const QString &batPath) { - double current_uA = readDouble(batPath + "/current_now"); - double voltage_uV = readDouble(batPath + "/voltage_now"); - - if (current_uA > 0 && voltage_uV > 0) { - return (current_uA * voltage_uV) / 1e12; - } - return -1; - } - - QIcon batteryIcon(int capacity, bool charging) { - int step = toStep(capacity); - QString num = pad3(step); - - QString base = "/run/current-system/sw/share/icons/Papirus/24x24/panel/"; - - QString file; - if (charging) { - file = base + "battery-" + num + "-charging.svg"; - } else { - file = base + "battery-" + num + ".svg"; - } - - QIcon icon(file); - - if (icon.isNull()) { - qDebug() << "FAILED icon:" << file; - icon = QIcon(base + "battery-100.svg"); - } - - return icon; - } - - void sendNotification(const QString &title, const QString &body) { - QString cmd = "notify-send \"" + title + "\" \"" + body + "\""; - system(cmd.toUtf8().constData()); - } - - int main(int argc, char *argv[]) { - QApplication app(argc, argv); - - QString batPath = "/sys/class/power_supply/BAT1"; - QSystemTrayIcon tray; - - auto updateIcon = [&]() { - int capacity = readInt(batPath + "/capacity"); - QString status = readFile(batPath + "/status"); - bool charging = status.contains("Charging"); - - tray.setIcon(batteryIcon(capacity, charging)); - }; - - auto notify = [&]() { - int capacity = readInt(batPath + "/capacity"); - QString status = readFile(batPath + "/status"); - - bool charging = status.contains("Charging"); - bool discharging = status.contains("Discharging"); - - double power = getPowerW(batPath); - - QString state; - if (charging) state = "Charging"; - else if (discharging) state = "Discharging"; - else state = status; - - QString powerStr = (power > 0.01) - ? QString::number(power, 'f', 2) + " W" - : "N/A"; - - QString msg = - QString("%1\n%2%\n%3") - .arg(state) - .arg(capacity) - .arg(powerStr); - - sendNotification("Battery status", msg); - }; - - QObject::connect(&tray, &QSystemTrayIcon::activated, - [&](QSystemTrayIcon::ActivationReason r) { - if (r == QSystemTrayIcon::Trigger) { - notify(); - } - }); - - updateIcon(); - tray.setVisible(true); - - QTimer timer; - QObject::connect(&timer, &QTimer::timeout, updateIcon); - timer.start(5000); - - return app.exec(); - } - ''; - }; - - nativeBuildInputs = [ - pkg-config - qt6.wrapQtAppsHook - ]; - - buildInputs = [ - qt6.qtbase - qt6.qtsvg - pkgs.papirus-icon-theme - ]; - - dontUnpack = true; - - buildPhase = '' - g++ $src -o qtbatticon \ - $(pkg-config --cflags --libs Qt6Widgets) - ''; - - installPhase = '' - mkdir -p $out/bin - install -m755 qtbatticon $out/bin/ - ''; -} diff --git a/hostsModules/laptop/scripts/autoUpdate.nix b/hostsModules/laptop/scripts/autoUpdate.nix deleted file mode 100644 index 887f5e1..0000000 --- a/hostsModules/laptop/scripts/autoUpdate.nix +++ /dev/null @@ -1,62 +0,0 @@ -{pkgs, ...}: -pkgs.writeShellApplication { - name = "custom-autoupdate"; - - runtimeInputs = with pkgs; [ - git - nixos-rebuild - matrix-commander-rs - libnotify - ]; - - text = '' - set -e - - FLAKE_DIR="/home/tomasr/nixos" - FLAKE="$FLAKE_DIR#laptop" - TIME=$(date -u +"%Y-%m-%dT%H-%M-%SZ") - - ERROR_FILE=$(mktemp) - - # snapshot current state - git -C "$FLAKE_DIR" add -A - git -C "$FLAKE_DIR" commit --allow-empty -m "snapshot pre-autoupdate-$TIME" - git -C "$FLAKE_DIR" tag "pre-autoupdate-$TIME" HEAD - - # update lock only - nix flake update --flake "$FLAKE_DIR" - - if sudo /run/current-system/sw/bin/nixos-rebuild switch --flake "$FLAKE" 2> "$ERROR_FILE"; then # use /run/.../bin/ uses the sudoless rule - - if ! git -C "$FLAKE_DIR" diff --quiet -- flake.lock; then - git -C "$FLAKE_DIR" add flake.lock - git -C "$FLAKE_DIR" commit -m "flake.lock: autoupdate-$TIME" - git -C "$FLAKE_DIR" push - - notify-send "Flake autoupdate" "Rebuild OK" - - matrix-commander-rs --verbose -m "Flake rebuild succesfull.
@notificationbot_0000" \ - --html \ - -r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU" - else - notify-send "Flake autoupdate" "No changes" - git -C "$FLAKE_DIR" push - fi - - else - ERROR_MSG=$(cat "$ERROR_FILE") - - notify-send -u critical "Flake autoupdate" "FAILED" - - matrix-commander-rs --verbose -m "Flake rebuild failed.
Error:
$ERROR_MSG

@notificationbot_0000" \ - --html \ - -r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU" - - git -C "$FLAKE_DIR" reset --hard "pre-autoupdate-$TIME" - fi - - git -C "$FLAKE_DIR" tag -d "pre-autoupdate-$TIME" # removes the tag - - rm -f "$ERROR_FILE" - ''; -} diff --git a/hostsModules/laptop/scripts/batterynotify.nix b/hostsModules/laptop/scripts/batterynotify.nix deleted file mode 100644 index 4fc53b8..0000000 --- a/hostsModules/laptop/scripts/batterynotify.nix +++ /dev/null @@ -1,73 +0,0 @@ -# taken and adapted https://github.com/miniMinn24/Battery_Notify with MIT License -{ - writeShellApplication, - mplayer, - brightnessctl, - ... -}: let - NotifySound = ../../../assets/battery_notify.mp3; -in - writeShellApplication { - name = "custom-batterynotify"; - runtimeInputs = [ - mplayer - brightnessctl - ]; - text = '' - - # Delay for startup - sleep 5 - - # Change your sound path here - - playsound() { - mplayer ${NotifySound} - } - - adjustBrightness() { - local adjustment="$1" - brightnessctl set "$adjustment" - } - - sendNotification() { - local title="$1" - local message="$2" - notify-send -h string:x-canonical-private-synchronous:sys-notify -e -u low "$title" "$message" - } - - # Runs full time in background - x=0 - while true; do - Battery_Status="$(\cat /sys/class/power_supply/BAT*/status)" - Battery_Capacity=$(\cat /sys/class/power_supply/BAT*/capacity) - - case "$Battery_Status" in - "Discharging") - if [ $x -eq 1 ]; then - sendNotification "Discharging" "Remains: ''${Battery_Capacity}%" - adjustBrightness "15%-" - playsound - x=0 - fi - ;; - "Charging") - if [ $x -eq 0 ]; then - sendNotification "Charging" "Current: ''${Battery_Capacity}%" - adjustBrightness "15%+" - playsound - x=1 - fi - ;; - "Full") - if [ $x -eq 0 ]; then - sendNotification "Fully Charged" "Noice: ''${Battery_Capacity}%" - playsound - x=1 - fi - ;; - esac - - sleep 1 - done - ''; - } diff --git a/hostsModules/laptop/scripts/batterywarning.nix b/hostsModules/laptop/scripts/batterywarning.nix deleted file mode 100644 index 41820d8..0000000 --- a/hostsModules/laptop/scripts/batterywarning.nix +++ /dev/null @@ -1,48 +0,0 @@ -# taken and adapted https://github.com/miniMinn24/Battery_Notify with MIT License -{ - writeShellApplication, - mplayer, - brightnessctl, - ... -}: let - NotifySound = ../../../assets/battery_notify.mp3; -in - writeShellApplication { - name = "custom-batterywarning"; - runtimeInputs = [ - mplayer - brightnessctl - ]; - text = '' - - # Delay for startup - sleep 5 - - - playsound() { - mplayer ${NotifySound} - } - - - - while true; do - Battery_Status="$(cat /sys/class/power_supply/BAT*/status)" - Battery_Capacity="$(cat /sys/class/power_supply/BAT*/capacity)" - - if [ "$Battery_Status" == "Discharging" ]; then - if [ "$Battery_Capacity" -le 20 ] && [ "$Battery_Capacity" -ge 10 ]; then - notify-send -e -u critical "Battery Low!" "Power running out: ''${Battery_Capacity}%" - playsound - sleep 180 - - elif [ "$Battery_Capacity" -lt 10 ]; then - notify-send -e -u critical "Battery Low!" "Save your works before immediate shutdown." - playsound - sleep 180 - fi - else - sleep 120 - fi - done - ''; - } diff --git a/hostsModules/laptop/scripts/checkMatrix.nix b/hostsModules/laptop/scripts/checkMatrix.nix deleted file mode 100644 index 46e9a74..0000000 --- a/hostsModules/laptop/scripts/checkMatrix.nix +++ /dev/null @@ -1,20 +0,0 @@ -{pkgs}: -pkgs.writeShellApplication { - name = "custom-checkMatrix"; - - runtimeInputs = [ - pkgs.matrix-commander-rs - pkgs.libnotify - ]; - - text = '' - expected="@totorile1:unredacted.org" - - current="$(matrix-commander-rs --whoami | tr -d '\n')" - - if [ "$current" != "$expected" ]; then - notify-send "matrix-commander-rs" \ - "You are not logged in as @totorile1:unredacted.org\nLog:\n$current" - fi - ''; -} diff --git a/hostsModules/laptop/scripts/cleanNix.nix b/hostsModules/laptop/scripts/cleanNix.nix deleted file mode 100644 index d5515c2..0000000 --- a/hostsModules/laptop/scripts/cleanNix.nix +++ /dev/null @@ -1,71 +0,0 @@ -{pkgs, ...}: -pkgs.writeShellApplication { - name = "custom-cleanNix"; - - runtimeInputs = with pkgs; [ - git - nixos-rebuild - matrix-commander-rs - libnotify - alejandra - deadnix - ]; - - text = '' - set -e - - FLAKE_DIR="/home/tomasr/nixos" - FLAKE="$FLAKE_DIR#laptop" - TIME=$(date -u +"%Y-%m-%dT%H-%M-%SZ") - - ERROR_FILE=$(mktemp) - - # snapshot current state - git -C "$FLAKE_DIR" add -A - git -C "$FLAKE_DIR" commit --allow-empty -m "snapshot pre-cleanup-$TIME" - git -C "$FLAKE_DIR" tag "pre-cleanup-$TIME" HEAD - - # the echos are to separate what each one is doing. Just for curiosity - echo "deadnix scans your Nix code and removes or reports unused (dead) variables and bindings" - deadnix --edit "$FLAKE_DIR" # removes unused code - echo "--------------------------------------------------------------" - echo "statix lints your Nix code to find stylistic issues, bad patterns, and potential mistakes." - statix fix "$FLAKE_DIR" # check other linting issues - echo "--------------------------------------------------------------" - echo "alejandra formats your Nix code consistently according to a strict, opinionated style." - alejandra "$FLAKE_DIR" # formats the config - echo "--------------------------------------------------------------" - - if sudo /run/current-system/sw/bin/nixos-rebuild switch --flake "$FLAKE" 2> "$ERROR_FILE"; then # use /run/.../bin/ uses the sudoless rule - - if ! git -C "$FLAKE_DIR" diff --quiet HEAD; then - git -C "$FLAKE_DIR" add -A - git -C "$FLAKE_DIR" commit -m "Auto: cleanup-$TIME" - git -C "$FLAKE_DIR" push - - notify-send "Nix auto cleanup" "Everything OK" - - matrix-commander-rs --verbose -m "Nix auto cleanup. Everything OK.
@notificationbot_0000" \ - --html \ - -r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU" - else - notify-send "Nix auto cleanup" "No changes" - git -C "$FLAKE_DIR" push - fi - - else - ERROR_MSG=$(cat "$ERROR_FILE") - - notify-send -u critical "Nix auto cleanup" "FAILED" - - matrix-commander-rs --verbose -m "Nix auto cleanup failed.
Error:
$ERROR_MSG

@notificationbot_0000" \ - --html \ - -r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU" - - git -C "$FLAKE_DIR" reset --hard "pre-cleanup-$TIME" - fi - git -C "$FLAKE_DIR" tag -d "pre-cleanup-$TIME" # removes the tag - - rm -f "$ERROR_FILE" - ''; -} diff --git a/modules/README.md b/modules/README.md deleted file mode 100644 index 637db4a..0000000 --- a/modules/README.md +++ /dev/null @@ -1 +0,0 @@ -This modules must be host independent. diff --git a/modules/applications/README.md b/modules/applications/README.md new file mode 100644 index 0000000..1f2b490 --- /dev/null +++ b/modules/applications/README.md @@ -0,0 +1 @@ +NixOS modules and home-manager modules with their scripts for most of my Applications diff --git a/modules/applications/anki.nix b/modules/applications/anki.nix new file mode 100644 index 0000000..a5a996a --- /dev/null +++ b/modules/applications/anki.nix @@ -0,0 +1,67 @@ +{ inputs, ... }: { + flake.nixosModules.anki = { pkgs, ... }: { + environment.systemPackages = [ + (pkgs.anki.withAddons [ + (pkgs.ankiAddons.recolor.withConfig { + config = { + # we must specify all the colors or it crashes as this overwrite the whole colors set + colors = { + # ===== Foregrounds ===== + FG = ["Foreground" "#ebdbb2" "#ebdbb2" ""]; + FG_SUBTLE = ["Subtle FG" "#d5c4a1" "#d5c4a1" ""]; + FG_FAINT = ["Faint FG" "#a89984" "#a89984" ""]; + FG_DISABLED = ["Disabled FG" "#928374" "#928374" ""]; + + # ===== Main Background Layers ===== + BG = ["Background" "#1d2021" "#1d2021" ""]; + MAIN_BG = ["Main Background" "#1d2021" "#1d2021" ""]; + VIEW_BG = ["View Background" "#282828" "#282828" ""]; + EDITOR_BG = ["Editor Background" "#282828" "#282828" ""]; + CANVAS = ["Canvas" "#282828" "#282828" ""]; + CANVAS_ELEVATED = ["Elevated Canvas" "#32302f" "#32302f" ""]; + + # ===== Tables & Lists ===== + TABLE_BG = ["Table Background" "#282828" "#282828" ""]; + TABLE_ALT_BG = ["Table Alt Background" "#32302f" "#32302f" ""]; + HEADER_BG = ["Header Background" "#3c3836" "#3c3836" ""]; + SELECTED_BG = ["Selected Background" "#504945" "#504945" ""]; + + # ===== Borders ===== + BORDER = ["Border" "#504945" "#504945" ""]; + FAINT_BORDER = ["Faint Border" "#3c3836" "#3c3836" ""]; + + # ===== Buttons ===== + BUTTON_GRADIENT_START = ["Button Start" "#3c3836" "#3c3836" ""]; + BUTTON_GRADIENT_END = ["Button End" "#3c3836" "#3c3836" ""]; + BUTTON_HOVER = ["Button Hover" "#665c54" "#665c54" ""]; + + # ===== Accent & Links ===== + ACCENT = ["Accent" "#458588" "#458588" ""]; + LINK = ["Link" "#83a598" "#83a598" ""]; + LINK_HOVER = ["Link Hover" "#8ec07c" "#8ec07c" ""]; + + # ===== Status ===== + WARNING = ["Warning" "#fe8019" "#fe8019" ""]; + ERROR = ["Error" "#fb4934" "#fb4934" ""]; + SUCCESS = ["Success" "#8ec07c" "#8ec07c" ""]; + }; + }; + # version = { major = 3; minor = 1; }; + # let nixpkgs handle the version + }) + ]) + ]; + }; + flake.homeModules.anki = { ... }: { + programs.anki = { + # we enable system wide with nixpkgs because it offers some addon configuration. We just use this for some config + #enable = true; + theme = "dark"; + sync = { + autoSync = true; + autoSyncMediaMinutes = 10; + syncMedia = true; + }; + }; + }; +} diff --git a/modules/applications/batsignal.nix b/modules/applications/batsignal.nix new file mode 100644 index 0000000..e9ba9b4 --- /dev/null +++ b/modules/applications/batsignal.nix @@ -0,0 +1,6 @@ +{ ... }: { + # unused at the moment see ../hardware/battery.nix + flake.homeModules.batsignal = { ... }: { + services.batsignal.enable = true; + }; +} diff --git a/modules/applications/browser.nix b/modules/applications/browser.nix new file mode 100644 index 0000000..88ff5a6 --- /dev/null +++ b/modules/applications/browser.nix @@ -0,0 +1,679 @@ +{ inputs, self, ...}: { + flake.nixosModules.browsers = { pkgs, pkgs-unstable, ...}: { + environment.systemPackages = with pkgs; [ + chromium # used only to flash the firmware on my framework laptop 16 (keyboard.frame.work) as only chromium based browser support webHID. + pkgs-unstable.tor-browser + self.packages.custom-librewolfprofiles + (pkgs.callPackage ../../modules/scripts/librewolfprofiles.nix {}) # fzf librewolf profile selector + ]; + }; + flake.homeModules.librewolf = { ... }: { + # adapted from https://github.com/contre95/dotfiles/blob/main/dotfiles/nixos/programs/librewolf.nix + home.sessionVariables = { + MOZ_ENABLE_WAYLAND = 1; + MOZ_USE_XINPUT2 = 1; + MOZ_DBUS_REMOTE = 1; + }; + programs.librewolf = { + enable = true; + settings = { + "browser.profiles.enabled" = true; + # disabled until i find something that uses it. + "webgl.disabled" = true; + # settings = lib.mapAttrs' (n: lib.nameValuePair "pref.${n}") { + "app.update.auto" = true; # disable auto update + #"dom.security.https_only_mode" = true; # force https + "extensions.pocket.enabled" = false; # disable pocket + #"browser.quitShortcut.disabled" = true; # disable ctrl+q + "browser.download.panel.shown" = true; # show download panel + "signon.rememberSignons" = false; # disable saving passwords + "identity.fxaccounts.enabled" = false; # disable librewolf accounts + "app.shield.optoutstudies.enabled" = false; # disable shield studies + "browser.shell.checkDefaultBrowser" = false; # don't check if default browser + #"browser.bookmarks.restore_default_bookmarks" = false; # don't restore default bookmarks + # Download handling + #"browser.download.dir" = "/home/meain/down"; # default download dir + "browser.startup.page" = 3; # restore previous session + # UI changes + # "browser.uidensity" = 1; # enable dense UI + #"general.autoScroll" = true; # enable autoscroll + # "browser.compactmode.show" = true; # enable compact mode + # "browser.tabs.firefox-view" = false; # enable librewolf view + #"startup.homepage_welcome_url" = + # "https://metrics.internal.contre.io/d/cUITC74Vksd/podman-revamped?orgId=1&from=2026-02-23T19:29:26.304Z&to=2026-02-23T19:59:26.304Z&timezone=browser&var-Filters=&var-namespace=alloy&var-level=error&var-level=debug&var-level=info&var-level=warn&refresh=5s&kiosk=true"; # disable welcome page + "browser.newtabpage.enabled" = true; # disable new tab page + "full-screen-api.ignore-widgets" = true; # fullscreen within window + "browser.toolbars.bookmarks.visibility" = "newtab"; # hide bookmarks toolbar; always, never, newtab + "browser.aboutConfig.showWarning" = false; # disable warning about about:config + "media.videocontrols.picture-in-picture.video-toggle.enabled" = false; # disable picture in picture button + + # Privacy + "privacy.resistFingerprinting" = true; + # "privacy.clearOnShutdown.cache" = false; + "privacy.clearOnShutdown.history" = false; + "privacy.clearHistory.cookiesAndStorage" = false; + "privacy.clearHistory.historyFormDataAndDownloads" = false; + "privacy.clearHistory.cache" = false; + "privacy.clearOnShutdown_v2.siteSettings" = false; + "privacy.clearOnShutdown_v2.cookiesAndStorage" = false; + "services.sync.prefs.sync.privacy.clearOnShutdown_v2.history" = false; + "services.sync.prefs.sync.privacy.clearOnShutdown_v2.siteSettings" = false; + "services.sync.prefs.sync.privacy.clearOnShutdown_v2.sessions" = false; + "services.sync.prefs.sync.privacy.clearOnShutdown_v2.cookies" = false; + "services.sync.prefs.sync.privacy.clearOnShutdown.history" = false; + "services.sync.prefs.sync.privacy.clearOnShutdown.siteSettings" = false; + "services.sync.prefs.sync.privacy.clearOnShutdown.sessions" = false; + "services.sync.prefs.sync.privacy.clearOnShutdown.cookies" = false; + "privacy.clearOnShutdown.cookies" = false; + "browser.discovery.enabled" = false; # disable discovery + "browser.search.suggest.enabled" = true; # disable search suggestions + "browser.contentblocking.category" = "standart"; # set tracking protection to standart to not interfer with adnauseam + "dom.private-attribution.submission.enabled" = false; # stop doing dumb stuff mozilla + "browser.protections_panel.infoMessage.seen" = true; # disable tracking protection info + + # Theme + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + "svg.context-properties.content.enabled" = true; + "layout.css.color-mix.enabled" = true; + + # Disable telemetry + "toolkit.telemetry.enabled" = false; + "toolkit.telemetry.unified" = false; + "browser.ping-centre.telemetry" = false; + "toolkit.telemetry.archive.enabled" = false; + "toolkit.telemetry.bhrPing.enabled" = false; + "toolkit.telemetry.updatePing.enabled" = false; + "browser.translations.automaticallyPopup" = false; + "toolkit.telemetry.hybridContent.enabled" = false; + "toolkit.telemetry.newProfilePing.enabled" = false; + "toolkit.telemetry.reportingpolicy.firstRun" = false; + "toolkit.telemetry.firstShutdownPing.enabled" = false; + "browser.newtabpage.activity-stream.telemetry" = false; + "toolkit.telemetry.shutdownPingSender.enabled" = false; + "browser.newtabpage.activity-stream.feeds.telemetry" = false; + + "browser.tabs.loadInBackground" = true; # open new tab in background + "browser.tabs.loadBookmarksInTabs" = true; # open bookmarks in new tab + "browser.tabs.warnOnOpen" = false; # don't warn when opening multiple tabs + "browser.tabs.warnOnQuit" = false; # don't warn when closing multiple tabs + "browser.tabs.warnOnClose" = false; # don't warn when closing multiple tabs + "browser.tabs.loadDivertedInBackground" = false; # open new tab in background + "browser.tabs.warnOnCloseOtherTabs" = false; # don't warn when closing multiple tabs + "browser.tabs.closeWindowWithLastTab" = false; # don't close window when last tab is closed + + # other + "media.autoplay.default" = 0; # enable autoplay on open + "devtools.toolbox.host" = "right"; # move devtools to right + "devtools.theme" = "dark"; + # "browser.ssb.enabled" = true; # enable site specific browser + "media.rdd-vpx.enabled" = true; # enable hardware acceleration + "devtools.cache.disabled" = true; # disable caching in devtools + "media.ffmpeg.vaapi.enabled" = true; # enable hardware acceleration + + # Fonts + "font.size.fixed.x-western" = 15; + "font.minimum-size.x-western" = 13; + "font.size.variable.x-western" = 15; + "font.size.monospace.x-western" = 15; + "browser.display.use_document_fonts" = 1; + "browser.link.open_newwindow.restriction" = 0; + # + # "browser.fixup.domainsuffixwhitelist.home" = true; + # "browser.fixup.domainwhitelist.internal.contre.io" = true; + "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; + # "keyword.enable" = false; # Disable search when typing unexistent TLD + }; + policies = { + ExtensionSettings = { + # the extension id should be from the manifesto and not a random name. + # if you dont know it. Put a random name. It will fail. Go to about:polices#error and the error will give you the correct id. + "enhancerforyoutube@maximerf.addons.mozilla.org" = { + installation_mode = "normal_installed"; + install_url = "https://addons.mozilla.org/firefox/downloads/latest/enhancer-for-youtube/latest.xpi"; + }; + + "sponsorBlocker@ajay.app" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi"; + installation_mode = "force_installed"; + }; + + "adnauseam@rednoise.org" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/adnauseam/latest.xpi"; + installation_mode = "force_installed"; + }; + "uBlock0@raymondhill.net" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; + installation_mode = "force_installed"; + }; + "{08d5243b-4236-4a27-984b-1ded22ce01c3}" = { + install_url = "https://addons.mozilla.org/firefox/downloads/file/3729287/gruvboxgruvboxgruvboxgruvboxgr-1.0.xpi"; + installation_mode = "force_installed"; + }; + "trackmenot@mrl.nyu.edu" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/trackmenot/latest.xpi"; + installation_mode = "force_installed"; + }; + "{446900e4-71c2-419f-a6a7-df9c091e268b}" = { + install_url = "https://addons.mozilla.org/firefox/downloads/file/4749958/bitwarden_password_manager-latest.xpi"; + installation_mode = "force_installed"; + }; + }; + DisableTelemetry = true; + DisableFirefoxStudies = true; + EnableTrackingProtection = { + Value = true; + Locked = true; + Cryptomining = true; + Fingerprinting = true; + }; + DisablePocket = true; + DisableAccounts = true; + DisableFirefoxScreenshots = true; + # OverrideFirstRunPage = ""; + # OverridePostUpdatePage = ""; + DontCheckDefaultBrowser = true; + DisplayBookmarksToolbar = "always"; # alternatives: "always" or "newtab" + DisplayMenuBar = "never"; # alternatives: "always", "never" or "default-on" + SearchBar = "unified"; # alternative: "separate" + }; + profiles.work = { + id = 0; + # userChrome = builtins.readFile ./userChrome.css; + # userContent = builtins.readFile ./userChrome.css; + extensions = { + #force = true; + #settings = { + # "adnauseam@rednoise.org".settings = { + # # Core behavior + # filteringEnabled = true; + # + # hidingAds = true; + # blockingMalware = true; + # clickingAds = true; + # + # # Privacy + # disableClickingForDNT = true; + # blockSocialMediaWidgets = false; + # + # # Filter lists + # selectedFilterLists = [ + # "adnauseam-filters" + # "easylist" + # "easyprivacy" + # "ublock-badware" + # "ublock-privacy" + # "ublock-unbreak" + # ]; + # + # # Advanced + # advancedUserEnabled = false; + # dynamicFilteringEnabled = false; + # + # # UI + # showIconBadge = true; + # parseTextAds = true; + # eventLogging = false; + # }; + # "trackmenot@mrl.nyu.edu".settings = { + # enabled = true; + + # # Query behavior + # runAtStartup = true; + # useTab = false; # don't open visible tab + # showQueries = false; # don't display fake queries + + # # Frequency (seconds between bursts) + # timeout = 600; # 10 minutes + # burstEnabled = true; + # burstTimeout = 20; # burst interval + # burstCount = 5; + + # # Query source + # useRssFeeds = true; # use dynamic trending feeds + # useUserQueries = false; # don't mix your real queries + # useBlackList = true; + + # # Search engines to generate noise for + # searchEngines = { + # google = true; + # bing = false; + # yahoo = false; + # baidu = false; + # duckduckgo = false; + # }; + + # # Logging + # enableLogging = false; + # }; + # "sponsorBlocker@ajay.app".settings = { + + # # Core behavior + # isEnabled = true; + # autoSkip = false; + # showSkipNotice = true; + # # this does not work + # # Segment categories (auto-skip behavior) + # categoryChooser = { + # Sponsor = { + # enabled = true; + # skipOption = "manualSkip"; + # }; + # intro = { + # enabled = true; + # actionType = 2; + # }; + # outro = { + # enabled = true; + # actionType = 2; + # }; + # selfpromo = { + # enabled = true; + # actionType = 2; + # }; + # interaction = { + # enabled = true; + # actionType = 1; # 1 = manual skip + # }; + # music_offtopic = { + # enabled = false; + # actionType = 0; + # }; + # preview = { + # enabled = false; + # actionType = 0; + # }; + # }; + + # # Privacy + # disableTelemetry = true; + # showDonationLink = false; + + # # UX + # showUpsells = false; + # hideSkipButtonPlayerControls = false; + + # # Advanced + # useLocalCache = true; + # trackViewCount = false; + # }; + #}; + }; + bookmarks = { + force = true; + settings = [ + { + name = "Nixos Config"; + tags = ["github"]; + keyword = "github"; + url = "https://github.com/tomasriveral/nixos"; + } + { + name = "Public AI"; + tags = ["ai" "chatgpt" "apertus"]; + keyword = "apertus"; + url = "https://chat.publicai.co/"; + } + { + name = "Signs of AI writing"; + tags = ["ai" "write"]; + keyword = "AI writing"; + url = "https://en.wikipedia.org/wiki/Wikipedia:Signs_of_AI_writing"; + } + { + name = "nixpkgs-review-gha"; + tags = ["nixpkgs-review" "gha"]; + keyword = "nixpkgs-review"; + url = "https://github.com/tomasriveral/nixpkgs-review-gha/actions/workflows/review.yml"; + } + { + name = "nixpkgs tracker"; + tags = ["nixpkgs" "tracker"]; + keyword = "nixpkgs tracker"; + url = "https://nixpk.gs/pr-tracker.html"; + } + { + name = "fahrlehrer"; + tags = ["theorie" "fahrlehrer" "conduite"]; + keyword = "fahrlehrer24"; + url = "https://app.fahrlehrer24.ch/"; + } + { + name = "cogito"; + tags = ["cogito" "esprit" "critique"]; + keyword = "Cogito l'Esprit critique"; + url = "https://app.cogito.fr"; + } + ]; + }; + search = { + force = true; + default = "quant"; + privateDefault = "qant"; + order = [ + "q" + "map" + "np" + "nw" + "bookmarks" + "tabs" + "history" + ]; + engines = { + # don't need these default ones + "amazondotcom-es".metaData.hidden = true; + "bing".metaData.hidden = true; + "ebay".metaData.hidden = true; + "metager".metaData.hidden = true; # dont work + "mojeek".metaData.hidden = true; # dont work + "seerx".metaData.hidden = true; + "perplexity".metaData.hidden = true; + "google".metaData.hidden = true; + "startpage".metaData.hidden = true; + "duckduckgo".metaData.hidden = true; + "Wikitionary" = { + urls = [ + { + template = "https://fr.wiktionary.org/w/index.php?search={searchTerms}"; + } + ]; + definedAliases = ["dict"]; + }; + "quant" = { + urls = [ + { + template = "https://www.qwant.com/"; + params = [ + { + name = "q"; + value = "{searchTerms}"; + } + ]; + } + ]; + definedAliases = ["q"]; + }; + "OpenStreeetMap" = { + urls = [ + { + template = "https://www.openstreetmap"; + params = [ + { + name = "q"; + value = "{searchTerms}"; + } + ]; + } + ]; + definedAliases = ["map"]; + }; + "Home Manager Options" = { + urls = [ + { + template = "https://home-manager-options.extranix.com/"; + params = [ + { + name = "query"; + value = "{searchTerms}"; + } + ]; + } + ]; + definedAliases = ["hm"]; + }; + "Nix Packages" = { + urls = [ + { + template = "https://search.nixos.org/packages"; + params = [ + { + name = "type"; + value = "packages"; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + } + ]; + definedAliases = ["np"]; + }; + "Nix Wiki" = { + urls = [ + { + template = "https://wiki.nixos.org/w/index.php?search={searchTerms}"; + } + ]; + definedAliases = ["nw"]; + }; + "Repology" = { + urls = [ + { + template = "https://repology.org/projects/?search={searchTerms}"; + } + ]; + definedAliases = ["rp"]; + }; + }; + }; + }; + profiles.other = { + id = 1; + # userChrome = builtins.readFile ./userChrome.css; + # userContent = builtins.readFile ./userChrome.css; + extensions = { + #force = false; + #settings = { + # "adnauseam@rednoise.org".settings = { + # # Core behavior + # filteringEnabled = true; + # + # hidingAds = true; + # blockingMalware = true; + # clickingAds = true; + # + # # Privacy + # disableClickingForDNT = true; + # blockSocialMediaWidgets = false; + # + # # Filter lists + # selectedFilterLists = [ + # "adnauseam-filters" + # "easylist" + # "easyprivacy" + # "ublock-badware" + # "ublock-privacy" + # "ublock-unbreak" + # ]; + # + # # Advanced + # advancedUserEnabled = false; + # dynamicFilteringEnabled = false; + # + # # UI + # showIconBadge = true; + # parseTextAds = true; + # eventLogging = false; + # }; + # "trackmenot@mrl.nyu.edu".settings = { + # enabled = true; + + # # Query behavior + # runAtStartup = true; + # useTab = false; # don't open visible tab + # showQueries = false; # don't display fake queries + + # # Frequency (seconds between bursts) + # timeout = 600; # 10 minutes + # burstEnabled = true; + # burstTimeout = 20; # burst interval + # burstCount = 5; + + # # Query source + # useRssFeeds = true; # use dynamic trending feeds + # useUserQueries = false; # don't mix your real queries + # useBlackList = true; + + # # Search engines to generate noise for + # searchEngines = { + # google = true; + # bing = false; + # yahoo = false; + # baidu = false; + # duckduckgo = false; + # }; + + # # Logging + # enableLogging = false; + # }; + # "sponsorBlocker@ajay.app".settings = { + + # # Core behavior + # isEnabled = true; + # autoSkip = false; + # showSkipNotice = true; + # # this does not work + # # Segment categories (auto-skip behavior) + # categoryChooser = { + # Sponsor = { + # enabled = true; + # skipOption = "manualSkip"; + # }; + # intro = { + # enabled = true; + # actionType = 2; + # }; + # outro = { + # enabled = true; + # actionType = 2; + # }; + # selfpromo = { + # enabled = true; + # actionType = 2; + # }; + # interaction = { + # enabled = true; + # actionType = 1; # 1 = manual skip + # }; + # music_offtopic = { + # enabled = false; + # actionType = 0; + # }; + # preview = { + # enabled = false; + # actionType = 0; + # }; + # }; + + # # Privacy + # disableTelemetry = true; + # showDonationLink = false; + + # # UX + # showUpsells = false; + # hideSkipButtonPlayerControls = false; + + # # Advanced + # useLocalCache = true; + # trackViewCount = false; + # }; + #}; + }; + search = { + force = true; + default = "quant"; + privateDefault = "qant"; + order = [ + "q" + "map" + "np" + "nw" + "bookmarks" + "tabs" + "history" + ]; + engines = { + # don't need these default ones + "amazondotcom-es".metaData.hidden = true; + "bing".metaData.hidden = true; + "ebay".metaData.hidden = true; + "metager".metaData.hidden = true; # dont work + "mojeek".metaData.hidden = true; # dont work + "seerx".metaData.hidden = true; + "perplexity".metaData.hidden = true; + "google".metaData.hidden = true; + "startpage".metaData.hidden = true; + "duckduckgo".metaData.hidden = true; + "quant" = { + urls = [ + { + template = "https://www.qwant.com/"; + params = [ + { + name = "q"; + value = "{searchTerms}"; + } + ]; + } + ]; + definedAliases = ["q"]; + }; + "OpenStreeetMap" = { + urls = [ + { + template = "https://www.openstreetmap"; + params = [ + { + name = "q"; + value = "{searchTerms}"; + } + ]; + } + ]; + definedAliases = ["map"]; + }; + "Onche.org" = { + urls = [ + { + template = "https://onche.org/forum/1/blabla-general/search?by=topic&q={searchTerms}"; + } + ]; + definedAliases = ["on"]; + }; + }; + }; + }; + }; + }; + flake.packages.custom-librewolfprofiles = { pkgs, ... }: + # fzf librewolf profile selector + pkgs.writeShellApplication { + name = "custom-librewolfprofiles"; + runtimeInputs = with pkgs; [ + zsh + fzf + ]; + text = '' + # List of profiles + profiles=("work" "other" "private window") + + # Use fzf to select + selected=$(printf "%s\n" "''${profiles[@]}" | fzf --height 6 --reverse --prompt="Select LibreWolf profile:") + + # If user cancels, exit + [[ -z "$selected" ]] && exit 0 + + # Launch LibreWolf detached, keeping environment + if [[ "$selected" == "private window" ]]; then + setsid librewolf --private-window --no-remote >/dev/null 2>&1 & + pkill -f "kitty.*Select LibreWolf profile" + else + setsid librewolf -P "$selected" --no-remote >/dev/null 2>&1 & + pkill -f "kitty.*Select LibreWolf profile" + fi + + # Exit the kitty terminal after selection + exit + ''; + }; +} diff --git a/modules/applications/caelestia.nix b/modules/applications/caelestia.nix new file mode 100644 index 0000000..d7c12eb --- /dev/null +++ b/modules/applications/caelestia.nix @@ -0,0 +1,611 @@ +{ self, ... }: { + flake.nixosModules.caelestia = { pkgs, ... }: { + qt.enable = true; + # to resolve this https://wiki.nixos.org/wiki/Home_Manager#I_cannot_set_GNOME_or_Gtk_themes_via_Home_Manager + programs.dconf.enable = true; + + + environment.systemPackages = with pkgs; [ + self.packages.${pkgs.system}.qtbatticon + kdePackages.qtdeclarative # provides qmlls and other things + quickshell # we have it but adding it there solves "WARN qt.qpa.services: Failed to register with host portal QDBusError("org.freedesktop.portal.Error.Failed", "Could not register app ID: App info not found for 'org.quickshell'")" + ]; + }; + flake.homeModules.caelestia = { ... }: let + sisyphe = ../../assets/sisyphe.gif; + pepe-music = ../../assets/pepe-music.gif; + in { + home.file.".local/state/caelestia/wallpaper/path.txt" = { + # dummy file. Does nothing. Prevent an error + enable = true; + text = "${sisyphe}"; + }; + home.file.".face" = { + # this is were caelestia will search for profiles pictures + source = ../../assets/sisyphePFP.png; + }; + # set profile picture in ~/.face + programs.caelestia = { + enable = true; + systemd = { + enable = false; # if we launch it form here, the keybinds don't work + target = "graphical-session.target"; + environment = []; + }; + settings = { + # default config https://github.com/caelestia-dots/shell?tab=readme-ov-file#example-configuration + appearance = { + mediaGifSpeedAdjustment = 500; + sessionGifSpeed = 0.7; + anim = { + duration = { + scale = 1; + }; + }; + /* + font = { + family = { + clock = "Rubik"; # (TODO figure out those fonts) + material = "Material Symboles Rounded"; + mono = "CaskaydiaCove NF"; + sans = "Rubik"; + }; + size = { + scale = 1; + }; + }; + */ + padding = { + scale = 1; + }; + rounding = { + scale = 1; + }; + spacing = { + scale = 1; + }; + transparency = { + enabled = false; + base = 0.85; + layeres = 0.4; + }; + }; + general = { + logo = "caelestia"; + apps = { + terminal = ["kitty"]; # default foot + audio = ["pavucontrol"]; + playback = ["vlc"]; # what's that? + explorer = ["dolphin"]; # default thunar + }; + battery = { + wanLevels = [ + { + level = 20; + title = "Low battery"; + message = "You might want to plug in a charger"; + icon = "battery_android_frame_2"; + } + { + level = 10; + title = "Did you see the previous message?"; + message = "You should probably plug in a charger now"; + icon = "battery_android_frame_1"; + } + { + level = 5; + title = "Critical battery level"; + message = "PLUG THE CHARGER RIGHT NOW!!"; + icon = "battery_android_alert"; + critical = true; + } + ]; + criticalLevel = 3; + }; + idle = { + lockBeforeSleep = true; + inhibitWhenAudio = true; + timeouts = [ + { + timeout = 180; + idleAction = "lock"; + } + { + timeout = 300; + idleAction = "dpms off"; # what's that? + returnAction = "dpms on"; + } + { + timeout = 600; + idleAction = ["systemctl" "suspend-then-hibernate"]; + } + ]; + }; + }; + background = { + desktopClock = { + enabled = false; + scale = 1.0; + position = "bottom-right"; + shadow = { + enabled = true; + opacity = 0.7; + blur = 0.4; + }; + background = { + enabled = false; + opacity = 0.7; + blur = true; + }; + invertColors = false; + }; + enabled = false; #default true + visualiser = { + blur = false; + enabled = false; + autohide = true; + rounding = 1; + spacing = 1; + }; + }; + bar = { + activeWindow = { + compact = false; + inverted = false; + showOnHover = true; + }; + clock = { + background = true; + showDate = true; + showIcon = true; + }; + dragThreshold = 20; + entries = [ + { + id = "logo"; + enabled = true; + } + { + id = "workspaces"; + enabled = true; + } + { + id = "spacer"; + enabled = true; + } + { + id = "activeWindow"; + enabled = true; + } + { + id = "spacer"; + enabled = true; + } + { + id = "tray"; + enabled = true; + } + { + id = "clock"; + enabled = true; + } + { + id = "statusIcon"; + enabled = true; + } + { + id = "power"; + enabled = true; + } + ]; + persistent = true; + popouts = { + activeWindow = true; + statusIcon = true; + tray = true; + }; + scrollActions = { + brightness = true; + workspaces = true; + volume = true; + }; + showOnHover = true; + status = { + showAudio = false; + showBattery = false; # use powerprofile daemon + showBluetooth = false; + showKbLayout = false; + showMicrophone = false; + showNetwork = false; + showWifi = true; + showLockStatus = false; + }; + tray = { + background = true; # default true + compact = false; + iconSubs = []; + recolour = true; + }; + workspaces = { + activeIndicator = true; + activeLabel = "󰮯"; + activeTrail = false; + label = " "; + occupiedBg = false; + occpiedLabel = "󰮯"; + perMonitorWorkspaces = true; + showWindows = true; + shown = 5; + specialWorkspaceIcons = [ + { + name = "steam"; + icon = "sports_esports"; + } + ]; + windowIcons = [ + { + regex = "steam(_app_(default|[0-9]+))?"; + icon = "sports_esports"; + } + ]; + }; + excludedScreens = [""]; # default says "" those this work? + }; + border = { + rounding = 25; + thickness = 10; + }; + dashboard = { + enabled = true; + dragThreshold = 50; + mediaUpdateInterval = 500; + showOnHover = true; + }; + launcher = { + actionsPrefix = ">"; + actions = [ + { + name = "Calculator"; + icon = "calculate"; + description = "Do simple math equations (powered by Qalc)"; + command = ["autocomplete" "calc"]; + enabled = false; # default true + dangerous = false; + } + { + name = "Scheme"; + icon = "palette"; + description = "Change the current colour scheme"; + command = ["autocomplete" "scheme"]; + enabled = false; # default true + dangerous = false; + } + { + name = "Wallpaper"; + icon = "image"; + description = "Change the current wallpaper"; + command = ["autocomplete" "wallpaper"]; + enabled = false; # default true + dangerous = false; + } + { + name = "Variant"; # to remove + icon = "colors"; + description = "Change the current scheme variant"; + command = ["autocomplete" "variant"]; + enabled = true; + dangerous = false; + } + { + name = "Transparency"; + icon = "opacity"; + description = "Change shell transparency"; + command = ["autocomplete" "transparency"]; + enabled = false; + dangerous = false; + } + { + name = "Random"; + icon = "casino"; + description = "Switch to a random wallpaper"; + command = ["caelestia" "wallpaper" "-r"]; + enabled = false; # default true + dangerous = false; + } + { + name = "Light"; + icon = "light_mode"; + description = "Change the scheme to light mode"; + command = ["setMode" "light"]; + enabled = false; # default true + dangerous = false; + } + { + name = "Dark"; + icon = "dark_mode"; + description = "Change the scheme to dark mode"; + command = ["setMode" "dark"]; + enabled = false; # default true + dangerous = false; + } + { + name = "Shutdown"; + icon = "power_settings_new"; + description = "Shutdown the system"; + command = ["systemctl" "poweroff"]; + enabled = true; + dangerous = true; + } + { + name = "Reboot"; + icon = "cached"; + description = "Reboot the system"; + command = ["systemctl" "reboot"]; + enabled = true; + dangerous = true; + } + { + name = "Lock"; # does this work with ly? + icon = "lock"; + description = "Log out of the current session"; + command = ["loginctl" "terminate-user" ""]; + enabled = true; + dangerous = true; + } + { + name = "Sleep"; + icon = "bedtime"; + description = "Suspend then hibernate"; + command = ["systemctl" "suspend-then-hibernate"]; + enabled = true; + dangerous = false; + } + { + name = "Settings"; + icon = "settings"; + description = "Configure the shell"; + command = ["caelestia" "shell" "controlCenter" "open"]; + enabled = false; # default true + dangerous = false; + } + ]; + dragThreshold = 50; + vimKeybinds = false; # intersting to put to true + enableDangerousActions = false; # set to true + maxShown = 7; + maxWallpapers = 9; + specialPrefix = "@"; + useFuzzy = { + # should try + apps = false; + actions = false; + schemes = false; + variants = false; + wallpapers = false; + }; + showOnHover = false; + favouriteApps = []; + hiddenApps = []; + }; + lock = { + recolourLogo = false; # what's that + hideNotifs = false; + }; + notifs = { + actionOnClick = false; + clearThreshold = 0.3; + defaultExpireTimeout = 5000; + expantThreshold = 20; + openeExpanded = false; + expire = true; + }; + osd = { + # thats the slider for brightness and sound + enabled = true; + enableBrightness = true; + enableMicrophone = false; + hideDelay = 2000; + }; + paths = { + mediaGif = pepe-music; # default "root:/assets/bongocat.gif" + sessionGif = sisyphe; # default "root:/assets/kurukuru.gif" + noNotifsPic = "root:/assets/dino.png"; + lockNoNotifsPic = "root:/assets/dino.png"; + wallpaperDir = "~/Pictures/Wallpapers"; + lyricsDir = "~/Music/lyrics"; + }; + services = { + audioIncrement = 0.1; + brightnessIncrement = 0.1; + maxVolume = 1.0; + defaultPlayer = "Spotify"; + gpuType = ""; + #playerAliases: [ { "from": "com.github.th_ch.youtube_music", "to": "YT Music" } ]; # how to put this into nix language? + weatherLocation = "Lausanne"; + useFahrenheit = false; + useFahrenheitPerformance = false; + useTwelveHourClock = false; + smartScheme = false; # default true + visualisersBars = 45; + }; + session = { + dragThreshold = 30; # what does dragThreshold do? + enabled = true; + vimKeybinds = false; # maybe set to true? + icons = { + logout = "logout"; + shutdown = "power_settings_new"; + hibernate = "downloading"; # find a better icon + reboot = "cached"; + }; + commands = { + logout = ["hyprctl" "dispatch exit"]; + shutdown = ["systemctl" "poweroff"]; + hibernate = ["systemctl" "hibernate"]; + reboot = ["systemctl" "reboot"]; + }; + }; + sidebar = { + dragThreshold = 80; + enabled = true; + }; + # is there a way to get some system info? + utilities = { + enabled = true; + maxToasts = 4; # toats are like notification but on the botto left + toasts = { + audioInputChanged = true; + audioOutputChanged = true; + capsLockChanged = true; + chargingChanged = true; + configLoaded = true; + dndChanged = true; + gameModeChanged = true; + kbLayoutChanged = true; + kbLimit = true; + numLockChanged = true; + vpnChanged = true; + nowPlaying = false; + }; + }; + vpn = { + enabled = false; # default true + provider = [ + { + # default example-configuration + name = "wireguard"; + interface = "your-connection-name"; + displayName = "wireguard (Your VPN)"; + enabled = false; + } + ]; + }; + quickToggles = [ + { + id = "wifi"; + enabled = true; + } + { + id = "bluetooth"; + enabled = true; + } + { + id = "mic"; + enabled = true; + } + { + id = "settings"; + enabled = true; # should desactivate + } + { + id = "gameMode"; + enabled = true; # should remap my performance mode + } + { + id = "dnd"; #do not disturb + enabled = true; + } + { + id = "vpn"; + enabled = false; # default true; + } + ]; + }; + cli = { + # default config https://github.com/caelestia-dots/cli?tab=readme-ov-file#configuring + enable = true; # Also add caelestia-cli to path + settings = { + record = { + extraArgs = []; + }; + wallpaper = { + postHook = "caelestia scheme set -n gruvbox -f soft -m dark"; # sets the theme + }; + theme = { + enableTerm = false; # we do it manually by adapting our kitty config + enableHypr = false; # this seems to add the splash + enableDiscord = true; + enableSpicetify = true; + enableFuzzel = true; #what's that? + enablleBtop = false; # default true + enableQt = true; + }; + toggles = { + communication = { + discord = { + enable = false; # default true + match = [ + { + class = "discord"; + } + ]; + whatsapp = { + enable = true; + match = [ + { + class = "whatsapp"; + } + ]; + }; + }; + }; + music = { + spotify = { + enable = false; # default true + match = [ + { + class = "Spotify"; + } + { + initialTitle = "Spotify"; + } + { + initialTitle = "Spotify Free"; + } + ]; + command = ["spicetify" "watch" "-s"]; + move = true; + }; + feishin = { + enable = true; + match = [ + { + class = "feishin"; + } + ]; + move = true; + }; + }; + sysmon = { + btop = { + enable = true; + match = [ + { + class = "btop"; + title = "btop"; + workspace = { + name = "special:sysmon"; + }; + } + ]; + command = ["foot" "-a" "btop" "-T" "btop" "fish" "-C" "exec btop"]; # maybe switch to btm and kitty? + }; + }; + todo = { + todoist = { + enable = false; # default true + match = [ + { + class = "Todoist"; + } + ]; + command = ["todoist"]; + move = true; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/modules/applications/eza.nix b/modules/applications/eza.nix new file mode 100644 index 0000000..b18e501 --- /dev/null +++ b/modules/applications/eza.nix @@ -0,0 +1,115 @@ +{ ... }: { + flake.homeModules.eza = { ... }: { + # ls replacement + # see ./zsh.nix for the alias (usefull to se default flags) + programs.eza = { + enable = true; + enableZshIntegration = true; + theme = { + # from https://github.com/eza-community/eza-themes/blob/main/themes/gruvbox-dark.yml + colourful = true; + + filekinds = { + normal = {foreground = "#ebdbb2";}; + directory = {foreground = "#83a598";}; + symlink = {foreground = "#8ec07c";}; + pipe = {foreground = "#928374";}; + block_device = {foreground = "#fb4934";}; + char_device = {foreground = "#fb4934";}; + socket = {foreground = "#665c54";}; + special = {foreground = "#d3869b";}; + executable = {foreground = "#b8bb26";}; + mount_point = {foreground = "#fe8019";}; + }; + perms = { + user_read = {foreground = "#ebdbb2";}; + user_write = {foreground = "#fabd2f";}; + user_execute_file = {foreground = "#b8bb26";}; + user_execute_other = {foreground = "#b8bb26";}; + group_read = {foreground = "#ebdbb2";}; + group_write = {foreground = "#fabd2f";}; + group_execute = {foreground = "#b8bb26";}; + other_read = {foreground = "#bdae93";}; + other_write = {foreground = "#fabd2f";}; + other_execute = {foreground = "#b8bb26";}; + special_user_file = {foreground = "#d3869b";}; + special_other = {foreground = "#928374";}; + attribute = {foreground = "#bdae93";}; + }; + size = { + major = {foreground = "#bdae93";}; + minor = {foreground = "#8ec07c";}; + number_byte = {foreground = "#ebdbb2";}; + number_kilo = {foreground = "#ebdbb2";}; + number_mega = {foreground = "#83a598";}; + number_giga = {foreground = "#d3869b";}; + number_huge = {foreground = "#d3869b";}; + unit_byte = {foreground = "#bdae93";}; + unit_kilo = {foreground = "#83a598";}; + unit_mega = {foreground = "#d3869b";}; + unit_giga = {foreground = "#d3869b";}; + unit_huge = {foreground = "#fe8019";}; + }; + users = { + user_you = {foreground = "#ebdbb2";}; + user_root = {foreground = "#fb4934";}; + user_other = {foreground = "#d3869b";}; + group_yours = {foreground = "#ebdbb2";}; + group_other = {foreground = "#928374";}; + group_root = {foreground = "#fb4934";}; + }; + links = { + normal = {foreground = "#8ec07c";}; + multi_link_file = {foreground = "#fe8019";}; + }; + git = { + new = {foreground = "#b8bb26";}; + modified = {foreground = "#fabd2f";}; + deleted = {foreground = "#fb4934";}; + renamed = {foreground = "#8ec07c";}; + typechange = {foreground = "#d3869b";}; + ignored = {foreground = "#928374";}; + conflicted = {foreground = "#cc241d";}; + }; + git_repo = { + branch_main = {foreground = "#ebdbb2";}; + branch_other = {foreground = "#d3869b";}; + git_clean = {foreground = "#b8bb26";}; + git_dirty = {foreground = "#fb4934";}; + }; + security_context = { + colon = {foreground = "#928374";}; + user = {foreground = "#ebdbb2";}; + role = {foreground = "#d3869b";}; + typ = {foreground = "#665c54";}; + range = {foreground = "#d3869b";}; + }; + file_type = { + image = {foreground = "#fabd2f";}; + video = {foreground = "#fb4934";}; + music = {foreground = "#b8bb26";}; + lossless = {foreground = "#8ec07c";}; + crypto = {foreground = "#928374";}; + document = {foreground = "#ebdbb2";}; + compressed = {foreground = "#d3869b";}; + temp = {foreground = "#cc241d";}; + compiled = {foreground = "#83a598";}; + build = {foreground = "#928374";}; + source = {foreground = "#83a598";}; + punctuation = {foreground = "#928374";}; + date = {foreground = "#fabd2f";}; + inode = {foreground = "#bdae93";}; + blocks = {foreground = "#a89984";}; + header = {foreground = "#ebdbb2";}; + octal = {foreground = "#8ec07c";}; + flags = {foreground = "#d3869b";}; + + symlink_path = {foreground = "#8ec07c";}; + control_char = {foreground = "#83a598";}; + broken_symlink = {foreground = "#fb4934";}; + broken_path_overlay = {foreground = "#928374";}; + }; + }; + }; + }; +} diff --git a/modules/applications/fastfetch.nix b/modules/applications/fastfetch.nix new file mode 100644 index 0000000..dabcbce --- /dev/null +++ b/modules/applications/fastfetch.nix @@ -0,0 +1,176 @@ +{ ... }: { + flake.homeModules.fastfetch = { ... }: { + # Adapted from https://github.com/dacrab/fastfetch-config/blob/main/config.jsonc + programs.fastfetch = { + enable = true; + + settings = { + logo = { + type = "none"; + #source = "nixos"; + }; + + modules = [ + # ───────────── Hardware ───────────── + + { + type = "custom"; + format = "╭───────────────────────── Hardware ──────────────────────────╮"; + outputColor = "blue"; + } + + { + type = "title"; + key = " PC"; + keyColor = "green"; + } + + { + type = "host"; + key = "│ ├󰇅 Laptop"; + keyColor = "green"; + } + + { + type = "display"; + key = "│ ├󰍹 Display"; + keyColor = "green"; + } + + { + type = "cpu"; + key = "│ ├󰍛 CPU"; + showPeCoreCount = true; + format = "{1}"; + keyColor = "green"; + } + + { + type = "gpu"; + key = "│ ├󰍛 GPU"; + keyColor = "green"; + } + + { + type = "memory"; + key = "└ └󰍛 Memory"; + keyColor = "green"; + } + + { + type = "custom"; + format = "╰─────────────────────────────────────────────────────────────╯"; + outputColor = "blue"; + } + + # ───────────── Software ───────────── + + { + type = "custom"; + format = "╭───────────────────────── Software ──────────────────────────╮"; + outputColor = "blue"; + } + + { + type = "os"; + key = " OS"; + keyColor = "cyan"; + } + + { + type = "kernel"; + key = "│ ├ Kernel"; + keyColor = "cyan"; + } + + { + type = "packages"; + key = "│ ├󰏖 Packages"; + keyColor = "cyan"; + } + + { + type = "shell"; + key = "│ ├ Shell"; + keyColor = "cyan"; + } + + { + type = "terminal"; + key = "│ ├ Terminal"; + keyColor = "cyan"; + } + + { + type = "command"; + key = "│ ├ OS Age"; + keyColor = "cyan"; + text = '' + birth_install=$(stat -c %W /) + current=$(date +%s) + time_progression=$((current - birth_install)) + days_difference=$((time_progression / 86400)) + echo $days_difference days + ''; + } + + { + type = "uptime"; + key = "└ └ Uptime"; + keyColor = "cyan"; + } + + { + type = "de"; + key = " DE"; + keyColor = "blue"; + } + + { + type = "wm"; + key = " WM"; + keyColor = "magenta"; + } + + { + type = "gpu"; + key = "│ ├󰍛 GPU Driver"; + format = "{3}"; + keyColor = "magenta"; + } + + { + type = "brightness"; + key = "│ ├󰃟 Brightness"; + keyColor = "magenta"; + } + + { + type = "version"; + key = "└ └ FastFetch"; + keyColor = "magenta"; + } + + { + type = "custom"; + format = "╰────────────────────────────────────────────────────────────╯"; + outputColor = "blue"; + } + + #{ + # type = "custom"; + # format = '' + # {#0} {#1} {#2} {#3} {#4} {#5} {#6} {#7} + # ''; + #} #for some reason dont work + { + type = "colors"; + symbol = "diamond"; + } + + "break" + ]; + }; + }; + }; +} diff --git a/modules/applications/games.nix b/modules/applications/games.nix new file mode 100644 index 0000000..7ce99b4 --- /dev/null +++ b/modules/applications/games.nix @@ -0,0 +1,9 @@ +{ ... }: { + flake.nixosModules.games = {pkgs, ...}: { + environment.systemPackages = with pkgs; [ + supertux # fuck mario + supertuxkart # fuck mariokart + # my favorite italian plumber is free software + ]; + }; +} diff --git a/modules/applications/git.nix b/modules/applications/git.nix new file mode 100644 index 0000000..4cf9aed --- /dev/null +++ b/modules/applications/git.nix @@ -0,0 +1,14 @@ +{ ... }: { + flake.homeModules.git = { ... }: { + programs.git = { + enable = true; + settings = { + init.defaultBranch = "main"; + }; + }; + programs.gh = { + enable = true; + gitCredentialHelper.enable = true; + }; + }; +} diff --git a/modules/applications/gtk.nix b/modules/applications/gtk.nix new file mode 100644 index 0000000..2e64c9d --- /dev/null +++ b/modules/applications/gtk.nix @@ -0,0 +1,14 @@ +{ ... }: { + flake.homeModules.gtk = {pkgs, ...}: { + # gtk config + gtk.theme = { + enable = true; + Gruvbox-GTK-Theme-BL-MB = { + enable = true; + name = "Gruvbox-GTK-Theme-BL-MB"; + package = pkgs.gruvbox-gtk-theme; + }; + }; + # to resolve this https://wiki.nixos.org/wiki/Home_Manager#I_cannot_set_GNOME_or_Gtk_themes_via_Home_Manager + }; +} diff --git a/modules/applications/hypridle.nix b/modules/applications/hypridle.nix new file mode 100644 index 0000000..beed889 --- /dev/null +++ b/modules/applications/hypridle.nix @@ -0,0 +1,23 @@ +{ ... }: { + # this was in my home-manager config, but looks like more + flake.nixosModules.hypridle = { ... }: { + services.hypridle = { + enable = true; + settings = { + general = { + lock_cmd = "notify-send 'lock!'"; # dbus/sysd lock command (loginctl lock-session) + unlock_cmd = "notify-send 'unlock!'"; # same as above, but unlock + before_sleep_cmd = "notify-send 'Zzz'"; # command ran before sleep + after_sleep_cmd = "notify-send 'Awake!"; # command ran after sleep + ignore_dbus_inhibit = false; # whether to ignore dbus-sent idle-inhibit requests (used by e.g. firefox or steam) + ignore_systemd_inhibit = false; # whether to ignore systemd-inhibit --what=idle inhibitors + }; + listener = { + timeout = 500; # in seconds + on-timeout = "notify-send 'You are idle!'"; # command to run when timeout has passed + on-resume = "notify-send 'Welcome back!'"; # command to run when activity is detected after timeout has fired. + }; + }; + }; + }; +} diff --git a/modules/applications/hyprland.nix b/modules/applications/hyprland.nix new file mode 100644 index 0000000..e26284a --- /dev/null +++ b/modules/applications/hyprland.nix @@ -0,0 +1,498 @@ +{ self, ... }: { + flake.nixosModules.hyprland = { pkgs, pkgs-unstable, ... }: { + environment.systemPackages = with pkgs; [ + swww #wallpaper daemon + gruvbox-gtk-theme + hyprcursor + capitaine-cursors-themed # cursor theme + papirus-icon-theme + papirus-folders + self.packages.${pkgs.system}.custom-wallpaper + self.packages.${pkgs.system}.custom-dontkillsteam # kill app (if not steam or tomato-c + self.packages.${pkgs.system}.custom-killall # kill all windows except focused window + xdg-utils + ]; + # enable hyprland WM + programs.hyprland = { + enable = true; + package = pkgs-unstable.hyprland; # we use the unstable branch to get the latest features + withUWSM = true; + xwayland.enable = true; + }; + + xdg.portal = { + enable = true; + extraPortals = [ + pkgs.xdg-desktop-portal-wlr + pkgs.xdg-desktop-portal-gtk + ]; + }; + # removes uxterm + services.xserver.excludePackages = [pkgs.xterm]; + + # Enable the X11 windowing system. + services.xserver.enable = true; + }; + flake.homeModules.hyprland-laptop = { ... }: { + wayland.windowManager.hyprland.settings = { + exec-once = [ + "qtbatticon" # custom battery tray + ]; + monitor = [ + "eDP-1, highres@highrr, 0x0, 1" + ]; + }; + }; + flake.homeModules.hyprland = {pkgs-unstable, ...}: let + wallpaper = ../../assets/wallpaper1.jpg; + in { + #refer to https://wiki.hypr.land/Nix/Hyprland-on-Home-Manager/ + wayland.windowManager.hyprland.enable = true; + wayland.windowManager.hyprland.package = pkgs-unstable.hyprland; + #hint Electron apps to use on wayland; + home.sessionVariables.NIXOS_OZONE_WL = "1"; + wayland.windowManager.hyprland.plugins = [ + #pkgs-unstable.hyprlandPlugins.hyprspace # currently broken + #pkgs-unstable.hyprlandPlugins.hypr-dynamic-cursors # currently broken + ]; + wayland.windowManager.hyprland.settings = { + "$mod" = "SUPER"; + "$term" = "kitty"; + "$editor" = "nvim"; + "$notes" = "kitty --class \"custom-obsidianvaults\" --name \"Select Obsidian vault\" --hold custom-obsidianvaults"; + "$file" = "dolphin"; + "$browser" = "kitty --class \"custom-librewolfprofiles\" --name \"Select LibreWolf profile\" --hold custom-librewolfprofiles"; + # ▄▀█ █▄░█ █ █▀▄▀█ ▄▀█ ▀█▀ █ █▀█ █▄░█ + # █▀█ █░▀█ █ █░▀░█ █▀█ ░█░ █ █▄█ █░▀█ + animations = { + enabled = true; + bezier = [ + "wind, 0.05, 0.9, 0.1, 1.05" + "winIn, 0.1, 1.1, 0.1, 1.1" + "winOut, 0.3, -0.3, 0, 1" + "liner, 1, 1, 1, 1" + ]; + animation = [ + "windows, 1, 6, wind, slide" + "windowsIn, 1, 6, winIn, slide" + "windowsOut, 1, 5, winOut, slide" + "windowsMove, 1, 5, wind, slide" + "border, 1, 1, liner" + "borderangle, 1, 30, liner, loop" + "fade, 1, 10, default" + "workspaces, 1, 5, wind" + ]; + }; + + # █▀▀ █▄░█ █░█ + # ██▄ █░▀█ ▀▄▀ + + # See https://wiki.hyprland.org/Configuring/Environment-variables/ + env = [ + "PATH, $PATH:$scrPath" + "XDG_CURRENT_DESKTOP,Hyprland" + "XDG_SESSION_TYPE,wayland" + "XDG_SESSION_DESKTOP,Hyprland" + "QT_QPA_PLATFORM,wayland;xcb" + "QT_QPAPLATFORMTHEME,qt6ct" + "QT_WAYLAND_DISABLE_WINDOWDECORATION,1" + "MOZ_ENABLE_WAYLAND,1" + "GDK_SCALE,1" + ]; + + # █ █▄░█ █▀█ █░█ ▀█▀ + # █ █░▀█ █▀▀ █▄█ ░█░ + + input = { + kb_layout = ["ch"]; + follow_mouse = 1; + sensitivity = 0; + force_no_accel = 1; + }; + + # █▄▀ █▀▀ █▄█ █▄▄ █ █▄░█ █▀▄ █ █▄░█ █▀▀ █▀ + # █░█ ██▄ ░█░ █▄█ █ █░▀█ █▄▀ █ █░▀█ █▄█ ▄█ + # caelestia shell drawers toggle dashboard + # caelestia shell drawers toggle utilities + + bind = [ + #hyprland/utility keybindings + "$mod, W, togglefloating" + "$mod, G, togglegroup" + "Alt, Return, fullscreen" + "$mod, Left, movefocus, l" + "$mod, Right, movefocus, r" + "$mod, Up, movefocus, u" + "$mod, Down, movefocus, d" + "Alt, Tab, movefocus, d" + "$mod, 1, workspace, 1" + "$mod, 2, workspace, 2" + "$mod, 3, workspace, 3" + "$mod, 4, workspace, 4" + "$mod, 5, workspace, 5" + "$mod, 6, workspace, 6" + "$mod, 7, workspace, 7" + "$mod, 8, workspace, 8" + "$mod, 9, workspace, 9" + "$mod, 0, workspace, 10" + "$mod+Ctrl, Right, workspace, r+1" + "$mod+Ctrl, Left, workspace, r-1" + "$mod+Ctrl, Doown, workspace, empty" + "$mod+Shift, 1, movetoworkspace, 1" + "$mod+Shift, 2, movetoworkspace, 2" + "$mod+Shift, 3, movetoworkspace, 3" + "$mod+Shift, 4, movetoworkspace, 4" + "$mod+Shift, 5, movetoworkspace, 5" + "$mod+Shift, 6, movetoworkspace, 6" + "$mod+Shift, 7, movetoworkspace, 7" + "$mod+Shift, 8, movetoworkspace, 8" + "$mod+Shift, 9, movetoworkspace, 9" + "$mod+Shift, 0, movetoworkspace, 10" + "$mod+Ctrl+Alt, Right, movetoworkspace, r+1" + "$mod+Ctrl+Alt, Left, movetoworkspace, r-1" + #"$mod, Backspace, exec, wlogout -b 4 -T 600 -B 600" + "$mod, Backspace, exec, caelestia shell drawers toggle session" + "$mod+Shift+Ctrl, Left, movewindow, l" + "$mod+Shift+Ctrl, Right, movewindow, r" + "$mod+Shift+Ctrl, Up, movewindow, u" + "$mod+Shift+Ctrl, Down, movewindow, d" + "$mod, mouse_down, workspace, e+1" + "$mod, mouse_up, workspace, e-1" + "$mod, V, exec, cliphist list | rofi -dmenu| cliphist decode | wl-copy" # copy paste + "$mod, B, exec, hyprkeys -bkr | rofi -dmenu" + #"$mod, A, tagwindow, noborder" # used to not apply image border + "$mod, S, togglespecialworkspace," + "Alt+$mod, S, movetoworkspace, special" + # for the scrolling layout + "$mod, A, layoutmsg, move -col" + "$mod, D, layoutmsg, move +col" + #apps keybindings + "$mod, T, exec, $term" + "$mod, E, exec, $file" + "$mod, F, exec, $browser" + "$mod, N, exec, $notes" + #"$mod+Shift, A, exec, rofi -show drun" + "$mod+Shift, A, exec, caelestia shell drawers toggle launcher" + "$mod, Q, exec, custom-dontkillsteam" + #"Ctrl+Alt, W, exec, pkill waybar || waybar" + "Ctrl+Alt, W, exec, caelestia shell drawers toggle sidebar" + #"$mod, L, exec, swaylock -eFLK -i ${wallpaper}" + "$mod, L, exec, caelestia shell lock lock" + #"$mod, F11, exec, hyprshot -m window" + ", F11, exec, caelestia screenshot" + #"$mod_SHIFT, S, exec, hyprshot -m region --clipboard only" + # "$mod_SHIFT, S, exec, qs ipc call screenshot toggle" + "$mod_SHIFT, S, exec, caelestia shell picker open" + # framework 16 rgb macropad + "Ctrl+$mod, 6, exec, custom-killall" # pos 1 1 killall apps except focused one + #"Ctrl+Alt, 7, exec, custom-performance" # pos 2 1 start performance mode + "Ctrl+Alt, 7, exec, caelestia shell gameMode toggle" + # reloads the autostart programs # pos 3 1 + # we passed to caelestia-shell and stoped using that + /* + "Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=16 -e sh -c 'custom-weather'" + "Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=11 -e sh -c 'custom-cowsay'" + "Ctrl+$mod, 4, exec, kitty -e 'custom-launch'" + "Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=5 -e btm --theme gruvbox --disable-click --disable_advanced_kill --enable_cache_memory -g -R -T " + "Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=1 -e sh -c 'cmatrix -br'" + #"Ctrl+Alt, 1, exec, swaync-client -t" # pos 4 1 notification center + "Ctrl+Alt, 1, exec, qs ipc call notifications toggle" + */ + "Ctrl+Alt, 1, exec, caelestia shell drawers toggle sidebar" + "Ctrl+$mod, 4, exec, caelestia shell notifs toggleDnd" + "Ctrl+$mod, 3, exec, pavucontrol" # pos 1 2 audiocontrol + "Ctrl+Shift+Alt, 0, exec, kitty --hold --class \"custom-changeAudioOutput\" --name \"Select audio output\" zsh -c \"custom-changeAudioOutput\"" # pos 2 2 change audio output fzf + "Ctrl+$mod, 5, exec, gnome-characters" # pos 3 2 special chars + "Ctrl+Alt, 8, exec, hyprpicker | tee >(wl-copy) | cliphist store" # pos 4 2 colorpicker + "Ctrl+Alt, 0, exec, custom-tomato" # pos 1 3 pomodoro app + "Ctrl+Alt, 2, exec, custom-bottom" # pos 2 3 btm (like htop but cleaner) + "Ctrl+Alt, 9, exec, anki" + # if hyprexpo plugin enabled bind = $mainMod, Space, hyprexpo:expo, toggle + # maybe exec sudo framework-tools-tui + + #plugins keybindings + #"$mod, SPACE, overview:toggle, " + ]; + binde = [ + "$mod+Shift, Right, resizeactive, 30 0" + "$mod+Shift, Left, resizeactive, -30, 0" + "$mod+Shift, Up, resizeactive, 0 -30" + "$mod+Shift, Down, resizeactive,m 0 30" + ]; + bindl = [ + ", F1, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle" #toggle audio mute + ", F5, exec, playerctl play-pause" # media F4-F6 + ", F4, exec, playerctl previous" + ", F6, exec, playerctl next" + ]; + bindel = [ + ", F2, exec, pactl set-sink-volume @DEFAULT_SINK@ -10%" # decrease volume + ", F3, exec, pactl set-sink-volume @DEFAULT_SINK@ +10%" # increase volume + ", F7, exec, brightnessctl s 10%-" # decrease brightness + ", F8, exec, brightnessctl s +10%" # increase brightness + ]; + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + "$mod, Z, movewindow" + "$mod, X, resizewindow" + ]; + # █░░ ▄▀█ █░█ █▄░█ █▀▀ █░█ + # █▄▄ █▀█ █▄█ █░▀█ █▄▄ █▀█ + exec-once = [ + "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" # for XDPH + "dbus-update-activation-environment --systemd --all" # for XDPH + "systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" # for XDPH + "systemctl --user start xdg-desktop-portal-wlr.service" + "blueman-applet" # systray app for Bluetooth + "udiskie --no-automount --smart-tray" # front-end that allows to manage removable media + "nm-applet --indicator" # systray app for Network/wifi + #setups clipboard + "rm -rf ~/.cache/cliphist/ && wl-paste --type text --watch cliphist store & wl-paste --type image --watch cliphist store" + #"wl-paste --type text --watch cliphist store" # clipboard store text data + #"wl-paste --type image --watch cliphist store" # clipboard store image data + "custom-batterynotify" + "custom-batterywarning" + #"birdtray" # thunderbird tray app # curently broken + #wallpapers/b + "swww img ${wallpaper}" + "swww-daemon" + "sleep 1 && custom-wallpaper" + "custom-checkKdrive && custom-mountkdrive" # checks if the remote works and mount it + #"waybar" + "custom-gitnotify" + "custom-checkMatrix" # checks if matrix-commander-rs is connected which is important for other stuff + #"custom-obsidianbackup" # backups the obsidian notes to kdrive and to a timed hidden dir (~/.Notes.backup/) + #"QS-notifycache" # builds the cache that will be used for the notification history + "sleep 4 & caelestia-shell" #works better if it sleeps a bit before + /* + We stopped using that ######################### maybe we should desactivate those scripts + # login autostart + ####################### + "[workspace 1 silent] sleep 1 && kitty -o font_size=16 -e sh -c 'custom-weather'" + "[workspace 1 silent] sleep 1 && kitty -o font_size=11 -e sh -c 'custom-cowsay'" + "[workspace 1 silent] kitty -e 'custom-launch'" + "[workspace 1 silent] sleep 1 && kitty -o font_size=5 -e btm --theme gruvbox --disable-click --disable_advanced_kill --enable_cache_memory -g -R -T " + "[workspace 1 silent] sleep 1 && kitty -o font_size=1 -e sh -c 'cmatrix -br'" + ###################### + ###################### + */ + ]; + splash = true; # remove default background on startup + # gestures (also keybindings) + gesture = [ + "3, right, move, +col" + "3, left, move, -col" + ]; + + # █░░ ▄▀█ █▄█ █▀█ █░█ ▀█▀ █▀ + # █▄▄ █▀█ ░█░ █▄█ █▄█ ░█░ ▄█ + + dwindle = { + preserve_split = true; + }; + scrolling = { + column_width = 0.45; + }; + + # █▀▄▀█ █ █▀ █▀▀ + # █░▀░█ █ ▄█ █▄▄ + + misc = { + vrr = 0; + force_default_wallpaper = 0; + }; + xwayland = { + force_zero_scaling = true; + }; + + # █▀▄▀█ █▀█ █▄░█ █ ▀█▀ █▀█ █▀█ + # █░▀░█ █▄█ █#░▀█ █ ░█░ █▄█ █▀▄ + monitor = [ + #",preferred, auto, auto" + "HDMI-A-1, highres2highrr, auto-left, 1" + ]; + # _______ ___ __ __ _______ ___ __ _ _______ + #| || | | | | || || | | | | || | + #| _ || | | | | || ___|| | | |_| || _____| + #| |_| || | | |_| || | __ | | | || |_____ + #| ___|| |___ | || || || | | _ ||_____ | + #| | | || || |_| || | | | | | _____| | + #|___| |_______||_______||_______||___| |_| |__||_______| + # + "plugin:dynamic-cursors" = { + enabled = true; + threshold = 2; + mode = "rotate"; + rotate = { + # length in px of the simulated stick used to rotate the cursor + # most realistic if this is your actual cursor size + length = 20; + offset = 0; + }; + shake = { + enabled = true; + # use nearest-neighbour (pixelated) scaling when shaking + # may look weird when effects are enabled + nearest = true; + threshold = 4; + # magnification level immediately after shake start + base = 4.0; + # magnification increase per second when continuing to shake + speed = 4.0; + # how much the speed is influenced by the current shake intensitiy + influence = 0.0; + + # maximal magnification the cursor can reach + # values below 1 disable the limit (e.g. 0) + limit = 0.0; + + # time in millseconds the cursor will stay magnified after a shake has ended + timeout = 2000; + + # show cursor behaviour `tilt`, `rotate`, etc. while shaking + effects = true; + + # enable ipc events for shake + ipc = false; + }; + }; + "plugin:overview" = { + disableGestures = true; + showEmptyWorkspace = true; + workspaceActiveBorder = "rgb(ab7746)"; + disableBlur = true; + }; + + ##################################################### + ##################################################### + # theme + decoration = { + dim_special = 0.3; + rounding = 18; + blur = { + special = true; + enabled = true; + size = 4; + passes = 2; + new_optimizations = true; + ignore_opacity = true; + }; + }; + general = { + gaps_in = 5; + gaps_out = 15; + border_size = 4; + "col.active_border" = "rgba(ca6702ff) rgba(ecd3a0ff) 45deg"; + "col.inactive_border" = "rgba(f1dca7d9) rgba(ffe1a8d9) 45deg"; + layout = "dwindle"; + resize_on_border = true; + }; + group = { + "col.border_active" = "rgba(ca6702ff) rgba(ecd3a0ff) 45deg"; + "col.border_inactive" = "rgba(f1dca7d9) rgba(ffe1a8d9) 45deg"; + "col.border_locked_active" = "rgba(ca6702ff) rgba(ecd3a0ff) 45deg"; + "col.border_locked_inactive" = "rgba(f1dca7d9) rgba(ffe1a8d9) 45deg"; + }; + #################################################### + ################################################## + + # /$$ /$$ /$$ + #| $$ /$ | $$ | $$ + #| $$ /$$$| $$ /$$$$$$ /$$$$$$ | $$ /$$ /$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ + #| $$/$$ $$ $$ /$$__ $$ /$$__ $$| $$ /$$/ /$$_____/ /$$__ $$ |____ $$ /$$_____/ /$$__ $$ + #| $$$$_ $$$$| $$ \ $$| $$ \__/| $$$$$$/ | $$$$$$ | $$ \ $$ /$$$$$$$| $$ | $$$$$$$$ + #| $$$/ \ $$$| $$ | $$| $$ | $$_ $$ \____ $$| $$ | $$ /$$__ $$| $$ | $$_____/ + #| $$/ \ $$| $$$$$$/| $$ | $$ \ $$ /$$$$$$$/| $$$$$$$/| $$$$$$$| $$$$$$$| $$$$$$$ + #|__/ \__/ \______/ |__/ |__/ \__/|_______/ | $$____/ \_______/ \_______/ \_______/ + # | $$ + # | $$ + # |__/ + # see https://wiki.hypr.land/Configuring/Workspace-Rules/ + workspace = [ + "1, layout:master" + "2, layout:scrolling, layoutopt:direction:right" + "name:special, layout:scrolling" + # used for smart gaps along some windowrules + #"w[tv1], gapsout:1, gapsin:1" + #"f[1], gapsout:1, gapsin:1" + ]; + + # █░█░█ █ █▄░█ █▀▄ █▀█ █░█░█   █▀█ █░█ █░░ █▀▀ █▀ + # ▀▄▀▄▀ █ █░▀█ █▄▀ █▄█ ▀▄▀▄▀   █▀▄ █▄█ █▄▄ ██▄ ▄█ + windowrule = [ + "opacity 0.90 0.90, match:class ^(firefox)$" + "opacity 0.90 0.90, match:class ^(Brave-browser)$" + "opacity 0.80 0.80, match:class ^(code-oss)$" + "opacity 0.80 0.80, match:class ^(Code)$" + "opacity 0.80 0.80, match:class ^(code-url-handler)$" + "opacity 0.80 0.80, match:class ^(code-insiders-url-handler)$" + "opacity 0.75 0.75, match:class ^(kitty)$" + "opacity 0.80 0.80, match:class ^(org.kde.dolphin)$" + "opacity 0.80 0.80, float on, match:class ^(org.kde.ark)$" + "opacity 0.80 0.80, float on, match:class ^(nwg-look)$" + "opacity 0.80 0.80, float on, match:class ^(qt5ct)$" + "opacity 0.80 0.80, float on, match:class ^(qt6ct)$" + "opacity 0.80 0.80, float on, match:class ^(kvantummanager)$" + "opacity 0.80 0.70, float on, match:class ^(org.pulseaudio.pavucontrol)$" + "opacity 0.80 0.70, float on, match:class ^(blueman-manager)$" + "opacity 0.80 0.70, float on, match:class ^(nm-applet)$" + "opacity 0.80 0.70, float on, match:class ^(nm-connection-editor)$" + "opacity 0.80 0.70, float on, match:class ^(org.kde.polkit-kde-authentication-agent-1)$" + "opacity 0.80 0.70, match:class ^(polkit-gnome-authentication-agent-1)$" + "opacity 0.80 0.70, match:class ^(org.freedesktop.impl.portal.desktop.gtk)$" + "opacity 0.80 0.70, match:class ^(org.freedesktop.impl.portal.desktop.hyprland)$" + "opacity 0.70 0.70, match:class ^([Ss]team)$" + "opacity 0.70 0.70, match:class ^(steamwebhelper)$" + "opacity 0.70 0.70, match:class ^(Spotify)$" + "opacity 0.70 0.70, match:initial_title ^(Spotify Free)$" + "opacity 0.90 0.90, float on, match:class ^(com.github.rafostar.Clapper)$" + "opacity 0.80 0.80, match:class ^(com.github.tchx84.Flatseal)$" + "opacity 0.80 0.80, match:class ^(hu.kramo.Cartridges)$" + "opacity 0.80 0.80, match:class ^(com.obsproject.Studio)$" + "opacity 0.80 0.80, match:class ^(gnome-boxes)$" + "opacity 0.80 0.80, match:class ^(discord)$" + "opacity 0.80 0.80, match:class ^(WebCord)$" + "opacity 0.80 0.80, match:class ^(ArmCord)$" + "opacity 0.80 0.80, float on, match:class ^(app.drey.Warp)$" + "opacity 0.80 0.80, float on, match:class ^(net.davidotek.pupgui2)$" + "opacity 0.80 0.80, float on, match:class ^(yad)$" + "opacity 0.80 0.80, float on, match:class ^(Signal)$" + "opacity 0.80 0.80, float on, match:class ^(io.github.alainm23.planify)$" + "opacity 0.80 0.80, float on, match:class ^(io.gitlab.theevilskeleton.Upscaler)$" + "opacity 0.80 0.80, float on, match:class ^(com.github.unrud.VideoDownloader)$" + "opacity 0.80 0.80, float on, match:class ^(io.gitlab.adhami3310.Impression)$" + "opacity 0.80 0.80, float on, match:class ^(io.missioncenter.MissionCenter)$" + "opacity 0.80 0.80, match:class ^(io.github.flattool.Warehouse)$" + "float on, match:class ^(org.kde.dolphin)$, match:title ^(Progress Dialog — Dolphin)$" + "float on, match:class ^(org.kde.dolphin)$, match:title ^(Copying — Dolphin)$" + "float on, match:class ^(firefox)$, match:title ^(Picture-in-Picture)$" + "float on, match:class ^(firefox)$, match:title ^(Library)$" + "float on, match:class ^(kitty)$, match:title ^(top)$" + "float on, match:class ^(kitty)$, match:title ^(btop)$" + "float on, match:class ^(kitty)$, match:title ^(htop)$" + "float on, match:class ^(vlc)$" + "float on, match:class ^(eog)$" + "float on, size 400 225, match:class ^(custom-librewolfprofiles)$" + "float on, size 1050 200, match:class ^(custom-changeAudioOutput)$" + "float on, size 400 175, match:class ^(custom-obsidianvaults)$" + "float on, size 600 600, match:initial_class ^(custom-pomodoro)$" + "float on, size 1500 800, match:initial_class ^(custom-bottom)$" + # smart gaps/border is ugly with caelestia-shell + #"border_size 2, match:float 0, match:workspace w[tv1]" + #"rounding 1, match:float 0, match:workspace w[tv1]" + #"border_size 2, match:float 0, match:workspace f[1]" + #"rounding 1, match:float 0, match:workspace f[1]" + ]; + # add a float for tomato when in kitty + #"plugin:imgborders:noimgborders, tag:noborder" + layerrule = [ + "blur on, ignore_alpha 0, match:namespace rofi" + "blur on, ignore_alpha 0, match:namespace notifications" + "blur on, ignore_alpha 0, match:namespace swaync-notification-window" + "blur on, ignore_alpha 0, match:namespace swaync-control-center" + "blur on, match:namespace logout_dialog" + ]; + }; + }; +} diff --git a/modules/applications/hyprlandScripts.nix b/modules/applications/hyprlandScripts.nix new file mode 100644 index 0000000..359c1f2 --- /dev/null +++ b/modules/applications/hyprlandScripts.nix @@ -0,0 +1,101 @@ +{ self, ...}: { +# ----------------------------------------------------- +# Here are a bunch of scripts that interact with hyprland +# Some are still used. Some are broken. Some are deprecated. But I do still keep them in case I want to go back to old tools +# ----------------------------------------------------- + # kills the app, but when it's steam or custom-pomodoro + flake.packages.custom-dontkillsteam = { pkgs, ... }: + pkgs.writeShellApplication { + name = "custom-dontkillsteam"; + runtimeInputs = with pkgs; [ + hyprland + jq + ]; + text = '' + class=$(hyprctl activewindow -j | jq -r ".class") + if [[ "$class" == "Steam" || "$class" == "custom-pomodoro" ]]; then + hyprctl dispatch movetoworkspacesilent special + else + hyprctl dispatch killactive "" + fi + + ''; + }; + flake.packages.custom-killall = { pkgs, pkgs-unstable, ...}: + pkgs.writeShellApplication { + name = "custom-killall"; + runtimeInputs = with pkgs; [ + pkgs-unstable.hyprland + jq + ]; + text = '' + active_workspace_id=$(hyprctl activeworkspace -j | jq -r '.id') + + hyprctl clients -j | + jq -r ".[] + | select(.workspace.id==''${active_workspace_id}) + | select(.focusHistoryID!=0) + | .pid" | + xargs -r kill + ''; + }; + flake.packages.custom-wallpaper = { pkgs, ... }: + let + wallpaper1 = ../../assets/wallpaper1.jpg; + wallpaper2 = ../../assets/wallpaper2.jpg; + wallpaper3 = ../../assets/wallpaper3.jpg; + wallpaper4 = ../../assets/wallpaper4.jpg; + wallpaper5 = ../../assets/wallpaper5.jpg; + in + pkgs.writeShellApplication { + name = "custom-wallpaper"; + runtimeInputs = with pkgs; [ + socat + swww + ]; + text = '' + handle() { + case $1 in + workspace*) + str=$1 + i=$((''${#str}-1)) + workspace="''${str:$i:1}" + case $workspace in + 1 | 6) + swww img -t none ${wallpaper1} + ;; + 2 | 7) + swww img -t none ${wallpaper2} + ;; + 3 | 8) + swww img -t none ${wallpaper3} + ;; + 4 | 9) + swww img -t none ${wallpaper4} + ;; + 5 | 10 | 0) + swww img -t none ${wallpaper5} + ;; + esac + ;; + esac + } + + socat -U - UNIX-CONNECT:"$XDG_RUNTIME_DIR"/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock | while read -r line; do handle "$line"; done + ''; + }; + flake.packages.custom-launch = { pkgs, ... }: + pkgs.writeShellApplication { + # used for the terminal autostart. Needs to get cleared and recall fastfetch so that the bar from oh-my-zsh get resized + # unused + name = "custom-launch"; + runtimeInputs = with pkgs; [ + zsh + ]; + text = '' + sleep 2 + clear + zsh + ''; + }; +} diff --git a/modules/applications/kdrive.nix b/modules/applications/kdrive.nix new file mode 100644 index 0000000..1d974d3 --- /dev/null +++ b/modules/applications/kdrive.nix @@ -0,0 +1,70 @@ +{ self, ... }: { + flake.nixosModules.kdrive = { pkgs-unstable, ... }: { + environment.systemPackages = with pkgs-unstable; [ + rclone + self.packages.${pkgs.system}.custom-checkKdrive + self.packages.${pkgs.system}.custom-mountkdrive + ]; + # removes rclone error + programs.fuse = { + userAllowOther = true; + enable = true; + }; + }; + flake.packages.custom-checkKdrive = { pkgs, ... }: + pkgs.writeShellApplication { + name = "custom-checkKdrive"; + runtimeInputs = with pkgs; [ + rclone + matrix-commander-rs + libnotify + ]; + text = '' + + # waits for an internet connection. It pings both Google DNS and Cloudfare dns in case one of them is down + until ping -c1 -W1 1.1.1.1 >/dev/null 2>&1 || \ + ping -c1 -W1 8.8.8.8 >/dev/null 2>&1 + do + sleep 1 + done + + set +e + + output=$(rclone lsd kdrive: 2>&1) + status=$? + + set -e + + if [ $status -eq 0 ]; then + echo "kdrive OK" + else + echo "kdrive rclone failed with error: $output" + notify-send "rclone kdrive failed" "$output" + matrix-commander-rs --verbose -m "rclone kdrive failed.
Error:
$output

@notificationbot_0000" \ + --html \ + -r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU" + fi + ''; + }; + flake.packages.custom-mountkdrive = { pkgs, ... }: + pkgs.writeShellApplication { + name = "custom-mountkdrive"; + runtimeInputs = with pkgs; [ + rclone + libnotify + ]; + text = '' + REMOTE_NAME="kdrive" + MOUNT_POINT="$HOME/kdrive" + + if rclone listremotes | rg "^''${REMOTE_NAME}:"; then + echo "Mounting ''${REMOTE_NAME}..." + rclone mount "''${REMOTE_NAME}:" "$MOUNT_POINT" --vfs-cache-mode writes --allow-non-empty & + else + notify-send "rclone mount failed" \ + "Remote ''${REMOTE_NAME} not found.\nConfigure rclone and create the dir ~/kdrive/ or comment out the exec line in hyprland.nix." + echo "Remote ''${REMOTE_NAME} not found. Configure rclone or comment out the exec line in hyprland.nix." + fi + ''; + }; +} diff --git a/modules/applications/kitty.nix b/modules/applications/kitty.nix new file mode 100644 index 0000000..5d1b4cd --- /dev/null +++ b/modules/applications/kitty.nix @@ -0,0 +1,123 @@ +{ ... }: { + flake.homeModules.kitty = { ... }: { + programs.kitty = { + enable = true; + #font.name = nerd-fonts._0xproto; + #font.size = "10"; + ## new config (matches with caelestia + ## old condfig + extraConfig = '' + font_size 14 + bold_font auto + italic_font auto + bold_italic_font auto + + window_padding_width 25 + + # --- Core --- + foreground #ece0d9 + background #18120e + + selection_foreground #18120e + selection_background #ece0d9 + + cursor #ffb878 + cursor_text_color #18120e + + # --- Tabs --- + active_tab_foreground #18120e + active_tab_background #5c412a + inactive_tab_foreground #d6c3b5 + inactive_tab_background #241e1a + + # --- Black / Gray --- + color0 #353433 + color8 #b29f91 + + # --- Red --- + color1 #e17300 + color9 #ff8a20 + + # --- Green --- + color2 #ffc071 + color10 #ffd6a8 + + # --- Yellow --- + color3 #ffe0c6 + color11 #fff2e8 + + # --- Blue --- + color4 #b9ab66 + color12 #d7be91 + + # --- Magenta --- + color5 #ed9562 + color13 #fcad7e + + # --- Cyan --- + color6 #f4c16d + color14 #ffd497 + + # --- White --- + color7 #ebd4c1 + color15 #FFFFFF + ''; + /* + extraConfig = '' + # font nerd-fonts._0xproto # this key dont work and causes errors + font_size 14 + bold_font auto + italic_font auto + bold_italic_font auto + window_padding_width 25 + foreground #FFFFFF + background #1B1D1C + selection_foreground #1B1D1C + selection_background #FFFFFF + cursor #C3AC76 + cursor_text_color #0F1010 + + active_tab_foreground #1B1D1C + active_tab_background #6B5540 + inactive_tab_foreground #6B5540 + inactive_tab_background #1B1D1C + + # black + color0 #29523D + color8 #578F73 + + # red + #color1 #FFF0CC + #color9 #F0DBAA + # we need actual red colors + color1 #CC241D + color9 #9D0006 + + # green + color2 #FFEECC + color10 #F0D9AA + + # yellow + color3 #FFE5CC + color11 #F0CCAA + + # blue + color4 #9AE6C0 + color12 #9AE6C0 + + # magenta + color5 #E6CC9A + color13 #E6CC9A + + # cyan + color6 #E6BF9A + color14 #E6BF9A + + # white + color7 #FFF0CC + color15 #F0DBAA + ''; + */ + }; + }; +} diff --git a/modules/applications/ly.nix b/modules/applications/ly.nix new file mode 100644 index 0000000..7926c58 --- /dev/null +++ b/modules/applications/ly.nix @@ -0,0 +1,96 @@ +{ ... }: { + flake.nixosModules.ly = { ... }: { + # a minimal ly config as the big config (ly.nix) didnt worked + services.displayManager.ly = { + enable = true; + settings = { + # Core animation + animation = "none"; # none or doom or matrix or gameoflife or a dur file + # Ly supports 24-bit true color with styling, which means each color is a 32-bit value. + # The format is 0xSSRRGGBB, where SS is the styling, RR is red, GG is green, and BB is blue. + # Here are the possible styling options: + # TB_BOLD 0x01000000 + # TB_UNDERLINE 0x02000000 + # TB_REVERSE 0x04000000 + # TB_ITALIC 0x08000000 + # TB_BLINK 0x10000000 + # TB_HI_BLACK 0x20000000 + # TB_BRIGHT 0x40000000 + # TB_DIM 0x80000000 + # Programmatically, you'd apply them using the bitwise OR operator (|), but because Ly's + # configuration doesn't support using it, you have to manually compute the color value. + # Note that, if you want to use the default color value of the terminal, you can use the + # special value 0x00000000. This means that, if you want to use black, you *must* use + # the styling option TB_HI_BLACK (the RGB values are ignored when using this option). + # Basic TUI settings + clear_password = true; + default_input = "password"; + fg = "0x01cd6400"; + full_color = true; + hide_borders = false; + hide_key_hints = false; + hide_keyboard_locks = true; + hide_version_string = false; + input_len = 34; + lang = "en"; + numlock = false; + save = true; + service_name = "ly"; + + bigclock = "en"; + clock = "%H:%M"; + + colormix_col1 = "0x08E85D04"; + colormix_col2 = "0x08FABD2F"; + colormix_col3 = "0x08FE8019"; + + # Box appearance + #border_fg = "0x00FFFFFF"; + blank_box = true; + box_title = "tomasr@nixos"; + #margin_box_h = 2; + #margin_box_v = 1; + #text_in_center = false; + + # Animation: Conway’s Game of Life (optional, comment out for minimal setup) + gameoflife_fg = "0x40FFFFFF"; + + gameoflife_frame_delay = 3; + gameoflife_entropy_interval = 10; + gameoflife_initial_density = 0.666; + + # Optional commands (leave null or comment if unused) + hibernate_cmd = null; + inactivity_cmd = null; + login_cmd = "start-hyprland"; + #logout_cmd = null; + sleep_cmd = null; + + # System commands keys + shutdown_cmd = "/sbin/shutdown $PLATFORM_SHUTDOWN_ARG now"; + shutdown_key = "F1"; + restart_key = "F2"; + sleep_key = "F3"; + hibernate_key = "F4"; + + # top bar + session_log = null; + initial_info_text = null; # + # Custom sessions + #custom_sessions = "$CONFIG_DIRECTORY/ly/custom-sessions"; + #waylandsessions = "$PREFIX_DIRECTORY/share/wayland-sessions"; + #xsessions = "$PREFIX_DIRECTORY/share/xsessions"; + + # Xorg settings (only needed if using X) + #x_cmd = "$PREFIX_DIRECTORY/bin/X"; + #x_vt = null; + #xauth_cmd = "$PREFIX_DIRECTORY/bin/xauth"; + #xinitrc = "~/.xinitrc"; + + # Setup / startup scripts + #setup_cmd = "$CONFIG_DIRECTORY/ly/setup.sh"; + #start_cmd = "$CONFIG_DIRECTORY/ly/startup.sh"; + }; + }; + }; +} diff --git a/modules/applications/micro.nix b/modules/applications/micro.nix new file mode 100644 index 0000000..be127ac --- /dev/null +++ b/modules/applications/micro.nix @@ -0,0 +1,42 @@ +{ inputs, ... }: { + flake.hostModules.micro = { pkgs-unstable, ... }: { + programs.micro = { + enable = true; + package = pkgs-unstable.micro-full; + settings = { + }; + }; + home.file.".config/micro/plug/vivify" = { + enable = true; + source = inputs.microPlugins-vivify; + recursive = true; + force = true; + }; + home.file.".config/micro/init.lua" = { + enable = true; + force = true; + text = '' + local buffer = import("micro/buffer") + local shell = import("micro/shell") + + function vivifyOpen(buf) + local cursor = buf:GetActiveCursor() + local line = cursor.Loc.Y + 1 + + shell.ExecCommand("viv", string.format("%s:%d", buf.AbsPath, line)) + end + + function onBufferOpen(buf) + if os.getenv("MICRO_VIVIFY") ~= "1" then + return + end + + -- only run for real files (not help/log/etc) + if buf.Type.Kind == buffer.BTDefault then + vivifyOpen(buf) + end + end + ''; + }; + }; +} diff --git a/modules/applications/mullvad.nix b/modules/applications/mullvad.nix new file mode 100644 index 0000000..19d2cf3 --- /dev/null +++ b/modules/applications/mullvad.nix @@ -0,0 +1,15 @@ +{ ... }: { + flake.nixosModules.mullvad = {pkgs-unstable, ...}: { + services.mullvad-vpn = { + enable = true; + package = pkgs-unstable.mullvad-vpn; + }; + }; + flake.homeModules.mullvad = {pkgs-unstable, ...}: { + programs.mullvad-vpn = { + # gui + enable = true; + package = pkgs-unstable.mullvad-vpn; + }; + }; +} diff --git a/modules/applications/neovim.nix b/modules/applications/neovim.nix new file mode 100644 index 0000000..6b8144e --- /dev/null +++ b/modules/applications/neovim.nix @@ -0,0 +1,501 @@ +{ ... }: { + flake.homeModules.neovim = {pkgs-unstable, ...}: { + programs.neovim = { + enable = true; + vimAlias = false; + viAlias = false; + package = pkgs-unstable.neovim-unwrapped; # required for unwrapped version + plugins = [ + pkgs-unstable.vimPlugins.vivify-vim + pkgs-unstable.vimPlugins.vimtex + pkgs-unstable.vimPlugins.zoxide-vim + #pkgs-unstable.vimPlugins.gruvbox + pkgs-unstable.vimPlugins.gruvbox-nvim + pkgs-unstable.vimPlugins.neovim-sensible + pkgs-unstable.vimPlugins.nvim-web-devicons + pkgs-unstable.vimPlugins.nvim-tree-lua + pkgs-unstable.vimPlugins.nvim-surround + pkgs-unstable.vimPlugins.floaterm + pkgs-unstable.vimPlugins.nvim-lspconfig + pkgs-unstable.vimPlugins.cmp-nvim-lsp + pkgs-unstable.vimPlugins.cmp-nvim-lsp-signature-help + pkgs-unstable.vimPlugins.cmp-under-comparator + pkgs-unstable.vimPlugins.cmp-buffer + pkgs-unstable.vimPlugins.cmp-path + pkgs-unstable.vimPlugins.cmp-cmdline + pkgs-unstable.vimPlugins.nvim-cmp + pkgs-unstable.vimPlugins.cmp-vsnip + pkgs-unstable.vimPlugins.vim-vsnip + pkgs-unstable.vimPlugins.dashboard-nvim + pkgs-unstable.vimPlugins.lualine-nvim + pkgs-unstable.vimPlugins.vim-nix + pkgs-unstable.vimPlugins.plenary-nvim + pkgs-unstable.vimPlugins.blink-ripgrep-nvim + pkgs-unstable.vimPlugins.nvim-treesitter + pkgs-unstable.vimPlugins.nvim-treesitter-parsers.rasi + pkgs-unstable.vimPlugins.nvim-treesitter-parsers.regex + pkgs-unstable.vimPlugins.nvim-treesitter-parsers.udev + pkgs-unstable.vimPlugins.nvim-treesitter-parsers.zsh + pkgs-unstable.vimPlugins.nvim-treesitter-parsers.c + pkgs-unstable.vimPlugins.nvim-treesitter-parsers.bibtex + pkgs-unstable.vimPlugins.nvim-treesitter-parsers.bash + pkgs-unstable.vimPlugins.nvim-treesitter-parsers.gitignore + pkgs-unstable.vimPlugins.nvim-treesitter-parsers.comment + pkgs-unstable.vimPlugins.nvim-treesitter-parsers.json + pkgs-unstable.vimPlugins.nvim-treesitter-parsers.hyprlang + pkgs-unstable.vimPlugins.nvim-treesitter-parsers.lua + pkgs-unstable.vimPlugins.nvim-treesitter-parsers.latex + pkgs-unstable.vimPlugins.nvim-treesitter-parsers.kitty + pkgs-unstable.vimPlugins.nvim-treesitter-parsers.markdown + pkgs-unstable.vimPlugins.nvim-treesitter-parsers.nix + pkgs-unstable.vimPlugins.nvim-treesitter-parsers.printf + pkgs-unstable.vimPlugins.nvim-treesitter-parsers.python + pkgs-unstable.vimPlugins.telescope-nvim + pkgs-unstable.vimPlugins.nvim-scrollbar + pkgs-unstable.vimPlugins.promise-async + pkgs-unstable.vimPlugins.nvim-ufo + pkgs-unstable.vimPlugins.cheatsheet-nvim + pkgs-unstable.vimPlugins.popup-nvim + pkgs-unstable.vimPlugins.vim-visual-multi + pkgs-unstable.vimPlugins.fugit2-nvim + pkgs-unstable.vimPlugins.nvim-lastplace + pkgs-unstable.vimPlugins.runner-nvim # terminal + pkgs-unstable.vimPlugins.better-diagnostic-virtual-text + pkgs-unstable.vimPlugins.garbage-day-nvim + ]; + extraLuaConfig = '' + + local vim = vim + + -- ========================= + -- LEADER & KEY DISABLE + -- ========================= + vim.g.mapleader = ' ' + vim.g.maplocalleader = ' ' + vim.keymap.set({'n', 'v'}, '', '', { desc = 'Leader key, disable default behavior' }) + vim.keymap.set('n', 'q', '', { desc = 'Disable macro recording' }) + vim.keymap.set('n', 'gg', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'gG', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'g0', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'g^', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'g$', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'gj', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'gk', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'g~', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'gu', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'gU', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'g=', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'gq', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'g@', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'g?', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'gC', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'gD', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'gx', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'gr', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'g[', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'g]', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'g;', '', { desc = 'Disable g motion' }) + vim.keymap.set('n', 'g,', '', { desc = 'Disable g motion' }) + -- ========================= + -- GENERAL OPTIONS + -- ========================= + vim.g.have_nerd_font = true + vim.opt.relativenumber = false + vim.opt.number = true + vim.opt.mouse = 'a' + vim.opt.showmode = false + vim.schedule(function() + vim.opt.clipboard = 'unnamedplus' + end) + vim.opt.breakindent = true + vim.opt.undofile = true + vim.opt.ignorecase = true + vim.opt.smartcase = true + vim.opt.signcolumn = 'yes' + vim.opt.updatetime = 250 + vim.opt.timeoutlen = 300 + vim.opt.splitright = true + vim.opt.splitbelow = true + vim.opt.list = true + vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } + vim.opt.expandtab = true + vim.opt.smartindent = true + vim.opt.tabstop = 4 + vim.opt.shiftwidth = 4 + vim.opt.inccommand = 'split' + vim.opt.cursorline = true + vim.opt.scrolloff = 10 + + + -- ========================= + -- BASIC KEYMAPS + -- ========================= + vim.keymap.set('n', '', 'nohlsearch') + vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) + + -- Disable arrow keys in normal mode + vim.keymap.set('n', '', 'echo "Use h to move!!"') + vim.keymap.set('n', '', 'echo "Use l to move!!"') + vim.keymap.set('n', '', 'echo "Use k to move!!"') + vim.keymap.set('n', '', 'echo "Use j to move!!"') + + -- Window navigation + vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) + vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) + vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) + vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) + + -- Cheatsheet + vim.keymap.set("n","§", "Cheatsheet") + require("cheatsheet").setup({ + bundled_cheatsheets = { enabled = { "default" } }, + bundled_plugin_cheatsheets = { disabled = { "gitsigns.nvim" } } + }) + + -- Highlight yanked text + vim.api.nvim_create_autocmd('TextYankPost', { + desc = 'Highlight on yank', + group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), + callback = function() vim.highlight.on_yank() end, + }) + + -- ======================== + -- terminal + -- ======================= + require("runner-nvim").setup({ + position = 'right', -- position of the terminal window when using the shell_handler + -- can be: top, left, right, bottom + -- will be overwritten when using the telescope mapping to open horizontally or vertically + + width = 80, -- width of window when position is left or right + height = 10, -- height of window when position is top or bottom + + handlers = { + lua = function(bufnr) + vim.print('Running lua file in buffer ' .. bufnr) + -- Run the file here + end + } + }) + + vim.keymap.set("n", "", function() require("runner-nvim").run() end) + -- ========================= + -- SCROLLBAR + -- ========================= + require("scrollbar").setup() + + -- ========================= + -- UFO FOLDING + -- ========================= + vim.o.foldcolumn = '1' + vim.o.foldlevel = 99 + vim.o.foldlevelstart = 99 + vim.o.foldenable = true + vim.keymap.set('n', '1', "foldopen") + vim.keymap.set('n', '2', "foldclose") + require('ufo').setup({ + provider_selector = function() return {'treesitter', 'indent'} end + }) + + -- ========================= + -- treesitter + -- ======================== + require('nvim-treesitter').setup({ + ensure_installed = {}, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + indent = { enable = true }, + }) + -- ========================= + -- NVIM-TREE + -- ========================= + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + require("nvim-tree").setup({ + sort = { sorter = "case_sensitive" }, + view = { width = 30 }, + renderer = { group_empty = true }, + filters = { dotfiles = true }, + }) + + -- ========================= + -- CMP CONFIGURATION + -- ========================= + local cmp = require'cmp' + cmp.setup({ + snippet = { expand = function(args) vim.fn["vsnip#anonymous"](args.body) end }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ { name = 'nvim_lsp' }, { name = 'vsnip' } }, { { name = 'buffer' } }), + }) + + cmp.setup.cmdline({ '/', '?' }, { mapping = cmp.mapping.preset.cmdline(), sources = { { name = 'buffer' } } }) + cmp.setup.cmdline(':', { mapping = cmp.mapping.preset.cmdline(), sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }), matching = { disallow_symbol_nonprefix_matching = false } }) + + -- ========================= + -- LSP CONFIGURATION + -- ========================= + local capabilities = require('cmp_nvim_lsp').default_capabilities() + + -- Diagnostics + vim.keymap.set("n", "e4", function() vim.diagnostic.jump({ prev=true, count = 1 }) end, { desc = "Previous diagnostic" }) + vim.keymap.set("n", "e5", function() vim.diagnostic.jump({ prev=false, count = 1 }) end, { desc = "Next diagnostic" }) + vim.keymap.set("n", "e1", vim.diagnostic.open_float, { desc = "Show diagnostic" }) + vim.keymap.set("n", "e3", vim.diagnostic.setloclist, { desc = "Diagnostic list" }) + vim.keymap.set("n", "e2", vim.lsp.buf.code_action, { desc = "Show correction" }) + + vim.keymap.set("n", "e", function() + local clients = vim.lsp.get_clients({ name = "ltex" }) + + if #clients > 0 then + -- Stop LTeX + for _, client in ipairs(clients) do + client.stop() + end + print("LTeX OFF") + else + -- Start LTeX + vim.cmd("LspStart ltex") + print("LTeX ON") + end + end, { desc = "Toggle LTeX" }) + + vim.diagnostic.config({ + update_in_insert = false, -- i don't get any new error when in insert + }) + require("better-diagnostic-virtual-text").setup({ + ui = { + wrap_line_after = false, -- wrap the line after this length to avoid the virtual text is too long + left_kept_space = 3, --- the number of spaces kept on the left side of the virtual text, make sure it enough to custom for each line + right_kept_space = 3, --- the number of spaces kept on the right side of the virtual text, make sure it enough to custom for each line + arrow = "  ", + up_arrow = "  ", + down_arrow = "  ", + above = false, -- the virtual text will be displayed above the line + }, + priority = 2003, -- the priority of virtual text + inline = false, + + }) + + + -- LSP functionality + vim.keymap.set("n", "g1", vim.lsp.buf.hover, { desc = "Hover documentation" }) + vim.keymap.set("n", "g2", vim.lsp.buf.definition, { desc = "Go to definition" }) + vim.keymap.set("n", "g3", vim.lsp.buf.declaration, { desc = "Go to declaration" }) + vim.keymap.set("n", "g4", vim.lsp.buf.implementation, { desc = "Go to implementation" }) + vim.keymap.set("n", "g5", vim.lsp.buf.references, { desc = "Show references" }) + + -- LSP server setup + vim.lsp.config("lua_ls", { cmd = { "lua-language-server" }, filetypes = { "lua" }, root_dir = vim.fs.dirname, on_attach = on_attach }) + vim.lsp.config("clangd", { + cmd = { "clangd", "--header-insertion=never" }, + filetypes = { "c","cpp","objc","objcpp" }, + on_attach = on_attach , + init_options = { + + clangdFileStatus = true, + usePlaceholders = true, + completeUnimported = false, -- this adds a bunch of #include even thought they are #included in another header file + headerInsertion = false, + headerInsertionDecorators = false, + addDependencyHeaders = false, + semanticHighlighting = true} + }) + vim.lsp.config("nixd", { + cmd = { "nixd" }, + filetypes = { "nix" }, + on_attach = on_attach, + }) + vim.lsp.config("pylsp", { + cmd = { "pylsp" }, + filetypes = { "python" }, + on_attach = on_attach, + settings = { + pylsp = { + plugins = { + pylsp_mypy = { enabled = true }, + jedi_completion = { fuzzy = true } + } + } + } + }) + vim.lsp.config("texlab", { cmd = { "texlab" }, filetypes = { "tex" }, on_attach = on_attach }) + vim.lsp.config("ltex", { + cmd = { "ltex-ls-plus" }, + filetypes = { "markdown", "text", "tex", "plaintex" }, + on_attach = on_attach, + + settings = { + ltex = { + language = "fr", + + enabled = { + "markdown", + "text", + "tex", + "plaintex", + }, + + completionEnabled = true, + diagnosticSeverity = "information", + + additionalRules = { + enablePickyRules = false, + motherTongue = "fr", + }, + + dictionary = { + ["fr"] = { + "icelle", + "icelui", + "iceux", + "maldoror", + "evariste", + "galois", + "arno", + "dessacrer", + }, + }, + }, + }, + }) + + vim.lsp.enable({ "lua_ls", "clangd", "pylsp", "texlab", "nixd", "ltex"}) + -- ========================= + -- DASHBOARD + -- ========================= + require('dashboard').setup { + theme = 'hyper', + config = { + header = { + " ... ... . ", + " .=*8888n..\"%888: @88> ", + " X ?8888f '8888 u. ... .. %8P .. . : ", + " 88x. '8888X 8888> .u ...ue888b :~\"\"888h.:^\"888: . .888: x888 x888. ", + "'8888k 8888X '\"*8h. ud8888. 888R Y888r 8X `8888X 8888> .@88u ~`8888~'888X`?888f` ", + " \"8888 X888X .xH8 :888'8888. 888R I888> X888n. 8888X ?888> '\"888E` X888 888X '888> ", + " `8\" X888!:888X d888 '88%\" 888R I888> '88888 8888X ?**h. 888E X888 888X '888> ", + " =~` X888 X888X 8888.+\" 888R I888> `*88 8888~ x88x. 888E X888 888X '888> ", + " :h. X8*` !888X 8888L u8888cJ888 ..<\" 88*` 88888X 888E X888 888X '888> ", + " X888xX\" '8888..: '8888c. .+ \"*888*P\" ..XC. `*8888k 888& \"*88%\"\"*88\" '888!` ", + ":~`888f '*888*\" \"88888% 'Y\" :888888H. `%88> R888\" `~ \" `\"` ", + " \"\" `\"` \"YP' < `\"888888: X\" \"\" ", + " %888888x.-` ", + " \"\"**\"\" ", + "", + "" + }, + shortcut = { { desc = " Open File Tree", group = "", key = 't', action = 'NvimTreeOpen' } }, + packages = { enable = false }, + project = { enable = true, limit = 8, icon = ' New file', action = 'Telescope find_files cwd=' }, + mru = { limit = 10, icon = ' History' }, + footer = {}, + } + } + + -- jumps cursor when was last cursor last time + require("nvim-lastplace").setup({ + -- Filetypes to ignore + ignore_filetypes = { + "gitcommit", "gitrebase", "svn", "hgcommit", "xxd", "COMMIT_EDITMSG" + }, + + -- Buffer types to ignore + ignore_buftypes = { + "quickfix", "nofile", "help", "terminal" + }, + + -- Center cursor after jumping + center_on_jump = true, + + -- Only jump if target line is not visible + jump_only_if_not_visible = false, + + -- Minimum lines required to enable jumping + min_lines = 10, + + -- Maximum line to jump to (0 = no limit) + max_line = 0, + + -- Open folds after jumping + open_folds = true, + + -- Enable debug messages + debug = false, + }) + -- ====================== + -- gruvbox + -- ====================== + + require("gruvbox").setup({ + terminal_colors = false, -- add neovim terminal colors + undercurl = true, + underline = true, + bold = true, + italic = { + strings = false, + emphasis = true, + comments = true, + operators = false, + folds = true, + }, + strikethrough = true, + invert_selection = false, + invert_signs = false, + invert_tabline = false, + inverse = true, -- invert background for search, diffs, statuslines and errors + contrast = "hard", -- can be "hard", "soft" or empty string + palette_overrides = { -- for overrides see https://github.com/ellisonleao/gruvbox.nvim/blob/main/lua/gruvbox.lua + dark0_hard = "#241F17" + }, + overrides = { + String = {fg = "#FFB878", italic = false}, + FoldColumn = {fg = faded_orange, bg = dark0_hard} + }, + dim_inactive = false, + transparent_mode = false, + }) + vim.opt.termguicolors = false + vim.o.background = "dark" + vim.cmd("colorscheme gruvbox") + -- ========================= + -- LUALINE + -- ========================= + require('lualine').setup { options = { theme = "gruvbox_dark" } } + + + --==================0 + -- Some utils + --================== + vim.keymap.set('n', 'r1', 'Fugit2', { desc = 'Open git helper' }) + + vim.keymap.set("n", "t", function() + local line = vim.api.nvim_get_current_line() + + local result = vim.fn.system({ "custom-syllabes" }, line) + + print(vim.trim(result)) + end, { desc = "Count syllables (current line)" }) + -- ========================= + -- telescope + -- ======================= + local builtin = require('telescope.builtin') + vim.keymap.set('n', 'f1', builtin.find_files, { desc = 'Telescope find files' }) + vim.keymap.set('n', 'f2', builtin.live_grep, { desc = 'Telescope live grep' }) + vim.keymap.set('n', 'f3', builtin.buffers, { desc = 'Telescope buffers' }) + vim.keymap.set('n', 'f4', builtin.help_tags, { desc = 'Telescope help tags' }) + + -- Disable relative numbers even if plugins override + vim.api.nvim_create_autocmd("VimEnter", { callback = function() vim.opt.colorcolumn = ""; vim.opt.relativenumber = false end }) + ''; + }; + }; +} diff --git a/modules/applications/obsidian.nix b/modules/applications/obsidian.nix new file mode 100644 index 0000000..f343224 --- /dev/null +++ b/modules/applications/obsidian.nix @@ -0,0 +1,126 @@ +{ ... }: { + # obsidian is unused -> see my project https://github.com/tomasriveral/NoteWrapper + flake.homeModules.obsidian = { ... }: { + programs.obsidian = { + enable = true; + + vaults = { + miscellanious = { + enable = true; + target = "/Documents/Notes/miscellanious"; + }; + work = { + enable = true; + target = "/Documents/Notes/work"; + }; + }; + + defaultSettings = { + appearance.theme = "gruvbox"; + + extraFiles = { + ".obsidian/themes/gruvbox/manifest.json" = ../../other/obsidian-theme/manifest.json; + ".obsidian/themes/gruvbox/obsidian.css" = ../../other/obsidian-theme/obsidian.css; + ".obsidian/themes/gruvbox/theme.css" = ../../other/obsidian-theme/theme.css; + }; + }; + }; + }; + flake.packages.custom-obsidianbackup = {pkgs, ...}: + pkgs.writeShellApplication { + name = "custom-obsidianbackup"; + runtimeInputs = with pkgs; [ + rclone + libnotify + rsync + ]; + text = '' + #!/usr/bin/env bash + + SOURCE_DIR="$HOME/Documents/Notes" + DEST_DIR="$HOME/kdrive/Notes" + BACKUP_DIR="$HOME/.Notes.backup" + + mkdir -p "$DEST_DIR" + mkdir -p "$BACKUP_DIR" + + while true; do + # Timestamp for this run + TIMESTAMP=$(date +%Y-%m-%d_%H-%M) + TIMESTAMPED_BACKUP="$BACKUP_DIR/$TIMESTAMP" + mkdir -p "$TIMESTAMPED_BACKUP" + + echo "[$(date)] Starting Obsidian backup..." + + # Check rclone mount + status=$(rclone about kdrive: 2>&1 || true) + if [[ "$status" =~ .*CRITICAL.* ]]; then + echo "[$(date)] rclone failed:" + echo "$status" + notify-send -u critical "rclone failed" \ + "rclone might be broken or you need to deactivate this script in HomeManager." + else + # Run rsync with verbose debugging + echo "[$(date)] Running rsync..." + rsync -Lavh --progress --update --backup --backup-dir="$TIMESTAMPED_BACKUP" \ + --exclude='.obsidian/cache/**' \ + "$SOURCE_DIR/" "$DEST_DIR/" + + echo "[$(date)] Backup completed for this run." + fi + + # Safely remove backups older than 30 days + if [[ -d "$BACKUP_DIR" && "$BACKUP_DIR" == "$HOME/.Notes.backup" ]]; then + echo "[$(date)] Cleaning old backups..." + find "$BACKUP_DIR/" -mindepth 1 -maxdepth 1 -type d -mtime +30 -exec rm -rf {} \; + else + echo "[$(date)] Backup directory not safe. Skipping cleanup." + fi + + # Wait 1 hour + echo "[$(date)] Sleeping for 1 hour..." + sleep 3600 + done + ''; + }; + # this might be broken after dendritic nix. As it searched for the obsidian.nix to get list of vaults + flake.packages.custom-obsidianvaults = {pkgs, ...}: + pkgs.writeShellApplication { + name = "custom-obsidianvaults"; + runtimeInputs = with pkgs; [ + zsh + fzf + ripgrep + ]; + text = '' + # Path to your obsidian.nix + obsidian_nix="$HOME/nixos/modules/home-manager/obsidian.nix" + + # Extract vault names without line numbers and colors + mapfile -t vaults < <(rg -N --color=never -Po 'vaults\.\K[[:alnum:]_]+' "$obsidian_nix") + + # Let user select a vault with fzf + selected=$(printf "%s\n" "''${vaults[@]}" \ + | fzf --height 6 --reverse --prompt="Select Obsidian vault:") + + # Exit if user cancels + [[ -z "$selected" ]] && exit 0 + + # Remove any stray ANSI codes (optional) + selected=$(echo "$selected" | sed -r 's/\x1B\[[0-9;]*[mK]//g') + + # Find the target path of the selected vault + vault_path=$(rg -N --color=never -A2 "vaults.$selected" "$obsidian_nix" \ + | rg 'target =' | sed -E 's/.*"([^"]+)".*/\1/') + + # Expand ~ if present + vault_path="''${vault_path/#\~/$HOME}" + + # Launch Obsidian with the selected vault using URI + [[ -n "$vault_path" ]] && setsid xdg-open "obsidian://open?vault=$selected" >/dev/null 2>&1 & + # Exit the kitty terminal after selection + pkill -f "kitty.*Select Obsidian vault" + exit + ''; + }; +} diff --git a/modules/applications/oh-my-posh.nix b/modules/applications/oh-my-posh.nix new file mode 100644 index 0000000..7a031f9 --- /dev/null +++ b/modules/applications/oh-my-posh.nix @@ -0,0 +1,9 @@ +{ ... }: { + flake.homeModules.oh-my-posh = { ... }: { + programs.oh-my-posh = { + enable = true; + enableZshIntegration = true; + useTheme = "gruvbox"; + }; + }; +} diff --git a/modules/applications/quickshell.nix b/modules/applications/quickshell.nix new file mode 100644 index 0000000..688d14b --- /dev/null +++ b/modules/applications/quickshell.nix @@ -0,0 +1,125 @@ +{ ... }: +{ + flake.homeModules.quickshell = { ... }: { + # pulled from https://codeberg.org/zacoons/rivendell-hyprdots + # replaced by caelestia-shell + qt.enable = true; + programs.quickshell = { + systemd.enable = true; + enable = true; + }; + home.file.".config/quickshell" = { + source = ../../other/quickshell; + recursive = true; + }; + }; + flake.packages.QS-notifycache = {writeShellApplication, ...}: + # creates and maintains cache file for the notification history + writeShellApplication { + name = "QS-notifycache"; + text = '' + CACHE="$HOME/.cache/notify_history" + # Create or erase existing cache + mkdir -p "$(dirname "$CACHE")" + : > "$CACHE" # truncate file + echo "Notification history initialized at $(date)" >> "$CACHE" + ''; + }; + flake.packages.QS-notifyhistory = {writeShellApplication, ...}: + writeShellApplication { + name = "QS-notifyhistory"; + text = '' + app="$1" + title="$2" + body="$3" + date="$(date +%T)" + urgency="$4" + + case "$urgency" in + 0) urgency_text="low";; + 1) urgency_text="normal";; + 2) urgency_text="critical";; + *) urgency_text="unknown";; + esac + { + echo "$app" + echo "$title" + echo "$body" + echo "$date" + echo "$urgency_text" + + } >> "$HOME/.cache/notify_history" + ''; + }; + flake.packages.QS-sysinfo = { pkgs, ... }: + pkgs.writeShellApplication { + name = "QS-sysinfo"; + runtimeInputs = with pkgs; [ + ripgrep + gawkInteractive + iproute2 + coreutils + procps + upower + ]; + text = '' + # Pad CPU, MEM, DISK to 2 chars (right-aligned) + + cpu=$(awk '/^cpu /{printf("%.0f", ($2+$4)*100/($2+$4+$5))}' /proc/stat) + cpu=$(printf "%2s" "$cpu") + + sum=0 + count=0 + + for f in /sys/class/hwmon/hwmon*/temp*_input; do + if [ -r "$f" ]; then + val=$(cat "$f" 2>/dev/null) || continue + sum=$((sum + val)) + count=$((count + 1)) + fi + done + + temp=$(( sum / count / 1000 )) + + sum=0 + count=0 + + for f in /sys/class/hwmon/hwmon*/fan*_input; do + if [ -r "$f" ]; then + val=$(cat "$f" 2>/dev/null) || continue + sum=$((sum + val)) + count=$((count + 1)) + fi + done + fan=$(( sum / count )) + fan=$(printf "%4s" "$fan") + + mem=$(free | awk '/Mem:/ {printf("%.0f",$3/$2*100)}') + mem=$(printf "%2s" "$mem") + + disk=$(df / | awk 'NR==2 {gsub("%",""); print $5}') + disk=$(printf "%2s" "$disk") + + # Pad POWER to 5 chars (XX.XX) + power=$(upower -b | awk -F: '/energy-rate/ {gsub(/^[ \t]+/, "", $2); split($2,a," "); printf("%.2f", a[1])}') + power=$(printf "%5s" "$power") + + # network calculations + iface=$(ip route get 1.1.1.1 | awk '{print $5; exit}') + + rx1=$(cat "/sys/class/net/$iface/statistics/rx_bytes") + tx1=$(cat "/sys/class/net/$iface/statistics/tx_bytes") + + sleep 1 + + rx2=$(cat "/sys/class/net/$iface/statistics/rx_bytes") + tx2=$(cat "/sys/class/net/$iface/statistics/tx_bytes") + + down_speed=$(( (rx2 - rx1) / 1024 )) + up_speed=$(( (tx2 - tx1) / 1024 )) + + # Output JSON + echo "{\"cpu\":\"$cpu\",\"temp\":\"$temp\",\"fan\":\"$fan\",\"mem\":\"$mem\",\"disk\":\"$disk\",\"power\":\"$power\",\"down\":\"$down_speed\",\"up\":\"$up_speed\"}" + ''; + }; +} diff --git a/modules/applications/ripgrep.nix b/modules/applications/ripgrep.nix new file mode 100644 index 0000000..00c43dc --- /dev/null +++ b/modules/applications/ripgrep.nix @@ -0,0 +1,16 @@ +{ ... }: { + flake.homeModules.ripgrep = { ... }: { + programs.ripgrep = { + enable = true; + arguments = [ + "-S" + "-." + "-p" + "-n" + ]; + }; + programs.ripgrep-all = { + enable = true; + }; + }; +} diff --git a/modules/applications/rofi.nix b/modules/applications/rofi.nix new file mode 100644 index 0000000..bebe4f2 --- /dev/null +++ b/modules/applications/rofi.nix @@ -0,0 +1,8 @@ +{ ... }: { + flake.homeModules.rofi = { ... }: { + programs.rofi = { + enable = true; + theme = "gruvbox-dark-hard"; + }; + }; +} diff --git a/modules/applications/sbb-tui.nix b/modules/applications/sbb-tui.nix new file mode 100644 index 0000000..d9efec4 --- /dev/null +++ b/modules/applications/sbb-tui.nix @@ -0,0 +1,31 @@ +{ ... }: { + flake.homeModules.sbb-tui = { pkgs-unstable, ... }: { + home.packages = [ + pkgs-unstable.sbb-tui + ]; + home.file.".config/sbb-tui/config.yaml" = { + enable = true; + # Gruvbox (from https://github.com/Necrom4/sbb-tui/blob/master/docs/themes.md) + text = '' + ui: + nerdfont: true + theme: + text: "#EBDBB2" + textMuted: "#928374" + error: "#FB4934" + warning: "#FB4934" + borderFocused: "#FABD2F" + borderUnfocused: "#504945" + badgeKeyFg: "#282828" + badgeKeyBg: "#FABD2F" + badgeVehicleFg: "#EBDBB2" + badgeVehicleBg: "#458588" + badgeModelFg: "#282828" + badgeModelBg: "#FB4934" + badgeCompanyFg: "#282828" + badgeCompanyBg: "#EBDBB2" + logo: "#EBDBB2" + ''; + }; + }; +} diff --git a/modules/applications/ssh.nix b/modules/applications/ssh.nix new file mode 100644 index 0000000..36542f5 --- /dev/null +++ b/modules/applications/ssh.nix @@ -0,0 +1,27 @@ +{ ... }: { + flake.homeModules.ssh = { ... }: { + programs.ssh = { + enable = true; + enableDefaultConfig = false; # will be removed in the futur. Removes evaluation warning + matchBlocks."*" = { + # equivalent to the default config + forwardAgent = false; + addKeysToAgent = "no"; + compression = false; + serverAliveInterval = 0; + serverAliveCountMax = 3; + hashKnownHosts = false; + userKnownHostsFile = "~/.ssh/known_hosts"; + controlMaster = "no"; + controlPath = "~/.ssh/master-%r@%n:%p"; + controlPersist = "no"; + }; + }; + services.ssh-agent.enable = true; + home.file.".ssh/config".text = '' + Host * + AddKeysToAgent yes + IdentityFile ~/.ssh/id_ed25519 + ''; + }; +} diff --git a/modules/applications/swayUtils.nix b/modules/applications/swayUtils.nix new file mode 100644 index 0000000..02d04e3 --- /dev/null +++ b/modules/applications/swayUtils.nix @@ -0,0 +1,44 @@ +{ ... }: { + # replaced by caelestia + flake.homeModules.swaync = { ... }: { + services.swaync = { + enable = true; + }; + }; + flake.homeModules.swaylock = { ... }: { + programs.swaylock = { + enable = true; + settings = { + color = "1e1e2e"; + bs-hl-color = "f5e0dc"; + caps-lock-bs-hl-color = "f5e0dc"; + caps-lock-key-hl-color = "a6e3a1"; + inside-color = "00000000"; + inside-clear-color = "00000000"; + inside-caps-lock-color = "00000000"; + inside-ver-color = "00000000"; + inside-wrong-color = "00000000"; + key-hl-color = "a6e3a1"; + layout-bg-color = "00000000"; + layout-border-color = "00000000"; + layout-text-color = "cdd6f4"; + line-color = "00000000"; + line-clear-color = "00000000"; + line-caps-lock-color = "00000000"; + line-ver-color = "00000000"; + line-wrong-color = "00000000"; + ring-color = "b4befe"; + ring-clear-color = "f5e0dc"; + ring-caps-lock-color = "fab387"; + ring-ver-color = "89b4fa"; + ring-wrong-color = "eba0ac"; + separator-color = "00000000"; + text-color = "cdd6f4"; + text-clear-color = "f5e0dc"; + text-caps-lock-color = "fab387"; + text-ver-color = "89b4fa"; + text-wrong-color = "eba0ac"; + }; + }; + }; +} diff --git a/modules/applications/thunderbird.nix b/modules/applications/thunderbird.nix new file mode 100644 index 0000000..c386e47 --- /dev/null +++ b/modules/applications/thunderbird.nix @@ -0,0 +1,10 @@ +{ ... }: { + flake.homeModules.thunderbird = { ... }: { + programs.thunderbird = { + enable = true; + profiles.tomasr = { + isDefault = true; + }; + }; + }; +} diff --git a/modules/applications/vivify.nix b/modules/applications/vivify.nix new file mode 100644 index 0000000..21136fb --- /dev/null +++ b/modules/applications/vivify.nix @@ -0,0 +1,28 @@ +{ ... }: { + flake.homeModules.vivify = {pkgs-unstable, ...}: { + home.file.".config/vivify/config.json" = { + enable = true; + text = '' + { + "browserOptions": { + "name": "qutebrowser", + "arguments": ["-T"] + } + }''; + }; + home.packages = [ + pkgs-unstable.vivify + ]; + programs.qutebrowser = { + enable = true; + settings = { + auto_save.session = false; + changelog_after_upgrade = "never"; + content.cookies.accept = "never"; + }; + extraConfig = '' + config.bind('', 'yank url ;; message-info "URL copied"') + ''; + }; + }; +} diff --git a/modules/applications/waybar.nix b/modules/applications/waybar.nix new file mode 100644 index 0000000..f068922 --- /dev/null +++ b/modules/applications/waybar.nix @@ -0,0 +1,716 @@ +{ ... }: +{ + flake.homeModules.waybar = { ... }: { + # replaced by caelestia + programs.waybar = { + enable = true; + settings = [ + { + layer = "top"; + position = "left"; + margin = "5 2 5 0"; + reload_style_on_change = true; + modules-left = [ + "hyprland/workspaces" + "group/info" + "group/power" + ]; + modules-center = [ + ]; + modules-right = [ + "hyprland/window" + "group/brightness" + "group/sound" + "group/connection" + "group/together" + "tray" + "battery" + ]; + # groups settings are organized by alphabetical order + "group/audio" = { + orientation = "inherit"; + drawer = { + transition-duration = 500; + transition-left-to-right = false; + }; + modules = [ + "pulseaudio" + "pulseaudio#mic" + "pulseaudio/slider" + ]; + }; + "group/bluetooth" = { + orientation = "inherit"; + drawer = { + transition-duration = 500; + transition-left-to-right = true; + }; + modules = [ + "bluetooth" + "bluetooth#status" + ]; + }; + "group/brightness" = { + orientation = "inherit"; + drawer = { + transition-duration = 500; + transition-left-to-right = false; + }; + modules = [ + "backlight" + "backlight/slider" + ]; + }; + "group/connection" = { + orientation = "inherit"; + modules = ["group/network"]; + }; + "group/gcpu" = { + orientation = "inherit"; + modules = [ + "custom/cpu-icon" + "temperature" + "cpu" + ]; + }; + "group/info" = { + orientation = "inherit"; + modules = [ + "group/gcpu" + "memory" + "disk" + ]; + }; + "group/network" = { + orientation = "inherit"; + drawer = { + transition-duration = 500; + transition-left-to-right = true; + }; + modules = [ + "network" + "network#speed" + ]; + }; + "group/power" = { + orientation = "inherit"; + modules = [ + "battery#w" + "battery#powerdraw" + ]; + }; + "group/sound" = { + orientation = "inherit"; + modules = [ + "group/audio" + "custom/notification" + ]; + }; + "group/together" = { + orientation = "inherit"; + modules = [ + "group/utils" + "clock" + ]; + }; + "group/utils" = { + orientation = "inherit"; + drawer = { + transition-duration = 500; + transition-left-to-right = true; + }; + modules = [ + "custom/weather" + "custom/colorpicker" + ]; + }; + # modules settings are organized by alphabetical order + backlight = { + device = "intel_backlight"; # my laptop is amd and it works + format = "{icon}"; + format-icons = [ + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + ]; + on-scroll-down = "brightnessctl s 5%-"; + on-scroll-up = "brightness s +5%"; + tooltip = true; + tooltip-format = "Brightness: {percent}%"; + smooth-scrolling-threshold = 1; + }; + "backlight/slider" = { + min = 5; + max = 100; + orientation = "vertical"; + device = "intel_backlight"; + }; + battery = { + #rotate = 90; + interval = 30; + states = { + good = 95; + warning = 20; + critical = 15; + }; + format = "{icon} {capacity}"; + format-charging = "{icon} {capacity}% "; + format-full = "{icon}"; + format-icons = [ + "󰁻" + "󰁼" + "󰁾" + "󰂀" + "󰂂" + "󰁹" + ]; + tooltip-format = "{timeTo} {capacity} %"; + }; + "battery#powerdraw" = { + rotate = 90; + interval = 10; + format = "{power:.0001f}"; + }; + "battery#w" = { + rotate = 90; + interval = 100000; + format = "W"; + }; + bluetooth = { + format-on = ""; + format-off = "󰂲"; + format-disabled = ""; + format-connected = ""; + tooltip-format = "{controller_alias}\t{controller_address}\n\n{num_connections} connected"; + tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}"; + tooltip-format-enumerate-connected = "{device_alias}\t{device_address}"; + tooltip-format-enumerate-connected-battery = "{device_alias}\t{device_address}\t{device_battery_percentage}%"; + }; + "bluetooth#status" = { + format-on = ""; + format-off = ""; + format-disabled = ""; + format-connected = "{num_connections}"; + format-connected-battery = "{device_battery_percentage}%"; + tooltip-format = "{controller_alias}\t{controller_address}\n\n{num_connections} connected"; + tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}"; + tooltip-format-enumerate-connected = "{device_alias}\t{device_address}"; + tooltip-format-enumerate-connected-battery = "{device_alias}\t{device_address}\t{device_battery_percentage}%"; + }; + clock = { + format = "{:%H\n%M}"; + tooltip-format = "{calendar}"; + calendar = { + mode = "month"; + mode-mon-col = 3; + weeks-pos = "right"; + on-scroll = 1; + on-click-right = "mode"; + format = { + today = "{}"; + }; + }; + }; + cpu = { + format = "{usage}%"; + }; + "custom/colorpicker" = { + format = ""; + on-click = "hyprpicker | tee >(wl-copy) | cliphist store"; + }; + "custom/cpu-icon" = { + format = "󰻠"; + tooltip = false; + }; + "custom/mark" = { + format = ""; + tooltip = false; + }; + "custom/weather" = { + format = "{}"; + interval = 3600; + exec = "custom-weatherwaybar"; + return-type = "json"; + }; + disk = { + interval = 600; + format = " 󰋊 \n{percentage_used}󱉸"; + path = "/"; #maybe we should subtract ~/kdrive if it is counted + }; + "hyprland/window" = { + format = "{class}"; + rotate = 90; + }; + "hyprland/workspaces" = { + format = "{icon}"; + format-icons = { + "1" = ""; + "2" = ""; + "3" = ""; + "4" = ""; + "5" = ""; + "6" = ""; + "7" = ""; + "8" = ""; + "9" = ""; + "10" = ""; + "active" = ""; + "default" = ""; + }; + persistent-workspaces = { + "*" = [1 2 3 4 5 6 7 8 9 10]; + }; + }; + idle_inhibitor = { + format = "{icon}"; + tooltip-format-activated = "Idle Inhibitor is active"; + tooltip-format-deactivated = "Idle Inhibitor is not active"; + format-icons = { + activated = "󰔡"; + deactivated = "󰔢"; + }; + }; + memory = { + format = "  \n{:2}󱉸"; + }; + network = { + format = "{icon}"; + format-icons = { + wifi = ["󰤨"]; + ethernet = ["󰈀"]; + disconnected = ["󰖪"]; + }; + format-wifi = "󰤨"; + format-ethernet = "󰈀"; + format-disconnected = "󰖪"; + format-linked = "󰈁"; + tooltip = false; + }; + "network#speed" = { + format = " {bandwidthDownBits} "; + rotate = 90; + interval = 5; + tooltip-format = "{ipaddr}"; + tooltip-format-wifi = "{essid} ({signalStrength}%)  \n{ipaddr} | {frequency} MHz{icon} "; + tooltip-format-ethernet = "{ifname} 󰈀 \n{ipaddr} | {frequency} MHz{icon} "; + tooltip-format-disconnected = "Not Connected to any type of Network"; + tooltip = true; + }; + power-profiles-daemon = { + format = "{icon}"; + tooltip-format = "Power profile: {profile}\nDriver: {driver}"; + tooltip = true; + format-icons = { + default = ""; + performance = ""; + balanced = ""; + power-saver = ""; + }; + }; + pulseaudio = { + format = "{icon}"; + format-bluetooth = "{icon}"; + tooltip-format = "{volume}% {icon} | {desc}"; + format-muted = "󰖁"; + format-icons = { + headphones = "󰋌"; + handsfree = "󰋌"; + headset = "󰋌"; + phone = ""; + portable = ""; + car = " "; + default = [ + "󰕿" + "󰖀" + "󰕾" + ]; + }; + on-click = "volume mute"; + on-click-middle = "pavucontrol"; + on-scroll-up = "pactl set-sink-volume @DEFAULT_SINK@ +5%"; + on-scroll-down = "pactl set-sink-volume @DEFAULT_SINK@ -5%"; + smooth-scrolling-threshold = 1; + }; + "pulseaudio#mic" = { + format = "{format_source}"; + format-source = ""; + format-source-muted = ""; + tooltip-format = "{volume}% {format_source}"; + on-click = "pactl set-source-mute 0 toggle"; + on-scroll-down = "pactl set-source-volume 0 -1%"; + on-scroll-up = "pactl set-source-volume 0 +1%"; + }; + "pulseaudio/slider" = { + min = 0; + max = 140; + orientation = "vertical"; + }; + temperature = { + format = "{temperatureC}°C"; + format-critical = "{temperatureC}°C"; + interval = 10; + }; + tray = { + icon-size = 18; + spacing = 10; + }; + } + ]; # home-manager wants the whole config as a list of bars + style = '' + @define-color foreground #c5c5c5; + @define-color background #191919; + @define-color cursor #c5c5c5; + + @define-color color0 #191919; + @define-color color1 #3a3632; + @define-color color2 #582c1e; + @define-color color3 #423f39; + @define-color color4 #50473c; + @define-color color5 #634723; + @define-color color6 #BAA470; + @define-color color7 #8c8c8c; + @define-color color8 #525252; + @define-color color9 #4e4843; + @define-color color10 #763b28; + @define-color color11 #59554c; + @define-color color12 #6b5f51; + @define-color color13 #855f2f; + @define-color color14 #796d62; + @define-color color15 #c5c5c5; + + @define-color active @color6; + + * { + font-size: 23px; + font-family: "0xProto Nerd Font"; + min-width: 8px; + min-height: 0px; + border: none; + border-radius: 0; + box-shadow: none; + text-shadow: none; + padding: 0px; + margin: 0px; + + } + + window#waybar { + transition-property: background-color; + transition-duration: 0.5s; + border-radius: 8px; + border: 2px solid @active; + background: @background; + background: alpha(@background, 0.7); + color: lighter(@active); + } + + menu, + tooltip { + border-radius: 8px; + padding: 2px; + border: 1px solid lighter(@active); + background: alpha(@background, 0.6); + + color: lighter(@active); + } + + menu label, + tooltip label { + font-size: 20px; + color: lighter(@active); + } + + #submap, + #tray>.needs-attention { + animation-name: blink-active; + animation-duration: 1s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; + } + + .modules-right { + margin: 0px 6px 6px 6px; + border-radius: 4px; + background: alpha(@background, 0.4); + color: lighter(@active); + } + + .modules-left { + transition-property: background-color; + transition-duration: 0.5s; + margin: 6px 6px 6px 6px; + border-radius: 4px; + background: alpha(@background, 0.4); + color: lighter(@active); + } + + #gcpu, + #custom-github, + #memory, + #disk, + #together, + #submap, + #custom-weather { + font-size: 17px; + } + + #custom-recorder, + #connection, + #cnoti, + #brightness, + #power, + #custom-updates, + #tray, + #audio, + #privacy, + #sound { + border-radius: 4px; + margin: 2px 2px 4px 2px; + background: alpha(darker(@active), 0.3); + } + + #custom-notifications { + padding-left: 4px; + } + + #custom-hotspot, + #custom-github, + #custom-notifications { + font-size: 20px; + } + + #custom-hotspot { + padding-right: 2px; + } + + #custom-vpn, + #custom-hotspot { + background: alpha(darker(@active), 0.3); + } + + #privacy-item { + padding: 6px 0px 6px 6px; + } + + #gcpu { + padding: 8px 0px 8px 0px; + } + + #custom-cpu-icon { + font-size: 36px; + } + + #custom-cputemp, + #temperature { + font-size: 17px; + } + #disk, + #memory, + #cpu { + font-size: 20px; + font-weight: bold; + } + + #custom-github { + padding-top: 2px; + padding-right: 4px; + } + + #custom-dmark { + color: alpha(@foreground, 0.3); + } + + #submap { + margin-bottom: 0px; + } + + #hyprland.window { + margin-left: 20px; + } + + #workspaces { + margin: 0px 2px; + padding: 4px 0px 0px 0px; + border-radius: 8px; + } + + #workspaces button { + transition-property: background-color; + transition-duration: 0.5s; + color: @foreground; + background: transparent; + border-radius: 4px; + color: alpha(@foreground, 0.3); + } + + #workspaces button.urgent { + font-weight: bold; + color: @foreground; + } + + #workspaces button.active { + padding: 4px 2px; + background: alpha(@active, 0.4); + color: lighter(@active); + border-radius: 4px; + } + + #network.wifi { + padding-right: 4px; + } + + #submap { + min-width: 0px; + margin: 4px 6px 4px 6px; + } + + #tray { + padding: 0px 0px 0px 0px; + } + + #bluetooth { + padding-top: 2px; + } + + #window { + border-radius: 8px; + padding: 4px 14px; + margin: 4px 2px 4px 2px; + } + + #battery { + font-size: 17px; + border-radius: 8px; + padding: 4px 0px; + margin: 4px 2px 4px 2px; + } + + #battery.discharging.warning { + animation-name: blink-yellow; + animation-duration: 1s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; + } + + #battery.discharging.critical { + animation-name: blink-red; + animation-duration: 1s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; + } + + #battery.powerdraw { + font-size: 17px; + padding: 0; + margin-right: -20px; + margin-left: -20px; + } + #battery.w { + font-size: 17px; + padding: 0; + margin-left: -20px; + margin-right: -20px; + } + + #clock { + font-weight: bold; + padding: 4px 2px 2px 2px; + } + + #pulseaudio.mic { + border-radius: 4px; + color: @background; + background: alpha(darker(@foreground), 0.6); + padding-left: 4px; + } + + #backlight-slider slider, + #pulseaudio-slider slider { + background-color: transparent; + box-shadow: none; + } + + #backlight-slider trough, + #pulseaudio-slider trough { + margin-top: 4px; + min-width: 6px; + min-height: 60px; + border-radius: 8px; + background-color: alpha(@background, 0.6); + } + + #backlight-slider highlight, + #pulseaudio-slider highlight { + border-radius: 8px; + background-color: lighter(@active); + } + + #bluetooth.discoverable, + #bluetooth.discovering, + #bluetooth.pairable { + border-radius: 8px; + animation-name: blink-active; + animation-duration: 1s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; + } + + @keyframes blink-active { + to { + background-color: @active; + color: @foreground; + } + } + + @keyframes blink-red { + to { + background-color: #c64d4f; + color: @foreground; + } + } + + @keyframes blink-yellow { + to { + background-color: #cf9022; + color: @foreground; + } + } + ''; + }; + }; + flake.packages.custom-weatherwaybar = { pkgs, ... }: + pkgs.writeShellApplication { + name = "custom-weatherwaybar"; + runtimeInputs = with pkgs; [ + curl + ]; + text = '' + PATTERN="C" + PATTERN2=" " + TEXT1="''$(curl -s "https://wttr.in/?format=%c")" + TEXT1=''${TEXT1/$PATTERN2/} + TEXT2="''$(curl -s "https://wttr.in/?format=%t")" + TEXT2=''${TEXT2/$PATTERN/} + TEXT3="''$(curl -s "https://wttr.in/?format=%f")" + TEXT3=''${TEXT3/$PATTERN/} + printf '{"text":" %s\\n %s\\n %s", "tooltip": false, "class": "weather"}\\n' \ + "$TEXT1" "$TEXT2" "$TEXT3" + ''; + }; +} diff --git a/modules/applications/wlogout.nix b/modules/applications/wlogout.nix new file mode 100644 index 0000000..53e55f8 --- /dev/null +++ b/modules/applications/wlogout.nix @@ -0,0 +1,118 @@ +{ ... }: { + # replaced by wlogout + flake.homeModules.wlogout = { ... }: let + wallpaper = ../../assets/wallpaper1.jpg; + lock = ../../assets/lock.png; + lock-hover = ../../assets/lock-hover.png; + shutdown = ../../assets/power.png; + shutdown-hover = ../../assets/power-hover.png; + logout = ../../assets/logout.png; + logout-hover = ../../assets/logout-hover.png; + reboot = ../../assets/restart.png; + reboot-hover = ../../assets/restart-hover.png; + in { + programs.wlogout = { + enable = true; + layout = [ + { + label = "lock"; + action = "swaylock -eFLfk -i ${wallpaper}"; + text = " Lock (L) "; + keybind = "l"; + } + { + label = "reboot"; + action = "systemctl reboot"; + text = " Reboot (R) "; + keybind = "r"; + } + { + label = "shutdown"; + action = "systemctl poweroff"; + text = "Shutdown (S)"; + keybind = "s"; + } + { + label = "logout"; + action = "loginctl terminate-session $(loginctl show-session $(loginctl | grep $USER | awk '{print $1}') -p Id --value)"; + text = " Logout (E) "; + keybind = "e"; + } + ]; + style = '' + window { + font-family: OxProto Nerd Font; + font-size: 14pt; + color: #000000; /* text */ + background-color: rgba(40, 40, 40, 0.76); + } + + button { + background-repeat: no-repeat; + background-position: center; + background-size: 50%; + border-style: solid; + border-radius: 4px; + border-width: 2px; + border-color: #ebdbb2; + background-color: rgba(40, 40, 40, 0.76); + margin: 10px; + transition: + box-shadow 0.3s ease-in-out, + background-color 0.3s ease-in-out; + } + + button:hover { + background-color: rgba(250, 137, 26, 0.3); + color: #282828; + } + + button:focus { + background-color: #ebdbb2; + color: #282828; + } + + #lock { + background-image: image(url("${lock}")); + } + #lock:focus { + background-image: image(url("${lock-hover}")); + } + #lock:hover { + background-image: image(url("${lock-hover}")); + } + + #logout { + background-image: image(url("${logout}")); + } + #logout:focus { + background-image: image(url("${logout-hover}")); + } + #logout:hover { + background-image: image(url("${logout-hover}")); + } + + + #shutdown { + background-image: image(url("${shutdown}")); + } + #shutdown:focus { + background-image: image(url("${shutdown-hover}")); + } + #shutdown:hover { + background-image: image(url("${shutdown-hover}")); + } + + #reboot { + background-image: image(url("${reboot}")); + } + #reboot:focus { + background-image: image(url("${reboot-hover}")); + } + #reboot:hover { + background-image: image(url("${reboot-hover}")); + } + ''; + }; + }; +} diff --git a/modules/applications/zoxide.nix b/modules/applications/zoxide.nix new file mode 100644 index 0000000..8d1fb12 --- /dev/null +++ b/modules/applications/zoxide.nix @@ -0,0 +1,8 @@ +{ ... }: { + flake.homeModules.zoxide = { ... }: { + programs.zoxide = { + enable = true; + enableZshIntegration = true; + }; + }; +} diff --git a/modules/applications/zsh.nix b/modules/applications/zsh.nix new file mode 100644 index 0000000..5a0b30f --- /dev/null +++ b/modules/applications/zsh.nix @@ -0,0 +1,88 @@ +{ self, ... }: { + flake.homeModules.zsh-laptop = { ... }: { + programs.zsh = { + shellAliases = { + snrt = "git -C ~/nixos add -A && time sudo nixos-rebuild test --flake ~/nixos/#laptop && pkill shell || true && pkill caelestia-shell || true && caelestia-shell -n > /dev/null 2>&1 & disown"; + snrs = "git -C ~/nixos add -A && time sudo nixos-rebuild switch --flake ~/nixos/#laptop && pkill shell || true && pkill caelestia-shell || true && caelestia-shell -n > /dev/null 2>&1 & disown"; + }; + }; + }; + flake.homeModules.zsh = {pkgs, ...}: { + home.packages = [ + self.packages.${pkgs.system}.dejaManuallyDerived + ]; + + programs.zsh = { + enable = true; + autosuggestion.enable = false; # zsh-autocomplete is replaced by deja + initContent = '' + # Safe cat that uses colorize plugin ccat + custom-cat() { + if [[ -t 1 ]]; then + ccat "$@" + else + command cat "$@" + fi + } + + custom-eza() { # behaves differently if we just call it or if we pipe initContent + if [[ -t 1 ]]; then + eza -hlF -aa --color=always --hyperlink --group-directories-first --show-symlinks --icons=always --git --no-permissions "$@" + else + command eza "$@" + fi + } + eval "$(direnv hook zsh)" + eval "$(deja init zsh)" + export PATH="$PATH:$HOME/NoteWrapper" # some project im coding + fastfetch''\n''; + shellAliases = { + ".." = "z .."; + grep = "rg"; + ll = "custom-eza"; # if there is a special ls just use the big eza + la = "custom-eza"; + l = "custom-eza"; + eza = "custom-eza"; + ls = "\\eza -a"; # ls -> normal ls. eza gives more info + tree = "\\eza -hlTF --color=always --hyperlink --group-directories-first --show-symlinks --icons=always --git --no-permissions"; + cat = "custom-cat"; + pomodoro = "custom-tomato"; + librewolf = "kitty --class \"custom-librewolfprofiles\" --name \"Select LibreWolf profile\" --hold custom-librewolfprofiles"; + manix = "custom-manix"; + man = "custom-man"; + mplayer = "mplayer -volume 5"; + # these are to create the developpement shell + cenv = "nix-shell -p zsh gcc raylib libx11 libGL"; + # i always write nvim wrong :( + nbim = "nvim"; + nivm = "nvim"; + bivm = "nvim"; + nibm = "nvim"; + vikm = "nvim"; + nvimm = "nvim"; + nnvim = "nvim"; + nvvim = "nvim"; + nviim = "nvim"; + }; + }; + }; + flake.homeModules.oh-my-zsh = { ... }: { + programs.zsh.oh-my-zsh = { + enable = true; + theme = "jonathan"; + plugins = [ + "aliases" + "alias-finder" + "colored-man-pages" + "colorize" + "command-not-found" + "dirhistory" + "fzf" + "git" + "rclone" + "safe-paste" + "sudo" + ]; + }; + }; +} diff --git a/modules/hardware/battery.nix b/modules/hardware/battery.nix new file mode 100644 index 0000000..b58ed99 --- /dev/null +++ b/modules/hardware/battery.nix @@ -0,0 +1,450 @@ +{ ... }: { + flake.nixosModules.battery-laptop = { + lib, + config, + ... + }: + # https://discourse.nixos.org/t/what-is-the-best-option-for-power-management/63406/2 + # we just activate tlp unconditonally + #let + # cfg = config.custom; + #hasBattery = + # lib.any (x: lib.strings.hasPrefix "BAT" x) + # (builtins.attrNames (builtins.readDir "/sys/class/power_supply")); + #in + { + # options.custom = { + # battery.enable = lib.mkOption { + # default = hasBattery; + # description = "Enable better battery support"; + # type = lib.types.bool; + # }; + # }; + + # config = lib.mkIf cfg.battery.enable { + powerManagement.powertop.enable = true; # enable powertop auto tuning on startup. + # Acording to https://community.frame.work/t/solved-keys-stick-and-repeat-after-being-released/51153/12 + # Some powertop bug is responsable for the problem of the random keypress being stuck + # fix: from https://git.gabbie.blue/blue/nixconf/src/commit/2d1bc6dad4684c019b6b3e894408e76e2734806c/hosts/gabbielaptop/configuration.nix#L68 + powerManagement.powertop.postStart = '' + ${lib.getExe' config.systemd.package "udevadm"} trigger -c bind -s usb -a idVendor=32ac -a idProduct=0018 + # Retrigger macropad udev rules + ${lib.getExe' config.systemd.package "udevadm"} trigger -c bind -s usb -a idVendor=32ac -a idProduct=0013 + ''; + services.system76-scheduler.settings.cfsProfiles.enable = true; # Better scheduling for CPU cycles - thanks System76!!! + services.thermald.enable = true; # Enable thermald, the temperature management daemon. (only necessary if on Intel CPUs) + services.power-profiles-daemon.enable = false; # Disable GNOMEs power management + services.tlp = { + enable = true; # Enable TLP (better than gnomes internal power manager) + settings = { + CPU_BOOST_ON_AC = 1; + CPU_BOOST_ON_BAT = 1; + CPU_HWP_DYN_BOOST_ON_AC = 1; + CPU_HWP_DYN_BOOST_ON_BAT = 1; + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; + CPU_ENERGY_PERF_POLICY_ON_BAT = "balance_power"; + PLATFORM_PROFILE_ON_AC = "performance"; + PLATFORM_PROFILE_ON_BAT = "balanced"; + START_CHARGE_THRESH_BAT1 = 75; + STOP_CHARGE_THRESH_BAT1 = 85; + }; + }; + # }; + }; + flake.packages.batteryNotify = { pkgs, ... }: let + NotifySound = ../../assets/battery_notify.mp3; + in + pkgs.writeShellApplication { + # taken and adapted https://github.com/miniMinn24/Battery_Notify with MIT License + + name = "custom-batterynotify"; + runtimeInputs = with pkgs; [ + mplayer + brightnessctl + ]; + text = '' + + # Delay for startup + sleep 5 + + # Change your sound path here + + playsound() { + mplayer ${NotifySound} + } + + adjustBrightness() { + local adjustment="$1" + brightnessctl set "$adjustment" + } + + sendNotification() { + local title="$1" + local message="$2" + notify-send -h string:x-canonical-private-synchronous:sys-notify -e -u low "$title" "$message" + } + + # Runs full time in background + x=0 + while true; do + Battery_Status="$(\cat /sys/class/power_supply/BAT*/status)" + Battery_Capacity=$(\cat /sys/class/power_supply/BAT*/capacity) + + case "$Battery_Status" in + "Discharging") + if [ $x -eq 1 ]; then + sendNotification "Discharging" "Remains: ''${Battery_Capacity}%" + adjustBrightness "15%-" + playsound + x=0 + fi + ;; + "Charging") + if [ $x -eq 0 ]; then + sendNotification "Charging" "Current: ''${Battery_Capacity}%" + adjustBrightness "15%+" + playsound + x=1 + fi + ;; + "Full") + if [ $x -eq 0 ]; then + sendNotification "Fully Charged" "Noice: ''${Battery_Capacity}%" + playsound + x=1 + fi + ;; + esac + + sleep 1 + done + ''; + }; + flake.packages.batteryWarning = { pkgs, ...}: let + NotifySound = ../../assets/battery_notify.mp3; + in + pkgs.writeShellApplication { + # taken and adapted https://github.com/miniMinn24/Battery_Notify with MIT License + name = "custom-batterywarning"; + runtimeInputs = with pkgs; [ + mplayer + brightnessctl + ]; + text = '' + + # Delay for startup + sleep 5 + + + playsound() { + mplayer ${NotifySound} + } + + + + while true; do + Battery_Status="$(cat /sys/class/power_supply/BAT*/status)" + Battery_Capacity="$(cat /sys/class/power_supply/BAT*/capacity)" + + if [ "$Battery_Status" == "Discharging" ]; then + if [ "$Battery_Capacity" -le 20 ] && [ "$Battery_Capacity" -ge 10 ]; then + notify-send -e -u critical "Battery Low!" "Power running out: ''${Battery_Capacity}%" + playsound + sleep 180 + + elif [ "$Battery_Capacity" -lt 10 ]; then + notify-send -e -u critical "Battery Low!" "Save your works before immediate shutdown." + playsound + sleep 180 + fi + else + sleep 120 + fi + done + ''; + }; + flake.packages.qtbatticon = { pkgs, ... }: + # because cbatticon, batticonplus and other things didn't work. + # chatGpt did this. + # https://chatgpt.com/c/69da11b3-ba24-8331-b7b0-a58a72e69d42 + # at your risk and perils + # click on the icon to get a notification with state, percentage and wattage + pkgs.stdenv.mkDerivation { + pname = "qtbatticon"; + version = "1.0"; + + src = pkgs.writeTextFile { + name = "qtbatticon.cpp"; + text = '' + #include + #include + #include + #include + #include + #include + #include + #include + #include + + QString readFile(const QString &path) { + QFile f(path); + if (!f.open(QIODevice::ReadOnly)) return ""; + QTextStream in(&f); + return in.readAll().trimmed(); + } + + int readInt(const QString &path) { + return readFile(path).toInt(); + } + + double readDouble(const QString &path) { + QFile f(path); + if (!f.open(QIODevice::ReadOnly)) return 0; + QTextStream in(&f); + return in.readAll().trimmed().toDouble(); + } + + int toStep(int capacity) { + return (capacity / 10) * 10; + } + + QString pad3(int n) { + return QString("%1").arg(n, 3, 10, QChar('0')); + } + + double getPowerW(const QString &batPath) { + double current_uA = readDouble(batPath + "/current_now"); + double voltage_uV = readDouble(batPath + "/voltage_now"); + + if (current_uA > 0 && voltage_uV > 0) { + return (current_uA * voltage_uV) / 1e12; + } + return -1; + } + + QIcon batteryIcon(int capacity, bool charging) { + int step = toStep(capacity); + QString num = pad3(step); + + QString base = "/run/current-system/sw/share/icons/Papirus/24x24/panel/"; + + QString file; + if (charging) { + file = base + "battery-" + num + "-charging.svg"; + } else { + file = base + "battery-" + num + ".svg"; + } + + QIcon icon(file); + + if (icon.isNull()) { + qDebug() << "FAILED icon:" << file; + icon = QIcon(base + "battery-100.svg"); + } + + return icon; + } + + void sendNotification(const QString &title, const QString &body) { + QString cmd = "notify-send \"" + title + "\" \"" + body + "\""; + system(cmd.toUtf8().constData()); + } + + int main(int argc, char *argv[]) { + QApplication app(argc, argv); + + QString batPath = "/sys/class/power_supply/BAT1"; + QSystemTrayIcon tray; + + auto updateIcon = [&]() { + int capacity = readInt(batPath + "/capacity"); + QString status = readFile(batPath + "/status"); + bool charging = status.contains("Charging"); + + tray.setIcon(batteryIcon(capacity, charging)); + }; + + auto notify = [&]() { + int capacity = readInt(batPath + "/capacity"); + QString status = readFile(batPath + "/status"); + + bool charging = status.contains("Charging"); + bool discharging = status.contains("Discharging"); + + double power = getPowerW(batPath); + + QString state; + if (charging) state = "Charging"; + else if (discharging) state = "Discharging"; + else state = status; + + QString powerStr = (power > 0.01) + ? QString::number(power, 'f', 2) + " W" + : "N/A"; + + QString msg = + QString("%1\n%2%\n%3") + .arg(state) + .arg(capacity) + .arg(powerStr); + + sendNotification("Battery status", msg); + }; + + QObject::connect(&tray, &QSystemTrayIcon::activated, + [&](QSystemTrayIcon::ActivationReason r) { + if (r == QSystemTrayIcon::Trigger) { + notify(); + } + }); + + updateIcon(); + tray.setVisible(true); + + QTimer timer; + QObject::connect(&timer, &QTimer::timeout, updateIcon); + timer.start(5000); + + return app.exec(); + } + ''; + }; + + nativeBuildInputs = with pkgs; [ + pkg-config + qt6.wrapQtAppsHook + ]; + + buildInputs = with pkgs; [ + qt6.qtbase + qt6.qtsvg + papirus-icon-theme + ]; + + dontUnpack = true; + + buildPhase = '' + g++ $src -o qtbatticon \ + $(pkg-config --cflags --libs Qt6Widgets) + ''; + + installPhase = '' + mkdir -p $out/bin + install -m755 qtbatticon $out/bin/ + ''; + }; + # This was replaced by caelestia shell's Game Mode + flake.packages.custom-performance = { pkgs, ...}: + pkgs.writeShellApplication { + name = "custom-performance"; + runtimeInputs = with pkgs; [ + hyprland + gawk + libnotify + ]; + text = '' + HYPRGAMEMODE=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}') + if [ "$HYPRGAMEMODE" = 1 ] ; then + hyprctl --batch "\ + keyword animations:enabled 0;\ + keyword animation borderangle,0; \ + keyword decoration:shadow:enabled 0;\ + keyword decoration:blur:enabled 0;\ + keyword decoration:fullscreen_opacity 1;\ + keyword general:gaps_in 0;\ + keyword general:gaps_out 0;\ + keyword general:border_size 1;\ + keyword decoration:rounding 0" + notify-send -u critical -t 5000 "Performance mode [ON]" + exit + else + notify-send -u critical -t 5000 "Performance mode [OFF]" + hyprctl reload + exit 0 + fi + ''; + }; + # Old script that was used for the battery. Might not work. + flake.packages.custom-olddeprecatedbatterynotify = { pkgs, ... }: + pkgs.writeShellApplication { + name = "custom-olddeprecatedbatterynotify"; + + runtimeInputs = with pkgs; [ + libnotify # provides notify-send + systemd # provides systemctl + ]; + + text = '' + set -euo pipefail + + LOW="''${BATTERY_LOW_THRESHOLD:-20}" + CRITICAL="''${BATTERY_CRITICAL_THRESHOLD:-5}" + FULL="''${BATTERY_FULL_THRESHOLD:-95}" + INTERVAL="''${BATTERY_INTERVAL:-30}" + ACTION="''${BATTERY_CRITICAL_ACTION:-systemctl suspend}" + + notify() { + notify-send -a "Battery" -u "$1" "$2" "$3" + } + + get_info() { + total=0 + count=0 + + for bat in /sys/class/power_supply/BAT*; do + [ -f "$bat/capacity" ] || continue + capacity=$(<"$bat/capacity") + status=$(<"$bat/status") + total=$((total + capacity)) + count=$((count + 1)) + done + + [ "$count" -gt 0 ] || exit 0 + percentage=$((total / count)) + } + + last_state="" + + while true; do + get_info + + if [[ "$status" == "Discharging" && "$percentage" -le "$CRITICAL" ]]; then + notify critical "Battery Critically Low" "$percentage% — suspending." + $ACTION + + elif [[ "$status" == "Discharging" && "$percentage" -le "$LOW" ]]; then + if [[ "$last_state" != "low" ]]; then + notify normal "Battery Low" "$percentage% remaining." + last_state="low" + fi + + elif [[ "$status" != "Discharging" && "$percentage" -ge "$FULL" ]]; then + if [[ "$last_state" != "full" ]]; then + notify normal "Battery Full" "$percentage% — unplug charger." + last_state="full" + fi + + else + last_state="" + fi + + sleep "$INTERVAL" + done + ''; + }; + flake.homeModules.cbatticon = { ... }: { + # don't works. some GTK error. I let it here if someday, someone is interest in this shit. + # ChatGPT half baked a replacement that works on my system. + # see qtbatticon + services.cbatticon = { + enable = true; + lowLevelPercent = 20; + criticalLevelPercent = 5; + batteryId = "BAT1"; + hideNotification = true; # we use another script for battery notifications + updateIntervalSeconds = 10; + }; + }; +} diff --git a/modules/hardware/bluetooth.nix b/modules/hardware/bluetooth.nix new file mode 100644 index 0000000..4b9e416 --- /dev/null +++ b/modules/hardware/bluetooth.nix @@ -0,0 +1,8 @@ +{ inputs, ...}: { + flake.nixosModule.bluetooth = {pkgs, ...}: { + hardware.bluetooth.enable = true; + environment.systemPackages = with pkgs; [ + blueman # GTK-based Bluetooth Manager + ]; + }; +} diff --git a/modules/hardware/bootloader.nix b/modules/hardware/bootloader.nix new file mode 100644 index 0000000..b2162f6 --- /dev/null +++ b/modules/hardware/bootloader.nix @@ -0,0 +1,16 @@ +{ ... }: { + flake.nixosModules.bootloader-laptop = { + inputs, + pkgs, + ... + }: { + # grub theme + boot.loader.grub = { + theme = inputs.nixos-grub-themes.packages.${pkgs.system}.nixos; # if you want to use nixos grub theme + }; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + }; +} diff --git a/modules/hardware/disk.nix b/modules/hardware/disk.nix new file mode 100644 index 0000000..64fc317 --- /dev/null +++ b/modules/hardware/disk.nix @@ -0,0 +1,18 @@ +{ ... }: { + flake.nixosModule.disk = { pkgs, ... }: { + environment.systemPackages = with pkgs; [ + gnome-disk-utility + udiskie + ]; + }; + flake.nixosModule.disk-laptop = { ... }: { + # i found swap necessary when running nixpkgs review + swapDevices = [ + { + device = "/swapfile"; + size = 16384; # 16 GB + } + ]; + boot.kernel.sysctl."vm.swappiness" = 10; + }; +} diff --git a/modules/hardware/hardware-configuration.nix b/modules/hardware/hardware-configuration.nix new file mode 100644 index 0000000..db5888b --- /dev/null +++ b/modules/hardware/hardware-configuration.nix @@ -0,0 +1,36 @@ +{ ... }: { + flake.nixosModules.hardware-configuration-laptop = { + config, + lib, + modulesPath, + ... + }: { + # Do not modify this file! It was generated by ‘nixos-generate-config’ + # and may be overwritten by future invocations. Please make changes + # to /etc/nixos/configuration.nix instead. + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "usbhid" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/6aa664c2-8b23-4e20-b6e9-1806bf0f8df2"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/A59A-7AFA"; + fsType = "vfat"; + options = ["fmask=0077" "dmask=0077"]; + }; + + swapDevices = []; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + }; +} diff --git a/modules/hardware/hardwareUtils.nix b/modules/hardware/hardwareUtils.nix new file mode 100644 index 0000000..358613c --- /dev/null +++ b/modules/hardware/hardwareUtils.nix @@ -0,0 +1,10 @@ +{ ... }: { + flake.nixosModules.hardwareUtils-laptop = {pkgs, ...}: { + environment.systemPackages = with pkgs; [ + # used for the framework 16 laptop + framework-tool + framework-tool-tui + vial # Open-source GUI and QMK fork for configuring your keyboard in real time + ]; + }; +} diff --git a/modules/hardware/udev.nix b/modules/hardware/udev.nix new file mode 100644 index 0000000..84f59f5 --- /dev/null +++ b/modules/hardware/udev.nix @@ -0,0 +1,22 @@ +{ ... }: { + flake.nixosModules.udev = { ... }: { + # udev with only the necessary rules. See udev.nix to get all the rules + services.udev.extraRules = '' + # adapted from here https://wiki.nixos.org/wiki/Keychron_M6 + KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="32ac", MODE="0660", GROUP="users", TAG+="uaccess" + + + # taken from here + SUBSYSTEMS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0013", TAG+="uaccess" + SUBSYSTEMS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0018", TAG+="uaccess" + + # acording to https://community.frame.work/t/solved-keys-stick-and-repeat-after-being-released/51153/12 + # the random keypress stuck comes from conflict between powertop and udev + # fix from: https://git.gabbie.blue/blue/nixconf/src/commit/2d1bc6dad4684c019b6b3e894408e76e2734806c/hosts/gabbielaptop/configuration.nix#L68 + # disable USB auto suspend for framework keyboard + ACTION=="bind", SUBSYSTEM=="usb", ATTR{idVendor}=="32ac", ATTR{idProduct}=="0018", TEST=="power/control", ATTR{power/control}="on" + # disable USB auto suspend for framework macropad + ACTION=="bind", SUBSYSTEM=="usb", ATTR{idVendor}=="32ac", ATTR{idProduct}=="0013", TEST=="power/control", ATTR{power/control}="on" + ''; + }; +} diff --git a/modules/home-manager/.OLDneovim.nix b/modules/home-manager/.OLDneovim.nix deleted file mode 100644 index ded0ff3..0000000 --- a/modules/home-manager/.OLDneovim.nix +++ /dev/null @@ -1,551 +0,0 @@ -# OLD Deprecated. -{ - config, - pkgs, - ... -}: -# same as ./neovim.nix but you vim plug. -# i tried importing my nvim config from fedora to a more nixy way but a lot of settings and plugins didnt work. Maybe i'll fix it latter -# the only difference is the we use :PlugInstall or a similar command before doing anything -{ - programs.neovim = { - enable = true; - vimAlias = true; - viAlias = true; - extraLuaConfig = '' - local vim = vim - -- local Plug = vim.fn['plug#'] - vim.g.mapleader ='ü' - vim.g.maplocalleader = 'ü' - - -- Set to true if you have a Nerd Font installed and selected in the terminal - vim.g.have_nerd_font = true - - -- [[ Setting options ]] - -- See `:help vim.opt` - -- NOTE: You can change these options as you wish! - -- For more options, you can see `:help option-list` - - -- Make line numbers default - -- You can also add relative line numbers, to help with jumping. - -- Experiment for yourself to see if you like it! - -- vim.opt.relativenumber = true - - -- Enable mouse mode, can be useful for resizing splits for example! - vim.opt.mouse = 'a' - - -- Don't show the mode, since it's already in the status line - vim.opt.showmode = true - - -- Sync clipboard between OS and Neovim. - -- Schedule the setting after `UiEnter` because it can increase startup-time. - -- Remove this option if you want your OS clipboard to remain independent. - -- See `:help 'clipboard'` - vim.schedule(function() - vim.opt.clipboard = 'unnamedplus' - end) - - - -- Enable break indent - vim.opt.breakindent = true - - -- Save undo history - vim.opt.undofile = true - - -- Case-insensitive searching UNLESS \C or one or more capital letters in the search term - vim.opt.ignorecase = true - vim.opt.smartcase = true - - -- Keep signcolumn on by default - vim.opt.signcolumn = 'yes' - - -- Decrease update time - vim.opt.updatetime = 250 - - -- Decrease mapped sequence wait time - -- Displays which-key popup sooner - vim.opt.timeoutlen = 300 - - -- Configure how new splits should be opened - vim.opt.splitright = true - vim.opt.splitbelow = true - - -- Sets how neovim will display certain whitespace characters in the editor. - -- See `:help 'list'` - -- and `:help 'listchars'` - vim.opt.list = true - vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } - - - - -- indentation settings - added by me - -- refere to https://stackoverflow.com/questions/51995128/setting-autoindentation-to-spaces-in-neovim for more information - vim.opt.expandtab = true - vim.opt.smartindent = true - vim.opt.tabstop = 4 - vim.opt.shiftwidth = 4 - - -- Preview substitutions live, as you type! - vim.opt.inccommand = 'split' - - -- Show which line your cursor is on - vim.opt.cursorline = true - - -- Minimal number of screen lines to keep above and below the cursor. - vim.opt.scrolloff = 10 - - -- [[ Basic Keymaps ]] - -- See `:help vim.keymap.set()` - - -- Clear highlights on search when pressing in normal mode - -- See `:help hlsearch` - vim.keymap.set('n', '', 'nohlsearch') - - -- Diagnostic keymaps - vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) - - -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier - -- for people to discover. Otherwise, you normally need to press , which - -- is not what someone will guess without a bit more experience. - -- - -- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping - -- or just use to exit terminal mode - vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) - - -- TIP: Disable arrow keys in normal mode - -- vim.keymap.set('n', '', 'echo "Use h to move!!"') - -- vim.keymap.set('n', '', 'echo "Use l to move!!"') - -- vim.keymap.set('n', '', 'echo "Use k to move!!"') - -- vim.keymap.set('n', '', 'echo "Use j to move!!"') - - -- Keybinds to make split navigation easier. - -- Use CTRL+ to switch between windows - -- - -- See `:help wincmd` for a list of all window commands - vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) - vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) - vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) - vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) - - -- jump to next error - vim.keymap.set("n", "t", vim.diagnostic.goto_prev) - vim.keymap.set("n", "z", vim.diagnostic.goto_next) - - - -- [[ Basic Autocommands ]] - -- See `:help lua-guide-autocommands` - - -- Highlight when yanking (copying) text - -- Try it with `yap` in normal mode - -- See `:help vim.highlight.on_yank()` - vim.api.nvim_create_autocmd('TextYankPost', { - desc = 'Highlight when yanking (copying) text', - group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), - callback = function() - vim.highlight.on_yank() - end, - }) - - --require("multiple-cursors").setup({ - -- version = "*", -- Use the latest tagged version - -- opts = {}, -- This causes the plugin setup function to be called - -- keys = { - -- {"", "MultipleCursorsAddDown", mode = {"n", "x"}, desc = "Add cursor and move down"}, - -- {"", "MultipleCursorsAddUp", mode = {"n", "x"}, desc = "Add cursor and move up"}, - -- - -- {"", "MultipleCursorsAddUp", mode = {"n", "i", "x"}, desc = "Add cursor and move up"}, - -- {"", "MultipleCursorsAddDown", mode = {"n", "i", "x"}, desc = "Add cursor and move down"}, - -- - -- {"", "MultipleCursorsMouseAddDelete", mode = {"n", "i"}, desc = "Add or remove cursor"}, - -- - -- {"m", "MultipleCursorsAddVisualArea", mode = {"x"}, desc = "Add cursors to the lines of the visual area"}, - -- - -- {"a", "MultipleCursorsAddMatches", mode = {"n", "x"}, desc = "Add cursors to cword"}, - -- {"A", "MultipleCursorsAddMatchesV", mode = {"n", "x"}, desc = "Add cursors to cword in previous area"}, - -- - -- {"d", "MultipleCursorsAddJumpNextMatch", mode = {"n", "x"}, desc = "Add cursor and jump to next cword"}, - -- {"D", "MultipleCursorsJumpNextMatch", mode = {"n", "x"}, desc = "Jump to next cword"}, - -- - -- {"l", "MultipleCursorsLock", mode = {"n", "x"}, desc = "Lock virtual cursors"}, - -- }, - --}) - - - vim.keymap.set("n","§", "Cheatsheet") - - require("cheatsheet").setup({ - bundled_cheatsheets = { - -- only show the default cheatsheet - enabled = { "default" }, - }, - bundled_plugin_cheatsheets = { - -- show cheatsheets for all plugins except gitsigns - disabled = { "gitsigns.nvim" }, - } - }) - - - - -- Can be applied to each buffer separately - - local default_options = { - ui = { - wrap_line_after = false, -- wrap the line after this length to avoid the virtual text is too long - left_kept_space = 3, --- the number of spaces kept on the left side of the virtual text, make sure it enough to custom for each line - right_kept_space = 3, --- the number of spaces kept on the right side of the virtual text, make sure it enough to custom for each line - arrow = "  ", - up_arrow = "  ", - down_arrow = "  ", - above = false, -- the virtual text will be displayed above the line - }, - priority = 2003, -- the priority of virtual text - inline = true, - } - - - -- scrollbar - require("scrollbar").setup() - - -- ufo https://github.com/kevinhwang91/nvim-ufo - vim.o.foldcolumn = '1' -- '0' is not bad - vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value - vim.o.foldlevelstart = 99 - vim.o.foldenable = true - - -- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself - vim.keymap.set('n', '1', "foldopen") - vim.keymap.set('n', '2', "foldclose") - vim.keymap.set('n', '3', "openAllFold") - vim.keymap.set('n', '4', " closeAllFold") - -- Option 3: treesitter as a main provider instead - -- (Note: the `nvim-treesitter` plugin is *not* needed.) - -- ufo uses the same query files for folding (queries//folds.scm) - -- performance and stability are better than `foldmethod=nvim_treesitter#foldexpr()` - --vim.keymap.set('n', '1', function() require("ufo").foldopen() end, {buffer=0}) - --vim.keymap.set('n', '2', function() require("ufo").foldclose() end) - - - - -- added by myself - require('ufo').setup({ - provider_selector = function(bufnr, filetype, buftype) - return {'treesitter', 'indent'} - end - }) - - -- Color schemes should be loaded after plug#end(). - vim.o.background = "dark" -- or "light" for light mode - -- Default options: - require("gruvbox").setup({ - terminal_colors = true, -- add neovim terminal colors - undercurl = true, - underline = true, - bold = true, - italic = { - strings = true, - emphasis = true, - comments = true, - operators = false, - folds = true, - }, - strikethrough = true, - invert_selection = false, - invert_signs = false, - invert_tabline = false, - invert_intend_guides = false, - inverse = true, -- invert background for search, diffs, statuslines and errors - contrast = "", -- can be "hard", "soft" or empty string - palette_overrides = {}, - overrides = {}, - dim_inactive = false, - transparent_mode = false, - }) - vim.cmd("colorscheme gruvbox") - -- nvim-tree https://github.com/nvim-tree/nvim-tree.lua - -- disable netrw at the very start of your init.lua - vim.g.loaded_netrw = 1 - vim.g.loaded_netrwPlugin = 1 - - -- optionally enable 24-bit colour - vim.opt.termguicolors = true - - - -- setup with some options - require("nvim-tree").setup({ - sort = { - sorter = "case_sensitive", - }, - view = { - width = 30, - }, - renderer = { - group_empty = true, - }, - filters = { - dotfiles = true, - }, - }) - vim.opt.number = true - -- Uncomment for opening the navigable tree file systeme on startup of NeoVim - --vim.cmd('NvimTreeOpen') - - require('md-pdf').setup({ - --- Set margins around document - margins = "1.5cm", - -- tango, pygments are quite nice for white on white - highlight = "tango", - -- Generate a table of contents, on by default - toc = true, - -- Define a custom preview command, enabling hooks and other custom logic - preview_cmd = function() return 'firefox' end, - -- if true, then the markdown file is continuously converted on each write, even if the - -- file viewer closed, e.g., firefox is "closed" once the document is opened in it. - ignore_viewer_state = false, - -- Specify font, `nil` uses the default font of the theme - fonts = nil, - -- or, where all or only some options can be specified. NOTE: those that are `nil` can be left - -- out completely - fonts = { - main_font = nil, - sans_font = "DejaVuSans", - mono_font = "IosevkaTerm Nerd Font Mono", - math_font = nil, - }, - -- Custom options passed to `pandoc` CLI call, can be ignored for setup - pandoc_user_args = nil, - -- or - pandoc_user_args = { - -- short - "-V KEY[:VALUE]", - -- long options - "--standalone=[true|false]", - }, - --- Path to output. Needs to be always relative, e.g.: "./", "../", "./out" or simply "out", but - --- not absolute e.g.: "/"! - output_path = "", - }) - - -- setup mapping - vim.keymap.set("n", ",", function() - require('md-pdf').convert_md_to_pdf() - end) - -- Set up nvim-cmp. - local cmp = require'cmp' - - cmp.setup({ - snippet = { - -- REQUIRED - you must specify a snippet engine - expand = function(args) - vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. - -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. - -- require('snippy').expand_snippet(args.body) -- For `snippy` users. - -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. - -- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+) - end, - }, - window = { - -- completion = cmp.config.window.bordered(), - -- documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'vsnip' }, -- For vsnip users. - -- { name = 'luasnip' }, -- For luasnip users. - -- { name = 'ultisnips' }, -- For ultisnips users. - -- { name = 'snippy' }, -- For snippy users. - }, { - { name = 'buffer' }, - }) - }) - - -- To use git you need to install the plugin petertriho/cmp-git and uncomment lines below - -- Set configuration for specific filetype. - --[[ cmp.setup.filetype('gitcommit', { - sources = cmp.config.sources({ - { name = 'git' }, - }, { - { name = 'buffer' }, - }) - }) - require("cmp_git").setup() ]]-- - - -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). - cmp.setup.cmdline({ '/', '?' }, { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = 'buffer' } - } - }) - - -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). - cmp.setup.cmdline(':', { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = 'path' } - }, { - { name = 'cmdline' } - }), - matching = { disallow_symbol_nonprefix_matching = false } - }) - - - -- require(lspconfig) is deprecated - -- -- Set up lspconfig. - -- local capabilities = require('cmp_nvim_lsp').default_capabilities() - -- -- Replace with each lsp server you've enabled. - -- require('lspconfig')['texlab'].setup { - -- capabilities = capabilities - -- } - --require'lspconfig'.clangd.setup{} - --lspconfig = require("lspconfig") - --lspconfig.pylsp.setup { - --on_attach = custom_attach, - --settings = { - -- pylsp = { - -- plugins = { - -- -- formatter options - -- black = { enabled = true }, - -- autopep8 = { enabled = false }, - -- yapf = { enabled = false }, - -- -- linter options - -- pylint = { enabled = true, executable = "pylint" }, - -- pyflakes = { enabled = false }, - -- pycodestyle = { enabled = false }, - -- -- type checker - -- pylsp_mypy = { enabled = true }, - -- -- auto-completion options - -- jedi_completion = { fuzzy = true }, - -- -- import sorting - -- pyls_isort = { enabled = true }, - -- }, - -- }, - --}, - --flags = { - -- debounce_text_changes = 200, - --}, - --capabilities = capabilities, - --} - ---- lua-lsp - --require'lspconfig'.lua_ls.setup{} - -- - --new version - -- ============================ - -- LSP CONFIGURATION (Neovim 0.11+) - -- ============================ - - -- Set up capabilities for nvim-cmp LSP completion - local capabilities = require('cmp_nvim_lsp').default_capabilities() - - -- Optional: custom on_attach function if you have keymaps - -- local custom_attach = function(client, bufnr) - -- -- your on_attach code here - -- end - - -- Utility function to simplify server setup - local function setup_lsp(server_name, opts) - vim.lsp.config(server_name, opts or {}) - end - - -- ======== LSP SERVERS ======== - - -- TeXLab - setup_lsp("texlab", { - capabilities = capabilities, - }) - - -- Clangd (C/C++) - setup_lsp("clangd", { - capabilities = capabilities, - }) - - -- Python LSP (pylsp) - setup_lsp("pylsp", { - on_attach = custom_attach, - capabilities = capabilities, - flags = { - debounce_text_changes = 200, - }, - settings = { - pylsp = { - plugins = { - -- Formatter options - black = { enabled = true }, - autopep8 = { enabled = false }, - yapf = { enabled = false }, - -- Linter options - pylint = { enabled = true, executable = "pylint" }, - pyflakes = { enabled = false }, - pycodestyle = { enabled = false }, - -- Type checker - pylsp_mypy = { enabled = true }, - -- Auto-completion options - jedi_completion = { fuzzy = true }, - -- Import sorting - pyls_isort = { enabled = true }, - }, - }, - }, - }) - - -- Lua LSP - setup_lsp("lua_ls", { - capabilities = capabilities, - }) - - - -- dashboard config - require('dashboard').setup { - theme = 'hyper', - config = { - header = { - " ... ... . ", - " .=*8888n..\"%888: @88> ", - " X ?8888f '8888 u. ... .. %8P .. . : ", - " 88x. '8888X 8888> .u ...ue888b :~\"\"888h.:^\"888: . .888: x888 x888. ", - "'8888k 8888X '\"*8h. ud8888. 888R Y888r 8X `8888X 8888> .@88u ~`8888~'888X`?888f` ", - " \"8888 X888X .xH8 :888'8888. 888R I888> X888n. 8888X ?888> '\"888E` X888 888X '888> ", - " `8\" X888!:888X d888 '88%\" 888R I888> '88888 8888X ?**h. 888E X888 888X '888> ", - " =~` X888 X888X 8888.+\" 888R I888> `*88 8888~ x88x. 888E X888 888X '888> ", - " :h. X8*` !888X 8888L u8888cJ888 ..<\" 88*` 88888X 888E X888 888X '888> ", - " X888xX\" '8888..: '8888c. .+ \"*888*P\" ..XC. `*8888k 888& \"*88%\"\"*88\" '888!` ", - ":~`888f '*888*\" \"88888% 'Y\" :888888H. `%88> R888\" `~ \" `\"` ", - " \"\" `\"` \"YP' < `\"888888: X\" \"\" ", - " %888888x.-` ", - " \"\"**\"\" ", - "", - "" - }, - shortcut = { - { desc = " Open File Tree", group = "", key = 't', action = 'NvimTreeOpen' }, - -- action can be a function type - }, - packages = { enable = false }, -- show how many plugins neovim loaded - -- limit how many projects list, action when you press key or enter it will run this action. - -- action can be a functino type, e.g. - -- action = func(path) vim.cmd('Telescope find_files cwd=' .. path) end - project = { enable = true, limit = 8, icon = ' New file', label = "", action = 'Telescope find_files cwd=' }, - mru = { limit = 10, icon = ' History', label = "", cwd_only = false }, - footer = {}, -- footer - } - } - - -- lualine config https://github.com/nvim-lualine/lualine.nvim/blob/master/examples/bubbles.lua - require('lualine').setup { - options = { theme = "gruvbox_dark" }, - } - local builtin = require('telescope.builtin') - vim.keymap.set('n', 'ff', builtin.find_files, { desc = 'Telescope find files' }) - vim.keymap.set('n', 'fg', builtin.live_grep, { desc = 'Telescope live grep' }) - vim.keymap.set('n', 'fb', builtin.buffers, { desc = 'Telescope buffers' }) - vim.keymap.set('n', 'fh', builtin.help_tags, { desc = 'Telescope help tags' }) - - ''; - }; -} diff --git a/modules/home-manager/anki.nix b/modules/home-manager/anki.nix deleted file mode 100644 index 9d91c71..0000000 --- a/modules/home-manager/anki.nix +++ /dev/null @@ -1,12 +0,0 @@ -_: { - programs.anki = { - # we enable system wide with nixpkgs because it offers some addon configuration. We just use this for some config - #enable = true; - theme = "dark"; - sync = { - autoSync = true; - autoSyncMediaMinutes = 10; - syncMedia = true; - }; - }; -} diff --git a/modules/home-manager/batsignal.nix b/modules/home-manager/batsignal.nix deleted file mode 100644 index ebf8cd8..0000000 --- a/modules/home-manager/batsignal.nix +++ /dev/null @@ -1,5 +0,0 @@ -_: { - services.batsignal = { - enable = true; - }; -} diff --git a/modules/home-manager/caelestia.nix b/modules/home-manager/caelestia.nix deleted file mode 100644 index b3475ee..0000000 --- a/modules/home-manager/caelestia.nix +++ /dev/null @@ -1,597 +0,0 @@ -_: let - sisyphe = ../../assets/sisyphe.gif; - pepe-music = ../../assets/pepe-music.gif; -in { - home.file.".local/state/caelestia/wallpaper/path.txt" = { - # dummy file. Does nothing. Prevent an error - enable = true; - text = "${sisyphe}"; - }; - home.file.".face" = { - # this is were caelestia will search for profiles pictures - source = ../../assets/sisyphePFP.png; - }; - # set profile picture in ~/.face - programs.caelestia = { - enable = true; - systemd = { - enable = false; # if we launch it form here, the keybinds don't work - target = "graphical-session.target"; - environment = []; - }; - settings = { - # default config https://github.com/caelestia-dots/shell?tab=readme-ov-file#example-configuration - appearance = { - mediaGifSpeedAdjustment = 500; - sessionGifSpeed = 0.7; - anim = { - duration = { - scale = 1; - }; - }; - /* - font = { - family = { - clock = "Rubik"; # (TODO figure out those fonts) - material = "Material Symboles Rounded"; - mono = "CaskaydiaCove NF"; - sans = "Rubik"; - }; - size = { - scale = 1; - }; - }; - */ - padding = { - scale = 1; - }; - rounding = { - scale = 1; - }; - spacing = { - scale = 1; - }; - transparency = { - enabled = false; - base = 0.85; - layeres = 0.4; - }; - }; - general = { - logo = "caelestia"; - apps = { - terminal = ["kitty"]; # default foot - audio = ["pavucontrol"]; - playback = ["vlc"]; # what's that? - explorer = ["dolphin"]; # default thunar - }; - battery = { - wanLevels = [ - { - level = 20; - title = "Low battery"; - message = "You might want to plug in a charger"; - icon = "battery_android_frame_2"; - } - { - level = 10; - title = "Did you see the previous message?"; - message = "You should probably plug in a charger now"; - icon = "battery_android_frame_1"; - } - { - level = 5; - title = "Critical battery level"; - message = "PLUG THE CHARGER RIGHT NOW!!"; - icon = "battery_android_alert"; - critical = true; - } - ]; - criticalLevel = 3; - }; - idle = { - lockBeforeSleep = true; - inhibitWhenAudio = true; - timeouts = [ - { - timeout = 180; - idleAction = "lock"; - } - { - timeout = 300; - idleAction = "dpms off"; # what's that? - returnAction = "dpms on"; - } - { - timeout = 600; - idleAction = ["systemctl" "suspend-then-hibernate"]; - } - ]; - }; - }; - background = { - desktopClock = { - enabled = false; - scale = 1.0; - position = "bottom-right"; - shadow = { - enabled = true; - opacity = 0.7; - blur = 0.4; - }; - background = { - enabled = false; - opacity = 0.7; - blur = true; - }; - invertColors = false; - }; - enabled = false; #default true - visualiser = { - blur = false; - enabled = false; - autohide = true; - rounding = 1; - spacing = 1; - }; - }; - bar = { - activeWindow = { - compact = false; - inverted = false; - showOnHover = true; - }; - clock = { - background = true; - showDate = true; - showIcon = true; - }; - dragThreshold = 20; - entries = [ - { - id = "logo"; - enabled = true; - } - { - id = "workspaces"; - enabled = true; - } - { - id = "spacer"; - enabled = true; - } - { - id = "activeWindow"; - enabled = true; - } - { - id = "spacer"; - enabled = true; - } - { - id = "tray"; - enabled = true; - } - { - id = "clock"; - enabled = true; - } - { - id = "statusIcon"; - enabled = true; - } - { - id = "power"; - enabled = true; - } - ]; - persistent = true; - popouts = { - activeWindow = true; - statusIcon = true; - tray = true; - }; - scrollActions = { - brightness = true; - workspaces = true; - volume = true; - }; - showOnHover = true; - status = { - showAudio = false; - showBattery = false; # use powerprofile daemon - showBluetooth = false; - showKbLayout = false; - showMicrophone = false; - showNetwork = false; - showWifi = true; - showLockStatus = false; - }; - tray = { - background = true; # default true - compact = false; - iconSubs = []; - recolour = true; - }; - workspaces = { - activeIndicator = true; - activeLabel = "󰮯"; - activeTrail = false; - label = " "; - occupiedBg = false; - occpiedLabel = "󰮯"; - perMonitorWorkspaces = true; - showWindows = true; - shown = 5; - specialWorkspaceIcons = [ - { - name = "steam"; - icon = "sports_esports"; - } - ]; - windowIcons = [ - { - regex = "steam(_app_(default|[0-9]+))?"; - icon = "sports_esports"; - } - ]; - }; - excludedScreens = [""]; # default says "" those this work? - }; - border = { - rounding = 25; - thickness = 10; - }; - dashboard = { - enabled = true; - dragThreshold = 50; - mediaUpdateInterval = 500; - showOnHover = true; - }; - launcher = { - actionsPrefix = ">"; - actions = [ - { - name = "Calculator"; - icon = "calculate"; - description = "Do simple math equations (powered by Qalc)"; - command = ["autocomplete" "calc"]; - enabled = false; # default true - dangerous = false; - } - { - name = "Scheme"; - icon = "palette"; - description = "Change the current colour scheme"; - command = ["autocomplete" "scheme"]; - enabled = false; # default true - dangerous = false; - } - { - name = "Wallpaper"; - icon = "image"; - description = "Change the current wallpaper"; - command = ["autocomplete" "wallpaper"]; - enabled = false; # default true - dangerous = false; - } - { - name = "Variant"; # to remove - icon = "colors"; - description = "Change the current scheme variant"; - command = ["autocomplete" "variant"]; - enabled = true; - dangerous = false; - } - { - name = "Transparency"; - icon = "opacity"; - description = "Change shell transparency"; - command = ["autocomplete" "transparency"]; - enabled = false; - dangerous = false; - } - { - name = "Random"; - icon = "casino"; - description = "Switch to a random wallpaper"; - command = ["caelestia" "wallpaper" "-r"]; - enabled = false; # default true - dangerous = false; - } - { - name = "Light"; - icon = "light_mode"; - description = "Change the scheme to light mode"; - command = ["setMode" "light"]; - enabled = false; # default true - dangerous = false; - } - { - name = "Dark"; - icon = "dark_mode"; - description = "Change the scheme to dark mode"; - command = ["setMode" "dark"]; - enabled = false; # default true - dangerous = false; - } - { - name = "Shutdown"; - icon = "power_settings_new"; - description = "Shutdown the system"; - command = ["systemctl" "poweroff"]; - enabled = true; - dangerous = true; - } - { - name = "Reboot"; - icon = "cached"; - description = "Reboot the system"; - command = ["systemctl" "reboot"]; - enabled = true; - dangerous = true; - } - { - name = "Lock"; # does this work with ly? - icon = "lock"; - description = "Log out of the current session"; - command = ["loginctl" "terminate-user" ""]; - enabled = true; - dangerous = true; - } - { - name = "Sleep"; - icon = "bedtime"; - description = "Suspend then hibernate"; - command = ["systemctl" "suspend-then-hibernate"]; - enabled = true; - dangerous = false; - } - { - name = "Settings"; - icon = "settings"; - description = "Configure the shell"; - command = ["caelestia" "shell" "controlCenter" "open"]; - enabled = false; # default true - dangerous = false; - } - ]; - dragThreshold = 50; - vimKeybinds = false; # intersting to put to true - enableDangerousActions = false; # set to true - maxShown = 7; - maxWallpapers = 9; - specialPrefix = "@"; - useFuzzy = { - # should try - apps = false; - actions = false; - schemes = false; - variants = false; - wallpapers = false; - }; - showOnHover = false; - favouriteApps = []; - hiddenApps = []; - }; - lock = { - recolourLogo = false; # what's that - hideNotifs = false; - }; - notifs = { - actionOnClick = false; - clearThreshold = 0.3; - defaultExpireTimeout = 5000; - expantThreshold = 20; - openeExpanded = false; - expire = true; - }; - osd = { - # thats the slider for brightness and sound - enabled = true; - enableBrightness = true; - enableMicrophone = false; - hideDelay = 2000; - }; - paths = { - mediaGif = pepe-music; # default "root:/assets/bongocat.gif" - sessionGif = sisyphe; # default "root:/assets/kurukuru.gif" - noNotifsPic = "root:/assets/dino.png"; - lockNoNotifsPic = "root:/assets/dino.png"; - wallpaperDir = "~/Pictures/Wallpapers"; - lyricsDir = "~/Music/lyrics"; - }; - services = { - audioIncrement = 0.1; - brightnessIncrement = 0.1; - maxVolume = 1.0; - defaultPlayer = "Spotify"; - gpuType = ""; - #playerAliases: [ { "from": "com.github.th_ch.youtube_music", "to": "YT Music" } ]; # how to put this into nix language? - weatherLocation = "Lausanne"; - useFahrenheit = false; - useFahrenheitPerformance = false; - useTwelveHourClock = false; - smartScheme = false; # default true - visualisersBars = 45; - }; - session = { - dragThreshold = 30; # what does dragThreshold do? - enabled = true; - vimKeybinds = false; # maybe set to true? - icons = { - logout = "logout"; - shutdown = "power_settings_new"; - hibernate = "downloading"; # find a better icon - reboot = "cached"; - }; - commands = { - logout = ["hyprctl" "dispatch exit"]; - shutdown = ["systemctl" "poweroff"]; - hibernate = ["systemctl" "hibernate"]; - reboot = ["systemctl" "reboot"]; - }; - }; - sidebar = { - dragThreshold = 80; - enabled = true; - }; - # is there a way to get some system info? - utilities = { - enabled = true; - maxToasts = 4; # toats are like notification but on the botto left - toasts = { - audioInputChanged = true; - audioOutputChanged = true; - capsLockChanged = true; - chargingChanged = true; - configLoaded = true; - dndChanged = true; - gameModeChanged = true; - kbLayoutChanged = true; - kbLimit = true; - numLockChanged = true; - vpnChanged = true; - nowPlaying = false; - }; - }; - vpn = { - enabled = false; # default true - provider = [ - { - # default example-configuration - name = "wireguard"; - interface = "your-connection-name"; - displayName = "wireguard (Your VPN)"; - enabled = false; - } - ]; - }; - quickToggles = [ - { - id = "wifi"; - enabled = true; - } - { - id = "bluetooth"; - enabled = true; - } - { - id = "mic"; - enabled = true; - } - { - id = "settings"; - enabled = true; # should desactivate - } - { - id = "gameMode"; - enabled = true; # should remap my performance mode - } - { - id = "dnd"; #do not disturb - enabled = true; - } - { - id = "vpn"; - enabled = false; # default true; - } - ]; - }; - cli = { - # default config https://github.com/caelestia-dots/cli?tab=readme-ov-file#configuring - enable = true; # Also add caelestia-cli to path - settings = { - record = { - extraArgs = []; - }; - wallpaper = { - postHook = "caelestia scheme set -n gruvbox -f soft -m dark"; # sets the theme - }; - theme = { - enableTerm = false; # we do it manually by adapting our kitty config - enableHypr = false; # this seems to add the splash - enableDiscord = true; - enableSpicetify = true; - enableFuzzel = true; #what's that? - enablleBtop = false; # default true - enableQt = true; - }; - toggles = { - communication = { - discord = { - enable = false; # default true - match = [ - { - class = "discord"; - } - ]; - whatsapp = { - enable = true; - match = [ - { - class = "whatsapp"; - } - ]; - }; - }; - }; - music = { - spotify = { - enable = false; # default true - match = [ - { - class = "Spotify"; - } - { - initialTitle = "Spotify"; - } - { - initialTitle = "Spotify Free"; - } - ]; - command = ["spicetify" "watch" "-s"]; - move = true; - }; - feishin = { - enable = true; - match = [ - { - class = "feishin"; - } - ]; - move = true; - }; - }; - sysmon = { - btop = { - enable = true; - match = [ - { - class = "btop"; - title = "btop"; - workspace = { - name = "special:sysmon"; - }; - } - ]; - command = ["foot" "-a" "btop" "-T" "btop" "fish" "-C" "exec btop"]; # maybe switch to btm and kitty? - }; - }; - todo = { - todoist = { - enable = false; # default true - match = [ - { - class = "Todoist"; - } - ]; - command = ["todoist"]; - move = true; - }; - }; - }; - }; - }; - }; -} diff --git a/modules/home-manager/cbatticon.nix b/modules/home-manager/cbatticon.nix deleted file mode 100644 index b919435..0000000 --- a/modules/home-manager/cbatticon.nix +++ /dev/null @@ -1,13 +0,0 @@ -# don't works. some GTK error. I let it here if someday, someone is interest in this shit. -# ChatGPT half baked a replacement that works on my system. -# see ../qt/qtbatticon -_: { - services.cbatticon = { - enable = true; - lowLevelPercent = 20; - criticalLevelPercent = 5; - batteryId = "BAT1"; - hideNotification = true; # we use another script for battery notifications - updateIntervalSeconds = 10; - }; -} diff --git a/modules/home-manager/cursor.nix b/modules/home-manager/cursor.nix deleted file mode 100644 index aa91337..0000000 --- a/modules/home-manager/cursor.nix +++ /dev/null @@ -1,9 +0,0 @@ -{pkgs, ...}: { - home.pointerCursor = { - hyprcursor.enable = true; - enable = true; - package = pkgs.capitaine-cursors-themed; - name = "Capitaine Cursors (Gruvbox)"; - size = 32; - }; -} diff --git a/modules/home-manager/eza.nix b/modules/home-manager/eza.nix deleted file mode 100644 index a04e29f..0000000 --- a/modules/home-manager/eza.nix +++ /dev/null @@ -1,114 +0,0 @@ -_: -# ls replacement -# see ./zsh.nix for the alias (usefull to se default flags) -{ - programs.eza = { - enable = true; - enableZshIntegration = true; - theme = { - # from https://github.com/eza-community/eza-themes/blob/main/themes/gruvbox-dark.yml - colourful = true; - - filekinds = { - normal = {foreground = "#ebdbb2";}; - directory = {foreground = "#83a598";}; - symlink = {foreground = "#8ec07c";}; - pipe = {foreground = "#928374";}; - block_device = {foreground = "#fb4934";}; - char_device = {foreground = "#fb4934";}; - socket = {foreground = "#665c54";}; - special = {foreground = "#d3869b";}; - executable = {foreground = "#b8bb26";}; - mount_point = {foreground = "#fe8019";}; - }; - perms = { - user_read = {foreground = "#ebdbb2";}; - user_write = {foreground = "#fabd2f";}; - user_execute_file = {foreground = "#b8bb26";}; - user_execute_other = {foreground = "#b8bb26";}; - group_read = {foreground = "#ebdbb2";}; - group_write = {foreground = "#fabd2f";}; - group_execute = {foreground = "#b8bb26";}; - other_read = {foreground = "#bdae93";}; - other_write = {foreground = "#fabd2f";}; - other_execute = {foreground = "#b8bb26";}; - special_user_file = {foreground = "#d3869b";}; - special_other = {foreground = "#928374";}; - attribute = {foreground = "#bdae93";}; - }; - size = { - major = {foreground = "#bdae93";}; - minor = {foreground = "#8ec07c";}; - number_byte = {foreground = "#ebdbb2";}; - number_kilo = {foreground = "#ebdbb2";}; - number_mega = {foreground = "#83a598";}; - number_giga = {foreground = "#d3869b";}; - number_huge = {foreground = "#d3869b";}; - unit_byte = {foreground = "#bdae93";}; - unit_kilo = {foreground = "#83a598";}; - unit_mega = {foreground = "#d3869b";}; - unit_giga = {foreground = "#d3869b";}; - unit_huge = {foreground = "#fe8019";}; - }; - users = { - user_you = {foreground = "#ebdbb2";}; - user_root = {foreground = "#fb4934";}; - user_other = {foreground = "#d3869b";}; - group_yours = {foreground = "#ebdbb2";}; - group_other = {foreground = "#928374";}; - group_root = {foreground = "#fb4934";}; - }; - links = { - normal = {foreground = "#8ec07c";}; - multi_link_file = {foreground = "#fe8019";}; - }; - git = { - new = {foreground = "#b8bb26";}; - modified = {foreground = "#fabd2f";}; - deleted = {foreground = "#fb4934";}; - renamed = {foreground = "#8ec07c";}; - typechange = {foreground = "#d3869b";}; - ignored = {foreground = "#928374";}; - conflicted = {foreground = "#cc241d";}; - }; - git_repo = { - branch_main = {foreground = "#ebdbb2";}; - branch_other = {foreground = "#d3869b";}; - git_clean = {foreground = "#b8bb26";}; - git_dirty = {foreground = "#fb4934";}; - }; - security_context = { - colon = {foreground = "#928374";}; - user = {foreground = "#ebdbb2";}; - role = {foreground = "#d3869b";}; - typ = {foreground = "#665c54";}; - range = {foreground = "#d3869b";}; - }; - file_type = { - image = {foreground = "#fabd2f";}; - video = {foreground = "#fb4934";}; - music = {foreground = "#b8bb26";}; - lossless = {foreground = "#8ec07c";}; - crypto = {foreground = "#928374";}; - document = {foreground = "#ebdbb2";}; - compressed = {foreground = "#d3869b";}; - temp = {foreground = "#cc241d";}; - compiled = {foreground = "#83a598";}; - build = {foreground = "#928374";}; - source = {foreground = "#83a598";}; - punctuation = {foreground = "#928374";}; - date = {foreground = "#fabd2f";}; - inode = {foreground = "#bdae93";}; - blocks = {foreground = "#a89984";}; - header = {foreground = "#ebdbb2";}; - octal = {foreground = "#8ec07c";}; - flags = {foreground = "#d3869b";}; - - symlink_path = {foreground = "#8ec07c";}; - control_char = {foreground = "#83a598";}; - broken_symlink = {foreground = "#fb4934";}; - broken_path_overlay = {foreground = "#928374";}; - }; - }; - }; -} diff --git a/modules/home-manager/fastfetch.nix b/modules/home-manager/fastfetch.nix deleted file mode 100644 index 4658bb0..0000000 --- a/modules/home-manager/fastfetch.nix +++ /dev/null @@ -1,174 +0,0 @@ -_: { - # Adapted from https://github.com/dacrab/fastfetch-config/blob/main/config.jsonc - programs.fastfetch = { - enable = true; - - settings = { - logo = { - type = "none"; - #source = "nixos"; - }; - - modules = [ - # ───────────── Hardware ───────────── - - { - type = "custom"; - format = "╭───────────────────────── Hardware ──────────────────────────╮"; - outputColor = "blue"; - } - - { - type = "title"; - key = " PC"; - keyColor = "green"; - } - - { - type = "host"; - key = "│ ├󰇅 Laptop"; - keyColor = "green"; - } - - { - type = "display"; - key = "│ ├󰍹 Display"; - keyColor = "green"; - } - - { - type = "cpu"; - key = "│ ├󰍛 CPU"; - showPeCoreCount = true; - format = "{1}"; - keyColor = "green"; - } - - { - type = "gpu"; - key = "│ ├󰍛 GPU"; - keyColor = "green"; - } - - { - type = "memory"; - key = "└ └󰍛 Memory"; - keyColor = "green"; - } - - { - type = "custom"; - format = "╰─────────────────────────────────────────────────────────────╯"; - outputColor = "blue"; - } - - # ───────────── Software ───────────── - - { - type = "custom"; - format = "╭───────────────────────── Software ──────────────────────────╮"; - outputColor = "blue"; - } - - { - type = "os"; - key = " OS"; - keyColor = "cyan"; - } - - { - type = "kernel"; - key = "│ ├ Kernel"; - keyColor = "cyan"; - } - - { - type = "packages"; - key = "│ ├󰏖 Packages"; - keyColor = "cyan"; - } - - { - type = "shell"; - key = "│ ├ Shell"; - keyColor = "cyan"; - } - - { - type = "terminal"; - key = "│ ├ Terminal"; - keyColor = "cyan"; - } - - { - type = "command"; - key = "│ ├ OS Age"; - keyColor = "cyan"; - text = '' - birth_install=$(stat -c %W /) - current=$(date +%s) - time_progression=$((current - birth_install)) - days_difference=$((time_progression / 86400)) - echo $days_difference days - ''; - } - - { - type = "uptime"; - key = "└ └ Uptime"; - keyColor = "cyan"; - } - - { - type = "de"; - key = " DE"; - keyColor = "blue"; - } - - { - type = "wm"; - key = " WM"; - keyColor = "magenta"; - } - - { - type = "gpu"; - key = "│ ├󰍛 GPU Driver"; - format = "{3}"; - keyColor = "magenta"; - } - - { - type = "brightness"; - key = "│ ├󰃟 Brightness"; - keyColor = "magenta"; - } - - { - type = "version"; - key = "└ └ FastFetch"; - keyColor = "magenta"; - } - - { - type = "custom"; - format = "╰────────────────────────────────────────────────────────────╯"; - outputColor = "blue"; - } - - #{ - # type = "custom"; - # format = '' - # {#0} {#1} {#2} {#3} {#4} {#5} {#6} {#7} - # ''; - #} #for some reason dont work - { - type = "colors"; - symbol = "diamond"; - } - - "break" - ]; - }; - }; -} diff --git a/modules/home-manager/git.nix b/modules/home-manager/git.nix deleted file mode 100644 index 0136aa5..0000000 --- a/modules/home-manager/git.nix +++ /dev/null @@ -1,12 +0,0 @@ -_: { - programs.git = { - enable = true; - settings = { - init.defaultBranch = "main"; - }; - }; - programs.gh = { - enable = true; - gitCredentialHelper.enable = true; - }; -} diff --git a/modules/home-manager/gtk.nix b/modules/home-manager/gtk.nix deleted file mode 100644 index 85a0b7c..0000000 --- a/modules/home-manager/gtk.nix +++ /dev/null @@ -1,12 +0,0 @@ -{pkgs, ...}: { - # gtk config - gtk.theme = { - enable = true; - Gruvbox-GTK-Theme-BL-MB = { - enable = true; - name = "Gruvbox-GTK-Theme-BL-MB"; - package = pkgs.gruvbox-gtk-theme; - }; - }; - # to resolve this https://wiki.nixos.org/wiki/Home_Manager#I_cannot_set_GNOME_or_Gtk_themes_via_Home_Manager -} diff --git a/modules/home-manager/hypridle.nix b/modules/home-manager/hypridle.nix deleted file mode 100644 index c6e049a..0000000 --- a/modules/home-manager/hypridle.nix +++ /dev/null @@ -1,20 +0,0 @@ -_: { - services.hypridle = { - enable = true; - settings = { - general = { - lock_cmd = "notify-send 'lock!'"; # dbus/sysd lock command (loginctl lock-session) - unlock_cmd = "notify-send 'unlock!'"; # same as above, but unlock - before_sleep_cmd = "notify-send 'Zzz'"; # command ran before sleep - after_sleep_cmd = "notify-send 'Awake!"; # command ran after sleep - ignore_dbus_inhibit = false; # whether to ignore dbus-sent idle-inhibit requests (used by e.g. firefox or steam) - ignore_systemd_inhibit = false; # whether to ignore systemd-inhibit --what=idle inhibitors - }; - listener = { - timeout = 500; # in seconds - on-timeout = "notify-send 'You are idle!'"; # command to run when timeout has passed - on-resume = "notify-send 'Welcome back!'"; # command to run when activity is detected after timeout has fired. - }; - }; - }; -} diff --git a/modules/home-manager/hyprland.nix b/modules/home-manager/hyprland.nix deleted file mode 100644 index 21121fa..0000000 --- a/modules/home-manager/hyprland.nix +++ /dev/null @@ -1,452 +0,0 @@ -{pkgs-unstable, ...}: let - wallpaper = ../../assets/wallpaper1.jpg; -in { - #refer to https://wiki.hypr.land/Nix/Hyprland-on-Home-Manager/ - wayland.windowManager.hyprland.enable = true; - wayland.windowManager.hyprland.package = pkgs-unstable.hyprland; - #hint Electron apps to use on wayland; - home.sessionVariables.NIXOS_OZONE_WL = "1"; - wayland.windowManager.hyprland.plugins = [ - #pkgs-unstable.hyprlandPlugins.hyprspace # currently broken - #pkgs-unstable.hyprlandPlugins.hypr-dynamic-cursors # currently broken - ]; - wayland.windowManager.hyprland.settings = { - "$mod" = "SUPER"; - "$term" = "kitty"; - "$editor" = "nvim"; - "$notes" = "kitty --class \"custom-obsidianvaults\" --name \"Select Obsidian vault\" --hold custom-obsidianvaults"; - "$file" = "dolphin"; - "$browser" = "kitty --class \"custom-librewolfprofiles\" --name \"Select LibreWolf profile\" --hold custom-librewolfprofiles"; - # ▄▀█ █▄░█ █ █▀▄▀█ ▄▀█ ▀█▀ █ █▀█ █▄░█ - # █▀█ █░▀█ █ █░▀░█ █▀█ ░█░ █ █▄█ █░▀█ - animations = { - enabled = true; - bezier = [ - "wind, 0.05, 0.9, 0.1, 1.05" - "winIn, 0.1, 1.1, 0.1, 1.1" - "winOut, 0.3, -0.3, 0, 1" - "liner, 1, 1, 1, 1" - ]; - animation = [ - "windows, 1, 6, wind, slide" - "windowsIn, 1, 6, winIn, slide" - "windowsOut, 1, 5, winOut, slide" - "windowsMove, 1, 5, wind, slide" - "border, 1, 1, liner" - "borderangle, 1, 30, liner, loop" - "fade, 1, 10, default" - "workspaces, 1, 5, wind" - ]; - }; - - # █▀▀ █▄░█ █░█ - # ██▄ █░▀█ ▀▄▀ - - # See https://wiki.hyprland.org/Configuring/Environment-variables/ - env = [ - "PATH, $PATH:$scrPath" - "XDG_CURRENT_DESKTOP,Hyprland" - "XDG_SESSION_TYPE,wayland" - "XDG_SESSION_DESKTOP,Hyprland" - "QT_QPA_PLATFORM,wayland;xcb" - "QT_QPAPLATFORMTHEME,qt6ct" - "QT_WAYLAND_DISABLE_WINDOWDECORATION,1" - "MOZ_ENABLE_WAYLAND,1" - "GDK_SCALE,1" - ]; - - # █ █▄░█ █▀█ █░█ ▀█▀ - # █ █░▀█ █▀▀ █▄█ ░█░ - - input = { - kb_layout = ["ch"]; - follow_mouse = 1; - sensitivity = 0; - force_no_accel = 1; - }; - - # █▄▀ █▀▀ █▄█ █▄▄ █ █▄░█ █▀▄ █ █▄░█ █▀▀ █▀ - # █░█ ██▄ ░█░ █▄█ █ █░▀█ █▄▀ █ █░▀█ █▄█ ▄█ - # caelestia shell drawers toggle dashboard - # caelestia shell drawers toggle utilities - - bind = [ - #hyprland/utility keybindings - "$mod, W, togglefloating" - "$mod, G, togglegroup" - "Alt, Return, fullscreen" - "$mod, Left, movefocus, l" - "$mod, Right, movefocus, r" - "$mod, Up, movefocus, u" - "$mod, Down, movefocus, d" - "Alt, Tab, movefocus, d" - "$mod, 1, workspace, 1" - "$mod, 2, workspace, 2" - "$mod, 3, workspace, 3" - "$mod, 4, workspace, 4" - "$mod, 5, workspace, 5" - "$mod, 6, workspace, 6" - "$mod, 7, workspace, 7" - "$mod, 8, workspace, 8" - "$mod, 9, workspace, 9" - "$mod, 0, workspace, 10" - "$mod+Ctrl, Right, workspace, r+1" - "$mod+Ctrl, Left, workspace, r-1" - "$mod+Ctrl, Doown, workspace, empty" - "$mod+Shift, 1, movetoworkspace, 1" - "$mod+Shift, 2, movetoworkspace, 2" - "$mod+Shift, 3, movetoworkspace, 3" - "$mod+Shift, 4, movetoworkspace, 4" - "$mod+Shift, 5, movetoworkspace, 5" - "$mod+Shift, 6, movetoworkspace, 6" - "$mod+Shift, 7, movetoworkspace, 7" - "$mod+Shift, 8, movetoworkspace, 8" - "$mod+Shift, 9, movetoworkspace, 9" - "$mod+Shift, 0, movetoworkspace, 10" - "$mod+Ctrl+Alt, Right, movetoworkspace, r+1" - "$mod+Ctrl+Alt, Left, movetoworkspace, r-1" - #"$mod, Backspace, exec, wlogout -b 4 -T 600 -B 600" - "$mod, Backspace, exec, caelestia shell drawers toggle session" - "$mod+Shift+Ctrl, Left, movewindow, l" - "$mod+Shift+Ctrl, Right, movewindow, r" - "$mod+Shift+Ctrl, Up, movewindow, u" - "$mod+Shift+Ctrl, Down, movewindow, d" - "$mod, mouse_down, workspace, e+1" - "$mod, mouse_up, workspace, e-1" - "$mod, V, exec, cliphist list | rofi -dmenu| cliphist decode | wl-copy" # copy paste - "$mod, B, exec, hyprkeys -bkr | rofi -dmenu" - #"$mod, A, tagwindow, noborder" # used to not apply image border - "$mod, S, togglespecialworkspace," - "Alt+$mod, S, movetoworkspace, special" - # for the scrolling layout - "$mod, A, layoutmsg, move -col" - "$mod, D, layoutmsg, move +col" - #apps keybindings - "$mod, T, exec, $term" - "$mod, E, exec, $file" - "$mod, F, exec, $browser" - "$mod, N, exec, $notes" - #"$mod+Shift, A, exec, rofi -show drun" - "$mod+Shift, A, exec, caelestia shell drawers toggle launcher" - "$mod, Q, exec, custom-dontkillsteam" - #"Ctrl+Alt, W, exec, pkill waybar || waybar" - "Ctrl+Alt, W, exec, caelestia shell drawers toggle sidebar" - #"$mod, L, exec, swaylock -eFLK -i ${wallpaper}" - "$mod, L, exec, caelestia shell lock lock" - #"$mod, F11, exec, hyprshot -m window" - ", F11, exec, caelestia screenshot" - #"$mod_SHIFT, S, exec, hyprshot -m region --clipboard only" - # "$mod_SHIFT, S, exec, qs ipc call screenshot toggle" - "$mod_SHIFT, S, exec, caelestia shell picker open" - # framework 16 rgb macropad - "Ctrl+$mod, 6, exec, custom-killall" # pos 1 1 killall apps except focused one - #"Ctrl+Alt, 7, exec, custom-performance" # pos 2 1 start performance mode - "Ctrl+Alt, 7, exec, caelestia shell gameMode toggle" - # reloads the autostart programs # pos 3 1 - # we passed to caelestia-shell and stoped using that - /* - "Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=16 -e sh -c 'custom-weather'" - "Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=11 -e sh -c 'custom-cowsay'" - "Ctrl+$mod, 4, exec, kitty -e 'custom-launch'" - "Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=5 -e btm --theme gruvbox --disable-click --disable_advanced_kill --enable_cache_memory -g -R -T " - "Ctrl+$mod, 4, exec, sleep 1 && kitty -o font_size=1 -e sh -c 'cmatrix -br'" - #"Ctrl+Alt, 1, exec, swaync-client -t" # pos 4 1 notification center - "Ctrl+Alt, 1, exec, qs ipc call notifications toggle" - */ - "Ctrl+Alt, 1, exec, caelestia shell drawers toggle sidebar" - "Ctrl+$mod, 4, exec, caelestia shell notifs toggleDnd" - "Ctrl+$mod, 3, exec, pavucontrol" # pos 1 2 audiocontrol - "Ctrl+Shift+Alt, 0, exec, kitty --hold --class \"custom-changeAudioOutput\" --name \"Select audio output\" zsh -c \"custom-changeAudioOutput\"" # pos 2 2 change audio output fzf - "Ctrl+$mod, 5, exec, gnome-characters" # pos 3 2 special chars - "Ctrl+Alt, 8, exec, hyprpicker | tee >(wl-copy) | cliphist store" # pos 4 2 colorpicker - "Ctrl+Alt, 0, exec, custom-tomato" # pos 1 3 pomodoro app - "Ctrl+Alt, 2, exec, custom-bottom" # pos 2 3 btm (like htop but cleaner) - "Ctrl+Alt, 9, exec, anki" - # if hyprexpo plugin enabled bind = $mainMod, Space, hyprexpo:expo, toggle - # maybe exec sudo framework-tools-tui - - #plugins keybindings - #"$mod, SPACE, overview:toggle, " - ]; - binde = [ - "$mod+Shift, Right, resizeactive, 30 0" - "$mod+Shift, Left, resizeactive, -30, 0" - "$mod+Shift, Up, resizeactive, 0 -30" - "$mod+Shift, Down, resizeactive,m 0 30" - ]; - bindl = [ - ", F1, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle" #toggle audio mute - ", F5, exec, playerctl play-pause" # media F4-F6 - ", F4, exec, playerctl previous" - ", F6, exec, playerctl next" - ]; - bindel = [ - ", F2, exec, pactl set-sink-volume @DEFAULT_SINK@ -10%" # decrease volume - ", F3, exec, pactl set-sink-volume @DEFAULT_SINK@ +10%" # increase volume - ", F7, exec, brightnessctl s 10%-" # decrease brightness - ", F8, exec, brightnessctl s +10%" # increase brightness - ]; - bindm = [ - "$mod, mouse:272, movewindow" - "$mod, mouse:273, resizewindow" - "$mod, Z, movewindow" - "$mod, X, resizewindow" - ]; - # █░░ ▄▀█ █░█ █▄░█ █▀▀ █░█ - # █▄▄ █▀█ █▄█ █░▀█ █▄▄ █▀█ - exec-once = [ - "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" # for XDPH - "dbus-update-activation-environment --systemd --all" # for XDPH - "systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" # for XDPH - "systemctl --user start xdg-desktop-portal-wlr.service" - "blueman-applet" # systray app for Bluetooth - "udiskie --no-automount --smart-tray" # front-end that allows to manage removable media - "nm-applet --indicator" # systray app for Network/wifi - #setups clipboard - "rm -rf ~/.cache/cliphist/ && wl-paste --type text --watch cliphist store & wl-paste --type image --watch cliphist store" - #"wl-paste --type text --watch cliphist store" # clipboard store text data - #"wl-paste --type image --watch cliphist store" # clipboard store image data - "custom-batterynotify" - "custom-batterywarning" - #"birdtray" # thunderbird tray app # curently broken - #wallpapers/b - "swww img ${wallpaper}" - "swww-daemon" - "sleep 1 && custom-wallpaper" - "custom-checkKdrive && custom-mountkdrive" # checks if the remote works and mount it - #"waybar" - "custom-gitnotify" - "custom-checkMatrix" # checks if matrix-commander-rs is connected which is important for other stuff - #"custom-obsidianbackup" # backups the obsidian notes to kdrive and to a timed hidden dir (~/.Notes.backup/) - #"QS-notifycache" # builds the cache that will be used for the notification history - "sleep 4 & caelestia-shell" #works better if it sleeps a bit before - /* - We stopped using that ######################### maybe we should desactivate those scripts - # login autostart - ####################### - "[workspace 1 silent] sleep 1 && kitty -o font_size=16 -e sh -c 'custom-weather'" - "[workspace 1 silent] sleep 1 && kitty -o font_size=11 -e sh -c 'custom-cowsay'" - "[workspace 1 silent] kitty -e 'custom-launch'" - "[workspace 1 silent] sleep 1 && kitty -o font_size=5 -e btm --theme gruvbox --disable-click --disable_advanced_kill --enable_cache_memory -g -R -T " - "[workspace 1 silent] sleep 1 && kitty -o font_size=1 -e sh -c 'cmatrix -br'" - ###################### - ###################### - */ - ]; - splash = true; # remove default background on startup - # gestures (also keybindings) - gesture = [ - "3, right, move, +col" - "3, left, move, -col" - ]; - - # █░░ ▄▀█ █▄█ █▀█ █░█ ▀█▀ █▀ - # █▄▄ █▀█ ░█░ █▄█ █▄█ ░█░ ▄█ - - dwindle = { - preserve_split = true; - }; - scrolling = { - column_width = 0.45; - }; - - # █▀▄▀█ █ █▀ █▀▀ - # █░▀░█ █ ▄█ █▄▄ - - misc = { - vrr = 0; - force_default_wallpaper = 0; - }; - xwayland = { - force_zero_scaling = true; - }; - - # █▀▄▀█ █▀█ █▄░█ █ ▀█▀ █▀█ █▀█ - # █░▀░█ █▄█ █#░▀█ █ ░█░ █▄█ █▀▄ - monitor = [ - #",preferred, auto, auto" - "HDMI-A-1, highres2highrr, auto-left, 1" - ]; - # _______ ___ __ __ _______ ___ __ _ _______ - #| || | | | | || || | | | | || | - #| _ || | | | | || ___|| | | |_| || _____| - #| |_| || | | |_| || | __ | | | || |_____ - #| ___|| |___ | || || || | | _ ||_____ | - #| | | || || |_| || | | | | | _____| | - #|___| |_______||_______||_______||___| |_| |__||_______| - # - "plugin:dynamic-cursors" = { - enabled = true; - threshold = 2; - mode = "rotate"; - rotate = { - # length in px of the simulated stick used to rotate the cursor - # most realistic if this is your actual cursor size - length = 20; - offset = 0; - }; - shake = { - enabled = true; - # use nearest-neighbour (pixelated) scaling when shaking - # may look weird when effects are enabled - nearest = true; - threshold = 4; - # magnification level immediately after shake start - base = 4.0; - # magnification increase per second when continuing to shake - speed = 4.0; - # how much the speed is influenced by the current shake intensitiy - influence = 0.0; - - # maximal magnification the cursor can reach - # values below 1 disable the limit (e.g. 0) - limit = 0.0; - - # time in millseconds the cursor will stay magnified after a shake has ended - timeout = 2000; - - # show cursor behaviour `tilt`, `rotate`, etc. while shaking - effects = true; - - # enable ipc events for shake - ipc = false; - }; - }; - "plugin:overview" = { - disableGestures = true; - showEmptyWorkspace = true; - workspaceActiveBorder = "rgb(ab7746)"; - disableBlur = true; - }; - - ##################################################### - ##################################################### - # theme - decoration = { - dim_special = 0.3; - rounding = 18; - blur = { - special = true; - enabled = true; - size = 4; - passes = 2; - new_optimizations = true; - ignore_opacity = true; - }; - }; - general = { - gaps_in = 5; - gaps_out = 15; - border_size = 4; - "col.active_border" = "rgba(ca6702ff) rgba(ecd3a0ff) 45deg"; - "col.inactive_border" = "rgba(f1dca7d9) rgba(ffe1a8d9) 45deg"; - layout = "dwindle"; - resize_on_border = true; - }; - group = { - "col.border_active" = "rgba(ca6702ff) rgba(ecd3a0ff) 45deg"; - "col.border_inactive" = "rgba(f1dca7d9) rgba(ffe1a8d9) 45deg"; - "col.border_locked_active" = "rgba(ca6702ff) rgba(ecd3a0ff) 45deg"; - "col.border_locked_inactive" = "rgba(f1dca7d9) rgba(ffe1a8d9) 45deg"; - }; - #################################################### - ################################################## - - # /$$ /$$ /$$ - #| $$ /$ | $$ | $$ - #| $$ /$$$| $$ /$$$$$$ /$$$$$$ | $$ /$$ /$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ - #| $$/$$ $$ $$ /$$__ $$ /$$__ $$| $$ /$$/ /$$_____/ /$$__ $$ |____ $$ /$$_____/ /$$__ $$ - #| $$$$_ $$$$| $$ \ $$| $$ \__/| $$$$$$/ | $$$$$$ | $$ \ $$ /$$$$$$$| $$ | $$$$$$$$ - #| $$$/ \ $$$| $$ | $$| $$ | $$_ $$ \____ $$| $$ | $$ /$$__ $$| $$ | $$_____/ - #| $$/ \ $$| $$$$$$/| $$ | $$ \ $$ /$$$$$$$/| $$$$$$$/| $$$$$$$| $$$$$$$| $$$$$$$ - #|__/ \__/ \______/ |__/ |__/ \__/|_______/ | $$____/ \_______/ \_______/ \_______/ - # | $$ - # | $$ - # |__/ - # see https://wiki.hypr.land/Configuring/Workspace-Rules/ - workspace = [ - "1, layout:master" - "2, layout:scrolling, layoutopt:direction:right" - "name:special, layout:scrolling" - # used for smart gaps along some windowrules - #"w[tv1], gapsout:1, gapsin:1" - #"f[1], gapsout:1, gapsin:1" - ]; - - # █░█░█ █ █▄░█ █▀▄ █▀█ █░█░█   █▀█ █░█ █░░ █▀▀ █▀ - # ▀▄▀▄▀ █ █░▀█ █▄▀ █▄█ ▀▄▀▄▀   █▀▄ █▄█ █▄▄ ██▄ ▄█ - windowrule = [ - "opacity 0.90 0.90, match:class ^(firefox)$" - "opacity 0.90 0.90, match:class ^(Brave-browser)$" - "opacity 0.80 0.80, match:class ^(code-oss)$" - "opacity 0.80 0.80, match:class ^(Code)$" - "opacity 0.80 0.80, match:class ^(code-url-handler)$" - "opacity 0.80 0.80, match:class ^(code-insiders-url-handler)$" - "opacity 0.75 0.75, match:class ^(kitty)$" - "opacity 0.80 0.80, match:class ^(org.kde.dolphin)$" - "opacity 0.80 0.80, float on, match:class ^(org.kde.ark)$" - "opacity 0.80 0.80, float on, match:class ^(nwg-look)$" - "opacity 0.80 0.80, float on, match:class ^(qt5ct)$" - "opacity 0.80 0.80, float on, match:class ^(qt6ct)$" - "opacity 0.80 0.80, float on, match:class ^(kvantummanager)$" - "opacity 0.80 0.70, float on, match:class ^(org.pulseaudio.pavucontrol)$" - "opacity 0.80 0.70, float on, match:class ^(blueman-manager)$" - "opacity 0.80 0.70, float on, match:class ^(nm-applet)$" - "opacity 0.80 0.70, float on, match:class ^(nm-connection-editor)$" - "opacity 0.80 0.70, float on, match:class ^(org.kde.polkit-kde-authentication-agent-1)$" - "opacity 0.80 0.70, match:class ^(polkit-gnome-authentication-agent-1)$" - "opacity 0.80 0.70, match:class ^(org.freedesktop.impl.portal.desktop.gtk)$" - "opacity 0.80 0.70, match:class ^(org.freedesktop.impl.portal.desktop.hyprland)$" - "opacity 0.70 0.70, match:class ^([Ss]team)$" - "opacity 0.70 0.70, match:class ^(steamwebhelper)$" - "opacity 0.70 0.70, match:class ^(Spotify)$" - "opacity 0.70 0.70, match:initial_title ^(Spotify Free)$" - "opacity 0.90 0.90, float on, match:class ^(com.github.rafostar.Clapper)$" - "opacity 0.80 0.80, match:class ^(com.github.tchx84.Flatseal)$" - "opacity 0.80 0.80, match:class ^(hu.kramo.Cartridges)$" - "opacity 0.80 0.80, match:class ^(com.obsproject.Studio)$" - "opacity 0.80 0.80, match:class ^(gnome-boxes)$" - "opacity 0.80 0.80, match:class ^(discord)$" - "opacity 0.80 0.80, match:class ^(WebCord)$" - "opacity 0.80 0.80, match:class ^(ArmCord)$" - "opacity 0.80 0.80, float on, match:class ^(app.drey.Warp)$" - "opacity 0.80 0.80, float on, match:class ^(net.davidotek.pupgui2)$" - "opacity 0.80 0.80, float on, match:class ^(yad)$" - "opacity 0.80 0.80, float on, match:class ^(Signal)$" - "opacity 0.80 0.80, float on, match:class ^(io.github.alainm23.planify)$" - "opacity 0.80 0.80, float on, match:class ^(io.gitlab.theevilskeleton.Upscaler)$" - "opacity 0.80 0.80, float on, match:class ^(com.github.unrud.VideoDownloader)$" - "opacity 0.80 0.80, float on, match:class ^(io.gitlab.adhami3310.Impression)$" - "opacity 0.80 0.80, float on, match:class ^(io.missioncenter.MissionCenter)$" - "opacity 0.80 0.80, match:class ^(io.github.flattool.Warehouse)$" - "float on, match:class ^(org.kde.dolphin)$, match:title ^(Progress Dialog — Dolphin)$" - "float on, match:class ^(org.kde.dolphin)$, match:title ^(Copying — Dolphin)$" - "float on, match:class ^(firefox)$, match:title ^(Picture-in-Picture)$" - "float on, match:class ^(firefox)$, match:title ^(Library)$" - "float on, match:class ^(kitty)$, match:title ^(top)$" - "float on, match:class ^(kitty)$, match:title ^(btop)$" - "float on, match:class ^(kitty)$, match:title ^(htop)$" - "float on, match:class ^(vlc)$" - "float on, match:class ^(eog)$" - "float on, size 400 225, match:class ^(custom-librewolfprofiles)$" - "float on, size 1050 200, match:class ^(custom-changeAudioOutput)$" - "float on, size 400 175, match:class ^(custom-obsidianvaults)$" - "float on, size 600 600, match:initial_class ^(custom-pomodoro)$" - "float on, size 1500 800, match:initial_class ^(custom-bottom)$" - # smart gaps/border is ugly with caelestia-shell - #"border_size 2, match:float 0, match:workspace w[tv1]" - #"rounding 1, match:float 0, match:workspace w[tv1]" - #"border_size 2, match:float 0, match:workspace f[1]" - #"rounding 1, match:float 0, match:workspace f[1]" - ]; - # add a float for tomato when in kitty - #"plugin:imgborders:noimgborders, tag:noborder" - layerrule = [ - "blur on, ignore_alpha 0, match:namespace rofi" - "blur on, ignore_alpha 0, match:namespace notifications" - "blur on, ignore_alpha 0, match:namespace swaync-notification-window" - "blur on, ignore_alpha 0, match:namespace swaync-control-center" - "blur on, match:namespace logout_dialog" - ]; - }; -} diff --git a/modules/home-manager/kitty.nix b/modules/home-manager/kitty.nix deleted file mode 100644 index 5255897..0000000 --- a/modules/home-manager/kitty.nix +++ /dev/null @@ -1,121 +0,0 @@ -_: { - programs.kitty = { - enable = true; - #font.name = nerd-fonts._0xproto; - #font.size = "10"; - ## new config (matches with caelestia - ## old condfig - extraConfig = '' - font_size 14 - bold_font auto - italic_font auto - bold_italic_font auto - - window_padding_width 25 - - # --- Core --- - foreground #ece0d9 - background #18120e - - selection_foreground #18120e - selection_background #ece0d9 - - cursor #ffb878 - cursor_text_color #18120e - - # --- Tabs --- - active_tab_foreground #18120e - active_tab_background #5c412a - inactive_tab_foreground #d6c3b5 - inactive_tab_background #241e1a - - # --- Black / Gray --- - color0 #353433 - color8 #b29f91 - - # --- Red --- - color1 #e17300 - color9 #ff8a20 - - # --- Green --- - color2 #ffc071 - color10 #ffd6a8 - - # --- Yellow --- - color3 #ffe0c6 - color11 #fff2e8 - - # --- Blue --- - color4 #b9ab66 - color12 #d7be91 - - # --- Magenta --- - color5 #ed9562 - color13 #fcad7e - - # --- Cyan --- - color6 #f4c16d - color14 #ffd497 - - # --- White --- - color7 #ebd4c1 - color15 #FFFFFF - ''; - /* - extraConfig = '' - # font nerd-fonts._0xproto # this key dont work and causes errors - font_size 14 - bold_font auto - italic_font auto - bold_italic_font auto - window_padding_width 25 - foreground #FFFFFF - background #1B1D1C - selection_foreground #1B1D1C - selection_background #FFFFFF - cursor #C3AC76 - cursor_text_color #0F1010 - - active_tab_foreground #1B1D1C - active_tab_background #6B5540 - inactive_tab_foreground #6B5540 - inactive_tab_background #1B1D1C - - # black - color0 #29523D - color8 #578F73 - - # red - #color1 #FFF0CC - #color9 #F0DBAA - # we need actual red colors - color1 #CC241D - color9 #9D0006 - - # green - color2 #FFEECC - color10 #F0D9AA - - # yellow - color3 #FFE5CC - color11 #F0CCAA - - # blue - color4 #9AE6C0 - color12 #9AE6C0 - - # magenta - color5 #E6CC9A - color13 #E6CC9A - - # cyan - color6 #E6BF9A - color14 #E6BF9A - - # white - color7 #FFF0CC - color15 #F0DBAA - ''; - */ - }; -} diff --git a/modules/home-manager/librewolf.nix b/modules/home-manager/librewolf.nix deleted file mode 100644 index 81b1cb2..0000000 --- a/modules/home-manager/librewolf.nix +++ /dev/null @@ -1,638 +0,0 @@ -# adapted from https://github.com/contre95/dotfiles/blob/main/dotfiles/nixos/programs/librewolf.nix -_: { - home.sessionVariables = { - MOZ_ENABLE_WAYLAND = 1; - MOZ_USE_XINPUT2 = 1; - MOZ_DBUS_REMOTE = 1; - }; - programs.librewolf = { - enable = true; - settings = { - "browser.profiles.enabled" = true; - # disabled until i find something that uses it. - "webgl.disabled" = true; - # settings = lib.mapAttrs' (n: lib.nameValuePair "pref.${n}") { - "app.update.auto" = true; # disable auto update - #"dom.security.https_only_mode" = true; # force https - "extensions.pocket.enabled" = false; # disable pocket - #"browser.quitShortcut.disabled" = true; # disable ctrl+q - "browser.download.panel.shown" = true; # show download panel - "signon.rememberSignons" = false; # disable saving passwords - "identity.fxaccounts.enabled" = false; # disable librewolf accounts - "app.shield.optoutstudies.enabled" = false; # disable shield studies - "browser.shell.checkDefaultBrowser" = false; # don't check if default browser - #"browser.bookmarks.restore_default_bookmarks" = false; # don't restore default bookmarks - # Download handling - #"browser.download.dir" = "/home/meain/down"; # default download dir - "browser.startup.page" = 3; # restore previous session - # UI changes - # "browser.uidensity" = 1; # enable dense UI - #"general.autoScroll" = true; # enable autoscroll - # "browser.compactmode.show" = true; # enable compact mode - # "browser.tabs.firefox-view" = false; # enable librewolf view - #"startup.homepage_welcome_url" = - # "https://metrics.internal.contre.io/d/cUITC74Vksd/podman-revamped?orgId=1&from=2026-02-23T19:29:26.304Z&to=2026-02-23T19:59:26.304Z&timezone=browser&var-Filters=&var-namespace=alloy&var-level=error&var-level=debug&var-level=info&var-level=warn&refresh=5s&kiosk=true"; # disable welcome page - "browser.newtabpage.enabled" = true; # disable new tab page - "full-screen-api.ignore-widgets" = true; # fullscreen within window - "browser.toolbars.bookmarks.visibility" = "newtab"; # hide bookmarks toolbar; always, never, newtab - "browser.aboutConfig.showWarning" = false; # disable warning about about:config - "media.videocontrols.picture-in-picture.video-toggle.enabled" = false; # disable picture in picture button - - # Privacy - "privacy.resistFingerprinting" = true; - # "privacy.clearOnShutdown.cache" = false; - "privacy.clearOnShutdown.history" = false; - "privacy.clearHistory.cookiesAndStorage" = false; - "privacy.clearHistory.historyFormDataAndDownloads" = false; - "privacy.clearHistory.cache" = false; - "privacy.clearOnShutdown_v2.siteSettings" = false; - "privacy.clearOnShutdown_v2.cookiesAndStorage" = false; - "services.sync.prefs.sync.privacy.clearOnShutdown_v2.history" = false; - "services.sync.prefs.sync.privacy.clearOnShutdown_v2.siteSettings" = false; - "services.sync.prefs.sync.privacy.clearOnShutdown_v2.sessions" = false; - "services.sync.prefs.sync.privacy.clearOnShutdown_v2.cookies" = false; - "services.sync.prefs.sync.privacy.clearOnShutdown.history" = false; - "services.sync.prefs.sync.privacy.clearOnShutdown.siteSettings" = false; - "services.sync.prefs.sync.privacy.clearOnShutdown.sessions" = false; - "services.sync.prefs.sync.privacy.clearOnShutdown.cookies" = false; - "privacy.clearOnShutdown.cookies" = false; - "browser.discovery.enabled" = false; # disable discovery - "browser.search.suggest.enabled" = true; # disable search suggestions - "browser.contentblocking.category" = "standart"; # set tracking protection to standart to not interfer with adnauseam - "dom.private-attribution.submission.enabled" = false; # stop doing dumb stuff mozilla - "browser.protections_panel.infoMessage.seen" = true; # disable tracking protection info - - # Theme - "toolkit.legacyUserProfileCustomizations.stylesheets" = true; - "svg.context-properties.content.enabled" = true; - "layout.css.color-mix.enabled" = true; - - # Disable telemetry - "toolkit.telemetry.enabled" = false; - "toolkit.telemetry.unified" = false; - "browser.ping-centre.telemetry" = false; - "toolkit.telemetry.archive.enabled" = false; - "toolkit.telemetry.bhrPing.enabled" = false; - "toolkit.telemetry.updatePing.enabled" = false; - "browser.translations.automaticallyPopup" = false; - "toolkit.telemetry.hybridContent.enabled" = false; - "toolkit.telemetry.newProfilePing.enabled" = false; - "toolkit.telemetry.reportingpolicy.firstRun" = false; - "toolkit.telemetry.firstShutdownPing.enabled" = false; - "browser.newtabpage.activity-stream.telemetry" = false; - "toolkit.telemetry.shutdownPingSender.enabled" = false; - "browser.newtabpage.activity-stream.feeds.telemetry" = false; - - "browser.tabs.loadInBackground" = true; # open new tab in background - "browser.tabs.loadBookmarksInTabs" = true; # open bookmarks in new tab - "browser.tabs.warnOnOpen" = false; # don't warn when opening multiple tabs - "browser.tabs.warnOnQuit" = false; # don't warn when closing multiple tabs - "browser.tabs.warnOnClose" = false; # don't warn when closing multiple tabs - "browser.tabs.loadDivertedInBackground" = false; # open new tab in background - "browser.tabs.warnOnCloseOtherTabs" = false; # don't warn when closing multiple tabs - "browser.tabs.closeWindowWithLastTab" = false; # don't close window when last tab is closed - - # other - "media.autoplay.default" = 0; # enable autoplay on open - "devtools.toolbox.host" = "right"; # move devtools to right - "devtools.theme" = "dark"; - # "browser.ssb.enabled" = true; # enable site specific browser - "media.rdd-vpx.enabled" = true; # enable hardware acceleration - "devtools.cache.disabled" = true; # disable caching in devtools - "media.ffmpeg.vaapi.enabled" = true; # enable hardware acceleration - - # Fonts - "font.size.fixed.x-western" = 15; - "font.minimum-size.x-western" = 13; - "font.size.variable.x-western" = 15; - "font.size.monospace.x-western" = 15; - "browser.display.use_document_fonts" = 1; - "browser.link.open_newwindow.restriction" = 0; - # - # "browser.fixup.domainsuffixwhitelist.home" = true; - # "browser.fixup.domainwhitelist.internal.contre.io" = true; - "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; - # "keyword.enable" = false; # Disable search when typing unexistent TLD - }; - policies = { - ExtensionSettings = { - # the extension id should be from the manifesto and not a random name. - # if you dont know it. Put a random name. It will fail. Go to about:polices#error and the error will give you the correct id. - "enhancerforyoutube@maximerf.addons.mozilla.org" = { - installation_mode = "normal_installed"; - install_url = "https://addons.mozilla.org/firefox/downloads/latest/enhancer-for-youtube/latest.xpi"; - }; - - "sponsorBlocker@ajay.app" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/sponsorblock/latest.xpi"; - installation_mode = "force_installed"; - }; - - "adnauseam@rednoise.org" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/adnauseam/latest.xpi"; - installation_mode = "force_installed"; - }; - "uBlock0@raymondhill.net" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; - installation_mode = "force_installed"; - }; - "{08d5243b-4236-4a27-984b-1ded22ce01c3}" = { - install_url = "https://addons.mozilla.org/firefox/downloads/file/3729287/gruvboxgruvboxgruvboxgruvboxgr-1.0.xpi"; - installation_mode = "force_installed"; - }; - "trackmenot@mrl.nyu.edu" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/trackmenot/latest.xpi"; - installation_mode = "force_installed"; - }; - "{446900e4-71c2-419f-a6a7-df9c091e268b}" = { - install_url = "https://addons.mozilla.org/firefox/downloads/file/4749958/bitwarden_password_manager-latest.xpi"; - installation_mode = "force_installed"; - }; - }; - DisableTelemetry = true; - DisableFirefoxStudies = true; - EnableTrackingProtection = { - Value = true; - Locked = true; - Cryptomining = true; - Fingerprinting = true; - }; - DisablePocket = true; - DisableAccounts = true; - DisableFirefoxScreenshots = true; - # OverrideFirstRunPage = ""; - # OverridePostUpdatePage = ""; - DontCheckDefaultBrowser = true; - DisplayBookmarksToolbar = "always"; # alternatives: "always" or "newtab" - DisplayMenuBar = "never"; # alternatives: "always", "never" or "default-on" - SearchBar = "unified"; # alternative: "separate" - }; - profiles.work = { - id = 0; - # userChrome = builtins.readFile ./userChrome.css; - # userContent = builtins.readFile ./userChrome.css; - extensions = { - #force = true; - #settings = { - # "adnauseam@rednoise.org".settings = { - # # Core behavior - # filteringEnabled = true; - # - # hidingAds = true; - # blockingMalware = true; - # clickingAds = true; - # - # # Privacy - # disableClickingForDNT = true; - # blockSocialMediaWidgets = false; - # - # # Filter lists - # selectedFilterLists = [ - # "adnauseam-filters" - # "easylist" - # "easyprivacy" - # "ublock-badware" - # "ublock-privacy" - # "ublock-unbreak" - # ]; - # - # # Advanced - # advancedUserEnabled = false; - # dynamicFilteringEnabled = false; - # - # # UI - # showIconBadge = true; - # parseTextAds = true; - # eventLogging = false; - # }; - # "trackmenot@mrl.nyu.edu".settings = { - # enabled = true; - - # # Query behavior - # runAtStartup = true; - # useTab = false; # don't open visible tab - # showQueries = false; # don't display fake queries - - # # Frequency (seconds between bursts) - # timeout = 600; # 10 minutes - # burstEnabled = true; - # burstTimeout = 20; # burst interval - # burstCount = 5; - - # # Query source - # useRssFeeds = true; # use dynamic trending feeds - # useUserQueries = false; # don't mix your real queries - # useBlackList = true; - - # # Search engines to generate noise for - # searchEngines = { - # google = true; - # bing = false; - # yahoo = false; - # baidu = false; - # duckduckgo = false; - # }; - - # # Logging - # enableLogging = false; - # }; - # "sponsorBlocker@ajay.app".settings = { - - # # Core behavior - # isEnabled = true; - # autoSkip = false; - # showSkipNotice = true; - # # this does not work - # # Segment categories (auto-skip behavior) - # categoryChooser = { - # Sponsor = { - # enabled = true; - # skipOption = "manualSkip"; - # }; - # intro = { - # enabled = true; - # actionType = 2; - # }; - # outro = { - # enabled = true; - # actionType = 2; - # }; - # selfpromo = { - # enabled = true; - # actionType = 2; - # }; - # interaction = { - # enabled = true; - # actionType = 1; # 1 = manual skip - # }; - # music_offtopic = { - # enabled = false; - # actionType = 0; - # }; - # preview = { - # enabled = false; - # actionType = 0; - # }; - # }; - - # # Privacy - # disableTelemetry = true; - # showDonationLink = false; - - # # UX - # showUpsells = false; - # hideSkipButtonPlayerControls = false; - - # # Advanced - # useLocalCache = true; - # trackViewCount = false; - # }; - #}; - }; - bookmarks = { - force = true; - settings = [ - { - name = "Nixos Config"; - tags = ["github"]; - keyword = "github"; - url = "https://github.com/tomasriveral/nixos"; - } - { - name = "Public AI"; - tags = ["ai" "chatgpt" "apertus"]; - keyword = "apertus"; - url = "https://chat.publicai.co/"; - } - { - name = "Signs of AI writing"; - tags = ["ai" "write"]; - keyword = "AI writing"; - url = "https://en.wikipedia.org/wiki/Wikipedia:Signs_of_AI_writing"; - } - { - name = "nixpkgs-review-gha"; - tags = ["nixpkgs-review" "gha"]; - keyword = "nixpkgs-review"; - url = "https://github.com/tomasriveral/nixpkgs-review-gha/actions/workflows/review.yml"; - } - { - name = "nixpkgs tracker"; - tags = ["nixpkgs" "tracker"]; - keyword = "nixpkgs tracker"; - url = "https://nixpk.gs/pr-tracker.html"; - } - { - name = "fahrlehrer"; - tags = ["theorie" "fahrlehrer" "conduite"]; - keyword = "fahrlehrer24"; - url = "https://app.fahrlehrer24.ch/"; - } - { - name = "cogito"; - tags = ["cogito" "esprit" "critique"]; - keyword = "Cogito l'Esprit critique"; - url = "https://app.cogito.fr"; - } - ]; - }; - search = { - force = true; - default = "quant"; - privateDefault = "qant"; - order = [ - "q" - "map" - "np" - "nw" - "bookmarks" - "tabs" - "history" - ]; - engines = { - # don't need these default ones - "amazondotcom-es".metaData.hidden = true; - "bing".metaData.hidden = true; - "ebay".metaData.hidden = true; - "metager".metaData.hidden = true; # dont work - "mojeek".metaData.hidden = true; # dont work - "seerx".metaData.hidden = true; - "perplexity".metaData.hidden = true; - "google".metaData.hidden = true; - "startpage".metaData.hidden = true; - "duckduckgo".metaData.hidden = true; - "Wikitionary" = { - urls = [ - { - template = "https://fr.wiktionary.org/w/index.php?search={searchTerms}"; - } - ]; - definedAliases = ["dict"]; - }; - "quant" = { - urls = [ - { - template = "https://www.qwant.com/"; - params = [ - { - name = "q"; - value = "{searchTerms}"; - } - ]; - } - ]; - definedAliases = ["q"]; - }; - "OpenStreeetMap" = { - urls = [ - { - template = "https://www.openstreetmap"; - params = [ - { - name = "q"; - value = "{searchTerms}"; - } - ]; - } - ]; - definedAliases = ["map"]; - }; - "Home Manager Options" = { - urls = [ - { - template = "https://home-manager-options.extranix.com/"; - params = [ - { - name = "query"; - value = "{searchTerms}"; - } - ]; - } - ]; - definedAliases = ["hm"]; - }; - "Nix Packages" = { - urls = [ - { - template = "https://search.nixos.org/packages"; - params = [ - { - name = "type"; - value = "packages"; - } - { - name = "query"; - value = "{searchTerms}"; - } - ]; - } - ]; - definedAliases = ["np"]; - }; - "Nix Wiki" = { - urls = [ - { - template = "https://wiki.nixos.org/w/index.php?search={searchTerms}"; - } - ]; - definedAliases = ["nw"]; - }; - "Repology" = { - urls = [ - { - template = "https://repology.org/projects/?search={searchTerms}"; - } - ]; - definedAliases = ["rp"]; - }; - }; - }; - }; - profiles.other = { - id = 1; - # userChrome = builtins.readFile ./userChrome.css; - # userContent = builtins.readFile ./userChrome.css; - extensions = { - #force = false; - #settings = { - # "adnauseam@rednoise.org".settings = { - # # Core behavior - # filteringEnabled = true; - # - # hidingAds = true; - # blockingMalware = true; - # clickingAds = true; - # - # # Privacy - # disableClickingForDNT = true; - # blockSocialMediaWidgets = false; - # - # # Filter lists - # selectedFilterLists = [ - # "adnauseam-filters" - # "easylist" - # "easyprivacy" - # "ublock-badware" - # "ublock-privacy" - # "ublock-unbreak" - # ]; - # - # # Advanced - # advancedUserEnabled = false; - # dynamicFilteringEnabled = false; - # - # # UI - # showIconBadge = true; - # parseTextAds = true; - # eventLogging = false; - # }; - # "trackmenot@mrl.nyu.edu".settings = { - # enabled = true; - - # # Query behavior - # runAtStartup = true; - # useTab = false; # don't open visible tab - # showQueries = false; # don't display fake queries - - # # Frequency (seconds between bursts) - # timeout = 600; # 10 minutes - # burstEnabled = true; - # burstTimeout = 20; # burst interval - # burstCount = 5; - - # # Query source - # useRssFeeds = true; # use dynamic trending feeds - # useUserQueries = false; # don't mix your real queries - # useBlackList = true; - - # # Search engines to generate noise for - # searchEngines = { - # google = true; - # bing = false; - # yahoo = false; - # baidu = false; - # duckduckgo = false; - # }; - - # # Logging - # enableLogging = false; - # }; - # "sponsorBlocker@ajay.app".settings = { - - # # Core behavior - # isEnabled = true; - # autoSkip = false; - # showSkipNotice = true; - # # this does not work - # # Segment categories (auto-skip behavior) - # categoryChooser = { - # Sponsor = { - # enabled = true; - # skipOption = "manualSkip"; - # }; - # intro = { - # enabled = true; - # actionType = 2; - # }; - # outro = { - # enabled = true; - # actionType = 2; - # }; - # selfpromo = { - # enabled = true; - # actionType = 2; - # }; - # interaction = { - # enabled = true; - # actionType = 1; # 1 = manual skip - # }; - # music_offtopic = { - # enabled = false; - # actionType = 0; - # }; - # preview = { - # enabled = false; - # actionType = 0; - # }; - # }; - - # # Privacy - # disableTelemetry = true; - # showDonationLink = false; - - # # UX - # showUpsells = false; - # hideSkipButtonPlayerControls = false; - - # # Advanced - # useLocalCache = true; - # trackViewCount = false; - # }; - #}; - }; - search = { - force = true; - default = "quant"; - privateDefault = "qant"; - order = [ - "q" - "map" - "np" - "nw" - "bookmarks" - "tabs" - "history" - ]; - engines = { - # don't need these default ones - "amazondotcom-es".metaData.hidden = true; - "bing".metaData.hidden = true; - "ebay".metaData.hidden = true; - "metager".metaData.hidden = true; # dont work - "mojeek".metaData.hidden = true; # dont work - "seerx".metaData.hidden = true; - "perplexity".metaData.hidden = true; - "google".metaData.hidden = true; - "startpage".metaData.hidden = true; - "duckduckgo".metaData.hidden = true; - "quant" = { - urls = [ - { - template = "https://www.qwant.com/"; - params = [ - { - name = "q"; - value = "{searchTerms}"; - } - ]; - } - ]; - definedAliases = ["q"]; - }; - "OpenStreeetMap" = { - urls = [ - { - template = "https://www.openstreetmap"; - params = [ - { - name = "q"; - value = "{searchTerms}"; - } - ]; - } - ]; - definedAliases = ["map"]; - }; - "Onche.org" = { - urls = [ - { - template = "https://onche.org/forum/1/blabla-general/search?by=topic&q={searchTerms}"; - } - ]; - definedAliases = ["on"]; - }; - }; - }; - }; - }; -} diff --git a/modules/home-manager/micro.nix b/modules/home-manager/micro.nix deleted file mode 100644 index ffd5cb8..0000000 --- a/modules/home-manager/micro.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ - pkgs-unstable, - inputs, - ... -}: { - programs.micro = { - enable = true; - package = pkgs-unstable.micro-full; - settings = { - }; - }; - home.file.".config/micro/plug/vivify" = { - enable = true; - source = inputs.microPlugins-vivify; - recursive = true; - force = true; - }; - home.file.".config/micro/init.lua" = { - enable = true; - force = true; - text = '' - local buffer = import("micro/buffer") - local shell = import("micro/shell") - - function vivifyOpen(buf) - local cursor = buf:GetActiveCursor() - local line = cursor.Loc.Y + 1 - - shell.ExecCommand("viv", string.format("%s:%d", buf.AbsPath, line)) - end - - function onBufferOpen(buf) - if os.getenv("MICRO_VIVIFY") ~= "1" then - return - end - - -- only run for real files (not help/log/etc) - if buf.Type.Kind == buffer.BTDefault then - vivifyOpen(buf) - end - end - ''; - }; -} diff --git a/modules/home-manager/mullvad.nix b/modules/home-manager/mullvad.nix deleted file mode 100644 index c4f3e06..0000000 --- a/modules/home-manager/mullvad.nix +++ /dev/null @@ -1,8 +0,0 @@ -# see also ../nixos/mullvad.nix -{pkgs-unstable, ...}: { - programs.mullvad-vpn = { - # gui - enable = true; - package = pkgs-unstable.mullvad-vpn; - }; -} diff --git a/modules/home-manager/neovim.nix b/modules/home-manager/neovim.nix deleted file mode 100644 index 95a6d2f..0000000 --- a/modules/home-manager/neovim.nix +++ /dev/null @@ -1,499 +0,0 @@ -{pkgs-unstable, ...}: { - programs.neovim = { - enable = true; - vimAlias = false; - viAlias = false; - package = pkgs-unstable.neovim-unwrapped; # required for unwrapped version - plugins = [ - pkgs-unstable.vimPlugins.vivify-vim - pkgs-unstable.vimPlugins.vimtex - pkgs-unstable.vimPlugins.zoxide-vim - #pkgs-unstable.vimPlugins.gruvbox - pkgs-unstable.vimPlugins.gruvbox-nvim - pkgs-unstable.vimPlugins.neovim-sensible - pkgs-unstable.vimPlugins.nvim-web-devicons - pkgs-unstable.vimPlugins.nvim-tree-lua - pkgs-unstable.vimPlugins.nvim-surround - pkgs-unstable.vimPlugins.floaterm - pkgs-unstable.vimPlugins.nvim-lspconfig - pkgs-unstable.vimPlugins.cmp-nvim-lsp - pkgs-unstable.vimPlugins.cmp-nvim-lsp-signature-help - pkgs-unstable.vimPlugins.cmp-under-comparator - pkgs-unstable.vimPlugins.cmp-buffer - pkgs-unstable.vimPlugins.cmp-path - pkgs-unstable.vimPlugins.cmp-cmdline - pkgs-unstable.vimPlugins.nvim-cmp - pkgs-unstable.vimPlugins.cmp-vsnip - pkgs-unstable.vimPlugins.vim-vsnip - pkgs-unstable.vimPlugins.dashboard-nvim - pkgs-unstable.vimPlugins.lualine-nvim - pkgs-unstable.vimPlugins.vim-nix - pkgs-unstable.vimPlugins.plenary-nvim - pkgs-unstable.vimPlugins.blink-ripgrep-nvim - pkgs-unstable.vimPlugins.nvim-treesitter - pkgs-unstable.vimPlugins.nvim-treesitter-parsers.rasi - pkgs-unstable.vimPlugins.nvim-treesitter-parsers.regex - pkgs-unstable.vimPlugins.nvim-treesitter-parsers.udev - pkgs-unstable.vimPlugins.nvim-treesitter-parsers.zsh - pkgs-unstable.vimPlugins.nvim-treesitter-parsers.c - pkgs-unstable.vimPlugins.nvim-treesitter-parsers.bibtex - pkgs-unstable.vimPlugins.nvim-treesitter-parsers.bash - pkgs-unstable.vimPlugins.nvim-treesitter-parsers.gitignore - pkgs-unstable.vimPlugins.nvim-treesitter-parsers.comment - pkgs-unstable.vimPlugins.nvim-treesitter-parsers.json - pkgs-unstable.vimPlugins.nvim-treesitter-parsers.hyprlang - pkgs-unstable.vimPlugins.nvim-treesitter-parsers.lua - pkgs-unstable.vimPlugins.nvim-treesitter-parsers.latex - pkgs-unstable.vimPlugins.nvim-treesitter-parsers.kitty - pkgs-unstable.vimPlugins.nvim-treesitter-parsers.markdown - pkgs-unstable.vimPlugins.nvim-treesitter-parsers.nix - pkgs-unstable.vimPlugins.nvim-treesitter-parsers.printf - pkgs-unstable.vimPlugins.nvim-treesitter-parsers.python - pkgs-unstable.vimPlugins.telescope-nvim - pkgs-unstable.vimPlugins.nvim-scrollbar - pkgs-unstable.vimPlugins.promise-async - pkgs-unstable.vimPlugins.nvim-ufo - pkgs-unstable.vimPlugins.cheatsheet-nvim - pkgs-unstable.vimPlugins.popup-nvim - pkgs-unstable.vimPlugins.vim-visual-multi - pkgs-unstable.vimPlugins.fugit2-nvim - pkgs-unstable.vimPlugins.nvim-lastplace - pkgs-unstable.vimPlugins.runner-nvim # terminal - pkgs-unstable.vimPlugins.better-diagnostic-virtual-text - pkgs-unstable.vimPlugins.garbage-day-nvim - ]; - extraLuaConfig = '' - - local vim = vim - - -- ========================= - -- LEADER & KEY DISABLE - -- ========================= - vim.g.mapleader = ' ' - vim.g.maplocalleader = ' ' - vim.keymap.set({'n', 'v'}, '', '', { desc = 'Leader key, disable default behavior' }) - vim.keymap.set('n', 'q', '', { desc = 'Disable macro recording' }) - vim.keymap.set('n', 'gg', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'gG', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'g0', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'g^', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'g$', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'gj', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'gk', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'g~', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'gu', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'gU', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'g=', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'gq', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'g@', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'g?', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'gC', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'gD', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'gx', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'gr', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'g[', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'g]', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'g;', '', { desc = 'Disable g motion' }) - vim.keymap.set('n', 'g,', '', { desc = 'Disable g motion' }) - -- ========================= - -- GENERAL OPTIONS - -- ========================= - vim.g.have_nerd_font = true - vim.opt.relativenumber = false - vim.opt.number = true - vim.opt.mouse = 'a' - vim.opt.showmode = false - vim.schedule(function() - vim.opt.clipboard = 'unnamedplus' - end) - vim.opt.breakindent = true - vim.opt.undofile = true - vim.opt.ignorecase = true - vim.opt.smartcase = true - vim.opt.signcolumn = 'yes' - vim.opt.updatetime = 250 - vim.opt.timeoutlen = 300 - vim.opt.splitright = true - vim.opt.splitbelow = true - vim.opt.list = true - vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } - vim.opt.expandtab = true - vim.opt.smartindent = true - vim.opt.tabstop = 4 - vim.opt.shiftwidth = 4 - vim.opt.inccommand = 'split' - vim.opt.cursorline = true - vim.opt.scrolloff = 10 - - - -- ========================= - -- BASIC KEYMAPS - -- ========================= - vim.keymap.set('n', '', 'nohlsearch') - vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) - - -- Disable arrow keys in normal mode - vim.keymap.set('n', '', 'echo "Use h to move!!"') - vim.keymap.set('n', '', 'echo "Use l to move!!"') - vim.keymap.set('n', '', 'echo "Use k to move!!"') - vim.keymap.set('n', '', 'echo "Use j to move!!"') - - -- Window navigation - vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) - vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) - vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) - vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) - - -- Cheatsheet - vim.keymap.set("n","§", "Cheatsheet") - require("cheatsheet").setup({ - bundled_cheatsheets = { enabled = { "default" } }, - bundled_plugin_cheatsheets = { disabled = { "gitsigns.nvim" } } - }) - - -- Highlight yanked text - vim.api.nvim_create_autocmd('TextYankPost', { - desc = 'Highlight on yank', - group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), - callback = function() vim.highlight.on_yank() end, - }) - - -- ======================== - -- terminal - -- ======================= - require("runner-nvim").setup({ - position = 'right', -- position of the terminal window when using the shell_handler - -- can be: top, left, right, bottom - -- will be overwritten when using the telescope mapping to open horizontally or vertically - - width = 80, -- width of window when position is left or right - height = 10, -- height of window when position is top or bottom - - handlers = { - lua = function(bufnr) - vim.print('Running lua file in buffer ' .. bufnr) - -- Run the file here - end - } - }) - - vim.keymap.set("n", "", function() require("runner-nvim").run() end) - -- ========================= - -- SCROLLBAR - -- ========================= - require("scrollbar").setup() - - -- ========================= - -- UFO FOLDING - -- ========================= - vim.o.foldcolumn = '1' - vim.o.foldlevel = 99 - vim.o.foldlevelstart = 99 - vim.o.foldenable = true - vim.keymap.set('n', '1', "foldopen") - vim.keymap.set('n', '2', "foldclose") - require('ufo').setup({ - provider_selector = function() return {'treesitter', 'indent'} end - }) - - -- ========================= - -- treesitter - -- ======================== - require('nvim-treesitter').setup({ - ensure_installed = {}, - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, - indent = { enable = true }, - }) - -- ========================= - -- NVIM-TREE - -- ========================= - vim.g.loaded_netrw = 1 - vim.g.loaded_netrwPlugin = 1 - require("nvim-tree").setup({ - sort = { sorter = "case_sensitive" }, - view = { width = 30 }, - renderer = { group_empty = true }, - filters = { dotfiles = true }, - }) - - -- ========================= - -- CMP CONFIGURATION - -- ========================= - local cmp = require'cmp' - cmp.setup({ - snippet = { expand = function(args) vim.fn["vsnip#anonymous"](args.body) end }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), - }), - sources = cmp.config.sources({ { name = 'nvim_lsp' }, { name = 'vsnip' } }, { { name = 'buffer' } }), - }) - - cmp.setup.cmdline({ '/', '?' }, { mapping = cmp.mapping.preset.cmdline(), sources = { { name = 'buffer' } } }) - cmp.setup.cmdline(':', { mapping = cmp.mapping.preset.cmdline(), sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }), matching = { disallow_symbol_nonprefix_matching = false } }) - - -- ========================= - -- LSP CONFIGURATION - -- ========================= - local capabilities = require('cmp_nvim_lsp').default_capabilities() - - -- Diagnostics - vim.keymap.set("n", "e4", function() vim.diagnostic.jump({ prev=true, count = 1 }) end, { desc = "Previous diagnostic" }) - vim.keymap.set("n", "e5", function() vim.diagnostic.jump({ prev=false, count = 1 }) end, { desc = "Next diagnostic" }) - vim.keymap.set("n", "e1", vim.diagnostic.open_float, { desc = "Show diagnostic" }) - vim.keymap.set("n", "e3", vim.diagnostic.setloclist, { desc = "Diagnostic list" }) - vim.keymap.set("n", "e2", vim.lsp.buf.code_action, { desc = "Show correction" }) - - vim.keymap.set("n", "e", function() - local clients = vim.lsp.get_clients({ name = "ltex" }) - - if #clients > 0 then - -- Stop LTeX - for _, client in ipairs(clients) do - client.stop() - end - print("LTeX OFF") - else - -- Start LTeX - vim.cmd("LspStart ltex") - print("LTeX ON") - end - end, { desc = "Toggle LTeX" }) - - vim.diagnostic.config({ - update_in_insert = false, -- i don't get any new error when in insert - }) - require("better-diagnostic-virtual-text").setup({ - ui = { - wrap_line_after = false, -- wrap the line after this length to avoid the virtual text is too long - left_kept_space = 3, --- the number of spaces kept on the left side of the virtual text, make sure it enough to custom for each line - right_kept_space = 3, --- the number of spaces kept on the right side of the virtual text, make sure it enough to custom for each line - arrow = "  ", - up_arrow = "  ", - down_arrow = "  ", - above = false, -- the virtual text will be displayed above the line - }, - priority = 2003, -- the priority of virtual text - inline = false, - - }) - - - -- LSP functionality - vim.keymap.set("n", "g1", vim.lsp.buf.hover, { desc = "Hover documentation" }) - vim.keymap.set("n", "g2", vim.lsp.buf.definition, { desc = "Go to definition" }) - vim.keymap.set("n", "g3", vim.lsp.buf.declaration, { desc = "Go to declaration" }) - vim.keymap.set("n", "g4", vim.lsp.buf.implementation, { desc = "Go to implementation" }) - vim.keymap.set("n", "g5", vim.lsp.buf.references, { desc = "Show references" }) - - -- LSP server setup - vim.lsp.config("lua_ls", { cmd = { "lua-language-server" }, filetypes = { "lua" }, root_dir = vim.fs.dirname, on_attach = on_attach }) - vim.lsp.config("clangd", { - cmd = { "clangd", "--header-insertion=never" }, - filetypes = { "c","cpp","objc","objcpp" }, - on_attach = on_attach , - init_options = { - - clangdFileStatus = true, - usePlaceholders = true, - completeUnimported = false, -- this adds a bunch of #include even thought they are #included in another header file - headerInsertion = false, - headerInsertionDecorators = false, - addDependencyHeaders = false, - semanticHighlighting = true} - }) - vim.lsp.config("nixd", { - cmd = { "nixd" }, - filetypes = { "nix" }, - on_attach = on_attach, - }) - vim.lsp.config("pylsp", { - cmd = { "pylsp" }, - filetypes = { "python" }, - on_attach = on_attach, - settings = { - pylsp = { - plugins = { - pylsp_mypy = { enabled = true }, - jedi_completion = { fuzzy = true } - } - } - } - }) - vim.lsp.config("texlab", { cmd = { "texlab" }, filetypes = { "tex" }, on_attach = on_attach }) - vim.lsp.config("ltex", { - cmd = { "ltex-ls-plus" }, - filetypes = { "markdown", "text", "tex", "plaintex" }, - on_attach = on_attach, - - settings = { - ltex = { - language = "fr", - - enabled = { - "markdown", - "text", - "tex", - "plaintex", - }, - - completionEnabled = true, - diagnosticSeverity = "information", - - additionalRules = { - enablePickyRules = false, - motherTongue = "fr", - }, - - dictionary = { - ["fr"] = { - "icelle", - "icelui", - "iceux", - "maldoror", - "evariste", - "galois", - "arno", - "dessacrer", - }, - }, - }, - }, - }) - - vim.lsp.enable({ "lua_ls", "clangd", "pylsp", "texlab", "nixd", "ltex"}) - -- ========================= - -- DASHBOARD - -- ========================= - require('dashboard').setup { - theme = 'hyper', - config = { - header = { - " ... ... . ", - " .=*8888n..\"%888: @88> ", - " X ?8888f '8888 u. ... .. %8P .. . : ", - " 88x. '8888X 8888> .u ...ue888b :~\"\"888h.:^\"888: . .888: x888 x888. ", - "'8888k 8888X '\"*8h. ud8888. 888R Y888r 8X `8888X 8888> .@88u ~`8888~'888X`?888f` ", - " \"8888 X888X .xH8 :888'8888. 888R I888> X888n. 8888X ?888> '\"888E` X888 888X '888> ", - " `8\" X888!:888X d888 '88%\" 888R I888> '88888 8888X ?**h. 888E X888 888X '888> ", - " =~` X888 X888X 8888.+\" 888R I888> `*88 8888~ x88x. 888E X888 888X '888> ", - " :h. X8*` !888X 8888L u8888cJ888 ..<\" 88*` 88888X 888E X888 888X '888> ", - " X888xX\" '8888..: '8888c. .+ \"*888*P\" ..XC. `*8888k 888& \"*88%\"\"*88\" '888!` ", - ":~`888f '*888*\" \"88888% 'Y\" :888888H. `%88> R888\" `~ \" `\"` ", - " \"\" `\"` \"YP' < `\"888888: X\" \"\" ", - " %888888x.-` ", - " \"\"**\"\" ", - "", - "" - }, - shortcut = { { desc = " Open File Tree", group = "", key = 't', action = 'NvimTreeOpen' } }, - packages = { enable = false }, - project = { enable = true, limit = 8, icon = ' New file', action = 'Telescope find_files cwd=' }, - mru = { limit = 10, icon = ' History' }, - footer = {}, - } - } - - -- jumps cursor when was last cursor last time - require("nvim-lastplace").setup({ - -- Filetypes to ignore - ignore_filetypes = { - "gitcommit", "gitrebase", "svn", "hgcommit", "xxd", "COMMIT_EDITMSG" - }, - - -- Buffer types to ignore - ignore_buftypes = { - "quickfix", "nofile", "help", "terminal" - }, - - -- Center cursor after jumping - center_on_jump = true, - - -- Only jump if target line is not visible - jump_only_if_not_visible = false, - - -- Minimum lines required to enable jumping - min_lines = 10, - - -- Maximum line to jump to (0 = no limit) - max_line = 0, - - -- Open folds after jumping - open_folds = true, - - -- Enable debug messages - debug = false, - }) - -- ====================== - -- gruvbox - -- ====================== - - require("gruvbox").setup({ - terminal_colors = false, -- add neovim terminal colors - undercurl = true, - underline = true, - bold = true, - italic = { - strings = false, - emphasis = true, - comments = true, - operators = false, - folds = true, - }, - strikethrough = true, - invert_selection = false, - invert_signs = false, - invert_tabline = false, - inverse = true, -- invert background for search, diffs, statuslines and errors - contrast = "hard", -- can be "hard", "soft" or empty string - palette_overrides = { -- for overrides see https://github.com/ellisonleao/gruvbox.nvim/blob/main/lua/gruvbox.lua - dark0_hard = "#241F17" - }, - overrides = { - String = {fg = "#FFB878", italic = false}, - FoldColumn = {fg = faded_orange, bg = dark0_hard} - }, - dim_inactive = false, - transparent_mode = false, - }) - vim.opt.termguicolors = false - vim.o.background = "dark" - vim.cmd("colorscheme gruvbox") - -- ========================= - -- LUALINE - -- ========================= - require('lualine').setup { options = { theme = "gruvbox_dark" } } - - - --==================0 - -- Some utils - --================== - vim.keymap.set('n', 'r1', 'Fugit2', { desc = 'Open git helper' }) - - vim.keymap.set("n", "t", function() - local line = vim.api.nvim_get_current_line() - - local result = vim.fn.system({ "custom-syllabes" }, line) - - print(vim.trim(result)) - end, { desc = "Count syllables (current line)" }) - -- ========================= - -- telescope - -- ======================= - local builtin = require('telescope.builtin') - vim.keymap.set('n', 'f1', builtin.find_files, { desc = 'Telescope find files' }) - vim.keymap.set('n', 'f2', builtin.live_grep, { desc = 'Telescope live grep' }) - vim.keymap.set('n', 'f3', builtin.buffers, { desc = 'Telescope buffers' }) - vim.keymap.set('n', 'f4', builtin.help_tags, { desc = 'Telescope help tags' }) - - -- Disable relative numbers even if plugins override - vim.api.nvim_create_autocmd("VimEnter", { callback = function() vim.opt.colorcolumn = ""; vim.opt.relativenumber = false end }) - ''; - }; -} diff --git a/modules/home-manager/obsidian.nix b/modules/home-manager/obsidian.nix deleted file mode 100644 index 938145d..0000000 --- a/modules/home-manager/obsidian.nix +++ /dev/null @@ -1,26 +0,0 @@ -_: { - programs.obsidian = { - enable = true; - - vaults = { - miscellanious = { - enable = true; - target = "/Documents/Notes/miscellanious"; - }; - work = { - enable = true; - target = "/Documents/Notes/work"; - }; - }; - - defaultSettings = { - appearance.theme = "gruvbox"; - - extraFiles = { - ".obsidian/themes/gruvbox/manifest.json" = ../../other/obsidian-theme/manifest.json; - ".obsidian/themes/gruvbox/obsidian.css" = ../../other/obsidian-theme/obsidian.css; - ".obsidian/themes/gruvbox/theme.css" = ../../other/obsidian-theme/theme.css; - }; - }; - }; -} diff --git a/modules/home-manager/oh-my-posh.nix b/modules/home-manager/oh-my-posh.nix deleted file mode 100644 index 317b214..0000000 --- a/modules/home-manager/oh-my-posh.nix +++ /dev/null @@ -1,7 +0,0 @@ -_: { - programs.oh-my-posh = { - enable = true; - enableZshIntegration = true; - useTheme = "gruvbox"; - }; -} diff --git a/modules/home-manager/oh-my-zsh.nix b/modules/home-manager/oh-my-zsh.nix deleted file mode 100644 index 24095b9..0000000 --- a/modules/home-manager/oh-my-zsh.nix +++ /dev/null @@ -1,19 +0,0 @@ -_: { - programs.zsh.oh-my-zsh = { - enable = true; - theme = "jonathan"; - plugins = [ - "aliases" - "alias-finder" - "colored-man-pages" - "colorize" - "command-not-found" - "dirhistory" - "fzf" - "git" - "rclone" - "safe-paste" - "sudo" - ]; - }; -} diff --git a/modules/home-manager/other/desktopEntries.nix b/modules/home-manager/other/desktopEntries.nix deleted file mode 100644 index 41e8bbb..0000000 --- a/modules/home-manager/other/desktopEntries.nix +++ /dev/null @@ -1,30 +0,0 @@ -_: -# see ../../docs/printing.md -{ - home.file.".local/share/applications/org.quickshell.desktop" = { - enable = true; - text = '' - [Desktop Entry] - Name=QuickShell - Comment=QuickShell application - Exec=quickshell - Icon=utilities-terminal - Type=Application - Categories=Utility; - StartupNotify=true - X-DBUS-ServiceName=org.quickshell - ''; - }; - home.file.".local/share/applications/org.kde.PrintQueue.desktop" = { - enable = true; - text = '' - [Desktop Entry] - Type=Application - Name=Print Queue - Exec=print-queue - Icon=printer - Categories=Utility; - StartupNotify=true - ''; - }; -} diff --git a/modules/home-manager/other/user.nix b/modules/home-manager/other/user.nix deleted file mode 100644 index d35901b..0000000 --- a/modules/home-manager/other/user.nix +++ /dev/null @@ -1,9 +0,0 @@ -_: { - home.username = "tomasr"; - home.homeDirectory = "/home/tomasr"; - - home.sessionVariables = { - EDITOR = "neovim"; - TERMINAL = "kitty"; - }; -} diff --git a/modules/home-manager/quickshell.nix b/modules/home-manager/quickshell.nix deleted file mode 100644 index e2aedb1..0000000 --- a/modules/home-manager/quickshell.nix +++ /dev/null @@ -1,12 +0,0 @@ -# pulled from https://codeberg.org/zacoons/rivendell-hyprdots -_: { - qt.enable = true; - programs.quickshell = { - systemd.enable = true; - enable = true; - }; - home.file.".config/quickshell" = { - source = ../../other/quickshell; - recursive = true; - }; -} diff --git a/modules/home-manager/rclone.nix b/modules/home-manager/rclone.nix deleted file mode 100644 index 43797f5..0000000 --- a/modules/home-manager/rclone.nix +++ /dev/null @@ -1,6 +0,0 @@ -{pkgs-unstable, ...}: { - programs.rclone = { - enable = true; - package = pkgs-unstable.rclone; - }; -} diff --git a/modules/home-manager/ripgrep.nix b/modules/home-manager/ripgrep.nix deleted file mode 100644 index 03dfed6..0000000 --- a/modules/home-manager/ripgrep.nix +++ /dev/null @@ -1,14 +0,0 @@ -_: { - programs.ripgrep = { - enable = true; - arguments = [ - "-S" - "-." - "-p" - "-n" - ]; - }; - programs.ripgrep-all = { - enable = true; - }; -} diff --git a/modules/home-manager/rofi.nix b/modules/home-manager/rofi.nix deleted file mode 100644 index d4bf2be..0000000 --- a/modules/home-manager/rofi.nix +++ /dev/null @@ -1,6 +0,0 @@ -_: { - programs.rofi = { - enable = true; - theme = "gruvbox-dark-hard"; - }; -} diff --git a/modules/home-manager/sbb-tui.nix b/modules/home-manager/sbb-tui.nix deleted file mode 100644 index 6d379e2..0000000 --- a/modules/home-manager/sbb-tui.nix +++ /dev/null @@ -1,29 +0,0 @@ -_: { - home.packages = [ - #pkgs-unstable.sbb-tui - ]; - home.file.".config/sbb-tui/config.yaml" = { - enable = true; - # Gruvbox (from https://github.com/Necrom4/sbb-tui/blob/master/docs/themes.md) - text = '' - ui: - nerdfont: true - theme: - text: "#EBDBB2" - textMuted: "#928374" - error: "#FB4934" - warning: "#FB4934" - borderFocused: "#FABD2F" - borderUnfocused: "#504945" - badgeKeyFg: "#282828" - badgeKeyBg: "#FABD2F" - badgeVehicleFg: "#EBDBB2" - badgeVehicleBg: "#458588" - badgeModelFg: "#282828" - badgeModelBg: "#FB4934" - badgeCompanyFg: "#282828" - badgeCompanyBg: "#EBDBB2" - logo: "#EBDBB2" - ''; - }; -} diff --git a/modules/home-manager/ssh.nix b/modules/home-manager/ssh.nix deleted file mode 100644 index 8201c23..0000000 --- a/modules/home-manager/ssh.nix +++ /dev/null @@ -1,25 +0,0 @@ -_: { - programs.ssh = { - enable = true; - enableDefaultConfig = false; # will be removed in the futur. Removes evaluation warning - matchBlocks."*" = { - # equivalent to the default config - forwardAgent = false; - addKeysToAgent = "no"; - compression = false; - serverAliveInterval = 0; - serverAliveCountMax = 3; - hashKnownHosts = false; - userKnownHostsFile = "~/.ssh/known_hosts"; - controlMaster = "no"; - controlPath = "~/.ssh/master-%r@%n:%p"; - controlPersist = "no"; - }; - }; - services.ssh-agent.enable = true; - home.file.".ssh/config".text = '' - Host * - AddKeysToAgent yes - IdentityFile ~/.ssh/id_ed25519 - ''; -} diff --git a/modules/home-manager/swaylock.nix b/modules/home-manager/swaylock.nix deleted file mode 100644 index 226a296..0000000 --- a/modules/home-manager/swaylock.nix +++ /dev/null @@ -1,36 +0,0 @@ -_: { - programs.swaylock = { - enable = true; - settings = { - color = "1e1e2e"; - bs-hl-color = "f5e0dc"; - caps-lock-bs-hl-color = "f5e0dc"; - caps-lock-key-hl-color = "a6e3a1"; - inside-color = "00000000"; - inside-clear-color = "00000000"; - inside-caps-lock-color = "00000000"; - inside-ver-color = "00000000"; - inside-wrong-color = "00000000"; - key-hl-color = "a6e3a1"; - layout-bg-color = "00000000"; - layout-border-color = "00000000"; - layout-text-color = "cdd6f4"; - line-color = "00000000"; - line-clear-color = "00000000"; - line-caps-lock-color = "00000000"; - line-ver-color = "00000000"; - line-wrong-color = "00000000"; - ring-color = "b4befe"; - ring-clear-color = "f5e0dc"; - ring-caps-lock-color = "fab387"; - ring-ver-color = "89b4fa"; - ring-wrong-color = "eba0ac"; - separator-color = "00000000"; - text-color = "cdd6f4"; - text-clear-color = "f5e0dc"; - text-caps-lock-color = "fab387"; - text-ver-color = "89b4fa"; - text-wrong-color = "eba0ac"; - }; - }; -} diff --git a/modules/home-manager/swaync.nix b/modules/home-manager/swaync.nix deleted file mode 100644 index f89e51e..0000000 --- a/modules/home-manager/swaync.nix +++ /dev/null @@ -1,5 +0,0 @@ -_: { - services.swaync = { - enable = true; - }; -} diff --git a/modules/home-manager/thunderbird.nix b/modules/home-manager/thunderbird.nix deleted file mode 100644 index 767b475..0000000 --- a/modules/home-manager/thunderbird.nix +++ /dev/null @@ -1,8 +0,0 @@ -_: { - programs.thunderbird = { - enable = true; - profiles.tomasr = { - isDefault = true; - }; - }; -} diff --git a/modules/home-manager/vivify.nix b/modules/home-manager/vivify.nix deleted file mode 100644 index 57e6c1b..0000000 --- a/modules/home-manager/vivify.nix +++ /dev/null @@ -1,26 +0,0 @@ -{pkgs-unstable, ...}: { - home.file.".config/vivify/config.json" = { - enable = true; - text = '' - { - "browserOptions": { - "name": "qutebrowser", - "arguments": ["-T"] - } - }''; - }; - home.packages = [ - pkgs-unstable.vivify - ]; - programs.qutebrowser = { - enable = true; - settings = { - auto_save.session = false; - changelog_after_upgrade = "never"; - content.cookies.accept = "never"; - }; - extraConfig = '' - config.bind('', 'yank url ;; message-info "URL copied"') - ''; - }; -} diff --git a/modules/home-manager/waybar.nix b/modules/home-manager/waybar.nix deleted file mode 100644 index 8a0c935..0000000 --- a/modules/home-manager/waybar.nix +++ /dev/null @@ -1,693 +0,0 @@ -_: { - programs.waybar = { - enable = true; - settings = [ - { - layer = "top"; - position = "left"; - margin = "5 2 5 0"; - reload_style_on_change = true; - modules-left = [ - "hyprland/workspaces" - "group/info" - "group/power" - ]; - modules-center = [ - ]; - modules-right = [ - "hyprland/window" - "group/brightness" - "group/sound" - "group/connection" - "group/together" - "tray" - "battery" - ]; - # groups settings are organized by alphabetical order - "group/audio" = { - orientation = "inherit"; - drawer = { - transition-duration = 500; - transition-left-to-right = false; - }; - modules = [ - "pulseaudio" - "pulseaudio#mic" - "pulseaudio/slider" - ]; - }; - "group/bluetooth" = { - orientation = "inherit"; - drawer = { - transition-duration = 500; - transition-left-to-right = true; - }; - modules = [ - "bluetooth" - "bluetooth#status" - ]; - }; - "group/brightness" = { - orientation = "inherit"; - drawer = { - transition-duration = 500; - transition-left-to-right = false; - }; - modules = [ - "backlight" - "backlight/slider" - ]; - }; - "group/connection" = { - orientation = "inherit"; - modules = ["group/network"]; - }; - "group/gcpu" = { - orientation = "inherit"; - modules = [ - "custom/cpu-icon" - "temperature" - "cpu" - ]; - }; - "group/info" = { - orientation = "inherit"; - modules = [ - "group/gcpu" - "memory" - "disk" - ]; - }; - "group/network" = { - orientation = "inherit"; - drawer = { - transition-duration = 500; - transition-left-to-right = true; - }; - modules = [ - "network" - "network#speed" - ]; - }; - "group/power" = { - orientation = "inherit"; - modules = [ - "battery#w" - "battery#powerdraw" - ]; - }; - "group/sound" = { - orientation = "inherit"; - modules = [ - "group/audio" - "custom/notification" - ]; - }; - "group/together" = { - orientation = "inherit"; - modules = [ - "group/utils" - "clock" - ]; - }; - "group/utils" = { - orientation = "inherit"; - drawer = { - transition-duration = 500; - transition-left-to-right = true; - }; - modules = [ - "custom/weather" - "custom/colorpicker" - ]; - }; - # modules settings are organized by alphabetical order - backlight = { - device = "intel_backlight"; # my laptop is amd and it works - format = "{icon}"; - format-icons = [ - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - ]; - on-scroll-down = "brightnessctl s 5%-"; - on-scroll-up = "brightness s +5%"; - tooltip = true; - tooltip-format = "Brightness: {percent}%"; - smooth-scrolling-threshold = 1; - }; - "backlight/slider" = { - min = 5; - max = 100; - orientation = "vertical"; - device = "intel_backlight"; - }; - battery = { - #rotate = 90; - interval = 30; - states = { - good = 95; - warning = 20; - critical = 15; - }; - format = "{icon} {capacity}"; - format-charging = "{icon} {capacity}% "; - format-full = "{icon}"; - format-icons = [ - "󰁻" - "󰁼" - "󰁾" - "󰂀" - "󰂂" - "󰁹" - ]; - tooltip-format = "{timeTo} {capacity} %"; - }; - "battery#powerdraw" = { - rotate = 90; - interval = 10; - format = "{power:.0001f}"; - }; - "battery#w" = { - rotate = 90; - interval = 100000; - format = "W"; - }; - bluetooth = { - format-on = ""; - format-off = "󰂲"; - format-disabled = ""; - format-connected = ""; - tooltip-format = "{controller_alias}\t{controller_address}\n\n{num_connections} connected"; - tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}"; - tooltip-format-enumerate-connected = "{device_alias}\t{device_address}"; - tooltip-format-enumerate-connected-battery = "{device_alias}\t{device_address}\t{device_battery_percentage}%"; - }; - "bluetooth#status" = { - format-on = ""; - format-off = ""; - format-disabled = ""; - format-connected = "{num_connections}"; - format-connected-battery = "{device_battery_percentage}%"; - tooltip-format = "{controller_alias}\t{controller_address}\n\n{num_connections} connected"; - tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}"; - tooltip-format-enumerate-connected = "{device_alias}\t{device_address}"; - tooltip-format-enumerate-connected-battery = "{device_alias}\t{device_address}\t{device_battery_percentage}%"; - }; - clock = { - format = "{:%H\n%M}"; - tooltip-format = "{calendar}"; - calendar = { - mode = "month"; - mode-mon-col = 3; - weeks-pos = "right"; - on-scroll = 1; - on-click-right = "mode"; - format = { - today = "{}"; - }; - }; - }; - cpu = { - format = "{usage}%"; - }; - "custom/colorpicker" = { - format = ""; - on-click = "hyprpicker | tee >(wl-copy) | cliphist store"; - }; - "custom/cpu-icon" = { - format = "󰻠"; - tooltip = false; - }; - "custom/mark" = { - format = ""; - tooltip = false; - }; - "custom/weather" = { - format = "{}"; - interval = 3600; - exec = "custom-weatherwaybar"; - return-type = "json"; - }; - disk = { - interval = 600; - format = " 󰋊 \n{percentage_used}󱉸"; - path = "/"; #maybe we should subtract ~/kdrive if it is counted - }; - "hyprland/window" = { - format = "{class}"; - rotate = 90; - }; - "hyprland/workspaces" = { - format = "{icon}"; - format-icons = { - "1" = ""; - "2" = ""; - "3" = ""; - "4" = ""; - "5" = ""; - "6" = ""; - "7" = ""; - "8" = ""; - "9" = ""; - "10" = ""; - "active" = ""; - "default" = ""; - }; - persistent-workspaces = { - "*" = [1 2 3 4 5 6 7 8 9 10]; - }; - }; - idle_inhibitor = { - format = "{icon}"; - tooltip-format-activated = "Idle Inhibitor is active"; - tooltip-format-deactivated = "Idle Inhibitor is not active"; - format-icons = { - activated = "󰔡"; - deactivated = "󰔢"; - }; - }; - memory = { - format = "  \n{:2}󱉸"; - }; - network = { - format = "{icon}"; - format-icons = { - wifi = ["󰤨"]; - ethernet = ["󰈀"]; - disconnected = ["󰖪"]; - }; - format-wifi = "󰤨"; - format-ethernet = "󰈀"; - format-disconnected = "󰖪"; - format-linked = "󰈁"; - tooltip = false; - }; - "network#speed" = { - format = " {bandwidthDownBits} "; - rotate = 90; - interval = 5; - tooltip-format = "{ipaddr}"; - tooltip-format-wifi = "{essid} ({signalStrength}%)  \n{ipaddr} | {frequency} MHz{icon} "; - tooltip-format-ethernet = "{ifname} 󰈀 \n{ipaddr} | {frequency} MHz{icon} "; - tooltip-format-disconnected = "Not Connected to any type of Network"; - tooltip = true; - }; - power-profiles-daemon = { - format = "{icon}"; - tooltip-format = "Power profile: {profile}\nDriver: {driver}"; - tooltip = true; - format-icons = { - default = ""; - performance = ""; - balanced = ""; - power-saver = ""; - }; - }; - pulseaudio = { - format = "{icon}"; - format-bluetooth = "{icon}"; - tooltip-format = "{volume}% {icon} | {desc}"; - format-muted = "󰖁"; - format-icons = { - headphones = "󰋌"; - handsfree = "󰋌"; - headset = "󰋌"; - phone = ""; - portable = ""; - car = " "; - default = [ - "󰕿" - "󰖀" - "󰕾" - ]; - }; - on-click = "volume mute"; - on-click-middle = "pavucontrol"; - on-scroll-up = "pactl set-sink-volume @DEFAULT_SINK@ +5%"; - on-scroll-down = "pactl set-sink-volume @DEFAULT_SINK@ -5%"; - smooth-scrolling-threshold = 1; - }; - "pulseaudio#mic" = { - format = "{format_source}"; - format-source = ""; - format-source-muted = ""; - tooltip-format = "{volume}% {format_source}"; - on-click = "pactl set-source-mute 0 toggle"; - on-scroll-down = "pactl set-source-volume 0 -1%"; - on-scroll-up = "pactl set-source-volume 0 +1%"; - }; - "pulseaudio/slider" = { - min = 0; - max = 140; - orientation = "vertical"; - }; - temperature = { - format = "{temperatureC}°C"; - format-critical = "{temperatureC}°C"; - interval = 10; - }; - tray = { - icon-size = 18; - spacing = 10; - }; - } - ]; # home-manager wants the whole config as a list of bars - style = '' - @define-color foreground #c5c5c5; - @define-color background #191919; - @define-color cursor #c5c5c5; - - @define-color color0 #191919; - @define-color color1 #3a3632; - @define-color color2 #582c1e; - @define-color color3 #423f39; - @define-color color4 #50473c; - @define-color color5 #634723; - @define-color color6 #BAA470; - @define-color color7 #8c8c8c; - @define-color color8 #525252; - @define-color color9 #4e4843; - @define-color color10 #763b28; - @define-color color11 #59554c; - @define-color color12 #6b5f51; - @define-color color13 #855f2f; - @define-color color14 #796d62; - @define-color color15 #c5c5c5; - - @define-color active @color6; - - * { - font-size: 23px; - font-family: "0xProto Nerd Font"; - min-width: 8px; - min-height: 0px; - border: none; - border-radius: 0; - box-shadow: none; - text-shadow: none; - padding: 0px; - margin: 0px; - - } - - window#waybar { - transition-property: background-color; - transition-duration: 0.5s; - border-radius: 8px; - border: 2px solid @active; - background: @background; - background: alpha(@background, 0.7); - color: lighter(@active); - } - - menu, - tooltip { - border-radius: 8px; - padding: 2px; - border: 1px solid lighter(@active); - background: alpha(@background, 0.6); - - color: lighter(@active); - } - - menu label, - tooltip label { - font-size: 20px; - color: lighter(@active); - } - - #submap, - #tray>.needs-attention { - animation-name: blink-active; - animation-duration: 1s; - animation-timing-function: linear; - animation-iteration-count: infinite; - animation-direction: alternate; - } - - .modules-right { - margin: 0px 6px 6px 6px; - border-radius: 4px; - background: alpha(@background, 0.4); - color: lighter(@active); - } - - .modules-left { - transition-property: background-color; - transition-duration: 0.5s; - margin: 6px 6px 6px 6px; - border-radius: 4px; - background: alpha(@background, 0.4); - color: lighter(@active); - } - - #gcpu, - #custom-github, - #memory, - #disk, - #together, - #submap, - #custom-weather { - font-size: 17px; - } - - #custom-recorder, - #connection, - #cnoti, - #brightness, - #power, - #custom-updates, - #tray, - #audio, - #privacy, - #sound { - border-radius: 4px; - margin: 2px 2px 4px 2px; - background: alpha(darker(@active), 0.3); - } - - #custom-notifications { - padding-left: 4px; - } - - #custom-hotspot, - #custom-github, - #custom-notifications { - font-size: 20px; - } - - #custom-hotspot { - padding-right: 2px; - } - - #custom-vpn, - #custom-hotspot { - background: alpha(darker(@active), 0.3); - } - - #privacy-item { - padding: 6px 0px 6px 6px; - } - - #gcpu { - padding: 8px 0px 8px 0px; - } - - #custom-cpu-icon { - font-size: 36px; - } - - #custom-cputemp, - #temperature { - font-size: 17px; - } - #disk, - #memory, - #cpu { - font-size: 20px; - font-weight: bold; - } - - #custom-github { - padding-top: 2px; - padding-right: 4px; - } - - #custom-dmark { - color: alpha(@foreground, 0.3); - } - - #submap { - margin-bottom: 0px; - } - - #hyprland.window { - margin-left: 20px; - } - - #workspaces { - margin: 0px 2px; - padding: 4px 0px 0px 0px; - border-radius: 8px; - } - - #workspaces button { - transition-property: background-color; - transition-duration: 0.5s; - color: @foreground; - background: transparent; - border-radius: 4px; - color: alpha(@foreground, 0.3); - } - - #workspaces button.urgent { - font-weight: bold; - color: @foreground; - } - - #workspaces button.active { - padding: 4px 2px; - background: alpha(@active, 0.4); - color: lighter(@active); - border-radius: 4px; - } - - #network.wifi { - padding-right: 4px; - } - - #submap { - min-width: 0px; - margin: 4px 6px 4px 6px; - } - - #tray { - padding: 0px 0px 0px 0px; - } - - #bluetooth { - padding-top: 2px; - } - - #window { - border-radius: 8px; - padding: 4px 14px; - margin: 4px 2px 4px 2px; - } - - #battery { - font-size: 17px; - border-radius: 8px; - padding: 4px 0px; - margin: 4px 2px 4px 2px; - } - - #battery.discharging.warning { - animation-name: blink-yellow; - animation-duration: 1s; - animation-timing-function: linear; - animation-iteration-count: infinite; - animation-direction: alternate; - } - - #battery.discharging.critical { - animation-name: blink-red; - animation-duration: 1s; - animation-timing-function: linear; - animation-iteration-count: infinite; - animation-direction: alternate; - } - - #battery.powerdraw { - font-size: 17px; - padding: 0; - margin-right: -20px; - margin-left: -20px; - } - #battery.w { - font-size: 17px; - padding: 0; - margin-left: -20px; - margin-right: -20px; - } - - #clock { - font-weight: bold; - padding: 4px 2px 2px 2px; - } - - #pulseaudio.mic { - border-radius: 4px; - color: @background; - background: alpha(darker(@foreground), 0.6); - padding-left: 4px; - } - - #backlight-slider slider, - #pulseaudio-slider slider { - background-color: transparent; - box-shadow: none; - } - - #backlight-slider trough, - #pulseaudio-slider trough { - margin-top: 4px; - min-width: 6px; - min-height: 60px; - border-radius: 8px; - background-color: alpha(@background, 0.6); - } - - #backlight-slider highlight, - #pulseaudio-slider highlight { - border-radius: 8px; - background-color: lighter(@active); - } - - #bluetooth.discoverable, - #bluetooth.discovering, - #bluetooth.pairable { - border-radius: 8px; - animation-name: blink-active; - animation-duration: 1s; - animation-timing-function: linear; - animation-iteration-count: infinite; - animation-direction: alternate; - } - - @keyframes blink-active { - to { - background-color: @active; - color: @foreground; - } - } - - @keyframes blink-red { - to { - background-color: #c64d4f; - color: @foreground; - } - } - - @keyframes blink-yellow { - to { - background-color: #cf9022; - color: @foreground; - } - } - ''; - }; -} diff --git a/modules/home-manager/wlogout.nix b/modules/home-manager/wlogout.nix deleted file mode 100644 index 08b6a91..0000000 --- a/modules/home-manager/wlogout.nix +++ /dev/null @@ -1,115 +0,0 @@ -_: let - wallpaper = ../../assets/wallpaper1.jpg; - lock = ../../assets/lock.png; - lock-hover = ../../assets/lock-hover.png; - shutdown = ../../assets/power.png; - shutdown-hover = ../../assets/power-hover.png; - logout = ../../assets/logout.png; - logout-hover = ../../assets/logout-hover.png; - reboot = ../../assets/restart.png; - reboot-hover = ../../assets/restart-hover.png; -in { - programs.wlogout = { - enable = true; - layout = [ - { - label = "lock"; - action = "swaylock -eFLfk -i ${wallpaper}"; - text = " Lock (L) "; - keybind = "l"; - } - { - label = "reboot"; - action = "systemctl reboot"; - text = " Reboot (R) "; - keybind = "r"; - } - { - label = "shutdown"; - action = "systemctl poweroff"; - text = "Shutdown (S)"; - keybind = "s"; - } - { - label = "logout"; - action = "loginctl terminate-session $(loginctl show-session $(loginctl | grep $USER | awk '{print $1}') -p Id --value)"; - text = " Logout (E) "; - keybind = "e"; - } - ]; - style = '' - window { - font-family: OxProto Nerd Font; - font-size: 14pt; - color: #000000; /* text */ - background-color: rgba(40, 40, 40, 0.76); - } - - button { - background-repeat: no-repeat; - background-position: center; - background-size: 50%; - border-style: solid; - border-radius: 4px; - border-width: 2px; - border-color: #ebdbb2; - background-color: rgba(40, 40, 40, 0.76); - margin: 10px; - transition: - box-shadow 0.3s ease-in-out, - background-color 0.3s ease-in-out; - } - - button:hover { - background-color: rgba(250, 137, 26, 0.3); - color: #282828; - } - - button:focus { - background-color: #ebdbb2; - color: #282828; - } - - #lock { - background-image: image(url("${lock}")); - } - #lock:focus { - background-image: image(url("${lock-hover}")); - } - #lock:hover { - background-image: image(url("${lock-hover}")); - } - - #logout { - background-image: image(url("${logout}")); - } - #logout:focus { - background-image: image(url("${logout-hover}")); - } - #logout:hover { - background-image: image(url("${logout-hover}")); - } - - - #shutdown { - background-image: image(url("${shutdown}")); - } - #shutdown:focus { - background-image: image(url("${shutdown-hover}")); - } - #shutdown:hover { - background-image: image(url("${shutdown-hover}")); - } - - #reboot { - background-image: image(url("${reboot}")); - } - #reboot:focus { - background-image: image(url("${reboot-hover}")); - } - #reboot:hover { - background-image: image(url("${reboot-hover}")); - } - ''; - }; -} diff --git a/modules/home-manager/zoxide.nix b/modules/home-manager/zoxide.nix deleted file mode 100644 index 32ffebc..0000000 --- a/modules/home-manager/zoxide.nix +++ /dev/null @@ -1,6 +0,0 @@ -_: { - programs.zoxide = { - enable = true; - enableZshIntegration = true; - }; -} diff --git a/modules/home-manager/zsh.nix b/modules/home-manager/zsh.nix deleted file mode 100644 index bbb405e..0000000 --- a/modules/home-manager/zsh.nix +++ /dev/null @@ -1,55 +0,0 @@ -{pkgs-unstable, ...}: { - home.packages = [ - (pkgs-unstable.callPackage ../packages/deja.nix {}) - ]; - - programs.zsh = { - enable = true; - autosuggestion.enable = false; # zsh-autocomplete is replaced by deja - initContent = '' - # Safe cat that uses colorize plugin ccat - custom-cat() { - if [[ -t 1 ]]; then - ccat "$@" - else - command cat "$@" - fi - } - - custom-eza() { # behaves differently if we just call it or if we pipe initContent - if [[ -t 1 ]]; then - eza -hlF -aa --color=always --hyperlink --group-directories-first --show-symlinks --icons=always --git --no-permissions "$@" - else - command eza "$@" - fi - } - eval "$(direnv hook zsh)" - eval "$(deja init zsh)" - export PATH="$PATH:$HOME/NoteWrapper" # some project im coding - fastfetch''\n''; - shellAliases = { - ".." = "z .."; - grep = "rg"; - ll = "custom-eza"; # if there is a special ls just use the big eza - la = "custom-eza"; - l = "custom-eza"; - eza = "custom-eza"; - ls = "\\eza -a"; # ls -> normal ls. eza gives more info - tree = "\\eza -hlTF --color=always --hyperlink --group-directories-first --show-symlinks --icons=always --git --no-permissions"; - cat = "custom-cat"; - pomodoro = "custom-tomato"; - librewolf = "kitty --class \"custom-librewolfprofiles\" --name \"Select LibreWolf profile\" --hold custom-librewolfprofiles"; - manix = "custom-manix"; - man = "custom-man"; - mplayer = "mplayer -volume 5"; - # these are to create the developpement shell - cenv = "nix-shell -p zsh gcc raylib libx11 libGL"; - # i always write nvim wrong :( - nbim = "nvim"; - nivm = "nvim"; - bivm = "nvim"; - nibm = "nvim"; - vikm = "nvim"; - }; - }; -} diff --git a/modules/hosts/laptop.nix b/modules/hosts/laptop.nix new file mode 100644 index 0000000..509be21 --- /dev/null +++ b/modules/hosts/laptop.nix @@ -0,0 +1,114 @@ +{ inputs, self, ...}: { + flake.nixosConfiguration.laptop = inputs.nixpkgs.lib.nixosSystem { + modules = with self.nixosModules; [ + # keep this alphabetically organised + anki + audioAndMedia + autoCleanup-laptop + autoUpdate-laptop + battery-laptop + bluetooth + bootloader-laptop + browsers + caelestia + development + documentation + disk + disk-laptop + fonts + games + hardware-configuration-laptop + hardwareUtils-laptop + home-manager-laptop + hyprland + IO + kdrive + latex + ly + mullvad + networking + notifications + office + #ollama + otherUtils + printer + udev + user + ]; + }; + flake.homeConfiguration.tomasr = inputs.home-manager.lib.homeManagerConfiguration { + pkgs = import inputs.nixpkgs { system = "x86_64-linux"; }; + pkgs-unstable = import inputs.nixpkgs-unstable { system = "x86_64-linux"; }; + modules = with self.homeModules; [ + anki + cursor + eza + fastfetch + git + gtk + hyprland + hyprland-laptop + kitty + librewolf + mullvad + neovim + oh-my-zsh + ripgrep + rofi + sbb-tui + ssh + thunderbird + tomasrModule + vivify + zoxide + zsh + zsh-laptop + ]; + }; + flake.nixosModules.laptop = { ... }: { + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "25.11"; # Did you read the comment? + + home-manager.users.USERNAME = self.homeModules.USERNAMEModule; + }; + flake.nixosModules.home-manager-laptop = { ... }: { + imports = [ + inputs.home-manager.nixosModules.default # import official home-manager NixOS module + ]; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + }; + }; + flake.homeModules.tomasrModule = { ... }: { + imports = [ + inputs.caelestia-shell.homeManagerModules.default + ]; + home.username = "tomasr"; + home.homeDirectory = "/home/tomasr"; + + home.sessionVariables = { + EDITOR = "neovim"; + TERMINAL = "kitty"; + }; + + # Required for Home Manager + home.stateVersion = "25.11"; # match your Home Manager release + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + }; +} diff --git a/modules/nixos/.lyBROKEN.nix b/modules/nixos/.lyBROKEN.nix deleted file mode 100644 index e36c697..0000000 --- a/modules/nixos/.lyBROKEN.nix +++ /dev/null @@ -1,302 +0,0 @@ -_: { - services.displayManager.ly = { - enable = true; - settings = { - animation = "gameoflife"; # none or doom or matrix or gameoflife or a dur file - animation_frame_delay = 5; - animation_timeout_sec = 0; - asterisk = "0x2022"; - auth_fails = 2; # numbers of failed authentification before special animation - battery_id = "BAT1"; - bigclock = "en"; - bigclock_12hr = false; - bigclock_seconds = false; - # Blank main box background - # Setting to false will make it transparent - blank_box = false; - - # Border foreground color id - border_fg = "0x00FFFFFF"; - - # Title to show at the top of the main box - # If set to null, none will be shown - box_title = null; - - # Brightness decrease command - brightness_down_cmd = "$PREFIX_DIRECTORY/bin/brightnessctl -q -n s 10%-"; - - # Brightness decrease key combination, or null to disable - brightness_down_key = "F5"; - - # Brightness increase command - brightness_up_cmd = "$PREFIX_DIRECTORY/bin/brightnessctl -q -n s +10%"; - - # Brightness increase key combination, or null to disable - brightness_up_key = "F6"; - - # Erase password input on failure - clear_password = true; - - # Format string for clock in top right corner (see strftime specification). Example: %c - # If null, the clock won't be shown - clock = true; - - # CMatrix animation foreground color id - cmatrix_fg = "0x0000FF00"; - - # CMatrix animation character string head color id - cmatrix_head_col = "0x01FFFFFF"; - - # CMatrix animation minimum codepoint. It uses a 16-bit integer - # For Japanese characters for example, you can use 0x3000 here - cmatrix_min_codepoint = "0x21"; - - # CMatrix animation maximum codepoint. It uses a 16-bit integer - # For Japanese characters for example, you can use 0x30FF here - cmatrix_max_codepoint = "0x7B"; - - # Color mixing animation first color id - colormix_col1 = "0x00FF0000"; - - # Color mixing animation second color id - colormix_col2 = "0x000000FF"; - - # Color mixing animation third color id - colormix_col3 = "0x20000000"; - - # Custom sessions directory - # You can specify multiple directories, - # e.g. $CONFIG_DIRECTORY/ly/custom-sessions:$PREFIX_DIRECTORY/share/custom-sessions - custom_sessions = "$CONFIG_DIRECTORY/ly/custom-sessions"; - - # Input box active by default on startup - # Available inputs: info_line, session, login, password - default_input = "password"; - - # DOOM animation fire height (1 thru 9) - doom_fire_height = 6; - - # DOOM animation fire spread (0 thru 4) - doom_fire_spread = 2; - - # DOOM animation custom top color (low intensity flames) - doom_top_color = "0x009F2707"; - - # DOOM animation custom middle color (medium intensity flames) - doom_middle_color = "0x00C78F17"; - - # DOOM animation custom bottom color (high intensity flames) - doom_bottom_color = "0x00FFFFFF"; - - # Dur file path - dur_file_path = "$CONFIG_DIRECTORY/ly/example.dur"; - - # Dur file alignment - # The dur file can be aligned with a direction and centered easily with the flags below - # Available inputs: topleft, topcenter, topright, centerleft, center, centerright, bottomleft, bottomcenter, bottomright - dur_offset_alignment = "center"; - - # Dur offset x direction (value is added to the current position determined by alignment, negatives are supported) - dur_x_offset = 0; - - # Dur offset y direction (value is added to the current position determined by alignment, negatives are supported) - dur_y_offset = 0; - - # Set margin to the edges of the DM (useful for curved monitors) - edge_margin = 0; - - # Error background color id - error_bg = "0x00000000"; - - # Error foreground color id - # Default is red and bold - error_fg = "0x01FF0000"; - - # Foreground color id - fg = "0x00FFFFFF"; - - # Render true colors (if supported) - # If false, output will be in eight-color mode - # All eight-color mode color codes: - # TB_DEFAULT 0x0000 - # TB_BLACK 0x0001 - # TB_RED 0x0002 - # TB_GREEN 0x0003 - # TB_YELLOW 0x0004 - # TB_BLUE 0x0005 - # TB_MAGENTA 0x0006 - # TB_CYAN 0x0007 - # TB_WHITE 0x0008 - # If full color is off, the styling options still work. The colors are - # always 32-bit values with the styling in the most significant byte. - # Note: If using the dur_file animation option and the dur file's color range - # is saved as 256 with this option disabled, the file will not be drawn. - full_color = true; - - # Game of Life entropy interval (0 = disabled, >0 = add entropy every N generations) - # 0 -> Pure Conway's Game of Life (will eventually stabilize) - # 10 -> Add entropy every 10 generations (recommended for continuous activity) - # 50+ -> Less frequent entropy for more natural evolution - gameoflife_entropy_interval = 10; - - # Game of Life animation foreground color id - gameoflife_fg = "0x0000FF00"; - - # Game of Life frame delay (lower = faster animation, higher = slower) - # 1-3 -> Very fast animation - # 6 -> Default smooth animation speed - # 10+ -> Slower, more contemplative speed - gameoflife_frame_delay = 3; - - # Game of Life initial cell density (0.0 to 1.0) - # 0.1 -> Sparse, minimal activity - # 0.4 -> Balanced activity (recommended) - # 0.7+ -> Dense, chaotic patterns - gameoflife_initial_density = 0.666; - - # Command executed when pressing hibernate key (can be null) - hibernate_cmd = null; - - # Specifies the key combination used for hibernate - hibernate_key = "F4"; - - # Remove main box borders - hide_borders = false; - - # Remove power management command hints - hide_key_hints = false; - - # Remove keyboard lock states from the top right corner - hide_keyboard_locks = false; - - # Remove version number from the top left corner - hide_version_string = false; - - # Command executed when no input is detected for a certain time - # If null, no command will be executed - inactivity_cmd = null; - - # Executes a command after a certain amount of seconds - inactivity_delay = 0; - - # Initial text to show on the info line - # If set to null, the info line defaults to the hostname - initial_info_text = null; - - # Input boxes length - input_len = 34; - - # Active language - # Available languages are found in $CONFIG_DIRECTORY/ly/lang/ - lang = "en"; - - # Command executed when logging in - # If null, no command will be executed - # Important: the code itself must end with `exec "$@"` in order to launch the session! - # You can also set environment variables in there, they'll persist until logout - login_cmd = null; - - # Path for login.defs file (used for listing all local users on the system on - # Linux) - #login_defs_path = /etc/login.defs - - # Command executed when logging out - # If null, no command will be executed - # Important: the session will already be terminated when this command is executed, so - # no need to add `exec "$@"` at the end - logout_cmd = null; - - # General log file path - #ly_log = /var/log/ly.log - - # Main box horizontal margin - margin_box_h = 2; - - # Main box vertical margin - margin_box_v = 1; - - # Set numlock on/off at startup - numlock = false; - - # Default path - # If null, ly doesn't set a path - #path = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - - # Command executed when pressing restart_key - #restart_cmd = "/sbin/shutdown -r now" - - # Specifies the key combination used for restart - restart_key = "F2"; - - # Save the current desktop and login as defaults, and load them on startup - save = true; - - # Service name (set to ly to use the provided pam config file) - service_name = "ly"; - - # Session log file path - # This will contain stdout and stderr of Wayland sessions - # By default it's saved in the user's home directory - # Important: due to technical limitations, X11, shell sessions as well as - # launching session via KMSCON aren't supported, which means you won't get any - # logs from those sessions. - # If null, no session log will be created - session_log = null; - - # Setup command - setup_cmd = "$CONFIG_DIRECTORY/ly/setup.sh"; - - # Command executed when pressing shutdown_key - shutdown_cmd = "/sbin/shutdown $PLATFORM_SHUTDOWN_ARG now"; - - # Specifies the key combination used for shutdown - shutdown_key = "F1"; - - # Command executed when pressing sleep key (can be null) - sleep_cmd = null; - - # Specifies the key combination used for sleep - sleep_key = "F3"; - - # Command executed when starting Ly (before the TTY is taken control of) - # See file at path below for an example of changing the default TTY colors - start_cmd = "$CONFIG_DIRECTORY/ly/startup.sh"; - - # Center the session name. - text_in_center = false; - - # Default vi mode - # normal -> normal mode - # insert -> insert mode - vi_default_mode = "normal"; - - # Enable vi keybindings - vi_mode = false; - - # Wayland desktop environments - # You can specify multiple directories, - # e.g. $PREFIX_DIRECTORY/share/wayland-sessions:$PREFIX_DIRECTORY/local/share/wayland-sessions - waylandsessions = "$PREFIX_DIRECTORY/share/wayland-sessions"; - - # Xorg server command - x_cmd = "$PREFIX_DIRECTORY/bin/X"; - - # Xorg virtual terminal number - # Mostly useful for FreeBSD where choosing the current TTY causes issues - # If null, the current TTY will be chosen - x_vt = null; - - # Xorg xauthority edition tool - xauth_cmd = "$PREFIX_DIRECTORY/bin/xauth"; - - # xinitrc - # If null, the xinitrc session will be hidden - xinitrc = "~/.xinitrc"; - - # Xorg desktop environments - # You can specify multiple directories, - # e.g. $PREFIX_DIRECTORY/share/xsessions:$PREFIX_DIRECTORY/local/share/xsessions - xsessions = "$PREFIX_DIRECTORY/share/xsessions"; - }; - }; -} diff --git a/modules/nixos/.udevBROKEN.nix b/modules/nixos/.udevBROKEN.nix deleted file mode 100644 index d7e48b4..0000000 --- a/modules/nixos/.udevBROKEN.nix +++ /dev/null @@ -1,138 +0,0 @@ -{ - config, - pkgs, - ... -}: { - # udev are setup for controlling the framework 16 laptop's keyboard - services.udev.extraRules = '' - ## https://github.com/qmk/qmk_firmware/blob/master/util/udev/50-qmk.extraRules - ## Atmel DFU - #### ATmega16U2 - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2fef", TAG+="uaccess" - #### ATmega32U2 - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff0", TAG+="uaccess" - #### ATmega16U4 - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff3", TAG+="uaccess" - #### ATmega32U4 - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff4", TAG+="uaccess" - #### AT90USB64 - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff9", TAG+="uaccess" - #### AT90USB162 - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ffa", TAG+="uaccess" - #### AT90USB128 - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ffb", TAG+="uaccess" - # - ## Input Club - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="1c11", ATTRS{idProduct}=="b007", TAG+="uaccess" - # - ## STM32duino - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="1eaf", ATTRS{idProduct}=="0003", TAG+="uaccess" - ## STM32 DFU - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", TAG+="uaccess" - # - ## BootloadHID - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05df", TAG+="uaccess" - # - ## USBAspLoader - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", TAG+="uaccess" - # - ## USBtinyISP - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="1782", ATTRS{idProduct}=="0c9f", TAG+="uaccess" - # - ## ModemManager should ignore the following devices - ## Atmel SAM-BA (Massdrop) - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="6124", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - # - ## Caterina (Pro Micro) - ### pid.codes shared PID - #### Keyboardio Atreus 2 Bootloader - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="2302", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - ### Spark Fun Electronics - #### Pro Micro 3V3/8MHz - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9203", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - #### Pro Micro 5V/16MHz - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9205", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - #### LilyPad 3V3/8MHz (and some Pro Micro clones) - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b4f", ATTRS{idProduct}=="9207", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - ### Pololu Electronics - #### A-Star 32U4 - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="1ffb", ATTRS{idProduct}=="0101", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - ### Arduino SA - #### Leonardo - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0036", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - #### Micro - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0037", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - ### Adafruit Industries LLC - #### Feather 32U4 - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="239a", ATTRS{idProduct}=="000c", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - #### ItsyBitsy 32U4 3V3/8MHz - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="239a", ATTRS{idProduct}=="000d", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - #### ItsyBitsy 32U4 5V/16MHz - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="239a", ATTRS{idProduct}=="000e", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - ### dog hunter AG - #### Leonardo - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="2a03", ATTRS{idProduct}=="0036", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - #### Micro - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="2a03", ATTRS{idProduct}=="0037", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1" - # - ## hid_listen - #KERNEL=="hidraw*", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl" - # - ## hid bootloaders - ### QMK HID - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2067", TAG+="uaccess" - ### PJRC's HalfKay - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="0478", TAG+="uaccess" - # - ## APM32 DFU - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="314b", ATTRS{idProduct}=="0106", TAG+="uaccess" - # - ## GD32V DFU - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="28e9", ATTRS{idProduct}=="0189", TAG+="uaccess" - # - ## WB32 DFU - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="342d", ATTRS{idProduct}=="dfa0", TAG+="uaccess" - # - ## AT32 DFU - # SUBSYSTEMS=="usb", ATTRS{idVendor}=="2e3c", ATTRS{idProduct}=="df11", TAG+="uaccess" - - - # and # https://community.frame.work/t/guide-updated-after-firmware-updates-udev-rules-for-https-keyboard-frame-work/78708 - - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0010", TAG+="uaccess" - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0012", TAG+="uaccess" - SUBSYSTEMS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0013", TAG+="uaccess" - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0014", TAG+="uaccess" - SUBSYSTEMS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0018", TAG+="uaccess" - #SUBSYSTEMS=="usb", ATTRS{idVendor}=="32ac", ATTRS{idProduct}=="0019", TAG+="uaccess" - - - - - # USB [VendorID]:[ProductID] “[Manufacturer][Product name]” - # 32ac:0012 “Framework Laptop 16 Keyboard Module - ANSI” - # 32ac:0013 “Framework Laptop 16 RGB Macropad” - # 32ac:0014 “Framework Laptop 16 Numpad Module” - # 32ac:0018 “Framework Laptop 16 Keyboard Module - ISO” - # 32ac:0019 “Framework Laptop 16 Keyboard Module - JIS” - - - ##https://github.com/ublue-os/config/blob/main/files/etc/udev/rules.d/50-framework16.rules - ## Audio Expansion Card - #ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="32ac", ATTR{idProduct}=="0010", ATTR{power/autosuspend}="10", ATTR{power/control}="auto", GOTO="rules_end" - # - ## Framework Laptop 16 Keyboard Module - ANSI - #ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="32ac", ATTR{idProduct}=="0012", ATTR{power/autosuspend}="-1", ATTR{power/control}="on", ATTR{power/wakeup}="disabled", GOTO="rules_end" - # - ## Framework Laptop 16 RGB Macropad - # - ## Framework Laptop 16 Numpad Module - #ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="32ac", ATTR{idProduct}=="0014", ATTR{power/autosuspend}="-1", ATTR{power/control}="on", ATTR{power/wakeup}="disabled", GOTO="rules_end" - # - ## Framework Laptop 16 Keyboard Module - #ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="32ac", ATTR{idProduct}=="0018", ATTR{power/autosuspend}="-1", ATTR{power/control}="on", ATTR{power/wakeup}="disabled", GOTO="rules_end" - # - #LABEL="rules_end" - - ''; -} diff --git a/modules/nixos/IO.nix b/modules/nixos/IO.nix deleted file mode 100644 index f9fa255..0000000 --- a/modules/nixos/IO.nix +++ /dev/null @@ -1,20 +0,0 @@ -{pkgs, ...}: { - # Configure keymap in X11 - services.xserver.xkb = { - layout = "ch"; - variant = "fr"; - }; - - # Configure console keymap - console.keyMap = "fr_CH"; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - environment.systemPackages = with pkgs; [ - wl-clipboard - cliphist - hyprkeys # keybind helper - hyprpicker - ]; -} diff --git a/modules/nixos/anki.nix b/modules/nixos/anki.nix deleted file mode 100644 index e396d06..0000000 --- a/modules/nixos/anki.nix +++ /dev/null @@ -1,53 +0,0 @@ -{pkgs, ...}: { - environment.systemPackages = with pkgs; [ - (pkgs.anki.withAddons [ - (pkgs.ankiAddons.recolor.withConfig { - config = { - # we must specify all the colors or it crashes as this overwrite the whole colors set - colors = { - # ===== Foregrounds ===== - FG = ["Foreground" "#ebdbb2" "#ebdbb2" ""]; - FG_SUBTLE = ["Subtle FG" "#d5c4a1" "#d5c4a1" ""]; - FG_FAINT = ["Faint FG" "#a89984" "#a89984" ""]; - FG_DISABLED = ["Disabled FG" "#928374" "#928374" ""]; - - # ===== Main Background Layers ===== - BG = ["Background" "#1d2021" "#1d2021" ""]; - MAIN_BG = ["Main Background" "#1d2021" "#1d2021" ""]; - VIEW_BG = ["View Background" "#282828" "#282828" ""]; - EDITOR_BG = ["Editor Background" "#282828" "#282828" ""]; - CANVAS = ["Canvas" "#282828" "#282828" ""]; - CANVAS_ELEVATED = ["Elevated Canvas" "#32302f" "#32302f" ""]; - - # ===== Tables & Lists ===== - TABLE_BG = ["Table Background" "#282828" "#282828" ""]; - TABLE_ALT_BG = ["Table Alt Background" "#32302f" "#32302f" ""]; - HEADER_BG = ["Header Background" "#3c3836" "#3c3836" ""]; - SELECTED_BG = ["Selected Background" "#504945" "#504945" ""]; - - # ===== Borders ===== - BORDER = ["Border" "#504945" "#504945" ""]; - FAINT_BORDER = ["Faint Border" "#3c3836" "#3c3836" ""]; - - # ===== Buttons ===== - BUTTON_GRADIENT_START = ["Button Start" "#3c3836" "#3c3836" ""]; - BUTTON_GRADIENT_END = ["Button End" "#3c3836" "#3c3836" ""]; - BUTTON_HOVER = ["Button Hover" "#665c54" "#665c54" ""]; - - # ===== Accent & Links ===== - ACCENT = ["Accent" "#458588" "#458588" ""]; - LINK = ["Link" "#83a598" "#83a598" ""]; - LINK_HOVER = ["Link Hover" "#8ec07c" "#8ec07c" ""]; - - # ===== Status ===== - WARNING = ["Warning" "#fe8019" "#fe8019" ""]; - ERROR = ["Error" "#fb4934" "#fb4934" ""]; - SUCCESS = ["Success" "#8ec07c" "#8ec07c" ""]; - }; - }; - # version = { major = 3; minor = 1; }; - # let nixpkgs handle the version - }) - ]) - ]; -} diff --git a/modules/nixos/audioAndMedia.nix b/modules/nixos/audioAndMedia.nix deleted file mode 100644 index d6bef91..0000000 --- a/modules/nixos/audioAndMedia.nix +++ /dev/null @@ -1,34 +0,0 @@ -{pkgs, ...}: { - # 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; - }; - environment.systemPackages = with pkgs; [ - (pkgs.callPackage ../../modules/scripts/changeAudioOutput.nix {}) - kdePackages.okular - kdePackages.dolphin - pulseaudio # sound server - playerctl # controls media player - pavucontrol # PulseAudio Volume Control - mplayer # Movie player that supports many video formats - krita # image edition - yt-dlp # some youtube downloader - vlc - #mprisence # Highly customizable Discord Rich Presence for MPRIS media players on Linux - #gif-for-cli # Render gifs as ASCII art in your cli - #rembg # background remover - gpu-screen-recorder - inkscape - ]; -} diff --git a/modules/nixos/bluetooth.nix b/modules/nixos/bluetooth.nix deleted file mode 100644 index 8934420..0000000 --- a/modules/nixos/bluetooth.nix +++ /dev/null @@ -1,6 +0,0 @@ -{pkgs, ...}: { - hardware.bluetooth.enable = true; - environment.systemPackages = with pkgs; [ - blueman # GTK-based Bluetooth Manager - ]; -} diff --git a/modules/nixos/browser.nix b/modules/nixos/browser.nix deleted file mode 100644 index b06bc32..0000000 --- a/modules/nixos/browser.nix +++ /dev/null @@ -1,13 +0,0 @@ -# configuration for main browser is in ../home-manager/librewolf.nix -# configuration for qutebrowser is in ../home-manager/vivify.nix -{ - pkgs, - pkgs-unstable, - ... -}: { - environment.systemPackages = with pkgs; [ - chromium # used only to flash the firmware on my framework laptop 16 (keyboard.frame.work) as only chromium based browser support webHID. - pkgs-unstable.tor-browser - (pkgs.callPackage ../../modules/scripts/librewolfprofiles.nix {}) # fzf librewolf profile selector - ]; -} diff --git a/modules/nixos/development.nix b/modules/nixos/development.nix deleted file mode 100644 index eb5b191..0000000 --- a/modules/nixos/development.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - pkgs, - pkgs-unstable, - ... -}: { - programs.nix-ld.enable = true; #Run unpatched dynamic binaries on NixOS. For example lets run ./a.out from gcc - environment.systemPackages = with pkgs; [ - gcc - jq # json parser used in some scripts - jp # lightweight and flexible cli JSON parser - (pkgs-unstable.python314.withPackages (ps: - with ps; [ - matplotlib - networkx - scipy - ])) - python313Packages.pygments # used for ccat (comment of colorize plugin from oh-my-zsh) - pkg-config - gdb - raylib - glfw # raylib and some dependecies - gnumake - go - direnv - cling # c interpreter used for coding - # lsp - clang-tools - python311Packages.python-lsp-server - ltex-ls-plus - pylint - black - ]; -} diff --git a/modules/nixos/disk.nix b/modules/nixos/disk.nix deleted file mode 100644 index 97d8c5a..0000000 --- a/modules/nixos/disk.nix +++ /dev/null @@ -1,11 +0,0 @@ -{pkgs, ...}: { - environment.systemPackages = with pkgs; [ - gnome-disk-utility - udiskie # removable disk automounter for udisks - (pkgs.callPackage ../../modules/scripts/mountkdrive.nix {}) - ]; - - # removes rclone error - programs.fuse.userAllowOther = true; - programs.fuse.enable = true; -} diff --git a/modules/nixos/documentation.nix b/modules/nixos/documentation.nix deleted file mode 100644 index a06b79c..0000000 --- a/modules/nixos/documentation.nix +++ /dev/null @@ -1,14 +0,0 @@ -{pkgs, ...}: { - documentation.man.generateCaches = true; # used for the man script - - environment.pathsToLink = [ - # see https://wiki.nixos.org/wiki/Documentation_Gaps#How_do_manpages_work?_Or:_environment.pathsToLink_and_buildEnv - "/share/applications" - "/share/xdg-desktop-portal" - ]; - environment.systemPackages = [ - pkgs.manix - (pkgs.callPackage ../../modules/scripts/manix.nix {}) # fzf manix searcher - (pkgs.callPackage ../../modules/scripts/man.nix {}) # fzf man searcher - ]; -} diff --git a/modules/nixos/fonts.nix b/modules/nixos/fonts.nix deleted file mode 100644 index 2d816ff..0000000 --- a/modules/nixos/fonts.nix +++ /dev/null @@ -1,12 +0,0 @@ -{pkgs, ...}: { - # fonts - fonts.packages = with pkgs; [ - nerd-fonts._0xproto - cinzel - times-newer-roman - ]; - - environment.systemPackages = with pkgs; [ - gnome-font-viewer - ]; -} diff --git a/modules/nixos/games.nix b/modules/nixos/games.nix deleted file mode 100644 index 1321fd7..0000000 --- a/modules/nixos/games.nix +++ /dev/null @@ -1,7 +0,0 @@ -{pkgs, ...}: { - environment.systemPackages = with pkgs; [ - supertux # fuck mario - supertuxkart # fuck mariokart - # my favorite italian plumber is free software - ]; -} diff --git a/modules/nixos/latex.nix b/modules/nixos/latex.nix deleted file mode 100644 index e9787bc..0000000 --- a/modules/nixos/latex.nix +++ /dev/null @@ -1,44 +0,0 @@ -{pkgs, ...}: { - environment.systemPackages = with pkgs; [ - texlab - ltex-ls-plus - biber - (pkgs.texliveMedium.withPackages ( - ps: - with ps; [ - # these few pkgs are used in the CV template - titlesec # allows creating custom \section - marvosym # some symboles - ebgaramond # Use the EB Garamond font - microtype # To enable letterspacing - fontaxes - # these few pkgs were used for my TM - svg - catchfile - caption - transparent - cfr-lm - svn-prov - nfssext-cfr - hyphenat - csquotes - enumitem - chngcntr - tcolorbox - pdfcol - wrapfig - tocloft - lastpage - biblatex - biblatex-iso690 - libertine - minted - upquote - lipsum - footmisc - #(setq org-latex-compiler "lualatex") - #(setq org-preview-latex-default-process 'dvisvgm) - ] - )) - ]; -} diff --git a/modules/nixos/ly.nix b/modules/nixos/ly.nix deleted file mode 100644 index 0aff326..0000000 --- a/modules/nixos/ly.nix +++ /dev/null @@ -1,94 +0,0 @@ -_: { - # a minimal ly config as the big config (ly.nix) didnt worked - services.displayManager.ly = { - enable = true; - settings = { - # Core animation - animation = "none"; # none or doom or matrix or gameoflife or a dur file - # Ly supports 24-bit true color with styling, which means each color is a 32-bit value. - # The format is 0xSSRRGGBB, where SS is the styling, RR is red, GG is green, and BB is blue. - # Here are the possible styling options: - # TB_BOLD 0x01000000 - # TB_UNDERLINE 0x02000000 - # TB_REVERSE 0x04000000 - # TB_ITALIC 0x08000000 - # TB_BLINK 0x10000000 - # TB_HI_BLACK 0x20000000 - # TB_BRIGHT 0x40000000 - # TB_DIM 0x80000000 - # Programmatically, you'd apply them using the bitwise OR operator (|), but because Ly's - # configuration doesn't support using it, you have to manually compute the color value. - # Note that, if you want to use the default color value of the terminal, you can use the - # special value 0x00000000. This means that, if you want to use black, you *must* use - # the styling option TB_HI_BLACK (the RGB values are ignored when using this option). - # Basic TUI settings - clear_password = true; - default_input = "password"; - fg = "0x01cd6400"; - full_color = true; - hide_borders = false; - hide_key_hints = false; - hide_keyboard_locks = true; - hide_version_string = false; - input_len = 34; - lang = "en"; - numlock = false; - save = true; - service_name = "ly"; - - bigclock = "en"; - clock = "%H:%M"; - - colormix_col1 = "0x08E85D04"; - colormix_col2 = "0x08FABD2F"; - colormix_col3 = "0x08FE8019"; - - # Box appearance - #border_fg = "0x00FFFFFF"; - blank_box = true; - box_title = "tomasr@nixos"; - #margin_box_h = 2; - #margin_box_v = 1; - #text_in_center = false; - - # Animation: Conway’s Game of Life (optional, comment out for minimal setup) - gameoflife_fg = "0x40FFFFFF"; - - gameoflife_frame_delay = 3; - gameoflife_entropy_interval = 10; - gameoflife_initial_density = 0.666; - - # Optional commands (leave null or comment if unused) - hibernate_cmd = null; - inactivity_cmd = null; - login_cmd = "start-hyprland"; - #logout_cmd = null; - sleep_cmd = null; - - # System commands keys - shutdown_cmd = "/sbin/shutdown $PLATFORM_SHUTDOWN_ARG now"; - shutdown_key = "F1"; - restart_key = "F2"; - sleep_key = "F3"; - hibernate_key = "F4"; - - # top bar - session_log = null; - initial_info_text = null; # - # Custom sessions - #custom_sessions = "$CONFIG_DIRECTORY/ly/custom-sessions"; - #waylandsessions = "$PREFIX_DIRECTORY/share/wayland-sessions"; - #xsessions = "$PREFIX_DIRECTORY/share/xsessions"; - - # Xorg settings (only needed if using X) - #x_cmd = "$PREFIX_DIRECTORY/bin/X"; - #x_vt = null; - #xauth_cmd = "$PREFIX_DIRECTORY/bin/xauth"; - #xinitrc = "~/.xinitrc"; - - # Setup / startup scripts - #setup_cmd = "$CONFIG_DIRECTORY/ly/setup.sh"; - #start_cmd = "$CONFIG_DIRECTORY/ly/startup.sh"; - }; - }; -} diff --git a/modules/nixos/mullvad.nix b/modules/nixos/mullvad.nix deleted file mode 100644 index 2ca7e01..0000000 --- a/modules/nixos/mullvad.nix +++ /dev/null @@ -1,7 +0,0 @@ -# see also ../home-manager/mullvad.nix -{pkgs-unstable, ...}: { - services.mullvad-vpn = { - enable = true; - package = pkgs-unstable.mullvad-vpn; - }; -} diff --git a/modules/nixos/nixUtils.nix b/modules/nixos/nixUtils.nix deleted file mode 100644 index 41eca06..0000000 --- a/modules/nixos/nixUtils.nix +++ /dev/null @@ -1,34 +0,0 @@ -# some options are in ../../hostsModules/laptop/nixos/nixUtils.nix -{ - pkgs-unstable, - inputs, - ... -}: { - # Garbage collector of generations - nix.gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 7d"; # every week delete generations older than a month - }; - - #manix is unhappy without this - nix.nixPath = [ - "nixpkgs=${inputs.nixpkgs.outPath}" - "home-manager=${inputs.home-manager.outPath}" - ]; - - #adds nixos experimental features: - nix.settings.experimental-features = ["nix-command" "flakes"]; - - environment.systemPackages = with pkgs-unstable; [ - nixpkgs-review - nixfmt-tree - treefmt - nixd - deadnix - alejandra - vimPluginsUpdater # used for building plugins - nix-index - statix - ]; -} diff --git a/modules/nixos/notifications.nix b/modules/nixos/notifications.nix deleted file mode 100644 index 2d382fb..0000000 --- a/modules/nixos/notifications.nix +++ /dev/null @@ -1,15 +0,0 @@ -# notifications server is set by caelestia-shell. See ../home-manager/caelestia.nix -{pkgs, ...}: { - environment.systemPackages = with pkgs; [ - libnotify # Library that sends desktop notifications to a notification daemon - socat # Utility for bidirectional data transfer between two independent data channels (used to communicate between hyprland and swww to change wallpapers dinamically) - matrix-commander-rs # matrix client used to send notifications from scripts to my phone - # battery notifications - (pkgs.callPackage ../../hostsModules/laptop/scripts/batterynotify.nix {}) - (pkgs.callPackage ../../hostsModules/laptop/scripts/batterywarning.nix {}) - # checks if matrix-commander-rs is installed and logged in - (pkgs.callPackage ../../hostsModules/laptop/scripts/checkMatrix.nix {}) - (pkgs.callPackage ../../modules/scripts/gitnotify.nix {}) # check if git is set up - (pkgs.callPackage ../../modules/scripts/checkKdrive.nix {}) # check if kdrive is set up with rclone - ]; -} diff --git a/modules/nixos/office.nix b/modules/nixos/office.nix deleted file mode 100644 index 4159c11..0000000 --- a/modules/nixos/office.nix +++ /dev/null @@ -1,6 +0,0 @@ -{pkgs, ...}: { - environment.systemPackages = with pkgs; [ - libreoffice - birdtray - ]; -} diff --git a/modules/nixos/otherUtils.nix b/modules/nixos/otherUtils.nix deleted file mode 100644 index 825d605..0000000 --- a/modules/nixos/otherUtils.nix +++ /dev/null @@ -1,28 +0,0 @@ -# try to keep packages here at a minium. Preferably use a dedicated file -{ - pkgs, - pkgs-unstable, - ... -}: { - environment.systemPackages = with pkgs; [ - gnome-calculator - snapshot - gnome-characters - #tree # shows dir in tree # we use eza now - brightnessctl # control brightness - powertop - fzf - bottom # Cross-platform graphical process/system monitor with a customizable interface - tomato-c # pomodoro timer - #hyprshot - mailcap - fuzzel - usbutils # used for lsusb - (pkgs.callPackage ../../modules/scripts/dontkillsteam.nix {}) # kill app (if it is steam put it in some background - (pkgs.callPackage ../../modules/scripts/killall.nix {}) # kill all windows except focused window - (pkgs.callPackage ../../modules/scripts/tomato.nix {}) - (pkgs.callPackage ../../modules/scripts/syllabes.nix {}) # python script to get number of syllabes in french - pkgs-unstable.bitwarden-desktop - fluffychat # matrix client - ]; -} diff --git a/modules/nixos/printer.nix b/modules/nixos/printer.nix deleted file mode 100644 index 5a24a15..0000000 --- a/modules/nixos/printer.nix +++ /dev/null @@ -1,39 +0,0 @@ -{pkgs, ...}: { - #https://wiki.nixos.org/wiki/Printing - services.avahi = { - enable = true; - nssmdns4 = true; - openFirewall = true; - }; - - # Enable CUPS to print documents. - services.printing = { - enable = true; - drivers = with pkgs; [ - cups-filters - #cups-browsed - #gutenprint - #gutenprintBin - hplipWithPlugin - hplip - ]; - }; - services.ipp-usb.enable = true; - environment.systemPackages = with pkgs; [ - kdePackages.print-manager - ghostscript - hplipWithPlugin - ]; - hardware.printers = { - ensurePrinters = [ - { - name = "HP_OfficeJet_Pro_7740"; - location = "Home"; - deviceUri = "hp:/usb/OfficeJet_Pro_7740_series"; - model = "drv:///hp/hpcups.drv/hp-officejet_pro_7740_series.ppd"; - } - ]; - - ensureDefaultPrinter = "HP_OfficeJet_Pro_7740"; - }; -} diff --git a/modules/nixos/theme.nix b/modules/nixos/theme.nix deleted file mode 100644 index de6bada..0000000 --- a/modules/nixos/theme.nix +++ /dev/null @@ -1,22 +0,0 @@ -# most of the themeing are in the home-manager modules. This just installs some packages needed -{pkgs, ...}: { - qt.enable = true; - - # to resolve this https://wiki.nixos.org/wiki/Home_Manager#I_cannot_set_GNOME_or_Gtk_themes_via_Home_Manager - programs.dconf.enable = true; - - environment.systemPackages = with pkgs; [ - swww #wallpaper daemon - gruvbox-gtk-theme - hyprcursor - capitaine-cursors-themed # cursor theme - kdePackages.qtdeclarative # provides qmlls and other things - quickshell # we have it but adding it there solves "WARN qt.qpa.services: Failed to register with host portal QDBusError("org.freedesktop.portal.Error.Failed", "Could not register app ID: App info not found for 'org.quickshell'")" - papirus-icon-theme - papirus-folders - (pkgs.callPackage ../../modules/scripts/wallpaper.nix {}) - #(pkgs.callPackage ../../modules/scripts/colorpicker.nix {}) # old color picker - #(pkgs.callPackage ../../modules/scripts/weather.nix {}) # old cli weather - (pkgs.callPackage ../../hostsModules/laptop/qt/qtbatticon.nix {}) # custom qt tray icon for battery - ]; -} diff --git a/modules/nixos/user.nix b/modules/nixos/user.nix deleted file mode 100644 index 693cf1a..0000000 --- a/modules/nixos/user.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ - pkgs, - pkgs-unstable, - inputs, - ... -}: { - services.dbus.enable = true; - security.polkit.enable = true; - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - # the home manager config is set in ../../hostsModules/*/nixos/user.nix - extraSpecialArgs = {inherit inputs pkgs-unstable;}; - }; - - # Set your time zone. - time.timeZone = "Europe/Zurich"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - # zsh dont want to work if it is not initialzed here. - programs.zsh.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.tomasr = { - isNormalUser = true; - description = "Tomas Rivera"; - extraGroups = ["networkmanager" "wheel" "fuse"]; #wheel allow to use sudo / fuse -> rclone - shell = pkgs.zsh; - }; - - security.wrappers.gsr-kms-server = { - # to remove the password prompt when using gpu-screen-recorder - owner = "root"; - group = "root"; - capabilities = "cap_sys_admin+ep"; - source = "${pkgs.gpu-screen-recorder}/bin/gsr-kms-server"; - }; - - services.upower.enable = true; - - # removes need for password for nixos-rebuild - security.sudo.extraRules = [ - { - users = ["tomasr"]; - commands = [ - { - command = "/run/current-system/sw/bin/nixos-rebuild"; - options = ["NOPASSWD"]; - } - { - command = "${pkgs.nixos-rebuild}/bin/nixos-rebuild"; - options = ["NOPASSWD"]; - } - { - command = "${pkgs-unstable.nixos-rebuild}/bin/nixos-rebuild"; - options = ["NOPASSWD"]; - } - ]; - } - ]; -} diff --git a/modules/nixos/windowManager.nix b/modules/nixos/windowManager.nix deleted file mode 100644 index c608e28..0000000 --- a/modules/nixos/windowManager.nix +++ /dev/null @@ -1,42 +0,0 @@ -# customization is in ../home-manager/hyprland.nix -{ - pkgs-unstable, - pkgs, - ... -}: { - # Enable the X11 windowing system. - services.xserver.enable = true; - - # Enable the GNOME Desktop Environment. - # services.displayManager.gdm.enable = true; - # services.desktopManager.gnome.enable = true; - # we dont use gnome but some utils yes -> see pckgs - #enable sddm - #services.displayManager.sddm = { - # enable = true; - # wayland.enable = true; - #}; - # we use ly as the displayManager. see ../../modules/nixos/ly.nix - - # enable hyprland WM - programs.hyprland = { - enable = true; - package = pkgs-unstable.hyprland; # we use the unstable branch to get the latest features - withUWSM = true; - xwayland.enable = true; - }; - - xdg.portal = { - enable = true; - extraPortals = [ - pkgs.xdg-desktop-portal-wlr - pkgs.xdg-desktop-portal-gtk - ]; - }; - # removes uxterm - services.xserver.excludePackages = [pkgs.xterm]; - - environment.systemPackages = with pkgs; [ - xdg-utils - ]; -} diff --git a/modules/other/IO.nix b/modules/other/IO.nix new file mode 100644 index 0000000..87eb1f2 --- /dev/null +++ b/modules/other/IO.nix @@ -0,0 +1,22 @@ +{ ... }: { + flake.nixosModules.IO = {pkgs, ...}: { + # Configure keymap in X11 + services.xserver.xkb = { + layout = "ch"; + variant = "fr"; + }; + + # Configure console keymap + console.keyMap = "fr_CH"; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + environment.systemPackages = with pkgs; [ + wl-clipboard + cliphist + hyprkeys # keybind helper + hyprpicker + ]; + }; +} diff --git a/modules/other/cursor.nix b/modules/other/cursor.nix new file mode 100644 index 0000000..48878c5 --- /dev/null +++ b/modules/other/cursor.nix @@ -0,0 +1,11 @@ +{ ... }: { + flake.homeModules.cursor = {pkgs, ...}: { + home.pointerCursor = { + hyprcursor.enable = true; + enable = true; + package = pkgs.capitaine-cursors-themed; + name = "Capitaine Cursors (Gruvbox)"; + size = 32; + }; + }; +} diff --git a/modules/other/desktopEntries.nix b/modules/other/desktopEntries.nix new file mode 100644 index 0000000..6817eb4 --- /dev/null +++ b/modules/other/desktopEntries.nix @@ -0,0 +1,31 @@ +{ ... }: { + flake.homeModules.desktopEntries = { ... }: { + # for when the system lacks of a .desktop file + home.file.".local/share/applications/org.quickshell.desktop" = { + enable = true; + text = '' + [Desktop Entry] + Name=QuickShell + Comment=QuickShell application + Exec=quickshell + Icon=utilities-terminal + Type=Application + Categories=Utility; + StartupNotify=true + X-DBUS-ServiceName=org.quickshell + ''; + }; + home.file.".local/share/applications/org.kde.PrintQueue.desktop" = { + enable = true; + text = '' + [Desktop Entry] + Type=Application + Name=Print Queue + Exec=print-queue + Icon=printer + Categories=Utility; + StartupNotify=true + ''; + }; + }; +} diff --git a/modules/other/fonts.nix b/modules/other/fonts.nix new file mode 100644 index 0000000..f8ffffb --- /dev/null +++ b/modules/other/fonts.nix @@ -0,0 +1,14 @@ +{ ... }: { + flake.nixosModules.fonts = { pkgs, ... }: { + # fonts + fonts.packages = with pkgs; [ + nerd-fonts._0xproto + cinzel + times-newer-roman + ]; + + environment.systemPackages = with pkgs; [ + gnome-font-viewer + ]; + }; +} diff --git a/modules/other/printer.nix b/modules/other/printer.nix new file mode 100644 index 0000000..e583875 --- /dev/null +++ b/modules/other/printer.nix @@ -0,0 +1,41 @@ +{ ... }: { + flake.nixosModules.printer = {pkgs, ...}: { + #https://wiki.nixos.org/wiki/Printing + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + + # Enable CUPS to print documents. + services.printing = { + enable = true; + drivers = with pkgs; [ + cups-filters + #cups-browsed + #gutenprint + #gutenprintBin + hplipWithPlugin + hplip + ]; + }; + services.ipp-usb.enable = true; + environment.systemPackages = with pkgs; [ + kdePackages.print-manager + ghostscript + hplipWithPlugin + ]; + hardware.printers = { + ensurePrinters = [ + { + name = "HP_OfficeJet_Pro_7740"; + location = "Home"; + deviceUri = "hp:/usb/OfficeJet_Pro_7740_series"; + model = "drv:///hp/hpcups.drv/hp-officejet_pro_7740_series.ppd"; + } + ]; + + ensureDefaultPrinter = "HP_OfficeJet_Pro_7740"; + }; + }; +} diff --git a/modules/other/user.nix b/modules/other/user.nix new file mode 100644 index 0000000..884624c --- /dev/null +++ b/modules/other/user.nix @@ -0,0 +1,50 @@ +{ ... }: { + flake.nixModules.user = { + pkgs, + pkgs-unstable, + ... + }: { + services.dbus.enable = true; + security.polkit.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Zurich"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + # zsh dont want to work if it is not initialzed here. + programs.zsh.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.tomasr = { + isNormalUser = true; + description = "Tomas Rivera"; + extraGroups = ["networkmanager" "wheel" "fuse"]; #wheel allow to use sudo / fuse -> rclone + shell = pkgs.zsh; + }; + + services.upower.enable = true; + + # removes need for password for nixos-rebuild + security.sudo.extraRules = [ + { + users = ["tomasr"]; + commands = [ + { + command = "/run/current-system/sw/bin/nixos-rebuild"; + options = ["NOPASSWD"]; + } + { + command = "${pkgs.nixos-rebuild}/bin/nixos-rebuild"; + options = ["NOPASSWD"]; + } + { + command = "${pkgs-unstable.nixos-rebuild}/bin/nixos-rebuild"; + options = ["NOPASSWD"]; + } + ]; + } + ]; + }; +} diff --git a/modules/packages/README.md b/modules/packages/README.md index 0065938..75a0a30 100644 --- a/modules/packages/README.md +++ b/modules/packages/README.md @@ -1,3 +1,7 @@ -Used for custom package derivation. +Used for custom package derivation or for scripts. For example, to use a newer package version that is still not in nixpkgs-unstable. + +Some rules about package naming: +* If it is a custom derivation of a package, end with `ManuallyDerived` +* If it is a script, start with `custom-`. The executable, package name (and file name if it is the only thing in this nix file) must be equal. diff --git a/modules/packages/custom-bottom.nix b/modules/packages/custom-bottom.nix new file mode 100644 index 0000000..c1e6399 --- /dev/null +++ b/modules/packages/custom-bottom.nix @@ -0,0 +1,13 @@ +{ ... }: { + flake.packages.custom-bottom = { pkgs, ... }: + pkgs.writeShellApplication { + name = "custom-bottom"; + runtimeInputs = with pkgs; [ + kitty + bottom + ]; + text = '' + kitty --class "custom-bottom" -o font_size=10 --name "custom-bottom" -e btm --theme gruvbox --disable-click --disable_advanced_kill --enable_cache_memory -g -R -T + ''; + }; +} diff --git a/modules/packages/custom-colorpicker.nix b/modules/packages/custom-colorpicker.nix new file mode 100644 index 0000000..5c73010 --- /dev/null +++ b/modules/packages/custom-colorpicker.nix @@ -0,0 +1,73 @@ +{ ... }: { + flake.packages.custom-colorpicker = { pkgs, ... }: + pkgs.writeShellApplication { + # useless. Just use hyprpicker + name = "custom-colorpicker"; + runtimeInputs = with pkgs; [ + hyprpicker + libnotify + toybox + wl-clipboard + ]; + text = '' + check() { + command -v "$1" 1>/dev/null + } + + notify() { + check notify-send && { + notify-send -a "Color Picker" "$@" + return + } + echo "$@" + } + + loc="$HOME/.cache/colorpicker" + [ -d "$loc" ] || mkdir -p "$loc" + [ -f "$loc/colors" ] || touch "$loc/colors" + + limit=10 + + [[ $# -eq 1 && $1 = "-l" ]] && { + cat "$loc/colors" + exit + } + + [[ $# -eq 1 && $1 = "-j" ]] && { + text="$(head -n 1 "$loc/colors")" + + mapfile -t allcolors < <(tail -n +2 "$loc/colors") + # allcolors=($(tail -n +2 "$loc/colors")) + tooltip=" COLORS\n\n" + + tooltip+="-> $text 󰸌 \n" + for i in "''${allcolors[@]}"; do + tooltip+=" $i 󰸌 \n" + done + + cat <󰸌", "tooltip":"$tooltip"} + EOF + + exit + } + + check hyprpicker || { + notify "hyprpicker is not installed" + exit + } + killall -q hyprpicker + color=$(hyprpicker) + + check wl-copy && { + echo "$color" | sed -z 's/\n//g' | wl-copy + } + + prevColors=$(head -n $((limit - 1)) "$loc/colors") + echo "$color" >"$loc/colors" + echo "$prevColors" >>"$loc/colors" + sed -i '/^$/d' "$loc/colors" + pkill -RTMIN+1 waybar + ''; + }; +} diff --git a/modules/packages/custom-cowsay.nix b/modules/packages/custom-cowsay.nix new file mode 100644 index 0000000..c0e0588 --- /dev/null +++ b/modules/packages/custom-cowsay.nix @@ -0,0 +1,83 @@ +{ ... }: { + flake.packages.custom-cowsay = { pkgs, ... }: + pkgs.writeShellApplication { + name = "custom-cowsay"; + runtimeInputs = with pkgs; [ + cowsay + ]; + text = '' + + cows=("actually" "alpaca" "bud-frogs" "daemon" "elephant-in-snake" "moofasa" "skeleton" "three-eyes" "supermilker" "tux" "vader" "www") + declare -a sentences=( + "Sharing knowledge is the most fundamental act of friendship. Because it is a way you can give something without loosing something. -Richard Stallman" + "Free software' is a matter of liberty, not price. To understand the concept, you should think of 'free' as in 'free speech,' not as in 'free beer'. -Richard Stallman" + "Programming is not a science. Programming is a craft. -Richard Stallman" + "I did write some code in Java once, but that was the island in Indonesia. -Richard Stallman" + "Facebook is not your friend, it is a surveillance engine. -Richard Stallman" + "People said I should accept the world. Bullshit! I don't accept the world. -Richard Stallman" + "You can use any editor you want, but remember that vi vi vi is the text editor of the beast. -Richard Stallman" + "The idea of copyright did not exist in ancient times, when authors frequently copied other authors at length in works of non-fiction. This practice was useful, and is the only way many authors' works have survived even in part. -Richard Stallman" + "Idiots can be defeated but they never admit it. -Richard Stallman" + "Open source is a development methodology; free software is a social movement. -Richard Stallman" + "People sometimes ask me if it is a sin in the Church of Emacs to use vi. Using a free version of vi is not a sin; it is a penance. So happy hacking. -Richard Stallman" + "A computer is like air conditioning - it becomes useless when you open Windows -Linus Torvald" + "Intelligence is the ability to avoid doing work, yet getting the work done. -Linus Torvald" + "Software is like sex: It's better when it's free. -Linus Torvald" + "All operating systems sucks, but Linux just sucks less -Linus Torvald" + "I like offending people, because I think people who get offended should be offended. -Linus Torval" + "Talk is cheap. Show me the code. -Linus Torval" + "Most of the good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program. -Linus Torvald" + "Bad programmers worry about the code. Good programmers worry about data structures and their relationships. -Linus Torvald" + "If Microsoft ever does applications for Linux it means I've won. -Linus Torvald" + "Avoiding complexity reduces bugs. -Linus Torvald" + "Backups are for wimps. Real men upload their data to an FTP site and have everyone else mirror it. -Linus Torvald" + "Nobody actually creates perfect code the first time around, except me. But there's only one of me. -Linus Torvald" + "Microsoft isn't evil, they just make really crappy operating systems. -Linus Torvald" + "When you say 'I wrote a program that crashed Windows,' people just stare at you blankly and say 'Hey, I got those with the system, for free.' -Linus Torval" + "C++ is a horrible language. It's made more horrible by the fact that a lot of substandard programmers use it, to the point where it's much much easier to generate total and utter crap with it. -Linus Torvald" + "If you think your users are idiots, only idiots will use it. -Linus Torvald" + "My name is Linus, and I am your God. -Linus Torvald" + "An infinite number of monkeys typing into GNU emacs would never make a good program. -Linus Torvald" + "Object-oriented programming is an exceptionally bad idea which could only have originated in California. -Edgser Dijkstra" + "If debugging is the process of removing software bugs, then programming must be the process of putting them in. -Edgser Dijkstra" + "The art of programming is the art of organizing complexity. -Edgser Dijkstra" + "Program testing can be used to show the presence of bugs, but never to show their absence! -Edgser Dijkstra" + "It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. -Edgser Dijkstra" + "The effort of using machines to mimic the human mind has always struck me as rather silly. I would rather use them to mimic something better. -Edgser Dijkstra" + "Computer science is no more about computers than astronomy is about telescopes. -Edgser Dijkstra" + "Programming in Basic causes brain damage. -Edgser Dijkstra" + "The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague. -Edgser Dijkstra" + "If in physics there's something you don't understand, you can always hide behind the uncharted depths of nature. You can always blame God. You didn't make it so complex yourself. But if your program doesn't work, there is no one to hide behind. You cannot hide behind an obstinate nature. If it doesn't work, you've messed up. -Edgser Dijkstra" + "Teaching COBOL ought to be regarded as a criminal act. -Edgser Dijkstra" + "If you want more effective programmers, you will discover that they should not waste their time debugging, they should not introduce the bugs to start with. -Edgser Dijkstra" + "If we wish to count lines of code, we should not regard them as 'lines produced' but as 'lines spent.' -Edgser Dijkstra" + "In almost every computation a great variety of arrangements for the succession of the processes is possible, and various considerations must influence the selections amongst them for the purposes of a calculating engine. One essential object is to choose that arrangement which shall tend to reduce to a minimum the time necessary for completing the calculation. -Ada Lovelace" + "I’m making an operating system myself, so I know what it’s like to be God. -Terry Davis" + "I’m schizophrenic and so am I. -Terry Davis" + "If I was a dog, I would bark. -Terry Davis" + "Who has a better kernel? Debian? No. -Terry Davis" + "Computers are fast, programmers keep it slow. -A random Reddit user" + "Before software can be reusable it first has to be usable. -Ralph Johnson" + "The best thing about a Boolean is that even if you are wrong, you're only off by a bit. -Anonymous" + "It's not a bug, it's a feature. -Programmers" + "NVIDIA, fuck you -Linus Torvald" + ) + while true + do + echo + echo + echo + echo + echo + echo + SIndex=$(( RANDOM % ''${#sentences[@]} )) + index=$(( RANDOM % ''${#cows[@]} )) + #cow="/usr/share/cowsay/cows/''${cows[index]}.cow" + cowsay -f "''${cows[index]}" "''${sentences[SIndex]}" + sleep 10 + clear + done + ''; + # reduce terminal size for actually + }; +} diff --git a/modules/packages/custom-syllabes.nix b/modules/packages/custom-syllabes.nix new file mode 100644 index 0000000..e1471bb --- /dev/null +++ b/modules/packages/custom-syllabes.nix @@ -0,0 +1,30 @@ +{ ... }: +{ + flake.packages.custom-syllabes = { pkgs, ... }: + # counts how many syllabes in a string. + # not perfect. Does not handle silents e in french + # but that's what I use for writing poetry + pkgs.writers.writePython3Bin "custom-syllabes" { + libraries = with pkgs; [ + python3Packages.pyphen + ]; + } '' + import sys + import pyphen + + dic = pyphen.Pyphen(lang="fr") + + text = sys.stdin.read().strip() + + chunks = [] + total = 0 + + for w in text.split(): + hyphenated = dic.inserted(w) + parts = hyphenated.split("-") + chunks.append("/".join(parts)) + total += len(parts) + + print(f"{total} ({'/'.join(chunks)})") + ''; +} diff --git a/modules/packages/custom-tomato.nix b/modules/packages/custom-tomato.nix new file mode 100644 index 0000000..d6f0b95 --- /dev/null +++ b/modules/packages/custom-tomato.nix @@ -0,0 +1,14 @@ +{ ... }: +{ + flake.packages.custom-tomato = { pkgs, ... }: + pkgs.writeShellApplication { + name = "custom-tomato"; + runtimeInputs = with pkgs; [ + kitty + tomato-c + ]; + text = '' + kitty --class "custom-pomodoro" --name "custom-pomodoro" -e tomato + ''; + }; +} diff --git a/modules/packages/custom-weather.nix b/modules/packages/custom-weather.nix new file mode 100644 index 0000000..fc61498 --- /dev/null +++ b/modules/packages/custom-weather.nix @@ -0,0 +1,16 @@ +{ ... }: +{ + flake.packages.custom-weather = { pkgs, ... }: + pkgs.writeShellApplication { + name = "custom-weather"; + runtimeInputs = with pkgs; [ + curl + ]; + text = '' + while true; do + curl "https://wttr.in/?0&d&q&F&lang=fr" + sleep 7200 + done + ''; + }; +} diff --git a/modules/packages/deja.nix b/modules/packages/deja.nix deleted file mode 100644 index 0227843..0000000 --- a/modules/packages/deja.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ - lib, - buildGoModule, - fetchFromGitHub, - nix-update-script, - versionCheckHook, -}: -buildGoModule (finalAttrs: { - pname = "deja"; - version = "0.2.6"; - __structuredAttrs = true; - src = fetchFromGitHub { - owner = "Giammarco-Ferranti"; - repo = "deja"; - tag = "v${finalAttrs.version}"; - hash = "sha256-xxbClKhhSwo+jUjAZ2gS4yOS5sSI76dfPpDzA3qdV18="; - }; - - vendorHash = "sha256-KmLdMK94cGOXMPJwWS6NgLB5OiNmJbszHdnLzauqJm8="; - - ldflags = [ - "-s" - "-w" - "-X main.version=${finalAttrs.version}" - ]; - - doCheck = true; - - nativeCheckInputs = [versionCheckHook]; - - passthru.updateScript = nix-update-script {}; - - meta = { - description = "Predictive inline shell autosuggestions for zsh"; - homepage = "https://github.com/Giammarco-Ferranti/deja"; - license = lib.licenses.mit; - platforms = lib.platforms.unix; - maintainers = with lib.maintainers; [tomasrivera]; - mainProgram = "deja"; - }; -}) diff --git a/modules/packages/dejaManuallyDerived.nix b/modules/packages/dejaManuallyDerived.nix new file mode 100644 index 0000000..9c8d0eb --- /dev/null +++ b/modules/packages/dejaManuallyDerived.nix @@ -0,0 +1,43 @@ +{ ... }: { + flake.packages.dejaManuallyDerived = { + lib, + buildGoModule, + fetchFromGitHub, + nix-update-script, + versionCheckHook, + }: + buildGoModule (finalAttrs: { + pname = "deja"; + version = "0.2.6"; + __structuredAttrs = true; + src = fetchFromGitHub { + owner = "Giammarco-Ferranti"; + repo = "deja"; + tag = "v${finalAttrs.version}"; + hash = "sha256-xxbClKhhSwo+jUjAZ2gS4yOS5sSI76dfPpDzA3qdV18="; + }; + + vendorHash = "sha256-KmLdMK94cGOXMPJwWS6NgLB5OiNmJbszHdnLzauqJm8="; + + ldflags = [ + "-s" + "-w" + "-X main.version=${finalAttrs.version}" + ]; + + doCheck = true; + + nativeCheckInputs = [versionCheckHook]; + + passthru.updateScript = nix-update-script {}; + + meta = { + description = "Predictive inline shell autosuggestions for zsh"; + homepage = "https://github.com/Giammarco-Ferranti/deja"; + license = lib.licenses.mit; + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [tomasrivera]; + mainProgram = "deja"; + }; + }); +} diff --git a/modules/packages/labplot.nix b/modules/packages/labplot.nix deleted file mode 100644 index 465e103..0000000 --- a/modules/packages/labplot.nix +++ /dev/null @@ -1,123 +0,0 @@ -{ - lib, - stdenv, - fetchpatch, - fetchurl, - cmake, - extra-cmake-modules, - shared-mime-info, - wrapQtAppsHook, - qtbase, - karchive, - kcompletion, - kconfig, - kcoreaddons, - kcrash, - kdoctools, - ki18n, - kiconthemes, - kio, - knewstuff, - kparts, - ktextwidgets, - kxmlgui, - syntax-highlighting, - gsl, - poppler, - fftw, - hdf5, - netcdf, - cfitsio, - libcerf, - # cantor, - zlib, - lz4, - readstat, - matio, - qtserialport, - discount, -}: -stdenv.mkDerivation rec { - pname = "labplot"; - version = "2.10.1"; - - src = fetchurl { - url = "mirror://kde/stable/labplot/labplot-${version}.tar.xz"; - sha256 = "sha256-K24YFRfPtuDf/3uJXz6yDHzjWeZzLThUXgdXya6i2u8="; - }; - - cmakeFlags = [ - # Disable Vector BLF since it depends on DBC parser which fails to be detected - "-DENABLE_VECTOR_BLF=OFF" - ]; - - patches = [ - (fetchpatch { - name = "matio-fix-compilation-for-latest-version-1.5.27.patch"; - url = "https://github.com/KDE/labplot/commit/d6142308ffa492d9f7cea00fad3b4cd1babfd00c.patch"; - hash = "sha256-qD5jj6GxBKbQezKJb1Z8HnwFO84WJBGQDawS/6o/wHE="; - }) - ]; - - nativeBuildInputs = [ - cmake - extra-cmake-modules - shared-mime-info - wrapQtAppsHook - ]; - - buildInputs = [ - qtbase - - karchive - kcompletion - kconfig - kcoreaddons - kcrash - kdoctools - ki18n - kiconthemes - kio - knewstuff - kparts - ktextwidgets - kxmlgui - - syntax-highlighting - gsl - - poppler - fftw - hdf5 - netcdf - cfitsio - libcerf - # cantor - zlib - lz4 - readstat - matio - qtserialport - discount - ]; - - meta = { - description = "Free, open source and cross-platform data visualization and analysis software accessible to everyone"; - homepage = "https://labplot.kde.org"; - license = with lib.licenses; [ - asl20 - bsd3 - cc-by-30 - cc0 - gpl2Only - gpl2Plus - gpl3Only - gpl3Plus - lgpl3Plus - mit - ]; - maintainers = ["tomasriveral"]; - mainProgram = "labplot2"; - platforms = lib.platforms.unix; - }; -} diff --git a/modules/packages/plint.nix b/modules/packages/plint.nix deleted file mode 100644 index 0ab8397..0000000 --- a/modules/packages/plint.nix +++ /dev/null @@ -1,51 +0,0 @@ -{ - lib, - python3Packages, - fetchFromGitLab, - frhyme, - haspirater, -}: -python3Packages.buildPythonApplication rec { - pname = "plint"; - - # No PyPI version mentioned; upstream is git-based - version = "unstable-2026-04-28"; - - src = fetchFromGitLab { - owner = "a3nm"; - repo = "plint"; - rev = "master"; - sha256 = lib.fakeSha256; # replace after first build - }; - - propagatedBuildInputs = [ - frhyme - haspirater - python3Packages.cherrypy - ]; - - # plint uses scripts + data generation steps, so disable strict tests - doCheck = false; - - preBuild = '' - # required data generation steps from README - echo "Generating frhyme.json..." - (cd frhyme/lexique && ./lexique_retrieve.sh > lexique.txt) - (cd frhyme && ./make.sh 4 lexique/lexique.txt additions > frhyme.json) - - echo "Generating occurrences file..." - ./lexique_occurrences_retrieve.sh > data/occurrences || true - ''; - - postInstall = '' - # ensure CLI entry point exists - install -Dm755 plint.py $out/bin/plint - ''; - - meta = with lib; { - description = "French poetry validator (metrics, rhymes, template checking)"; - homepage = "https://gitlab.com/a3nm/plint"; - license = licenses.gpl3Plus; - platforms = platforms.unix; - }; -} diff --git a/modules/packages/sbb-tui.nix b/modules/packages/sbb-tui.nix deleted file mode 100644 index f5c2c48..0000000 --- a/modules/packages/sbb-tui.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ - lib, - buildGoModule, - fetchFromGitHub, - nix-update-script, - versionCheckHook, -}: -buildGoModule (finalAttrs: { - pname = "sbb-tui"; - version = "1.14.2"; - __structuredAttrs = true; - src = fetchFromGitHub { - owner = "Necrom4"; - repo = "sbb-tui"; - tag = "v${finalAttrs.version}"; - hash = lib.fakeHash; - }; - - vendorHash = "sha256-K4DOu3rfSlKAa5JNKCzWWpnWZlXXxtN5Po7p1Spqe1w="; - - ldflags = [ - "-s" - "-w" - "-X main.version=${finalAttrs.version}" - ]; - - allowGoReference = true; - - doCheck = true; - - nativeCheckInputs = [versionCheckHook]; - - passthru.updateScript = nix-update-script {}; - - meta = { - description = "TUI client for Switzerland's public transport timetables, inspired by SBB/CFF/FFS app"; - homepage = "https://github.com/Necrom4/sbb-tui"; - license = lib.licenses.mit; - platforms = lib.platforms.unix; - maintainers = with lib.maintainers; [tomasrivera]; - mainProgram = "sbb-tui"; - }; -}) diff --git a/modules/packages/sbb-tuiManuallyDerived.nix b/modules/packages/sbb-tuiManuallyDerived.nix new file mode 100644 index 0000000..35e54a6 --- /dev/null +++ b/modules/packages/sbb-tuiManuallyDerived.nix @@ -0,0 +1,45 @@ +{ ... }: { + flake.packages.sbb-tuiManuallyDerived = { + lib, + buildGoModule, + fetchFromGitHub, + nix-update-script, + versionCheckHook, + }: + buildGoModule (finalAttrs: { + pname = "sbb-tui"; + version = "1.14.2"; + __structuredAttrs = true; + src = fetchFromGitHub { + owner = "Necrom4"; + repo = "sbb-tui"; + tag = "v${finalAttrs.version}"; + hash = lib.fakeHash; + }; + + vendorHash = "sha256-K4DOu3rfSlKAa5JNKCzWWpnWZlXXxtN5Po7p1Spqe1w="; + + ldflags = [ + "-s" + "-w" + "-X main.version=${finalAttrs.version}" + ]; + + allowGoReference = true; + + doCheck = true; + + nativeCheckInputs = [versionCheckHook]; + + passthru.updateScript = nix-update-script {}; + + meta = { + description = "TUI client for Switzerland's public transport timetables, inspired by SBB/CFF/FFS app"; + homepage = "https://github.com/Necrom4/sbb-tui"; + license = lib.licenses.mit; + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [tomasrivera]; + mainProgram = "sbb-tui"; + }; + }); +} diff --git a/modules/packages/vivify.nix b/modules/packages/vivify.nix deleted file mode 100644 index 2df2a57..0000000 --- a/modules/packages/vivify.nix +++ /dev/null @@ -1,87 +0,0 @@ -{ - lib, - stdenv, - nix-update-script, - fetchYarnDeps, - fetchFromGitHub, - yarnConfigHook, - npmHooks, - nodejs, - zip, - file, -}: -stdenv.mkDerivation (finalAttrs: { - pname = "vivify"; - version = "0.14.0"; - - src = fetchFromGitHub { - owner = "jannis-baum"; - repo = "Vivify"; - tag = "v${finalAttrs.version}"; - hash = "sha256-CszMG+c0bNHfXWqcI3b4iGpeFJ+FmzHDzxflPS+wEe0="; - }; - - yarnOfflineCache = fetchYarnDeps { - yarnLock = "${finalAttrs.src}/yarn.lock"; - hash = "sha256-svgEanFiBSQn0TdTuB0CnLR71lkANABEaDiKB+Vc0Rc="; - }; - - installPhase = '' - runHook preInstall - - yarn install - - substituteInPlace node_modules/.bin/tsc \ - --replace-fail '/usr/bin/env node' '${lib.getExe nodejs}' - - substituteInPlace node_modules/.bin/webpack \ - --replace-fail '/usr/bin/env node' '${lib.getExe nodejs}' - - substituteInPlace node_modules/.bin/postject \ - --replace-fail '/usr/bin/env node' '${lib.getExe nodejs}' - - make VIV_VERSION=${finalAttrs.version} linux - - mkdir -p $out/bin - install -Dm755 ./build/linux/viv $out/bin/viv - install -Dm755 ./build/linux/vivify-server $out/bin/vivify-server - - wrapProgram $out/bin/viv \ - --prefix PATH : ${ - lib.makeBinPath [ - nodejs - file - ] - } - ''; - - nativeBuildInputs = [ - yarnConfigHook - npmHooks.npmInstallHook - zip - - nodejs - file - ]; - - # Stripping 'unneeded symbols' causes vivify-server executable to break - # (segmentation fault) - dontStrip = true; - - passthru.updateScript = nix-update-script {}; - - meta = { - description = "Live Markdown viewer"; - longDescription = '' - Vivify brings your files to life in the browser! - Vivify is primarily made to render Markdown and Jupyter Notebooks, but will also - serve as a directory browser and let you view code files with syntax highlighting. - ''; - homepage = "https://github.com/jannis-baum/Vivify"; - changelog = "https://github.com/jannis-baum/Vivify/releases/tag/v${finalAttrs.src.tag}"; - license = lib.licenses.gpl3; - maintainers = with lib.maintainers; [skohtv]; - platforms = lib.platforms.linux; - mainProgram = "viv"; - }; -}) diff --git a/modules/packages/vivifyManuallyDerived.nix b/modules/packages/vivifyManuallyDerived.nix new file mode 100644 index 0000000..8efb058 --- /dev/null +++ b/modules/packages/vivifyManuallyDerived.nix @@ -0,0 +1,89 @@ +{ ... }: { + flake.packages.vivifyManuallyDerived = { + lib, + stdenv, + nix-update-script, + fetchYarnDeps, + fetchFromGitHub, + yarnConfigHook, + npmHooks, + nodejs, + zip, + file, + }: + stdenv.mkDerivation (finalAttrs: { + pname = "vivify"; + version = "0.14.0"; + + src = fetchFromGitHub { + owner = "jannis-baum"; + repo = "Vivify"; + tag = "v${finalAttrs.version}"; + hash = "sha256-CszMG+c0bNHfXWqcI3b4iGpeFJ+FmzHDzxflPS+wEe0="; + }; + + yarnOfflineCache = fetchYarnDeps { + yarnLock = "${finalAttrs.src}/yarn.lock"; + hash = "sha256-svgEanFiBSQn0TdTuB0CnLR71lkANABEaDiKB+Vc0Rc="; + }; + + installPhase = '' + runHook preInstall + + yarn install + + substituteInPlace node_modules/.bin/tsc \ + --replace-fail '/usr/bin/env node' '${lib.getExe nodejs}' + + substituteInPlace node_modules/.bin/webpack \ + --replace-fail '/usr/bin/env node' '${lib.getExe nodejs}' + + substituteInPlace node_modules/.bin/postject \ + --replace-fail '/usr/bin/env node' '${lib.getExe nodejs}' + + make VIV_VERSION=${finalAttrs.version} linux + + mkdir -p $out/bin + install -Dm755 ./build/linux/viv $out/bin/viv + install -Dm755 ./build/linux/vivify-server $out/bin/vivify-server + + wrapProgram $out/bin/viv \ + --prefix PATH : ${ + lib.makeBinPath [ + nodejs + file + ] + } + ''; + + nativeBuildInputs = [ + yarnConfigHook + npmHooks.npmInstallHook + zip + + nodejs + file + ]; + + # Stripping 'unneeded symbols' causes vivify-server executable to break + # (segmentation fault) + dontStrip = true; + + passthru.updateScript = nix-update-script {}; + + meta = { + description = "Live Markdown viewer"; + longDescription = '' + Vivify brings your files to life in the browser! + Vivify is primarily made to render Markdown and Jupyter Notebooks, but will also + serve as a directory browser and let you view code files with syntax highlighting. + ''; + homepage = "https://github.com/jannis-baum/Vivify"; + changelog = "https://github.com/jannis-baum/Vivify/releases/tag/v${finalAttrs.src.tag}"; + license = lib.licenses.gpl3; + maintainers = with lib.maintainers; [skohtv]; + platforms = lib.platforms.linux; + mainProgram = "viv"; + }; + }); +} diff --git a/modules/packages/z13ctl.nix b/modules/packages/z13ctl.nix deleted file mode 100644 index f3a835f..0000000 --- a/modules/packages/z13ctl.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - lib, - buildGoModule, - fetchFromGitHub, -}: -buildGoModule { - pname = "z13ctl"; - version = "1.1.6"; - - src = fetchFromGitHub { - owner = "dahui"; - repo = "z13ctl"; - rev = "v1.1.6"; - hash = "sha256-21mdAzbw8JISDLG7iSEI4VCephDTtbioN0/RRxvCLR8="; - }; - - vendorHash = "sha256-ftkcianIR36PNAoMOVuk4lUr7goWUcHhjyNseUraJU0="; - - subPackages = ["."]; - - __structuredAttrs = true; - - meta = with lib; { - description = "Utility for ASUS ROG Flow Z13 (2025)"; - homepage = "https://github.com/dahui/z13ctl"; - license = licenses.asl20; - platforms = platforms.linux; - mainProgram = "z13ctl"; - maintainers = with maintainers; [badheuristic]; - }; -} diff --git a/modules/parts.nix b/modules/parts.nix new file mode 100644 index 0000000..eaeb26b --- /dev/null +++ b/modules/parts.nix @@ -0,0 +1,14 @@ +# see https://www.vimjoyer.com/nix/dendritic-home-manager +{ inputs, ... }: { + imports = [ + # adds home-manager options to flake-parts + inputs.home-manager.flakeModules.home-manager + ]; + + config.systems = [ + "x86_64-linux" + #"aarch64-linux" + #"x86_64-darwin" + #"aarch64-darwin" + ]; +} diff --git a/modules/qt/README.md b/modules/qt/README.md deleted file mode 100644 index 48a8205..0000000 --- a/modules/qt/README.md +++ /dev/null @@ -1,3 +0,0 @@ -Used for custom qt modules. - -Previously, `qtbatticon`. (Moved to `../../hostsModules/laptop/qt/qtbatticon`) diff --git a/modules/scripts/OldDeprecatedbatterynotify.nix b/modules/scripts/OldDeprecatedbatterynotify.nix deleted file mode 100644 index ea67c56..0000000 --- a/modules/scripts/OldDeprecatedbatterynotify.nix +++ /dev/null @@ -1,71 +0,0 @@ -{ - writeShellApplication, - libnotify, - systemd, -}: -writeShellApplication { - name = "custom-olddeprecatedbatterynotify"; - - runtimeInputs = [ - libnotify # provides notify-send - systemd # provides systemctl - ]; - - text = '' - set -euo pipefail - - LOW="''${BATTERY_LOW_THRESHOLD:-20}" - CRITICAL="''${BATTERY_CRITICAL_THRESHOLD:-5}" - FULL="''${BATTERY_FULL_THRESHOLD:-95}" - INTERVAL="''${BATTERY_INTERVAL:-30}" - ACTION="''${BATTERY_CRITICAL_ACTION:-systemctl suspend}" - - notify() { - notify-send -a "Battery" -u "$1" "$2" "$3" - } - - get_info() { - total=0 - count=0 - - for bat in /sys/class/power_supply/BAT*; do - [ -f "$bat/capacity" ] || continue - capacity=$(<"$bat/capacity") - status=$(<"$bat/status") - total=$((total + capacity)) - count=$((count + 1)) - done - - [ "$count" -gt 0 ] || exit 0 - percentage=$((total / count)) - } - - last_state="" - - while true; do - get_info - - if [[ "$status" == "Discharging" && "$percentage" -le "$CRITICAL" ]]; then - notify critical "Battery Critically Low" "$percentage% — suspending." - $ACTION - - elif [[ "$status" == "Discharging" && "$percentage" -le "$LOW" ]]; then - if [[ "$last_state" != "low" ]]; then - notify normal "Battery Low" "$percentage% remaining." - last_state="low" - fi - - elif [[ "$status" != "Discharging" && "$percentage" -ge "$FULL" ]]; then - if [[ "$last_state" != "full" ]]; then - notify normal "Battery Full" "$percentage% — unplug charger." - last_state="full" - fi - - else - last_state="" - fi - - sleep "$INTERVAL" - done - ''; -} diff --git a/modules/scripts/QSnotifycache.nix b/modules/scripts/QSnotifycache.nix deleted file mode 100644 index a7fbbbf..0000000 --- a/modules/scripts/QSnotifycache.nix +++ /dev/null @@ -1,14 +0,0 @@ -# creates and maintains cache file for the notification history -{writeShellApplication, ...}: -writeShellApplication { - name = "QS-notifycache"; - runtimeInputs = [ - ]; - text = '' - CACHE="$HOME/.cache/notify_history" - # Create or erase existing cache - mkdir -p "$(dirname "$CACHE")" - : > "$CACHE" # truncate file - echo "Notification history initialized at $(date)" >> "$CACHE" - ''; -} diff --git a/modules/scripts/QSnotifyhistory.nix b/modules/scripts/QSnotifyhistory.nix deleted file mode 100644 index 601dd4d..0000000 --- a/modules/scripts/QSnotifyhistory.nix +++ /dev/null @@ -1,28 +0,0 @@ -{writeShellApplication, ...}: -writeShellApplication { - name = "QS-notifyhistory"; - runtimeInputs = [ - ]; - text = '' - app="$1" - title="$2" - body="$3" - date="$(date +%T)" - urgency="$4" - - case "$urgency" in - 0) urgency_text="low";; - 1) urgency_text="normal";; - 2) urgency_text="critical";; - *) urgency_text="unknown";; - esac - { - echo "$app" - echo "$title" - echo "$body" - echo "$date" - echo "$urgency_text" - - } >> "$HOME/.cache/notify_history" - ''; -} diff --git a/modules/scripts/QSsysinfo.nix b/modules/scripts/QSsysinfo.nix deleted file mode 100644 index 16f1b25..0000000 --- a/modules/scripts/QSsysinfo.nix +++ /dev/null @@ -1,80 +0,0 @@ -{ - writeShellApplication, - ripgrep, - gawkInteractive, - iproute2, - coreutils, - procps, - upower, - ... -}: -writeShellApplication { - name = "QS-sysinfo"; - runtimeInputs = [ - ripgrep - gawkInteractive - iproute2 - coreutils - procps - upower - ]; - text = '' - # Pad CPU, MEM, DISK to 2 chars (right-aligned) - - cpu=$(awk '/^cpu /{printf("%.0f", ($2+$4)*100/($2+$4+$5))}' /proc/stat) - cpu=$(printf "%2s" "$cpu") - - sum=0 - count=0 - - for f in /sys/class/hwmon/hwmon*/temp*_input; do - if [ -r "$f" ]; then - val=$(cat "$f" 2>/dev/null) || continue - sum=$((sum + val)) - count=$((count + 1)) - fi - done - - temp=$(( sum / count / 1000 )) - - sum=0 - count=0 - - for f in /sys/class/hwmon/hwmon*/fan*_input; do - if [ -r "$f" ]; then - val=$(cat "$f" 2>/dev/null) || continue - sum=$((sum + val)) - count=$((count + 1)) - fi - done - fan=$(( sum / count )) - fan=$(printf "%4s" "$fan") - - mem=$(free | awk '/Mem:/ {printf("%.0f",$3/$2*100)}') - mem=$(printf "%2s" "$mem") - - disk=$(df / | awk 'NR==2 {gsub("%",""); print $5}') - disk=$(printf "%2s" "$disk") - - # Pad POWER to 5 chars (XX.XX) - power=$(upower -b | awk -F: '/energy-rate/ {gsub(/^[ \t]+/, "", $2); split($2,a," "); printf("%.2f", a[1])}') - power=$(printf "%5s" "$power") - - # network calculations - iface=$(ip route get 1.1.1.1 | awk '{print $5; exit}') - - rx1=$(cat "/sys/class/net/$iface/statistics/rx_bytes") - tx1=$(cat "/sys/class/net/$iface/statistics/tx_bytes") - - sleep 1 - - rx2=$(cat "/sys/class/net/$iface/statistics/rx_bytes") - tx2=$(cat "/sys/class/net/$iface/statistics/tx_bytes") - - down_speed=$(( (rx2 - rx1) / 1024 )) - up_speed=$(( (tx2 - tx1) / 1024 )) - - # Output JSON - echo "{\"cpu\":\"$cpu\",\"temp\":\"$temp\",\"fan\":\"$fan\",\"mem\":\"$mem\",\"disk\":\"$disk\",\"power\":\"$power\",\"down\":\"$down_speed\",\"up\":\"$up_speed\"}" - ''; -} diff --git a/modules/scripts/btm.nix b/modules/scripts/btm.nix deleted file mode 100644 index e459738..0000000 --- a/modules/scripts/btm.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ - writeShellApplication, - kitty, - bottom, - ... -}: -writeShellApplication { - name = "custom-bottom"; - runtimeInputs = [ - kitty - bottom - ]; - text = '' - kitty --class "custom-bottom" -o font_size=10 --name "custom-bottom" -e btm --theme gruvbox --disable-click --disable_advanced_kill --enable_cache_memory -g -R -T - ''; -} diff --git a/modules/scripts/changeAudioOutput.nix b/modules/scripts/changeAudioOutput.nix deleted file mode 100644 index 3e1aadb..0000000 --- a/modules/scripts/changeAudioOutput.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - writeShellApplication, - fzf, - pulseaudio, - jq, - ... -}: -writeShellApplication { - name = "custom-changeAudioOutput"; - runtimeInputs = [ - fzf - pulseaudio - jq - ]; - text = '' - select=$(pactl -f json list sinks | jq -r '.[].name' | fzf) - if [[ -n "$select" ]]; then - pactl set-default-sink "$select" - fi - pkill -f "kitty.*Select audio output" - ''; -} diff --git a/modules/scripts/checkKdrive.nix b/modules/scripts/checkKdrive.nix deleted file mode 100644 index 2a7f515..0000000 --- a/modules/scripts/checkKdrive.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ - writeShellApplication, - rclone, - matrix-commander-rs, - libnotify, - ... -}: -writeShellApplication { - name = "custom-checkKdrive"; - runtimeInputs = [ - rclone - matrix-commander-rs - libnotify - ]; - text = '' - - # waits for an internet connection. It pings both Google DNS and Cloudfare dns in case one of them is down - until ping -c1 -W1 1.1.1.1 >/dev/null 2>&1 || \ - ping -c1 -W1 8.8.8.8 >/dev/null 2>&1 - do - sleep 1 - done - - set +e - - output=$(rclone lsd kdrive: 2>&1) - status=$? - - set -e - - if [ $status -eq 0 ]; then - echo "kdrive OK" - else - echo "kdrive rclone failed with error: $output" - notify-send "rclone kdrive failed" "$output" - matrix-commander-rs --verbose -m "rclone kdrive failed.
Error:
$output

@notificationbot_0000" \ - --html \ - -r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU" - fi - ''; -} diff --git a/modules/scripts/colorpicker.nix b/modules/scripts/colorpicker.nix deleted file mode 100644 index 4718109..0000000 --- a/modules/scripts/colorpicker.nix +++ /dev/null @@ -1,82 +0,0 @@ -# useless -# used to come from my old dotfiles which were copied from fedora-hyprdots -# just use hyprpicker | tee >(wl-copy) | cliphist store -# because hyprpicker and cliphist are inside my configuration.nix -# no need to verify their existence -{ - writeShellApplication, - hyprpicker, - libnotify, - toybox, - wl-clipboard, - ... -}: -writeShellApplication { - name = "custom-colorpicker-useless"; - runtimeInputs = [ - hyprpicker - libnotify - toybox - wl-clipboard - ]; - text = '' - check() { - command -v "$1" 1>/dev/null - } - - notify() { - check notify-send && { - notify-send -a "Color Picker" "$@" - return - } - echo "$@" - } - - loc="$HOME/.cache/colorpicker" - [ -d "$loc" ] || mkdir -p "$loc" - [ -f "$loc/colors" ] || touch "$loc/colors" - - limit=10 - - [[ $# -eq 1 && $1 = "-l" ]] && { - cat "$loc/colors" - exit - } - - [[ $# -eq 1 && $1 = "-j" ]] && { - text="$(head -n 1 "$loc/colors")" - - mapfile -t allcolors < <(tail -n +2 "$loc/colors") - # allcolors=($(tail -n +2 "$loc/colors")) - tooltip=" COLORS\n\n" - - tooltip+="-> $text 󰸌 \n" - for i in "''${allcolors[@]}"; do - tooltip+=" $i 󰸌 \n" - done - - cat <󰸌", "tooltip":"$tooltip"} - EOF - - exit - } - - check hyprpicker || { - notify "hyprpicker is not installed" - exit - } - killall -q hyprpicker - color=$(hyprpicker) - - check wl-copy && { - echo "$color" | sed -z 's/\n//g' | wl-copy - } - - prevColors=$(head -n $((limit - 1)) "$loc/colors") - echo "$color" >"$loc/colors" - echo "$prevColors" >>"$loc/colors" - sed -i '/^$/d' "$loc/colors" - pkill -RTMIN+1 waybar - ''; -} diff --git a/modules/scripts/cowsay.nix b/modules/scripts/cowsay.nix deleted file mode 100644 index 9bbb7ad..0000000 --- a/modules/scripts/cowsay.nix +++ /dev/null @@ -1,83 +0,0 @@ -{ - writeShellApplication, - cowsay, - ... -}: -writeShellApplication { - name = "custom-cowsay"; - runtimeInputs = [cowsay]; - text = '' - - cows=("actually" "alpaca" "bud-frogs" "daemon" "elephant-in-snake" "moofasa" "skeleton" "three-eyes" "supermilker" "tux" "vader" "www") - declare -a sentences=( - "Sharing knowledge is the most fundamental act of friendship. Because it is a way you can give something without loosing something. -Richard Stallman" - "Free software' is a matter of liberty, not price. To understand the concept, you should think of 'free' as in 'free speech,' not as in 'free beer'. -Richard Stallman" - "Programming is not a science. Programming is a craft. -Richard Stallman" - "I did write some code in Java once, but that was the island in Indonesia. -Richard Stallman" - "Facebook is not your friend, it is a surveillance engine. -Richard Stallman" - "People said I should accept the world. Bullshit! I don't accept the world. -Richard Stallman" - "You can use any editor you want, but remember that vi vi vi is the text editor of the beast. -Richard Stallman" - "The idea of copyright did not exist in ancient times, when authors frequently copied other authors at length in works of non-fiction. This practice was useful, and is the only way many authors' works have survived even in part. -Richard Stallman" - "Idiots can be defeated but they never admit it. -Richard Stallman" - "Open source is a development methodology; free software is a social movement. -Richard Stallman" - "People sometimes ask me if it is a sin in the Church of Emacs to use vi. Using a free version of vi is not a sin; it is a penance. So happy hacking. -Richard Stallman" - "A computer is like air conditioning - it becomes useless when you open Windows -Linus Torvald" - "Intelligence is the ability to avoid doing work, yet getting the work done. -Linus Torvald" - "Software is like sex: It's better when it's free. -Linus Torvald" - "All operating systems sucks, but Linux just sucks less -Linus Torvald" - "I like offending people, because I think people who get offended should be offended. -Linus Torval" - "Talk is cheap. Show me the code. -Linus Torval" - "Most of the good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program. -Linus Torvald" - "Bad programmers worry about the code. Good programmers worry about data structures and their relationships. -Linus Torvald" - "If Microsoft ever does applications for Linux it means I've won. -Linus Torvald" - "Avoiding complexity reduces bugs. -Linus Torvald" - "Backups are for wimps. Real men upload their data to an FTP site and have everyone else mirror it. -Linus Torvald" - "Nobody actually creates perfect code the first time around, except me. But there's only one of me. -Linus Torvald" - "Microsoft isn't evil, they just make really crappy operating systems. -Linus Torvald" - "When you say 'I wrote a program that crashed Windows,' people just stare at you blankly and say 'Hey, I got those with the system, for free.' -Linus Torval" - "C++ is a horrible language. It's made more horrible by the fact that a lot of substandard programmers use it, to the point where it's much much easier to generate total and utter crap with it. -Linus Torvald" - "If you think your users are idiots, only idiots will use it. -Linus Torvald" - "My name is Linus, and I am your God. -Linus Torvald" - "An infinite number of monkeys typing into GNU emacs would never make a good program. -Linus Torvald" - "Object-oriented programming is an exceptionally bad idea which could only have originated in California. -Edgser Dijkstra" - "If debugging is the process of removing software bugs, then programming must be the process of putting them in. -Edgser Dijkstra" - "The art of programming is the art of organizing complexity. -Edgser Dijkstra" - "Program testing can be used to show the presence of bugs, but never to show their absence! -Edgser Dijkstra" - "It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. -Edgser Dijkstra" - "The effort of using machines to mimic the human mind has always struck me as rather silly. I would rather use them to mimic something better. -Edgser Dijkstra" - "Computer science is no more about computers than astronomy is about telescopes. -Edgser Dijkstra" - "Programming in Basic causes brain damage. -Edgser Dijkstra" - "The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague. -Edgser Dijkstra" - "If in physics there's something you don't understand, you can always hide behind the uncharted depths of nature. You can always blame God. You didn't make it so complex yourself. But if your program doesn't work, there is no one to hide behind. You cannot hide behind an obstinate nature. If it doesn't work, you've messed up. -Edgser Dijkstra" - "Teaching COBOL ought to be regarded as a criminal act. -Edgser Dijkstra" - "If you want more effective programmers, you will discover that they should not waste their time debugging, they should not introduce the bugs to start with. -Edgser Dijkstra" - "If we wish to count lines of code, we should not regard them as 'lines produced' but as 'lines spent.' -Edgser Dijkstra" - "In almost every computation a great variety of arrangements for the succession of the processes is possible, and various considerations must influence the selections amongst them for the purposes of a calculating engine. One essential object is to choose that arrangement which shall tend to reduce to a minimum the time necessary for completing the calculation. -Ada Lovelace" - "I’m making an operating system myself, so I know what it’s like to be God. -Terry Davis" - "I’m schizophrenic and so am I. -Terry Davis" - "If I was a dog, I would bark. -Terry Davis" - "Who has a better kernel? Debian? No. -Terry Davis" - "Computers are fast, programmers keep it slow. -A random Reddit user" - "Before software can be reusable it first has to be usable. -Ralph Johnson" - "The best thing about a Boolean is that even if you are wrong, you're only off by a bit. -Anonymous" - "It's not a bug, it's a feature. -Programmers" - "NVIDIA, fuck you -Linus Torvald" - ) - while true - do - echo - echo - echo - echo - echo - echo - SIndex=$(( RANDOM % ''${#sentences[@]} )) - index=$(( RANDOM % ''${#cows[@]} )) - #cow="/usr/share/cowsay/cows/''${cows[index]}.cow" - cowsay -f "''${cows[index]}" "''${sentences[SIndex]}" - sleep 10 - clear - done - ''; - # reduce terminal size for actually -} diff --git a/modules/scripts/dontkillsteam.nix b/modules/scripts/dontkillsteam.nix deleted file mode 100644 index b30a3ed..0000000 --- a/modules/scripts/dontkillsteam.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - writeShellApplication, - hyprland, - jq, - ... -}: -writeShellApplication { - name = "custom-dontkillsteam"; - runtimeInputs = [ - hyprland - jq - ]; - text = '' - class=$(hyprctl activewindow -j | jq -r ".class") - if [[ "$class" == "Steam" || "$class" == "custom-pomodoro" ]]; then - hyprctl dispatch movetoworkspacesilent special - else - hyprctl dispatch killactive "" - fi - - ''; -} diff --git a/modules/scripts/gitnotify.nix b/modules/scripts/gitnotify.nix deleted file mode 100644 index 5decd7a..0000000 --- a/modules/scripts/gitnotify.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - writeShellApplication, - git, - libnotify, - ... -}: -writeShellApplication { - name = "custom-gitnotify"; - runtimeInputs = [ - git - libnotify - ]; - text = '' - # Check if git is installed - if ! command -v git >/dev/null 2>&1; then - exit 0 - fi - - NAME=$(git config --global user.name) - EMAIL=$(git config --global user.email) - - if [[ -z "$NAME" || -z "$EMAIL" ]]; then - notify-send \ - "Git not configured" \ - "Set your identity\n or remove this warning by removing the custom-gitnotify line in\n ~/nixos/modules/home-manager/hyprland.nix" - matrix-commander-rs --verbose -m "Git not configured.
Set your identify or remove this warning by removing the custom-gitnotify in ~/nixos/modules/home-manager/hyprland.nix
@notificationbot_0000" \ - --html \ - -r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU" - fi - ''; -} diff --git a/modules/scripts/killall.nix b/modules/scripts/killall.nix deleted file mode 100644 index 860ae7d..0000000 --- a/modules/scripts/killall.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ - writeShellApplication, - hyprland, - jq, - ... -}: -writeShellApplication { - name = "custom-killall"; - runtimeInputs = [ - hyprland - jq - ]; - text = '' - active_workspace_id=$(hyprctl activeworkspace -j | jq -r '.id') - - hyprctl clients -j | - jq -r ".[] - | select(.workspace.id==''${active_workspace_id}) - | select(.focusHistoryID!=0) - | .pid" | - xargs -r kill - ''; -} diff --git a/modules/scripts/launch.nix b/modules/scripts/launch.nix deleted file mode 100644 index 1827989..0000000 --- a/modules/scripts/launch.nix +++ /dev/null @@ -1,17 +0,0 @@ -# used for the terminal autostart. Needs to get cleared and recall fastfetch so that the bar from oh-my-zsh get resized -{ - writeShellApplication, - zsh, - ... -}: -writeShellApplication { - name = "custom-launch"; - runtimeInputs = [ - zsh - ]; - text = '' - sleep 2 - clear - zsh - ''; -} diff --git a/modules/scripts/librewolfprofiles.nix b/modules/scripts/librewolfprofiles.nix deleted file mode 100644 index 4456e42..0000000 --- a/modules/scripts/librewolfprofiles.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ - writeShellApplication, - zsh, - fzf, - ... -}: -writeShellApplication { - name = "custom-librewolfprofiles"; - runtimeInputs = [ - zsh - fzf - ]; - text = '' - # List of profiles - profiles=("work" "other" "private window") - - # Use fzf to select - selected=$(printf "%s\n" "''${profiles[@]}" | fzf --height 6 --reverse --prompt="Select LibreWolf profile:") - - # If user cancels, exit - [[ -z "$selected" ]] && exit 0 - - # Launch LibreWolf detached, keeping environment - if [[ "$selected" == "private window" ]]; then - setsid librewolf --private-window --no-remote >/dev/null 2>&1 & - pkill -f "kitty.*Select LibreWolf profile" - else - setsid librewolf -P "$selected" --no-remote >/dev/null 2>&1 & - pkill -f "kitty.*Select LibreWolf profile" - fi - - # Exit the kitty terminal after selection - exit - ''; -} diff --git a/modules/scripts/man.nix b/modules/scripts/man.nix deleted file mode 100644 index 0b1766d..0000000 --- a/modules/scripts/man.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ - writeShellApplication, - man, - ripgrep, - fzf, - ... -}: let - cacheTime = "10"; -in - writeShellApplication { - name = "custom-man"; - runtimeInputs = [ - man - ripgrep - fzf - ]; - text = '' - CACHE_DIR="''${XDG_CACHE_HOME:-$HOME/.cache}" - CACHE_FILE="$CACHE_DIR/custom-man-options.txt" - mkdir -p "$CACHE_DIR" - - REGENERATE=0 - - # check if -r flag was passed - if [ "''${1:-}" = "-r" ]; then - REGENERATE=1 - fi - - - # regenerate if file does not exist or is older than cacheTime days - if [ ! -f "$CACHE_FILE" ] || [ "$(find "$CACHE_FILE" -mtime +${cacheTime} -print)" ]; then - REGENERATE=1 - fi - - if [ $REGENERATE -eq 1 ]; then - echo "(Re)building custom-manix cache..." - mkdir -p "$(dirname "$CACHE_FILE")" - man -k . > "$CACHE_FILE" - fi - - # read from cache and pipe into fzf - cat "$CACHE_FILE" \ - | fzf --preview "man {1}" \ - | xargs man - ''; - } diff --git a/modules/scripts/manix.nix b/modules/scripts/manix.nix deleted file mode 100644 index cdbbd8e..0000000 --- a/modules/scripts/manix.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ - writeShellApplication, - manix, - ripgrep, - fzf, - ... -}: let - cacheTime = "10"; -in - writeShellApplication { - name = "custom-manix"; - runtimeInputs = [ - manix - ripgrep - fzf - ]; - text = '' - CACHE_DIR="''${XDG_CACHE_HOME:-$HOME/.cache}" - CACHE_FILE="$CACHE_DIR/custom-manix-options.txt" - mkdir -p "$CACHE_DIR" - - REGENERATE=0 - - # check if -r flag was passed - if [ "''${1:-}" = "-r" ]; then - REGENERATE=1 - fi - - - # regenerate if file does not exist or is older than cacheTime days - if [ ! -f "$CACHE_FILE" ] || [ "$(find "$CACHE_FILE" -mtime +${cacheTime} -print)" ]; then - REGENERATE=1 - fi - - if [ $REGENERATE -eq 1 ]; then - echo "(Re)building custom-manix cache..." - mkdir -p "$(dirname "$CACHE_FILE")" - manix "" | rg -N '^(?:\x1b\[[0-9;]*m)*# ' | sed 's/\x1b\[[0-9;]*m//g; s/^# //' | rg -Nv '^(<|.*https?://)' > "$CACHE_FILE" - fi - - # read from cache and pipe into fzf - cat "$CACHE_FILE" \ - | fzf --preview "manix {}" \ - | xargs manix - ''; - } diff --git a/modules/scripts/mountkdrive.nix b/modules/scripts/mountkdrive.nix deleted file mode 100644 index 1b1d2df..0000000 --- a/modules/scripts/mountkdrive.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - writeShellApplication, - rclone, - libnotify, - ... -}: -writeShellApplication { - name = "custom-mountkdrive"; - runtimeInputs = [ - rclone - libnotify - ]; - text = '' - REMOTE_NAME="kdrive" - MOUNT_POINT="$HOME/kdrive" - - if rclone listremotes | rg "^''${REMOTE_NAME}:"; then - echo "Mounting ''${REMOTE_NAME}..." - rclone mount "''${REMOTE_NAME}:" "$MOUNT_POINT" --vfs-cache-mode writes --allow-non-empty & - else - notify-send "rclone mount failed" \ - "Remote ''${REMOTE_NAME} not found.\nConfigure rclone and create the dir ~/kdrive/ or comment out the exec line in hyprland.nix." - echo "Remote ''${REMOTE_NAME} not found. Configure rclone or comment out the exec line in hyprland.nix." - fi - ''; -} diff --git a/modules/scripts/obsidianbackup.nix b/modules/scripts/obsidianbackup.nix deleted file mode 100644 index 2dfc2ca..0000000 --- a/modules/scripts/obsidianbackup.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ - writeShellApplication, - rclone, - libnotify, - rsync, - ... -}: -writeShellApplication { - name = "custom-obsidianbackup"; - runtimeInputs = [ - rclone - libnotify - rsync - ]; - text = '' - #!/usr/bin/env bash - - SOURCE_DIR="$HOME/Documents/Notes" - DEST_DIR="$HOME/kdrive/Notes" - BACKUP_DIR="$HOME/.Notes.backup" - - mkdir -p "$DEST_DIR" - mkdir -p "$BACKUP_DIR" - - while true; do - # Timestamp for this run - TIMESTAMP=$(date +%Y-%m-%d_%H-%M) - TIMESTAMPED_BACKUP="$BACKUP_DIR/$TIMESTAMP" - mkdir -p "$TIMESTAMPED_BACKUP" - - echo "[$(date)] Starting Obsidian backup..." - - # Check rclone mount - status=$(rclone about kdrive: 2>&1 || true) - if [[ "$status" =~ .*CRITICAL.* ]]; then - echo "[$(date)] rclone failed:" - echo "$status" - notify-send -u critical "rclone failed" \ - "rclone might be broken or you need to deactivate this script in HomeManager." - else - # Run rsync with verbose debugging - echo "[$(date)] Running rsync..." - rsync -Lavh --progress --update --backup --backup-dir="$TIMESTAMPED_BACKUP" \ - --exclude='.obsidian/cache/**' \ - "$SOURCE_DIR/" "$DEST_DIR/" - - echo "[$(date)] Backup completed for this run." - fi - - # Safely remove backups older than 30 days - if [[ -d "$BACKUP_DIR" && "$BACKUP_DIR" == "$HOME/.Notes.backup" ]]; then - echo "[$(date)] Cleaning old backups..." - find "$BACKUP_DIR/" -mindepth 1 -maxdepth 1 -type d -mtime +30 -exec rm -rf {} \; - else - echo "[$(date)] Backup directory not safe. Skipping cleanup." - fi - - # Wait 1 hour - echo "[$(date)] Sleeping for 1 hour..." - sleep 3600 - done - ''; -} diff --git a/modules/scripts/obsidianprofiles.nix b/modules/scripts/obsidianprofiles.nix deleted file mode 100644 index ad98363..0000000 --- a/modules/scripts/obsidianprofiles.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ - writeShellApplication, - zsh, - fzf, - ripgrep, - ... -}: -writeShellApplication { - name = "custom-obsidianvaults"; - runtimeInputs = [ - zsh - fzf - ripgrep - ]; - text = '' - # Path to your obsidian.nix - obsidian_nix="$HOME/nixos/modules/home-manager/obsidian.nix" - - # Extract vault names without line numbers and colors - mapfile -t vaults < <(rg -N --color=never -Po 'vaults\.\K[[:alnum:]_]+' "$obsidian_nix") - - # Let user select a vault with fzf - selected=$(printf "%s\n" "''${vaults[@]}" \ - | fzf --height 6 --reverse --prompt="Select Obsidian vault:") - - # Exit if user cancels - [[ -z "$selected" ]] && exit 0 - - # Remove any stray ANSI codes (optional) - selected=$(echo "$selected" | sed -r 's/\x1B\[[0-9;]*[mK]//g') - - # Find the target path of the selected vault - vault_path=$(rg -N --color=never -A2 "vaults.$selected" "$obsidian_nix" \ - | rg 'target =' | sed -E 's/.*"([^"]+)".*/\1/') - - # Expand ~ if present - vault_path="''${vault_path/#\~/$HOME}" - - # Launch Obsidian with the selected vault using URI - [[ -n "$vault_path" ]] && setsid xdg-open "obsidian://open?vault=$selected" >/dev/null 2>&1 & - # Exit the kitty terminal after selection - pkill -f "kitty.*Select Obsidian vault" - exit - ''; -} diff --git a/modules/scripts/performance-mode.nix b/modules/scripts/performance-mode.nix deleted file mode 100644 index c9bd99a..0000000 --- a/modules/scripts/performance-mode.nix +++ /dev/null @@ -1,31 +0,0 @@ -# used for the terminal autostart. Needs to get cleared and recall fastfetch so that the bar from oh-my-zsh get resized -{writeShellApplication, ...}: -writeShellApplication { - name = "custom-performance"; - runtimeInputs = [ - "hyprland" - "gawk" - "libnotify" - ]; - text = '' - HYPRGAMEMODE=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}') - if [ "$HYPRGAMEMODE" = 1 ] ; then - hyprctl --batch "\ - keyword animations:enabled 0;\ - keyword animation borderangle,0; \ - keyword decoration:shadow:enabled 0;\ - keyword decoration:blur:enabled 0;\ - keyword decoration:fullscreen_opacity 1;\ - keyword general:gaps_in 0;\ - keyword general:gaps_out 0;\ - keyword general:border_size 1;\ - keyword decoration:rounding 0" - notify-send -u critical -t 5000 "Performance mode [ON]" - exit - else - notify-send -u critical -t 5000 "Performance mode [OFF]" - hyprctl reload - exit 0 - fi - ''; -} diff --git a/modules/scripts/syllabes.nix b/modules/scripts/syllabes.nix deleted file mode 100644 index 4655f9a..0000000 --- a/modules/scripts/syllabes.nix +++ /dev/null @@ -1,181 +0,0 @@ -{ - pkgs, - python3Packages, - ... -}: -pkgs.writers.writePython3Bin "custom-syllabes" { - libraries = [ - python3Packages.pyphen - ]; -} '' - import sys - import pyphen - - dic = pyphen.Pyphen(lang="fr") - - text = sys.stdin.read().strip() - - chunks = [] - total = 0 - - for w in text.split(): - hyphenated = dic.inserted(w) - parts = hyphenated.split("-") - chunks.append("/".join(parts)) - total += len(parts) - - print(f"{total} ({'/'.join(chunks)})") -'' -/* - used IPA but had a deprecated dependency -{ pkgs, python3Packages, ... }: - -pkgs.writers.writePython3Bin "custom-syllabes" { - libraries = [ - python3Packages.epitran - python3Packages.setuptools - ]; -} '' -import sys -import epitran -import re - -epi = epitran.Epitran("fra-Latn") - - -def count_syllables_ipa(ipa): - return len(re.findall(r"[aeiouyɑɛœɔ̃ɑ̃ɛ̃œ̃]", ipa)) - - -text = sys.stdin.read().strip() - -total = 0 -chunks = [] - -for word in text.split(): - ipa = epi.transliterate(word) - syllables = count_syllables_ipa(ipa) - - total += syllables - chunks.append(f"{word}/{ipa}") - -print(f"{total} ({' | '.join(chunks)})") -'' -*/ -/* - { pkgs, ... }: - -let - lexique = pkgs.fetchurl { - url = "http://www.lexique.org/databases/Lexique383/Lexique383.tsv"; - sha256 = "sha256-Y3ujenZ6ZmecSDcdZz7OUMv1QbSaTkDlmJY9Tz+85Ss="; - }; - -in -pkgs.writers.writePython3Bin "custom-syllabes" { - libraries = [ pkgs.python3Packages.pandas ]; -} '' -import os -import sys -import pandas as pd -import re - -# ---------------------------- -# Load Lexique383 -# ---------------------------- -LEX_PATH = os.environ.get( - "LEXIQUE_PATH", - "${lexique}" -) - -df = pd.read_csv(LEX_PATH, sep="\t", low_memory=False) - -lex = dict(zip(df["ortho"].str.lower(), df["phon"])) - - -# ---------------------------- -# phoneme-based syllabification -# ---------------------------- - -VOWELS = set([ - "a", "e", "ɛ", "ə", "i", "o", "ɔ", "u", "y", - "ɑ̃", "ɛ̃", "ɔ̃", "œ̃" -]) - - -def is_vowel(ph): - return any(v in ph for v in VOWELS) - - -def syllabify_phonemes(phonemes): - syllables = [] - cur = "" - - for p in phonemes: - cur += p - - if is_vowel(p): - syllables.append(cur) - cur = "" - - if cur and syllables: - syllables[-1] += cur - elif cur: - syllables.append(cur) - - return syllables - - -# ---------------------------- -# poetic adjustment (basic) -# ---------------------------- - -def apply_rules(word, phon, syllables): - # e muet at end (very rough heuristic) - if phon.endswith("ə") or phon.endswith("e"): - if len(syllables) > 1: - syllables = syllables[:-1] - return syllables - - -# ---------------------------- -# main counter -# ---------------------------- - -def count_word(word): - w = re.sub(r"[^a-zàâçéèêëîïôûùœæ']", "", word.lower()) - if not w: - return 0, [] - - phon = lex.get(w) - if not phon: - # fallback heuristic - syls = re.findall(r"[aeiouyàâéèêëîïôûùœæ]+", w) - return len(syls), syls - - phonemes = phon.split() - syls = syllabify_phonemes(phonemes) - syls = apply_rules(w, phon, syls) - - return len(syls), syls - - -def main(): - text = sys.stdin.read().strip() - total = 0 - out = [] - - for w in text.split(): - c, syls = count_word(w) - total += c - if syls: - out.append("/".join(syls)) - - print(f"{total} ({' '.join(out)})") - - -if __name__ == "__main__": - main() -'' -*/ - diff --git a/modules/scripts/tomato.nix b/modules/scripts/tomato.nix deleted file mode 100644 index 68c5526..0000000 --- a/modules/scripts/tomato.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ - writeShellApplication, - kitty, - tomato-c, - ... -}: -writeShellApplication { - name = "custom-tomato"; - runtimeInputs = [ - kitty - tomato-c - ]; - text = '' - kitty --class "custom-pomodoro" --name "custom-pomodoro" -e tomato - ''; -} diff --git a/modules/scripts/trimmer.nix b/modules/scripts/trimmer.nix deleted file mode 100644 index 16a8583..0000000 --- a/modules/scripts/trimmer.nix +++ /dev/null @@ -1,266 +0,0 @@ -# https://gist.github.com/MaxwellDupre/3077cd229490cf93ecab08ef2a79c852 -{ - writeShellApplication, - nix, - ... -}: -writeShellApplication { - name = "custom-trimmer"; - runtimeInputs = [ - nix - ]; - text = '' - set -euo pipefail - - ## Defaults - keepGensDef=30; keepDaysDef=7 - keepGens=$keepGensDef; keepDays=$keepDaysDef - - ## Usage - usage () { - printf "Usage:\n\t ./trim-generations.sh \n\n - (defaults are: Keep-Gens=%d Keep-Days=%d Profile=user)\n\n" "$keepGensDef" "$keepDaysDef" - printf "If you enter any parameters, you must enter all three, or none to use defaults.\n" - printf "Example:\n\t trim-generations.sh 15 10 home-manager\n" - printf " this will work on the home-manager profile and keep all generations from the\n" - printf "last 10 days, and keep at least 15 generations no matter how old.\n" - printf "\nProfiles available are:\tuser, home-manager, channels, system (root)\n" - printf "\n-h or --help prints this help text." - } - - if [ $# -eq 1 ]; then # if help requested - if [ "$1" = "-h" ]; then - usage - exit 1; - fi - if [ "$1" = "--help" ]; then - usage - exit 2; - fi - printf "Dont recognise your option exiting..\n\n" - usage - exit 3; - - elif [ $# -eq 0 ]; then # print the defaults - printf "The current defaults are:\n Keep-Gens=%d Keep-Days=%d \n\n" "$keepGensDef" "$keepDaysDef" - read -r -p "Keep these defaults? (y/n):" answer - - case "$answer" in - [yY1] ) - printf "Using defaults..\n" - ;; - [nN0] ) printf "ok, doing nothing, exiting..\n" - exit 6; - ;; - * ) printf "%b" "Doing nothing, exiting.." - exit 7; - ;; - esac - fi - - ## Handle parameters (and change if root) - if [[ $EUID -ne 0 ]]; then # if not root - profile=$(readlink /home/"$USER"/.nix-profile) - else - if [ -d /nix/var/nix/profiles/system ]; then # maybe this or the other - profile="/nix/var/nix/profiles/system" - elif [ -d /nix/var/nix/profiles/default ]; then - profile="/nix/var/nix/profiles/default" - else - echo "Cant find profile for root. Exiting" - exit 8 - fi - fi - if (( $# < 1 )); then - printf "Keeping default: %d generations OR %d days, whichever is more\n" "$keepGensDef" "$keepDaysDef" - elif [[ $# -le 2 ]]; then - printf "\nError: Not enough arguments.\n\n" >&2 - usage - exit 1 - elif (( $# > 4)); then - printf "\nError: Too many arguments.\n\n" >&2 - usage - exit 2 - else - if [ "$1" -lt 1 ]; then - printf "using Gen numbers less than 1 not recommended. Setting to min=1\n" - read -r -p "is that ok? (y/n): " answer - printf "%s" "$answer" - case "$answer" in - [yY1] ) - printf "ok, continuing..\n" - ;; - [nN0] ) - printf "ok, doing nothing, exiting..\n" - exit 6; - ;; - * ) - printf "%b" "Doing nothing, exiting.." - exit 7; - ;; - esac - fi - if [ "$2" -lt 0 ]; then - printf "using negative days number not recommended. Setting to min=0\n" - read -r -p "is that ok? (y/n): " answer - - case "$answer" in - [yY1] ) - printf "ok, continuing..\n" - ;; - [nN0] ) - printf "ok, doing nothing, exiting..\n" - exit 6; - ;; - * ) - printf "%b" "Doing nothing, exiting.." - exit 7; - ;; - esac - fi - keepGens=$1; keepDays=$2; - (( keepGens < 1 )) && keepGens=1 - (( keepDays < 0 )) && keepDays=0 - if [[ $EUID -ne 0 ]]; then - if [[ $3 == "user" ]] || [[ $3 == "default" ]]; then - profile=$(readlink /home/"$USER"/.nix-profile) - elif [[ $3 == "home-manager" ]]; then - # home-manager defaults to $XDG_STATE_HOME; otherwise, use - # `home-manager generations` and `nix-store --query --roots - # /nix/store/...` to figure out what reference is keeping the old - # generations alive. - profile="''${XDG_STATE_HOME:-$HOME/.local/state}/nix/profiles/home-manager" - elif [[ $3 == "channels" ]]; then - profile="/nix/var/nix/profiles/per-user/$USER/channels" - else - printf "\nError: Do not understand your third argument. Should be one of: (user / home-manager/ channels)\n\n" - usage - exit 3 - fi - else - if [[ $3 == "system" ]]; then - profile="/nix/var/nix/profiles/system" - elif [[ $3 == "user" ]] || [[ $3 == "default" ]]; then - profile="/nix/var/nix/profiles/default" - else - printf "\nError: Do not understand your third argument. Should be one of: (user / system)\n\n" - usage - exit 3 - fi - fi - printf "OK! \t Keep Gens = %s \t Keep Days = %s \n\n" "$keepGens" "$keepDays" - - - fi - - printf "Operating on profile: %s \t \n\n" "$profile" - - ## Runs at the end, to decide whether to delete profiles that match chosen parameters. - choose () { - local default="$1" - local prompt="$2" - local answer - - read -r -p "$prompt" answer - [ -z "$answer" ] && answer="$default" - - case "$answer" in - [yY1] ) #printf "answered yes!\n" - nix-env --delete-generations -p "$profile" "''${!gens[@]}" - exit 0 - ;; - [nN0] ) printf "Ok doing nothing exiting..\n" - exit 6; - ;; - * ) printf "%b" "Unexpected answer '$answer'!" >&2 - exit 7; - ;; - esac - } # end of function choose - - # printf "profile = %s \n\n" "$profile" - ## Query nix-env for generations list - #IFS=$'\n' nixGens=( $(nix-env --list-generations -p "$profile" | sed 's:^\s*::; s:\s*$::' | tr '\t' ' ' | tr -s ' ') ) - # gave errors replaced by: - mapfile -t nixGens < <( - nix-env --list-generations -p "$profile" | - sed 's:^\s*::; s:\s*$::' | - tr '\t' ' ' | - tr -s ' ' - ) - timeNow=$(date +%s) - - ## Get info on oldest generation - IFS=' ' read -r -a oldestGenArr <<< "''${nixGens[0]}" - oldestGen=''${oldestGenArr[0]} - oldestDate=''${oldestGenArr[1]} - printf "%-30s %s\n" "oldest generation:" "$oldestGen" - #oldestDate=''${nixGens[0]:3:19} - printf "%-30s %s\n" "oldest generation created:" "$oldestDate" - oldestTime=$(date -d "$oldestDate" +%s) - oldestElapsedSecs=$((timeNow-oldestTime)) - oldestElapsedMins=$((oldestElapsedSecs/60)) - oldestElapsedHours=$((oldestElapsedMins/60)) - oldestElapsedDays=$((oldestElapsedHours/24)) - printf "%-30s %s\n" "minutes before now:" "$oldestElapsedMins" - printf "%-30s %s\n" "hours before now:" "$oldestElapsedHours" - printf "%-30s %s\n\n" "days before now:" "$oldestElapsedDays" - - ## Get info on current generation - for i in "''${nixGens[@]}"; do - IFS=' ' read -r -a iGenArr <<< "$i" - genNumber=''${iGenArr[0]} - genDate=''${iGenArr[1]} - if [[ "$i" =~ current ]]; then - currentGen=$genNumber - printf "%-30s %s\n" "current generation:" "$currentGen" - currentDate=$genDate - printf "%-30s %s\n" "current generation created:" "$currentDate" - currentTime=$(date -d "$currentDate" +%s) - currentElapsedSecs=$((timeNow-currentTime)) - currentElapsedMins=$((currentElapsedSecs/60)) - currentElapsedHours=$((currentElapsedMins/60)) - currentElapsedDays=$((currentElapsedHours/24)) - printf "%-30s %s\n" "minutes before now:" "$currentElapsedMins" - printf "%-30s %s\n" "hours before now:" "$currentElapsedHours" - printf "%-30s %s\n\n" "days before now:" "$currentElapsedDays" - fi - done - - ## Compare oldest and current generations - timeBetweenOldestAndCurrent=$((currentTime-oldestTime)) - elapsedDays=$((timeBetweenOldestAndCurrent/60/60/24)) - generationsDiff=$((currentGen-oldestGen)) - - ## Figure out what we should do, based on generations and options - if [[ elapsedDays -le keepDays ]]; then - printf "All generations are no more than %s days older than current generation. \nOldest gen days difference from current gen: %s \n\n\tNothing to do!\n" "$keepDays" "$elapsedDays" - exit 4; - elif [[ generationsDiff -lt keepGens ]]; then - printf "Oldest generation (%d) is only %d generations behind current (%d). \n\n\t Nothing to do!\n" "$oldestGen" "$generationsDiff" "$currentGen" - exit 5; - else - printf "\tSomething to do...\n" - declare -a gens - for i in "''${nixGens[@]}"; do - IFS=' ' read -r -a iGenArr <<< "$i" - genNumber=''${iGenArr[0]} - genDiff=$((currentGen-genNumber)) - genDate=''${iGenArr[1]} - genTime=$(date -d "$genDate" +%s) - elapsedSecs=$((timeNow-genTime)) - genDaysOld=$((elapsedSecs/60/60/24)) - if [[ genDaysOld -gt keepDays ]] && [[ genDiff -ge keepGens ]]; then - gens["$genNumber"]="$genDate, $genDaysOld day(s) old" - fi - done - printf "\nFound the following generation(s) to delete:\n" - for K in "''${!gens[@]}"; do - printf "generation %d \t ''${gens[$K]}\n" "$K" - done - printf "\n" - choose "y" "Do you want to delete these? [Y/n]: " - fi - - ''; -} diff --git a/modules/scripts/wallpaper.nix b/modules/scripts/wallpaper.nix deleted file mode 100644 index 62916a2..0000000 --- a/modules/scripts/wallpaper.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ - writeShellApplication, - socat, - swww, - ... -}: let - wallpaper1 = ../../assets/wallpaper1.jpg; - wallpaper2 = ../../assets/wallpaper2.jpg; - wallpaper3 = ../../assets/wallpaper3.jpg; - wallpaper4 = ../../assets/wallpaper4.jpg; - wallpaper5 = ../../assets/wallpaper5.jpg; -in - writeShellApplication { - name = "custom-wallpaper"; - runtimeInputs = [ - socat - swww - ]; - text = '' - handle() { - case $1 in - workspace*) - str=$1 - i=$((''${#str}-1)) - workspace="''${str:$i:1}" - case $workspace in - 1 | 6) - swww img -t none ${wallpaper1} - ;; - 2 | 7) - swww img -t none ${wallpaper2} - ;; - 3 | 8) - swww img -t none ${wallpaper3} - ;; - 4 | 9) - swww img -t none ${wallpaper4} - ;; - 5 | 10 | 0) - swww img -t none ${wallpaper5} - ;; - esac - ;; - esac - } - - socat -U - UNIX-CONNECT:"$XDG_RUNTIME_DIR"/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock | while read -r line; do handle "$line"; done - ''; - } diff --git a/modules/scripts/weather.nix b/modules/scripts/weather.nix deleted file mode 100644 index 5ff2e36..0000000 --- a/modules/scripts/weather.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - writeShellApplication, - curl, - ... -}: -writeShellApplication { - name = "custom-weather"; - runtimeInputs = [ - curl - ]; - text = '' - while true; do - curl "https://wttr.in/?0&d&q&F&lang=fr" - sleep 7200 - done - ''; -} diff --git a/modules/scripts/weatherwaybar.nix b/modules/scripts/weatherwaybar.nix deleted file mode 100644 index 8e6a390..0000000 --- a/modules/scripts/weatherwaybar.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ - writeShellApplication, - curl, - ... -}: -writeShellApplication { - name = "custom-weatherwaybar"; - runtimeInputs = [ - curl - ]; - text = '' - PATTERN="C" - PATTERN2=" " - TEXT1="''$(curl -s "https://wttr.in/?format=%c")" - TEXT1=''${TEXT1/$PATTERN2/} - TEXT2="''$(curl -s "https://wttr.in/?format=%t")" - TEXT2=''${TEXT2/$PATTERN/} - TEXT3="''$(curl -s "https://wttr.in/?format=%f")" - TEXT3=''${TEXT3/$PATTERN/} - printf '{"text":" %s\\n %s\\n %s", "tooltip": false, "class": "weather"}\\n' \ - "$TEXT1" "$TEXT2" "$TEXT3" - ''; -} diff --git a/modules/test.nix b/modules/test.nix new file mode 100644 index 0000000..5d347df --- /dev/null +++ b/modules/test.nix @@ -0,0 +1,9 @@ +{inputs, ...}: { + flake.nixosModules.test = { pkgs, ...}: { + programs.firefox.enable = true; + + environment.systemPackages = with pkgs; [ + vim + ]; + }; +} diff --git a/modules/utilities/README.md b/modules/utilities/README.md new file mode 100644 index 0000000..3fa49f7 --- /dev/null +++ b/modules/utilities/README.md @@ -0,0 +1 @@ +./utilities are more for collection of small application/settings that big configuration that should be in ../application diff --git a/modules/utilities/audioAndMedia.nix b/modules/utilities/audioAndMedia.nix new file mode 100644 index 0000000..194b02b --- /dev/null +++ b/modules/utilities/audioAndMedia.nix @@ -0,0 +1,60 @@ +{ self, ... }: { + flake.nixosModules.audioAndMedia = {pkgs, ...}: { + # 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; + }; + environment.systemPackages = with pkgs; [ + self.packages.${pkgs.system}.custom-changeAudioOutput + kdePackages.okular + kdePackages.dolphin + pulseaudio # sound server + playerctl # controls media player + pavucontrol # PulseAudio Volume Control + mplayer # Movie player that supports many video formats + krita # image edition + yt-dlp # some youtube downloader + vlc + #mprisence # Highly customizable Discord Rich Presence for MPRIS media players on Linux + #gif-for-cli # Render gifs as ASCII art in your cli + #rembg # background remover + gpu-screen-recorder + inkscape + ]; + + security.wrappers.gsr-kms-server = { + # to remove the password prompt when using gpu-screen-recorder + owner = "root"; + group = "root"; + capabilities = "cap_sys_admin+ep"; + source = "${pkgs.gpu-screen-recorder}/bin/gsr-kms-server"; + }; + }; + flake.packages.custom-changeAudioOutput = { pkgs, ...}: + pkgs.writeShellApplication { + name = "custom-changeAudioOutput"; + runtimeInputs = with pkgs; [ + fzf + pulseaudio + jq + ]; + text = '' + select=$(pactl -f json list sinks | jq -r '.[].name' | fzf) + if [[ -n "$select" ]]; then + pactl set-default-sink "$select" + fi + pkill -f "kitty.*Select audio output" + ''; + }; +} diff --git a/modules/utilities/autoCleanup.nix b/modules/utilities/autoCleanup.nix new file mode 100644 index 0000000..62f0193 --- /dev/null +++ b/modules/utilities/autoCleanup.nix @@ -0,0 +1,118 @@ +{ self, ... }: { + flake.nixosModules.autoCleanup-laptop = {pkgs, ...}: { + # Ensure your script is available system-wide + environment.systemPackages = [ + self.packages.${pkgs.system}.custom-cleanNix-laptop + ]; + users.users.tomasr = { + linger = true; # lingering is required + }; + + systemd.user.services.custom-cleanNix = { + description = "NixOS configuration auto cleanup"; + + serviceConfig = { + Type = "oneshot"; + + ExecStart = "/run/current-system/sw/bin/custom-cleanNix"; + + # safety for long rebuilds + TimeoutStartSec = "45min"; + TimeoutStopSec = "10min"; + + # avoid overlap + RemainAfterExit = true; + + # tweaks that should make the system run normally during the rebuilds + Nice = 10; + IOSchedulingClass = "best-effort"; + IOSchedulingPriority = 7; + }; + }; + + # Systemd USER timer + systemd.user.timers.custom-cleanNix = { + wantedBy = ["timers.target"]; + + timerConfig = { + OnCalendar = "Sat *-*-* 20:00:00"; # runs saturday night. If for whatever reason something breaks. I have whole sunday to fix it. + + Persistent = true; # if it happens during shutted down + + # avoids thundering herd on boot + RandomizedDelaySec = "2h"; + }; + }; + }; + flake.packages.custom-cleanNix-laptop = {pkgs, ...}: + pkgs.writeShellApplication { + name = "custom-cleanNix"; + + runtimeInputs = with pkgs; [ + git + nixos-rebuild + matrix-commander-rs + libnotify + alejandra + deadnix + ]; + + text = '' + set -e + + FLAKE_DIR="/home/tomasr/nixos" + FLAKE="$FLAKE_DIR#laptop" + TIME=$(date -u +"%Y-%m-%dT%H-%M-%SZ") + + ERROR_FILE=$(mktemp) + + # snapshot current state + git -C "$FLAKE_DIR" add -A + git -C "$FLAKE_DIR" commit --allow-empty -m "snapshot pre-cleanup-$TIME" + git -C "$FLAKE_DIR" tag "pre-cleanup-$TIME" HEAD + + # the echos are to separate what each one is doing. Just for curiosity + echo "deadnix scans your Nix code and removes or reports unused (dead) variables and bindings" + deadnix --edit "$FLAKE_DIR" # removes unused code + echo "--------------------------------------------------------------" + echo "statix lints your Nix code to find stylistic issues, bad patterns, and potential mistakes." + statix fix "$FLAKE_DIR" # check other linting issues + echo "--------------------------------------------------------------" + echo "alejandra formats your Nix code consistently according to a strict, opinionated style." + alejandra "$FLAKE_DIR" # formats the config + echo "--------------------------------------------------------------" + + if sudo /run/current-system/sw/bin/nixos-rebuild switch --flake "$FLAKE" 2> "$ERROR_FILE"; then # use /run/.../bin/ uses the sudoless rule + + if ! git -C "$FLAKE_DIR" diff --quiet HEAD; then + git -C "$FLAKE_DIR" add -A + git -C "$FLAKE_DIR" commit -m "Auto: cleanup-$TIME" + git -C "$FLAKE_DIR" push + + notify-send "Nix auto cleanup" "Everything OK" + + matrix-commander-rs --verbose -m "Nix auto cleanup. Everything OK.
@notificationbot_0000" \ + --html \ + -r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU" + else + notify-send "Nix auto cleanup" "No changes" + git -C "$FLAKE_DIR" push + fi + + else + ERROR_MSG=$(cat "$ERROR_FILE") + + notify-send -u critical "Nix auto cleanup" "FAILED" + + matrix-commander-rs --verbose -m "Nix auto cleanup failed.
Error:
$ERROR_MSG

@notificationbot_0000" \ + --html \ + -r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU" + + git -C "$FLAKE_DIR" reset --hard "pre-cleanup-$TIME" + fi + git -C "$FLAKE_DIR" tag -d "pre-cleanup-$TIME" # removes the tag + + rm -f "$ERROR_FILE" + ''; + }; +} diff --git a/modules/utilities/autoUpdate.nix b/modules/utilities/autoUpdate.nix new file mode 100644 index 0000000..cb20673 --- /dev/null +++ b/modules/utilities/autoUpdate.nix @@ -0,0 +1,109 @@ +{ self, ... }: { + flake.nixosModules.autoUpdate-laptop = {pkgs, ...}: { + # Ensure your script is available system-wide + environment.systemPackages = [ + self.packages.${pkgs.system}.custom-autoupdate-laptop + ]; + users.users.tomasr = { + linger = true; # lingering is required + }; + + systemd.user.services.custom-autoupdate = { + description = "NixOS flake auto update"; + + serviceConfig = { + Type = "oneshot"; + + ExecStart = "/run/current-system/sw/bin/custom-autoupdate"; + + # safety for long rebuilds + TimeoutStartSec = "45min"; + TimeoutStopSec = "10min"; + + # avoid overlap + RemainAfterExit = true; + + # tweaks that should make the system run normally during the rebuilds + Nice = 10; + IOSchedulingClass = "best-effort"; + IOSchedulingPriority = 7; + }; + }; + + # Systemd USER timer + systemd.user.timers.custom-autoupdate = { + wantedBy = ["timers.target"]; + + timerConfig = { + OnCalendar = "Fri *-*-* 20:00:00"; # runs friday night. If for whatever reason something breaks. I have whole week-end to fix it. + + Persistent = true; # if it happens during shutted down + + # avoids thundering herd on boot + RandomizedDelaySec = "2h"; + }; + }; + }; + flake.packages.custom-autoupdate-laptop = {pkgs, ...}: + pkgs.writeShellApplication { + name = "custom-autoupdate"; + + runtimeInputs = with pkgs; [ + git + nixos-rebuild + matrix-commander-rs + libnotify + ]; + + text = '' + set -e + + FLAKE_DIR="/home/tomasr/nixos" + FLAKE="$FLAKE_DIR#laptop" + TIME=$(date -u +"%Y-%m-%dT%H-%M-%SZ") + + ERROR_FILE=$(mktemp) + + # snapshot current state + git -C "$FLAKE_DIR" add -A + git -C "$FLAKE_DIR" commit --allow-empty -m "snapshot pre-autoupdate-$TIME" + git -C "$FLAKE_DIR" tag "pre-autoupdate-$TIME" HEAD + + # update lock only + nix flake update --flake "$FLAKE_DIR" + + if sudo /run/current-system/sw/bin/nixos-rebuild switch --flake "$FLAKE" 2> "$ERROR_FILE"; then # use /run/.../bin/ uses the sudoless rule + + if ! git -C "$FLAKE_DIR" diff --quiet -- flake.lock; then + git -C "$FLAKE_DIR" add flake.lock + git -C "$FLAKE_DIR" commit -m "flake.lock: autoupdate-$TIME" + git -C "$FLAKE_DIR" push + + notify-send "Flake autoupdate" "Rebuild OK" + + matrix-commander-rs --verbose -m "Flake rebuild succesfull.
@notificationbot_0000" \ + --html \ + -r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU" + else + notify-send "Flake autoupdate" "No changes" + git -C "$FLAKE_DIR" push + fi + + else + ERROR_MSG=$(cat "$ERROR_FILE") + + notify-send -u critical "Flake autoupdate" "FAILED" + + matrix-commander-rs --verbose -m "Flake rebuild failed.
Error:
$ERROR_MSG

@notificationbot_0000" \ + --html \ + -r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU" + + git -C "$FLAKE_DIR" reset --hard "pre-autoupdate-$TIME" + fi + + git -C "$FLAKE_DIR" tag -d "pre-autoupdate-$TIME" # removes the tag + + rm -f "$ERROR_FILE" + ''; + }; +} diff --git a/modules/utilities/communicationAndNotification.nix b/modules/utilities/communicationAndNotification.nix new file mode 100644 index 0000000..e6c9c3e --- /dev/null +++ b/modules/utilities/communicationAndNotification.nix @@ -0,0 +1,62 @@ +{ self, ...}: { + flake.nixosModules.notifications = { pkgs, ... }: { + environment.systemPackages = with pkgs; [ + libnotify # Library that sends desktop notifications to a notification daemon + socat # Utility for bidirectional data transfer between two independent data channels (used to communicate between hyprland and swww to change wallpapers dinamically) + matrix-commander-rs # matrix client used to send notifications from scripts to my phone + # battery notifications + self.packages.${pkgs.system}.custom-batterynotify + self.packages.${pkgs.system}.custom-batterywarning + # checks if matrix-commander-rs is installed and logged in + self.packages.${pkgs.system}.custom-checkMatrix + self.packages.${pkgs.system}.custom-gitnotify # checks if git is set up + self.packages.${pkgs.system}.custom-checkKdrive # check if kdrive is set up with rclone + ]; + }; + flake.packages.custom-checkMatrix = { pkgs, ...}: + pkgs.writeShellApplication { + name = "custom-checkMatrix"; + + runtimeInputs = with pkgs; [ + matrix-commander-rs + libnotify + ]; + + text = '' + expected="@totorile1:unredacted.org" + + current="$(matrix-commander-rs --whoami | tr -d '\n')" + + if [ "$current" != "$expected" ]; then + notify-send "matrix-commander-rs" \ + "You are not logged in as @totorile1:unredacted.org\nLog:\n$current" + fi + ''; + }; + flake.packages.custom-gitnotify = { pkgs, ...}: + pkgs.writeShellApplication { + name = "custom-gitnotify"; + runtimeInputs = with pkgs; [ + git + libnotify + ]; + text = '' + # Check if git is installed + if ! command -v git >/dev/null 2>&1; then + exit 0 + fi + + NAME=$(git config --global user.name) + EMAIL=$(git config --global user.email) + + if [[ -z "$NAME" || -z "$EMAIL" ]]; then + notify-send \ + "Git not configured" \ + "Set your identity\n or remove this warning by removing the custom-gitnotify line in\n ~/nixos/modules/applications/hyprland.nix" + matrix-commander-rs --verbose -m "Git not configured.
Set your identify or remove this warning by removing the custom-gitnotify in ~/nixos/modules/applications/hyprland.nix
@notificationbot_0000" \ + --html \ + -r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU" + fi + ''; + }; +} diff --git a/modules/utilities/development.nix b/modules/utilities/development.nix new file mode 100644 index 0000000..e4b6bbd --- /dev/null +++ b/modules/utilities/development.nix @@ -0,0 +1,32 @@ +{ ... }: +{ + flake.nixosModules.development = { pkgs, pkgs-unstable, ... }: { + programs.nix-ld.enable = true; #Run unpatched dynamic binaries on NixOS. For example lets run ./a.out from gcc + environment.systemPackages = with pkgs; [ + gcc + jq # json parser used in some scripts + jp # lightweight and flexible cli JSON parser + (pkgs-unstable.python314.withPackages (ps: + with ps; [ + matplotlib + networkx + scipy + ])) + python313Packages.pygments # used for ccat (comment of colorize plugin from oh-my-zsh) + pkg-config + gdb + raylib + glfw # raylib and some dependecies + gnumake + go + direnv + cling # c interpreter used for coding + # lsp + clang-tools + python311Packages.python-lsp-server + ltex-ls-plus + pylint + black + ]; + }; +} diff --git a/modules/utilities/documentation.nix b/modules/utilities/documentation.nix new file mode 100644 index 0000000..021d231 --- /dev/null +++ b/modules/utilities/documentation.nix @@ -0,0 +1,93 @@ +{ self, ... }: let cacheTime = "10"; in { + flake.nixosModules.documentation = { pkgs, ... }: { + # unfortunatly this adds a lot of computation when nix rebuilds + documentation.man.generateCaches = true; # used for the man script + + environment.pathsToLink = [ + # see https://wiki.nixos.org/wiki/Documentation_Gaps#How_do_manpages_work?_Or:_environment.pathsToLink_and_buildEnv + "/share/applications" + "/share/xdg-desktop-portal" + ]; + environment.systemPackages = [ + pkgs.manix + self.packages.${pkgs.system}.custom-man + self.packages.${pkgs.system}.custom-manix + ]; + }; + flake.packages.custom-man = { pkgs, ... }: + pkgs.writeShellApplication { + name = "custom-man"; + runtimeInputs = with pkgs; [ + man + ripgrep + fzf + ]; + text = '' + CACHE_DIR="''${XDG_CACHE_HOME:-$HOME/.cache}" + CACHE_FILE="$CACHE_DIR/custom-man-options.txt" + mkdir -p "$CACHE_DIR" + + REGENERATE=0 + + # check if -r flag was passed + if [ "''${1:-}" = "-r" ]; then + REGENERATE=1 + fi + + + # regenerate if file does not exist or is older than cacheTime days + if [ ! -f "$CACHE_FILE" ] || [ "$(find "$CACHE_FILE" -mtime +${cacheTime} -print)" ]; then + REGENERATE=1 + fi + + if [ $REGENERATE -eq 1 ]; then + echo "(Re)building custom-manix cache..." + mkdir -p "$(dirname "$CACHE_FILE")" + man -k . > "$CACHE_FILE" + fi + + # read from cache and pipe into fzf + cat "$CACHE_FILE" \ + | fzf --preview "man {1}" \ + | xargs man + ''; + }; + flake.packages.custom-manix = { pkgs, ... }: + pkgs.writeShellApplication { + name = "custom-manix"; + runtimeInputs = with pkgs; [ + manix + ripgrep + fzf + ]; + text = '' + CACHE_DIR="''${XDG_CACHE_HOME:-$HOME/.cache}" + CACHE_FILE="$CACHE_DIR/custom-manix-options.txt" + mkdir -p "$CACHE_DIR" + + REGENERATE=0 + + # check if -r flag was passed + if [ "''${1:-}" = "-r" ]; then + REGENERATE=1 + fi + + + # regenerate if file does not exist or is older than cacheTime days + if [ ! -f "$CACHE_FILE" ] || [ "$(find "$CACHE_FILE" -mtime +${cacheTime} -print)" ]; then + REGENERATE=1 + fi + + if [ $REGENERATE -eq 1 ]; then + echo "(Re)building custom-manix cache..." + mkdir -p "$(dirname "$CACHE_FILE")" + manix "" | rg -N '^(?:\x1b\[[0-9;]*m)*# ' | sed 's/\x1b\[[0-9;]*m//g; s/^# //' | rg -Nv '^(<|.*https?://)' > "$CACHE_FILE" + fi + + # read from cache and pipe into fzf + cat "$CACHE_FILE" \ + | fzf --preview "manix {}" \ + | xargs manix + ''; + }; +} diff --git a/modules/utilities/latex.nix b/modules/utilities/latex.nix new file mode 100644 index 0000000..9ae0655 --- /dev/null +++ b/modules/utilities/latex.nix @@ -0,0 +1,46 @@ +{ ... }: { + flake.nixosModules.latex = {pkgs, ...}: { + environment.systemPackages = with pkgs; [ + texlab + ltex-ls-plus + biber + (pkgs.texliveMedium.withPackages ( + ps: + with ps; [ + # these few pkgs are used in the CV template + titlesec # allows creating custom \section + marvosym # some symboles + ebgaramond # Use the EB Garamond font + microtype # To enable letterspacing + fontaxes + # these few pkgs were used for my TM + svg + catchfile + caption + transparent + cfr-lm + svn-prov + nfssext-cfr + hyphenat + csquotes + enumitem + chngcntr + tcolorbox + pdfcol + wrapfig + tocloft + lastpage + biblatex + biblatex-iso690 + libertine + minted + upquote + lipsum + footmisc + #(setq org-latex-compiler "lualatex") + #(setq org-preview-latex-default-process 'dvisvgm) + ] + )) + ]; + }; +} diff --git a/modules/utilities/networking.nix b/modules/utilities/networking.nix new file mode 100644 index 0000000..41326d9 --- /dev/null +++ b/modules/utilities/networking.nix @@ -0,0 +1,27 @@ +{ ... }: { + flake.nixosModules.networking = {pkgs, ...}: { + environment.systemPackages = with pkgs; [ + wget + networkmanagerapplet # NetworkManager control applet + inetutils # collections of network programs such as telnet + ]; + #networking.Name = "nixos"; # Define your hostname. + #networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + #networking.proxy.default = "http://user:password@proxy:port/"; + #networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + networking.firewall.enable = false; + }; +} diff --git a/modules/utilities/nixUtils.nix b/modules/utilities/nixUtils.nix new file mode 100644 index 0000000..54b9af2 --- /dev/null +++ b/modules/utilities/nixUtils.nix @@ -0,0 +1,301 @@ +{ inputs, ... }: +{ + flake.nixosModules.nixUtils-laptop = { ... }: { + # nixpkgs-review crashed my laptop multiple times. We must reduce how much ressources it can take. + # for reference, my laptop is a 12 core ryzen 7 + nix.settings.max-jobs = 6; + nix.settings.cores = 6; + }; + flake.nixosModules.nixUtils = { pkgs-unstable, ... }: { + # Garbage collector of generations + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; # every week delete generations older than a month + }; + + #manix is unhappy without this + nix.nixPath = [ + "nixpkgs=${inputs.nixpkgs.outPath}" + "home-manager=${inputs.home-manager.outPath}" + ]; + + #adds nixos experimental features: + nix.settings.experimental-features = ["nix-command" "flakes"]; + + environment.systemPackages = with pkgs-unstable; [ + nixpkgs-review + nixfmt-tree + treefmt + nixd + deadnix + alejandra + vimPluginsUpdater # used for building plugins + nix-index + statix + ]; + }; + flake.packages.custom-trimmer = { pkgs, ... }: + # https://gist.github.com/MaxwellDupre/3077cd229490cf93ecab08ef2a79c852 + # better garbage collector + pkgs.writeShellApplication { + name = "custom-trimmer"; + runtimeInputs = with pkgs; [ + nix + ]; + text = '' + set -euo pipefail + + ## Defaults + keepGensDef=30; keepDaysDef=7 + keepGens=$keepGensDef; keepDays=$keepDaysDef + + ## Usage + usage () { + printf "Usage:\n\t ./trim-generations.sh \n\n + (defaults are: Keep-Gens=%d Keep-Days=%d Profile=user)\n\n" "$keepGensDef" "$keepDaysDef" + printf "If you enter any parameters, you must enter all three, or none to use defaults.\n" + printf "Example:\n\t trim-generations.sh 15 10 home-manager\n" + printf " this will work on the home-manager profile and keep all generations from the\n" + printf "last 10 days, and keep at least 15 generations no matter how old.\n" + printf "\nProfiles available are:\tuser, home-manager, channels, system (root)\n" + printf "\n-h or --help prints this help text." + } + + if [ $# -eq 1 ]; then # if help requested + if [ "$1" = "-h" ]; then + usage + exit 1; + fi + if [ "$1" = "--help" ]; then + usage + exit 2; + fi + printf "Dont recognise your option exiting..\n\n" + usage + exit 3; + + elif [ $# -eq 0 ]; then # print the defaults + printf "The current defaults are:\n Keep-Gens=%d Keep-Days=%d \n\n" "$keepGensDef" "$keepDaysDef" + read -r -p "Keep these defaults? (y/n):" answer + + case "$answer" in + [yY1] ) + printf "Using defaults..\n" + ;; + [nN0] ) printf "ok, doing nothing, exiting..\n" + exit 6; + ;; + * ) printf "%b" "Doing nothing, exiting.." + exit 7; + ;; + esac + fi + + ## Handle parameters (and change if root) + if [[ $EUID -ne 0 ]]; then # if not root + profile=$(readlink /home/"$USER"/.nix-profile) + else + if [ -d /nix/var/nix/profiles/system ]; then # maybe this or the other + profile="/nix/var/nix/profiles/system" + elif [ -d /nix/var/nix/profiles/default ]; then + profile="/nix/var/nix/profiles/default" + else + echo "Cant find profile for root. Exiting" + exit 8 + fi + fi + if (( $# < 1 )); then + printf "Keeping default: %d generations OR %d days, whichever is more\n" "$keepGensDef" "$keepDaysDef" + elif [[ $# -le 2 ]]; then + printf "\nError: Not enough arguments.\n\n" >&2 + usage + exit 1 + elif (( $# > 4)); then + printf "\nError: Too many arguments.\n\n" >&2 + usage + exit 2 + else + if [ "$1" -lt 1 ]; then + printf "using Gen numbers less than 1 not recommended. Setting to min=1\n" + read -r -p "is that ok? (y/n): " answer + printf "%s" "$answer" + case "$answer" in + [yY1] ) + printf "ok, continuing..\n" + ;; + [nN0] ) + printf "ok, doing nothing, exiting..\n" + exit 6; + ;; + * ) + printf "%b" "Doing nothing, exiting.." + exit 7; + ;; + esac + fi + if [ "$2" -lt 0 ]; then + printf "using negative days number not recommended. Setting to min=0\n" + read -r -p "is that ok? (y/n): " answer + + case "$answer" in + [yY1] ) + printf "ok, continuing..\n" + ;; + [nN0] ) + printf "ok, doing nothing, exiting..\n" + exit 6; + ;; + * ) + printf "%b" "Doing nothing, exiting.." + exit 7; + ;; + esac + fi + keepGens=$1; keepDays=$2; + (( keepGens < 1 )) && keepGens=1 + (( keepDays < 0 )) && keepDays=0 + if [[ $EUID -ne 0 ]]; then + if [[ $3 == "user" ]] || [[ $3 == "default" ]]; then + profile=$(readlink /home/"$USER"/.nix-profile) + elif [[ $3 == "home-manager" ]]; then + # home-manager defaults to $XDG_STATE_HOME; otherwise, use + # `home-manager generations` and `nix-store --query --roots + # /nix/store/...` to figure out what reference is keeping the old + # generations alive. + profile="''${XDG_STATE_HOME:-$HOME/.local/state}/nix/profiles/home-manager" + elif [[ $3 == "channels" ]]; then + profile="/nix/var/nix/profiles/per-user/$USER/channels" + else + printf "\nError: Do not understand your third argument. Should be one of: (user / home-manager/ channels)\n\n" + usage + exit 3 + fi + else + if [[ $3 == "system" ]]; then + profile="/nix/var/nix/profiles/system" + elif [[ $3 == "user" ]] || [[ $3 == "default" ]]; then + profile="/nix/var/nix/profiles/default" + else + printf "\nError: Do not understand your third argument. Should be one of: (user / system)\n\n" + usage + exit 3 + fi + fi + printf "OK! \t Keep Gens = %s \t Keep Days = %s \n\n" "$keepGens" "$keepDays" + + + fi + + printf "Operating on profile: %s \t \n\n" "$profile" + + ## Runs at the end, to decide whether to delete profiles that match chosen parameters. + choose () { + local default="$1" + local prompt="$2" + local answer + + read -r -p "$prompt" answer + [ -z "$answer" ] && answer="$default" + + case "$answer" in + [yY1] ) #printf "answered yes!\n" + nix-env --delete-generations -p "$profile" "''${!gens[@]}" + exit 0 + ;; + [nN0] ) printf "Ok doing nothing exiting..\n" + exit 6; + ;; + * ) printf "%b" "Unexpected answer '$answer'!" >&2 + exit 7; + ;; + esac + } # end of function choose + + # printf "profile = %s \n\n" "$profile" + ## Query nix-env for generations list + #IFS=$'\n' nixGens=( $(nix-env --list-generations -p "$profile" | sed 's:^\s*::; s:\s*$::' | tr '\t' ' ' | tr -s ' ') ) + # gave errors replaced by: + mapfile -t nixGens < <( + nix-env --list-generations -p "$profile" | + sed 's:^\s*::; s:\s*$::' | + tr '\t' ' ' | + tr -s ' ' + ) + timeNow=$(date +%s) + + ## Get info on oldest generation + IFS=' ' read -r -a oldestGenArr <<< "''${nixGens[0]}" + oldestGen=''${oldestGenArr[0]} + oldestDate=''${oldestGenArr[1]} + printf "%-30s %s\n" "oldest generation:" "$oldestGen" + #oldestDate=''${nixGens[0]:3:19} + printf "%-30s %s\n" "oldest generation created:" "$oldestDate" + oldestTime=$(date -d "$oldestDate" +%s) + oldestElapsedSecs=$((timeNow-oldestTime)) + oldestElapsedMins=$((oldestElapsedSecs/60)) + oldestElapsedHours=$((oldestElapsedMins/60)) + oldestElapsedDays=$((oldestElapsedHours/24)) + printf "%-30s %s\n" "minutes before now:" "$oldestElapsedMins" + printf "%-30s %s\n" "hours before now:" "$oldestElapsedHours" + printf "%-30s %s\n\n" "days before now:" "$oldestElapsedDays" + + ## Get info on current generation + for i in "''${nixGens[@]}"; do + IFS=' ' read -r -a iGenArr <<< "$i" + genNumber=''${iGenArr[0]} + genDate=''${iGenArr[1]} + if [[ "$i" =~ current ]]; then + currentGen=$genNumber + printf "%-30s %s\n" "current generation:" "$currentGen" + currentDate=$genDate + printf "%-30s %s\n" "current generation created:" "$currentDate" + currentTime=$(date -d "$currentDate" +%s) + currentElapsedSecs=$((timeNow-currentTime)) + currentElapsedMins=$((currentElapsedSecs/60)) + currentElapsedHours=$((currentElapsedMins/60)) + currentElapsedDays=$((currentElapsedHours/24)) + printf "%-30s %s\n" "minutes before now:" "$currentElapsedMins" + printf "%-30s %s\n" "hours before now:" "$currentElapsedHours" + printf "%-30s %s\n\n" "days before now:" "$currentElapsedDays" + fi + done + + ## Compare oldest and current generations + timeBetweenOldestAndCurrent=$((currentTime-oldestTime)) + elapsedDays=$((timeBetweenOldestAndCurrent/60/60/24)) + generationsDiff=$((currentGen-oldestGen)) + + ## Figure out what we should do, based on generations and options + if [[ elapsedDays -le keepDays ]]; then + printf "All generations are no more than %s days older than current generation. \nOldest gen days difference from current gen: %s \n\n\tNothing to do!\n" "$keepDays" "$elapsedDays" + exit 4; + elif [[ generationsDiff -lt keepGens ]]; then + printf "Oldest generation (%d) is only %d generations behind current (%d). \n\n\t Nothing to do!\n" "$oldestGen" "$generationsDiff" "$currentGen" + exit 5; + else + printf "\tSomething to do...\n" + declare -a gens + for i in "''${nixGens[@]}"; do + IFS=' ' read -r -a iGenArr <<< "$i" + genNumber=''${iGenArr[0]} + genDiff=$((currentGen-genNumber)) + genDate=''${iGenArr[1]} + genTime=$(date -d "$genDate" +%s) + elapsedSecs=$((timeNow-genTime)) + genDaysOld=$((elapsedSecs/60/60/24)) + if [[ genDaysOld -gt keepDays ]] && [[ genDiff -ge keepGens ]]; then + gens["$genNumber"]="$genDate, $genDaysOld day(s) old" + fi + done + printf "\nFound the following generation(s) to delete:\n" + for K in "''${!gens[@]}"; do + printf "generation %d \t ''${gens[$K]}\n" "$K" + done + printf "\n" + choose "y" "Do you want to delete these? [Y/n]: " + fi + + ''; + }; +} diff --git a/modules/utilities/office.nix b/modules/utilities/office.nix new file mode 100644 index 0000000..0a21272 --- /dev/null +++ b/modules/utilities/office.nix @@ -0,0 +1,8 @@ +{ ... }: { + flake.nixosModules.office = {pkgs, ...}: { + environment.systemPackages = with pkgs; [ + libreoffice + birdtray + ]; + }; +} diff --git a/modules/utilities/ollama.nix b/modules/utilities/ollama.nix new file mode 100644 index 0000000..79b3f19 --- /dev/null +++ b/modules/utilities/ollama.nix @@ -0,0 +1,27 @@ +{ ... }: { + flake.nixosModules.ollama = {pkgs-unstable, ...}: { + services.ollama = { + enable = true; + package = pkgs-unstable.ollama-vulkan; + #port = 11434; + #host = "127.0.0.1:11434"; + # loadModels load them directly into ram at startup. Doesn't download them. + #loadModels = [ "mistral:7b" ]; # don't forget the :xxxxx for ex: "mixtral" don't work + #syncModels = true; + }; + systemd.services.ollama.serviceConfig.ExecStartPost = [ + # use this to auto download models + "${pkgs-unstable.ollama-vulkan}/bin/ollama pull mistral:7b" + ]; + /* + services.open-webui = { + enable = true; + port = 8080; + environment = { + OLLAMA_BASE_URL = "http://127.0.0.1:11434"; + WEBUI_AUTH = "True"; + }; + }; + */ + }; +} diff --git a/modules/utilities/otherUtils.nix b/modules/utilities/otherUtils.nix new file mode 100644 index 0000000..dd22c83 --- /dev/null +++ b/modules/utilities/otherUtils.nix @@ -0,0 +1,28 @@ +{ ... }: { + flake.nixosModules.otherUtils = # try to keep packages here at a minium. Preferably use a dedicated file + { + pkgs, + pkgs-unstable, + ... + }: { + environment.systemPackages = with pkgs; [ + gnome-calculator + snapshot + gnome-characters + #tree # shows dir in tree # we use eza now + brightnessctl # control brightness + powertop + fzf + bottom # Cross-platform graphical process/system monitor with a customizable interface + tomato-c # pomodoro timer + #hyprshot + mailcap + fuzzel + usbutils # used for lsusb + (pkgs.callPackage ../../modules/scripts/tomato.nix {}) + (pkgs.callPackage ../../modules/scripts/syllabes.nix {}) # python script to get number of syllabes in french + pkgs-unstable.bitwarden-desktop + fluffychat # matrix client + ]; + }; +}