From c44ae86ac1a7e7b2bc7cc630aafd46568199a266 Mon Sep 17 00:00:00 2001 From: jackjohn7 <70782491+jackjohn7@users.noreply.github.com> Date: Thu, 26 Mar 2026 08:36:16 -0500 Subject: [PATCH] wip --- modules/features/layers/base.nix | 29 ---- modules/features/layers/fonts.nix | 14 ++ modules/features/layers/hyprland.nix | 5 + modules/features/layers/pipewire.nix | 19 +++ modules/features/layers/user.nix | 15 ++ modules/hosts/desktop/configuration.nix | 4 +- modules/hosts/laptop/configuration.nix | 144 ++++++++++++++++++ modules/hosts/laptop/default.nix | 7 + .../hosts/laptop/hardware-configuration.nix | 37 +++++ 9 files changed, 244 insertions(+), 30 deletions(-) create mode 100644 modules/features/layers/fonts.nix create mode 100644 modules/features/layers/hyprland.nix create mode 100644 modules/features/layers/pipewire.nix create mode 100644 modules/features/layers/user.nix create mode 100644 modules/hosts/laptop/configuration.nix create mode 100644 modules/hosts/laptop/default.nix create mode 100644 modules/hosts/laptop/hardware-configuration.nix diff --git a/modules/features/layers/base.nix b/modules/features/layers/base.nix index ced5a75..bb36e4b 100644 --- a/modules/features/layers/base.nix +++ b/modules/features/layers/base.nix @@ -21,10 +21,6 @@ # Enable the X11 windowing system. services.xserver.enable = true; - # Enable the GNOME Desktop Environment. - services.xserver.displayManager.gdm.enable = true; - services.xserver.desktopManager.gnome.enable = true; - # Configure keymap in X11 services.xserver.xkb = { layout = "us"; @@ -34,35 +30,10 @@ # Enable CUPS to print documents. services.printing.enable = true; - # Enable sound with pipewire. - services.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 touchpad support (enabled default in most desktopManager). # services.xserver.libinput.enable = true; - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.jingus = { - isNormalUser = true; - description = "jingus"; - extraGroups = [ "networkmanager" "wheel" ]; - shell = pkgs.zsh; - packages = with pkgs; [ - # thunderbird - ]; - }; # Some programs need SUID wrappers, can be configured further or are # started in user sessions. diff --git a/modules/features/layers/fonts.nix b/modules/features/layers/fonts.nix new file mode 100644 index 0000000..10e34e9 --- /dev/null +++ b/modules/features/layers/fonts.nix @@ -0,0 +1,14 @@ +{ self, inputs, ... }: { + flake.nixosModules.fonts = { pkgs, lib, ... }: { + fonts.packages = with pkgs; [ + noto-fonts + noto-fonts-cjk-sans + noto-fonts-emoji + liberation_ttf + nerd-fonts.martian-mono + dina-font + proggyfonts + ripgrep + ]; + }; +} diff --git a/modules/features/layers/hyprland.nix b/modules/features/layers/hyprland.nix new file mode 100644 index 0000000..61b1c46 --- /dev/null +++ b/modules/features/layers/hyprland.nix @@ -0,0 +1,5 @@ +{ self, inputs, ... }: { + flake.nixosModules.development = { pkgs, lib, ... }: { + programs.hyprland.enable = true; + }; +} diff --git a/modules/features/layers/pipewire.nix b/modules/features/layers/pipewire.nix new file mode 100644 index 0000000..b58f7ca --- /dev/null +++ b/modules/features/layers/pipewire.nix @@ -0,0 +1,19 @@ +{ self, inputs, ... }: { + flake.nixosModules.pipewire = { pkgs, lib, ... }: { + # Enable sound with pipewire. + services.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; + }; + }; +} diff --git a/modules/features/layers/user.nix b/modules/features/layers/user.nix new file mode 100644 index 0000000..94a9427 --- /dev/null +++ b/modules/features/layers/user.nix @@ -0,0 +1,15 @@ + +{ self, inputs, ... }: { + flake.nixosModules.user = { pkgs, lib, ... }: { + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.jingus = { + isNormalUser = true; + description = "jingus"; + extraGroups = [ "networkmanager" "wheel" ]; + shell = pkgs.zsh; + packages = with pkgs; [ + # thunderbird + ]; + }; + }; +} diff --git a/modules/hosts/desktop/configuration.nix b/modules/hosts/desktop/configuration.nix index a6941b0..93d74b2 100644 --- a/modules/hosts/desktop/configuration.nix +++ b/modules/hosts/desktop/configuration.nix @@ -2,8 +2,10 @@ { flake.nixosModules.desktopConfiguration = {pkgs, lib, ... }: { imports = - [ # Include the results of the hardware scan. + [ self.nixosModules.base + self.nixosModules.pipewire + self.nixosModules.fonts self.nixosModules.gaming self.nixosModules.development self.nixosModules.desktopHardware diff --git a/modules/hosts/laptop/configuration.nix b/modules/hosts/laptop/configuration.nix new file mode 100644 index 0000000..4935524 --- /dev/null +++ b/modules/hosts/laptop/configuration.nix @@ -0,0 +1,144 @@ +{ self, inputs, ... }: +{ + flake.nixosModules.laptopConfiguration = {pkgs, lib, ... }: { + imports = + [ + self.nixosModules.laptopHardware + self.nixosModules.base + self.nixosModules.fonts + self.nixosModules.pipewire + self.nixosModules.development + self.nixosModules.librewolf + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Use latest kernel. + boot.kernelPackages = pkgs.linuxPackages_latest; + + networking.hostName = "nixos"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "us"; + variant = ""; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.jingo = { + isNormalUser = true; + description = "j"; + extraGroups = [ "networkmanager" "wheel" "docker" "dialout" ]; + packages = with pkgs; []; + shell = pkgs.zsh; + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + wget + git + kitty + wofi + firefox + waybar + wl-clipboard + ripgrep + emacs-pgtk + zsh + zellij + zip + unzip + gnome-keyring + usbutils + dfu-util + libsecret + seahorse + ]; + + programs.zsh.enable = true; + + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + programs.hyprland.enable = true; + + virtualisation.docker.enable = true; + # enable emulation for ARM (for cross-compiling for RaspberryPi) + boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; + + # List services that you want to enable: + services.displayManager.ly = { + enable = true; + }; + programs.seahorse.enable = true; + services.gnome.gnome-keyring.enable = true; + services.dbus = { + enable = true; + packages = [ pkgs.gnome-keyring pkgs.gcr ]; + }; + # Define udev rules for DFU devices + services.udev.extraRules = '' + # Generic DFU rule (for meshtastic thingy) + SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", MODE="0666", GROUP="dialout" + SUBSYSTEM=="usb", ATTRS{idVendor}=="303a", ATTRS{idProduct}=="1001", MODE="0666", GROUP="dialout" + ''; + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + security.pam.services.ly.enableGnomeKeyring = true; + + nix.settings = { + experimental-features = [ "nix-command" "flakes" ]; + substituters = [ + "https://cache.nixos.org/" + "https://cache.garnix.io" + ]; + trusted-public-keys = [ + # Default NixOS cache key + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + # Garnix cache key + "cache.garnix.io:Lf0liRJ2oT5zekG0arzGcHtrIfuVjGrAG1MxRCBuFlA=" + ]; + download-buffer-size = 524288000; + }; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "25.05"; # Did you read the comment? + + swapDevices = [ { + device = "/dev/disk/by-label/swap"; # Or "/dev/sda2" + } ]; + }; +} diff --git a/modules/hosts/laptop/default.nix b/modules/hosts/laptop/default.nix new file mode 100644 index 0000000..71f2e53 --- /dev/null +++ b/modules/hosts/laptop/default.nix @@ -0,0 +1,7 @@ +{ self, inputs, ... }: { + flake.nixosConfigurations.laptop = inputs.nixpkgs.lib.nixosSystem { + modules = [ + self.nixosModules.laptopConfiguration + ]; + }; +} diff --git a/modules/hosts/laptop/hardware-configuration.nix b/modules/hosts/laptop/hardware-configuration.nix new file mode 100644 index 0000000..0affd77 --- /dev/null +++ b/modules/hosts/laptop/hardware-configuration.nix @@ -0,0 +1,37 @@ +{ self, inputs, ... }: { + flake.nixosModules.laptopHardware = { config, lib, pkgs, modulesPath, nixpkgs, ... }: { + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/78d511b1-8932-4af7-b74d-8194aeef0903"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/776B-1FD9"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/a0077d83-9d7b-4ecd-b60b-2de46562d841"; } + ]; + + # 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.wlp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + }; +}