From 849eb5dd11319d5dd76decbc99a4d543c061310a Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Mon, 19 Aug 2024 00:38:27 +0200 Subject: [PATCH] Update --- docs/APPS.md | 4 +- docs/src/README_template.md | 2 +- flake.nix | 10 ++-- hosts/laptop/configuration.nix | 68 +++---------------------- hosts/laptop/variables.nix | 2 +- hosts/modules/audio.nix | 20 ++++++++ hosts/modules/bluetooth.nix | 6 +++ hosts/modules/fonts.nix | 2 - hosts/modules/nvidia.nix | 3 +- hosts/modules/systemd-boot.nix | 12 +++++ hosts/modules/timezone.nix | 15 ++++++ hosts/modules/users.nix | 7 +++ hosts/server/configuration.nix | 2 - hosts/server/modules/internal/unifi.nix | 7 --- 14 files changed, 78 insertions(+), 82 deletions(-) create mode 100644 hosts/modules/audio.nix create mode 100644 hosts/modules/bluetooth.nix create mode 100644 hosts/modules/systemd-boot.nix create mode 100644 hosts/modules/timezone.nix create mode 100644 hosts/modules/users.nix delete mode 100644 hosts/server/modules/internal/unifi.nix diff --git a/docs/APPS.md b/docs/APPS.md index 523f15a..781699c 100644 --- a/docs/APPS.md +++ b/docs/APPS.md @@ -8,11 +8,12 @@ The laptop configuration is used by an Omen 16 laptop w/ nvidia and an amd gpu r The configurations files can be found in the `hosts/laptop` directory. | Category | Name | -|-----------------------------------------|----------------| +| --------------------------------------- | -------------- | | WM | Hyprland | | | hyprlock | | | hyprpaper | | | hypridle | +| | hyprcursor | | | wlogout | | Bar | waybar | | Terminal | kitty | @@ -49,7 +50,6 @@ I exposed some services to the internet using a reverse proxy (Nginx) and cloudf - Nextcloud - Vaultwarden - Adguard Home -- Unifi Controler - Uptime Kuma - "Jackflix" - Jellyfin, Transmission, *arr diff --git a/docs/src/README_template.md b/docs/src/README_template.md index a8a5ab8..9b9b6f7 100644 --- a/docs/src/README_template.md +++ b/docs/src/README_template.md @@ -17,7 +17,7 @@ It's a simple way to manage your system configuration and dotfiles. - 🏠 `home` are the dotfiles and configuration files for the users - 'programs' is a collection of apps configured with home-manager - 'scripts' is a folder full of bash scripts (see [SCRIPTS.md](docs/SCRIPTS.md)) - - 'system' is some desktop environment like configuration + - 'system' is some "desktop environment" configuration - 'wallpapers' are... wallpapers - 💻 `hosts` are the system configuration files - 'laptop' is my configuration for my laptop with Nvidia that you can copy diff --git a/flake.nix b/flake.nix index 9da77de..5404990 100644 --- a/flake.nix +++ b/flake.nix @@ -25,18 +25,18 @@ inputs.nixpkgs.follows = "nixpkgs"; }; hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; - nurpkgs.url = "github:nix-community/NUR"; + nurpkgs.url = "github:nix-community/NUR"; # TODO: test to remove nixos-hardware.url = "github:NixOS/nixos-hardware/master"; }; outputs = inputs@{ nixpkgs, ... }: { nixosConfigurations = { - nixy = nixpkgs.lib.nixosSystem { # CHANGE ME + nixy = nixpkgs.lib.nixosSystem { # CHANGEME system = "x86_64-linux"; modules = [ - ./hosts/laptop/configuration.nix # CHANGE ME - inputs.nixos-hardware.nixosModules.omen-16-n0005ne # CHANGE ME + ./hosts/laptop/configuration.nix # CHANGEME + inputs.nixos-hardware.nixosModules.omen-16-n0280nd # CHANGEME inputs.home-manager.nixosModules.home-manager { nixpkgs.overlays = [ inputs.nurpkgs.overlay ]; @@ -44,7 +44,7 @@ home-manager = { useGlobalPkgs = true; useUserPackages = true; - users."hadi" = import ./hosts/laptop/home.nix; # CHANGE ME + users."hadi" = import ./hosts/laptop/home.nix; # CHANGEME extraSpecialArgs = { inherit inputs; }; }; } diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix index a00ee3f..27cbcc6 100644 --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -5,49 +5,20 @@ ../modules/nvidia.nix # ../modules/prime.nix ../modules/tuigreet.nix + ../modules/timezone.nix ../modules/usb.nix + ../modules/systemd-boot.nix + ../modules/users.nix + ../modules/audio.nix + ../modules/bluetooth.nix ./variables.nix ]; - # Bootloader. - boot = { - loader.efi.canTouchEfiVariables = true; - loader.systemd-boot = { - enable = true; - consoleMode = "auto"; - }; - tmp.cleanOnBoot = true; - kernelPackages = - pkgs.linuxPackages_latest; # _zen, _hardened, _rt, _rt_latest, etc. - }; - # Networking networking.networkmanager.enable = true; networking.hostName = config.var.hostname; systemd.services.NetworkManager-wait-online.enable = false; - # Timezone and locale - time.timeZone = config.var.timeZone; - i18n.defaultLocale = config.var.defaultLocale; - i18n.extraLocaleSettings = { - LC_ADDRESS = config.var.extraLocale; - LC_IDENTIFICATION = config.var.extraLocale; - LC_MEASUREMENT = config.var.extraLocale; - LC_MONETARY = config.var.extraLocale; - LC_NAME = config.var.extraLocale; - LC_NUMERIC = config.var.extraLocale; - LC_PAPER = config.var.extraLocale; - LC_TELEPHONE = config.var.extraLocale; - LC_TIME = config.var.extraLocale; - }; - - # Users - users.users.${config.var.username} = { - isNormalUser = true; - description = "${config.var.username} account"; - extraGroups = [ "networkmanager" "wheel" ]; - }; - services = { tailscale.enable = config.var.tailscale; xserver = { @@ -69,11 +40,6 @@ }; users.defaultUserShell = pkgs.zsh; - hardware.bluetooth = { - enable = true; - powerOnBoot = true; - }; - # Set environment variables environment.variables = { XDG_DATA_HOME = "$HOME/.local/share"; @@ -85,25 +51,6 @@ NIXOS_OZONE_WL = "1"; }; - security.rtkit.enable = true; - hardware.pulseaudio.enable = false; - - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; - wireplumber = { - enable = true; - extraConfig = { - "10-disable-camera" = { - "wireplumber.profiles" = { main."monitor.libcamera" = "disabled"; }; - }; - }; - }; - }; - nix = { extraOptions = '' warn-dirty = false @@ -126,7 +73,8 @@ nixpkgs.config.allowUnfree = true; environment.systemPackages = with pkgs; [ networkmanagerapplet ]; - nixpkgs.config.permittedInsecurePackages = [ "electron-25.9.0" ]; + nixpkgs.config.permittedInsecurePackages = + [ "electron-25.9.0" ]; # TODO: test to remove system.autoUpgrade = { enable = config.var.autoUpgrade; @@ -136,7 +84,7 @@ allowReboot = false; }; - xdg.portal = { + xdg.portal = { # TODO: test to remove enable = true; configPackages = with pkgs; [ xdg-desktop-portal-gtk ]; }; diff --git a/hosts/laptop/variables.nix b/hosts/laptop/variables.nix index 38f592f..5b8dc88 100644 --- a/hosts/laptop/variables.nix +++ b/hosts/laptop/variables.nix @@ -27,7 +27,7 @@ # change the nvim's obsidian configuration if you want to enable that: obsidian = true; tailscale = true; - usbguard = false; + usbguard = false; # TODO: Add the allow list variable theme = import ../themes/nixy.nix; # select your theme here }; diff --git a/hosts/modules/audio.nix b/hosts/modules/audio.nix new file mode 100644 index 0000000..f25767a --- /dev/null +++ b/hosts/modules/audio.nix @@ -0,0 +1,20 @@ +{ + security.rtkit.enable = true; + hardware.pulseaudio.enable = false; + + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + wireplumber = { + enable = true; + extraConfig = { + "10-disable-camera" = { + "wireplumber.profiles" = { main."monitor.libcamera" = "disabled"; }; + }; + }; + }; + }; +} diff --git a/hosts/modules/bluetooth.nix b/hosts/modules/bluetooth.nix new file mode 100644 index 0000000..1b6e38b --- /dev/null +++ b/hosts/modules/bluetooth.nix @@ -0,0 +1,6 @@ +{ + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + }; +} diff --git a/hosts/modules/fonts.nix b/hosts/modules/fonts.nix index 339ce3e..02b26cd 100644 --- a/hosts/modules/fonts.nix +++ b/hosts/modules/fonts.nix @@ -28,7 +28,6 @@ enableDefaultPackages = false; - # this fixes emoji stuff fontconfig = { defaultFonts = { monospace = [ "FiraCode Nerd Font Mono" "Noto Color Emoji" ]; @@ -37,6 +36,5 @@ emoji = [ "Noto Color Emoji" ]; }; }; - }; } diff --git a/hosts/modules/nvidia.nix b/hosts/modules/nvidia.nix index 380e4c8..987200e 100644 --- a/hosts/modules/nvidia.nix +++ b/hosts/modules/nvidia.nix @@ -1,7 +1,7 @@ { lib, pkgs, config, ... }: let nvidiaDriverChannel = - config.boot.kernelPackages.nvidiaPackages.beta; # stable, latest, etc. + config.boot.kernelPackages.nvidiaPackages.beta; # stable, latest, beta, etc. in { # Load nvidia driver for Xorg and Wayland services.xserver.videoDrivers = @@ -14,7 +14,6 @@ in { ]; environment.variables = { GBM_BACKEND = "nvidia-drm"; - WLR_NO_HARDWARE_CURSORS = "1"; LIBVA_DRIVER_NAME = "nvidia"; # hardware acceleration __GLX_VENDOR_LIBRARY_NAME = "nvidia"; }; diff --git a/hosts/modules/systemd-boot.nix b/hosts/modules/systemd-boot.nix new file mode 100644 index 0000000..752e44f --- /dev/null +++ b/hosts/modules/systemd-boot.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: { + boot = { + loader.efi.canTouchEfiVariables = true; + loader.systemd-boot = { + enable = true; + consoleMode = "auto"; + }; + tmp.cleanOnBoot = true; + kernelPackages = + pkgs.linuxPackages_latest; # _zen, _hardened, _rt, _rt_latest, etc. + }; +} diff --git a/hosts/modules/timezone.nix b/hosts/modules/timezone.nix new file mode 100644 index 0000000..a157add --- /dev/null +++ b/hosts/modules/timezone.nix @@ -0,0 +1,15 @@ +{ config, ... }: { + time.timeZone = config.var.timeZone; + i18n.defaultLocale = config.var.defaultLocale; + i18n.extraLocaleSettings = { + LC_ADDRESS = config.var.extraLocale; + LC_IDENTIFICATION = config.var.extraLocale; + LC_MEASUREMENT = config.var.extraLocale; + LC_MONETARY = config.var.extraLocale; + LC_NAME = config.var.extraLocale; + LC_NUMERIC = config.var.extraLocale; + LC_PAPER = config.var.extraLocale; + LC_TELEPHONE = config.var.extraLocale; + LC_TIME = config.var.extraLocale; + }; +} diff --git a/hosts/modules/users.nix b/hosts/modules/users.nix new file mode 100644 index 0000000..a1d78a8 --- /dev/null +++ b/hosts/modules/users.nix @@ -0,0 +1,7 @@ +{ config, ... }: { + users.users.${config.var.username} = { + isNormalUser = true; + description = "${config.var.username} account"; + extraGroups = [ "networkmanager" "wheel" ]; + }; +} diff --git a/hosts/server/configuration.nix b/hosts/server/configuration.nix index 6aa9a7e..7eaddf3 100644 --- a/hosts/server/configuration.nix +++ b/hosts/server/configuration.nix @@ -9,7 +9,6 @@ ./modules/internal/openssh.nix ./modules/internal/adguard.nix ./modules/internal/cockpit.nix - # ./modules/internal/unifi.nix # FIXME: unifi5 is deprecated # exposed ./modules/exposed/ntfy-sh.nix @@ -19,7 +18,6 @@ ./modules/exposed/nginx.nix ./modules/exposed/nextcloud.nix ./modules/exposed/vaultwarden.nix - # ./modules/exposed/bitcoin-git.nix # FIXME: bitcoin-git is deprecated ./modules/www # jackflix diff --git a/hosts/server/modules/internal/unifi.nix b/hosts/server/modules/internal/unifi.nix deleted file mode 100644 index 0d9e430..0000000 --- a/hosts/server/modules/internal/unifi.nix +++ /dev/null @@ -1,7 +0,0 @@ -# unifi controller service -{ - services.unifi = { - enable = true; - openFirewall = true; # 8443(webui) and other port use by AP - }; -}