diff --git a/hosts/desktop/configuration.nix b/hosts/desktop/configuration.nix new file mode 100644 index 0000000..e07af62 --- /dev/null +++ b/hosts/desktop/configuration.nix @@ -0,0 +1,204 @@ +{ config, lib, pkgs, inputs, ... }: + +{ + imports = [ + ./hardware-configuration.nix + inputs.home-manager.nixosModules.default + ]; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.plymouth.enable = true; + + networking = { + networkmanager = { + enable = true; + wifi.backend = "iwd"; + }; + hostName = "nixos-laptop"; + firewall.enable = false; + wireless.iwd = { + enable = true; + settings = { + IPv6.Enabled = true; + Settings.Autoconnect = true; + }; + }; + + # Configure network proxy if necessary + # proxy.default = "http://user:password@proxy:port/"; + # proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + }; + + time.timeZone = "Europe/Madrid"; + + i18n= { + defaultLocale = "en_US.UTF-8"; + inputMethod = { + enable = true; + type = "fcitx5"; + fcitx5 = { + waylandFrontend = true; + addons = with pkgs; [ + fcitx5-mozc + fcitx5-gtk + fcitx5-chinese-addons + ]; + }; + }; + }; + + services = { + libinput.enable = true; + + greetd = { + enable = true; + restart = true; + settings = { + default_session = { + command = "${pkgs.greetd.tuigreet}/bin/tuigreet --cmd Hyprland"; + }; + }; + }; + + blueman.enable = true; + gvfs.enable = true; + auto-cpufreq.enable = true; + thermald.enable = true; + + power-profiles-daemon.enable = false; + }; + + security.pam.services.hyprlock = {}; + + environment.etc."greetd/environments".text = '' + Hyprland + ''; + + hardware = { + bluetooth.enable = true; + graphics = { + enable = true; + extraPackages = with pkgs;[ + intel-compute-runtime + intel-media-driver + ]; + }; + pulseaudio.enable = false; + system76.enableAll = true; + }; + + fonts.packages = with pkgs; [ + noto-fonts + noto-fonts-cjk-sans + noto-fonts-cjk-serif + noto-fonts-emoji + liberation_ttf + fira-code-symbols + mplus-outline-fonts.githubRelease + dina-font + nerd-fonts.fira-code + nerd-fonts.droid-sans-mono + ]; + + nixpkgs.config.allowUnfree = true; + + nix.settings = { + substituters = ["https://hyprland.cachix.org"]; + trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; + trusted-users = [ "root" "@wheel" ]; + allowed-users = [ "root" "@wheel" ]; + }; + + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 10d"; + }; + nix.optimise = { + automatic = true; + dates = [ "00:00" ]; + }; + + users.users.liamm = { + isNormalUser = true; + description = "liamm"; + extraGroups = [ "networkmanager" "wheel" "disk" "power" "video" "davfs2" "input" ]; + }; + + programs = { + dconf.enable = true; + steam = { + enable = true; + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = true; + }; + + nix-ld.enable = true; + mtr.enable = true; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + }; + + home-manager = { + useGlobalPkgs = true; + extraSpecialArgs = { inherit inputs; }; + users = { + "liamm" = import ./home.nix; + }; + }; + + environment.systemPackages = with pkgs; [ + vim + fd + file + ripgrep + wget + glib + spotify + discord + wl-clipboard + alacritty + libnotify + mesa + libdrm + ]; + + zramSwap = { + enable = true; + algorithm = "zstd"; + }; + + xdg = { + mime.enable = true; + portal = { + enable = true; + wlr.enable = true; + extraPortals = with pkgs;[ + xdg-desktop-portal-gtk + xdg-desktop-portal-wlr + xdg-desktop-portal-hyprland + ]; + config = { + common = { + default = [ "gtk" ]; + }; + }; + }; + }; + + # services.openssh.enable = true; + + # This option defines the first version of NixOS you have installed on this particular machine + # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, + # and migrated your data accordingly. + # + # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . + system.stateVersion = "23.11"; # Did you read the comment? +} diff --git a/hosts/desktop/hardware-configuration.nix b/hosts/desktop/hardware-configuration.nix new file mode 100644 index 0000000..87bd349 --- /dev/null +++ b/hosts/desktop/hardware-configuration.nix @@ -0,0 +1,44 @@ +# 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" "thunderbolt" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/c7704142-d0b9-4a85-af1c-ce776b895c0f"; + fsType = "ext4"; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/bf7180c8-72f0-483a-8306-821276eda3e5"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/E27A-231B"; + fsType = "vfat"; + }; + + 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.enp46s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; +} diff --git a/hosts/desktop/home.nix b/hosts/desktop/home.nix new file mode 100644 index 0000000..4e5225b --- /dev/null +++ b/hosts/desktop/home.nix @@ -0,0 +1,246 @@ +{ config, pkgs, lib, callPackage, inputs, ... }: + +{ + home.username = "liamm"; + home.homeDirectory = "/home/liamm"; + + imports = [ + # general modules + ../../modules/home-manager/dunst.nix + ../../modules/home-manager/tmux.nix + ../../modules/home-manager/fastfetch.nix + ../../modules/home-manager/terminals/alacritty.nix + + # desktop + ../../modules/desktop/bluetooth.nix + ../../modules/desktop/hyprland.nix + ]; + + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "23.11"; # Please read the comment before changing. + + nixpkgs.config.allowUnfree = true; + home.packages = with pkgs; [ + audacity + android-studio + brightnessctl + emacs-all-the-icons-fonts + emacsPackages.pdf-tools + exfatprogs + filezilla + firefox + floorp + genymotion + gimp + gnome-keyring + gtk4 + gvfs + grim + grimblast + htop + imagemagick + keepassxc + libsForQt5.polkit-kde-agent + mpv + nautilus + netbeans + networkmanagerapplet + nwg-look + openvpn + pamixer + pavucontrol + powertop + praat + prismlauncher + protonvpn-cli + protonvpn-gui + pspp + qbittorrent + signal-desktop + swww + texliveFull + tree + unzip + wev + wl-clipboard + xdg-user-dirs + zip + zoom-us + ]; + + home.file = {}; + + home.sessionVariables = { + EDITOR = "emacsclient"; + GIT_EDITOR = "nvim"; + NIX_SHELL_PRESERVE_PROMPT = 1; + }; + + nix.settings.extra-trusted-substituters = [ + "https://ghostty.cachix.org" + ]; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + # THEMING + + ## QT SECTION + qt = { + enable = true; + platformTheme.name = "gtk"; + style.name = "adwaita-dark"; + }; + + ## GTK SECTION + gtk = { + enable = true; + cursorTheme = { + package = pkgs.bibata-cursors; + name = "Bibata-Modern-Ice"; + }; + theme = { + name = "Materia-dark"; + package = pkgs.materia-theme; + }; + iconTheme = { + package = pkgs.arc-icon-theme; + name = "arc-icon-theme"; + }; + }; + + + # ENV SETTINGS + + fonts.fontconfig = { + enable = true; + }; + + xdg.enable = true; + xdg.configFile = { + "emacs" = { + recursive = true; + source = ../../modules/non-nix_configs/emacs; + }; + "ghostty" = { + recursive = true; + source = ../../modules/non-nix_configs/ghostty; + }; + "kitty" = { + recursive = true; + source = ../../modules/non-nix_configs/kitty; + }; + "nvim" = { + recursive = true; + source = ../../modules/non-nix_configs/nvim; + }; + "wofi" = { + recursive = true; + source = ../../modules/non-nix_configs/wofi; + }; + "user-dirs.dirs".source = ../../modules/non-nix_configs/user-dirs.dirs; + "user-dirs.locale".source = ../../modules/non-nix_configs/user-dirs.locale; + }; + + # BEGIN PROGRAMS + programs = { + bash = { + enable = true; + enableCompletion = true; + enableVteIntegration = true; + initExtra ='' + if [[ -z $ORIG_SHLVL ]]; then + export ORIG_SHLVL=$SHLVL + fi; + if [[ $SHLVL -gt $ORIG_SHLVL ]]; then + export PS1='\[\e[1;m\e[1;33m\e[1;m\] ($(($SHLVL - $ORIG_SHLVL))) \W\[\e[m\e[m\] 🐧 \[\e[1;32m\]~> \[\e[m\e[m\]' + else + export PS1='\[\e[1;m\e[1;33m\e[1;m\] \W\[\e[m\e[m\] 🐧 \[\e[1;32m\]~> \[\e[m\e[m\]' + fi; + set -o vi + fastfetch + ''; + shellAliases = { + build = "./build.sh"; + emacsd = "emacs --daemon"; + emacsc = "emacsclient -c -a 'emacs'"; + gap = "git add -p"; + gcp = "git commit -p"; + kpx = "keepassxc-cli open"; + ls = "ls --color=auto"; + ll = "ls -l"; + la = "ls -lA"; + nixrebuild = "nixos-rebuild build --flake ~/personal/nixos#default && sudo nixos-rebuild switch --flake ~/personal/nixos#default"; + nixbuild = "sudo nixos-rebuild switch --flake"; + nixtest = "sudo nixos-rebuild test --flake"; + new = "source $HOME/.bashrc"; + newbar = "pkill waybar; waybar &disown"; + ping = "ping -c 5"; + set-github-var = "export GITHUB=$(sed -n 2p ~/documents/.git_keys)"; + set-gitlab-var = "export GITLAB=$(sed -n 4p ~/documents/.git_keys)"; + vi = "\\vim"; + work = "nix develop --impure"; + ".." = "cd .."; + }; + }; + emacs = { + enable = true; + package = pkgs.emacs-gtk; + extraPackages = epkgs: [ + epkgs.pdf-tools + epkgs.org-pdftools + ]; + }; + feh.enable = true; + git = { + enable = true; + lfs.enable = true; + diff-so-fancy.enable = true; + userEmail = "maloneliam@proton.me"; + userName = "Liam Malone"; + }; + neovim = { + enable = true; + package = pkgs.neovim-unwrapped; + vimAlias = true; + vimdiffAlias = true; + }; + obs-studio = { + enable = true; + }; + wofi.enable = true; + }; + + + # BEGIN SERVICES + services = { + blueman-applet.enable = true; + network-manager-applet.enable = true; + + emacs = { + enable = true; + package = pkgs.emacs-gtk; + client = { + enable = true; + arguments = [ + "-c" + "-a emacs" + ]; + }; + startWithUserSession = "graphical"; + }; + + gnome-keyring.enable = true; + + gpg-agent = { + enable = true; + defaultCacheTtl = 1800; + enableSshSupport = true; + }; + + nextcloud-client.enable = true; + }; +}