diff --git a/.envrc b/.envrc deleted file mode 100644 index 3550a30..0000000 --- a/.envrc +++ /dev/null @@ -1 +0,0 @@ -use flake diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 5c1c87e..0000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* linguist-language=HolyC diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 2bbdbfe..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.direnv -result diff --git a/README.md b/README.md index ac50f50..b1e3b8d 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ -# Jet's NixOS config +# ❄️ NixOS dotfiles -I've done NixOS a few times, but this round has been very comfortable. Nothing is really that special about it, but feel free to copy it! +*My configuration files for NixOS. Feel free to look around and copy!* -> silly language thing credited to https://github.com/SylvanFranklin/.config - -This flake currently defines one host: `framework` which is my laptop. - -- system config lives in `configuration.nix` -- Home Manager config lives in `home.nix` +# Special thanks to: +- [Sioodmy's dotfiles](https://github.com/sioodmy/dotfiles) +- [Syndrizzle's dotfiles](https://github.com/syndrizzle/hotfiles) +- [Javacafe01's dotfiles](https://github.com/javacafe01/dotfiles) +- [Siduck76's NvChad](https://github.com/siduck76/nvchad/) +- [NixOS Manual](https://nixos.org/manual/nixos/stable/) +- [Epsyle's NixOS Dotfiles](https://github.com/epsyle/snowflake/) \ No newline at end of file diff --git a/configuration.nix b/configuration.nix deleted file mode 100644 index 20a20ab..0000000 --- a/configuration.nix +++ /dev/null @@ -1,310 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ ./hardware-configuration.nix ]; - - boot.loader.systemd-boot.enable = true; - boot.loader.systemd-boot.configurationLimit = 3; - boot.loader.efi.canTouchEfiVariables = true; - boot.loader.timeout = 1; - boot.loader.systemd-boot.consoleMode = "max"; - boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; - - networking.hostName = "framework"; - - # Ensure current wireless firmware is available. - hardware.enableRedistributableFirmware = true; - - hardware.bluetooth = { - enable = true; - powerOnBoot = true; - settings = { - General = { - Experimental = true; # Show battery charge of Bluetooth devices - }; - }; - }; - - networking.networkmanager.enable = true; - networking.networkmanager.settings = { - connection = { - "wifi.powersave" = 2; - }; - device = { - "wifi.scan-rand-mac-address" = false; - }; - }; - - services.resolved.enable = true; - - networking.firewall.enable = true; - # Required for Tailscale - networking.firewall.checkReversePath = "loose"; - networking.firewall.interfaces."tailscale0".allowedTCPPorts = [ 4096 ]; - - services.tailscale = { - enable = true; - }; - - systemd.services.tailscale-set-operator = { - description = "Set Tailscale operator user"; - after = [ "tailscaled.service" ]; - requires = [ "tailscaled.service" ]; - wantedBy = [ "multi-user.target" ]; - serviceConfig.Type = "oneshot"; - path = [ pkgs.tailscale ]; - script = '' - tailscale set --operator=jet - ''; - }; - - time.timeZone = "America/Los_Angeles"; - i18n.defaultLocale = "en_US.UTF-8"; - - # Framework Laptop 13 AMD AI 300 Series specific configurations - # Enable AMD GPU support and power management - hardware.graphics = { - enable = true; - enable32Bit = true; - }; - - # Enable keyd for key remapping - services.keyd = { - enable = true; - keyboards = { - default = { - ids = [ "*" ]; # Apply to all keyboards - settings = { - main = { - capslock = "esc"; - esc = "capslock"; - leftalt = "leftcontrol"; - leftcontrol = "leftalt"; - mute = "mute"; # ← Key 1: mute - volumedown = "playpause"; # ← Key 2: play/pause - volumeup = "volumedown"; # ← Key 3: vol down - previoussong = "volumeup"; # ← Key 4: vol up - playpause = "command(touch /tmp/keyd-f5-test)"; # ← Key 5: lock screen (testing) - nextsong = "noop"; # ← Key 6: disabled - brightnessdown = "noop"; # ← Key 7: disabled - brightnessup = "noop"; # ← Key 8: disabled - # Key 9: display toggle (leftmeta+p) - disabled below - rfkill = "brightnessdown"; # ← Key 10: brightness down - sysrq = "brightnessup"; # ← Key 11: brightness up - media = "sysrq"; # ← Key 12: screenshot - }; - }; - }; - frameworkRadio = { - ids = [ "32ac:0006" ]; - settings = { - main = { - brightnessdown = "noop"; # ← Key 7: disabled - brightnessup = "noop"; # ← Key 8: disabled - rfkill = "brightnessdown"; # ← Key 10: brightness down - }; - }; - }; - }; - }; - - # Prevent trackpad interference with keyd - environment.etc."libinput/local-overrides.quirks".text = '' - [Serial Keyboards] - MatchUdevType=keyboard - MatchName=keyd virtual keyboard - AttrKeyboardIntegration=internal - ''; - - # Codex currently probes the conventional FHS bubblewrap path. - systemd.tmpfiles.rules = [ - "L+ /usr/bin/bwrap - - - - ${pkgs.bubblewrap}/bin/bwrap" - ]; - - # Set Kitty as default terminal - xdg.terminal-exec = { - enable = true; - settings = { - default = [ "kitty.desktop" ]; - }; - }; - - services.flatpak.enable = true; - - virtualisation.docker.enable = true; - - services.displayManager.gdm.enable = true; - services.desktopManager.gnome.enable = true; - services.gnome.sushi.enable = true; - - # Remove default GNOME apps (keeping loupe and file-roller) - environment.gnome.excludePackages = with pkgs; [ - epiphany # GNOME Web - gnome-calculator - gnome-calendar - gnome-characters - gnome-clocks - gnome-connections - gnome-console - gnome-contacts - gnome-maps - gnome-music - gnome-weather - snapshot # Camera - gnome-text-editor - simple-scan - totem # Videos (have VLC) - yelp # Help docs - evince # PDF viewer (using Zen Browser) - geary # Email - gnome-tour - gnome-font-viewer # Have font-manager - ]; - - services.printing.enable = true; - - services.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; - users.users.jet = { - isNormalUser = true; - description = "Jet"; - extraGroups = [ - "networkmanager" - "wheel" - "video" - "render" - "docker" - ]; - }; - - nixpkgs.config.allowUnfree = true; - nix.settings = { - experimental-features = [ - "nix-command" - "flakes" - ]; - trusted-users = [ - "root" - "jet" - ]; - max-jobs = "auto"; - cores = 0; - build-users-group = "nixbld"; - }; - nix.gc = { - automatic = true; - dates = "daily"; - options = "--delete-older-than 7d"; - }; - nix.optimise.automatic = true; - - # Framework-specific services - # Enable fwupd for BIOS updates (distributed through LVFS) - services.fwupd.enable = true; - - # Enable periodic TRIM for NVMe/SSD health - services.fstrim.enable = true; - services.irqbalance.enable = true; - services.earlyoom.enable = true; - - # Power management for laptop - services.logind = { - settings = { - Login = { - HandleLidSwitch = "suspend"; - HandleLidSwitchExternalPower = "suspend"; - HandleLidSwitchDocked = "ignore"; - HandlePowerKey = "suspend"; - }; - }; - }; - - # Enable auto-cpufreq for intelligent power management (replaces TLP) - services.auto-cpufreq.enable = true; - services.auto-cpufreq.settings = { - battery = { - governor = "powersave"; - turbo = "never"; - }; - charger = { - governor = "performance"; - turbo = "auto"; - }; - }; - - # Disable power-profiles-daemon (conflicts with auto-cpufreq) - services.power-profiles-daemon.enable = false; - - # Enable power management (governor managed dynamically by auto-cpufreq) - powerManagement.enable = true; - - # v4l2loopback for OBS Virtual Camera - boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ]; - boot.kernelModules = [ "v4l2loopback" ]; - boot.extraModprobeConfig = '' - options cfg80211 ieee80211_regdom=US - options v4l2loopback devices=1 video_nr=1 card_label="OBS Virtual Camera" exclusive_caps=1 - ''; - - # RAM optimizations for 96GB system - boot.kernel.sysctl = { - "vm.vfs_cache_pressure" = 50; # Keep more filesystem cache in RAM - "vm.dirty_ratio" = 15; # Write to disk when 15% of RAM is dirty - "vm.dirty_background_ratio" = 5; # Start writing when 5% dirty - "kernel.nmi_watchdog" = 0; - "net.core.default_qdisc" = "fq"; - "net.ipv4.tcp_congestion_control" = "bbr"; - }; - - # Use RAM disk (tmpfs) for temporary files - much faster than disk - fileSystems."/tmp" = { - device = "tmpfs"; - fsType = "tmpfs"; - options = [ - "size=32G" # Use up to 32GB RAM for /tmp (adjust as needed) - "mode=1777" - "nosuid" - "nodev" - ]; - }; - - environment.systemPackages = with pkgs; [ - bubblewrap - docker - docker-compose - flatpak - wget - nh - ]; - - programs.steam.enable = true; - programs.nix-index-database.comma.enable = true; - - # https://wiki.nixos.org/wiki/Appimage - programs.appimage = { - enable = true; - binfmt = true; - }; - - # GameCube adapter udev rules for Slippi/Dolphin - # Disable USB autosuspend for Framework's problematic devices (fingerprint reader, USB-C hub) - services.udev.extraRules = '' - # GameCube adapter USB device (vendor ID 057e, product ID 0337) - SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="0337", MODE="0666" - # GameCube adapter HID device (needed for Dolphin to access controllers) - KERNEL=="hidraw*", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="0337", MODE="0666", GROUP="input" - # Disable autosuspend for Framework fingerprint reader - ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="27a6", ATTR{power/autosuspend}="-1" - # Disable autosuspend for Framework USB-C hub controllers - ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="32ac", ATTR{power/autosuspend}="-1" - ''; - - system.stateVersion = "25.05"; - -} diff --git a/flake.lock b/flake.lock index 19ebdf3..78eb6ca 100644 --- a/flake.lock +++ b/flake.lock @@ -1,26 +1,5 @@ { "nodes": { - "flake-parts": { - "inputs": { - "nixpkgs-lib": [ - "nur", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1733312601, - "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -28,11 +7,11 @@ ] }, "locked": { - "lastModified": 1776450050, - "narHash": "sha256-Hks5rQkQMTL9bK1v+z/DN9E/N3OXdJir5C5+VF2cJvk=", + "lastModified": 1711133180, + "narHash": "sha256-WJOahf+6115+GMl3wUfURu8fszuNeJLv9qAWFQl3Vmo=", "owner": "nix-community", "repo": "home-manager", - "rev": "6ddeb76a5db8f5bc57cf1601a761e34cb0dcd8ff", + "rev": "1c2c5e4cabba4c43504ef0f8cc3f3dfa284e2dbb", "type": "github" }, "original": { @@ -41,54 +20,13 @@ "type": "github" } }, - "home-manager_2": { - "inputs": { - "nixpkgs": [ - "zen-browser", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1774991950, - "narHash": "sha256-kScKj3qJDIWuN9/6PMmgy5esrTUkYinrO5VvILik/zw=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "f2d3e04e278422c7379e067e323734f3e8c585a7", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, - "nix-index-database": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1775970782, - "narHash": "sha256-7jt9Vpm48Yy5yAWigYpde+HxtYEpEuyzIQJF4VYehhk=", - "owner": "nix-community", - "repo": "nix-index-database", - "rev": "bedba5989b04614fc598af9633033b95a937933f", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nix-index-database", - "type": "github" - } - }, "nixos-hardware": { "locked": { - "lastModified": 1775490113, - "narHash": "sha256-2ZBhDNZZwYkRmefK5XLOusCJHnoeKkoN95hoSGgMxWM=", + "lastModified": 1710783728, + "narHash": "sha256-eIsfu3c9JUBgm3cURSKTXLEI9Dlk1azo+MWKZVqrmkc=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "c775c2772ba56e906cbeb4e0b2db19079ef11ff7", + "rev": "1e679b9a9970780cd5d4dfe755a74a8f96d33388", "type": "github" }, "original": { @@ -99,70 +37,24 @@ }, "nixpkgs": { "locked": { - "lastModified": 1776169885, - "narHash": "sha256-l/iNYDZ4bGOAFQY2q8y5OAfBBtrDAaPuRQqWaFHVRXM=", - "owner": "nixos", + "lastModified": 1711001935, + "narHash": "sha256-URtGpHue7HHZK0mrHnSf8wJ6OmMKYSsoLmJybrOLFSQ=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "4bd9165a9165d7b5e33ae57f3eecbcb28fb231c9", + "rev": "20f77aa09916374aa3141cbc605c955626762c9a", "type": "github" }, "original": { - "owner": "nixos", + "id": "nixpkgs", "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nur": { - "inputs": { - "flake-parts": "flake-parts", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1776449163, - "narHash": "sha256-GJkIh1cqtybBTuvmCR3lp/Q/8+h0s4GwtmxLlZOPXeI=", - "owner": "nix-community", - "repo": "NUR", - "rev": "bd26b584d9fbbd4c9caffdbb19ddc24a5d821cd6", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "NUR", - "type": "github" + "type": "indirect" } }, "root": { "inputs": { "home-manager": "home-manager", - "nix-index-database": "nix-index-database", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs", - "nur": "nur", - "zen-browser": "zen-browser" - } - }, - "zen-browser": { - "inputs": { - "home-manager": "home-manager_2", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1776403742, - "narHash": "sha256-ZmGY9XiOsuMS/THsSNkgp2fnc3asXQX/xRrQpWnY9nA=", - "owner": "0xc000022070", - "repo": "zen-browser-flake", - "rev": "ca7077bea5c830470437ea878da2a1940773324c", - "type": "github" - }, - "original": { - "owner": "0xc000022070", - "repo": "zen-browser-flake", - "type": "github" + "nixpkgs": "nixpkgs" } } }, diff --git a/flake.nix b/flake.nix index 066f5ad..8559f43 100644 --- a/flake.nix +++ b/flake.nix @@ -1,71 +1,59 @@ { - description = "flake for jet with Home Manager enabled"; - # https://github.com/drakerossman/nixos-musings/blob/main/how-to-add-home-manager-to-nixos/flake.nix + description = "Jet's Nix Config"; + inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - home-manager.url = "github:nix-community/home-manager"; - home-manager.inputs.nixpkgs.follows = "nixpkgs"; - nixos-hardware.url = "github:NixOS/nixos-hardware"; - zen-browser = { - url = "github:0xc000022070/zen-browser-flake"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - nix-index-database = { - url = "github:nix-community/nix-index-database"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - nur = { - url = "github:nix-community/NUR"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + nixpkgs.url = "nixpkgs/nixos-unstable"; + nixos-hardware.url = "github:NixOS/nixos-hardware"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = - inputs@{ - nixpkgs, - home-manager, - nixos-hardware, - ... - }: - { - formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt; - nixosConfigurations = { - framework = nixpkgs.lib.nixosSystem { - modules = [ - { nixpkgs.hostPlatform = "x86_64-linux"; } - ./configuration.nix - nixos-hardware.nixosModules.framework-amd-ai-300-series - home-manager.nixosModules.home-manager - inputs.nix-index-database.nixosModules.default - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.backupFileExtension = "backup"; - home-manager.extraSpecialArgs = { inherit inputs; }; - home-manager.users.jet = import ./home.nix; - } - { - nixpkgs.overlays = [ - inputs.nur.overlays.default - ]; - } - ]; - }; - }; + # All outputs for the system (configs) + outputs = { home-manager, nixpkgs, nixos-hardware, ... }@inputs: + let + system = "x86_64-linux"; #current system + pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux; + lib = nixpkgs.lib; - devShells.x86_64-linux.default = - let - pkgs = nixpkgs.legacyPackages.x86_64-linux; - nhs = pkgs.writeShellScriptBin "nhs" '' - sudo -v || exit $? - nh os switch --hostname framework path:. "$@" - ''; - in - pkgs.mkShell { - packages = [ - pkgs.nh - nhs - ]; - }; - }; + # This lets us reuse the code to "create" a system + # Credits go to sioodmy on this one! + # https://github.com/sioodmy/dotfiles/blob/main/flake.nix + mkSystem = pkgs: system: hostname: + let + hardwareConfig = { + "laptop" = nixos-hardware.nixosModules.lenovo-thinkpad-x1-6th-gen; + # Add other hostnames and their respective hardware configurations here + }; + in + pkgs.lib.nixosSystem { + inherit system; + modules = [ + { networking.hostName = hostname; } + ./modules/system/configuration.nix + (./. + "/hosts/${hostname}/hardware-configuration.nix") + (hardwareConfig.${hostname} or (lib.mkForce {})) # Import hardware configuration if exists for hostname + home-manager.nixosModules.home-manager + { + home-manager = { + useUserPackages = true; + useGlobalPkgs = true; + extraSpecialArgs = { inherit inputs; }; + users.jet = (./. + "/hosts/${hostname}/user.nix"); + }; + } + ]; + specialArgs = { inherit inputs; }; + }; + + + in { + nixosConfigurations = { + # Now, defining a new system is can be done in one line + # Architecture Hostname + laptop = mkSystem inputs.nixpkgs "x86_64-linux" "laptop"; + #desktop = mkSystem inputs.nixpkgs "x86_64-linux" "desktop"; + }; + }; } diff --git a/hardware-configuration.nix b/hardware-configuration.nix deleted file mode 100644 index 20e36c0..0000000 --- a/hardware-configuration.nix +++ /dev/null @@ -1,53 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ - config, - lib, - pkgs, - modulesPath, - ... -}: - -{ - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = [ - "nvme" - "xhci_pci" - "thunderbolt" - "usb_storage" - "sd_mod" - ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = { - device = "/dev/disk/by-uuid/687945b8-9e15-473d-b083-d3a3b12ac98f"; - fsType = "ext4"; - options = [ "noatime" ]; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/407C-573B"; - fsType = "vfat"; - options = [ - "fmask=0077" - "dmask=0077" - ]; - }; - - swapDevices = [ ]; - - # 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.wlp192s0.useDHCP = lib.mkDefault true; - - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/home.nix b/home.nix deleted file mode 100644 index 1bfdfdc..0000000 --- a/home.nix +++ /dev/null @@ -1,916 +0,0 @@ -{ - config, - pkgs, - inputs, - ... -}: - -let - name = "Jet"; - email = "jet@extremist.software"; - sshSigningKey = "~/.ssh/id_ed25519.pub"; - sshPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE40ISu3ydCqfdpb26JYD5cIN0Fu0id/FDS+xjB5zpqu"; - zenStartup = pkgs.makeDesktopItem { - name = "zen-startup"; - desktopName = "Zen Startup"; - comment = "Launch Zen Browser"; - exec = "${config.programs.zen-browser.package}/bin/zen-beta"; - terminal = false; - categories = [ "Network" ]; - }; - kittyZellijStartup = pkgs.makeDesktopItem { - name = "kitty-zellij-startup"; - desktopName = "Kitty Zellij Startup"; - comment = "Open Kitty and attach to the main Zellij session"; - exec = "${pkgs.kitty}/bin/kitty --start-as=fullscreen ${zellijPersistentSession}/bin/zellij-persistent-session"; - terminal = false; - categories = [ - "TerminalEmulator" - ]; - }; - vesktopStartup = pkgs.makeDesktopItem { - name = "vesktop-startup"; - desktopName = "Vesktop Startup"; - comment = "Launch Vesktop in fullscreen"; - exec = "${pkgs.vesktop}/bin/vesktop --start-fullscreen"; - terminal = false; - categories = [ "Network" ]; - }; - signalStartup = pkgs.makeDesktopItem { - name = "signal-startup"; - desktopName = "Signal Startup"; - comment = "Launch Signal in fullscreen"; - exec = "${pkgs.signal-desktop}/bin/signal-desktop --start-fullscreen"; - terminal = false; - categories = [ "Network" ]; - }; - betterbirdStartup = pkgs.makeDesktopItem { - name = "betterbird-startup"; - desktopName = "Betterbird Startup"; - comment = "Launch Betterbird in fullscreen"; - exec = "${pkgs.flatpak}/bin/flatpak run eu.betterbird.Betterbird --fullscreen"; - terminal = false; - categories = [ "Network" ]; - }; - zulipStartup = pkgs.makeDesktopItem { - name = "zulip-startup"; - desktopName = "Zulip Startup"; - comment = "Launch Zulip in fullscreen"; - exec = "${pkgs.zulip}/bin/zulip --start-fullscreen"; - terminal = false; - categories = [ "Network" ]; - }; - tailscaleQsExtension = pkgs.stdenvNoCC.mkDerivation { - pname = "tailscale-gnome-qs"; - version = "5"; - src = pkgs.fetchzip { - url = "https://github.com/tailscale-qs/tailscale-gnome-qs/archive/refs/tags/v5.tar.gz"; - sha256 = "0b9jy8pyxvpkxf3adlwq42kii14jn5g7xyxggjzg87pb5jg4zfg2"; - }; - dontBuild = true; - installPhase = '' - mkdir -p "$out/share/gnome-shell/extensions" - cp -r "$src/tailscale-gnome-qs@tailscale-qs.github.io" \ - "$out/share/gnome-shell/extensions/tailscale-gnome-qs@tailscale-qs.github.io" - ''; - }; - # opencode's native watcher binding needs libstdc++.so.6 on NixOS. - wrappedOpencode = pkgs.symlinkJoin { - name = "opencode-wrapped"; - paths = [ pkgs.opencode ]; - nativeBuildInputs = [ pkgs.makeWrapper ]; - postBuild = '' - wrapProgram "$out/bin/opencode" \ - --prefix LD_LIBRARY_PATH : "${pkgs.lib.makeLibraryPath [ pkgs.stdenv.cc.cc.lib ]}" - ''; - }; - nasaApodWallpaper = pkgs.writeShellApplication { - name = "nasa-apod-wallpaper"; - runtimeInputs = [ - pkgs.coreutils - pkgs.curl - pkgs.glib - pkgs.jq - ]; - text = '' - set -euo pipefail - - state_dir="${config.home.homeDirectory}/.local/state/nasa-apod" - current_link="$state_dir/current" - mkdir -p "$state_dir" - curl_args=( - --fail - --silent - --show-error - --location - --retry 30 - --retry-all-errors - --retry-delay 2 - --connect-timeout 10 - --max-time 300 - ) - - set_wallpaper() { - local target="$1" - - gsettings set org.gnome.desktop.background picture-uri "file://$target" - gsettings set org.gnome.desktop.background picture-uri-dark "file://$target" - gsettings set org.gnome.desktop.background picture-options 'zoom' - } - - json="$(curl "''${curl_args[@]}" 'https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY' || true)" - if [ -z "$json" ]; then - exit 0 - fi - - media_type="$(printf '%s' "$json" | jq -r '.media_type // empty')" - - if [ "$media_type" != "image" ]; then - exit 0 - fi - - image_url="$(printf '%s' "$json" | jq -r '.hdurl // .url // empty')" - if [ -z "$image_url" ]; then - exit 0 - fi - - ext="''${image_url##*.}" - ext="''${ext%%\?*}" - if [ -z "$ext" ] || [ "$ext" = "$image_url" ]; then - ext="jpg" - fi - - date_stamp="$(printf '%s' "$json" | jq -r '.date // empty')" - if [ -z "$date_stamp" ]; then - date_stamp="$(date +%F)" - fi - - target="$state_dir/apod-$date_stamp.$ext" - tmp="$target.tmp" - - if curl "''${curl_args[@]}" "$image_url" -o "$tmp" && [ -s "$tmp" ]; then - mv "$tmp" "$target" - ln -sfn "$target" "$current_link" - set_wallpaper "$target" - else - rm -f "$tmp" - fi - ''; - }; - zellijNewTabZoxide = pkgs.writeShellApplication { - name = "zellij-new-tab-zoxide"; - runtimeInputs = [ - pkgs.coreutils - pkgs.fzf - pkgs.zellij - pkgs.zoxide - ]; - text = '' - set -euo pipefail - - dirs="$(${pkgs.zoxide}/bin/zoxide query -l | while IFS= read -r dir; do - if [ -d "$dir" ]; then - printf '%s\t%s\n' "$(${pkgs.coreutils}/bin/basename "$dir")" "$dir" - fi - done)" - - if [ -z "$dirs" ]; then - if [ -n "''${ZELLIJ:-}" ]; then - exec ${pkgs.bashInteractive}/bin/bash -i - fi - exit 1 - fi - - dir="$(printf '%s\n' "$dirs" | ${pkgs.fzf}/bin/fzf \ - --delimiter='\t' \ - --with-nth='2' \ - --nth='1' \ - --height='40%' \ - --layout='reverse' \ - --border \ - --prompt='dir> ' \ - --exit-0 | ${pkgs.coreutils}/bin/cut -f2-)" - - if [ -z "$dir" ]; then - if [ -n "''${ZELLIJ:-}" ]; then - ${pkgs.zellij}/bin/zellij action close-tab >/dev/null 2>&1 || true - exit 0 - fi - exit 1 - fi - - tab_name="$(${pkgs.coreutils}/bin/basename "$dir")" - if [ "$dir" = "/" ]; then - tab_name="/" - fi - - cd "$dir" - - escape_kdl() { - local value="$1" - value="''${value//\\/\\\\}" - value="''${value//\"/\\\"}" - printf '%s' "$value" - } - - if [ -n "''${ZELLIJ:-}" ]; then - ${pkgs.zellij}/bin/zellij action rename-tab "$tab_name" >/dev/null 2>&1 || true - fi - - if [ -n "''${ZELLIJ:-}" ]; then - exec ${pkgs.bashInteractive}/bin/bash -i - fi - - layout_file="${config.home.homeDirectory}/.local/state/zellij-launch-layout.kdl" - mkdir -p "$(dirname "$layout_file")" - printf '%s\n' \ - 'layout {' \ - " tab name=\"$(escape_kdl "$tab_name")\" cwd=\"$(escape_kdl "$dir")\" {" \ - ' pane focus=true' \ - ' pane size=1 borderless=true {' \ - ' plugin location="compact-bar"' \ - ' }' \ - ' }' \ - '}' > "$layout_file" - - exec ${pkgs.zellij}/bin/zellij -l "$layout_file" - ''; - }; - zellijPersistentSession = pkgs.writeShellApplication { - name = "zellij-persistent-session"; - runtimeInputs = [ pkgs.zellij ]; - text = '' - set -euo pipefail - - while true; do - if ${pkgs.zellij}/bin/zellij attach --create main --force-run-commands; then - if ! ${zellijNewTabZoxide}/bin/zellij-new-tab-zoxide; then - exec ${pkgs.bashInteractive}/bin/bash -i - fi - else - exit $? - fi - done - ''; - }; - zellijSyncTabName = pkgs.writeShellApplication { - name = "zellij-sync-tab-name"; - runtimeInputs = [ - pkgs.coreutils - pkgs.jq - pkgs.zellij - ]; - text = '' - set -euo pipefail - - if [ -z "''${ZELLIJ:-}" ]; then - exit 0 - fi - - current_tab_info="$(${pkgs.zellij}/bin/zellij action current-tab-info --json 2>/dev/null)" - current_tab_id="$(printf '%s\n' "$current_tab_info" | ${pkgs.jq}/bin/jq -r '.tab_id // empty')" - current_tab_name="$(printf '%s\n' "$current_tab_info" | ${pkgs.jq}/bin/jq -r '.name // empty')" - - if [ -z "$current_tab_id" ]; then - exit 0 - fi - - next_tab_name="$(${pkgs.zellij}/bin/zellij action list-panes --json 2>/dev/null | ${pkgs.jq}/bin/jq -r --argjson tab_id "$current_tab_id" ' - [ .[] - | select((.is_plugin | not) and .tab_id == $tab_id) - | .pane_cwd // empty - | if . == "/" then "/" else split("/") | map(select(length > 0)) | last end - ] - | reduce .[] as $name ([]; if index($name) == null then . + [$name] else . end) - | join("-") - ' 2>/dev/null)" - - if [ -z "$next_tab_name" ] || [ "$next_tab_name" = "$current_tab_name" ]; then - exit 0 - fi - - exec ${pkgs.zellij}/bin/zellij action rename-tab "$next_tab_name" - ''; - }; -in -{ - imports = [ inputs.zen-browser.homeModules.default ]; - - home.username = "jet"; - home.homeDirectory = "/home/jet"; - home.stateVersion = "25.05"; - - # Configure GNOME settings - dconf.settings = { - "org/gnome/desktop/interface" = { - clock-format = "12h"; - clock-show-weekday = true; - color-scheme = "prefer-dark"; - enable-animations = false; - enable-hot-corners = false; - }; - "org/gnome/system/location" = { - enabled = true; - }; - "org/gnome/settings-daemon/plugins/power" = { - sleep-inactive-ac-type = "nothing"; - }; - "org/gtk/gtk4/settings/file-chooser" = { - show-hidden = true; - }; - "org/gtk/settings/file-chooser" = { - clock-format = "12h"; - show-hidden = true; - }; - "org/gnome/desktop/peripherals/touchpad" = { - disable-while-typing = false; - }; - "org/gnome/shell" = { - disable-user-extensions = false; - enabled-extensions = [ - "hidetopbar@mathieu.bidon.ca" - "wifiqrcode@glerro.pm.me" - "system-monitor@paradoxxx.zero.gmail.com" - "clipboard-indicator@tudmotu.com" - "emoji-copy@felipeftn" - "tailscale-gnome-qs@tailscale-qs.github.io" - ]; - }; - }; - - home.packages = with pkgs; [ - # Scripts - (writeShellScriptBin "tea-init" '' - name="''${1:-$(basename "$PWD")}" - login="''${2:-git.extremist.software}" - user=$(tea logins list -o simple | awk -v l="$login" '$2 == "https://"l {print $4}') - if [ -z "$user" ]; then - echo "error: no tea login found for $login" >&2 - exit 1 - fi - tea repo create --name "$name" --login "$login" - git remote add origin "ssh://forgejo@''${login}/''${user}/''${name}.git" - '') - (writeShellScriptBin "ow" '' - sudo -v - sudo tailscale serve --bg 4096 - exec opencode web --hostname 127.0.0.1 --port 4096 - '') - - # CLI - bat - bun - claude-code - ffmpeg-full - wrappedOpencode - skills - zellijNewTabZoxide - zellijSyncTabName - fd - btop - fastfetch - gh - hyfetch - jq - mkp224o - nixfmt - difftastic - ripgrep - tea - trash-cli - tree - unzip - - # LSP Servers - rust-analyzer - typescript-language-server - nil - - # Desktop - element-desktop - file-roller - font-manager - gimp3 - google-chrome - handbrake - inkscape - kdePackages.kdenlive - libreoffice - logseq - obs-studio - pavucontrol - prismlauncher - qpwgraph - qbittorrent-enhanced - signal-desktop - slack - tor-browser - vesktop - vlc - zulip - linphone - lmstudio - - # Fonts - nerd-fonts.commit-mono - - # GNOME Extensions - gnomeExtensions.clipboard-indicator - gnomeExtensions.emoji-copy - gnomeExtensions.hide-top-bar - gnomeExtensions.system-monitor-next - gnomeExtensions.wifi-qrcode - ]; - - home.sessionVariables = { - BROWSER = "zen"; - TERMINAL = "kitty"; - }; - - programs.git = { - enable = true; - settings = { - user.name = name; - user.email = email; - core.sshCommand = "ssh -o ServerAliveInterval=60 -o ServerAliveCountMax=3"; - core.compression = 6; - pack.windowMemory = "256m"; - pack.packSizeLimit = "2g"; - pack.threads = 1; - gpg.ssh.allowedSignersFile = "~/.config/git/allowed_signers"; - }; - signing = { - key = sshSigningKey; - signByDefault = true; - format = "ssh"; - }; - }; - - home.file.".gitconfig".text = '' - # Compatibility shim for tools that only read ~/.gitconfig. - [include] - path = ~/.config/git/config - ''; - - home.file.".config/git/allowed_signers".text = "${email} ${sshPublicKey}\n"; - - programs.helix = { - enable = true; - defaultEditor = true; - settings = { - theme = "dark_high_contrast"; - editor = { - line-number = "relative"; - lsp.display-messages = true; - lsp.display-inlay-hints = true; - end-of-line-diagnostics = "hint"; - inline-diagnostics = { - cursor-line = "hint"; - other-lines = "hint"; - }; - }; - }; - }; - - programs.starship = { - enable = true; - enableBashIntegration = true; - settings = { - format = "$directory$git_status$nix_shell$cmd_duration$line_break$character"; - directory.truncation_length = 3; - git_status.style = "red"; - git_branch.disabled = true; - nix_shell.format = "[$symbol]($style) "; - cmd_duration.min_time = 500; - character.success_symbol = "[❯](bold green)"; - character.error_symbol = "[❯](bold red)"; - }; - }; - - programs.zellij = { - enable = true; - enableBashIntegration = false; - - layouts.tabs-and-mode = '' - layout { - pane - pane size=1 borderless=true { - plugin location="status-bar" - } - pane size=1 borderless=true { - plugin location="tab-bar" - } - } - ''; - - layouts.zoxide-picker = '' - layout { - pane command="${zellijNewTabZoxide}/bin/zellij-new-tab-zoxide" close_on_exit=true - pane size=1 borderless=true { - plugin location="compact-bar" - } - } - ''; - - settings = { - # Default shell (using bash as configured in your system) - default_shell = "bash"; - default_layout = "zoxide-picker"; - pane_frames = false; - simplified_ui = true; - - # Mouse and interaction settings - enable for proper pane handling - mouse_mode = true; - copy_on_select = true; - - show_startup_tips = false; - show_release_notes = false; - - attach_to_session = true; - session_name = "main"; - on_force_close = "detach"; - session_serialization = true; - serialize_pane_viewport = true; - - ui = { - pane_frames = { - hide_session_name = true; - }; - }; - }; - - extraConfig = '' - keybinds { - tab { - bind "n" { NewTab { layout "zoxide-picker"; }; SwitchToMode "Normal"; } - bind "N" { NewTab; SwitchToMode "Normal"; } - } - } - ''; - }; - - programs.eza = { - enable = true; - icons = "always"; - enableBashIntegration = true; - git = true; - extraOptions = [ - "--group-directories-first" - "--all" - ]; - }; - - programs.fzf = { - enable = true; - enableBashIntegration = true; - }; - - programs.zoxide = { - enable = true; - enableBashIntegration = true; - }; - - programs.direnv = { - enable = true; - enableBashIntegration = true; - nix-direnv.enable = true; - }; - - programs.bash = { - enable = true; - enableCompletion = true; - historyControl = [ - "ignoredups" - "erasedups" - ]; - historySize = 50000; - historyFileSize = 100000; - shellOptions = [ - "histappend" - "checkwinsize" - "globstar" - ]; - shellAliases = { - "dr" = "direnv reload"; - "da" = "direnv allow"; - "nfu" = "nix flake update"; - "o" = - "OPENCODE_PERMISSION='{\"*\":\"allow\",\"external_directory\":\"allow\",\"doom_loop\":\"allow\"}' opencode"; - "os" = "opencode"; - ".." = "z .."; - j = "jj"; - jgf = "jj git fetch"; - jgp = "jj git push"; - jgc = "jj git clone --colocate"; - jbs = "jj bookmark set"; - jd = "jj describe"; - js = "jj show"; - jss = "jj show -s"; - jab = "jj abandon"; - jsp = "jj split"; - je = "jj edit --ignore-immutable"; - jall = "jj log -r 'all()'"; - jn = "jj new"; - jdiff = "jj diff"; - jsq = "jj squash"; - h = "hx"; - t = "trash"; - vanity = "mkp224o-amd64-64-24k -d noisebridgevanitytor noisebridge{2..7}"; - }; - initExtra = '' - # Automatically list directory contents when changing directories - auto_l_on_cd() { - if [ "$__LAST_PWD" != "$PWD" ]; then - l - __LAST_PWD="$PWD" - fi - } - - export PROMPT_COMMAND="auto_l_on_cd; $PROMPT_COMMAND" - __LAST_PWD="$PWD" - ''; - }; - - programs.kitty = { - enable = true; - settings = { - hide_window_decorations = "yes"; - draw_minimal_borders = "yes"; - font_family = "CommitMono Nerd Font"; - font_size = "12"; - confirm_os_window_close = "0"; - enable_audio_bell = "no"; - }; - themeFile = "GitHub_Dark_High_Contrast"; - }; - - programs.jujutsu = { - enable = true; - settings = { - remotes.origin.auto-track-bookmarks = "glob:*"; - user = { - inherit email name; - }; - - signing = { - behavior = "own"; - backend = "ssh"; - key = sshSigningKey; - }; - - git = { - sign-on-push = true; - }; - ui = { - default-command = "log"; - editor = "hx"; - pager = "bat --style=plain"; - }; - diff.tool = [ - "difft" - "--color=always" - "$left" - "$right" - ]; - }; - }; - - # Configure Zen Browser with about:config settings - programs.zen-browser = { - enable = true; - policies = { - DisableTelemetry = true; - DisableFirefoxStudies = true; - DisablePocket = true; - DontCheckDefaultBrowser = true; - DisableAppUpdate = true; - DisableMasterPasswordCreation = true; - DisablePasswordReveal = true; - DisableProfileImport = true; - ExtensionUpdate = false; - OfferToSaveLogins = false; - DisableFirefoxAccounts = true; - DisableFormHistory = true; - DisableSafeMode = true; - DisableSetDesktopBackground = true; - EnableTrackingProtection = { - Value = true; - Locked = true; - Cryptomining = true; - Fingerprinting = true; - }; - HardwareAcceleration = true; - NoDefaultBookmarks = true; - PasswordManagerEnabled = false; - Preferences = { - "zen.theme.border-radius" = 0; - "zen.theme.content-element-separation" = 0; - }; - }; - profiles.default = { - isDefault = true; - settings = { - "identity.fxaccounts.enabled" = false; - }; - extensions.packages = with pkgs.nur.repos.rycee.firefox-addons; [ - ublock-origin - onepassword-password-manager - sponsorblock - darkreader - vimium - return-youtube-dislikes - react-devtools - firefox-color - pay-by-privacy - translate-web-pages - user-agent-string-switcher - copy-selected-tabs-to-clipboard - dearrow - violentmonkey - tst-indent-line - ]; - search = { - default = "SearXNG"; - privateDefault = "SearXNG"; - force = true; - engines = { - "SearXNG" = { - urls = [ { template = "https://search.extremist.software/search?q={searchTerms}"; } ]; - definedAliases = [ "@s" ]; - }; - }; - }; - }; - }; - - # Override the Kitty desktop entry to always launch in fullscreen - xdg.desktopEntries.kitty = { - name = "Kitty"; - genericName = "Terminal Emulator"; - exec = "${pkgs.kitty}/bin/kitty --start-as=fullscreen ${zellijPersistentSession}/bin/zellij-persistent-session"; - icon = "kitty"; - type = "Application"; - categories = [ - "System" - "TerminalEmulator" - ]; - comment = "Fast, featureful, GPU based terminal emulator"; - }; - - # Extract archives on double-click - xdg.desktopEntries.extract-here = { - name = "Extract Here"; - exec = "file-roller --extract-here %U"; - icon = "file-roller"; - type = "Application"; - categories = [ "Utility" ]; - mimeType = [ - "application/zip" - "application/x-tar" - "application/x-compressed-tar" - "application/x-bzip-compressed-tar" - "application/x-xz-compressed-tar" - "application/x-zstd-compressed-tar" - "application/gzip" - "application/x-7z-compressed" - "application/x-rar" - "application/x-rar-compressed" - ]; - noDisplay = true; - }; - - xdg.desktopEntries.betterbird = { - name = "Betterbird"; - genericName = "Mail Client"; - exec = "${pkgs.flatpak}/bin/flatpak run eu.betterbird.Betterbird %u"; - icon = "eu.betterbird.Betterbird"; - type = "Application"; - categories = [ - "Network" - "Email" - ]; - mimeType = [ - "x-scheme-handler/mailto" - "x-scheme-handler/webcal" - "text/calendar" - ]; - comment = "Fine-tuned Thunderbird mail client"; - }; - - # Autostart applications using proper desktop files - xdg.autostart = { - enable = true; - entries = [ - "${zenStartup}/share/applications/zen-startup.desktop" - "${kittyZellijStartup}/share/applications/kitty-zellij-startup.desktop" - "${signalStartup}/share/applications/signal-startup.desktop" - "${pkgs.slack}/share/applications/slack.desktop" - "${betterbirdStartup}/share/applications/betterbird-startup.desktop" - "${vesktopStartup}/share/applications/vesktop-startup.desktop" - "${zulipStartup}/share/applications/zulip-startup.desktop" - ]; - }; - - home.file.".local/share/gnome-shell/extensions/tailscale-gnome-qs@tailscale-qs.github.io" = { - source = "${tailscaleQsExtension}/share/gnome-shell/extensions/tailscale-gnome-qs@tailscale-qs.github.io"; - recursive = true; - }; - - systemd.user.services.nasa-apod-wallpaper = { - Unit = { - Description = "Fetch NASA APOD wallpaper"; - After = [ "graphical-session.target" ]; - PartOf = [ "graphical-session.target" ]; - }; - Service = { - Type = "oneshot"; - ExecStart = "${nasaApodWallpaper}/bin/nasa-apod-wallpaper"; - }; - }; - - systemd.user.timers.nasa-apod-wallpaper = { - Unit.Description = "Refresh NASA APOD wallpaper daily"; - Timer = { - OnStartupSec = "0"; - OnUnitActiveSec = "1d"; - Unit = "nasa-apod-wallpaper.service"; - }; - Install.WantedBy = [ "timers.target" ]; - }; - - # Set Zen Browser as default - xdg.mimeApps = { - enable = true; - defaultApplications = { - "text/html" = "zen-beta.desktop"; - "x-scheme-handler/http" = "zen-beta.desktop"; - "x-scheme-handler/https" = "zen-beta.desktop"; - "x-scheme-handler/about" = "zen-beta.desktop"; - "x-scheme-handler/unknown" = "zen-beta.desktop"; - "x-scheme-handler/mailto" = "betterbird.desktop"; - "inode/directory" = "org.gnome.Nautilus.desktop"; - "application/zip" = "org.gnome.FileRoller.desktop"; - "application/x-tar" = "org.gnome.FileRoller.desktop"; - "application/x-compressed-tar" = "org.gnome.FileRoller.desktop"; - "application/x-bzip-compressed-tar" = "org.gnome.FileRoller.desktop"; - "application/x-xz-compressed-tar" = "org.gnome.FileRoller.desktop"; - "application/x-zstd-compressed-tar" = "org.gnome.FileRoller.desktop"; - "application/gzip" = "org.gnome.FileRoller.desktop"; - "application/x-7z-compressed" = "org.gnome.FileRoller.desktop"; - "application/x-rar" = "org.gnome.FileRoller.desktop"; - "application/x-rar-compressed" = "org.gnome.FileRoller.desktop"; - }; - }; - - home.file.".config/opencode/opencode.json".text = builtins.toJSON { - "$schema" = "https://opencode.ai/config.json"; - autoupdate = false; - plugin = [ "opencode-with-claude" ]; - mcp.linear = { - type = "remote"; - url = "https://mcp.linear.app/mcp"; - enabled = true; - }; - model = "openai/gpt-5.4-fast"; - small_model = "openai/gpt-5.4-mini-fast"; - provider.openai.models."gpt-5.4-fast".options = { - reasoningEffort = "xhigh"; - }; - share = "disabled"; - }; - - home.file.".config/opencode/AGENTS.md".text = '' - # NixOS Rules - - - This machine is NixOS. Prefer the Nix way for installing and running tools. - - Do not suggest `apt`, `dnf`, `pacman`, `brew`, `npm -g`, `pip install`, `cargo install`, `curl | sh`, or manual installers unless explicitly asked. - - If a repo has `flake.nix`, treat it as the source of truth for project tooling. - - If a needed tool belongs to the project, add it to `flake.nix` or the dev shell instead of installing it another way. - - If a repo has `flake.nix`, ensure `.envrc` contains `use flake` unless the repo intentionally uses a different setup. - - If there is no `flake.nix` and the tool is only needed temporarily, prefer `nix shell nixpkgs# -c `. - - For persistent tools, prefer declarative Nix configuration. - - Prefer `direnv` or `nix develop` before deciding a tool is missing. - - Never run `nixos-rebuild`, `nh os switch`, `nhs`, or other system switch commands unless explicitly asked. - ''; - - home.file.".config/opencode/tui.json".text = builtins.toJSON { - "$schema" = "https://opencode.ai/tui.json"; - keybinds = { - leader = "ctrl+x"; - command_list = "p"; - variant_cycle = "t"; - }; - }; - - xdg.userDirs = { - enable = true; - setSessionVariables = true; - }; - - gtk = { - enable = true; - gtk4.theme = config.gtk.theme; - gtk3.extraConfig.gtk-application-prefer-dark-theme = 1; - }; - -} diff --git a/hosts/laptop/hardware-configuration.nix b/hosts/laptop/hardware-configuration.nix new file mode 100644 index 0000000..0b89762 --- /dev/null +++ b/hosts/laptop/hardware-configuration.nix @@ -0,0 +1,40 @@ +# 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" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/ad656dd1-ef88-4930-b8dd-f61765bdc067"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/16AA-5446"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/cc53c40a-4c06-4fcf-844e-8e55147fc2ae"; } + ]; + + # 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.enp0s31f6.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/laptop/user.nix b/hosts/laptop/user.nix new file mode 100644 index 0000000..82c2e9c --- /dev/null +++ b/hosts/laptop/user.nix @@ -0,0 +1,24 @@ +{ config, lib, inputs, ...}: + +{ + imports = [ ../../modules/default.nix ]; + config.modules = { + # gui + firefox.enable = true; + kitty.enable = true; + eww.enable = true; + dunst.enable = true; + hyprland.enable = true; + wofi.enable = true; + + # cli + nvim.enable = true; + git.enable = true; + nushell.enable = true; + direnv.enable = true; + + # system + xdg.enable = true; + packages.enable = true; + }; +} diff --git a/lib/default.nix b/lib/default.nix new file mode 100644 index 0000000..c9d221d --- /dev/null +++ b/lib/default.nix @@ -0,0 +1,3 @@ +inputs: { + mkSystem = import ./mkSystem.nix inputs; +} diff --git a/lib/mkSystem.nix b/lib/mkSystem.nix new file mode 100644 index 0000000..5ae4789 --- /dev/null +++ b/lib/mkSystem.nix @@ -0,0 +1,11 @@ +{ self, ... } @ inputs: name: system: inputs.nixpkgs.lib.nixosSystem ( + { + inherit system; + specialArgs = { inherit inputs self; }; + modules = [ + "${self}/hosts/${name}/system.nix" + "${self}/hosts/${name}/user.nix" + inputs.home-manager.nixosModule + ]; + } +) diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..77a2de4 --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,24 @@ +{ inputs, pkgs, config, ... }: + +{ + home.stateVersion = "21.03"; + imports = [ + # gui + ./firefox + ./eww + ./dunst + ./kitty + ./hyprland + ./wofi + + # cli + ./nvim + ./nushell + ./git + ./direnv + + # system + ./xdg + ./packages + ]; +} diff --git a/modules/direnv/default.nix b/modules/direnv/default.nix new file mode 100644 index 0000000..9db2079 --- /dev/null +++ b/modules/direnv/default.nix @@ -0,0 +1,14 @@ +{ pkgs, lib, config, ... }: + +with lib; +let cfg = config.modules.direnv; + +in { + options.modules.direnv= { enable = mkEnableOption "direnv"; }; + config = mkIf cfg.enable { + programs.direnv = { + enable = true; + nix-direnv.enable = true; + }; + }; +} diff --git a/modules/dunst/default.nix b/modules/dunst/default.nix new file mode 100644 index 0000000..1dc85ac --- /dev/null +++ b/modules/dunst/default.nix @@ -0,0 +1,42 @@ +{ pkgs, lib, config, ... }: + +with lib; +let cfg = config.modules.dunst; + +in { + options.modules.dunst = { enable = mkEnableOption "dunst"; }; + config = mkIf cfg.enable { + home.packages = with pkgs; [ + dunst + ]; + + services.dunst = { + enable = true; + settings = { + global = { + origin = "top-left"; + offset = "60x12"; + separator_height = 2; + padding = 12; + horizontal_padding = 12; + text_icon_padding = 12; + frame_width = 4; + separator_color = "frame"; + idle_threshold = 120; + font = "JetBrainsMono Nerdfont 12"; + line_height = 0; + format = "%s\n%b"; + alignment = "center"; + icon_position = "off"; + startup_notification = "false"; + corner_radius = 12; + + frame_color = "#44465c"; + background = "#303241"; + foreground = "#d9e0ee"; + timeout = 2; + }; + }; + }; + }; +} diff --git a/modules/eww/default.nix b/modules/eww/default.nix new file mode 100644 index 0000000..2eae452 --- /dev/null +++ b/modules/eww/default.nix @@ -0,0 +1,50 @@ +{ inputs, lib, config, pkgs, ... }: +with lib; +let + cfg = config.modules.eww; +in { + options.modules.eww = { enable = mkEnableOption "eww"; }; + + config = mkIf cfg.enable { + # theres no programs.eww.enable here because eww looks for files in .config + # thats why we have all the home.files + + # eww package + home.packages = with pkgs; [ + eww + pamixer + brightnessctl + (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) + ]; + + # configuration + home.file.".config/eww/eww.scss".source = ./eww.scss; + home.file.".config/eww/eww.yuck".source = ./eww.yuck; + + # scripts + home.file.".config/eww/scripts/battery.sh" = { + source = ./scripts/battery.sh; + executable = true; + }; + + home.file.".config/eww/scripts/wifi.sh" = { + source = ./scripts/wifi.sh; + executable = true; + }; + + home.file.".config/eww/scripts/brightness.sh" = { + source = ./scripts/brightness.sh; + executable = true; + }; + + home.file.".config/eww/scripts/workspaces.sh" = { + source = ./scripts/workspaces.sh; + executable = true; + }; + + home.file.".config/eww/scripts/workspaces.lua" = { + source = ./scripts/workspaces.lua; + executable = true; + }; + }; +} diff --git a/modules/eww/eww.scss b/modules/eww/eww.scss new file mode 100644 index 0000000..88f0320 --- /dev/null +++ b/modules/eww/eww.scss @@ -0,0 +1,291 @@ +$base: #44465c; +$blue: #3fc6de; +$surface0: #44465c; +$surface1: #44465c; +$text: #d9e0ee; +$overlay0: #6e738d; +$red: #ec6a88; +$peach: #efb993; +$yellow: #efb993; +$mauve: #b072d1; +$green: #3fdaa4; +$mantle: #292a37; +$crust: #2e303e; +$light-gray: #9699b7; + +* { + all: unset; //Unsets everything so you can style everything from scratch + font-family: "JetBrainsMono" +} + +.icon { + font-family: monospace; + font-size: 1.4rem; +} + + +button { + transition: background-color 200ms, color 200ms; +} + +.active { + color: $green; + font-size: 1.4rem; +} + +.inactive { + color: $base; + font-size: 1.4rem; +} + +.inactive:hover { + color: $light-gray; +} + +.bar { + background-color: $mantle; + border-left: 4px dotted $red; +} + +.dashboard { + background-color: $mantle; + padding: 1rem; + margin-bottom: 1rem; +} + +.cal-box { + padding: 1rem 1rem .2rem; +} + +.cal { + padding: 0; + border-radius: 8px; +} + +.calendar_box { + padding: 1rem; + calendar:selected { + color: $blue; + } + + calendar.header { + color: $blue; + font-weight: bold; + } + + calendar.button { + color: $blue; + } + + calendar.highlight { + color: $green; + font-weight: bold; + } + + calendar:indeterminate { + color: rgba(205, 219, 249, 0.3); + } +} + +.sysinfo_box { + padding: 1rem; + .iconmem { + font-size: 3rem; + color: $yellow; + } + .iconcpu { + font-size: 3rem; + color: $blue; + } + .icondisk { + font-size: 3rem; + color: $green; + } + .cpubar, .membar, .diskbar { + background-color: $crust; + } +} +.slider_box { + padding: 0 1rem; + scale { + background-color: $crust; + border-radius: 100px; + margin: 0.5rem 0; + } + + scale trough { + border-radius: 100px; + } + + scale highlight { + padding: 8px; + margin: 8px; + border-radius: 100px; + } + + .brightness_slider highlight { + background-color: $yellow; + } + + .volume_slider highlight { + background-color: $blue; + } + + .micvolume_slider highlight { + background-color: $green; + } + + .slider_icon { + font-size: 2rem; + padding-right: 0.75rem; + } +} + +.notification_box { +} + +.wifi { + font-size: 2rem; + color: $blue; +} + +.clock { + font-weight: bold; + background-color: $base; + color: $text; + border-radius: 10px; + padding: 0.2rem; + margin: 0.5rem; +} + +.cpubar { + color: $blue; + background-color: $surface1; + margin: 4px 0; +} + +.diskbar { + color: $green; + background-color: $surface1; + margin: 4px 0; +} + +.membar { + color: $yellow; + background-color: $surface1; + margin: 4px 0; +} + +.iconmem, .iconcpu, .icondisk { + color: $base; + font-size: 2.5rem; +} + +.date { + font-size: 1.5rem; +} + +.reg-btn { + font-size: 2rem; + margin: 2px 8px; + border-radius: 10px; +} + +.dashbutton { + color: $mauve; +} + +.dashbutton:hover { + background-color: $base; +} + +.dashbutton:active { + background-color: $mauve; + color: $mantle; +} + +.powerbutton { + color: $red; +} + +.powerbutton:hover { + background-color: $base; +} + +.powerbutton:active { + background-color: $red; + color: $mantle; +} + +.launchbutton { + background-color: $blue; + color: $mantle; + margin-top: 6px; +} + +.launchbutton:hover { + background-color: $mauve; +} + +.launchbutton:active { + color: $mauve; + background-color: $mantle; +} + +.battery { + font-size: 1.5rem; + color: $blue; +} + +// Credits AlphaTechnolog +.powermenu-box { + padding: 0 2px; + margin: 7px 7px 7px 0px; + background: inherit; + .dispatcher { + border-radius: 15px; + background: $base; + color: $red; + font-size: 14px; + padding: 0 14px 0 10px; + &:hover { background-color: $surface0; } + &:active { background-color: $surface1; } + } +} + +// powermenu +.powermenu-container { + background: $crust; + color: $text; + padding: 10px; + font-size: 55px; + + transition: all 200ms cubic-bezier(.1,-0.00,.0,1.49); + + .btn { margin: 1rem;} + // shutdown + .shutdown-btn-box .btn { + color: $red; + border-radius: 15px; + background-color: $mantle; + &:hover { background-color: $base; } + &:active { background-color: $surface1; } + } + // reboot + .reboot-btn-box .btn { + color: $mauve; + border-radius: 15px; + background-color: $mantle; + &:hover { background-color: $base; } + &:active { background-color: $surface1; } + } + // exit + .exit-btn-box .btn { + color: $yellow; + border-radius: 15px; + background-color: $mantle; + &:hover { background-color: $base; } + &:active { background-color: $surface1; } + } +} + diff --git a/modules/eww/eww.yuck b/modules/eww/eww.yuck new file mode 100644 index 0000000..ec30798 --- /dev/null +++ b/modules/eww/eww.yuck @@ -0,0 +1,295 @@ +(defwidget bar [] + (centerbox :orientation "v" :hexpand false + (box :valign "start" :hexpand false :vexpand true :orientation "v" :space-evenly false + (launch) + (dashbutton) + (powerbutton) + ) + + (workspaces :halign "center" :vexpand true :hexpand false :orientation "v") + + (box :valign "end" :hexpand false :vexpand true :orientation "v" :space-evenly false + (battery) + (wifi) + (mem :thickness 4 :icon "") + (cpu :thickness 4 :icon "") + (disk :thickness 4 :icon "") + (time) + ) + ) +) + +(defpoll brightness :interval "999h" :initial 0 `brightnessctl -m | awk -F, '{print substr($4, 0, length($4)-1)}'`) +(defpoll volume :interval "999h" :initial 0 `pamixer --get-volume`) +(defpoll micvolume :interval "999h" :initial 0 `pamixer --get-volume --source 1`) +(defwidget dashboard [] + (box :orientation "v" + (box :class "info_box" :orientation "v" :space-evenly false + (box :class "calendar_box" + (calendar :width 200 :class "cal") + ) + + (box :class "slider_box" :orientation "v" :vexpand false :hexpand false + (box :space-evenly false + (label :class "slider_icon" :text "") + (scale :min 1 :max 101 :width 315 :class "brightness_slider" :value brightness :onchange "brightnessctl set {}%" :height 10) + ) + (box :space-evenly false + (label :class "slider_icon" :text "墳") + (scale :min 1 :max 101 :width 315 :class "volume_slider" :value volume :onchange "pamixer --set-volume $(echo {} | sed 's/[.].*$//')") + ) + (box :space-evenly false + (label :class "slider_icon" :text "") + (scale :min 1 :max 101 :width 315 :class "micvolume_slider" :value micvolume :onchange "pamixer --set-volume $(echo {} | sed 's/[.].*$//') --source 1") + ) + ) + (box :class "sysinfo_box" :orientation "h" :vexpand true :spacing 15 + (mem :thickness 12 :icon "") + (cpu :thickness 12 :icon "") + (disk :thickness 12 :icon "") + ) + ) + (box :class "notification_box" + ) + ) +) + + + + +;; Variables +(defvar time false) +(defvar cal false) + +;; ━━━ WIDGETS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +;; ━━━ MEMORY ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +(defwidget dashbutton[] + (button :class "reg-btn dashbutton" :onclick "eww open dashboard --toggle" "舘") +) + + + +;; ━━━ MEMORY ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +(defwidget mem [icon thickness] + (box :vexpand "false" :hexpand "false" + (circular-progress :value {EWW_RAM.used_mem_perc} + :class "membar" + :thickness {thickness} + :start-at 75 + + (label :class "iconmem" :text {icon}) + ) + ) +) + +;; ━━━ CPU ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +(defwidget cpu [icon thickness] + (box :vexpand "false" :hexpand "false" + (circular-progress :value {EWW_CPU.avg} + :class "cpubar" + :thickness {thickness} + :start-at 75 + + (label :class "iconcpu" :text {icon}) + ) + ) +) + +;; ━━━ DISK ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +(defwidget disk [icon thickness] + (box :vexpand "false" :hexpand "false" + (circular-progress :value {EWW_DISK["/"].used_perc} + :class "diskbar" + :thickness {thickness} + :start-at 75 + (label :class "icondisk" :text {icon}) + + ) + ) +) + + +;; ━━━ WIFI ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +(defvar wifi "{}") +(defpoll wifi :interval "30s" "./scripts/wifi.sh") + +(defwidget wifi [] + (box :vexpand false :hexpand false :orientation "v" + (label :text {wifi.icon} + :limit-width 10 + :tooltip {wifi.status} + :class "wifi" + ) + ) +) + +;; ━━━ BATTERY ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +(defvar battery "{}") +(defpoll battery :interval "60s" "./scripts/battery.sh") + +(defwidget battery [] + (label :text {battery.icon} + :limit-width 10 + :tooltip "${battery.status}: ${battery.percent}" + :class "battery" + ) +) + + +;; ━━━ VOLUME ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +(defvar volume-level 50) +(defvar volume-muted false) + +(defwindow volume + :monitor 0 + :geometry (geometry :y "100px" :x "0px" :width "250px" :height "200px" :anchor "center bottom") + :windowtype "dock" + :wm-ignore true + :stacking "fg" + + (box :class "volume-window" + :orientation "v" + :space-evenly "false" + (box :class "volume-widget" + :orientation "h" + :space-evenly false + :spacing 10 + (label :text {volume-muted ? "" : + volume-level == 0 ? "" : + volume-level < 32 ? "" : + volume-level < 65 ? "" : + ""} + + :class 'volume-icon ${volume-muted ? "volume-icon-muted" : ""}' + ) + (scale :class 'volume-slider ${volume-muted ? "volume-slider-muted" : ""}' + :hexpand "true" + :min 0 + :max 100 + :height 8 + :marks true + :value volume-level + :onchange "pamixer --set-volume {}")))) + +;; ━━━ TIME ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +(defpoll hour :interval "10s" "date +%H") +(defpoll minute :interval "10s" "date +%M") +(defpoll dateVar :interval "600s" "date '+%A %d.%m.%y'") + +(defwidget time [] + (eventbox :cursor "hand" :hexpand false :vexpand false + :tooltip "${dateVar}" + (box :orientation "v" :hexpand false :vexpand false :space-evenly false :class "clock" + (button :class "date" + :onclick "" "${hour}") + + (button :class "date" + :onclick "" "${minute}") + ) + ) +) + + + + +(defvar bright-level 50) +(defvar bright-muted false) +(defwindow brightness + :monitor 0 + :geometry (geometry :y "-60px" :x "60px" :width "300px" :height "150px" :anchor "bottom left") + :wm-ignore true + :stacking "fg" + + (box :class "volume-window" + :orientation "v" + :space-evenly "false" + (box :class "volume-widget" + :orientation "h" + :space-evenly false + :spacing 10 + (label :text "" + :class 'volume-icon' + ) + (scale :class 'volume-slider' + :hexpand "true" + :min 0 + :max 100 + :height 8 + :marks true + :value bright-level + :onchange "brightnessctl set {}%")))) +(defwidget launch [] + (button :class "reg-btn launchbutton" + :hexpand true + :onclick "wofi --show run --xoffset=1670 --yoffset=12 --width=230px --height=984 --style=$HOME/.config/wofi.css --term=kittyclient --prompt=Run &" "") +) + +(defwidget powerbutton [] + (eventbox :cursor "hand" + (button :class "reg-btn powerbutton" + :onclick "eww open powermenu --toggle &" "") + ) +) + (defwidget powermenucontent [] + (box :orientation "h" + :class "powermenu-container" + (box :class "shutdown-btn-box" + :orientation "h" + (button :class "btn" + :tooltip "Shutdown" + :onclick "eww close powermenu && shutdown now" + "⏻") + ) + (box :class "reboot-btn-box" + :orientation "h" + (button :class "btn" + :tooltip "Reboot" + :onclick "eww close powermenu && reboot" + "") + ) + (box :class "exit-btn-box" + :orientation "h" + (button :class "btn" + :tooltip "Suspend" + :onclick "systemctl suspend" + "") + ) + ) +) + +(defwindow powermenu + :monitor 0 + :geometry (geometry :x "0%" + :y "0%" + :width "30%" + :height "15%" + :anchor "center center") + :wm-ignore true + (powermenucontent)) + +(deflisten workspaces_listen "./scripts/workspaces.sh") +(defwidget workspaces [] + (literal :content workspaces_listen)) + +(defwindow dashboard + :monitor 0 + :geometry (geometry + :height "1080px" + :width "350px" + :x "48px" + :y "0px" + :anchor "top left") + :stacking "fg" + :class "dashboard" + (dashboard)) + +(defwindow bar + :monitor 0 + :exclusive false + :geometry (geometry :height "1080px" :x "-4px" :y "0px" + :width "52px" + :anchor "top left") + :stacking "fg" + (bar)) diff --git a/modules/eww/scripts/battery.sh b/modules/eww/scripts/battery.sh new file mode 100755 index 0000000..46fe3f8 --- /dev/null +++ b/modules/eww/scripts/battery.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +bat=/sys/class/power_supply/BAT1/ +per="$(cat "$bat/capacity")" +status="$(cat "$bat/status")" + +if [ "$per" -gt "90" ]; then + icon="" +elif [ "$per" -gt "80" ]; then + icon="" +elif [ "$per" -gt "70" ]; then + icon="" +elif [ "$per" -gt "60" ]; then + icon="" +elif [ "$per" -gt "50" ]; then + icon="" +elif [ "$per" -gt "40" ]; then + icon="" +elif [ "$per" -gt "30" ]; then + icon="" +elif [ "$per" -gt "20" ]; then + icon="" +elif [ "$per" -gt "10" ]; then + icon="" +elif [ "$per" -gt "0" ]; then + icon="" +else + icon="" +fi + + + + +if [ -s /sys/class/power_supply/BAT1/capacity ]; then + echo "{\"percent\": \"$per\", \"icon\": \"$icon\", \"charging\": \"$charging\", \"visible\": \"true\", \"status\": \"$status\"}" +else + echo "{\"visible\": \"false\" }" +fi diff --git a/modules/eww/scripts/brightness.sh b/modules/eww/scripts/brightness.sh new file mode 100755 index 0000000..47f9d4e --- /dev/null +++ b/modules/eww/scripts/brightness.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +if eww windows | grep -q "\*brightness"; then + eww update bright-level="$(brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}' | tr -d '%')" +else + eww close volume + eww open brightness + + eww update bright-level="$(brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}' | tr -d '%')" + sleep 2 + sleep 1 + eww close brightness +fi diff --git a/modules/eww/scripts/volume.sh b/modules/eww/scripts/volume.sh new file mode 100755 index 0000000..974530b --- /dev/null +++ b/modules/eww/scripts/volume.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +if eww windows | rg -q "\*volume"; then + eww update volume-level=$(pamixer --get-volume) + eww update volume-muted=$(pamixer --get-mute) + eww update volume-hidden=false +else + eww close brightness + eww open volume + + eww update volume-level=$(pamixer --get-volume) + eww update volume-muted=$(pamixer --get-mute) + eww update volume-hidden=false + sleep 2 + eww update volume-hidden=true + sleep 1 + eww close volume +fi diff --git a/modules/eww/scripts/wifi.sh b/modules/eww/scripts/wifi.sh new file mode 100755 index 0000000..02cbf34 --- /dev/null +++ b/modules/eww/scripts/wifi.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +if iwctl station wlan0 show | grep -q "connected"; then + icon="" + ssid=Amadeus + status="Connected to ${ssid}" +else + icon="睊" + status="offline" +fi + +echo "{\"icon\": \"${icon}\", \"status\": \"${status}\"}" diff --git a/modules/eww/scripts/workspaces.lua b/modules/eww/scripts/workspaces.lua new file mode 100755 index 0000000..cb0ec28 --- /dev/null +++ b/modules/eww/scripts/workspaces.lua @@ -0,0 +1,30 @@ +#!/usr/bin/env lua + +function trim(s) + return (string.gsub(s, "^%s*(.-)%s*$", "%1")) +end + +aw = io.popen("hyprctl monitors | grep active | sed 's/()/(1)/g' | sort | awk 'NR>1{print $1}' RS='(' FS=')'") +active_workspace = aw:read("*a") +aw:close() + +ew = io.popen("hyprctl workspaces | grep ID | sed 's/()/(1)/g' | sort | awk 'NR>1{print $1}' RS='(' FS=')'") +existing_workspaces = ew:read("*a") +ew:close() + +box = "(box :orientation \"v\" :spacing 1 :space-evenly \"true\" " + +for i = 1, #existing_workspaces do + local c = existing_workspaces:sub(i,i) + if tonumber(c) == tonumber(active_workspace) then + local btn = "(button :class \"active\" :onclick \"hyprctl dispatch workspace "..c.." \" \"\")" + box = box .. btn + elseif c ~= "\n" then + local btn = "(button :class \"inactive\" :onclick \"hyprctl dispatch workspace "..c.."\" \"\")" + box = box .. btn + end +end + +box = box .. ")" + +print(box) diff --git a/modules/eww/scripts/workspaces.sh b/modules/eww/scripts/workspaces.sh new file mode 100755 index 0000000..9ff9739 --- /dev/null +++ b/modules/eww/scripts/workspaces.sh @@ -0,0 +1,9 @@ +#!/bin/sh +workspaces() { +./scripts/workspaces.lua +} +workspaces +tail -f /tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/hyprland.log | grep --line-buffered "Changed to workspace" | while read -r; do +workspaces +done + diff --git a/modules/firefox/default.nix b/modules/firefox/default.nix new file mode 100644 index 0000000..168ed2b --- /dev/null +++ b/modules/firefox/default.nix @@ -0,0 +1,98 @@ +{ inputs, lib, config, pkgs, ... }: +with lib; +let + cfg = config.modules.eww; + +in { + options.modules.firefox = { enable = mkEnableOption "firefox"; }; + + config = mkIf cfg.enable { + programs.firefox = { + profiles = { + default = { + enable = true; + + # Install extensions from NUR + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + decentraleyes + ublock-origin + clearurls + sponsorblock + darkreader + h264ify + df-youtube + ]; + + # Privacy about:config settings + profiles.notus = { + settings = { + "browser.send_pings" = false; + "browser.urlbar.speculativeConnect.enabled" = false; + "dom.event.clipboardevents.enabled" = true; + "media.navigator.enabled" = false; + "network.cookie.cookieBehavior" = 1; + "network.http.referer.XOriginPolicy" = 2; + "network.http.referer.XOriginTrimmingPolicy" = 2; + "beacon.enabled" = false; + "browser.safebrowsing.downloads.remote.enabled" = false; + "network.IDN_show_punycode" = true; + "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; + "app.shield.optoutstudies.enabled" = false; + "dom.security.https_only_mode_ever_enabled" = true; + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + "browser.toolbars.bookmarks.visibility" = "never"; + "geo.enabled" = false; + + # Disable telemetry + "browser.newtabpage.activity-stream.feeds.telemetry" = false; + "browser.ping-centre.telemetry" = false; + "browser.tabs.crashReporting.sendReport" = false; + "devtools.onboarding.telemetry.logged" = false; + "toolkit.telemetry.enabled" = false; + "toolkit.telemetry.unified" = false; + "toolkit.telemetry.server" = ""; + + # Disable Pocket + "browser.newtabpage.activity-stream.feeds.discoverystreamfeed" = false; + "browser.newtabpage.activity-stream.feeds.section.topstories" = false; + "browser.newtabpage.activity-stream.section.highlights.includePocket" = false; + "browser.newtabpage.activity-stream.showSponsored" = false; + "extensions.pocket.enabled" = false; + + # Disable prefetching + "network.dns.disablePrefetch" = true; + "network.prefetch-next" = false; + + # Disable JS in PDFs + "pdfjs.enableScripting" = false; + + # Harden SSL + "security.ssl.require_safe_negotiation" = true; + + # Extra + "identity.fxaccounts.enabled" = false; + "browser.search.suggest.enabled" = false; + "browser.urlbar.shortcuts.bookmarks" = false; + "browser.urlbar.shortcuts.history" = false; + "browser.urlbar.shortcuts.tabs" = false; + "browser.urlbar.suggest.bookmark" = false; + "browser.urlbar.suggest.engines" = false; + "browser.urlbar.suggest.history" = false; + "browser.urlbar.suggest.openpage" = false; + "browser.urlbar.suggest.topsites" = false; + "browser.uidensity" = 1; + "media.autoplay.enabled" = false; + "toolkit.zoomManager.zoomValues" = ".8,.90,.95,1,1.1,1.2"; + + "privacy.firstparty.isolate" = true; + "network.http.sendRefererHeader" = 0; + }; + + # userChome.css to make it look better + userChrome = builtins.readFile ./userChrome.css; + }; + }; + }; + }; + }; +} diff --git a/modules/firefox/userChrome.css b/modules/firefox/userChrome.css new file mode 100644 index 0000000..a5a4a4e --- /dev/null +++ b/modules/firefox/userChrome.css @@ -0,0 +1,69 @@ +* { + box-shadow: none !important; + border: 0px solid !important; +} + +#tabbrowser-tabs { + --user-tab-rounding: 8px; +} + +.tab-background { + border-radius: var(--user-tab-rounding) var(--user-tab-rounding) 0px 0px !important; + /* Connected */ + margin-block: 1px 0 !important; + /* Connected */ +} + +#scrollbutton-up, +#scrollbutton-down { + /* 6/10/2021 */ + border-top-width: 1px !important; + border-bottom-width: 0 !important; +} + +.tab-background:is([selected], [multiselected]):-moz-lwtheme { + --lwt-tabs-border-color: rgba(0, 0, 0, 0.5) !important; + border-bottom-color: transparent !important; +} + +[brighttext='true'] .tab-background:is([selected], [multiselected]):-moz-lwtheme { + --lwt-tabs-border-color: rgba(255, 255, 255, 0.5) !important; + border-bottom-color: transparent !important; +} + +/* Container color bar visibility */ +.tabbrowser-tab[usercontextid]>.tab-stack>.tab-background>.tab-context-line { + margin: 0px max(calc(var(--user-tab-rounding) - 3px), 0px) !important; +} + +#TabsToolbar, +#tabbrowser-tabs { + --tab-min-height: 29px !important; +} + +#main-window[sizemode='true'] #toolbar-menubar[autohide='true']+#TabsToolbar, +#main-window[sizemode='true'] #toolbar-menubar[autohide='true']+#TabsToolbar #tabbrowser-tabs { + --tab-min-height: 30px !important; +} + +#scrollbutton-up, +#scrollbutton-down { + border-top-width: 0 !important; + border-bottom-width: 0 !important; +} + +#TabsToolbar, +#TabsToolbar>hbox, +#TabsToolbar-customization-target, +#tabbrowser-arrowscrollbox { + max-height: calc(var(--tab-min-height) + 1px) !important; +} + +#TabsToolbar-customization-target toolbarbutton>.toolbarbutton-icon, +#TabsToolbar-customization-target .toolbarbutton-text, +#TabsToolbar-customization-target .toolbarbutton-badge-stack, +#scrollbutton-up, +#scrollbutton-down { + padding-top: 7px !important; + padding-bottom: 6px !important; +} \ No newline at end of file diff --git a/modules/git/default.nix b/modules/git/default.nix new file mode 100644 index 0000000..b2d9f65 --- /dev/null +++ b/modules/git/default.nix @@ -0,0 +1,21 @@ +{ pkgs, lib, config, ... }: + +with lib; +let cfg = config.modules.git; + +in { + options.modules.git = { enable = mkEnableOption "git"; }; + config = mkIf cfg.enable { + programs.git = { + enable = true; + userName = "notusknot"; + userEmail = "notusknot@gmail.com"; + extraConfig = { + init = { defaultBranch = "main"; }; + core = { + excludesfile = "$NIXOS_CONFIG_DIR/scripts/gitignore"; + }; + }; + }; + }; +} diff --git a/modules/hyprland/default.nix b/modules/hyprland/default.nix new file mode 100644 index 0000000..5138eb4 --- /dev/null +++ b/modules/hyprland/default.nix @@ -0,0 +1,15 @@ +{ inputs, pkgs, lib, config, ... }: + +with lib; +let cfg = config.modules.hyprland; + +in { + options.modules.hyprland= { enable = mkEnableOption "hyprland"; }; + config = mkIf cfg.enable { + home.packages = with pkgs; [ + wofi swaybg wlsunset wl-clipboard hyprland + ]; + + home.file.".config/hypr/hyprland.conf".source = ./hyprland.conf; + }; +} diff --git a/modules/hyprland/hyprland.conf b/modules/hyprland/hyprland.conf new file mode 100644 index 0000000..bda3854 --- /dev/null +++ b/modules/hyprland/hyprland.conf @@ -0,0 +1,90 @@ +monitor=eDP-1,1920x1080@60,0x0,1 +monitor=eDP-1,addreserved,0,0,48,0 + +exec-once=swaybg -i $NIXOS_CONFIG_DIR/pics/wallpaper.png +exec-once=kitty --server +exec-once=wlsunset -l -23 -L -46 +exec-once=eww daemon +exec-once=eww open bar +exec-once=dunst + +input { + follow_mouse=0 +} + +general { + sensitivity=1 + main_mod=ALT + + gaps_in=6 + gaps_out=12 + border_size=4 + col.active_border=0xffb072d1 + col.inactive_border=0xff292a37 + + damage_tracking=full +} + +decoration { + rounding=8 + blur=0 + drop_shadow=0 + shadow_range=60 + col.shadow=0x66000000 +} + +animations { + enabled=1 + animation=windows,1,4,default,slide + animation=borders,1,5,default + animation=fadein,1,5,default + animation=workspaces,1,3,default,vertslide +} + +dwindle { + pseudotile=0 # enable pseudotiling on dwindle +} + +# example window rules +# for windows named/classed as abc and xyz +windowrule=float,move 0 0,pqiv +windowrule=float,kitty-notes +#windowrule=size 420 69,abc +#windowrule=tile,xyz +#windowrule=float,abc +#windowrule=pseudo,abc +#windowrule=monitor 0,xyz + +# example binds +bind=ALT,Return,exec,kittyclient +bind=ALTSHIFT,Q,killactive, +bind=ALT,V,togglefloating, +bind=ALT,R,exec,wofi --show run --xoffset=1670 --yoffset=12 --width=230px --height=984 --style=$HOME/.config/wofi.css --term=kittyclient --prompt=Run +bind=ALT,F,fullscreen,0 + +bind=ALT,h,movefocus,l +bind=ALT,l,movefocus,r +bind=ALT,k,movefocus,u +bind=ALT,j,movefocus,d + +bind=ALTSHIFT,h,movewindow,l +bind=ALTSHIFT,l,movewindow,r +bind=ALTSHIFT,k,movewindow,u +bind=ALTSHIFT,j,movewindow,d + +bind=ALT,1,workspace,1 +bind=ALT,2,workspace,2 +bind=ALT,3,workspace,3 +bind=ALT,4,workspace,4 +bind=ALT,5,workspace,5 + +bind=ALTSHIFT,exclam,movetoworkspacesilent,1 +bind=ALTSHIFT,at,movetoworkspacesilent,2 +bind=ALTSHIFT,numbersign,movetoworkspacesilent,3 +bind=ALTSHIFT,dollar,movetoworkspacesilent,4 +bind=ALTSHIFT,percent,movetoworkspacesilent,5 + +bind=,XF86MonBrightnessUp,exec,brightnessctl set +5% +bind=,XF86MonBrightnessDown,exec,brightnessctl set 5%- +bind=,XF86AudioRaiseVolume,exec,pamixer -i 5 +bind=,XF86AudioLowerVolume,exec,pamixer -d 5 diff --git a/modules/kitty/default.nix b/modules/kitty/default.nix new file mode 100644 index 0000000..c8108c8 --- /dev/null +++ b/modules/kitty/default.nix @@ -0,0 +1,14 @@ +{ pkgs, lib, config, ... }: + +with lib; +let cfg = config.modules.kitty; + +in { + options.modules.kitty = { enable = mkEnableOption "kitty"; }; + config = mkIf cfg.enable { + programs.kitty = { + enable = true; + extraConfig = builtins.readFile ./kitty.conf; + }; + }; +} diff --git a/modules/kitty/kitty.conf b/modules/kitty/kitty.conf new file mode 100644 index 0000000..5629bfa --- /dev/null +++ b/modules/kitty/kitty.conf @@ -0,0 +1,243 @@ +# vim:fileencoding=utf-8:ft=conf + +# Font family. You can also specify different fonts for the +# bold/italic/bold-italic variants. By default they are derived automatically, +# by the OSes font system. Setting them manually is useful for font families +# that have many weight variants like Book, Medium, Thick, etc. For example: +# font_family Operator Mono Book +# bold_font Operator Mono Thick +# bold_italic_font Operator Mono Medium +# font_family Input Mono +font_family JetBrainsMono Nerdfont +italic_font auto +bold_font auto +bold_italic_font auto + +# Font size (in pts) +font_size 12.0 + +# The foreground color +foreground #c0b18b + +# The background color +background #262626 + +# The foreground for selections +selection_foreground #2f2f2f + +# The background for selections +selection_background #d75f5f + +# The cursor color +cursor #8fee96 + +# The cursor shape can be one of (block, beam, underline) +shell_integration no-cursor +cursor_shape block + +# The interval (in seconds) at which to blink the cursor. Set to zero to +# disable blinking. +cursor_blink_interval 0.5 + +# Stop blinking cursor after the specified number of seconds of keyboard inactivity. Set to +# zero or a negative number to never stop blinking. +cursor_stop_blinking_after 15.0 + +# Number of lines of history to keep in memory for scrolling back +scrollback_lines 2000 + +# Program with which to view scrollback in a new window. The scrollback buffer is passed as +# STDIN to this program. If you change it, make sure the program you use can +# handle ANSI escape sequences for colors and text formatting. +scrollback_pager less +G -R + +# Wheel scroll multiplier (modify the amount scrolled by the mouse wheel) +wheel_scroll_multiplier 5.0 + +# The interval between successive clicks to detect double/triple clicks (in seconds) +click_interval 0.5 + +# Characters considered part of a word when double clicking. In addition to these characters +# any character that is marked as an alpha-numeric character in the unicode +# database will be matched. +select_by_word_characters :@-./_~?&=%+# + +# Hide mouse cursor after the specified number of seconds of the mouse not being used. Set to +# zero or a negative number to disable mouse cursor hiding. +mouse_hide_wait 0.0 + +# The enabled window layouts. A comma separated list of layout names. The special value * means +# all layouts. The first listed layout will be used as the startup layout. +# For a list of available layouts, see the file layouts.py +enabled_layouts * + +# If enabled, the window size will be remembered so that new instances of kitty will have the same +# size as the previous instance. If disabled, the window will initially have size configured +# by initial_window_width/height, in pixels. +remember_window_size no +initial_window_width 640 +initial_window_height 400 + +# Delay (in milliseconds) between screen updates. Decreasing it, increases fps +# at the cost of more CPU usage. The default value yields ~100fps which is more +# that sufficient for most uses. +# repaint_delay 10 +repaint_delay 10 + +# Delay (in milliseconds) before input from the program running in the terminal +# is processed. Note that decreasing it will increase responsiveness, but also +# increase CPU usage and might cause flicker in full screen programs that +# redraw the entire screen on each loop, because kitty is so fast that partial +# screen updates will be drawn. +input_delay 3 + +# Visual bell duration. Flash the screen when a bell occurs for the specified number of +# seconds. Set to zero to disable. +visual_bell_duration 0.0 + +# Enable/disable the audio bell. Useful in environments that require silence. +enable_audio_bell yes + +# The modifier keys to press when clicking with the mouse on URLs to open the URL +open_url_modifiers ctrl+shift + +# The program with which to open URLs that are clicked on. The special value "default" means to +# use the operating system's default URL handler. +open_url_with default + +# The value of the TERM environment variable to set +term xterm-kitty + +# The width (in pts) of window borders. Will be rounded to the nearest number of pixels based on screen resolution. +window_border_width 0 + +window_margin_width 15 + +# The color for the border of the active window +active_border_color #ffffff + +# The color for the border of inactive windows +inactive_border_color #cccccc + +# Tab-bar colors +active_tab_foreground #000 +active_tab_background #eee +inactive_tab_foreground #444 +inactive_tab_background #999 + + +# The 16 terminal colors. There are 8 basic colors, each color has a dull and +# bright version. + +# black +color0 #2f2f2f +color8 #656565 + +# red +color1 #d75f5f +color9 #d75f5f + +# green +color2 #d4d232 +color10 #8fee96 + +# yellow +color3 #af865a +color11 #cd950c + +# blue +color4 #22c3a1 +color12 #22c3a1 + +# magenta +color5 #775759 +color13 #775759 + +# cyan +color6 #84edb9 +color14 #84edb9 + +# white +color7 #c0b18b +color15 #d8d8d8 + +# Key mapping +# For a list of key names, see: http://www.glfw.org/docs/latest/group__keys.html +# For a list of modifier names, see: http://www.glfw.org/docs/latest/group__mods.html +# You can use the special action no_op to unmap a keyboard shortcut that is +# assigned in the default configuration. + +# Clipboard +map super+v paste_from_clipboard +map ctrl+shift+s paste_from_selection +map super+c copy_to_clipboard +map shift+insert paste_from_selection + +# Scrolling +map ctrl+shift+up scroll_line_up +map ctrl+shift+down scroll_line_down +map ctrl+shift+k scroll_line_up +map ctrl+shift+j scroll_line_down +map ctrl+shift+page_up scroll_page_up +map ctrl+shift+page_down scroll_page_down +map ctrl+shift+home scroll_home +map ctrl+shift+end scroll_end +map ctrl+shift+h show_scrollback + +# Window management +map super+n new_os_window +map super+w close_window +map ctrl+shift+enter new_window +map ctrl+shift+] next_window +map ctrl+shift+[ previous_window +map ctrl+shift+f move_window_forward +map ctrl+shift+b move_window_backward +map ctrl+shift+` move_window_to_top +map ctrl+shift+1 first_window +map ctrl+shift+2 second_window +map ctrl+shift+3 third_window +map ctrl+shift+4 fourth_window +map ctrl+shift+5 fifth_window +map ctrl+shift+6 sixth_window +map ctrl+shift+7 seventh_window +map ctrl+shift+8 eighth_window +map ctrl+shift+9 ninth_window +map ctrl+shift+0 tenth_window + +# Tab management +map ctrl+shift+right next_tab +map ctrl+shift+left previous_tab +map ctrl+shift+t new_tab +map ctrl+shift+q close_tab +map ctrl+shift+l next_layout +map ctrl+shift+. move_tab_forward +map ctrl+shift+, move_tab_backward + +# Miscellaneous +map ctrl+shift+up increase_font_size +map ctrl+shift+down decrease_font_size +map ctrl+shift+backspace restore_font_size + +# Symbol mapping (special font for specified unicode code points). Map the +# specified unicode codepoints to a particular font. Useful if you need special +# rendering for some symbols, such as for Powerline. Avoids the need for +# patched fonts. Each unicode code point is specified in the form U+. You can specify multiple code points, separated by commas +# and ranges separated by hyphens. symbol_map itself can be specified multiple times. +# Syntax is: +# +# symbol_map codepoints Font Family Name +# +# For example: +# +#symbol_map U+E0A0-U+E0A2,U+E0B0-U+E0B3 PowerlineSymbols +hide_window_decorations titlebar-only +macos_option_as_alt no + +# Change the color of the kitty window's titlebar on macOS. A value of "system" +# means to use the default system color, a value of "background" means to use +# the default background color and finally you can use an arbitrary color, such +# as #12af59 or "red". +macos_titlebar_color background + +allow_remote_control yes \ No newline at end of file diff --git a/modules/laptopHardware/default.nix b/modules/laptopHardware/default.nix new file mode 100644 index 0000000..da4664a --- /dev/null +++ b/modules/laptopHardware/default.nix @@ -0,0 +1,11 @@ +{ pkgs, lib, config, ... }: + +with lib; +let cfg = config.modules.laptopHardware; + +in { + options.modules.laptopHardware = { enable = mkEnableOption "laptopHardware"; }; + config = mkIf cfg.enable { + + }; +} diff --git a/modules/nushell/config.nu b/modules/nushell/config.nu new file mode 100644 index 0000000..2017b7c --- /dev/null +++ b/modules/nushell/config.nu @@ -0,0 +1,730 @@ +# Nushell Config File +# +# version = 0.83.1 + +# For more information on defining custom themes, see +# https://www.nushell.sh/book/coloring_and_theming.html +# And here is the theme collection +# https://github.com/nushell/nu_scripts/tree/main/themes +let dark_theme = { + # color for nushell primitives + separator: white + leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off + header: green_bold + empty: blue + # Closures can be used to choose colors for specific values. + # The value (in this case, a bool) is piped into the closure. + bool: {|| if $in { 'light_cyan' } else { 'light_gray' } } + int: white + filesize: {|e| + if $e == 0b { + 'white' + } else if $e < 1mb { + 'cyan' + } else { 'blue' } + } + duration: white + date: {|| (date now) - $in | + if $in < 1hr { + 'purple' + } else if $in < 6hr { + 'red' + } else if $in < 1day { + 'yellow' + } else if $in < 3day { + 'green' + } else if $in < 1wk { + 'light_green' + } else if $in < 6wk { + 'cyan' + } else if $in < 52wk { + 'blue' + } else { 'dark_gray' } + } + range: white + float: white + string: white + nothing: white + binary: white + cellpath: white + row_index: green_bold + record: white + list: white + block: white + hints: dark_gray + search_result: {bg: red fg: white} + shape_and: purple_bold + shape_binary: purple_bold + shape_block: blue_bold + shape_bool: light_cyan + shape_closure: green_bold + shape_custom: green + shape_datetime: cyan_bold + shape_directory: cyan + shape_external: cyan + shape_externalarg: green_bold + shape_filepath: cyan + shape_flag: blue_bold + shape_float: purple_bold + # shapes are used to change the cli syntax highlighting + shape_garbage: { fg: white bg: red attr: b} + shape_globpattern: cyan_bold + shape_int: purple_bold + shape_internalcall: cyan_bold + shape_list: cyan_bold + shape_literal: blue + shape_match_pattern: green + shape_matching_brackets: { attr: u } + shape_nothing: light_cyan + shape_operator: yellow + shape_or: purple_bold + shape_pipe: purple_bold + shape_range: yellow_bold + shape_record: cyan_bold + shape_redirection: purple_bold + shape_signature: green_bold + shape_string: green + shape_string_interpolation: cyan_bold + shape_table: blue_bold + shape_variable: purple + shape_vardecl: purple +} + + +# External completer example +# let carapace_completer = {|spans| +# carapace $spans.0 nushell $spans | from json +# } + + +# The default config record. This is where much of your global configuration is setup. +$env.config = { + show_banner: false # true or false to enable or disable the welcome banner at startup + + ls: { + use_ls_colors: true # use the LS_COLORS environment variable to colorize output + clickable_links: true # enable or disable clickable links. Your terminal has to support links. + } + + rm: { + always_trash: false # always act as if -t was given. Can be overridden with -p + } + + + table: { + mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other + index_mode: always # "always" show indexes, "never" show indexes, "auto" = show indexes when a table has "index" column + show_empty: true # show 'empty list' and 'empty record' placeholders for command output + trim: { + methodology: wrapping # wrapping or truncating + wrapping_try_keep_words: true # A strategy used by the 'wrapping' methodology + truncating_suffix: "..." # A suffix used by the 'truncating' methodology + } + } + + # datetime_format determines what a datetime rendered in the shell would look like. + # Behavior without this configuration point will be to "humanize" the datetime display, + # showing something like "a day ago." + datetime_format: { + # normal: '%a, %d %b %Y %H:%M:%S %z' # shows up in displays of variables or other datetime's outside of tables + # table: '%m/%d/%y %I:%M:%S%p' # generally shows up in tabular outputs such as ls. commenting this out will change it to the default human readable datetime format + } + + explore: { + try: { + border_color: {fg: "white"} + }, + status_bar_background: {fg: "#1D1F21", bg: "#C4C9C6"}, + command_bar_text: {fg: "#C4C9C6"}, + highlight: {fg: "black", bg: "yellow"}, + status: { + error: {fg: "white", bg: "red"}, + warn: {} + info: {} + }, + table: { + split_line: {fg: "#404040"}, + selected_cell: {}, + selected_row: {}, + selected_column: {}, + cursor: true, + line_head_top: true, + line_head_bottom: true, + line_shift: true, + line_index: true, + }, + config: { + border_color: {fg: "white"} + cursor_color: {fg: "black", bg: "light_yellow"} + }, + } + + history: { + max_size: 100_000 # Session has to be reloaded for this to take effect + sync_on_enter: false # Enable to share history between multiple sessions, else you have to close the session to write history to file + file_format: "plaintext" # "sqlite" or "plaintext" + isolation: false # only available with sqlite file_format. true enables history isolation, false disables it. true will allow the history to be isolated to the current session using up/down arrows. false will allow the history to be shared across all sessions. + } + + completions: { + case_sensitive: false # set to true to enable case-sensitive completions + quick: true # set this to false to prevent auto-selecting completions when only one remains + partial: true # set this to false to prevent partial filling of the prompt + algorithm: "fuzzy" # prefix or fuzzy + external: { + enable: true # set to false to prevent nushell looking into $env.PATH to find more suggestions, `false` recommended for WSL users as this look up may be very slow + max_results: 100 # setting it lower can improve completion performance at the cost of omitting some options + completer: null # check 'carapace_completer' above as an example + } + } + + filesize: { + metric: true # true => KB, MB, GB (ISO standard), false => KiB, MiB, GiB (Windows standard) + format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, auto + } + + cursor_shape: { + emacs: line # block, underscore, line, blink_block, blink_underscore, blink_line (line is the default) + vi_insert: line # block, underscore, line , blink_block, blink_underscore, blink_line (block is the default) + vi_normal: block # block, underscore, line, blink_block, blink_underscore, blink_line (underscore is the default) + } + + color_config: {} # if you want a more interesting theme, you can replace the empty record with `$dark_theme`, `$light_theme` or another custom record + use_grid_icons: true + footer_mode: "25" # always, never, number_of_rows, auto + float_precision: 2 # the precision for displaying floats in tables + buffer_editor: "" # command that will be used to edit the current line buffer with ctrl+o, if unset fallback to $env.EDITOR and $env.VISUAL + use_ansi_coloring: true + bracketed_paste: true # enable bracketed paste, currently useless on windows + edit_mode: emacs # emacs, vi + shell_integration: false # enables terminal shell integration. Off by default, as some terminals have issues with this. + render_right_prompt_on_last_line: false # true or false to enable or disable right prompt to be rendered on last line of the prompt. + + hooks: { + pre_prompt: [{ null }] # run before the prompt is shown + pre_execution: [{ null }] # run before the repl input is run + env_change: { + PWD: [{|before, after| null }] # run if the PWD environment is different since the last repl input + } + display_output: { + if (term size).columns >= 80 { + table -e + } else { + table + } + } + command_not_found: { null } # return an error message when a command is not found + } + + menus: [ + # Configuration for default nushell menus + # Note the lack of source parameter + { + name: completion_menu + only_buffer_difference: false + marker: "| " + type: { + layout: columnar + columns: 4 + col_width: 20 # Optional value. If missing all the screen width is used to calculate column width + col_padding: 2 + } + style: { + text: green + selected_text: green_reverse + description_text: yellow + } + } + { + name: history_menu + only_buffer_difference: true + marker: "? " + type: { + layout: list + page_size: 10 + } + style: { + text: green + selected_text: green_reverse + description_text: yellow + } + } + { + name: help_menu + only_buffer_difference: true + marker: "? " + type: { + layout: description + columns: 4 + col_width: 20 # Optional value. If missing all the screen width is used to calculate column width + col_padding: 2 + selection_rows: 4 + description_rows: 10 + } + style: { + text: green + selected_text: green_reverse + description_text: yellow + } + } + ] + + keybindings: [ + { + name: completion_menu + modifier: none + keycode: tab + mode: [emacs vi_normal vi_insert] + event: { + until: [ + { send: menu name: completion_menu } + { send: menunext } + ] + } + } + { + name: history_menu + modifier: control + keycode: char_r + mode: [emacs, vi_insert, vi_normal] + event: { send: menu name: history_menu } + } + { + name: help_menu + modifier: none + keycode: f1 + mode: [emacs, vi_insert, vi_normal] + event: { send: menu name: help_menu } + } + { + name: completion_previous_menu + modifier: shift + keycode: backtab + mode: [emacs, vi_normal, vi_insert] + event: { send: menuprevious } + } + { + name: next_page_menu + modifier: control + keycode: char_x + mode: emacs + event: { send: menupagenext } + } + { + name: undo_or_previous_page_menu + modifier: control + keycode: char_z + mode: emacs + event: { + until: [ + { send: menupageprevious } + { edit: undo } + ] + } + } + { + name: escape + modifier: none + keycode: escape + mode: [emacs, vi_normal, vi_insert] + event: { send: esc } # NOTE: does not appear to work + } + { + name: cancel_command + modifier: control + keycode: char_c + mode: [emacs, vi_normal, vi_insert] + event: { send: ctrlc } + } + { + name: quit_shell + modifier: control + keycode: char_d + mode: [emacs, vi_normal, vi_insert] + event: { send: ctrld } + } + { + name: clear_screen + modifier: control + keycode: char_l + mode: [emacs, vi_normal, vi_insert] + event: { send: clearscreen } + } + { + name: search_history + modifier: control + keycode: char_r + mode: [emacs, vi_normal, vi_insert] + event: { send: searchhistory } + } + { + name: open_command_editor + modifier: control + keycode: char_o + mode: [emacs, vi_normal, vi_insert] + event: { send: openeditor } + } + { + name: move_up + modifier: none + keycode: up + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {send: menuup} + {send: up} + ] + } + } + { + name: move_down + modifier: none + keycode: down + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {send: menudown} + {send: down} + ] + } + } + { + name: move_left + modifier: none + keycode: left + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {send: menuleft} + {send: left} + ] + } + } + { + name: move_right_or_take_history_hint + modifier: none + keycode: right + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {send: historyhintcomplete} + {send: menuright} + {send: right} + ] + } + } + { + name: move_one_word_left + modifier: control + keycode: left + mode: [emacs, vi_normal, vi_insert] + event: {edit: movewordleft} + } + { + name: move_one_word_right_or_take_history_hint + modifier: control + keycode: right + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {send: historyhintwordcomplete} + {edit: movewordright} + ] + } + } + { + name: move_to_line_start + modifier: none + keycode: home + mode: [emacs, vi_normal, vi_insert] + event: {edit: movetolinestart} + } + { + name: move_to_line_start + modifier: control + keycode: char_a + mode: [emacs, vi_normal, vi_insert] + event: {edit: movetolinestart} + } + { + name: move_to_line_end_or_take_history_hint + modifier: none + keycode: end + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {send: historyhintcomplete} + {edit: movetolineend} + ] + } + } + { + name: move_to_line_end_or_take_history_hint + modifier: control + keycode: char_e + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {send: historyhintcomplete} + {edit: movetolineend} + ] + } + } + { + name: move_to_line_start + modifier: control + keycode: home + mode: [emacs, vi_normal, vi_insert] + event: {edit: movetolinestart} + } + { + name: move_to_line_end + modifier: control + keycode: end + mode: [emacs, vi_normal, vi_insert] + event: {edit: movetolineend} + } + { + name: move_up + modifier: control + keycode: char_p + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {send: menuup} + {send: up} + ] + } + } + { + name: move_down + modifier: control + keycode: char_t + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {send: menudown} + {send: down} + ] + } + } + { + name: delete_one_character_backward + modifier: none + keycode: backspace + mode: [emacs, vi_insert] + event: {edit: backspace} + } + { + name: delete_one_word_backward + modifier: control + keycode: backspace + mode: [emacs, vi_insert] + event: {edit: backspaceword} + } + { + name: delete_one_character_forward + modifier: none + keycode: delete + mode: [emacs, vi_insert] + event: {edit: delete} + } + { + name: delete_one_character_forward + modifier: control + keycode: delete + mode: [emacs, vi_insert] + event: {edit: delete} + } + { + name: delete_one_character_forward + modifier: control + keycode: char_h + mode: [emacs, vi_insert] + event: {edit: backspace} + } + { + name: delete_one_word_backward + modifier: control + keycode: char_w + mode: [emacs, vi_insert] + event: {edit: backspaceword} + } + { + name: move_left + modifier: none + keycode: backspace + mode: vi_normal + event: {edit: moveleft} + } + { + name: newline_or_run_command + modifier: none + keycode: enter + mode: emacs + event: {send: enter} + } + { + name: move_left + modifier: control + keycode: char_b + mode: emacs + event: { + until: [ + {send: menuleft} + {send: left} + ] + } + } + { + name: move_right_or_take_history_hint + modifier: control + keycode: char_f + mode: emacs + event: { + until: [ + {send: historyhintcomplete} + {send: menuright} + {send: right} + ] + } + } + { + name: redo_change + modifier: control + keycode: char_g + mode: emacs + event: {edit: redo} + } + { + name: undo_change + modifier: control + keycode: char_z + mode: emacs + event: {edit: undo} + } + { + name: paste_before + modifier: control + keycode: char_y + mode: emacs + event: {edit: pastecutbufferbefore} + } + { + name: cut_word_left + modifier: control + keycode: char_w + mode: emacs + event: {edit: cutwordleft} + } + { + name: cut_line_to_end + modifier: control + keycode: char_k + mode: emacs + event: {edit: cuttoend} + } + { + name: cut_line_from_start + modifier: control + keycode: char_u + mode: emacs + event: {edit: cutfromstart} + } + { + name: swap_graphemes + modifier: control + keycode: char_t + mode: emacs + event: {edit: swapgraphemes} + } + { + name: move_one_word_left + modifier: alt + keycode: left + mode: emacs + event: {edit: movewordleft} + } + { + name: move_one_word_right_or_take_history_hint + modifier: alt + keycode: right + mode: emacs + event: { + until: [ + {send: historyhintwordcomplete} + {edit: movewordright} + ] + } + } + { + name: move_one_word_left + modifier: alt + keycode: char_b + mode: emacs + event: {edit: movewordleft} + } + { + name: move_one_word_right_or_take_history_hint + modifier: alt + keycode: char_f + mode: emacs + event: { + until: [ + {send: historyhintwordcomplete} + {edit: movewordright} + ] + } + } + { + name: delete_one_word_forward + modifier: alt + keycode: delete + mode: emacs + event: {edit: deleteword} + } + { + name: delete_one_word_backward + modifier: alt + keycode: backspace + mode: emacs + event: {edit: backspaceword} + } + { + name: delete_one_word_backward + modifier: alt + keycode: char_m + mode: emacs + event: {edit: backspaceword} + } + { + name: cut_word_to_right + modifier: alt + keycode: char_d + mode: emacs + event: {edit: cutwordright} + } + { + name: upper_case_word + modifier: alt + keycode: char_u + mode: emacs + event: {edit: uppercaseword} + } + { + name: lower_case_word + modifier: alt + keycode: char_l + mode: emacs + event: {edit: lowercaseword} + } + { + name: capitalize_char + modifier: alt + keycode: char_c + mode: emacs + event: {edit: capitalizechar} + } + ] +} + diff --git a/modules/nushell/default.nix b/modules/nushell/default.nix new file mode 100644 index 0000000..7d46a87 --- /dev/null +++ b/modules/nushell/default.nix @@ -0,0 +1,16 @@ +{ pkgs, lib, config, ... }: + +with lib; +let cfg = config.modules.nushell; + +in { + options.modules.nushell = { enable = mkEnableOption "nushell"; }; + config = mkIf cfg.enable { + programs.nushell = { + enable = true; + configFile.source = ./config.nu; + envFile.source = ./env.nu; + extraConfig = builtins.readFile ./extra.nu; + }; + }; +} diff --git a/modules/nushell/env.nu b/modules/nushell/env.nu new file mode 100644 index 0000000..51ed547 --- /dev/null +++ b/modules/nushell/env.nu @@ -0,0 +1,82 @@ +# Nushell Environment Config File +# +# version = 0.83.1 + +def create_left_prompt [] { + mut home = "" + try { + if $nu.os-info.name == "windows" { + $home = $env.USERPROFILE + } else { + $home = $env.HOME + } + } + + let dir = ([ + ($env.PWD | str substring 0..($home | str length) | str replace $home "~"), + ($env.PWD | str substring ($home | str length)..) + ] | str join) + + let path_color = (if (is-admin) { ansi red_bold } else { ansi green_bold }) + let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold }) + let path_segment = $"($path_color)($dir)" + + $path_segment | str replace --all (char path_sep) $"($separator_color)/($path_color)" +} + +def create_right_prompt [] { + # create a right prompt in magenta with green separators and am/pm underlined + let time_segment = ([ + (ansi reset) + (ansi magenta) + (date now | date format '%Y/%m/%d %r') + ] | str join | str replace --all "([/:])" $"(ansi green)${1}(ansi magenta)" | + str replace --all "([AP]M)" $"(ansi magenta_underline)${1}") + + let last_exit_code = if ($env.LAST_EXIT_CODE != 0) {([ + (ansi rb) + ($env.LAST_EXIT_CODE) + ] | str join) + } else { "" } + + ([$last_exit_code, (char space), $time_segment] | str join) +} + +# Use nushell functions to define your right and left prompt +$env.PROMPT_COMMAND = {|| create_left_prompt } +# $env.PROMPT_COMMAND_RIGHT = {|| create_right_prompt } + +# The prompt indicators are environmental variables that represent +# the state of the prompt +$env.PROMPT_INDICATOR = {|| " > " } +$env.PROMPT_INDICATOR_VI_INSERT = {|| " : " } +$env.PROMPT_INDICATOR_VI_NORMAL = {|| " > " } +$env.PROMPT_MULTILINE_INDICATOR = {|| "::: " } + +# Specifies how environment variables are: +# - converted from a string to a value on Nushell startup (from_string) +# - converted from a value back to a string when running external commands (to_string) +# Note: The conversions happen *after* config.nu is loaded +$env.ENV_CONVERSIONS = { + "PATH": { + from_string: { |s| $s | split row (char esep) | path expand --no-symlink } + to_string: { |v| $v | path expand --no-symlink | str join (char esep) } + } + "Path": { + from_string: { |s| $s | split row (char esep) | path expand --no-symlink } + to_string: { |v| $v | path expand --no-symlink | str join (char esep) } + } +} + +# Directories to search for scripts when calling source or use +$env.NU_LIB_DIRS = [ + # ($nu.default-config-dir | path join 'scripts') # add /scripts +] + +# Directories to search for plugin binaries when calling register +$env.NU_PLUGIN_DIRS = [ + # ($nu.default-config-dir | path join 'plugins') # add /plugins +] + +# To add entries to PATH (on Windows you might use Path), you can use the following pattern: +# $env.PATH = ($env.PATH | split row (char esep) | prepend '/some/path') diff --git a/modules/nushell/extra.nu b/modules/nushell/extra.nu new file mode 100644 index 0000000..0d58793 --- /dev/null +++ b/modules/nushell/extra.nu @@ -0,0 +1,16 @@ +#source ~/.cache/starship/init.nu +#source ~/.zoxide.nu +#alias cringe = sudo bootctl set-oneshot auto-windows +#alias fetch = neofetch +#alias ff = firefox +#alias gc = sudo nix-collect-garbage -d +#alias js = jj status +#alias jd = jj diff +#alias pu = pueue +#alias rb = sudo nice -n19 nixos-rebuild boot --flake ~/projects/NOflake/ +#alias rs = sudo nice -n19 nixos-rebuild switch --flake ~/projects/NOflake/ +#alias t = task +#alias ts = tailscale +#alias tss = tailscale status +#alias tsx = tailscale exit-node list +#alias zl = zellij diff --git a/modules/nvim/default.nix b/modules/nvim/default.nix new file mode 100644 index 0000000..a5013bd --- /dev/null +++ b/modules/nvim/default.nix @@ -0,0 +1,97 @@ +{ lib, config, pkgs, ... }: +with lib; +let + cfg = config.modules.nvim; + # Source my theme + jabuti-nvim = pkgs.vimUtils.buildVimPlugin { + name = "jabuti-nvim"; + src = pkgs.fetchFromGitHub { + owner = "jabuti-theme"; + repo = "jabuti-nvim"; + rev = "17f1b94cbf1871a89cdc264e4a8a2b3b4f7c76d2"; + sha256 = "sha256-iPjwx/rTd98LUPK1MUfqKXZhQ5NmKx/rN8RX1PIuDFA="; + }; + }; +in { + options.modules.nvim = { enable = mkEnableOption "nvim"; }; + config = mkIf cfg.enable { + + home.file.".config/nvim/settings.lua".source = ./init.lua; + + home.packages = with pkgs; [ + nixfmt # Nix + sumneko-lua-language-server stylua # Lua + ]; + + programs.nushell = { + initExtra = '' + export EDITOR="nvim" + ''; + + shellAliases = { + v = "nvim -i NONE"; + nvim = "nvim -i NONE"; + }; + }; + + programs.neovim = { + enable = true; + plugins = with pkgs.vimPlugins; [ + vim-nix + plenary-nvim + { + plugin = zk-nvim; + config = "require('zk').setup()"; + } + { + plugin = jabuti-nvim; + config = "colorscheme jabuti"; + } + { + plugin = impatient-nvim; + config = "lua require('impatient')"; + } + { + plugin = lualine-nvim; + config = "lua require('lualine').setup()"; + } + { + plugin = telescope-nvim; + config = "lua require('telescope').setup()"; + } + { + plugin = indent-blankline-nvim; + config = "lua require('indent_blankline').setup()"; + } + { + plugin = nvim-lspconfig; + config = '' + lua << EOF + require('lspconfig').rust_analyzer.setup{} + require('lspconfig').sumneko_lua.setup{} + require('lspconfig').rnix.setup{} + require('lspconfig').zk.setup{} + EOF + ''; + } + { + plugin = nvim-treesitter; + config = '' + lua << EOF + require('nvim-treesitter.configs').setup { + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + } + EOF + ''; + } + ]; + + extraConfig = '' + luafile ~/.config/nvim/settings.lua + ''; + }; + }; +} diff --git a/modules/nvim/init.lua b/modules/nvim/init.lua new file mode 100644 index 0000000..4da3afa --- /dev/null +++ b/modules/nvim/init.lua @@ -0,0 +1,83 @@ +local o = vim.opt +local g = vim.g + +-- Autocmds +vim.cmd [[ +augroup CursorLine + au! + au VimEnter * setlocal cursorline + au WinEnter * setlocal cursorline + au BufWinEnter * setlocal cursorline + au WinLeave * setlocal nocursorline +augroup END + +autocmd FileType nix setlocal shiftwidth=4 +]] + +-- Keybinds +local map = vim.api.nvim_set_keymap +local opts = { silent = true, noremap = true } + +map("n", "", "h", opts) +map("n", "", "j", opts) +map("n", "", "k", opts) +map("n", "", "l", opts) +map('n', '', ':Telescope live_grep ', opts) +map('n', '', ':Telescope find_files ', opts) +map('n', 'j', 'gj', opts) +map('n', 'k', 'gk', opts) +map('n', ';', ':', { noremap = true } ) + +g.mapleader = ' ' + +-- Performance +o.lazyredraw = true; +o.shell = "nushell" +o.shadafile = "NONE" + +-- Colors +o.termguicolors = true + +-- Undo files +o.undofile = true + +-- Indentation +o.smartindent = true +o.tabstop = 4 +o.shiftwidth = 4 +o.shiftround = true +o.expandtab = true +o.scrolloff = 3 + +-- Set clipboard to use system clipboard +o.clipboard = "unnamedplus" + +-- Use mouse +o.mouse = "a" + +-- Nicer UI settings +o.cursorline = true +o.relativenumber = true +o.number = true + +-- Get rid of annoying viminfo file +o.viminfo = "" +o.viminfofile = "NONE" + +-- Miscellaneous quality of life +o.ignorecase = true +o.ttimeoutlen = 5 +o.hidden = true +o.shortmess = "atI" +o.wrap = false +o.backup = false +o.writebackup = false +o.errorbells = false +o.swapfile = false +o.showmode = false +o.laststatus = 3 +o.pumheight = 6 +o.splitright = true +o.splitbelow = true +o.completeopt = "menuone,noselect" + diff --git a/modules/packages/default.nix b/modules/packages/default.nix new file mode 100644 index 0000000..0a09f31 --- /dev/null +++ b/modules/packages/default.nix @@ -0,0 +1,28 @@ +{ pkgs, lib, config, ... }: + +with lib; +let cfg = + config.modules.packages; + screen = pkgs.writeShellScriptBin "screen" ''${builtins.readFile ./screen}''; + bandw = pkgs.writeShellScriptBin "bandw" ''${builtins.readFile ./bandw}''; + maintenance = pkgs.writeShellScriptBin "maintenance" ''${builtins.readFile ./maintenance}''; + +in { + options.modules.packages = { enable = mkEnableOption "packages"; }; + config = mkIf cfg.enable { + home.packages = with pkgs; [ + # nix + nil + alejandra + # cli tools + bat + eza + fzf + ripgrep + unzip + tealdeer + ffmpeg + btop + ]; + }; +} diff --git a/modules/packages/maintenance b/modules/packages/maintenance new file mode 100755 index 0000000..4d10d6d --- /dev/null +++ b/modules/packages/maintenance @@ -0,0 +1,8 @@ +sudo nix-collect-garbage -d +sudo nix store verify --all +sudo nix store repair --all +cd $NIXOS_CONFIG_DIR +nix flake update +sudo nixos-rebuild switch --flake . --upgrade +nix run nixpkgs#bleachbit +nix run nixpkgs#pcmanfm diff --git a/modules/system/configuration.nix b/modules/system/configuration.nix new file mode 100755 index 0000000..7d80d8d --- /dev/null +++ b/modules/system/configuration.nix @@ -0,0 +1,160 @@ +{ config, pkgs, inputs, ... }: + +{ + # Remove unecessary preinstalled packages + environment.defaultPackages = [ ]; + services.xserver.desktopManager.xterm.enable = false; + + programs.nushell.enable = true; + + # Laptop-specific packages (the other ones are installed in `packages.nix`) + environment.systemPackages = with pkgs; [ + acpi tlp git + ]; + + # Install fonts + fonts = { + packages = with pkgs; [ + jetbrains-mono + roboto + openmoji-color + (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) + ]; + + fontconfig = { + hinting.autohint = true; + defaultFonts = { + emoji = [ "OpenMoji Color" ]; + }; + }; + }; + + + # Wayland stuff: enable XDG integration, allow sway to use brillo +xdg = { + portal = { + enable = true; + extraPortals = with pkgs; [ + xdg-desktop-portal-wlr + xdg-desktop-portal-gtk + ]; + config = { + common = { + default = "gtk"; + }; + preferred = { + "org.freedesktop.impl.portal.Screencast" = "wlr"; + }; + }; + }; +}; + + + # Nix settings, auto cleanup and enable flakes + nix = { + settings.auto-optimise-store = true; + settings.allowed-users = [ "jet" ]; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + extraOptions = '' + experimental-features = nix-command flakes + keep-outputs = true + keep-derivations = true + ''; + }; + + # Boot settings: clean /tmp/, latest kernel and enable bootloader + boot = { + tmp.cleanOnBoot = true; + loader = { + systemd-boot.enable = true; + systemd-boot.editor = false; + efi.canTouchEfiVariables = true; + timeout = 0; + }; + }; + + # Set up locales (timezone and keyboard layout) + time.timeZone = "America/Los_Angeles"; + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminus16"; + keyMap = "us"; + }; + + # Set up user and enable sudo + users.users.jet = { + isNormalUser = true; + extraGroups = [ "input" "wheel" "networkmanager"]; + shell = pkgs.nushell; + }; + + # Set up networking and secure it + networking = { + # Enable networking + networkmanager.enable = true; + firewall = { + #enable = true; + #allowedTCPPorts = [ 443 80 ]; + #allowedUDPPorts = [ 443 80 44857 ]; + #allowPing = false; + }; + }; + + # Set environment variables + environment.variables = { + NIXOS_CONFIG = "$HOME/.config/nixos/configuration.nix"; + NIXOS_CONFIG_DIR = "$HOME/.config/nixos/"; + XDG_DATA_HOME = "$HOME/.local/share"; + PASSWORD_STORE_DIR = "$HOME/.local/share/password-store"; + GTK_RC_FILES = "$HOME/.local/share/gtk-1.0/gtkrc"; + GTK2_RC_FILES = "$HOME/.local/share/gtk-2.0/gtkrc"; + MOZ_ENABLE_WAYLAND = "1"; + ZK_NOTEBOOK_DIR = "$HOME/stuff/notes/"; + EDITOR = "nvim"; + DIRENV_LOG_FORMAT = ""; + ANKI_WAYLAND = "1"; + DISABLE_QT5_COMPAT = "0"; + GTK_USE_PORTAL = "1"; + }; + + # Security + security = { + # Extra security + protectKernelImage = true; + }; + # Allow unfree package + nixpkgs.config.allowUnfree = true; + + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + jack.enable = true; + + # use the example session manager (no others are packaged yet so this is enabled by default, + # no need to redefine it in your config for now) + #media-session.enable = true; + }; + + # enable pulseaudio, enable opengl (for Wayland) + hardware = { + bluetooth.enable = true; + opengl = { + enable = true; + driSupport = true; + }; + }; + + # Do not touch + system.stateVersion = "23.11"; +} diff --git a/modules/template.nix b/modules/template.nix new file mode 100644 index 0000000..ce7f29b --- /dev/null +++ b/modules/template.nix @@ -0,0 +1,10 @@ +{ pkgs, lib, config, ... }: + +with lib; +let cfg = config.modules.PROGRAM; + +in { + options.modules.PROGRAM = { enable = mkEnableOption "PROGRAM"; }; + config = mkIf cfg.enable { + }; +} diff --git a/modules/wofi/default.nix b/modules/wofi/default.nix new file mode 100644 index 0000000..956dc36 --- /dev/null +++ b/modules/wofi/default.nix @@ -0,0 +1,11 @@ +{ pkgs, lib, config, ... }: + +with lib; +let cfg = config.modules.wofi; + +in { + options.modules.wofi = { enable = mkEnableOption "wofi"; }; + config = mkIf cfg.enable { + home.file.".config/wofi.css".source = ./wofi.css; + }; +} diff --git a/modules/wofi/wofi.css b/modules/wofi/wofi.css new file mode 100644 index 0000000..6f2ca04 --- /dev/null +++ b/modules/wofi/wofi.css @@ -0,0 +1,35 @@ +* { + all: unset; + font-family: "JetBrainsMono"; + font-size: 16px; +} + +#window { + background-color: #292a37; + border-radius: 12px; +} + +#outer-box { + background-color: #292a37; + border: 4px solid #44465c; + border-radius: 12px; +} + +#input{ + margin: 1rem; + padding: 0.5rem; + border-radius: 10px; + background-color: #303241; +} + +#entry { + margin: 0.25rem 0.75rem 0.25rem 0.75rem; + padding: 0.25rem 0.75rem 0.25rem 0.75rem; + color: #9699b7; + border-radius: 8px; +} + +#entry:selected { + background-color: #303241; + color: #d9e0ee; +} diff --git a/modules/xdg/default.nix b/modules/xdg/default.nix new file mode 100644 index 0000000..82109b0 --- /dev/null +++ b/modules/xdg/default.nix @@ -0,0 +1,21 @@ +{ pkgs, lib, config, ... }: + +with lib; +let cfg = config.modules.xdg; + +in { + options.modules.xdg = { enable = mkEnableOption "xdg"; }; + config = mkIf cfg.enable { + xdg.userDirs = { + enable = true; + documents = "$HOME/stuff/other/"; + download = "$HOME/stuff/other/"; + videos = "$HOME/stuff/other/"; + music = "$HOME/stuff/music/"; + pictures = "$HOME/stuff/pictures/"; + desktop = "$HOME/stuff/other/"; + publicShare = "$HOME/stuff/other/"; + templates = "$HOME/stuff/other/"; + }; + }; +}