diff --git a/machines/laptop.nix b/machines/laptop.nix index d74a660..b45a6f6 100644 --- a/machines/laptop.nix +++ b/machines/laptop.nix @@ -18,6 +18,7 @@ # Enabled modules modules = { + base.enable = true; pipewire.enable = true; wpa_supplicant.enable = true; }; diff --git a/merged.nix b/merged.nix index 4bcbf81..c0d7b2c 100644 --- a/merged.nix +++ b/merged.nix @@ -94,36 +94,36 @@ in { # }; # Use the systemd-boot EFI boot loader. - boot = { - loader = { - systemd-boot.enable = true; - systemd-boot.editor = false; - efi.canTouchEfiVariables = true; - timeout = 0; - }; + # boot = { + # loader = { + # systemd-boot.enable = true; + # systemd-boot.editor = false; + # efi.canTouchEfiVariables = true; + # timeout = 0; + # }; - tmp.cleanOnBoot = true; + # tmp.cleanOnBoot = true; - consoleLogLevel = 0; - initrd.verbose = false; - initrd.checkJournalingFS = false; + # consoleLogLevel = 0; + # initrd.verbose = false; + # initrd.checkJournalingFS = false; - plymouth = { - enable = false; - theme = "text"; - }; + # plymouth = { + # enable = false; + # theme = "text"; + # }; - kernelParams = [ - "quiet" - "boot.shell_on_fail" - "loglevel=3" - "rd.systemd.show_status=false" - "rd.udev.log_level=3" - "udev.log_priority=3" - "video=efifb:nobgrt" - "bgrt_disable" - ]; - }; + # kernelParams = [ + # "quiet" + # "boot.shell_on_fail" + # "loglevel=3" + # "rd.systemd.show_status=false" + # "rd.udev.log_level=3" + # "udev.log_priority=3" + # "video=efifb:nobgrt" + # "bgrt_disable" + # ]; + # }; # Set up console # console = { @@ -136,28 +136,28 @@ in { # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # networking.wireless.allowAuxiliaryImperativeNetworks = true; - nixpkgs.config.allowUnfree = true; + # nixpkgs.config.allowUnfree = true; # Set up graphics - hardware.graphics.enable32Bit = true; - hardware.graphics.enable = true; - services.xserver.videoDrivers = ["nvidia"]; - hardware.nvidia = { - modesetting.enable = true; - powerManagement.enable = false; - powerManagement.finegrained = false; - open = false; - nvidiaSettings = true; - package = config.boot.kernelPackages.nvidiaPackages.stable; - prime = { - intelBusId = "PCI:0:2:0"; - nvidiaBusId = "PCI:1:0:0"; - offload = { - enable = true; - enableOffloadCmd = true; - }; - }; - }; + # hardware.graphics.enable32Bit = true; + # hardware.graphics.enable = true; + # services.xserver.videoDrivers = ["nvidia"]; + # hardware.nvidia = { + # modesetting.enable = true; + # powerManagement.enable = false; + # powerManagement.finegrained = false; + # open = false; + # nvidiaSettings = true; + # package = config.boot.kernelPackages.nvidiaPackages.stable; + # prime = { + # intelBusId = "PCI:0:2:0"; + # nvidiaBusId = "PCI:1:0:0"; + # offload = { + # enable = true; + # enableOffloadCmd = true; + # }; + # }; + # }; # Set up tailscale # services.tailscale = { @@ -182,7 +182,7 @@ in { # }; # Set up input - services.libinput.enable = true; + # services.libinput.enable = true; # Display manager # services.greetd = { @@ -201,14 +201,14 @@ in { # Enable programs # programs.river.enable = true; - xdg.portal = { - enable = true; + # xdg.portal = { + # enable = true; - extraPortals = [ - pkgs.xdg-desktop-portal-gtk - pkgs.xdg-desktop-portal-wlr - ]; - }; + # extraPortals = [ + # pkgs.xdg-desktop-portal-gtk + # pkgs.xdg-desktop-portal-wlr + # ]; + # }; # Gamer moment # programs.steam.enable = true; @@ -225,10 +225,10 @@ in { # pr` # dconf - programs.dconf.enable = true; + # programs.dconf.enable = true; # Fonts - fonts.packages = with pkgs; [ + # fonts.packages = with pkgs; [ # my-wqy-zenhei # my-wqy-microhei # my-wqy-bitmapsong @@ -239,7 +239,7 @@ in { #unifont # Replace with Kissinger2 #unifont_upper # Replace with Kissinger 2 # (nerdfonts.override { fonts = ["NerdFontsSymbolsOnly"]; }) - ]; + # ]; # fonts.fontconfig.defaultFonts = { # serif = [ # # "DejaVu Serif" @@ -272,12 +272,12 @@ in { # List packages installed in system profile. To search, run: # $ nix search wget - environment.systemPackages = with pkgs; [ - git - vim - wget - curl - ]; + # environment.systemPackages = with pkgs; [ + # git + # vim + # wget + # curl + # ]; # Some programs need SUID wrappers, can be configured further or are # started in user sessions. diff --git a/modules/base/default.nix b/modules/base/default.nix index e69de29..c919482 100644 --- a/modules/base/default.nix +++ b/modules/base/default.nix @@ -0,0 +1,48 @@ +{ lib, config, pkgs, ... }: + +with lib; +let + cfg = config.modules.base; +in { + options.modules.base = { + enable = mkEnableOption "base"; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + # Add base linux utilities + git + wget + curl + dig + nix-tree + ]; + + modules = { + # Enable base modules + clean-tmp.enable = true; + fontconfig.enable = true; + neovim.enable = true; + systemd-boot.enable = true; + tuigreet.enable = true; + tailscale.enable = true; + }; + + # TODO: Remove everything below, it is here out of convenience and should be elsewhere + programs.dconf.enable = true; + xdg.portal = { + enable = true; + + extraPortals = with pkgs; [ + xdg-desktop-portal-gtk + xdg-desktop-portal-wlr + ]; + }; + services.libinput.enable = true; + modules.unfree.enable = true; + modules.unfree.allowedPackages = [ + "nvidia-x11" + "nvidia-settings" + ]; + }; +} \ No newline at end of file diff --git a/modules/boot/clean-tmp.nix b/modules/boot/clean-tmp.nix new file mode 100644 index 0000000..cbf0fc6 --- /dev/null +++ b/modules/boot/clean-tmp.nix @@ -0,0 +1,14 @@ +{ lib, config, pkgs, ... }: + +with lib; +let + cfg = config.modules.clean-tmp; +in { + options.modules.clean-tmp = { + enable = mkEnableOption "clean-tmp"; + }; + + config = mkIf cfg.enable { + boot.tmp.cleanOnBoot = true; + }; +} \ No newline at end of file diff --git a/modules/boot/silent-boot.nix b/modules/boot/silent-boot.nix new file mode 100644 index 0000000..b509fcc --- /dev/null +++ b/modules/boot/silent-boot.nix @@ -0,0 +1,31 @@ +{ lib, config, pkgs, ... }: + +with lib; +let + cfg = config.modules.silent-boot; +in { + options.modules.silent-boot = { + enable = mkEnableOption "silent-boot"; + }; + + config = mkIf cfg.enable { + boot = { + loader.timeout = 0; + }; + + consoleLogLevel = 0; + initrd.verbose = false; + initrd.checkJournalingFS = false; + + kernelParams = [ + "quiet" + "boot.shell_on_fail" + "loglevel=3" + "rd.systemd.show_status=false" + "rd.udev.log_level=3" + "udev.log_priority=3" + "video=efifb:nobgrt" + "bgrt_disable" + ]; + }; +} \ No newline at end of file diff --git a/modules/boot/systemd-boot.nix b/modules/boot/systemd-boot.nix new file mode 100644 index 0000000..556803a --- /dev/null +++ b/modules/boot/systemd-boot.nix @@ -0,0 +1,18 @@ +{ lib, config, pkgs, ... }: + +with lib; +let + cfg = config.modules.systemd-boot; +in { + options.modules.systemd-boot = { + enable = mkEnableOption "systemd-boot"; + }; + + config = mkIf cfg.enable { + boot.loader = { + systemd-boot.enable = true; + systemd-boot.editor = false; + efi.canTouchEfiVariables = true; + }; + }; +} \ No newline at end of file diff --git a/modules/default.nix b/modules/default.nix index 4c66d64..1a5c0d9 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -3,7 +3,13 @@ with lib; { imports = [ # Import modules + ./base/default.nix + ./boot/clean-tmp.nix + ./boot/silent-boot.nix + ./boot/systemd-boot.nix + ./brightnessctl/default.nix ./fontconfig/default.nix + ./graphics/default.nix ./greeter/greetd/default.nix ./greeter/greetd/tuigreet.nix ./locale/default.nix @@ -14,12 +20,4 @@ with lib; { ./vpn/tailscale.nix ./wifi/wpa_supplicant.nix ]; - - config.modules = { - # Enable default modules - fontconfig.enable = mkDefault true; - neovim.enable = mkDefault true; - tuigreet.enable = mkDefault true; - tailscale.enable = mkDefault true; - }; } diff --git a/modules/graphics/default.nix b/modules/graphics/default.nix new file mode 100644 index 0000000..57eac06 --- /dev/null +++ b/modules/graphics/default.nix @@ -0,0 +1,27 @@ +{ lib, config, pkgs, ... }: + +{ + config = { + # TODO: Modularize further, especially modesetting should be its own module. + # Set up graphics + hardware.graphics.enable32Bit = true; + hardware.graphics.enable = true; + services.xserver.videoDrivers = ["nvidia"]; + hardware.nvidia = { + modesetting.enable = true; + powerManagement.enable = false; + powerManagement.finegrained = false; + open = false; + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.stable; + prime = { + intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:1:0:0"; + offload = { + enable = true; + enableOffloadCmd = true; + }; + }; + }; + }; +} \ No newline at end of file