diff --git a/common.nix b/common.nix deleted file mode 100644 index 0bd5471..0000000 --- a/common.nix +++ /dev/null @@ -1,72 +0,0 @@ -_: { - lib, - pkgs, - ... -}: { - #use a better tty - services.kmscon = { - enable = true; - hwRender = true; - extraConfig = '' - font-size=10 - ''; - fonts = [ - { - name = "Overpass Mono"; - package = pkgs.overpass; - } - { - name = "OverpassMono Nerd Font"; - package = - pkgs.nerdfonts.override - { - fonts = ["Overpass"]; - }; - } - { - name = "Material Design Icons"; - package = pkgs.material-design-icons; - } - ]; - }; - systemd.services = { - "autovt@tty1".enable = false; - "kmsconvt@tty1".enable = false; - }; - - networking = { - firewall = { - enable = true; - allowPing = true; - }; - networkmanager.enable = true; - }; - #enable ssh - programs = { - mtr.enable = true; #ping and traceroute - gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; - }; - services.openssh = { - enable = true; - settings = { - PermitRootLogin = "yes"; - PasswordAuthentication = false; - KbdInteractiveAuthentication = false; - }; - }; - - #time settings - time.timeZone = "America/New_York"; - services = { - timesyncd = { - enable = true; - servers = [ - "time.cloudflare.com" - ]; - }; - }; - i18n.defaultLocale = "en_US.UTF-8"; -} diff --git a/flake.nix b/flake.nix index 8f19947..5d812b0 100644 --- a/flake.nix +++ b/flake.nix @@ -57,7 +57,6 @@ modules = [ (import ./modules inputs) - (import ./common.nix inputs) (import ./systems/gerg-desktop inputs) { nixpkgs.overlays = [ @@ -78,7 +77,6 @@ }; modules = [ (import ./modules inputs) - (import ./common.nix inputs) (import ./systems/game-laptop inputs) ]; }; @@ -93,7 +91,6 @@ }; modules = [ (import ./modules inputs) - (import ./common.nix inputs) (import ./systems/mom-laptop inputs) ]; }; diff --git a/imports/fonts.nix b/imports/fonts.nix index bfce5f3..567e18b 100644 --- a/imports/fonts.nix +++ b/imports/fonts.nix @@ -1,4 +1,5 @@ _: {pkgs, ...}: { + #use a better tty services.kmscon = { enable = true; hwRender = true; @@ -24,6 +25,11 @@ _: {pkgs, ...}: { } ]; }; + systemd.services = { + "autovt@tty1".enable = false; + "kmsconvt@tty1".enable = false; + }; + fonts = { fonts = with pkgs; [ overpass diff --git a/imports/picom.nix b/imports/picom.nix deleted file mode 100644 index 4c8773b..0000000 --- a/imports/picom.nix +++ /dev/null @@ -1,41 +0,0 @@ -_: { - services.picom = { - enable = true; - backend = "glx"; - shadow = false; - shadowOpacity = 0.5; - vSync = false; - settings = { - blur = false; - - shadow-radius = 12; - frame-opacity = 1.0; - inactive-opacity-override = false; - corner-radius = 12; - rounded-corners-exclude = [ - "window_type = 'desktop'" - "window_type = 'tooltip'" - ]; - mark-wmwin-focused = true; - mark-ovredir-focused = true; - detect-rounded-corners = true; - detect-client-opacity = true; - detect-transient = true; - use-damage = true; - log-level = "warn"; - wintypes = { - tooltip = { - fade = true; - shadow = false; - opacity = 1.0; - focus = true; - full-shadow = false; - }; - dock = {shadow = true;}; - dnd = {shadow = true;}; - popup_menu = {opacity = 1.0;}; - dropdown_menu = {opacity = 1.0;}; - }; - }; - }; -} diff --git a/imports/shells.nix b/imports/shells.nix index 70e2e69..dcefa35 100644 --- a/imports/shells.nix +++ b/imports/shells.nix @@ -6,6 +6,7 @@ #put: #source /run/current-system/sw/share/nix-direnv/direnvrc #in ~/.direnvrc + #do i need to do this^? environment = { systemPackages = [ pkgs.dash @@ -38,7 +39,7 @@ nix-boot = "nixos-rebuild boot --use-remote-sudo"; nix-clean = "nix-collect-garbage -d"; nix-gc-force = "rm /nix/var/nix/gcroots/auto/*"; - nix-gc-check = "sudo nix-store --gc --print-roots | egrep -v \"^(/nix/var|/run/\w+-system|\{memory|/proc)\""; + nix-gc-check = "nix-store --gc --print-roots | egrep -v \"^(/nix/var|/run/\w+-system|\{memory|/proc)\""; #vim stuff vi = "nvim"; vim = "nvim"; diff --git a/modules/DE-WM/default.nix b/modules/DE/default.nix similarity index 100% rename from modules/DE-WM/default.nix rename to modules/DE/default.nix diff --git a/modules/DE-WM/dwm.nix b/modules/DE/dwm.nix similarity index 74% rename from modules/DE-WM/dwm.nix rename to modules/DE/dwm.nix index c584b86..43aef74 100644 --- a/modules/DE-WM/dwm.nix +++ b/modules/DE/dwm.nix @@ -7,13 +7,14 @@ ... }: with lib; let - cfg = config.localModules.dwm; + cfg = config.localModules.DE.dwm; in { - options.localModules.dwm = { + options.localModules.DE.dwm = { enable = mkEnableOption ""; }; config = mkIf cfg.enable { + services.gvfs.enable = true; environment.systemPackages = [suckless.packages.${pkgs.system}.dmenu]; services.xserver = { enable = true; @@ -23,7 +24,7 @@ in { }; displayManager = { sessionCommands = '' - feh --bg-scale ${self + /misc/recursion.png} + ${pkgs.feh}/bin/feh --bg-scale ${self + /misc/recursion.png} ''; defaultSession = "none+dwm"; }; diff --git a/modules/DE-WM/gnome.nix b/modules/DE/gnome.nix similarity index 93% rename from modules/DE-WM/gnome.nix rename to modules/DE/gnome.nix index cf8564f..a731aba 100644 --- a/modules/DE-WM/gnome.nix +++ b/modules/DE/gnome.nix @@ -6,9 +6,9 @@ _: { ... }: with lib; let - cfg = config.localModules.gnome; + cfg = config.localModules.DE.gnome; in { - options.localModules.gnome = { + options.localModules.DE.gnome = { enable = mkEnableOption ""; }; config = mkIf cfg.enable { diff --git a/modules/DE-WM/xfce.nix b/modules/DE/xfce.nix similarity index 82% rename from modules/DE-WM/xfce.nix rename to modules/DE/xfce.nix index a42d9e9..53258d4 100644 --- a/modules/DE-WM/xfce.nix +++ b/modules/DE/xfce.nix @@ -5,9 +5,9 @@ _: { ... }: with lib; let - cfg = config.localModules.xfce; + cfg = config.localModules.DE.xfce; in { - options.localModules.xfce = { + options.localModules.DE.xfce = { enable = mkEnableOption ""; }; config = mkIf cfg.enable { diff --git a/modules/DM/autoLogin.nix b/modules/DM/autoLogin.nix index 0973e66..200cda8 100644 --- a/modules/DM/autoLogin.nix +++ b/modules/DM/autoLogin.nix @@ -6,12 +6,10 @@ _: { ... }: with lib; let - cfg = config.localModules.autoLogin; + cfg = config.localModules.DM.autoLogin; in { - options.localModules.autoLogin = { - enable = mkEnableOption ""; - }; - config = mkIf cfg.enable { + options.localModules.DM.autoLogin = mkEnableOption ""; + config = mkIf cfg { services.xserver.displayManager = { autoLogin = { enable = true; diff --git a/modules/DM/lightDM.nix b/modules/DM/lightDM.nix index 1a06a94..0ddb1d3 100644 --- a/modules/DM/lightDM.nix +++ b/modules/DM/lightDM.nix @@ -7,9 +7,9 @@ _: { ... }: with lib; let - cfg = config.localModules.lightdm; + cfg = config.localModules.DM.lightdm; in { - options.localModules.lightdm = { + options.localModules.DM.lightdm = { enable = mkEnableOption ""; }; config = mkIf cfg.enable { diff --git a/modules/X11.nix b/modules/X11.nix new file mode 100644 index 0000000..0f9671b --- /dev/null +++ b/modules/X11.nix @@ -0,0 +1,124 @@ +_: { + config, + pkgs, + options, + lib, + ... +}: +with lib; let + cfg = config.localModules.X11Programs; +in { + options.localModules.X11Programs = { + picom.enable = mkEnableOption ""; + sxhkd.enable = mkEnableOption ""; + }; + config = mkMerge [ + { + services.xserver = { + exportConfiguration = true; + layout = "us"; + libinput.enable = true; + xautolock.enable = false; + excludePackages = [pkgs.xterm]; + }; + } + + ( + mkIf cfg.picom.enable { + services.picom = { + enable = true; + backend = "glx"; + shadow = false; + shadowOpacity = 0.5; + vSync = false; + settings = { + blur = false; + + shadow-radius = 12; + frame-opacity = 1.0; + inactive-opacity-override = false; + corner-radius = 12; + rounded-corners-exclude = [ + "window_type = 'desktop'" + "window_type = 'tooltip'" + ]; + mark-wmwin-focused = true; + mark-ovredir-focused = true; + detect-rounded-corners = true; + detect-client-opacity = true; + detect-transient = true; + use-damage = true; + log-level = "warn"; + wintypes = { + tooltip = { + fade = true; + shadow = false; + opacity = 1.0; + focus = true; + full-shadow = false; + }; + dock = {shadow = true;}; + dnd = {shadow = true;}; + popup_menu = {opacity = 1.0;}; + dropdown_menu = {opacity = 1.0;}; + }; + }; + }; + } + ) + ( + let + configFile = pkgs.writeText "sxhkdrc" '' + XF86AudioPlay + playerctl play-pause + XF86AudioPause + playerctl play-pause + XF86AudioStop + playerctl stop + XF86AudioNext + playerctl next + XF86AudioPrev + playerctl previous + XF86AudioRaiseVolume + amixer sset Master 40+ + XF86AudioLowerVolume + amixer sset Master 40- + XF86AudioMute + amixer sset Master toggle + XF86MonBrightnessUp + brightnessctl s 20+ + XF86MonBrightnessDown + brightnessctl s 20- + Print + maim $HOME/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg + Print + shift + maim | xclip -selection clipboard -t image/png + super + Print + maim -s $HOME/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg + super + Print + shift + maim -s | xclip -selection clipboard -t image/png + ''; + in + mkIf cfg.sxhkd.enable + { + environment.systemPackages = [ + pkgs.maim #screenshooter + pkgs.brightnessctl #brightness control for laptop + pkgs.playerctl #music control + pkgs.xclip + pkgs.coreutils + ]; + systemd.user.services.sxhkd = { + description = "sxhkd hotkey daemon"; + wantedBy = ["graphical-session.target"]; + partOf = ["graphical-session.target"]; + serviceConfig = { + ExecStart = "${pkgs.sxhkd}/bin/sxhkd -c ${configFile}"; + RestartSec = 3; + Restart = "always"; + }; + }; + } + ) + ]; +} diff --git a/imports/boot.nix b/modules/boot.nix similarity index 95% rename from imports/boot.nix rename to modules/boot.nix index 4bef5e4..86a5cb0 100644 --- a/imports/boot.nix +++ b/modules/boot.nix @@ -11,7 +11,7 @@ _: {lib, ...}: { consoleLogLevel = 0; initrd.verbose = false; plymouth = { - enable = true; + enable = lib.mkDefault true; theme = "breeze"; logo = ../misc/nixos.png; }; diff --git a/modules/common/default.nix b/modules/common/default.nix deleted file mode 100644 index 7097285..0000000 --- a/modules/common/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -inputs: { - imports = [ - (import ./nix.nix inputs) - (import ./x.nix inputs) - ]; -} diff --git a/modules/common/x.nix b/modules/common/x.nix deleted file mode 100644 index c72d600..0000000 --- a/modules/common/x.nix +++ /dev/null @@ -1,15 +0,0 @@ -_: { - lib, - pkgs, - ... -}: -with lib; { - services.xserver = { - exportConfiguration = mkDefault true; - layout = mkDefault "us"; - libinput.enable = mkDefault true; - xautolock.enable = mkDefault false; - desktopManager.xterm.enable = mkDefault false; - excludePackages = mkDefault [pkgs.xterm]; - }; -} diff --git a/modules/default.nix b/modules/default.nix index 01403a0..ace8af0 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,9 +1,12 @@ inputs: { imports = [ - (import ./sxhkd.nix inputs) - (import ./common inputs) + (import ./boot.nix inputs) + (import ./misc.nix inputs) + (import ./packages.nix inputs) + (import ./X11.nix inputs) + (import ./nix.nix inputs) (import ./unfree.nix inputs) - (import ./DE-WM inputs) + (import ./DE inputs) (import ./DM inputs) (import ./hardware.nix inputs) ]; diff --git a/modules/hardware.nix b/modules/hardware.nix index 31660bd..42180c4 100644 --- a/modules/hardware.nix +++ b/modules/hardware.nix @@ -1,8 +1,10 @@ _: { config, options, + lib, ... -}: let +}: +with lib; let cfg = config.localModules.hardware; in { options.localModules.hardware = { @@ -19,41 +21,41 @@ in { }; }; }; - config = - mkMerge [ - ( - mkIf (! cfg.gpuAcceleration.disable) { - hardware = { - opengl = { - enable = true; - driSupport = true; - driSupport32Bit = true; - }; + config = mkMerge [ + ( + mkIf (! cfg.gpuAcceleration.disable) { + hardware = { + opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; }; - } - ) - (mkIf (! cfg.sound.disable) { - security.rtkit.enable = true; - sound.enable = lib.mkForce false; #disable alsa - hardware.pulseaudio.enable = lib.mkForce false; #disable pulseAudio - services.pipewire = { - enable = true; - audio.enable = true; - wireplumber.enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; }; - }) - ] - ++ { + } + ) + (mkIf (! cfg.sound.disable) { + security.rtkit.enable = true; + sound.enable = lib.mkForce false; #disable alsa + hardware.pulseaudio.enable = lib.mkForce false; #disable pulseAudio + services.pipewire = { + enable = true; + audio.enable = true; + wireplumber.enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + }) + + { hardware = { + enableRedistributableFirmware = true; cpu = { intel.updateMicrocode = true; amd.updateMicrocode = true; - enableRedistributableFirmware = true; }; }; - }; + } + ]; } diff --git a/modules/misc.nix b/modules/misc.nix new file mode 100644 index 0000000..5b2a80a --- /dev/null +++ b/modules/misc.nix @@ -0,0 +1,30 @@ +_: { + #enable ssh + programs = { + mtr.enable = true; #ping and traceroute + gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + }; + services.openssh = { + enable = true; + settings = { + PermitRootLogin = "yes"; + PasswordAuthentication = false; + KbdInteractiveAuthentication = false; + }; + }; + + #time settings + time.timeZone = "America/New_York"; + services = { + timesyncd = { + enable = true; + servers = [ + "time.cloudflare.com" + ]; + }; + }; + i18n.defaultLocale = "en_US.UTF-8"; +} diff --git a/modules/common/nix.nix b/modules/nix.nix similarity index 100% rename from modules/common/nix.nix rename to modules/nix.nix diff --git a/imports/packages.nix b/modules/packages.nix similarity index 59% rename from imports/packages.nix rename to modules/packages.nix index 2ed1fa5..d170bf0 100644 --- a/imports/packages.nix +++ b/modules/packages.nix @@ -7,18 +7,9 @@ _: {pkgs, ...}: { pkgs.alsa-utils #volume control pkgs.xclip #commandline clipboard access pkgs.btrfs-progs #for external harddrive - pkgs.feh #for wallpaper #directly used tui apps pkgs.bottom #view tasks pkgs.bc #terminal calculator pkgs.nix-tree #view packages - #pointless stuff - pkgs.cava #pretty audio - pkgs.pipes-rs # more fun things - #gui apps - pkgs.pavucontrol #gui volume control - pkgs.pcmanfm #file manager - #big gui apps - pkgs.librewolf #best browser ]; }; } diff --git a/modules/sxhkd.nix b/modules/sxhkd.nix deleted file mode 100644 index 7a87bd8..0000000 --- a/modules/sxhkd.nix +++ /dev/null @@ -1,64 +0,0 @@ -_: { - config, - lib, - options, - pkgs, - ... -}: -with lib; let - cfg = config.localModules.sxhkd; - keybindingsStr = '' - XF86AudioPlay - playerctl play-pause - XF86AudioPause - playerctl play-pause - XF86AudioStop - playerctl stop - XF86AudioNext - playerctl next - XF86AudioPrev - playerctl previous - XF86AudioRaiseVolume - amixer sset Master 40+ - XF86AudioLowerVolume - amixer sset Master 40- - XF86AudioMute - amixer sset Master toggle - XF86MonBrightnessUp - brightnessctl s 20+ - XF86MonBrightnessDown - brightnessctl s 20- - Print - maim $HOME/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg - Print + shift - maim | xclip -selection clipboard -t image/png - super + Print - maim -s $HOME/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg - super + Print + shift - maim -s | xclip -selection clipboard -t image/png - ''; - configFile = pkgs.writeText "sxhkdrc" keybindingsStr; -in { - options.localModules.sxhkd = { - enable = mkEnableOption "simple X hotkey daemon"; - }; - config = mkIf cfg.enable { - environment.systemPackages = [ - pkgs.maim #screenshooter - pkgs.brightnessctl #brightness control for laptop - pkgs.playerctl #music control - pkgs.xclip - pkgs.coreutils - ]; - systemd.user.services.sxhkd = { - description = "sxhkd hotkey daemon"; - wantedBy = ["graphical-session.target"]; - partOf = ["graphical-session.target"]; - serviceConfig = { - ExecStart = "${pkgs.sxhkd}/bin/sxhkd -c ${configFile}"; - RestartSec = 3; - Restart = "always"; - }; - }; - }; -} diff --git a/systems/game-laptop/default.nix b/systems/game-laptop/default.nix index a50250f..5e2f8d3 100644 --- a/systems/game-laptop/default.nix +++ b/systems/game-laptop/default.nix @@ -4,16 +4,22 @@ inputs: { ... }: { imports = [ - (import ../imports/boot.nix inputs) + (import ./prime.nix inputs) + (import ./gaming.nix inputs) + (import ../imports/fonts.nix inputs) (import ../imports/git.nix inputs) - (import ../imports/packages.nix inputs) - (import ../imports/prime.nix inputs) - (import ../imports/gnome.nix inputs) (import ../imports/shells.nix inputs) - (import ../imports/gaming.nix inputs) (import ../imports/theme.nix inputs) ]; + + localModules = { + DE.gnome.enable = true; + DM = { + lightdm.enable = true; + autoLogin = true; + }; + }; nixpkgs.allowedUnfree = [ "nvidia-x11" "nvidia-persistenced" @@ -23,9 +29,15 @@ inputs: { ]; system.stateVersion = "23.05"; environment.systemPackages = [ + pkgs.pavucontrol #gui volume control + pkgs.pcmanfm #file manager + pkgs.librewolf #best browser pkgs.webcord ]; - networking.hostName = settings.hostname; + networking = { + hostName = settings.hostname; + networkmanager.enable = true; + }; boot.kernelPackages = pkgs.linuxPackages_latest; hardware.cpu.amd.updateMicrocode = true; users = { @@ -35,10 +47,6 @@ inputs: { extraGroups = ["audio" "networkmanager"]; }; }; - services.xserver.displayManager.autoLogin = { - enable = true; - user = settings.username; - }; hardware.bluetooth.enable = true; services.blueman.enable = true; boot = { diff --git a/imports/gaming.nix b/systems/game-laptop/gaming.nix similarity index 100% rename from imports/gaming.nix rename to systems/game-laptop/gaming.nix diff --git a/imports/prime.nix b/systems/game-laptop/prime.nix similarity index 100% rename from imports/prime.nix rename to systems/game-laptop/prime.nix diff --git a/systems/gerg-desktop/default.nix b/systems/gerg-desktop/default.nix index 48a0b00..5af5855 100644 --- a/systems/gerg-desktop/default.nix +++ b/systems/gerg-desktop/default.nix @@ -1,170 +1,84 @@ inputs: { pkgs, settings, - config, ... }: { imports = [ - # (import ../imports/boot.nix inputs) - #(import ../../imports/dwm.nix inputs) + (import ./refreshrate.nix inputs) + (import ./vfio.nix inputs) + (import ./parrot.nix inputs) + (import ./spicetify.nix inputs) + #(import ./mining.nix inputs) + (import ./zfs inputs) + (import ../../imports/fonts.nix inputs) (import ../../imports/git.nix inputs) - (import ../../imports/packages.nix inputs) - (import ../../imports/parrot.nix inputs) - (import ../../imports/picom.nix inputs) - (import ../../imports/refreshrate.nix inputs) (import ../../imports/shells.nix inputs) (import ../../imports/theme.nix inputs) - (import ../../imports/vfio.nix inputs) - # (import ../../imports/mining.nix inputs) - (import ../../imports/spicetify.nix inputs) ]; system.stateVersion = "23.05"; localModules = { - sxhkd.enable = true; - dwm.enable = true; - lightdm.enable = true; - autoLogin.enable = true; + X11Programs = { + sxhkd.enable = true; + picom.enable = true; + }; + DE.dwm.enable = true; + DM = { + lightdm.enable = true; + autoLogin = true; + }; }; + services.xserver.videoDrivers = ["amdgpu"]; - services.gvfs.enable = true; #gvfs for pcmanfm - - environment.systemPackages = with pkgs; [ - webcord # talk to people (gross) - bitwarden #store stuff - qbittorrent #steal stuff - networkmanagerapplet #gui connection control - vlc #play stuff + environment.systemPackages = [ + pkgs.webcord # talk to people (gross) + pkgs.bitwarden #store stuff + pkgs.qbittorrent #steal stuff + pkgs.networkmanagerapplet #gui connection control + pkgs.pavucontrol #gui volume control + pkgs.pcmanfm #file manager + pkgs.librewolf #best browser + #pointless stuff + pkgs.cava #pretty audio + pkgs.pipes-rs # more fun things + pkgs.vlc #play stuff ]; networking = { hostName = settings.hostname; hostId = "288b56db"; - }; - hardware.cpu.amd.updateMicrocode = true; - #user managment - users = { - users."${settings.username}" = { - uid = 1000; - isNormalUser = true; - extraGroups = ["wheel" "audio" "networkmanager"]; - }; - }; - boot = { - zfs.devNodes = "/dev/disk/by-id/"; - kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; - kernelParams = ["nohibernate" "zfs.zfs_arc_max=17179869184"]; - supportedFilesystems = ["zfs" "vfat"]; - initrd = { - kernelModules = ["amdgpu" "dm_mod"]; - availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "sd_mod" "hid_generic"]; - includeDefaultModules = false; - }; - loader = { - efi = { - canTouchEfiVariables = false; + useDHCP = false; + dhcpcd.enable = false; + networkmanager.enable = false; + nameservers = ["1.1.1.1" "1.0.0.1"]; + defaultGateway = "192.168.1.1"; + interfaces = { + "enp11s0" = { + name = "eth0"; }; - generationsDir.copyKernels = true; - systemd-boot.enable = false; - grub = { - enable = true; - efiInstallAsRemovable = true; - version = 2; - copyKernels = true; - efiSupport = true; - zfsSupport = true; - mirroredBoots = [ + "bridge0" = { + name = "bridge0"; + ipv4.addresses = [ { - path = "/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N0E"; - devices = ["/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N0E"]; - } - { - path = "/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N22"; - devices = ["/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N22"]; + address = "192.168.1.4"; + prefixLength = 24; } ]; }; }; + bridges."bridge0".interfaces = ["eth0"]; }; - systemd.services.zfs-mount.enable = false; - services.zfs = { - autoScrub.enable = true; - trim.enable = true; + #user managment + users.users."${settings.username}" = { + uid = 1000; + isNormalUser = true; + extraGroups = ["wheel" "audio"]; }; - fileSystems."/" = { - device = "rpool/nixos/root"; - fsType = "zfs"; - options = ["X-mount.mkdir"]; + boot = { + initrd = { + kernelModules = ["amdgpu"]; + availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "sd_mod"]; + includeDefaultModules = false; + }; }; - - fileSystems."/home" = { - device = "rpool/nixos/home"; - fsType = "zfs"; - options = ["X-mount.mkdir"]; - }; - - fileSystems."/var" = { - device = "rpool/nixos/var"; - fsType = "zfs"; - options = ["X-mount.mkdir"]; - }; - - fileSystems."/var/lib" = { - device = "rpool/nixos/var/lib"; - fsType = "zfs"; - options = ["X-mount.mkdir"]; - }; - - fileSystems."/var/log" = { - device = "rpool/nixos/var/log"; - fsType = "zfs"; - options = ["X-mount.mkdir"]; - }; - - fileSystems."/boot" = { - device = "bpool/nixos/root"; - fsType = "zfs"; - options = ["X-mount.mkdir"]; - }; - - fileSystems."/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N0E" = { - device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N0E-part2"; - fsType = "vfat"; - options = [ - "X-mount.mkdir" - "x-systemd.idle-timout=1min" - "x-systemd.automount" - "noauto" - "nofail" - ]; - }; - fileSystems."/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N22" = { - device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N22-part2"; - fsType = "vfat"; - options = [ - "X-mount.mkdir" - "x-systemd.idle-timout=1min" - "x-systemd.automount" - "noauto" - "nofail" - ]; - }; - swapDevices = [ - { - device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N0E-part4"; - discardPolicy = "both"; - randomEncryption = { - enable = true; - allowDiscards = true; - }; - } - { - device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N22-part4"; - discardPolicy = "both"; - randomEncryption = { - enable = true; - allowDiscards = true; - }; - } - ]; } diff --git a/imports/mining.nix b/systems/gerg-desktop/mining.nix similarity index 100% rename from imports/mining.nix rename to systems/gerg-desktop/mining.nix diff --git a/imports/parrot.nix b/systems/gerg-desktop/parrot.nix similarity index 88% rename from imports/parrot.nix rename to systems/gerg-desktop/parrot.nix index a7c4ed3..1edb339 100644 --- a/imports/parrot.nix +++ b/systems/gerg-desktop/parrot.nix @@ -13,6 +13,8 @@ _: { script = "parrot"; serviceConfig = { EnvironmentFile = "/home/${settings.username}/saveme/.env"; + Restart = "on-failure"; + RestartSec = "30s"; }; }; } diff --git a/imports/refreshrate.nix b/systems/gerg-desktop/refreshrate.nix similarity index 92% rename from imports/refreshrate.nix rename to systems/gerg-desktop/refreshrate.nix index 41e1953..d253d56 100644 --- a/imports/refreshrate.nix +++ b/systems/gerg-desktop/refreshrate.nix @@ -1,7 +1,5 @@ _: { services.xserver = { - #set drivers for igpu - videoDrivers = ["amdgpu"]; #fix nasty screen tearing screenSection = '' Option "TearFree" "true" diff --git a/imports/spicetify.nix b/systems/gerg-desktop/spicetify.nix similarity index 100% rename from imports/spicetify.nix rename to systems/gerg-desktop/spicetify.nix diff --git a/imports/vfio.nix b/systems/gerg-desktop/vfio.nix similarity index 91% rename from imports/vfio.nix rename to systems/gerg-desktop/vfio.nix index dd19fe3..93216b6 100644 --- a/imports/vfio.nix +++ b/systems/gerg-desktop/vfio.nix @@ -1,6 +1,7 @@ _: { pkgs, settings, + self, ... }: { boot = { @@ -36,9 +37,9 @@ _: { users.users."${settings.username}".extraGroups = ["kvm" "libvirtd"]; systemd.services.libvirtd.preStart = let + xml = pkgs.writeText "Windows.xml" (builtins.readFile "${self}/misc/Windows.xml"); qemuHook = pkgs.writeScript "qemu-hook" '' #!${pkgs.stdenv.shell} - GUEST_NAME="$1" OPERATION="$2" SUB_OPERATION="$3" @@ -63,5 +64,8 @@ _: { # Copy hook files ln -sf ${qemuHook} /var/lib/libvirt/hooks/qemu + + mkdir -p /var/lib/libvirt/qemu/ + ln -sf ${xml} /var/lib/libvirt/qemu/Windows.xml ''; } diff --git a/systems/gerg-desktop/zfs/default.nix b/systems/gerg-desktop/zfs/default.nix new file mode 100644 index 0000000..d4ac548 --- /dev/null +++ b/systems/gerg-desktop/zfs/default.nix @@ -0,0 +1,122 @@ +_: {config, ...}: { + boot = { + zfs.devNodes = "/dev/disk/by-id/"; + kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; + kernelParams = ["nohibernate" "zfs.zfs_arc_max=17179869184"]; + supportedFilesystems = ["zfs" "vfat"]; + initrd = { + kernelModules = ["dm_mod"]; + availableKernelModules = ["hid_generic"]; + }; + plymouth.enable = false; + loader = { + generationsDir.copyKernels = true; + + #override defaults + systemd-boot.enable = false; + efi.canTouchEfiVariables = false; + + grub = { + enable = true; + efiInstallAsRemovable = true; + version = 2; + copyKernels = true; + efiSupport = true; + zfsSupport = true; + mirroredBoots = [ + { + path = "/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N0E"; + devices = ["/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N0E"]; + } + { + path = "/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N22"; + devices = ["/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N22"]; + } + ]; + }; + }; + }; + systemd.services.zfs-mount.enable = false; + services.zfs = { + autoScrub.enable = true; + trim.enable = true; + }; + fileSystems = { + "/" = { + device = "rpool/nixos/root"; + fsType = "zfs"; + options = ["X-mount.mkdir"]; + }; + + "/home" = { + device = "rpool/nixos/home"; + fsType = "zfs"; + options = ["X-mount.mkdir"]; + }; + + "/var" = { + device = "rpool/nixos/var"; + fsType = "zfs"; + options = ["X-mount.mkdir"]; + }; + + "/var/lib" = { + device = "rpool/nixos/var/lib"; + fsType = "zfs"; + options = ["X-mount.mkdir"]; + }; + + "/var/log" = { + device = "rpool/nixos/var/log"; + fsType = "zfs"; + options = ["X-mount.mkdir"]; + }; + + "/boot" = { + device = "bpool/nixos/root"; + fsType = "zfs"; + options = ["X-mount.mkdir"]; + }; + + "/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N0E" = { + device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N0E-part2"; + fsType = "vfat"; + options = [ + "X-mount.mkdir" + "x-systemd.idle-timout=1min" + "x-systemd.automount" + "noauto" + "nofail" + ]; + }; + "/boot/efis/nvme-SHPP41-500GM_SSB4N6719101A4N22" = { + device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N22-part2"; + fsType = "vfat"; + options = [ + "X-mount.mkdir" + "x-systemd.idle-timout=1min" + "x-systemd.automount" + "noauto" + "nofail" + ]; + }; + }; + swapDevices = [ + { + device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N0E-part4"; + discardPolicy = "both"; + randomEncryption = { + enable = true; + allowDiscards = true; + }; + } + { + device = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N22-part4"; + discardPolicy = "both"; + randomEncryption = { + enable = true; + allowDiscards = true; + }; + } + ]; +} diff --git a/systems/mom-laptop/default.nix b/systems/mom-laptop/default.nix index 397ce00..68bb847 100644 --- a/systems/mom-laptop/default.nix +++ b/systems/mom-laptop/default.nix @@ -1,59 +1,43 @@ inputs: { pkgs, settings, - lib, ... }: { imports = [ - (import ../imports/boot.nix inputs) + (import ./printing.nix inputs) (import ../imports/fonts.nix inputs) (import ../imports/git.nix inputs) - (import ../imports/packages.nix inputs) - (import ../imports/xfce.nix inputs) (import ../imports/shells.nix inputs) (import ../imports/theme.nix inputs) ]; - nixpkgs.allowedUnfree = ["hplip"]; + localModules = { + DM = { + lightdm.enable = true; + autoLogin = true; + }; + DE.xfce.enable = true; + }; + system.stateVersion = "22.11"; environment.systemPackages = [ - pkgs.gimp - (pkgs.xsane.override {gimpSupport = true;}) pkgs.vlc - pkgs.libreoffice pkgs.nomacs pkgs.gnome.gnome-calculator pkgs.xfce.xfce4-whiskermenu-plugin pkgs.rsync + pkgs.pavucontrol #gui volume control + pkgs.librewolf #best browser ]; services.xserver.videoDrivers = ["intel"]; - networking.hostName = settings.hostname; + networking = { + hostName = settings.hostname; + networkmanager.enable = true; + }; boot.kernelPackages = pkgs.linuxPackages_latest; - hardware.cpu.intel.updateMicrocode = true; - #printing stuff - hardware.sane = { - enable = true; - extraBackends = [pkgs.hplipWithPlugin]; - #run this to setup gimp plugin - #ln -s /run/current-system/sw/bin/xsane ~/.config/GIMP/2.10/plug-ins/xsane - }; - services = { - printing = { - enable = true; - drivers = [pkgs.hplipWithPlugin]; - }; - }; - - users = { - defaultUserShell = pkgs.zsh; - users."${settings.username}" = { - uid = 1000; - isNormalUser = true; - extraGroups = ["audio" "networkmanager" "scanner" "lp" "cups"]; - }; - }; - services.xserver.displayManager.autoLogin = { - enable = true; - user = settings.username; + users.users."${settings.username}" = { + uid = 1000; + isNormalUser = true; + extraGroups = ["audio" "networkmanager"]; }; boot = { initrd.availableKernelModules = ["xhci-pci" "ehci-pci" "ahci" "usbhid" "sd_mod" "sr_mod" "rtsx_usb_sdmmc"]; diff --git a/systems/mom-laptop/printing.nix b/systems/mom-laptop/printing.nix new file mode 100644 index 0000000..0683d07 --- /dev/null +++ b/systems/mom-laptop/printing.nix @@ -0,0 +1,21 @@ +_: {pkgs, ...}: { + nixpkgs.allowedUnfree = ["hplip"]; + environment.systemPackages = [ + pkgs.gimp + (pkgs.xsane.override {gimpSupport = true;}) + pkgs.libreoffice + ]; + users.users."${settings.username}".extraGroups = ["scanner" "lp" "cups"]; + hardware.sane = { + enable = true; + extraBackends = [pkgs.hplipWithPlugin]; + #run this to setup gimp plugin + #ln -s /run/current-system/sw/bin/xsane ~/.config/GIMP/2.10/plug-ins/xsane + }; + services = { + printing = { + enable = true; + drivers = [pkgs.hplipWithPlugin]; + }; + }; +}