commit 58a3f28118f2049ab38c89a66e605dbbcfaae738 Author: Frost-Phoenix <67cyril6767@gmail.com> Date: Sun Nov 5 11:40:44 2023 +0100 first commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..3e83a22 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Config test \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..5873d87 --- /dev/null +++ b/flake.lock @@ -0,0 +1,387 @@ +{ + "nodes": { + "alejandra": { + "inputs": { + "fenix": "fenix", + "flakeCompat": "flakeCompat", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1660510326, + "narHash": "sha256-xFumnivtVwu5fFBOrTxrv6fv3geHKF04RGP23EsDVaI=", + "owner": "kamadorueda", + "repo": "alejandra", + "rev": "ef03f7ef74ec97fd91a016a51c9c9667fb315652", + "type": "github" + }, + "original": { + "owner": "kamadorueda", + "ref": "3.0.0", + "repo": "alejandra", + "type": "github" + } + }, + "fenix": { + "inputs": { + "nixpkgs": [ + "alejandra", + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1657607339, + "narHash": "sha256-HaqoAwlbVVZH2n4P3jN2FFPMpVuhxDy1poNOR7kzODc=", + "owner": "nix-community", + "repo": "fenix", + "rev": "b814c83d9e6aa5a28d0cf356ecfdafb2505ad37d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1685662779, + "narHash": "sha256-cKDDciXGpMEjP1n6HlzKinN0H+oLmNpgeCTzYnsA2po=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "71fb97f0d875fd4de4994dfb849f2c75e17eb6c3", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flakeCompat": { + "flake": false, + "locked": { + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1687421788, + "narHash": "sha256-CgoHjiUBnru0bV4PE8z1R6ZD9KeWtuAaUkyYWYJmQUE=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "a4817894576f9cd01d784e60a0bfb143c81fc2be", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "hypr-contrib": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1687033460, + "narHash": "sha256-X93JvDR+SeXYylPq0pn+yM/GpTz31rN/ioY7Lsrv1OE=", + "owner": "hyprwm", + "repo": "contrib", + "rev": "93b6aba94c29388e1fe28908bc9b50e2ee841835", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "contrib", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "nixpkgs": [ + "nixpkgs" + ], + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1687375226, + "narHash": "sha256-y4l7tZELvVNmMZNdLmLdEZkApBWn1p7+MuGAxY0s47s=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "fc59cef1ee573a950c5d5f3bacf1b51142fd56db", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1684265364, + "narHash": "sha256-AxNnWbthsuNx73HDQr0eBxrcE3+yfl/WsaXZqUFmkpQ=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "8c279b9fb0f2b031427dc5ef4eab53f2ed835530", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "hyprpicker": { + "inputs": { + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1687346387, + "narHash": "sha256-1dQkKFdk4HYd8GzD1i2RlFWZHt/5IOf+qFLT//1mwkc=", + "owner": "hyprwm", + "repo": "hyprpicker", + "rev": "1d05cc3423cd8ecd0489a7229396c5011d158b2c", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprpicker", + "type": "github" + } + }, + "nix-gaming": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs_4" + }, + "locked": { + "lastModified": 1687396360, + "narHash": "sha256-KScLvg0PbrvlAZ6K4A8QUR6dh+VAuWHV2gA5zV682gQ=", + "owner": "fufexan", + "repo": "nix-gaming", + "rev": "abd9bc538faee423b66d929e5fbb39f76c37579d", + "type": "github" + }, + "original": { + "owner": "fufexan", + "repo": "nix-gaming", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1657425264, + "narHash": "sha256-3aHvoI2e8vJKw3hvnHECaBpSsL5mxVsVtaLCnTdNcH8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "de5b3dd17034e6106e75746e81618e5bd408de8a", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1685564631, + "narHash": "sha256-8ywr3AkblY4++3lIVxmrWZFzac7+f32ZEhH/A8pNscI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4f53efe34b3a8877ac923b9350c874e3dcd5dc0a", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1658161305, + "narHash": "sha256-X/nhnMCa1Wx4YapsspyAs6QYz6T/85FofrI6NpdPDHg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e4d49de45a3b5dbcb881656b4e3986e666141ea9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1683014792, + "narHash": "sha256-6Va9iVtmmsw4raBc3QKvQT2KT/NGRWlvUlJj46zN8B8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1a411f23ba299db155a5b45d5e145b85a7aafc42", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1686582075, + "narHash": "sha256-vtflsfKkHtF8IduxDNtbme4cojiqvlvjp5QNYhvoHXc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7e63eed145566cca98158613f3700515b4009ce3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1686960236, + "narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "04af42f3b31dba0ef742d254456dc4c14eedac86", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nur": { + "locked": { + "lastModified": 1687422705, + "narHash": "sha256-qO5Uesc0wNg60Zp3P1QXgLVFiC3cHCqd34dQSmU9OMw=", + "owner": "nix-community", + "repo": "NUR", + "rev": "2deeab84b27858c0c5537c41c243144829b55928", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NUR", + "type": "github" + } + }, + "root": { + "inputs": { + "alejandra": "alejandra", + "home-manager": "home-manager", + "hypr-contrib": "hypr-contrib", + "hyprland": "hyprland", + "hyprpicker": "hyprpicker", + "nix-gaming": "nix-gaming", + "nixpkgs": "nixpkgs_5", + "nur": "nur" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1657557289, + "narHash": "sha256-PRW+nUwuqNTRAEa83SfX+7g+g8nQ+2MMbasQ9nt6+UM=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "caf23f29144b371035b864a1017dbc32573ad56d", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "wlroots": { + "flake": false, + "locked": { + "host": "gitlab.freedesktop.org", + "lastModified": 1686753331, + "narHash": "sha256-KovjVFwcuoUO0eu/UiWrnD3+m/K+SHSAVIz4xF9K1XA=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "7e7633abf09b362d0bad9e3fc650fd692369291d", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "type": "gitlab" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1685385764, + "narHash": "sha256-r+XMyOoRXq+hlfjayb+fyi9kq2JK48TrwuNIAXqlj7U=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "4d9ff0c17716936e0b5ca577a39e263633901ed1", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..78b7e5d --- /dev/null +++ b/flake.nix @@ -0,0 +1,34 @@ +{ + description = "Fahim's nixos configuration"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nur.url = "github:nix-community/NUR"; + hypr-contrib.url = "github:hyprwm/contrib"; + hyprpicker.url = "github:hyprwm/hyprpicker"; + alejandra.url = "github:kamadorueda/alejandra/3.0.0"; + nix-gaming.url = "github:fufexan/nix-gaming"; + hyprland = { + url = "github:hyprwm/Hyprland"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + { nixpkgs + , self + , ... + } @ inputs: + let + selfPkgs = import ./pkgs; + in + { + overlays.default = selfPkgs.overlay; + nixosConfigurations = import ./modules/core/default.nix { + inherit self nixpkgs inputs; + }; + }; +} diff --git a/hosts/nixos/hardware-configuration.nix b/hosts/nixos/hardware-configuration.nix new file mode 100644 index 0000000..f743c34 --- /dev/null +++ b/hosts/nixos/hardware-configuration.nix @@ -0,0 +1,42 @@ +# 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, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/fbfe1772-e806-4c26-8b5d-586b711bbd39"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/6B0A-E6F3"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/3acb02a9-cb86-484f-bf54-730d743c8ecc"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s20f0u3.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true; + # networking.interfaces.enp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..79f4ff0 --- /dev/null +++ b/install.sh @@ -0,0 +1,7 @@ +cp /etc/nixos/hardware-configuration.nix hosts/nixos/hardware-configuration.nix +sleep 1 +mkdir -p ~/Pictures/wallpapers +sleep 1 +cp ./wallpaper/wallpaper.png ~/Pictures/wallpapers/ +sleep 1 +sudo nixos-rebuild switch --flake .#nixos \ No newline at end of file diff --git a/modules/core/bootloader.nix b/modules/core/bootloader.nix new file mode 100644 index 0000000..b6ce9d5 --- /dev/null +++ b/modules/core/bootloader.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: + +{ + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.kernelPackages = pkgs.linuxPackages_lqx; + boot.initrd.kernelModules = [ "amdgpu" ]; +} diff --git a/modules/core/cloudflare-warp.nix b/modules/core/cloudflare-warp.nix new file mode 100644 index 0000000..8ae2e50 --- /dev/null +++ b/modules/core/cloudflare-warp.nix @@ -0,0 +1,24 @@ +{ pkgs, ... }: { + systemd.packages = with pkgs; [ + (cloudflare-warp.overrideAttrs (old: { + src = pkgs.fetchurl { + url = "https://pkg.cloudflareclient.com/pool/jammy/main/c/cloudflare-warp/cloudflare-warp_2023.3.470-1_amd64.deb"; + sha256 = "sha256-AYnmisEQKFiEB2iRJifEqRbdzAyBcfrU0ITeUokKLag="; + }; + unpackPhase = null; + })) + ]; + + systemd.services."warp-svc".wantedBy = [ "multi-user.target" ]; + + environment.systemPackages = with pkgs;[ + (cloudflare-warp.overrideAttrs (old: { + src = pkgs.fetchurl { + url = "https://pkg.cloudflareclient.com/pool/jammy/main/c/cloudflare-warp/cloudflare-warp_2023.3.470-1_amd64.deb"; + sha256 = "sha256-AYnmisEQKFiEB2iRJifEqRbdzAyBcfrU0ITeUokKLag="; + }; + unpackPhase = null; + })) + + ]; +} diff --git a/modules/core/default.nix b/modules/core/default.nix new file mode 100644 index 0000000..6505a33 --- /dev/null +++ b/modules/core/default.nix @@ -0,0 +1,36 @@ +{ inputs +, nixpkgs +, self +, ... +}: +let + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + }; + lib = nixpkgs.lib; +in +{ + nixos = nixpkgs.lib.nixosSystem { + specialArgs = { inherit self inputs; }; + modules = + [ (import ./bootloader.nix) ] + ++ [ (import ./hardware.nix) ] + ++ [ (import ./xserver.nix) ] + ++ [ (import ./steam.nix) ] + ++ [ (import ./network.nix) ] + ++ [ (import ./pipewire.nix) ] + ++ [ (import ./program.nix) ] + ++ [ (import ./../home/package/python.nix) ] + ++ [ (import ./security.nix) ] + ++ [ (import ./services.nix) ] + ++ [ (import ./system.nix) ] + ++ [ (import ./user.nix) ] + ++ [ (import ./wayland.nix) ] + ++ [ (import ./cloudflare-warp.nix) ] + ++ [ (import ./virtualization.nix) ] + ++ [ (import ./../../hosts/nixos/hardware-configuration.nix) ] + ; + }; +} diff --git a/modules/core/hardware.nix b/modules/core/hardware.nix new file mode 100755 index 0000000..d84f12b --- /dev/null +++ b/modules/core/hardware.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: { + # hardware.video.hidpi.enable = true; + hardware.opengl.enable = true; + hardware.opengl.driSupport = true; + hardware.opengl.driSupport32Bit = true; + hardware.opengl.extraPackages = with pkgs; [ + amdvlk + ]; + powerManagement.cpuFreqGovernor = "performance"; +} diff --git a/modules/core/network.nix b/modules/core/network.nix new file mode 100755 index 0000000..9264aec --- /dev/null +++ b/modules/core/network.nix @@ -0,0 +1,7 @@ +{ ... }: { + networking = { + hostName = "nixos"; + networkmanager.enable = true; + nameservers = [ "1.1.1.1" ]; + }; +} diff --git a/modules/core/pipewire.nix b/modules/core/pipewire.nix new file mode 100755 index 0000000..3810f91 --- /dev/null +++ b/modules/core/pipewire.nix @@ -0,0 +1,11 @@ +{ ... }: { + sound.enable = true; + hardware.pulseaudio.enable = false; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + lowLatency.enable = true; + }; +} diff --git a/modules/core/program.nix b/modules/core/program.nix new file mode 100755 index 0000000..f3f54d5 --- /dev/null +++ b/modules/core/program.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: { + programs.dconf.enable = true; + programs.zsh.enable = true; + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + pinentryFlavor = "gtk2"; + }; +} diff --git a/modules/core/security.nix b/modules/core/security.nix new file mode 100644 index 0000000..92e6ff4 --- /dev/null +++ b/modules/core/security.nix @@ -0,0 +1,5 @@ +{ ... }: { + security.rtkit.enable = true; + security.sudo.enable = true; + security.pam.services.swaylock = { }; +} diff --git a/modules/core/services.nix b/modules/core/services.nix new file mode 100755 index 0000000..3d0259f --- /dev/null +++ b/modules/core/services.nix @@ -0,0 +1,7 @@ +{...}: { + services = { + gvfs.enable = true; + gnome.gnome-keyring.enable = true; + dbus.enable = true; + }; +} diff --git a/modules/core/steam.nix b/modules/core/steam.nix new file mode 100644 index 0000000..0aecd08 --- /dev/null +++ b/modules/core/steam.nix @@ -0,0 +1,13 @@ +{ pkgs, lib, ... }: { + programs.steam = { + enable = true; + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = false; + }; + programs.gamemode.enable = true; + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "steam" + "steam-original" + "steam-runtime" + ]; +} diff --git a/modules/core/system.nix b/modules/core/system.nix new file mode 100644 index 0000000..762fd55 --- /dev/null +++ b/modules/core/system.nix @@ -0,0 +1,37 @@ +{ self +, pkgs +, lib +, inputs +, ... +}: { + imports = [ inputs.nix-gaming.nixosModules.default ]; + nix = { + settings = { + auto-optimise-store = true; + experimental-features = [ "nix-command" "flakes" ]; + substituters = [ "https://nix-gaming.cachix.org" ]; + trusted-public-keys = [ "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" ]; + }; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + }; + nixpkgs = { + overlays = [ + self.overlays.default + inputs.nur.overlay + ]; + }; + + environment.systemPackages = with pkgs; [ + wget + git + ]; + + time.timeZone = "Europe/Paris"; + i18n.defaultLocale = "en_US.UTF-8"; + nixpkgs.config.allowUnfree = true; + system.stateVersion = "23.05"; +} diff --git a/modules/core/user.nix b/modules/core/user.nix new file mode 100644 index 0000000..2001797 --- /dev/null +++ b/modules/core/user.nix @@ -0,0 +1,38 @@ +{ pkgs +, inputs +, ... +}: +let + name = "FrostPhoenix"; + username = "frostphoenix"; + #email = "t@gmail.com"; + initialPassword = "dreamX"; + packages = with pkgs; [ + fish + ]; +in +{ + imports = [ inputs.home-manager.nixosModules.home-manager ]; + home-manager = { + useUserPackages = true; + useGlobalPkgs = true; + extraSpecialArgs = { inherit inputs; }; + users.${username} = { + imports = [ (import ./../home) ]; + home.username = username; + home.homeDirectory = "/home/${username}"; + home.stateVersion = "22.11"; + programs.home-manager.enable = true; + }; + }; + + users.users.${username} = { + isNormalUser = true; + initialPassword = initialPassword; + description = name; + extraGroups = [ "networkmanager" "wheel" ]; + shell = pkgs.zsh; + }; + users.users.root.initialPassword = initialPassword; + nix.settings.allowed-users = [ "frostphoenix" ]; +} diff --git a/modules/core/virtualization.nix b/modules/core/virtualization.nix new file mode 100644 index 0000000..2fdf6b7 --- /dev/null +++ b/modules/core/virtualization.nix @@ -0,0 +1,33 @@ +{ config, pkgs, ... }: + +{ + # Add user to libvirtd group + users.users.frostphoenix.extraGroups = [ "libvirtd" ]; + + # Install necessary packages + environment.systemPackages = with pkgs; [ + virt-manager + virt-viewer + spice + spice-gtk + spice-protocol + win-virtio + win-spice + gnome.adwaita-icon-theme + virtiofsd + ]; + + # Manage the virtualisation services + virtualisation = { + libvirtd = { + enable = true; + qemu = { + swtpm.enable = true; + ovmf.enable = true; + ovmf.packages = [ pkgs.OVMFFull.fd ]; + }; + }; + spiceUSBRedirection.enable = true; + }; + services.spice-vdagentd.enable = true; +} diff --git a/modules/core/wayland.nix b/modules/core/wayland.nix new file mode 100644 index 0000000..811443b --- /dev/null +++ b/modules/core/wayland.nix @@ -0,0 +1,12 @@ +{ inputs, pkgs, ... }: +{ + programs.hyprland.enable = true; + xdg.portal = { + enable = true; + wlr.enable = true; + extraPortals = [ + pkgs.xdg-desktop-portal-hyprland + # pkgs.xdg-desktop-portal-gtk + ]; + }; +} diff --git a/modules/core/xserver.nix b/modules/core/xserver.nix new file mode 100644 index 0000000..2cd18bc --- /dev/null +++ b/modules/core/xserver.nix @@ -0,0 +1,17 @@ +{ pkgs, ... }: { + services.xserver = { + enable = true; + layout = "us"; + videoDrivers = [ "amdgpu" ]; + displayManager.autoLogin = { + enable = true; + user = "frostphoenix"; + }; + libinput = { + enable = true; + mouse = { + accelProfile = "flat"; + }; + }; + }; +} diff --git a/modules/home/chromium/default.nix b/modules/home/chromium/default.nix new file mode 100644 index 0000000..9c4a59c --- /dev/null +++ b/modules/home/chromium/default.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + programs.chromium = { + enable = true; + }; +} diff --git a/modules/home/default.nix b/modules/home/default.nix new file mode 100644 index 0000000..ec1251d --- /dev/null +++ b/modules/home/default.nix @@ -0,0 +1,23 @@ +{ inputs, ... }: { + imports = + [ (import ./waybar) ] + ++ [ (import ./firefox) ] + # ++ [ (import ./vscode) ] + ++ [ (import ./chromium) ] + ++ [ (import ./hyprland) ] + ++ [ (import ./gaming) ] + ++ [ (import ./git) ] + ++ [ (import ./foot) ] + ++ [ (import ./swaylock) ] + ++ [ (import ./wofi) ] + ++ [ (import ./zsh) ] + ++ [ (import ./gtk) ] + ++ [ (import ./mako) ] + ++ [ (import ./scripts) ] + ++ [ (import ./neofetch) ] + ++ [ (import ./starship) ] + ++ [ (import ./wlogout) ] + ++ [ (import ./nvim) ] + ++ [ (import ./package) ]; + +} diff --git a/modules/home/firefox/default.nix b/modules/home/firefox/default.nix new file mode 100755 index 0000000..2198f04 --- /dev/null +++ b/modules/home/firefox/default.nix @@ -0,0 +1,75 @@ +{ config, pkgs, theme, inputs, ... }: + +{ + programs.firefox = + let + userChrome = pkgs.substituteAll { + src = ./userChrome.css; + }; + in + { + enable = true; + package = pkgs.wrapFirefox pkgs.firefox-unwrapped { + extraPolicies = { + CaptivePortal = false; + DisableFirefoxStudies = true; + DisablePocket = true; + DisableTelemetry = true; + DisableFirefoxAccounts = true; + NoDefaultBookmarks = true; + OfferToSaveLogins = false; + OfferToSaveLoginsDefault = false; + PasswordManagerEnabled = false; + FirefoxHome = { + Search = false; + Pocket = false; + Snippets = false; + TopSites = false; + Highlights = false; + }; + UserMessaging = { + ExtensionRecommendations = false; + SkipOnboarding = true; + }; + }; + }; + profiles = { + default = { + id = 0; + name = "fahim"; + search = { + force = true; + default = "Google"; + engines = { + "NixOS Search" = { + urls = [{ template = "https://search.nixos.org/packages?channel=23.05&from=0&size=50&sort=relevance&type=packages&query={searchTerms}"; }]; + iconUpdateURL = "https://nixos.wiki/favicon.png"; + updateInterval = 24 * 60 * 60 * 1000; + definedAliases = [ "@ns" ]; + }; + "Wikipedia (en)".metaData.alias = "@wiki"; + "Amazon.com".metaData.hidden = true; + "Bing".metaData.hidden = true; + "eBay".metaData.hidden = true; + }; + }; + settings = { + "general.smoothScroll" = true; + "browser.toolbars.bookmarks.visibility" = "never"; + "privacy.webrtc.legacyGlobalIndicator" = false; + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + "browser.compactmode.show" = true; + }; + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + ublock-origin + # duckduckgo-privacy-essentials + languagetool + news-feed-eradicator + tabliss + videospeed + ]; + userChrome = builtins.readFile userChrome; + }; + }; + }; +} diff --git a/modules/home/firefox/userChrome.css b/modules/home/firefox/userChrome.css new file mode 100755 index 0000000..181dcb3 --- /dev/null +++ b/modules/home/firefox/userChrome.css @@ -0,0 +1,478 @@ +#identity-box.extensionPage #identity-icon-label { + display: none !important; +} + +* { + border-radius: 2px !important; +} +#webrtcIndicator { + display: none !important; +} +#identity-box.extensionPage + #identity-icon[tooltiptext="Loaded by extension: Tabliss"] + ~ #identity-icon-label { + display: none !important; +} + +#identity-icon-box { + background: none !important; +} + +#identity-box.extensionPage + #identity-icon[tooltiptext="Loaded by extension: Tabliss"], +#urlbar[pageproxystate="invalid"] #identity-box #identity-icon, +#tracking-protection-icon-container[hidden] + ~ #identity-box[pageproxystate="valid"].notSecure:not(.chromeUI, .localResource) + #identity-icon { + fill-opacity: var(--urlbar-icon-fill-opacity) !important; + list-style-image: url(chrome://userchrome/content/engines/google.svg) !important; +} + +#identity-box.extensionPage + #identity-icon[tooltiptext="Loaded by extension: Tabliss"], +#urlbar[pageproxystate="invalid"] #identity-box #identity-icon, +#tracking-protection-icon-container[hidden] + ~ #identity-box[pageproxystate="valid"].notSecure:not(.chromeUI, .localResource) + #identity-icon { + display: none !important; +} + +/*==============================================================================================* + +-----+-----+-----+-----+-----+-----+-----+ + | █▀▀ | ▄▀█ | █▀▀ | █▀▀ | ▄▀█ | █▀▄ | █▀▀ | + | █▄▄ | █▀█ | ▄▄█ | █▄▄ | █▀█ | █▄▀ | ██▄ | + +-----+-----+-----+-----+-----+-----+-----+ + Description: Minimalist, Simple, Keyboard Centered and based on SimpleFox. 🦊 + What you get is a really simple responsive one-line layout using the new Proton UI. + > SimpleFox: https://github.com/migueravila/SimpleFox + + Author: Andreas Grafen + (https://andreas.grafen.info) + + Repository: https://github.com/andreasgrafen/ag.proton + Thank you Nick, Abdallah and Benyamin for all the great suggestions for improvements! ♡ + Nick: https://github.com/nicksundermeyer) + Abdallah: https://github.com/HeiWiper) + Benyamin: https://github.com/benyaminl) + If you're looking for a **mouse-friendly** clone please check out Waterfall. + https://github.com/crambaud/waterfall +*==============================================================================================*/ + +/*---+---+---+---+---+---+ + | C | O | N | F | I | G | + +---+---+---+---+---+---*/ + +/* Feel free to tweak the following + * config settingsto your own liking. */ + +:root { + /*---+---+---+---+---+---+---+ + | C | O | L | O | U | R | S | + +---+---+---+---+---+---+---*/ + + /* Comment this block out if you want to keep the default theme colour. */ + /* This will also work with custom colours from color.firefox.com. */ + + /* Theme Colour Suggestions + * Dark Light */ + --window-colour: #1F1F1F; /* #FAFAFC; */ + + --secondary-colour: #595959; /* #EAEAEC; */ + --inverted-colour: #cdd6f4; /* #1E2021; */ + --blue: #89dceb; + + /* Containter Tab Colours */ + --uc-identity-color-blue: #89b4fa; + --uc-identity-color-teal: #94e2d5; + --uc-identity-color-green: #a6e3a1; + --uc-identity-color-yellow: #f9e2af; + --uc-identity-color-orange: #fab387; + --uc-identity-color-red: #f38ba8; + --uc-identity-color-pink: #f5c2e7; + --uc-identity-color-purple: #b4befe; + + /* URL colour in URL bar suggestions */ + --urlbar-popup-url-color: var(--uc-identity-color-purple) !important; + + /*---+---+---+---+---+---+---+ + | V | I | S | U | A | L | S | + +---+---+---+---+---+---+---*/ + + /* global border radius */ + --uc-border-radius: 4px; + + /* dynamic url bar width settings */ + --uc-urlbar-width: clamp(200px, 40vw, 500px); + + /* dynamic tab width settings */ + --uc-active-tab-width: clamp(100px, 20vw, 300px); + --uc-inactive-tab-width: clamp(50px, 15vw, 200px); + + /* if active always shows the tab close button */ + --show-tab-close-button: none; /* DEFAULT: -moz-inline-box; */ + + /* if active only shows the tab close button on hover*/ + --show-tab-close-button-hover: none; /* DEFAULT: -moz-inline-box; */ + + /* adds left and right margin to the container-tabs indicator */ + --container-tabs-indicator-margin: 10px; +} + +/*---+---+---+---+---+---+---+ + | B | U | T | T | O | N | S | + +---+---+---+---+---+---+---*/ + +#back-button, +#forward-button { + display: none !important; +} + +/* bookmark icon */ +#star-button { + display: none !important; +} + +/* zoom indicator */ +#urlbar-zoom-button { + display: none !important; +} + +/* Make button small as Possible, hidden out of sight */ +#PanelUI-button { + margin-top: -5px; + margin-bottom: 44px; +} + +#PanelUI-menu-button { + padding: 0px !important; + max-height: 1px; + + list-style-image: none !important; +} + +#PanelUI-menu-button .toolbarbutton-icon { + width: 1px !important; + +} +#PanelUI-menu-button .toolbarbutton-badge-stack { + padding: 0px !important; +} + +#reader-mode-button { + display: none !important; +} + +/* tracking protection shield icon */ +#tracking-protection-icon-container { + display: none !important; +} + +/* #identity-box { display: none !important } /* hides encryption AND permission items */ +#identity-permission-box { + display: none !important; +} /* only hodes permission items */ + +/* e.g. playing indicator (secondary - not icon) */ +.tab-secondary-label { + display: none !important; +} + +#pageActionButton { + display: none !important; +} +#page-action-buttons { + display: none !important; +} + +#urlbar-go-button { + display: none !important; +} + +/*=============================================================================================*/ + +/*---+---+---+---+---+---+ + | L | A | Y | O | U | T | + +---+---+---+---+---+---*/ + +/* No need to change anything below this comment. + * Just tweak it if you want to tweak the overall layout. c: */ + +:root { + --uc-theme-colour: var(--window-colour, var(--toolbar-bgcolor)); + --uc-hover-colour: var(--secondary-colour, rgba(0, 0, 0, 0.2)); + --uc-inverted-colour: var(--inverted-colour, var(--toolbar-color)); + --cg-blue-colour: var(--uc-identity-color-blue); + --button-bgcolor: var(--uc-theme-colour) !important; + --button-hover-bgcolor: var(--uc-hover-colour) !important; + --button-active-bgcolor: var(--uc-hover-colour) !important; + + --toolbarbutton-border-radius: var(--uc-border-radius) !important; + + --tab-border-radius: var(--uc-border-radius) !important; + --lwt-text-color: var(--uc-inverted-colour) !important; + --lwt-tab-text: var(--uc-inverted-colour) !important; + --arrowpanel-border-radius: var(--uc-border-radius) !important; + + --tab-block-margin: 2px !important; +} + +window, +#main-window, +#toolbar-menubar, +#TabsToolbar, +#PersonalToolbar, +#navigator-toolbox, +#sidebar-box, +#nav-bar { + -moz-appearance: none !important; + + border: none !important; + box-shadow: none !important; + background: var(--uc-theme-colour) !important; +} + +/* grey out ccons inside the toolbar to make it + * more aligned with the Black & White colour look */ +#PersonalToolbar toolbarbutton:not(:hover), +#bookmarks-toolbar-button:not(:hover) { + filter: grayscale(1) !important; +} + +/* remove window control buttons */ +.titlebar-buttonbox-container { + display: none !important; +} + +/* remove "padding" left and right from tabs */ +.titlebar-spacer { + display: none !important; +} + +/* remove gap after pinned tabs */ +#tabbrowser-tabs[haspinnedtabs]:not([positionpinnedtabs]) + > #tabbrowser-arrowscrollbox + > .tabbrowser-tab[first-visible-unpinned-tab] { + margin-inline-start: 0 !important; +} + +/* remove tab shadow */ +.tabbrowser-tab > .tab-stack > .tab-background { + box-shadow: none !important; +} + +/* tab background */ +.tabbrowser-tab > .tab-stack > .tab-background { + background: var(--uc-theme-colour) !important; +} + +/* active tab background */ +.tabbrowser-tab[selected] > .tab-stack > .tab-background { + background: var(--uc-hover-colour) !important; +} + +/* multi tab selection */ +#tabbrowser-tabs:not([noshadowfortests]) + .tabbrowser-tab:is([visuallyselected="true"], [multiselected]) + > .tab-stack + > .tab-background:-moz-lwtheme { + background: var(--uc-hover-colour) !important; +} + +/* tab close button options */ +.tabbrowser-tab:not([pinned]) .tab-close-button { + display: var(--show-tab-close-button) !important; +} +.tabbrowser-tab:not([pinned]):hover .tab-close-button { + display: var(--show-tab-close-button-hover) !important; +} + +/* adaptive tab width */ +.tabbrowser-tab[selected][fadein]:not([pinned]) { + max-width: var(--uc-active-tab-width) !important; +} +.tabbrowser-tab[fadein]:not([selected]):not([pinned]) { + max-width: var(--uc-inactive-tab-width) !important; +} + +/* container tabs indicator */ +.tabbrowser-tab[usercontextid] + > .tab-stack + > .tab-background + > .tab-context-line { + margin: -1px var(--container-tabs-indicator-margin) 0 + var(--container-tabs-indicator-margin) !important; + + border-radius: var(--tab-border-radius) !important; +} + +/* show favicon when media is playing but tab is hovered */ +.tab-icon-image:not([pinned]) { + opacity: 1 !important; +} + +/* Makes the speaker icon to always appear if the tab is playing (not only on hover) */ +.tab-icon-overlay:not([crashed]), +.tab-icon-overlay[pinned][crashed][selected] { + top: 5px !important; + z-index: 1 !important; + + padding: 1.5px !important; + inset-inline-end: -8px !important; + width: 16px !important; + height: 16px !important; + + border-radius: 10px !important; +} + +/* style and position speaker icon */ +.tab-icon-overlay:not([sharing], [crashed]):is([soundplaying], [muted], [activemedia-blocked]) { + stroke: transparent !important; + background: transparent !important; + opacity: 1 !important; + fill-opacity: 0.8 !important; + + color: currentColor !important; + + stroke: var(--uc-theme-colour) !important; + background-color: var(--uc-theme-colour) !important; +} + +/* change the colours of the speaker icon on active tab to match tab colours */ +.tabbrowser-tab[selected] + .tab-icon-overlay:not([sharing], [crashed]):is([soundplaying], [muted], [activemedia-blocked]) { + stroke: var(--uc-hover-colour) !important; + background-color: var(--uc-hover-colour) !important; +} + +.tab-icon-overlay:not([pinned], [sharing], [crashed]):is([soundplaying], [muted], [activemedia-blocked]) { + margin-inline-end: 9.5px !important; +} + +.tabbrowser-tab:not([image]) + .tab-icon-overlay:not([pinned], [sharing], [crashed]) { + top: 0 !important; + + padding: 0 !important; + margin-inline-end: 5.5px !important; + inset-inline-end: 0 !important; +} + +.tab-icon-overlay:not([crashed])[soundplaying]:hover, +.tab-icon-overlay:not([crashed])[muted]:hover, +.tab-icon-overlay:not([crashed])[activemedia-blocked]:hover { + color: currentColor !important; + stroke: var(--uc-inverted-colour) !important; + background-color: var(--uc-inverted-colour) !important; + fill-opacity: 0.95 !important; +} + +.tabbrowser-tab[selected] .tab-icon-overlay:not([crashed])[soundplaying]:hover, +.tabbrowser-tab[selected] .tab-icon-overlay:not([crashed])[muted]:hover, +.tabbrowser-tab[selected] + .tab-icon-overlay:not([crashed])[activemedia-blocked]:hover { + color: currentColor !important; + stroke: var(--uc-inverted-colour) !important; + background-color: var(--uc-inverted-colour) !important; + fill-opacity: 0.95 !important; +} + +/* speaker icon colour fix */ +#TabsToolbar .tab-icon-overlay:not([crashed])[soundplaying], +#TabsToolbar .tab-icon-overlay:not([crashed])[muted], +#TabsToolbar .tab-icon-overlay:not([crashed])[activemedia-blocked] { + color: var(--uc-inverted-colour) !important; +} + +/* speaker icon colour fix on hover */ +#TabsToolbar .tab-icon-overlay:not([crashed])[soundplaying]:hover, +#TabsToolbar .tab-icon-overlay:not([crashed])[muted]:hover, +#TabsToolbar .tab-icon-overlay:not([crashed])[activemedia-blocked]:hover { + color: var(--uc-theme-colour) !important; +} + +#nav-bar { + border: none !important; + box-shadow: none !important; + background: transparent !important; +} + +/* remove border below whole nav */ +#navigator-toolbox { + border-bottom: none !important; +} + +#urlbar, +#urlbar * { + outline: none !important; + box-shadow: none !important; +} + +#urlbar-background { + border: var(--uc-hover-colour) !important; +} + +#urlbar[focused="true"] > #urlbar-background, +#urlbar:not([open]) > #urlbar-background { + margin-top: 0; + background: transparent !important; +} + +#urlbar[open] > #urlbar-background { + background: var(--uc-theme-colour) !important; +} + +.urlbarView-row:hover > .urlbarView-row-inner, +.urlbarView-row[selected] > .urlbarView-row-inner { + background: var(--urlbar-popup-url-color) !important; + color: var(--window-colour) !important; +} + +/* transition to oneline */ +@media (min-width: 1000px) { + /* move tabs bar over */ + #TabsToolbar { + margin-left: var(--uc-urlbar-width) !important; + /* margin-top: 0px !important; */ + } + + /* move entire nav bar */ + #nav-bar { + margin: calc((var(--urlbar-min-height) * -1) - 8px) + calc(100vw - var(--uc-urlbar-width)) 0 0 !important; + margin-top: -40px !important; + } +} /* end media query */ + +/* Container Tabs */ +.identity-color-blue { + --identity-tab-color: var(--uc-identity-color-blue) !important; + --identity-icon-color: var(--uc-identity-color-blue) !important; +} +.identity-color-teal { + --identity-tab-color: var(--uc-identity-color-teal) !important; + --identity-icon-color: var(--uc-identity-color-teal) !important; +} +.identity-color-green { + --identity-tab-color: var(--uc-identity-color-green) !important; + --identity-icon-color: var(--uc-identity-color-green) !important; +} +.identity-color-yellow { + --identity-tab-color: var(--uc-identity-color-yellow) !important; + --identity-icon-color: var(--uc-identity-color-yellow) !important; +} +.identity-color-orange { + --identity-tab-color: var(--uc-identity-color-orange) !important; + --identity-icon-color: var(--uc-identity-color-orange) !important; +} +.identity-color-red { + --identity-tab-color: var(--uc-identity-color-red) !important; + --identity-icon-color: var(--uc-identity-color-red) !important; +} +.identity-color-pink { + --identity-tab-color: var(--uc-identity-color-pink) !important; + --identity-icon-color: var(--uc-identity-color-pink) !important; +} +.identity-color-purple { + --identity-tab-color: var(--uc-identity-color-purple) !important; + --identity-icon-color: var(--uc-identity-color-purple) !important; +} diff --git a/modules/home/foot/default.nix b/modules/home/foot/default.nix new file mode 100644 index 0000000..e63ab16 --- /dev/null +++ b/modules/home/foot/default.nix @@ -0,0 +1,6 @@ +{...}: { + programs.foot = { + enable = true; + }; + xdg.configFile."foot/foot.ini".source = ./foot.ini; +} diff --git a/modules/home/foot/foot.ini b/modules/home/foot/foot.ini new file mode 100644 index 0000000..940c82d --- /dev/null +++ b/modules/home/foot/foot.ini @@ -0,0 +1,41 @@ + +[main] +# Police +font=JetBrainsMono nerd font:size=11 + +[url] +osc8-underline=always + +[cursor] +style=block +blink=yes + +[mouse] +hide-when-typing=yes + +[key-bindings] +scrollback-up-page=Control+Shift+Page_Up +scrollback-down-page=Control+Shift+Page_Down +scrollback-up-line=Control+Shift+Up +scrollback-down-line=Control+Shift+Down + + +[colors] +foreground=B9B9B9 # Text +background=1F1F1F # Base +regular0=45475a # Surface 1 +regular1=f38ba8 # red +regular2=a6e3a1 # green +regular3=f9e2af # yellow +regular4=89b4fa # blue +regular5=f5c2e7 # pink +regular6=94e2d5 # teal +regular7=bac2de # Subtext 1 +bright0=585b70 # Surface 2 +bright1=f38ba8 # red +bright2=a6e3a1 # green +bright3=f9e2af # yellow +bright4=89b4fa # blue +bright5=f5c2e7 # pink +bright6=94e2d5 # teal +bright7=a6adc8 # Subtext 0 diff --git a/modules/home/gaming/default.nix b/modules/home/gaming/default.nix new file mode 100644 index 0000000..654210b --- /dev/null +++ b/modules/home/gaming/default.nix @@ -0,0 +1,36 @@ +{ pkgs, config, inputs, ... }: { + home.packages = with pkgs;[ + gamemode + gamescope + winetricks + inputs.nix-gaming.packages.${pkgs.system}.proton-ge + inputs.nix-gaming.packages.${pkgs.system}.wine-ge + ]; + # inputs.nix-gaming.packages.${pkgs.system}.faf-client + # inputs.nix-gaming.packages.${pkgs.system}.osu-lazer-bin + # ] ++ (inputs.nix-gaming.lib.legendaryBuilder pkgs + # { + # games = { + # rocket-league = { + # desktopName = "Rocket League"; + # tricks = [ "dxvk" "win10" ]; + # icon = builtins.fetchurl { + # url = "https://user-images.githubusercontent.com/36706276/203341314-eaaa0659-9b79-4f40-8b4a-9bc1f2b17e45.png"; + # name = "rocket-league.png"; + # sha256 = "0a9ayr3vwsmljy7dpf8wgichsbj4i4wrmd8awv2hffab82fz4ykb"; + # }; + # discordIntegration = false; + # gamemodeIntegration = true; + # preCommands = '' + # echo "the game will start!" + # ''; + # postCommands = '' + # echo "the game has stopped!" + # ''; + # }; + # }; + # opts = { + # wine = inputs.nix-gaming.packages.${pkgs.system}.wine-ge; + # }; + # }); +} diff --git a/modules/home/git/default.nix b/modules/home/git/default.nix new file mode 100644 index 0000000..0a7b5dd --- /dev/null +++ b/modules/home/git/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: { + programs.git.enable = true; + programs.git.userName = "Frost-Phoenix"; + programs.git.userEmail = "67cyril6767@gmail.com"; + home.packages = [ pkgs.gh ]; +} diff --git a/modules/home/gtk/default.nix b/modules/home/gtk/default.nix new file mode 100755 index 0000000..1660b48 --- /dev/null +++ b/modules/home/gtk/default.nix @@ -0,0 +1,42 @@ +{ pkgs, ... }: +let + matrix-gtk = pkgs.fetchFromGitHub { + owner = "samiulbasirfahim"; + repo = "Matrix-gtk"; + rev = "9ff060e016e5cd4830aafb6299142c3d8922944e"; + sha256 = "K7tEtB0WGKyjND+pZKUd4pktBlCV3v27pvqaxMILpFU="; + }; +in +{ + fonts.fontconfig.enable = true; + home.packages = [ + pkgs.twemoji-color-font + pkgs.noto-fonts + pkgs.noto-fonts-cjk + pkgs.noto-fonts-emoji + (pkgs.nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) + ]; + xdg.dataFile."themes/matrix-gtk".source = matrix-gtk; + gtk = { + enable = true; + font = { + name = "JetBrainsMono Nerd Font"; + size = 10; + }; + iconTheme = { + package = pkgs.papirus-icon-theme; + name = "Papirus-Dark"; + }; + theme = { + name = "matrix-gtk"; + }; + cursorTheme = { + name = "Catppuccin-Frappe-Dark"; + }; + }; + home.pointerCursor = { + package = pkgs.catppuccin-cursors; + name = "Catppuccin-Frappe-Red"; + size = 15; + }; +} diff --git a/modules/home/hyprland/config.nix b/modules/home/hyprland/config.nix new file mode 100644 index 0000000..544c24d --- /dev/null +++ b/modules/home/hyprland/config.nix @@ -0,0 +1,205 @@ +{ ... }: +let + color = (import ../../variables/colors.nix); + window_manager = (import ../../variables/window_manager.nix); +in +{ + wayland.windowManager.hyprland = { + extraConfig = " + $mainMod = SUPER + monitor = ,highrr,auto,1 + monitor = ,highres,auto,1 + + + input { + kb_layout = us + numlock_by_default = true + follow_mouse = 1 + sensitivity = 0 + } + + + misc { + disable_autoreload = true + disable_hyprland_logo = true + always_follow_on_dnd = true + layers_hog_keyboard_focus = true + animate_manual_resizes = false + enable_swallow = true + swallow_regex = + focus_on_activate = true + } + + + general { + gaps_in = 6 + gaps_out = 10 + border_size = 2 + col.active_border = rgba(595959ff) + col.inactive_border = rgba(00140e10) + apply_sens_to_raw = 1 + } + + + dwindle { + no_gaps_when_only = false + force_split = 0 + special_scale_factor = 0.8 + split_width_multiplier = 1.0 + use_active_for_splits = true + pseudotile = yes + preserve_split = yes + } + + + master { + new_is_master = true + special_scale_factor = 1 + no_gaps_when_only = false + } + + + decoration { + rounding = 0 + multisample_edges = true + blur_new_optimizations = 1 + active_opacity = 0.8500; + inactive_opacity = 0.76; + blur = 1 + blur_size = 2 + blur_passes = 2 + drop_shadow = 0 + } + + + animations { + enabled=1 + bezier = overshot, 0.13, 0.99, 0.29, 1.1 + animation = windows, 1, 4, overshot, slide + animation = windowsOut, 1, 5, default, popin 80% + animation = border, 1, 5, default + animation = fade, 1, 8, default + animation = workspaces, 1, 6, overshot, slidevert + } + + + # ---------------------------------------------------------------- + # keybindings + bind = $mainMod, Return, exec, foot + bind = $mainMod SHIFT, Return, exec, foot --fullscreen + bind = $mainMod, Q, killactive, + bind = $mainMod, T, killactive, + bind = $mainMod, F, fullscreen, + bind = $mainMod, Space, togglefloating, + bind = $mainMod, Z, exec, pkill wofi || wofi --show drun + bind = $mainMod, X, exec, pkill wlogout || wlogout -b 4 + bind = $mainMod, C, exec, hyprctl dispatch centerwindow none + bind = SUPER, V, exec, cliphist list | wofi -dmenu | cliphist decode | wl-copy + bind = $mainMod, P, pseudo, + bind = $mainMod, Y, pin, + bind = $mainMod, J, togglesplit, + bind = $mainMod, E, exec, thunar + bind = $mainMod, B, exec, pkill -SIGUSR1 .waybar-wrapped + bind = $mainMod SHIFT, c ,exec, hyprpicker -a + bind = $mainMod, G,exec, $HOME/.local/bin/toggle_layout + bind = $mainMod, W,exec, pkill wofi || wallpaper-picker + bind = $mainMod, O,exec, toggle-opacity + bind = $mainMod, A,exec, toggle-animation + bind = $mainMod, D,exec, toggle-blur + # screenshot + bind = ,Print, exec, grimblast --notify --cursor save area ~/Pictures/$(date ' + %Y-%m-%d ' T '%H:%M:%S ').png + bind = $mainMod, Print, exec, grimblast --notify --cursor copy area + # switch focus + bind = $mainMod, left, movefocus, l + bind = $mainMod, right, movefocus, r + bind = $mainMod, up, movefocus, u + bind = $mainMod, down, movefocus, d + # switch workspace + bind = $mainMod, 1, workspace, 1 + bind = $mainMod, 2, workspace, 2 + bind = $mainMod, 3, workspace, 3 + bind = $mainMod, 4, workspace, 4 + bind = $mainMod, 5, workspace, 5 + bind = $mainMod, 6, workspace, 6 + bind = $mainMod, 7, workspace, 7 + bind = $mainMod, 8, workspace, 8 + bind = $mainMod, 9, workspace, 9 + bind = $mainMod, 0, workspace, 10 + # same as above, but switch to the workspace + bind = $mainMod SHIFT, 1, movetoworkspace, 1 + bind = $mainMod SHIFT, 2, movetoworkspace, 2 + bind = $mainMod SHIFT, 3, movetoworkspace, 3 + bind = $mainMod SHIFT, 4, movetoworkspace, 4 + bind = $mainMod SHIFT, 5, movetoworkspace, 5 + bind = $mainMod SHIFT, 6, movetoworkspace, 6 + bind = $mainMod SHIFT, 7, movetoworkspace, 7 + bind = $mainMod SHIFT, 8, movetoworkspace, 8 + bind = $mainMod SHIFT, 9, movetoworkspace, 9 + bind = $mainMod SHIFT, 0, movetoworkspace, 10 + bind = $mainMod CTRL, c, movetoworkspace, empty + # window control + bind = SUPER SHIFT, left, movewindow, l + bind = SUPER SHIFT, right, movewindow, r + bind = SUPER SHIFT, up, movewindow, u + bind = SUPER SHIFT, down, movewindow, d + bind = SUPER CTRL, left, resizeactive, -80 0 + bind = SUPER CTRL, right, resizeactive, 80 0 + bind = SUPER CTRL, up, resizeactive, 0 -80 + bind = SUPER CTRL, down, resizeactive, 0 80 + bind = SUPER ALT, left, moveactive, -80 0 + bind = SUPER ALT, right, moveactive, 80 0 + bind = SUPER ALT, up, moveactive, 0 -80 + bind = SUPER ALT, down, moveactive, 0 80 + # media and volume controls + bind = ,XF86AudioRaiseVolume,exec, pamixer -i 5 + bind = ,XF86AudioLowerVolume,exec, pamixer -d 5 + bind = ,XF86AudioMute,exec, pamixer -t + bind = ,XF86AudioPlay,exec, playerctl play-pause + bind = ,XF86AudioNext,exec, playerctl next + bind = ,XF86AudioPrev,exec, playerctl previous + bind = , XF86AudioStop, exec, playerctl stop + bind = $mainMod, mouse_down, workspace, e-1 + bind = $mainMod, mouse_up, workspace, e+1 + # mouse binding + bindm = $mainMod, mouse:272, movewindow + bindm = $mainMod, mouse:273, resizewindow + # windowrule + windowrule = float,wlogout + windowrule = float,wofi + windowrule = noanim,wlogout + windowrule = noanim,wofi + windowrule = pin,wofi + windowrule = noborder,wofi + windowrule = tile, neovide + windowrule = idleinhibit focus,mpv + windowrule = float,udiskie + windowrule = float,title:^(Transmission)$ + windowrule = float,title:^(Volume Control)$ + windowrule = float,title:^(Firefox — Sharing Indicator)$ + windowrule = move 0 0,title:^(Firefox — Sharing Indicator)$ + windowrule = size 700 450,title:^(Volume Control)$ + windowrule = move 40 55%,title:^(Volume Control)$ + windowrulev2 = float, title:^(Picture-in-Picture)$ + windowrulev2 = opacity 1.0 override 1.0 override, title:^(Picture-in-Picture)$ + windowrulev2 = pin, title:^(Picture-in-Picture)$ + windowrule = float,imv + windowrule = move 510 290,imv + windowrule = size 900 500,imv + windowrule = float,mpv + windowrule = move 510 290,mpv + windowrule = size 900 500,mpv + windowrulev2 = idleinhibit focus, class:^(mpv)$ + windowrulev2 = idleinhibit fullscreen, class:^(firefox)$ + + + # autostart + exec-once = hyprctl setcursor Catppuccin-Frappe-Dark 16 + exec-once = systemctl --user import-environment & + exec-once = hash dbus-update-activation-environment 2>/dev/null & + exec-once = dbus-update-activation-environment --systemd & + exec-once = swww init && swaylock && notify-send 'Hey $USER, Welcome back' && load-env + exec-once = wl-paste --type text --watch cliphist store && wl-paste --type image --watch cliphist store && mako & + exec-once = waybar & + "; + }; +} diff --git a/modules/home/hyprland/default.nix b/modules/home/hyprland/default.nix new file mode 100755 index 0000000..6bdbd21 --- /dev/null +++ b/modules/home/hyprland/default.nix @@ -0,0 +1,6 @@ +{ inputs, ... }: { + imports = [ (import ./hyprland.nix) ] + ++ [ (import ./config.nix) ] + ++ [ (import ./variables.nix) ] + ++ [ inputs.hyprland.homeManagerModules.default ]; +} diff --git a/modules/home/hyprland/hyprland.nix b/modules/home/hyprland/hyprland.nix new file mode 100644 index 0000000..24cd30f --- /dev/null +++ b/modules/home/hyprland/hyprland.nix @@ -0,0 +1,31 @@ +{ inputs +, pkgs +, ... +}: { + home.packages = with pkgs; [ + swww + inputs.hypr-contrib.packages.${pkgs.system}.grimblast + hyprpicker + wofi + rofi-wayland + wlogout + grim + slurp + wl-clipboard + cliphist + wf-recorder + glib + wayland + direnv + ]; + systemd.user.targets.hyprland-session.Unit.Wants = [ "xdg-desktop-autostart.target" ]; + wayland.windowManager.hyprland = { + enable = true; + xwayland = { + enable = true; + hidpi = true; + }; + nvidiaPatches = false; + systemdIntegration = true; + }; +} diff --git a/modules/home/hyprland/variables.nix b/modules/home/hyprland/variables.nix new file mode 100755 index 0000000..41d1dbd --- /dev/null +++ b/modules/home/hyprland/variables.nix @@ -0,0 +1,29 @@ +{ ... }: + +{ + home.sessionVariables = { + NIXOS_OZONE_WL = "1"; + __GL_GSYNC_ALLOWED = "0"; + __GL_VRR_ALLOWED = "0"; + _JAVA_AWT_WM_NONEREPARENTING = "1"; + SSH_AUTH_SOCK = "/run/user/1000/keyring/ssh"; + DISABLE_QT5_COMPAT = "0"; + GDK_BACKEND = "wayland"; + ANKI_WAYLAND = "1"; + DIRENV_LOG_FORMAT = ""; + WLR_DRM_NO_ATOMIC = "1"; + QT_AUTO_SCREEN_SCALE_FACTOR = "1"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + QT_QPA_PLATFORM = "xcb"; + QT_QPA_PLATFORMTHEME = "qt5ct"; + QT_STYLE_OVERRIDE = "kvantum"; + MOZ_ENABLE_WAYLAND = "1"; + WLR_BACKEND = "vulkan"; + WLR_RENDERER = "vulkan"; + WLR_NO_HARDWARE_CURSORS = "1"; + XDG_SESSION_TYPE = "wayland"; + SDL_VIDEODRIVER = "wayland"; + CLUTTER_BACKEND = "wayland"; + GTK_THEME = "matrix-gtk"; + }; +} diff --git a/modules/home/mako/default.nix b/modules/home/mako/default.nix new file mode 100755 index 0000000..5fa2788 --- /dev/null +++ b/modules/home/mako/default.nix @@ -0,0 +1,25 @@ +{ + config, + pkgs, + ... +}: { + services = { + mako = { + enable = true; + font = "JetBrainsMono Nerd Font 11"; + padding = "20"; + defaultTimeout = 5000; + borderSize = 2; + borderRadius = 0; + backgroundColor = "#1F1F1F"; + borderColor = "#595959"; + progressColor = "over #313244"; + textColor = "#cdd6f4"; + extraConfig = '' + text-alignment=center + [urgency=high] + border-color=#B45C65 + ''; + }; + }; +} diff --git a/modules/home/neofetch/config/config.conf b/modules/home/neofetch/config/config.conf new file mode 100644 index 0000000..82830c2 --- /dev/null +++ b/modules/home/neofetch/config/config.conf @@ -0,0 +1,79 @@ +print_info() +{ + info title + info underline + info " " distro + info " " kernel + info " " packages + info " " de + info " " memory + info " " uptime + info cols +} +title_fqdn="off" +kernel_shorthand="on" +distro_shorthand="on" +os_arch="off" +uptime_shorthand="tiny" +memory_percent="on" +memory_unit="mib" +package_managers="off" +shell_path="off" +shell_version="on" +speed_type="bios_limit" +speed_shorthand="on" +cpu_brand="on" +cpu_speed="on" +cpu_cores="logical" +cpu_temp="C" +gpu_brand="on" +gpu_type="all" +refresh_rate="on" +gtk_shorthand="on" +gtk2="on" +gtk3="on" +public_ip_host="" +public_ip_timeout=2 +de_version="on" +disk_show=('/') +disk_subtitle="mount" +disk_percent="on" +music_player="auto" +song_format="%artist% - %album% - %title%" +song_shorthand="on" +mpc_args=(-p 7777) +colors=(1 1 1 1 1 1) +# colors=(231) +bold="on" +underline_enabled="on" +underline_char="━" +separator="⋮" +block_range=(0 7) +color_blocks="off" +block_width=3 +block_height=1 +col_offset="auto" +bar_char_elapsed="-" +bar_char_total="=" +bar_border="on" +bar_length=15 +bar_color_elapsed="distro" +bar_color_total="distro" +cpu_display="off" +memory_display="off" +battery_display="off" +disk_display="off" +image_backend="ueberzug" +image_source="$HOME/.config/neofetch/logo.png" +ascii_distro="auto" +ascii_colors=(distro) +ascii_bold="on" +image_loop="off" +crop_mode="normal" +crop_offset="center" +image_size="208px" +gap=2 +yoffset=0 +xoffset=0 +background_color= +stdout="off" diff --git a/modules/home/neofetch/config/logo.png b/modules/home/neofetch/config/logo.png new file mode 100644 index 0000000..2785416 Binary files /dev/null and b/modules/home/neofetch/config/logo.png differ diff --git a/modules/home/neofetch/default.nix b/modules/home/neofetch/default.nix new file mode 100644 index 0000000..19928b7 --- /dev/null +++ b/modules/home/neofetch/default.nix @@ -0,0 +1,9 @@ +{ + config, + lib, + pkgs, + ... +}: { + home.packages = [pkgs.neofetch]; + # xdg.configFile."neofetch".source = ./config; +} diff --git a/modules/home/nvim/default.nix b/modules/home/nvim/default.nix new file mode 100644 index 0000000..f5473d4 --- /dev/null +++ b/modules/home/nvim/default.nix @@ -0,0 +1,13 @@ +{ pkgs, ... }: +let + neovim-config = pkgs.fetchFromGitHub { + owner = "samiulbasirfahim"; + repo = "neovim"; + rev = "a3344302921b59ecb24c167c9dc64bc8df4803da"; + sha256 = "9RVtU+bx8pBSYd66PU0F+e1FlRWbju035RQ2p7DZLGk="; + }; +in +{ + xdg.configFile."nvim".source = neovim-config; + programs.neovim.enable = true; +} diff --git a/modules/home/package/default.nix b/modules/home/package/default.nix new file mode 100755 index 0000000..1868411 --- /dev/null +++ b/modules/home/package/default.nix @@ -0,0 +1,50 @@ +{ inputs +, pkgs +, ... +}: { + home.packages = + let + php = pkgs.php.buildEnv { extraConfig = "memory_limit = 2G"; }; + in + (with pkgs; + [ + # programming + python39 + nodejs + nodePackages.nodemon + yarn + nix-prefetch-github + typescript + rnix-lsp + ripgrep + rustup + php + vscode + + # others + openssl + libnotify + pamixer + xfce.thunar + pavucontrol + wget + unzip + gparted + mpv + playerctl + qalculate-gtk + bleachbit + imv + htop + xdg-utils + fzf + ffmpeg + bore-cli + discord + exa + inputs.alejandra.defaultPackage.${system} + ] + ++ [ + + ]); +} diff --git a/modules/home/package/python.nix b/modules/home/package/python.nix new file mode 100644 index 0000000..566e8dd --- /dev/null +++ b/modules/home/package/python.nix @@ -0,0 +1,12 @@ +{pkgs, ...}: let + my-python-packages = ps: + with ps; [ + pandas + + requests + ]; +in { + environment.systemPackages = [ + (pkgs.python3.withPackages my-python-packages) + ]; +} diff --git a/modules/home/scripts/ani-cli b/modules/home/scripts/ani-cli new file mode 100644 index 0000000..cc18054 --- /dev/null +++ b/modules/home/scripts/ani-cli @@ -0,0 +1,413 @@ +#!/bin/sh + +version_number="4.2.1" + +# UI + +external_menu() { + rofi "$1" -sort -dmenu -i -width 1500 -p "$2" +} + +launcher() { + [ "$use_external_menu" = "0" ] && [ -z "$1" ] && set -- "+m" "$2" + [ "$use_external_menu" = "0" ] && fzf "$1" --reverse --prompt "$2" + [ "$use_external_menu" = "1" ] && external_menu "$1" "$2" +} + +nth() { + stdin=$(cat -) + [ -z "$stdin" ] && return 1 + line_count="$(printf "%s\n" "$stdin" | wc -l | tr -d "[:space:]")" + [ "$line_count" -eq 1 ] && printf "%s" "$stdin" | cut -f2,3 && return 0 + prompt="$1" + multi_flag="" + [ $# -ne 1 ] && shift && multi_flag="$1" + line=$(printf "%s" "$stdin" | cut -f1,3 | tr '\t' ' ' | launcher "$multi_flag" "$prompt" | cut -d " " -f 1) + [ -n "$line" ] && printf "%s" "$stdin" | grep -E '^'"${line}"'($|\s)' | cut -f2,3 || exit 1 +} + +die() { + printf "\33[2K\r\033[1;31m%s\033[0m\n" "$*" >&2 + exit 1 +} + +help_info() { + printf " + Usage: + %s [options] [query] + %s [query] [options] + %s [options] [query] [options] + + Options: + -c, --continue + Continue watching from history + -d, --download + Download the video instead of playing it + -D, --delete + Delete history + -s, --syncplay + Use Syncplay to watch with friends + -S, --select-nth + Select nth entry + -q, --quality + Specify the video quality + -v, --vlc + Use VLC to play the video + -V, --version + Show the version of the script + -h, --help + Show this help message and exit + -e, --episode, -r, --range + Specify the number of episodes to watch + --dub + play dubbed version + -U, --update + Update the script + Some example usages: + %s -q 720p banana fish + %s -d -e 2 cyberpunk edgerunners + %s --vlc cyberpunk edgerunners -q 1080p -e 4 + %s blue lock -e 5-6 + %s -e \"5 6\" blue lock + \n" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}" + exit 0 +} + +version_info() { + printf "%s\n" "$version_number" + exit 0 +} + +update_script() { + update="$(curl -s -A "$agent" "https://raw.githubusercontent.com/pystardust/ani-cli/master/ani-cli")" || die "Connection error" + update="$(printf '%s\n' "$update" | diff -u "$0" -)" + if [ -z "$update" ]; then + printf "Script is up to date :)\n" + else + if printf '%s\n' "$update" | patch "$0" -; then + printf "Script has been updated\n" + else + die "Can't update for some reason!" + fi + fi + exit 0 +} + +# checks if dependencies are present +dep_ch() { + for dep; do + command -v "$dep" >/dev/null || die "Program \"$dep\" not found. Please install it." + done +} + +# SCRAPING + +# extract the video links from reponse of embed urls, extract mp4 links form m3u8 lists +get_links() { + episode_link="$(curl -e "https://${allanime_base}" -s --cipher "AES256-SHA256" "https://allanimenews.com/apivtwo/clock.json?id=$*" -A "$agent" | sed 's|},{|\n|g' | sed -nE 's|.*link":"([^"]*)".*"resolutionStr":"([^"]*)".*|\2 >\1|p;s|.*hls","url":"([^"]*)".*"hardsub_lang":"en-US".*|\1|p')" + case "$episode_link" in + *crunchyroll*) + curl -e "https://${allanime_base}" -s --cipher "AES256-SHA256" "$episode_link" -A "$agent" | sed 's|^#.*x||g; s|,.*|p|g; /^#/d; $!N; s|\n| >|' | sort -nr + ;; + *repackager.wixmp.com*) + extract_link=$(printf "%s" "$episode_link" | cut -d'>' -f2 | sed 's|repackager.wixmp.com/||g;s|\.urlset.*||g') + for j in $(printf "%s" "$episode_link" | sed -nE 's|.*/,([^/]*),/mp4.*|\1|p' | sed 's|,|\n|g'); do + printf "%s >%s\n" "$j" "$extract_link" | sed "s|,[^/]*|${j}|g" + done | sort -nr + ;; + *//cache.* | *gofcdn.com*) + if printf "%s" "$episode_link" | head -1 | grep -q "original.m3u"; then + printf "%s" "$episode_link" + else + extract_link=$(printf "%s" "$episode_link" | head -1 | cut -d'>' -f2) + relative_link=$(printf "%s" "$extract_link" | sed 's|[^/]*$||') + curl -e "https://${allanime_base}/" -s --cipher "AES256-SHA256" "$extract_link" -A "$agent" | sed 's|^#.*x||g; s|,.*|p|g; /^#/d; $!N; s|\n| >|' | sed "s|>|>${relative_link}|g" | sort -nr + fi + ;; + *) [ -n "$episode_link" ] && printf "%s\n" "$episode_link" ;; + esac + printf "Fetching %s Links\n" "$provider_name" 1>&2 +} + +# innitialises provider_name and provider_id. First argument is the provider name, 2nd is the regex that matches that provider's link +provider_init() { + provider_name=$1 + provider_id=$(printf "%s" "$resp" | sed -n "$2" | head -1 | cut -d':' -f2) +} + +# generates links based on given provider +generate_link() { + case $1 in + 1) provider_init 'wixmp' '/Default :/p' ;; # wixmp(default)(m3u8)(multi) -> (mp4)(multi) + 2) provider_init 'pstatic' '/Default B :/p' ;; # pstatic(default backup)(mp4)(multi) + 3) provider_init 'vrv' '/Ac :/p' ;; # vrv(crunchyroll)(m3u8)(multi) + 4) provider_init 'sharepoint' '/S-mp4 :/p' ;; # sharepoint(mp4)(single) + 5) provider_init 'usercloud' '/Uv-mp4 :/p' ;; # usercloud(mp4)(single) + *) provider_init 'gogoanime' '/Luf-mp4 :/p' ;; # gogoanime(m3u8)(multi) + esac + [ -n "$provider_id" ] && get_links "$provider_id" +} + +select_quality() { + case "$1" in + best) result=$(printf "%s" "$links" | head -n1) ;; + worst) result=$(printf "%s" "$links" | grep -E '^[0-9]{3,4}' | tail -n1) ;; + *) result=$(printf "%s" "$links" | grep -m 1 "$1") ;; + esac + [ -z "$result" ] && printf "Specified quality not found, defaulting to best\n" 1>&2 && result=$(printf "%s" "$links" | head -n1) + printf "%s" "$result" | cut -d'>' -f2 +} + +# gets embed urls, collects direct links into provider files, selects one with desired quality into $episode +get_episode_url() { + # get the embed urls of the selected episode + episode_embed_gql="query (\$showId: String!, \$translationType: VaildTranslationTypeEnumType!, \$episodeString: String!) { episode( showId: \$showId translationType: \$translationType episodeString: \$episodeString ) { episodeString sourceUrls }}" + + resp=$(curl -e "https://${allanime_base}" -s --cipher "AES256-SHA256" -G "https://api.${allanime_base}/allanimeapi" --data-urlencode "variables={\"showId\":\"$id\",\"translationType\":\"$mode\",\"episodeString\":\"$ep_no\"}" --data-urlencode "query=$episode_embed_gql" -A "$agent" | tr '{}' '\n' | sed 's|\\u002F|\/|g;s|\\||g' | sed -nE 's|.*sourceUrl":".*clock\?id=([^"]*)".*sourceName":"([^"]*)".*|\2 :\1|p') + # generate links into sequential files + provider=1 + i=0 + while [ "$i" -lt 6 ]; do + generate_link "$provider" >"$cache_dir"/"$i" & + provider=$((provider % 6 + 1)) + : $((i += 1)) + done + wait + # select the link with matching quality + links=$(cat "$cache_dir"/* | sed 's|^Mp4-||g' | sort -g -r -s) + episode=$(select_quality "$quality") + [ -z "$episode" ] && die "Episode not released!" +} + +# search the query and give results +search_anime() { + search_gql="query( \$search: SearchInput \$limit: Int \$page: Int \$translationType: VaildTranslationTypeEnumType \$countryOrigin: VaildCountryOriginEnumType ) { shows( search: \$search limit: \$limit page: \$page translationType: \$translationType countryOrigin: \$countryOrigin ) { edges { _id name availableEpisodes __typename } }}" + + curl -e "https://${allanime_base}" -s --cipher "AES256-SHA256" -G "https://api.${allanime_base}/allanimeapi" --data-urlencode "variables={\"search\":{\"allowAdult\":false,\"allowUnknown\":false,\"query\":\"$1\"},\"limit\":40,\"page\":1,\"translationType\":\"$mode\",\"countryOrigin\":\"ALL\"}" --data-urlencode "query=$search_gql" -A "$agent" | sed 's|Show|\n|g' | sed -nE "s|.*_id\":\"([^\"]*)\",\"name\":\"([^\"]*)\".*${mode}\":([1-9][^,]*).*|\1\t\2 (\3 episodes)|p" +} + +# get the episodes list of the selected anime +episodes_list() { + episodes_list_gql="query (\$showId: String!) { show( _id: \$showId ) { _id availableEpisodesDetail }}" + + curl -e "https://${allanime_base}" -s --cipher AES256-SHA256 -G "https://api.${allanime_base}/allanimeapi" --data-urlencode "variables={\"showId\":\"$*\"}" --data-urlencode "query=$episodes_list_gql" -A "$agent" | sed -nE "s|.*$mode\":\[([0-9.\",]*)\].*|\1|p" | sed 's|,|\n|g; s|"||g' | sort -n -k 1 +} + +# PLAYING + +process_hist_entry() { + ep_list=$(episodes_list "$id") + ep_no=$(printf "%s" "$ep_list" | sed -n "/^${ep_no}$/{n;p;}") 2>/dev/null + [ -n "$ep_no" ] && printf "%s\t%s - episode %s\n" "$id" "$title" "$ep_no" +} + +update_history() { + if grep -q -- "$id" "$histfile"; then + sed -E "s/^[^\t]+\t${id}\t/${ep_no}\t${id}\t/" "$histfile" >"${histfile}.new" + else + cp "$histfile" "${histfile}.new" + printf "%s\t%s\t%s\n" "$ep_no" "$id" "$title" >>"${histfile}.new" + fi + mv "${histfile}.new" "$histfile" +} + +download() { + case $1 in + *m3u8*) ffmpeg -loglevel error -stats -i "$1" -c copy "$download_dir/$2.mp4" ;; + *) aria2c --check-certificate=false --continue --summary-interval=0 -x 16 -s 16 "$1" --dir="$download_dir" -o "$2.mp4" --download-result=hide ;; + esac +} + +play_episode() { + [ -z "$episode" ] && get_episode_url + case "$player_function" in + debug) printf "All links:\n%s\nSelected link:\n%s\n" "$links" "$episode" ;; + mpv*) nohup "$player_function" --force-media-title="${allanime_title}episode-${ep_no}-${mode}" "$episode" >/dev/null 2>&1 & ;; + android_mpv) nohup am start --user 0 -a android.intent.action.VIEW -d "$episode" -n is.xyz.mpv/.MPVActivity >/dev/null 2>&1 & ;; + android_vlc) nohup am start --user 0 -a android.intent.action.VIEW -d "$episode" -n org.videolan.vlc/org.videolan.vlc.gui.video.VideoPlayerActivity -e "title" "${allanime_title}episode-${ep_no}-${mode}" >/dev/null 2>&1 & ;; + iina) nohup "$player_function" --no-stdin --keep-running --mpv-force-media-title="${allanime_title}episode-${ep_no}-${mode}" "$episode" >/dev/null 2>&1 & ;; + flatpak_mpv) flatpak run io.mpv.Mpv --force-media-title="${allanime_title}episode-${ep_no}-${mode}" "$episode" >/dev/null 2>&1 & ;; + vlc*) nohup "$player_function" --play-and-exit --meta-title="${allanime_title}episode-${ep_no}-${mode}" "$episode" >/dev/null 2>&1 & ;; + *yncpla*) nohup "$player_function" "$episode" -- --force-media-title="${allanime_title}episode-${ep_no}-${mode}" >/dev/null 2>&1 & ;; + download) "$player_function" "$episode" "${allanime_title}episode-${ep_no}-${mode}" ;; + catt) nohup catt cast "$episode" >/dev/null 2>&1 & ;; + *) nohup "$player_function" "$episode" >/dev/null 2>&1 & ;; + esac + replay="$episode" + unset episode + update_history + wait +} + +play() { + start=$(printf "%s" "$ep_no" | grep -Eo '^(-1|[0-9]+(\.[0-9]+)?)') + end=$(printf "%s" "$ep_no" | grep -Eo '(-1|[0-9]+(\.[0-9]+)?)$') + [ "$start" = "-1" ] && ep_no=$(printf "%s" "$ep_list" | tail -n1) && unset start + [ -z "$end" ] || [ "$end" = "$start" ] && unset start end + [ "$end" = "-1" ] && end=$(printf "%s" "$ep_list" | tail -n1) + line_count=$(printf "%s\n" "$ep_no" | wc -l | tr -d "[:space:]") + if [ "$line_count" != 1 ] || [ -n "$start" ]; then + [ -z "$start" ] && start=$(printf "%s\n" "$ep_no" | head -n1) + [ -z "$end" ] && end=$(printf "%s\n" "$ep_no" | tail -n1) + range=$(printf "%s\n" "$ep_list" | sed -nE "/^${start}\$/,/^${end}\$/p") + [ -z "$range" ] && die "Invalid range!" + for i in $range; do + tput clear + ep_no=$i + printf "\33[2K\r\033[1;34mPlaying episode %s...\033[0m\n" "$ep_no" + play_episode + done + else + play_episode + fi +} + +# MAIN + +# setup +agent="Mozilla/5.0 (Windows NT 6.1; Win64; rv:109.0) Gecko/20100101 Firefox/109.0" +allanime_base="allanime.to" +mode="${ANI_CLI_MODE:-sub}" +download_dir="${ANI_CLI_DOWNLOAD_DIR:-.}" +quality="${ANI_CLI_QUALITY:-best}" +case "$(uname -a)" in +*Darwin*) player_function="${ANI_CLI_PLAYER:-iina}" ;; # mac OS +*ndroid*) player_function="${ANI_CLI_PLAYER:-android_mpv}" ;; # Android OS (termux) +*steamdeck*) player_function="${ANI_CLI_PLAYER:-flatpak_mpv}" ;; # steamdeck OS +*MINGW*) player_function="${ANI_CLI_PLAYER:-mpv.exe}" ;; # Windows OS +*) player_function="${ANI_CLI_PLAYER:-mpv}" ;; # Linux OS +esac + +use_external_menu="${ANI_CLI_EXTERNAL_MENU:-0}" +[ -t 0 ] || use_external_menu=1 +[ "$use_external_menu" = "0" ] && multi_selection_flag="${ANI_CLI_MULTI_SELECTION:-"-m"}" +[ "$use_external_menu" = "1" ] && multi_selection_flag="${ANI_CLI_MULTI_SELECTION:-"-multi-select"}" +cache_dir="${ANI_CLI_CACHE_DIR:-${XDG_CACHE_HOME:-$HOME/.cache}/ani-cli}" +[ ! -d "$cache_dir" ] && mkdir -p "$cache_dir" +hist_dir="${ANI_CLI_HIST_DIR:-${XDG_STATE_HOME:-$HOME/.local/state}/ani-cli}" +[ ! -d "$hist_dir" ] && mkdir -p "$hist_dir" +histfile="$hist_dir/ani-hsts" +[ ! -f "$histfile" ] && : >"$histfile" +search="${ANI_CLI_DEFAULT_SOURCE:-scrape}" + +while [ $# -gt 0 ]; do + case "$1" in + -v | --vlc) + case "$(uname -a)" in + *ndroid*) player_function="android_vlc" ;; + MINGW*) player_function="vlc.exe" ;; + *) player_function="vlc" ;; + esac + ;; + -s | --syncplay) + case "$(uname -s)" in + Darwin*) player_function="/Applications/Syncplay.app/Contents/MacOS/syncplay" ;; + MINGW* | *Msys) player_function="/c/Program Files (x86)/Syncplay/Syncplay.exe" ;; + *) player_function="syncplay" ;; + esac + ;; + -q | --quality) + [ $# -lt 2 ] && die "missing argument!" + quality="$2" + shift + ;; + -S | --select-nth) + [ $# -lt 2 ] && die "missing argument!" + index="$2" + shift + ;; + -c | --continue) search=history ;; + -d | --download) player_function=download ;; + -D | --delete) + : >"$histfile" + exit 0 + ;; + -V | --version) version_info ;; + -h | --help) help_info ;; + -e | --episode | -r | --range) + [ $# -lt 2 ] && die "missing argument!" + ep_no="$2" + shift + ;; + --dub) mode="dub" ;; + -U | --update) update_script ;; + *) query="$(printf "%s" "$query $1" | sed "s|^ ||;s| |+|g")" ;; + esac + shift +done +printf "\33[2K\r\033[1;34mChecking dependencies...\033[0m\n" +dep_ch "curl" "sed" "grep" "fzf" || true +case "$player_function" in +debug) ;; +download) dep_ch "ffmpeg" "aria2c" ;; +flatpak*) + dep_ch "flatpak" + flatpak info io.mpv.Mpv >/dev/null 2>&1 || die "Program \"mpv (flatpak)\" not found. Please install it." + ;; +android*) printf "Checking of players on Android is disabled\n" ;; +*) dep_ch "$player_function" ;; +esac + +# searching +case "$search" in +history) + anime_list=$(while read -r ep_no id title; do process_hist_entry & done <"$histfile") + wait + [ -z "$anime_list" ] && die "No unwatched series in history!" + result=$(printf "%s" "$anime_list" | nl -w 1 | nth "Select anime: " | cut -f1) + [ -z "$result" ] && exit 1 + result=$(grep "$result" "$histfile") + read -r ep_no id title <<-EOF + $result + EOF + ep_list=$(episodes_list "$id") + ep_no=$(printf "%s" "$ep_list" | sed -n "/^${ep_no}$/{n;p;}") 2>/dev/null + allanime_title="$(printf "%s" "$title" | cut -d'(' -f1 | tr -d '[:punct:]' | tr 'A-Z ' 'a-z-')" + tput cuu1 && tput el + ;; +*) + while [ -z "$query" ]; do + if [ "$use_external_menu" = "0" ]; then + printf "Search anime: " && read -r query + else + query=$(: | external_menu "" "Search anime: ") + fi + done + query=$(printf "%s" "$query" | sed "s| |+|g") + anime_list=$(search_anime "$query") + [ -z "$anime_list" ] && die "No results found!" + [ "$index" -eq "$index" ] 2>/dev/null && result=$(printf "%s" "$anime_list" | sed -n "${index}p") + [ -z "$index" ] && result=$(printf "%s" "$anime_list" | nl -w 1 | nth "Select anime: ") + [ -z "$result" ] && exit 1 + title=$(printf "%s" "$result" | cut -f2) + allanime_title="$(printf "%s" "$title" | cut -d'(' -f1 | tr -d '[:punct:]' | tr 'A-Z ' 'a-z-')" + id=$(printf "%s" "$result" | cut -f1) + ep_list=$(episodes_list "$id") + [ -z "$ep_no" ] && ep_no=$(printf "%s" "$ep_list" | nth "Select episode: " "$multi_selection_flag") + [ -z "$ep_no" ] && exit 1 + ;; +esac + +# moves the cursor up one line and clears that line +tput cuu1 && tput el + +# playback & loop +play +[ "$player_function" = "download" ] || [ "$player_function" = "debug" ] && exit 0 + +while cmd=$(printf "next\nreplay\nprevious\nselect\nchange_quality\nquit" | nth "Playing episode $ep_no of $title... "); do + case "$cmd" in + next) ep_no=$(printf "%s" "$ep_list" | sed -n "/^${ep_no}$/{n;p;}") 2>/dev/null ;; + replay) episode="$replay" ;; + previous) ep_no=$(printf "%s" "$ep_list" | sed -n "/^${ep_no}$/{g;1!p;};h") 2>/dev/null ;; + select) ep_no=$(printf "%s" "$ep_list" | nth "Select episode: " "$multi_selection_flag") ;; + change_quality) + episode=$(printf "%s" "$links" | sed -n '/^\([0-9]*p\)/p' | launcher) + quality=$(printf "%s" "$episode" | grep -oE "^[0-9]+") + episode=$(printf "%s" "$episode" | cut -d'>' -f2) + ;; + *) exit 0 ;; + esac + [ -z "$ep_no" ] && die "Out of range" + play +done \ No newline at end of file diff --git a/modules/home/scripts/default.nix b/modules/home/scripts/default.nix new file mode 100644 index 0000000..4dc229d --- /dev/null +++ b/modules/home/scripts/default.nix @@ -0,0 +1,85 @@ +{pkgs, ...}: let + wall-change = pkgs.writeShellScriptBin "wall-change" '' + swww img $1 --transition-type random --transition-pos "$(hyprctl cursorpos)" --transition-duration 3 + ''; + load-env = pkgs.writeShellScriptBin "load-env" '' + bash ~/.local/bin/env/animation + bash ~/.local/bin/env/layout + bash ~/.local/bin/env/opacity + bash ~/.local/bin/env/blur + bash ~/.local/bin/env/wallpaper + ''; + toggle-animation = pkgs.writeShellScriptBin "toggle-animation" '' + blur_val=$(hyprctl getoption animations:enabled | grep int) + echo "$blur_val" + if [[ "$blur_val" == " int: 1" ]]; then + rm -rf ~/.local/bin/env/animation + echo "hyprctl --batch 'keyword animations:enabled 0'" > ~/.local/bin/env/animation + hyprctl --batch "keyword animations:enabled 0" + else + rm -rf ~/.local/bin/env/animation + echo "hyprctl --batch 'keyword animations:enabled 1'" > ~/.local/bin/env/animation + hyprctl --batch "keyword animations:enabled 1" + fi + ''; + push = pkgs.writeShellScriptBin "push" '' + git_directory=$PWD/.git + if [[ -d $git_directory ]];then + git add . + read -p "Enter commit name: " commit_name + git commit -m "$commit_name" + git push + else + echo "Git wasn't initialized here." + fi + ''; + toggle-blur = pkgs.writeShellScriptBin "toggle-blur" '' + blur_val=$(hyprctl getoption decoration:blur | grep int) + echo "$blur_val" + if [[ "$blur_val" == " int: 1" ]]; then + rm -rf ~/.local/bin/env/blur + echo "hyprctl --batch 'keyword decoration:blur 0'" > ~/.local/bin/env/blur + hyprctl --batch "keyword decoration:blur 0" + else + rm -rf ~/.local/bin/env/blur + echo "hyprctl --batch 'keyword decoration:blur 1'" > ~/.local/bin/env/blur + hyprctl --batch "keyword decoration:blur 1" + fi + ''; + toggle-opacity = pkgs.writeShellScriptBin "toggle-opacity" '' + opacity_val=$(hyprctl getoption decoration:active_opacity | grep float) + echo "$opacity_val" + if [[ "$opacity_val" == " float: 0.850000" ]]; then + rm -rf ~/.local/bin/env/opacity + echo "hyprctl --batch 'keyword decoration:active_opacity 1.0 ; keyword decoration:inactive_opacity 1.0 ; keyword decoration:fullscreen_opacity 1.0'" > ~/.local/bin/env/opacity + hyprctl --batch "keyword decoration:active_opacity 1.0 ; keyword decoration:inactive_opacity 1.0 ; keyword decoration:fullscreen_opacity 1.0" + else + rm -rf ~/.local/bin/env/opacity + echo "hyprctl --batch 'keyword decoration:active_opacity 0.8500 ; keyword decoration:inactive_opacity 0.76 ; keyword decoration:fullscreen_opacity 1.0'" > ~/.local/bin/env/opacity + hyprctl --batch "keyword decoration:active_opacity 0.8500 ; keyword decoration:inactive_opacity 0.76 ; keyword decoration:fullscreen_opacity 1.0" + fi + ''; + wallpaper-picker = pkgs.writeShellScriptBin "wallpaper-picker" '' + wallpaper_folder=$HOME/Pictures/wallpapers + wallpaper_location="$(ls $wallpaper_folder | wofi -n --show dmenu)" + if [[ -d $wallpaper_folder/$wallpaper_location ]]; then + wallpaper_temp="$wallpaper_location" + elif [[ -f $wallpaper_folder/$wallpaper_location ]]; then + wall-change $wallpaper_folder/$wallpaper_temp/$wallpaper_location + else + exit 1 + fi + ''; +in { + home.file.".local/bin/toggle_layout".source = ./toggle_layout; + home.file.".local/bin/anime".source = ./ani-cli; + home.packages = with pkgs; [ + wall-change + wallpaper-picker + load-env + toggle-animation + toggle-blur + toggle-opacity + push + ]; +} diff --git a/modules/home/scripts/toggle_layout b/modules/home/scripts/toggle_layout new file mode 100755 index 0000000..6159878 --- /dev/null +++ b/modules/home/scripts/toggle_layout @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +current_layout=$(hyprctl getoption general:layout) + +for word in $current_layout +do + temp="${word%\"}" + temp="${temp#\"}" + if [ $temp == "dwindle" ]; then + rm -rf ~/.local/bin/env/layout + echo "hyprctl --batch 'keyword general:layout master;'" > ~/.local/bin/env/layout + hyprctl --batch "keyword general:layout master;" + fi + if [ $temp == "master" ]; then + rm -rf ~/.local/bin/env/layout + echo "hyprctl --batch 'keyword general:layout dwindle;'" > ~/.local/bin/env/layout + hyprctl --batch "keyword general:layout dwindle;" + fi +done diff --git a/modules/home/starship/default.nix b/modules/home/starship/default.nix new file mode 100755 index 0000000..09d5492 --- /dev/null +++ b/modules/home/starship/default.nix @@ -0,0 +1,41 @@ +{lib, ...}: { + programs.starship = { + enable = true; + settings = { + add_newline = false; + character = { + success_symbol = "[󰊠 ](bold #cba6f7)[󰊠 ](bold #f2cdcd)[󰊠 ](bold #b4befe)[ ](bold #a6e3a1)"; + error_symbol = "[󰊠 ](bold #cba6f7)[󰊠 ](bold #f2cdcd)[󰊠 ](bold #b4befe)[ ](bold #f38ba8)"; + vimcmd_symbol = "[ NORMAL](bold #fab387)"; + vimcmd_visual_symbol = "[ VISUAL](bold #89dceb)"; + }; + format = lib.strings.concatStrings [ + "$nix_shell" + "$os" + "$directory" + "$container" + "$git_branch $git_status" + "$python" + "$nodejs" + "$lua" + "$rust" + "$java" + "$c" + "$golang" + "$cmd_duration" + "$status" + "\n$character" + ]; + git_branch.symbol = " "; + git_commit.tag_disabled = false; + git_status = { + ahead = ''⇡''${count}''; + behind = ''⇣''${count}''; + diverged = ''⇕⇡''${ahead_count}⇣''${behind_count}''; + staged = "+$count"; + }; + kubernetes.disabled = false; + time.disabled = false; + }; + }; +} diff --git a/modules/home/swaylock/default.nix b/modules/home/swaylock/default.nix new file mode 100644 index 0000000..fe415e1 --- /dev/null +++ b/modules/home/swaylock/default.nix @@ -0,0 +1,60 @@ +{ + pkgs, + lib, + config, + inputs, + ... +}: { + # home.packages = with pkgs; [swaylock-effects]; + + programs.swaylock = { + enable = true; + package = pkgs.swaylock-effects; + settings = { + clock = true; + screenshots = true; + indicator = true; + indicator-radius = 100; + indicator-thickness = 7; + effect-blur = "7x5"; + effect-vignette = "0.5:0.5"; + ring-color = "3b4252"; + key-hl-color = "880033"; + line-color = "00000000"; + inside-color = "00000088"; + separator-color = "00000000"; + }; + }; + + services.swayidle = { + enable = true; + events = [ + { + event = "before-sleep"; + command = "${pkgs.swaylock-effects}/bin/swaylock -fF"; + } + { + event = "lock"; + command = "${pkgs.swaylock-effects}/bin/swaylock -fF"; + } + ]; + timeouts = [ + { + timeout = 90; + command = "swaylock"; + } + { + timeout = 300; + command = "systemctl suspend"; + } + # { + # timeout = 180; + # command = "systemctl suspend"; + # # command = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off"; + # # resumeCommand = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on"; + # } + ]; + }; + + systemd.user.services.swayidle.Install.WantedBy = lib.mkForce ["hyprland-session.target"]; +} diff --git a/modules/home/vscode/default.nix b/modules/home/vscode/default.nix new file mode 100644 index 0000000..cb357c3 --- /dev/null +++ b/modules/home/vscode/default.nix @@ -0,0 +1,18 @@ +{ pkgs, ... }: { + programs.vscode = { + enable = true; + package = pkgs.vscodium; + extensions = with pkgs.vscode-extensions;[ + esbenp.prettier-vscode + bradlc.vscode-tailwindcss + jnoortheen.nix-ide + ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ + { + name = "min-theme"; + publisher = "miguelsolorio"; + version = "1.5.0"; + sha256 = "DF/9OlWmjmnZNRBs2hk0qEWN38RcgacdVl9e75N8ZMY="; + } + ]; + }; +} diff --git a/modules/home/waybar/default.nix b/modules/home/waybar/default.nix new file mode 100755 index 0000000..1114331 --- /dev/null +++ b/modules/home/waybar/default.nix @@ -0,0 +1,5 @@ +{ ... }: { + imports = [ (import ./waybar.nix) ] + ++ [ (import ./settings.nix) ] + ++ [ (import ./style.nix) ]; +} diff --git a/modules/home/waybar/settings.nix b/modules/home/waybar/settings.nix new file mode 100644 index 0000000..14ab13e --- /dev/null +++ b/modules/home/waybar/settings.nix @@ -0,0 +1,132 @@ +{ ... }: +{ + + programs.waybar.settings = [ + { + "layer" = "top"; + "position" = "top"; + modules-left = [ + "custom/launcher" + "wlr/workspaces" + "temperature" + "idle_inhibitor" + ]; + modules-center = [ + "clock" + ]; + modules-right = [ + "pulseaudio" + "pulseaudio#microphone" + "memory" + "cpu" + "disk" + # "keyboard-state" + "network" + "cava" + "tray" + ]; + "custom/launcher" = { + "format" = " "; + "on-click" = "pkill wofi || wofi"; + "tooltip" = false; + }; + "idle_inhibitor" = { + "format" = "{icon}"; + "format-icons" = { + "activated" = ""; + "deactivated" = ""; + }; + }; + "disk" = { + "path" = "/home"; + "format" = "󰋊 {percentage_used}%"; + }; + "custom/wall" = { + "on-click" = "wallpaper_random"; + "on-click-middle" = "default_wall"; + "on-click-right" = "killall dynamic_wallpaper || dynamic_wallpaper &"; + "format" = " ﴔ "; + "tooltip" = false; + }; + "wlr/workspaces" = { + "format" = "{icon}"; + "on-click" = "activate"; + }; + "pulseaudio" = { + "scroll-step" = 5; + "format" = "{icon} {volume}%"; + "format-muted" = "󰸈 Muted"; + "format-icons" = { + "default" = [ "" "" "󱄠" ]; + }; + "on-click" = "pamixer -t"; + "on-click-right" = "pavucontrol"; + "on-click-middle" = "$HOME/.local/bin/toggle_sound_output"; + "tooltip" = false; + }; + "pulseaudio#microphone" = { + "format" = "{format_source}"; + "format-source" = "󰍬 {volume}%"; + "format-source-muted" = "󰍭 Muted"; + "on-click" = "pamixer --default-source -t"; + "on-scroll-up" = "pamixer --default-source -i 5"; + "on-scroll-down" = "pamixer --default-source -d 5"; + "scroll-step" = 5; + "on-click-right" = "pavucontrol"; + }; + "clock" = { + "interval" = 1; + "format" = "{:%I:%M %p %A %b %d}"; + "tooltip" = true; + "tooltip-format" = "{calendar}"; + }; + "memory" = { + "interval" = 1; + "format" = "󰟜 {percentage}%"; + "states" = { + "warning" = 85; + }; + }; + "cpu" = { + "interval" = 1; + "format" = "󰇖 {usage}%"; + }; + "network" = { + "interval" = 1; + "format" = "󰣺 Connected"; + "format-alt" = " {bandwidthUpBytes}  {bandwidthDownBytes}"; + "format-disconnected" = "󰣼 Disconnected"; + "tooltip" = false; + }; + "temperature" = { + "tooltip" = false; + "thermal-zone" = 2; + "hwmon-path" = "/sys/class/hwmon/hwmon2/temp1_input"; + "format" = " {temperatureC}°C"; + }; + "cava" = { + "framerate" = 60; + "autosens" = 1; + "sensitivity" = 10; + "bars" = 6; + "lower_cutoff_freq" = 50; + "higher_cutoff_freq" = 10000; + "method" = "pulse"; + "source" = "auto"; + "stereo" = true; + "reverse" = false; + "bar_delimiter" = 0; + "monstercat" = false; + "waves" = false; + "noise_reduction" = 0.77; + "input_delay" = 2; + "format-icons" = [ "▁" "▂" "▃" "▄" "▅" "▆" "▇" "█" ]; + "on-click-right" = "playerctl play-pause"; + }; + "tray" = { + "icon-size" = 12; + "spacing" = 5; + }; + } + ]; +} diff --git a/modules/home/waybar/style.nix b/modules/home/waybar/style.nix new file mode 100644 index 0000000..1d8672d --- /dev/null +++ b/modules/home/waybar/style.nix @@ -0,0 +1,91 @@ +{ ... }: { + programs.waybar.style = '' + * { + font-family: JetBrainsMono Nerd Font; + font-weight: normal; + font-size: 14px; + min-height: 0; + transition-property: background-color; + transition-duration: 0.5s; + } + + window#waybar { + background-color: transparent; + } + + window>box { + margin-left: 10px; + margin-right: 10px; + margin-top: 8px; + border: 2px solid #595959; + border-radius: 0px; + background-color: rgba(31, 31, 31, 1); + } + + #workspaces { + padding-left: 0px; + padding-right: 4px; + border-radius: 0px; + } + + #workspaces button { + padding-top: 5px; + border-radius: 0px; + padding-bottom: 5px; + padding-left: 8px; + padding-right: 8px; + } + + #workspaces button.active { + background-color: #595959; + color: rgb(23, 23, 23); + } + + #workspaces button.urgent { + color: #fff000; + } + + tooltip { + background: rgb(48, 45, 65); + } + + tooltip label { + color: rgb(217, 224, 238); + } + + #custom-launcher { + font-size: 16px; + padding-left: 10px; + padding-right: 6px; + color: #6896BA; + } + + #clock, + #memory, + #temperature, + #cpu, + #mpd, + #custom-wall, + #temperature, + #backlight, + #pulseaudio, + #network, + #battery, + #disk, + #idle_inhibitor { + padding-left: 10px; + padding-right: 10px; + padding-top: 0px; + padding-bottom: 0px; + color: #B9B9B9; + } + #cava { + padding-left: 10px; + padding-right: 10px; + } + #tray { + padding-right: 8px; + padding-left: 10px; + } + ''; +} diff --git a/modules/home/waybar/waybar.nix b/modules/home/waybar/waybar.nix new file mode 100644 index 0000000..1283e73 --- /dev/null +++ b/modules/home/waybar/waybar.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: { + programs.waybar = { + enable = true; + systemd = { + enable = false; + target = "graphical-session.target"; + }; + }; + programs.waybar.package = pkgs.waybar.overrideAttrs (oa: { + mesonFlags = (oa.mesonFlags or [ ]) ++ [ "-Dexperimental=true" ]; + }); +} diff --git a/modules/home/wlogout/config/layout b/modules/home/wlogout/config/layout new file mode 100644 index 0000000..1eed213 --- /dev/null +++ b/modules/home/wlogout/config/layout @@ -0,0 +1,24 @@ +{ + "label" : "lock", + "action" : "swaylock", + "text" : "Lock", + "keybind" : "l" +} +{ + "label": "reboot", + "action": "systemctl reboot", + "text": "Reboot", + "keybind": "r" +} +{ + "label" : "shutdown", + "action" : "poweroff", + "text" : "Shut Down", + "keybind" : "s" +} +{ + "label": "logout", + "action": "loginctl terminate-user $USER", + "text": "Logout", + "keybind": "e" +} diff --git a/modules/home/wlogout/config/lock-hover.png b/modules/home/wlogout/config/lock-hover.png new file mode 100644 index 0000000..8fb86fe Binary files /dev/null and b/modules/home/wlogout/config/lock-hover.png differ diff --git a/modules/home/wlogout/config/lock.png b/modules/home/wlogout/config/lock.png new file mode 100644 index 0000000..430451c Binary files /dev/null and b/modules/home/wlogout/config/lock.png differ diff --git a/modules/home/wlogout/config/logout-hover.png b/modules/home/wlogout/config/logout-hover.png new file mode 100644 index 0000000..9e570a9 Binary files /dev/null and b/modules/home/wlogout/config/logout-hover.png differ diff --git a/modules/home/wlogout/config/logout.png b/modules/home/wlogout/config/logout.png new file mode 100644 index 0000000..128c995 Binary files /dev/null and b/modules/home/wlogout/config/logout.png differ diff --git a/modules/home/wlogout/config/power-hover.png b/modules/home/wlogout/config/power-hover.png new file mode 100644 index 0000000..122d331 Binary files /dev/null and b/modules/home/wlogout/config/power-hover.png differ diff --git a/modules/home/wlogout/config/power.png b/modules/home/wlogout/config/power.png new file mode 100644 index 0000000..ce56166 Binary files /dev/null and b/modules/home/wlogout/config/power.png differ diff --git a/modules/home/wlogout/config/restart-hover.png b/modules/home/wlogout/config/restart-hover.png new file mode 100644 index 0000000..3e18536 Binary files /dev/null and b/modules/home/wlogout/config/restart-hover.png differ diff --git a/modules/home/wlogout/config/restart.png b/modules/home/wlogout/config/restart.png new file mode 100644 index 0000000..7855d40 Binary files /dev/null and b/modules/home/wlogout/config/restart.png differ diff --git a/modules/home/wlogout/config/sleep-hover.png b/modules/home/wlogout/config/sleep-hover.png new file mode 100644 index 0000000..0fd3bad Binary files /dev/null and b/modules/home/wlogout/config/sleep-hover.png differ diff --git a/modules/home/wlogout/config/sleep.png b/modules/home/wlogout/config/sleep.png new file mode 100644 index 0000000..6a3d607 Binary files /dev/null and b/modules/home/wlogout/config/sleep.png differ diff --git a/modules/home/wlogout/config/style.css b/modules/home/wlogout/config/style.css new file mode 100644 index 0000000..76cc37b --- /dev/null +++ b/modules/home/wlogout/config/style.css @@ -0,0 +1,53 @@ +window { + font-family: JetBrainsMono Nerd Font; + font-size: 14pt; + color: #CED7F4; /* text */ + background-color: rgba(31, 31, 31, 0.7); +} +button { + background-repeat: no-repeat; + background-position: center; + background-size: 50%; + border: none; + background-color: rgba(30, 30, 46, 0); + margin: 5px; + transition: box-shadow 0.2s ease-in-out, background-color 0.2s ease-in-out; +} +button:hover { + background-color: rgba(49, 50, 68, 0.5); +} +button:focus { + background-color: #595959; + color:#1F1F1F; +} +#lock { + background-image: image(url("./lock.png")); +} +#lock:focus { + background-image: image(url("./lock-hover.png")); +} +#logout { + background-image: image(url("./logout.png")); +} +#logout:focus { + background-image: image(url("./logout-hover.png")); +} +#suspend { + background-image: image(url("./sleep.png")); +} +#suspend:focus { + background-image: image(url("./sleep-hover.png")); +} + +#shutdown { + background-image: image(url("./power.png")); +} +#shutdown:focus { + background-image: image(url("./power-hover.png")); +} +#reboot { + background-image: image(url("./restart.png")); +} +#reboot:focus { + background-image: image(url("./restart-hover.png")); +} diff --git a/modules/home/wlogout/default.nix b/modules/home/wlogout/default.nix new file mode 100644 index 0000000..1429943 --- /dev/null +++ b/modules/home/wlogout/default.nix @@ -0,0 +1,3 @@ +{...}: { + xdg.configFile."wlogout".source = ./config; +} diff --git a/modules/home/wofi/config/config b/modules/home/wofi/config/config new file mode 100644 index 0000000..2073027 --- /dev/null +++ b/modules/home/wofi/config/config @@ -0,0 +1,15 @@ +width=600 +height=400 +location=center +show=drun +prompt=Search... +filter_rate=100 +allow_markup=true +no_actions=true +halign=fill +orientation=vertical +content_halign=fill +insensitive=true +allow_images=true +image_size=40 +gtk_dark=true diff --git a/modules/home/wofi/config/style.css b/modules/home/wofi/config/style.css new file mode 100644 index 0000000..7e67010 --- /dev/null +++ b/modules/home/wofi/config/style.css @@ -0,0 +1,67 @@ +* { + font-family: JetBrainsMono Nerd Font; +} +window { + margin: 0px; + border: 2px solid #595959; + background-color: rgba(31, 31, 31, 0.95); + border-radius: 0px; +} +#input { + all: unset; + min-height: 36px; + padding: 4px 10px; + margin: 4px; + border: none; + color: #e2e0ec; + font-weight: bold; + background-color: #595959; + outline: none; + border-radius: 0px; + margin: 10px; + margin-bottom: 2px; +} + +#inner-box { + margin: 4px; + padding: 10px; + font-weight: bold; + border-radius: 0px; +} + +#outer-box { + margin: 0px; + padding: 3px; + border: none; + border-radius: 0px; + border: 2px solid #595959; +} + +#scroll { + margin-top: 5px; + border: none; + border-radius: 0px; + margin-bottom: 5px; +} + +#text:selected { + color: #f1f0f5; + margin: 0px 0px; + border: none; + border-radius: 0px; +} + +#entry { + margin: 0px 0px; + border: none; + border-radius: 0px; + background-color: transparent; +} + +#entry:selected { + margin: 0px 0px; + border: none; + border-radius: 0px; + background: #595959; + /* background: linear-gradient(90deg, #E97193 0%, #82A497 100%); */ +} diff --git a/modules/home/wofi/default.nix b/modules/home/wofi/default.nix new file mode 100644 index 0000000..f34e966 --- /dev/null +++ b/modules/home/wofi/default.nix @@ -0,0 +1,3 @@ +{...} :{ + xdg.configFile."wofi".source = ./config; +} \ No newline at end of file diff --git a/modules/home/zsh/default.nix b/modules/home/zsh/default.nix new file mode 100755 index 0000000..8ad511d --- /dev/null +++ b/modules/home/zsh/default.nix @@ -0,0 +1,33 @@ +{ hostname +, config +, pkgs +, ... +}: { + programs.zsh = { + enable = true; + enableCompletion = true; + enableAutosuggestions = true; + enableSyntaxHighlighting = true; + oh-my-zsh = { + enable = true; + plugins = [ "git" ]; + + }; + shellAliases = { + n = "clear && neofetch"; + v = "nvim"; + record = "wf-recorder --audio=alsa_output.pci-0000_08_00.6.analog-stereo.monitor -f $HOME/Videos/$(date +'%Y%m%d%H%M%S_1.mp4')"; + ani = "bash $HOME/.local/bin/anime --dub"; + ls = "exa --icons --long"; + + # nixos + ncg = "nix-collect-garbage && nix-collect-garbage -d && sudo nix-collect-garbage && sudo nix-collect-garbage -d && sudo rm /nix/var/nix/gcroots/auto/*"; + nix-switch = "sudo nixos-rebuild switch --flake ~/Flakes/.#nixos"; + fl = "cd ~/Flakes/ && v"; + + # python + piv = "python -m venv .venv"; + psv = "source .venv/bin/activate"; + }; + }; +} diff --git a/pkgs/aichat/default.nix b/pkgs/aichat/default.nix new file mode 100644 index 0000000..96efe52 --- /dev/null +++ b/pkgs/aichat/default.nix @@ -0,0 +1,34 @@ +{ + lib, + rustPlatform, + fetchFromGitHub, + pkg-config, + openssl, + stdenv, +}: +rustPlatform.buildRustPackage rec { + pname = "aichat"; + version = "0.8.0"; + + src = fetchFromGitHub { + owner = "sigoden"; + repo = pname; + rev = "v${version}"; + hash = "sha256-E/QslRDeifFHlHUELv9rYHjfCAB1yXXiXlWOyPNkfps="; + }; + + cargoHash = "sha256-7TTHBeZ68G6k5eHBL1zDGsYiTyx27fBbN7Rl9AiZTng="; + + nativeBuildInputs = [ + pkg-config + ]; + + buildInputs = [ + openssl + ]; + + meta = with lib; { + description = "Using ChatGPT/GPT-3.5/GPT-4 in the terminal"; + homepage = "https://github.com/sigoden/aichat"; + }; +} diff --git a/pkgs/bore-cli/default.nix b/pkgs/bore-cli/default.nix new file mode 100644 index 0000000..b7e91b0 --- /dev/null +++ b/pkgs/bore-cli/default.nix @@ -0,0 +1,28 @@ +{ + lib, + stdenv, + rustPlatform, + fetchFromGitHub, +}: +rustPlatform.buildRustPackage rec { + pname = "bore-cli"; + version = "0.4.1"; + + src = fetchFromGitHub { + owner = "ekzhang"; + repo = "bore"; + rev = "v${version}"; + hash = "sha256-h5Xwsr61h52zb5HNPySKVjfYW96Fff7nwZUAL6vK9ko="; + }; + + cargoSha256 = "sha256-QyaQM8z5v0LgskkmZ/8ekZwxNrt8sq91BbnjvIqa2nI="; + + # tests do not find grcov path correctly + meta = with lib; { + description = "Rust tool to create TCP tunnels"; + homepage = "https://github.com/ekzhang/bore"; + license = licenses.mit; + maintainers = with maintainers; [DieracDelta]; + mainProgram = "bore"; + }; +} diff --git a/pkgs/catppuccin-cursors/default.nix b/pkgs/catppuccin-cursors/default.nix new file mode 100755 index 0000000..cf27c26 --- /dev/null +++ b/pkgs/catppuccin-cursors/default.nix @@ -0,0 +1,25 @@ +{ + lib, + stdenv, + fetchzip, + ... +}: +stdenv.mkDerivation rec { + pname = "cattpuccin-cursors"; + version = "9999"; + src = fetchzip { + url = "https://github.com/Ruixi-rebirth/Catppuccin-cursor/archive/refs/tags/1.0.zip"; + sha256 = "sha256-RCEVxeo3oBNqHogxWM/YqfPoQotirSQTMw15zCahWto="; + }; + installPhase = '' + mkdir -p $out/share/icons/Catppuccin-Frappe-Dark + cp -va index.theme cursors $out/share/icons/Catppuccin-Frappe-Dark + ''; + meta = { + description = "Soothing pastel mouse cursors"; + homepage = "https://github.com/Ruixi-rebirth/Catppuccin-cursor"; + license = lib.licenses.gpl3; + platforms = lib.platforms.unix; + maintainers = [lib.maintainers.Ruixi-rebirth]; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100755 index 0000000..d3a5f7f --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,12 @@ +rec{ + overlay = final: prev: + let + dirContents = builtins.readDir ../pkgs; + genPackage = name: { + inherit name; + value = final.callPackage (../pkgs + "/${name}") { }; + }; + names = builtins.attrNames dirContents; + in + builtins.listToAttrs (map genPackage names); +} diff --git a/wallpaper/wallpaper.png b/wallpaper/wallpaper.png new file mode 100644 index 0000000..ace8c2c Binary files /dev/null and b/wallpaper/wallpaper.png differ