From e24157a6145ab730ea5e62ae998c4043094c29ff Mon Sep 17 00:00:00 2001 From: Asmir A Date: Mon, 3 Jul 2023 22:35:58 +0200 Subject: [PATCH] create public release --- .gitignore | 1 + LICENSE | 21 +++ README.md | 1 + configuration.nix | 339 ++++++++++++++++++++++++++++++++++++ flake.lock | 268 ++++++++++++++++++++++++++++ flake.nix | 57 ++++++ hardware-configuration.nix | 78 +++++++++ home/home.nix | 260 +++++++++++++++++++++++++++ home/home_packages.nix | 79 +++++++++ home/i3.nix | 106 +++++++++++ home/i3status-rust.nix | 64 +++++++ home/sway.nix | 116 ++++++++++++ home/vimrc.lua | 195 +++++++++++++++++++++ home/vimrc.nix | 44 +++++ home/whatsapp-for-linux.nix | 35 ++++ home/zsh.nix | 104 +++++++++++ packages.nix | 64 +++++++ peerix-public | 1 + secrets/peerix.yaml | 31 ++++ 19 files changed, 1864 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 configuration.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hardware-configuration.nix create mode 100644 home/home.nix create mode 100644 home/home_packages.nix create mode 100644 home/i3.nix create mode 100644 home/i3status-rust.nix create mode 100644 home/sway.nix create mode 100644 home/vimrc.lua create mode 100644 home/vimrc.nix create mode 100644 home/whatsapp-for-linux.nix create mode 100644 home/zsh.nix create mode 100644 packages.nix create mode 100644 peerix-public create mode 100644 secrets/peerix.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..13fe842 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +./output diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..eb4fb78 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Asmir A + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..4ec9c62 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +NixOS configuration using nix flakes and home-manager diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..47460cf --- /dev/null +++ b/configuration.nix @@ -0,0 +1,339 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). +{ + config, + pkgs, + lib, + caps2esc, + nix-xilinx, + sops-nix, + ... +}: { + imports = []; + + system.stateVersion = "23.05"; + system.autoUpgrade.enable = false; + + sops.age.keyFile = config.users.users.akill.home + "/.config/sops/age/keys.txt"; + sops.secrets."peerix/private" = { + sopsFile = ./secrets/peerix.yaml; + }; + + nix = { + optimise.automatic = true; + gc.automatic = true; + gc.options = "--delete-older-than 7d"; + package = pkgs.nixUnstable; + settings = { + experimental-features = ["nix-command" "flakes"]; + trusted-public-keys = [ + "binarycache.mediabox.lan:3vZwbCaCuOK5fc92rKknvyU7e5fDbnKEKLb/VTaICoU=" + ]; + }; + }; + + boot = { + extraModulePackages = with config.boot.kernelPackages; [usbip]; + initrd.compressor = "zstd"; + initrd.kernelModules = ["amdgpu"]; + kernelPackages = pkgs.linuxPackages_latest; + kernelParams = ["psmouse.synaptics_intertouch=0"]; + loader.efi.canTouchEfiVariables = true; + loader.systemd-boot.editor = false; + loader.systemd-boot.enable = true; + readOnlyNixStore = true; + supportedFilesystems = ["btrfs"]; + tmp.useTmpfs = true; + }; + + security = { + rtkit.enable = true; + allowSimultaneousMultithreading = true; + sudo.enable = true; + doas.enable = true; + doas.extraRules = [ + { + users = ["akill"]; + keepEnv = true; + persist = true; + } + ]; + }; + + powerManagement = { + enable = true; + }; + + networking = { + firewall = { + enable = true; + allowedTCPPorts = [80 443]; + }; + + hostName = "nixy"; + nameservers = ["127.0.0.1" "::1"]; + dhcpcd.extraConfig = "nohook resolv.conf"; + + extraHosts = '' + 192.168.88.230 mediabox.lan + 192.168.88.230 jellyfin.mediabox.lan + 192.168.88.230 deluge.mediabox.lan + 192.168.88.230 binarycache.mediabox.lan + 192.168.88.231 workstation.lan + 192.168.88.1 router.lan + ''; + + networkmanager = { + enable = true; + dns = "none"; + wifi.backend = "iwd"; + }; + + wireless.iwd = { + enable = true; + settings = { + General = { + AddressRandomization = "network"; + #EnableNetworkConfiguration = true; + }; + }; + }; + }; + + time.timeZone = "Europe/Sarajevo"; + + nixpkgs.config.allowUnfree = true; + nixpkgs.overlays = [nix-xilinx.overlay]; + environment = { + homeBinInPath = true; + variables = { + PATH = "$HOME/.cargo/bin"; + }; + }; + + programs = { + gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + zsh.enable = true; + firejail.enable = true; + adb.enable = true; + wireshark.enable = true; + sway.enable = true; + }; + + # List services that you want to enable: + systemd = { + services = { + "caps2esc" = { + description = "Intercepts keyboard udev events"; + wants = ["systemd-udevd.service"]; + wantedBy = ["multi-user.target"]; + serviceConfig.Nice = -20; + script = '' + ${pkgs.interception-tools}/bin/intercept \ + -g /dev/input/by-path/platform-i8042-serio-0-event-kbd | \ + ${caps2esc.defaultPackage.x86_64-linux}/bin/caps2esc | ${pkgs.interception-tools}/bin/uinput \ + -d /dev/input/by-path/platform-i8042-serio-0-event-kbd \ + ''; + }; + }; + + extraConfig = '' + DefaultTimeoutStartSec=30s + DefaultTimeoutStopSec=30s + ''; + }; + + services = { + acpid.enable = true; + btrfs.autoScrub.enable = true; + dbus.enable = true; + fstrim.enable = true; + fwupd.enable = true; + ntp.enable = true; + openssh.enable = true; + printing.enable = true; + + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + xserver = { + enable = true; + dpi = 144; + libinput.enable = true; + desktopManager.xterm.enable = false; + displayManager = { + lightdm.enable = false; + startx.enable = true; + defaultSession = "none+i3"; + }; + windowManager.i3.enable = true; + }; + + udev = { + packages = [pkgs.openocd pkgs.rtl-sdr pkgs.openhantek6022]; + extraRules = '' + #Xilinx FTDI + ACTION=="add", ATTR{idVendor}=="0403", ATTR{manufacturer}=="Xilinx", MODE:="666" + + #Xilinx Digilent + ATTR{idVendor}=="1443", MODE:="666" + ACTION=="add", ATTR{idVendor}=="0403", ATTR{manufacturer}=="Digilent", MODE:="666" + ''; + }; + + tlp = { + enable = true; + }; + + actkbd = { + enable = true; + bindings = [ + { + keys = [113]; + events = ["key"]; + command = "/run/current-system/sw/bin/runuser -l akill -c 'amixer -q set Master toggle'"; + } + + { + keys = [114]; + events = ["key" "rep"]; + command = "/run/current-system/sw/bin/runuser -l akill -c 'amixer -q set Master 5%- unmute'"; + } + + { + keys = [115]; + events = ["key" "rep"]; + command = "/run/current-system/sw/bin/runuser -l akill -c 'amixer -q set Master 5%+ unmute'"; + } + + { + keys = [224]; + events = ["key"]; + command = "${pkgs.light}/bin/light -U 5"; + } + + { + keys = [225]; + events = ["key"]; + command = "${pkgs.light}/bin/light -A 5"; + } + ]; + }; + + dnscrypt-proxy2 = { + enable = true; + settings = { + ipv6_servers = true; + require_dnssec = true; + + sources.public-resolvers = { + urls = [ + "https://raw.githubusercontent.com/DNSCrypt/dnscrypt-resolvers/master/v3/public-resolvers.md" + "https://download.dnscrypt.info/resolvers-list/v3/public-resolvers.md" + ]; + cache_file = "/var/lib/dnscrypt-proxy2/public-resolvers.md"; + minisign_key = "RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3"; + }; + }; + }; + + nix-serve = { + enable = false; + secretKeyFile = "/var/cache-priv-key.pem"; + }; + + journald.extraConfig = '' + SystemMaxUse=50M + ''; + + logind.extraConfig = '' + KillUserProcesses=yes + ''; + }; + + fonts = { + fontconfig = { + cache32Bit = true; + allowBitmaps = true; + useEmbeddedBitmaps = true; + defaultFonts = { + monospace = ["JetBrainsMono"]; + }; + }; + + fonts = with pkgs; [ + dejavu_fonts + dina-font + fira-code + fira-code-symbols + font-awesome + font-awesome_4 + inconsolata + iosevka + jetbrains-mono + liberation_ttf + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + proggyfonts + siji + terminus_font + terminus_font_ttf + ubuntu_font_family + ]; + }; + + virtualisation = { + containers.storage.settings = { + storage = { + driver = "btrfs"; + graphroot = "/var/lib/containers/storage"; + runroot = "/run/containers/storage"; + }; + }; + podman = { + enable = true; + autoPrune.enable = true; + dockerCompat = true; + }; + }; + + sound.enable = true; + + hardware = { + bluetooth = { + enable = true; + settings = { + General = { + Enable = "Source,Sink,Media,Socket"; + }; + }; + }; + + opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + extraPackages = with pkgs; []; + }; + }; + + zramSwap = { + enable = false; + algorithm = "zstd"; + }; + + users.users.akill = { + isNormalUser = true; + shell = pkgs.zsh; + extraGroups = ["wireshark" "kvm" "tty" "audio" "sound" "adbusers" "dialout" "wheel"]; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..d93f013 --- /dev/null +++ b/flake.lock @@ -0,0 +1,268 @@ +{ + "nodes": { + "caps2esc": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1684616473, + "narHash": "sha256-e8/7jWl2EA1UROhd9L+D9kLdd5SoFYWi+56n2jer7g4=", + "owner": "asmir.abdulahovic", + "repo": "caps2esc", + "rev": "4ebc36bef4f4548566df14d94c9c9907e7a76e78", + "type": "gitlab" + }, + "original": { + "owner": "asmir.abdulahovic", + "repo": "caps2esc", + "type": "gitlab" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1688220547, + "narHash": "sha256-cNKKLPaEOxd6t22Mt3tHGubyylbKGdoi2A3QkMTKes0=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "89d10f8adce369a80e046c2fd56d1e7b7507bb5b", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nix-xilinx": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1685780173, + "narHash": "sha256-K18JYyCHrnb05Odb7N9FpU30az7QOV8uL9ch0RgU7i0=", + "owner": "asmir.abdulahovic", + "repo": "nix-xilinx", + "rev": "cc5ab958d31c58481b1f7f3a2c0a4db7c22006e9", + "type": "gitlab" + }, + "original": { + "owner": "asmir.abdulahovic", + "repo": "nix-xilinx", + "type": "gitlab" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1684585791, + "narHash": "sha256-lYPboblKrchmbkGMoAcAivomiOscZCjtGxxTSCY51SM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "eea79d584eff53bf7a76aeb63f8845da6d386129", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1688256355, + "narHash": "sha256-/E+OSabu4ii5+ccWff2k4vxDsXYhpc4hwnm0s6JOz7Y=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f553c016a31277246f8d3724d3b1eee5e8c0842c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "release-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1685677062, + "narHash": "sha256-zoHF7+HNwNwne2XEomphbdc4Y8tdWT16EUxUTXpOKpQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "95be94370d09f97f6af6a1df1eb9649b5260724e", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1688231357, + "narHash": "sha256-ZOn16X5jZ6X5ror58gOJAxPfFLAQhZJ6nOUeS4tfFwo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "645ff62e09d294a30de823cb568e9c6d68e92606", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1684668519, + "narHash": "sha256-KkVvlXTqdLLwko9Y0p1Xv6KQ9QTcQorrU098cGilb7c=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "85340996ba67cc02f01ba324e18b1306892ed6f5", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixpkgs-unstable", + "type": "indirect" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1688188316, + "narHash": "sha256-CXuQllDKCxtZaB/umnZOvoJ/d4kJguYgffeTA9l1B3o=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8277b539d371bf4308fc5097911aa58bfac1794f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "peerix": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs_4" + }, + "locked": { + "lastModified": 1684706914, + "narHash": "sha256-pBlTtsC28e/5MUTe4NWeNNOc/4Kf6EzGQGppQEQ/ioo=", + "owner": "asmir.abdulahovic", + "repo": "peerix", + "rev": "8fdbbd0039240e05b4f93bbd5b454d5643e8a8d1", + "type": "gitlab" + }, + "original": { + "owner": "asmir.abdulahovic", + "repo": "peerix", + "type": "gitlab" + } + }, + "root": { + "inputs": { + "caps2esc": "caps2esc", + "home-manager": "home-manager", + "nix-xilinx": "nix-xilinx", + "nixpkgs": "nixpkgs_3", + "peerix": "peerix", + "sops-nix": "sops-nix" + } + }, + "sops-nix": { + "inputs": { + "nixpkgs": "nixpkgs_5", + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1688268466, + "narHash": "sha256-fArazqgYyEFiNcqa136zVYXihuqzRHNOOeVICayU2Yg=", + "owner": "Mic92", + "repo": "sops-nix", + "rev": "5ed3c22c1fa0515e037e36956a67fe7e32c92957", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "sops-nix", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..5e0d544 --- /dev/null +++ b/flake.nix @@ -0,0 +1,57 @@ +{ + description = "NixOS configuration"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + caps2esc.url = "gitlab:asmir.abdulahovic/caps2esc"; + nix-xilinx.url = "gitlab:asmir.abdulahovic/nix-xilinx"; + peerix.url = "gitlab:asmir.abdulahovic/peerix"; + sops-nix.url = "github:Mic92/sops-nix"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = inputs @ { + self, + nixpkgs, + caps2esc, + home-manager, + nix-xilinx, + peerix, + sops-nix, + ... + }: { + nixosConfigurations = rec { + nixy = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + {_module.args = inputs;} + ./configuration.nix + ./packages.nix + ./hardware-configuration.nix + sops-nix.nixosModules.sops + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.akill = import ./home/home.nix; + } + peerix.nixosModules.peerix + { + services.peerix = { + enable = true; + globalCacheTTL = 10; + package = peerix.packages.x86_64-linux.peerix; + openFirewall = true; # UDP/12304 + privateKeyFile = nixy.config.sops.secrets."peerix/private".path; + publicKeyFile = ./peerix-public; + publicKey = "peerix-mediabox:UDgG3xdQYv7bmx2l4ZPNRPJtp2zMmY++H/fnGeJ9BQw="; + }; + } + ]; + }; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..9f306cc --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,78 @@ +# 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 = ["nvme" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd" "amdgpu"]; + boot.extraModulePackages = []; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/f06ac545-07c1-4b2b-8c0b-eeac43892933"; + fsType = "btrfs"; + options = ["subvol=root" "compress=zstd" "noatime"]; + }; + + boot.initrd.luks.devices."sys_enc".device = "/dev/disk/by-uuid/682d030d-189e-4b47-a60a-62cf1f3729d3"; + + fileSystems."/home" = { + device = "/dev/disk/by-uuid/f06ac545-07c1-4b2b-8c0b-eeac43892933"; + fsType = "btrfs"; + options = ["subvol=home" "compress=zstd" "noatime"]; + }; + + fileSystems."/nix" = { + device = "/dev/disk/by-uuid/f06ac545-07c1-4b2b-8c0b-eeac43892933"; + fsType = "btrfs"; + options = ["subvol=nix" "compress=zstd" "noatime"]; + }; + + fileSystems."/persist" = { + device = "/dev/disk/by-uuid/f06ac545-07c1-4b2b-8c0b-eeac43892933"; + fsType = "btrfs"; + options = ["subvol=persist" "compress=zstd" "noatime"]; + }; + + fileSystems."/var/log" = { + device = "/dev/disk/by-uuid/f06ac545-07c1-4b2b-8c0b-eeac43892933"; + fsType = "btrfs"; + options = ["subvol=log" "compress=zstd" "noatime"]; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/3F3E-9833"; + fsType = "vfat"; + }; + + fileSystems."/opt/xilinx" = { + device = "/dev/disk/by-uuid/09912fb9-0284-4b4e-add1-d4a27329539f"; + fsType = "erofs"; + }; + + swapDevices = [ + /* + { + device = "/dev/disk/by-uuid/ee1792c9-098b-40c1-b760-20def16ba67f"; + encrypted = { + enable = true; + keyFile = "/mnt-root/swap.key"; + label = "swap_encr"; + blkDev = "/dev/disk/by-uuid/aee12e27-b45a-4291-be78-db0a903071b3"; + }; + } + */ + ]; + + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + nix.settings.max-jobs = lib.mkDefault 8; +} diff --git a/home/home.nix b/home/home.nix new file mode 100644 index 0000000..b242209 --- /dev/null +++ b/home/home.nix @@ -0,0 +1,260 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; let + vimrc = import ./vimrc.nix {inherit pkgs vimUtils fetchFromGitHub;}; +in { + imports = [./zsh.nix ./i3status-rust.nix ./sway.nix ./i3.nix ./home_packages.nix ./whatsapp-for-linux.nix]; + + home.stateVersion = "22.11"; + home.username = "akill"; + home.homeDirectory = "/home/akill"; + + xdg.enable = true; + xdg.mimeApps = { + enable = true; + defaultApplications = { + "application/pdf" = ["sioyek.desktop"]; + }; + }; + + fonts.fontconfig.enable = true; + + home.sessionVariables = { + BROWSER = "qutebrowser"; + EDITOR = "nvim"; + _JAVA_AWT_WM_NONREPARENTING = "1"; + MOZ_ENABLE_WAYLAND = "1"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + SUDO_EDITOR = "nvim"; + WLR_RENDERER = "vulkan"; + }; + + wayland.windowManager.sway = {enable = true;}; + + programs = { + home-manager.enable = true; + + librewolf = { + enable = true; + package = pkgs.librewolf-wayland; + settings = { + "webgl.disable" = true; + "middlemouse.paste" = false; + }; + }; + + mpv = { + enable = true; + package = pkgs.mpv; + config = { + slang = "eng,en"; + alang = "eng,en"; + hwdec = "auto"; + vo = "gpu-next"; + ao = "pipewire"; + script-opts-set = "sponsorblock-local_database=no,sponsorblock-skip_categories=[sponsor,intro,selfpromo]"; + ytdl-format = "bestvideo[height<=?1080]+bestaudio/best"; + }; + + bindings = { + WHEEL_UP = "ignore"; + WHEEL_DOWN = "ignore"; + WHEEL_LEFT = "ignore"; + WHEEL_RIGHT = "ignore"; + }; + }; + + alacritty = { + enable = true; + + settings = { + font = { + normal.family = "JetBrainsMono"; + italic.family = "JetBrainsMono"; + bold.family = "JetBrainsMono"; + bold_italic.family = "JetBrainsMono"; + size = 14.0; + }; + + selection = { + text = "0xcfcfc2"; + background = "0x232629"; + + normal = { + black = "0x1c1b19"; + red = "0xef2f27"; + green = "0x519f50"; + yellow = "0xfbb829"; + blue = "0x2c78bf"; + magenta = "0xe02c6d"; + cyan = "0x0aaeb3"; + white = "0x918175"; + }; + + bright = { + black = "0x2D2C29"; + red = "0xf75341"; + green = "0x98bc37"; + yellow = "0xfed06e"; + blue = "0x68A8E4"; + magenta = "0xff5c8f"; + cyan = "0x53fde9"; + white = "0xfce8c3"; + }; + }; + }; + }; + + rofi = { + enable = true; + theme = "gruvbox-dark"; + }; + + foot = { + enable = true; + server.enable = true; + settings = { + main = { + font = "JetBrainsMono:size=10"; + dpi-aware = "yes"; + }; + mouse = {hide-when-typing = "yes";}; + }; + }; + + qutebrowser = { + enable = true; + package = pkgs.qutebrowser-qt6; + keyBindings = { + normal = { + "j" = "scroll-px 0 25"; + "k" = "scroll-px 0 -25"; + "u" = "undo --window"; + ";v" = "hint links userscript view_in_mpv"; + }; + }; + + settings = { + content.notifications.enabled = false; + content.pdfjs = true; + content.webgl = false; + fonts.completion.category = "14pt monospace"; + fonts.completion.entry = "14pt monospace"; + fonts.contextmenu = "14pt monospace"; + fonts.debug_console = "14pt monospace"; + fonts.downloads = "14pt monospace"; + fonts.hints = "14pt monospace"; + fonts.keyhint = "14pt monospace"; + fonts.messages.info = "14pt monospace"; + fonts.prompts = "14pt monospace"; + fonts.statusbar = "14pt monospace"; + hints.chars = "1qaz2wsx3edc4rfv5tgb6yhn7ujm8ik9ol0p"; + tabs.last_close = "close"; + tabs.position = "left"; + tabs.show = "multiple"; + tabs.tabs_are_windows = true; + tabs.width = "12%"; + zoom.default = "125%"; + }; + }; + + git = { + enable = true; + userName = "Asmir A"; + userEmail = "asmir.abdulahovic@gmail.com"; + extraConfig = { + pull = {rebase = true;}; + credential = {helper = "store";}; + }; + }; + + neovim = { + enable = true; + vimAlias = true; + vimdiffAlias = true; + plugins = vimrc.plugins; + extraConfig = ""; + extraPackages = vimrc.extraPackages; + }; + + obs-studio = { + enable = true; + plugins = with pkgs.obs-studio-plugins; [obs-vkcapture input-overlay obs-multi-rtmp obs-pipewire-audio-capture wlrobs obs-vaapi]; + }; + + i3status-rust.enable = true; + z-lua.enable = true; + zsh.enable = true; + }; + + xdg.configFile."nvim/init.lua" = { + source = ./vimrc.lua; + recursive = true; + }; + + services = { + lorri.enable = false; + mako.enable = true; + gammastep = { + enable = true; + latitude = "44.53"; + longitude = "18.67"; + temperature.day = 5500; + temperature.night = 2900; + }; + + gnome-keyring.enable = true; + + gpg-agent = { + enable = true; + defaultCacheTtl = 1800; + enableSshSupport = true; + }; + + swayidle = { + enable = true; + events = [ + { + event = "before-sleep"; + command = "swaylock_bg_blur.sh"; + } + { + event = "lock"; + command = "swaylock_bg_blur.sh"; + } + { + event = "after-resume"; + command = "pkill -USR1 i3status-rs"; + } + ]; + timeouts = [ + { + timeout = 15 * 60; + command = "swaylock_bg_blur.sh"; + } + ]; + }; + }; + + systemd.user = { + services = { + /* + himalaya = { + Unit.Description = "Himalaya new messages notifier"; + Service = { + ExecStart = "himalaya notify"; + Restart = "always"; + RestartSec = 10; + }; + Install = { + WantedBy = [ "multi-user.target" ]; + }; + }; + */ + }; + }; +} diff --git a/home/home_packages.nix b/home/home_packages.nix new file mode 100644 index 0000000..8ac4991 --- /dev/null +++ b/home/home_packages.nix @@ -0,0 +1,79 @@ +{ + config, + pkgs, + ... +}: { + home.packages = with pkgs; [ + alejandra + appimage-run + arp-scan + blackmagic + btop + cached-nix-shell + caddy + cargo + ccls + cemu + compsize + cura + deluge + ffmpeg-full + firefox + gcc + gdb + glab + glaxnimate + gnumake + grim + hyperfine + imagemagick + imv + jellyfin-media-player + kdenlive + kicad + kodi-wayland + libnotify + libreoffice + libva-utils + mediainfo + ncdu + neovide + ngspice + nodePackages.peerflix + openocd + pandoc + pass + patchelf + pavucontrol + pirate-get + powertop + pulsemixer + python3 + python3Packages.west + remmina + river + rtorrent + rustc + screen + seer + sioyek + skypeforlinux + slurp + texlive.combined.scheme-full + thunderbird + upx + waybar + wdisplays + whatsapp-for-linux + wireshark + wl-clipboard + wlr-randr + wofi + x2goclient + yt-dlp + zathura + zeal-qt6 + zig + zls + ]; +} diff --git a/home/i3.nix b/home/i3.nix new file mode 100644 index 0000000..158377b --- /dev/null +++ b/home/i3.nix @@ -0,0 +1,106 @@ +{ + config, + lib, + pkgs, + ... +}: let + scratchpad_cmd = "floating enable, resize set 1502 845, move position center, move scratchpad, scratchpad show"; +in { + xsession.windowManager.i3 = { + enable = true; + package = pkgs.i3; + + extraConfig = '' + new_window pixel 3 + hide_edge_borders smart + ''; + + config = rec { + modifier = "Mod1"; + + keybindings = lib.mkOptionDefault { + "${modifier}+Shift+Return" = "exec alacritty"; + "${modifier}+m" = "layout toggle splith tabbed"; + "${modifier}+t" = "split toggle"; + "${modifier}+s" = "layout toggle split"; + + "${modifier}+1" = "workspace 1"; + "${modifier}+2" = "workspace 2"; + "${modifier}+3" = "workspace 3"; + "${modifier}+4" = "workspace 4"; + "${modifier}+5" = "workspace 5"; + "${modifier}+6" = "workspace 6"; + "${modifier}+7" = "workspace 7"; + "${modifier}+8" = "workspace 8"; + "${modifier}+9" = "workspace 9"; + "${modifier}+0" = "workspace 10"; + + "${modifier}+Shift+1" = "move container to workspace 1"; + "${modifier}+Shift+2" = "move container to workspace 2"; + "${modifier}+Shift+3" = "move container to workspace 3"; + "${modifier}+Shift+4" = "move container to workspace 4"; + "${modifier}+Shift+5" = "move container to workspace 5"; + "${modifier}+Shift+6" = "move container to workspace 6"; + "${modifier}+Shift+7" = "move container to workspace 7"; + "${modifier}+Shift+8" = "move container to workspace 8"; + "${modifier}+Shift+9" = "move container to workspace 9"; + "${modifier}+Shift+0" = "move container to workspace 10"; + + "${modifier}+h" = "focus left"; + "${modifier}+j" = "focus down"; + "${modifier}+k" = "focus up"; + "${modifier}+l" = "focus right"; + "${modifier}+slash" = "exec ${pkgs.rofi}/bin/rofi -show window"; + "${modifier}+Escape" = "workspace back_and_forth"; + "${modifier}+p" = "exec ${pkgs.dmenu}/bin/dmenu_run"; + + "Mod4+l" = "exec i3-msg [instance=\"python3_scr\"] scratchpad show || exec alacritty --class python3_scr -e python3"; + "Mod4+j" = "exec i3-msg [class=\"ViberPC\"] scratchpad show || exec viber"; + "Mod4+m" = "exec i3-msg [class=\"Thunderbird\"] scratchpad show || exec thunderbird"; + "Mod4+y" = "exec i3-msg [instance=\"pulsemixer_scr\"] scratchpad show || exec alacritty --class pulsemixer_scr -e pulsemixer"; + }; + + window = { + /* + border = 4; + */ + commands = [ + { + command = scratchpad_cmd; + criteria = {instance = "pulsemixer_scr|python3_scr";}; + } + { + command = scratchpad_cmd; + criteria = {class = "Thunderbird";}; + } + { + command = scratchpad_cmd; + criteria = { + class = "ViberPC"; + title = "Viber"; + }; + } + { + command = "focus child, layout tabbed, focus"; + criteria = {class = "qutebrowser";}; + } + ]; + }; + + bars = [ + { + position = "top"; + fonts = { + names = ["DejaVu Sans Mono" "FontAwesome5Free"]; + style = "Fixed Bold SemiCondensed"; + size = 7.0; + }; + statusCommand = "i3status-rs /home/akill/.config/i3status-rust/config-top.toml"; + extraConfig = '' + workspace_min_width 30 + ''; + } + ]; + }; + }; +} diff --git a/home/i3status-rust.nix b/home/i3status-rust.nix new file mode 100644 index 0000000..5a56de7 --- /dev/null +++ b/home/i3status-rust.nix @@ -0,0 +1,64 @@ +{ + config, + lib, + pkgs, + ... +}: { + programs.i3status-rust = { + bars.top = { + icons = "awesome5"; + theme = "gruvbox-dark"; + settings.theme = { + theme = "plain"; + overrides = { + separator_fg = "#3287a8"; + }; + }; + + blocks = [ + { + block = "battery"; + interval = 10; + format = "$icon $percentage $time"; + } + { + block = "disk_space"; + path = "/"; + info_type = "available"; + interval = 20; + warning = 20.0; + alert = 10.0; + } + { + block = "net"; + device = "wlan0"; + interval = 2; + } + { + block = "net"; + device = "enp5s0"; + interval = 2; + } + { + block = "memory"; + } + { + block = "cpu"; + interval = 1; + format = "$utilization $barchart $frequency"; + } + { + block = "temperature"; + interval = 3; + } + { + block = "sound"; + } + { + block = "time"; + interval = 60; + } + ]; + }; + }; +} diff --git a/home/sway.nix b/home/sway.nix new file mode 100644 index 0000000..101fbc1 --- /dev/null +++ b/home/sway.nix @@ -0,0 +1,116 @@ +{ + config, + lib, + pkgs, + ... +}: { + wayland.windowManager.sway = { + enable = true; + extraSessionCommands = ""; + + config = { + fonts = { + names = ["JetBrainsMono"]; + style = "Bold Semi-Condensed"; + size = 11.0; + }; + + window.commands = [ + { + command = "move scratchpad, resize set 1152 648"; + criteria = {app_id = "pulsemixer|python3|whatsapp-for-linux|com.viber.Viber";}; + } + { + command = "move scratchpad, resize set 1502 845"; + criteria = {class = "ViberPC";}; + } + { + command = "floating enable"; + criteria = {app_id = "sws_cli";}; + } + ]; + + modifier = "Mod4"; + output = { + eDP-1 = { + bg = "~/pic/weird_dragon.jpg stretch"; + /* + scale = "1.4"; + */ + }; + }; + input = { + "1:1:AT_Translated_Set_2_keyboard" = {repeat_delay = "150";}; + "1:1:AT_Translated_Set_2_keyboard" = {repeat_rate = "70";}; + "2:7:SynPS/2_Synaptics_TouchPad" = {tap = "enabled";}; + }; + + bars = [ + { + position = "top"; + fonts = { + names = ["Iosevka" "FontAwesome"]; + style = "Bold Semi-Condensed"; + size = 12.0; + }; + statusCommand = "i3status-rs ~/.config/i3status-rust/config-top.toml"; + } + ]; + + keybindings = { + "Alt+Shift+q" = "kill"; + "Alt+Shift+Return" = "exec ${pkgs.foot}/bin/footclient"; + "Alt+p" = "exec ${pkgs.dmenu-wayland}/bin/dmenu-wl_run -fn \"mono 14\""; + + "Alt+Shift+space" = "floating toggle"; + "Alt+space" = "focus mode_toggle"; + + "Alt+m" = "layout toggle splith tabbed"; + "Alt+t" = "split toggle"; + "Alt+s" = "layout toggle split"; + + "Alt+1" = "workspace 1"; + "Alt+2" = "workspace 2"; + "Alt+3" = "workspace 3"; + "Alt+4" = "workspace 4"; + "Alt+5" = "workspace 5"; + "Alt+6" = "workspace 6"; + "Alt+7" = "workspace 7"; + "Alt+8" = "workspace 8"; + "Alt+9" = "workspace 9"; + "Alt+0" = "workspace 10"; + + "Alt+Shift+1" = "move container to workspace 1"; + "Alt+Shift+2" = "move container to workspace 2"; + "Alt+Shift+3" = "move container to workspace 3"; + "Alt+Shift+4" = "move container to workspace 4"; + "Alt+Shift+5" = "move container to workspace 5"; + "Alt+Shift+6" = "move container to workspace 6"; + "Alt+Shift+7" = "move container to workspace 7"; + "Alt+Shift+8" = "move container to workspace 8"; + "Alt+Shift+9" = "move container to workspace 9"; + "Alt+Shift+0" = "move container to workspace 10"; + + "Alt+h" = "focus left"; + "Alt+j" = "focus down"; + "Alt+k" = "focus up"; + "Alt+l" = "focus right"; + "Alt+slash" = "exec lckdo /tmp/.sws_cli_lock footclient -a sws_cli -- sws_cli.sh"; + "Alt+Escape" = "workspace back_and_forth"; + "Alt+f" = "fullscreen enable"; + + "Mod4+l" = '' + exec swaymsg [app_id="python3"] scratchpad show || exec foot -a python3 python3''; + "Mod4+h" = "exec swaymsg [app_id=whatsapp-for-linux] scratchpad show || exec whatsapp-for-linux"; + "Mod4+j" = "exec swaymsg [app_id=com.viber.Viber] scratchpad show"; + "Mod4+y" = '' + exec swaymsg [app_id="pulsemixer"] scratchpad show || exec foot -a pulsemixer pulsemixer''; + + "XF86AudioRaiseVolume" = "exec pactl set-sink-volume $(pacmd list-sinks |awk '/* index:/{print $3}') +5%"; + "XF86AudioLowerVolume" = "exec pactl set-sink-volume $(pacmd list-sinks |awk '/* index:/{print $3}') -5%"; + "XF86AudioMute" = "exec pactl set-sink-mute $(pacmd list-sinks |awk '/* index:/{print $3}') toggle"; + "XF86AudioMicMute" = "exec pactl set-source-mute $(pacmd list-sources |awk '/* index:/{print $3}') toggle"; + }; + }; + }; +} diff --git a/home/vimrc.lua b/home/vimrc.lua new file mode 100644 index 0000000..22df171 --- /dev/null +++ b/home/vimrc.lua @@ -0,0 +1,195 @@ +-- Basic settings +vim.g.loaded_matchparen = true +vim.g.netrw_liststyle = 3 +vim.go.background = 'dark' +vim.go.belloff = 'all' +vim.go.breakindent = true +vim.go.hlsearch = false +vim.go.laststatus = 0 +vim.go.lazyredraw = true +vim.go.showcmd = true +vim.go.synmaxcol = 800 +vim.go.syntax = 'on' +vim.go.termguicolors = true +vim.go.titleold = vim.fn.getcwd() +vim.go.title = true +vim.go.wildmenu = true +vim.go.wrap = true +vim.wo.number = true + +vim.cmd([[colorscheme gruvbox]]) + +-- Defines a read-write directory for treesitters in nvim's cache dir +local parser_install_dir = vim.fn.stdpath("cache") .. "/treesitters" +if vim.fn.isdirectory(parser_install_dir) == 0 then + vim.fn.mkdir(parser_install_dir, "p") +end +-- Adding runtime needed for Nix setup on non NixOS +vim.o.runtimepath = vim.o.runtimepath .. "," .. parser_install_dir + +require 'nvim-treesitter.install'.compilers = { 'gcc' } + +require 'nvim-treesitter.configs'.setup { + ensure_installed = { "c", "cpp", "zig", "python", "verilog", "nix", "lua", "latex" }, + parser_install_dir = parser_install_dir, + highlight = { enable = true, disable = {} }, + indent = { enable = false, disable = {} }, + rainbow = { + enable = true, + extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean + max_file_lines = 1000, -- Do not enable for files with more than 1000 lines, int + colors = { + '#ff0000', '#ffa500', '#ffff00', '#008000', '#0051a0', '#8003f2' + } -- table of hex strings + } +} + +-- Mappings. +-- See `:help vim.diagnostic.*` for documentation on any of the below functions +local opts = { noremap = true, silent = true } +vim.api.nvim_set_keymap('n', 'e', + 'lua vim.diagnostic.open_float()', opts) +vim.api.nvim_set_keymap('n', 'q', + 'lua vim.diagnostic.setloclist()', opts) +vim.api.nvim_set_keymap('n', 'Q', 'nohl', opts) +vim.api.nvim_set_keymap('n', 'j', 'gj', opts) +vim.api.nvim_set_keymap('n', 'k', 'gk', opts) +vim.api.nvim_set_keymap('v', 'j', 'gj', opts) +vim.api.nvim_set_keymap('v', 'k', 'gk', opts) +vim.api.nvim_set_keymap('n', '', '', opts) +vim.api.nvim_set_keymap('n', '', '', opts) +vim.api.nvim_set_keymap('n', '', '', opts) +vim.api.nvim_set_keymap('n', '', '', opts) + +vim.api.nvim_create_autocmd('LspAttach', { + desc = 'LSP actions', + callback = function() + local bufmap = function(mode, lhs, rhs) + vim.keymap.set(mode, lhs, rhs, { buffer = true }) + end + + -- Displays hover information about the symbol under the cursor + bufmap('n', 'K', 'lua vim.lsp.buf.hover()') + + -- Jump to the definition + bufmap('n', 'gd', 'lua vim.lsp.buf.definition()') + + -- Jump to declaration + bufmap('n', 'gD', 'lua vim.lsp.buf.declaration()') + + -- Lists all the implementations for the symbol under the cursor + bufmap('n', 'gi', 'lua vim.lsp.buf.implementation()') + + -- Jumps to the definition of the type symbol + bufmap('n', 'go', 'lua vim.lsp.buf.type_definition()') + + -- Lists all the references + bufmap('n', 'gr', 'lua vim.lsp.buf.references()') + + -- Displays a function's signature information + bufmap('n', '', 'lua vim.lsp.buf.signature_help()') + + -- Renames all references to the symbol under the cursor + bufmap('n', 'rn', 'lua vim.lsp.buf.rename()') + + -- Selects a code action available at the current cursor position + bufmap('n', '', 'lua vim.lsp.buf.code_action()') + bufmap('x', '', 'lua vim.lsp.buf.range_code_action()') + + -- Show diagnostics in a floating window + bufmap('n', 'gl', 'lua vim.diagnostic.open_float()') + + -- Move to the previous diagnostic + bufmap('n', '[d', 'lua vim.diagnostic.goto_prev()') + + -- Move to the next diagnostic + bufmap('n', ']d', 'lua vim.diagnostic.goto_next()') + + -- Format current buffer + bufmap('n', 'f', function() vim.lsp.buf.format { async = true } end) + end +}) + +-- Use a loop to conveniently call 'setup' on multiple servers and +-- map buffer local keybindings when the language server attaches +local cmp = require 'cmp' +cmp.setup({ + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'buffer' }, + { name = 'path' }, + }), + mapping = { + [""] = cmp.mapping({ + i = function(fallback) + if cmp.visible() then + cmp.select_next_item({ behavior = cmp.SelectBehavior.Insert }) + else + fallback() + end + end, + }), + [""] = cmp.mapping({ + i = function(fallback) + if cmp.visible() then + cmp.select_prev_item({ behavior = cmp.SelectBehavior.Insert }) + else + fallback() + end + end, + }), + [''] = cmp.mapping(cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), { 'i' }), + [''] = cmp.mapping(cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), { 'i' }), + [''] = cmp.mapping({ + i = function(fallback) + if cmp.visible() then + cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) + else + fallback() + end + end + }), + [''] = cmp.mapping({ + i = function(fallback) + if cmp.visible() then + cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select }) + else + fallback() + end + end + }), + [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), + [''] = cmp.mapping({ i = cmp.mapping.close(), c = cmp.mapping.close() }), + [''] = cmp.mapping({ + i = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }), + }), + } +}) + +local servers = { 'pyright', 'rust_analyzer', 'ccls', 'lua_ls', 'rnix', 'texlab', 'verible' } +local capabilities = require('cmp_nvim_lsp').default_capabilities() +for _, lsp in pairs(servers) do + require('lspconfig')[lsp].setup { + capabilities = capabilities + } +end + +require('lspconfig').lua_ls.setup({ + single_file_support = true, +}) + +require('lspconfig').verible.setup({ + root_dir = function() return vim.loop.cwd() end +}) + +if vim.fn.exists('+undofile') ~= 0 then + local undo_dir = vim.env.HOME .. '/.config/nvim/undo' + if vim.fn.isdirectory(undo_dir) == 0 then vim.fn.mkdir(undo_dir, 'p') end + vim.o.undodir = undo_dir + vim.o.undofile = true +end + +vim.cmd([[syntax sync minlines=100]]) +vim.cmd([[syntax sync maxlines=140]]) diff --git a/home/vimrc.nix b/home/vimrc.nix new file mode 100644 index 0000000..c3ca439 --- /dev/null +++ b/home/vimrc.nix @@ -0,0 +1,44 @@ +{ + pkgs, + vimUtils, + fetchFromGitHub, +}: { + extraPackages = [ + pkgs.ccls + pkgs.clang + pkgs.luaformatter + pkgs.nil + pkgs.pyright + pkgs.rnix-lsp + pkgs.rust-analyzer + pkgs.sumneko-lua-language-server + pkgs.svls + pkgs.texlab + pkgs.tree-sitter + pkgs.zls + pkgs.verible + ]; + + plugins = with pkgs.vimPlugins; [ + colorizer + fugitive + fzf-vim + gruvbox + nvim-lspconfig + nvim-treesitter + nvim-ts-rainbow + repeat + targets-vim + UltiSnips + vim-addon-nix + vim-signify + vim-slime + vim-snippets + zig-vim + cmp-nvim-lsp + cmp-buffer + cmp-path + cmp-cmdline + nvim-cmp + ]; +} diff --git a/home/whatsapp-for-linux.nix b/home/whatsapp-for-linux.nix new file mode 100644 index 0000000..124fe53 --- /dev/null +++ b/home/whatsapp-for-linux.nix @@ -0,0 +1,35 @@ +{ + config, + pkgs, + lib, + ... +}: +with lib; { + xdg.configFile."whatsapp-for-linux/settings.conf".source = builtins.toFile "settings.conf" ( + generators.toINI {} { + General = { + zoom_level = 1; + close_to_tray = false; + }; + + Network = { + allow_permissions = true; + }; + + web = { + allow-permissions = true; + hw-accel = 1; + }; + + general = { + notification-sounds = true; + close-to-tray = true; + start-in-tray = false; + }; + + appearance = { + prefer-dark-theme = true; + }; + } + ); +} diff --git a/home/zsh.nix b/home/zsh.nix new file mode 100644 index 0000000..a444e2b --- /dev/null +++ b/home/zsh.nix @@ -0,0 +1,104 @@ +{ + config, + lib, + pkgs, + ... +}: { + programs.z-lua = { + enableAliases = true; + enableZshIntegration = true; + }; + + programs.zsh = { + autocd = true; + enableCompletion = false; + syntaxHighlighting.enable = true; + defaultKeymap = "viins"; + + shellAliases = { + cfind = "cscope -C -R -L1"; + chmod = "chmod -v"; + chown = "chown -v"; + cp = "cp -v"; + rm = "rm -v"; + ip = "ip --color=auto"; + }; + + history = { + expireDuplicatesFirst = true; + extended = true; + save = 100000; + size = 100000; + }; + + plugins = [ + { + name = "nix_shell"; + src = pkgs.zsh-nix-shell; + file = "share/zsh-nix-shell/nix-shell.plugin.zsh"; + } + { + name = "nix_completion"; + src = pkgs.nix-zsh-completions; + file = "share/zsh/plugins/nix/nix-zsh-completions.plugin.zsh"; + } + { + name = "fast_syntax_highlight"; + src = pkgs.zsh-fast-syntax-highlighting; + file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh"; + } + { + name = "pure_prompt"; + src = pkgs.fetchFromGitHub { + owner = "sindresorhus"; + repo = "pure"; + rev = "47c0c881f0e7cfdb5eaccd335f52ad17b897c060"; + sha256 = "15xdhi72pq88ls5gx1h0k23jvb41j6kq6ar17dqmd5d38zsgwl3v"; + }; + file = "pure.plugin.zsh"; + } + { + name = "fzf"; + src = pkgs.fzf-zsh; + file = "share/zsh/plugins/fzf-zsh/fzf-zsh.plugin.zsh"; + } + { + name = "zsh-sudo"; + src = pkgs.fetchFromGitHub { + owner = "hcgraf"; + repo = "zsh-sudo"; + rev = "d8084def6bb1bde2482e7aa636743f40c69d9b32"; + sha256 = "1dpm51w3wjxil8sxqw4qxim5kmf6afmkwz1yfhldpdlqm7rfwpi3"; + }; + file = "sudo.plugin.zsh"; + } + ]; + + envExtra = ''''; + + initExtra = '' + # binds + bindkey '^K' fzf-file-widget + + # options + setopt nobeep + setopt nopromptcr + setopt c_bases + setopt completeinword + setopt completealiases + setopt extendedglob + setopt notify + + # + RPS1="" + + # + function chpwd() { + ls; + } + + eval "$(direnv hook zsh)" + zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' + ''; + }; +} diff --git a/packages.nix b/packages.nix new file mode 100644 index 0000000..ba3c080 --- /dev/null +++ b/packages.nix @@ -0,0 +1,64 @@ +{ + config, + pkgs, + nix-xilinx, + ... +}: { + environment.systemPackages = with pkgs; + [ + acpi + binutils + bluez + bluez-tools + btop + dhcpcd + direnv + dmidecode + dnsmasq + fd + file + fzf + fzy + git + gnupg + gptfdisk + htop + interception-tools + jq + msmtp + nano + neovim + nix-index + nixos-option + nmap + ntfs3g + ntfsprogs + openhantek6022 + pax-utils + pciutils + pstree + psutils + ripgrep + rsync + silver-searcher + sshfs + strace + swaylock + tig + unrar + unzip + usbutils + uutils-coreutils + vimpc + vulkan-extension-layer + vulkan-loader + vulkan-tools + vulkan-tools-lunarg + vulkan-validation-layers + wget + xdg-utils + zip + z-lua + ] + ++ (with nix-xilinx.packages.x86_64-linux; [vivado vitis vitis_hls model_composer xilinx-shell]); +} diff --git a/peerix-public b/peerix-public new file mode 100644 index 0000000..046e1d1 --- /dev/null +++ b/peerix-public @@ -0,0 +1 @@ +peerix-nixy:8THqS0R2zWF/47ai0RFmqJnieYTZ1jaWOD9tnzpvA6s= \ No newline at end of file diff --git a/secrets/peerix.yaml b/secrets/peerix.yaml new file mode 100644 index 0000000..fefb038 --- /dev/null +++ b/secrets/peerix.yaml @@ -0,0 +1,31 @@ +peerix: + private: ENC[AES256_GCM,data:WlWrX0kxeElaGvFllg2EkgfDsj1bkRwD9xMTWQevktDQaRd3IdVD9IwFZcwgTgS4hVM6gy9Q/VWX3M12vKaLdaKeTR/PMOQGCov291w12cAFIg/pYINp+511a9aHqFaIZx0WeA==,iv:Ni0M4Tikcbs6NsanYunOKn1R8jLlC59NiDbqNVPW7gM=,tag:POSZ9OgkLZyvnN8vn8OgDQ==,type:str] +sops: + kms: [] + gcp_kms: [] + azure_kv: [] + hc_vault: [] + age: + - recipient: age153y8mz6gqy5t54q4fnrdvjj4v5ls9cgp3hhpd2hzf5tvkcnncf6q4xns0j + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBNbWcxaHVYUjVydnZVZkJa + MFA1TDJFcmtpUis2SXBWNjh5QjI0WkgydHhBCklzVFRlZ0VoSitISlpIaVFJaHRZ + enNFaFl1MkRaQUtpb1JUOUNJaXJDT00KLS0tIHZBeGc2ejR4bkcxVjhrWDYyOVpk + V28zVWZsTFpJVHY3bHdqR3dGMHNqWncKcjvVw61Zfh0yXKikjnrlq1CIoN7wDiiQ + 5FDAzjdTMGLOXvrxtfKEJ0RUP8/ANJ+b69pJTBl8To4qIAFGKU0syg== + -----END AGE ENCRYPTED FILE----- + - recipient: age1smcrg45udmvl5w8306qec07lqqzjplwx3l8f80tcewpkh7r3h5yqgenrqd + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBYUnNveWIrOEE4UnlGNnpN + WE5oN1hrOTlma0ZWUDc5ZG5pcUFOV1BJam5nCnhiaFRJVjcreDFiTU85RlJzK0tT + eURJdHAwWXVZU2xHbTdsOVc4VjJOaUUKLS0tIGJ2c3JxVGFZWHdCY1p3M1VRNGlk + enVTczYxcjNPZkFHTG5RZEtRTTRJOUEKNTPZFBwdnKNmalgPqpJew8ucwQZ3yK+8 + 6Zqv3POnq68ms4nFelQynDYDAEK/maN+qYdo8qgFi14pz87liVF/Ug== + -----END AGE ENCRYPTED FILE----- + lastmodified: "2023-07-03T20:12:05Z" + mac: ENC[AES256_GCM,data:kcfnNiu88VTYGgxfSRIkqK8MXS7Gcan9oXxc+UM6/c7yCj35ogNGtDxJmJ4O1Gov2LrP3+lbhyHjOeQBYN06JmE+3o3SV/bIZ5HUWMYqmj+yO1sG8ugSx2NAgSMKmyESlrZTZvN9Z9Z8JocmN1TtyA9Uip7/URfGOXaIFYYDLwE=,iv:bxRoXN4DEIi4B2bCxKcImKp1rfkps4RxP3UbjBePjPw=,tag:x4yXtvmoOrFEadhZmbJjAQ==,type:str] + pgp: [] + unencrypted_suffix: _unencrypted + version: 3.7.3