diff options
| author | seth <[email protected]> | 2023-02-20 01:53:23 -0500 |
|---|---|---|
| committer | seth <[email protected]> | 2023-02-20 01:53:23 -0500 |
| commit | 0957b051ef4befd86ce97deef04f5095bea9543b (patch) | |
| tree | a669111fa7b0123a4e77819ddce0c0c75bef554f | |
| parent | a276cdbfa83425423c096d8049e6e29770018e31 (diff) | |
start using nixpkgs-fmt
40 files changed, 790 insertions, 772 deletions
diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 9361cf6..0000000 --- a/.editorconfig +++ /dev/null @@ -1,7 +0,0 @@ -root = true - -[*] -charset = utf-8 -end_of_line = lf -indent_style = tab -insert_file_newline = true @@ -1,77 +1,79 @@ { - inputs = { - nixpkgs.url = "nixpkgs/nixos-22.11"; - nixpkgsUnstable.url = "nixpkgs/nixos-unstable"; - nixos-wsl.url = "github:nix-community/NixOS-WSL?ref=main"; - home-manager.url = "github:nix-community/home-manager"; - home-manager.inputs.nixpkgs.follows = "nixpkgs"; - nixos-hardware.url = "github:NixOS/nixos-hardware"; - lanzaboote.url = "github:nix-community/lanzaboote"; - }; + inputs = { + nixpkgs.url = "nixpkgs/nixos-22.11"; + nixpkgsUnstable.url = "nixpkgs/nixos-unstable"; + nixos-wsl.url = "github:nix-community/NixOS-WSL?ref=main"; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + nixos-hardware.url = "github:NixOS/nixos-hardware"; + lanzaboote.url = "github:nix-community/lanzaboote"; + }; - outputs = inputs @ { - home-manager, - lanzaboote, - nixos-hardware, - nixos-wsl, - nixpkgs, - nixpkgsUnstable, - ... - }: let - util = import ./util {inherit inputs home-manager;}; - inherit (util) host user; - in { - homeConfigurations = { - seth = user.mkHMUser { - username = "seth"; - stateVersion = "23.05"; - channel = nixpkgsUnstable; - modules = []; - }; - }; + outputs = + inputs @ { home-manager + , lanzaboote + , nixos-hardware + , nixos-wsl + , nixpkgs + , nixpkgsUnstable + , ... + }: + let + util = import ./util { inherit inputs home-manager; }; + inherit (util) host user; + in + { + homeConfigurations = { + seth = user.mkHMUser { + username = "seth"; + stateVersion = "23.05"; + channel = nixpkgsUnstable; + modules = [ ]; + }; + }; - nixosConfigurations = - (host.mkHost { - name = "glados"; - modules = [ - nixos-hardware.nixosModules.common-cpu-amd-pstate - nixos-hardware.nixosModules.common-gpu-nvidia-nonprime - nixos-hardware.nixosModules.common-pc-ssd - lanzaboote.nixosModules.lanzaboote + nixosConfigurations = + (host.mkHost { + name = "glados"; + modules = [ + nixos-hardware.nixosModules.common-cpu-amd-pstate + nixos-hardware.nixosModules.common-gpu-nvidia-nonprime + nixos-hardware.nixosModules.common-pc-ssd + lanzaboote.nixosModules.lanzaboote - ./users/seth - ]; - specialArgs = { - desktop = "gnome"; - wsl = false; - }; - version = "23.05"; - pkgs = nixpkgsUnstable; - }) - // (host.mkHost { - name = "glados-wsl"; - modules = [ - nixos-wsl.nixosModules.wsl + ./users/seth + ]; + specialArgs = { + desktop = "gnome"; + wsl = false; + }; + version = "23.05"; + pkgs = nixpkgsUnstable; + }) + // (host.mkHost { + name = "glados-wsl"; + modules = [ + nixos-wsl.nixosModules.wsl - { - wsl = { - enable = true; - defaultUser = "seth"; - nativeSystemd = true; - wslConf.network.hostname = "glados-wsl"; - startMenuLaunchers = false; - interop.includePath = false; - }; - } + { + wsl = { + enable = true; + defaultUser = "seth"; + nativeSystemd = true; + wslConf.network.hostname = "glados-wsl"; + startMenuLaunchers = false; + interop.includePath = false; + }; + } - ./users/seth - ]; - specialArgs = { - desktop = ""; - wsl = true; - }; - version = "23.05"; - pkgs = nixpkgsUnstable; - }); - }; + ./users/seth + ]; + specialArgs = { + desktop = ""; + wsl = true; + }; + version = "23.05"; + pkgs = nixpkgsUnstable; + }); + }; } diff --git a/hosts/common/default.nix b/hosts/common/default.nix index 9544b42..df576df 100644 --- a/hosts/common/default.nix +++ b/hosts/common/default.nix @@ -1,14 +1,14 @@ _: { - imports = [ - ./documentation.nix - ./desktop - ./fonts.nix - ./locale.nix - ./packages.nix - ./security.nix - ./systemd.nix - ./users.nix - ]; + imports = [ + ./documentation.nix + ./desktop + ./fonts.nix + ./locale.nix + ./packages.nix + ./security.nix + ./systemd.nix + ./users.nix + ]; - # config.services.kmscon.enable = true; + # config.services.kmscon.enable = true; } diff --git a/hosts/common/desktop/default.nix b/hosts/common/desktop/default.nix index 3f6aba7..3496df9 100644 --- a/hosts/common/desktop/default.nix +++ b/hosts/common/desktop/default.nix @@ -1,25 +1,26 @@ +{ lib +, desktop +, ... +}: +let + gui = desktop != ""; +in { - lib, - desktop, - ... -}: let - gui = desktop != ""; -in { - imports = - [] - ++ ( - if (desktop == "gnome") - then [./gnome.nix] - else [] - ) - ++ ( - if (desktop == "plasma") - then [./plasma.nix] - else [] - ); + imports = + [ ] + ++ ( + if (desktop == "gnome") + then [ ./gnome.nix ] + else [ ] + ) + ++ ( + if (desktop == "plasma") + then [ ./plasma.nix ] + else [ ] + ); - environment.noXlibs = lib.mkForce false; - programs.xwayland.enable = gui; - services.xserver.enable = gui; - xdg.portal.enable = gui; + environment.noXlibs = lib.mkForce false; + programs.xwayland.enable = gui; + services.xserver.enable = gui; + xdg.portal.enable = gui; } diff --git a/hosts/common/desktop/gnome.nix b/hosts/common/desktop/gnome.nix index e3f8b21..f8d59a5 100644 --- a/hosts/common/desktop/gnome.nix +++ b/hosts/common/desktop/gnome.nix @@ -1,17 +1,17 @@ -{pkgs, ...}: { - environment = { - gnome.excludePackages = with pkgs; [ - epiphany - gnome-tour - ]; - systemPackages = with pkgs; [ - adw-gtk3 - blackbox-terminal - ]; - }; +{ pkgs, ... }: { + environment = { + gnome.excludePackages = with pkgs; [ + epiphany + gnome-tour + ]; + systemPackages = with pkgs; [ + adw-gtk3 + blackbox-terminal + ]; + }; - services.xserver = { - displayManager.gdm.enable = true; - desktopManager.gnome.enable = true; - }; + services.xserver = { + displayManager.gdm.enable = true; + desktopManager.gnome.enable = true; + }; } diff --git a/hosts/common/desktop/plasma.nix b/hosts/common/desktop/plasma.nix index 80514fd..cd31983 100644 --- a/hosts/common/desktop/plasma.nix +++ b/hosts/common/desktop/plasma.nix @@ -1,13 +1,13 @@ -{pkgs, ...}: { - services.xserver = { - displayManager.sddm.enable = true; - desktopManager.plasma5 = { - enable = true; - excludePackages = with pkgs.libsForQt5; [ - khelpcenter - plasma-browser-integration - print-manager - ]; - }; - }; +{ pkgs, ... }: { + services.xserver = { + displayManager.sddm.enable = true; + desktopManager.plasma5 = { + enable = true; + excludePackages = with pkgs.libsForQt5; [ + khelpcenter + plasma-browser-integration + print-manager + ]; + }; + }; } diff --git a/hosts/common/documentation.nix b/hosts/common/documentation.nix index ad7300d..64b78a3 100644 --- a/hosts/common/documentation.nix +++ b/hosts/common/documentation.nix @@ -1,7 +1,7 @@ -{pkgs, ...}: { - environment.systemPackages = with pkgs; [man-pages man-pages-posix]; - documentation = { - dev.enable = true; - man.enable = true; - }; +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ man-pages man-pages-posix ]; + documentation = { + dev.enable = true; + man.enable = true; + }; } diff --git a/hosts/common/fonts.nix b/hosts/common/fonts.nix index 78993cf..a9b133c 100644 --- a/hosts/common/fonts.nix +++ b/hosts/common/fonts.nix @@ -1,32 +1,33 @@ +{ pkgs +, desktop +, ... +}: +let + gui = desktop != ""; +in { - pkgs, - desktop, - ... -}: let - gui = desktop != ""; -in { - fonts = { - enableDefaultFonts = gui; - fonts = - if gui - then - with pkgs; [ - noto-fonts - noto-fonts-extra - noto-fonts-emoji - noto-fonts-cjk-sans - fira-code - (nerdfonts.override {fonts = ["FiraCode"];}) - ] - else []; - fontconfig.defaultFonts = - if gui - then { - serif = ["Noto Serif"]; - sansSerif = ["Noto Sans"]; - emoji = ["Noto Color Emoji"]; - monospace = ["Fira Code"]; - } - else {}; - }; + fonts = { + enableDefaultFonts = gui; + fonts = + if gui + then + with pkgs; [ + noto-fonts + noto-fonts-extra + noto-fonts-emoji + noto-fonts-cjk-sans + fira-code + (nerdfonts.override { fonts = [ "FiraCode" ]; }) + ] + else [ ]; + fontconfig.defaultFonts = + if gui + then { + serif = [ "Noto Serif" ]; + sansSerif = [ "Noto Sans" ]; + emoji = [ "Noto Color Emoji" ]; + monospace = [ "Fira Code" ]; + } + else { }; + }; } diff --git a/hosts/common/hardware/default.nix b/hosts/common/hardware/default.nix index 4d54961..a01e1a9 100644 --- a/hosts/common/hardware/default.nix +++ b/hosts/common/hardware/default.nix @@ -1,5 +1,5 @@ _: { - imports = [ - ./nvidia.nix - ]; + imports = [ + ./nvidia.nix + ]; } diff --git a/hosts/common/hardware/nvidia.nix b/hosts/common/hardware/nvidia.nix index 6308bc5..5306c56 100644 --- a/hosts/common/hardware/nvidia.nix +++ b/hosts/common/hardware/nvidia.nix @@ -1,24 +1,23 @@ -{ - config, - pkgs, - ... +{ config +, pkgs +, ... }: { - hardware = { - nvidia = { - package = config.boot.kernelPackages.nvidiaPackages.stable; - modesetting.enable = true; - nvidiaPersistenced = true; - powerManagement.enable = true; - }; - opengl = { - enable = true; - # make steam work - driSupport32Bit = true; - extraPackages = with pkgs; [ - vaapiVdpau - ]; - }; - }; + hardware = { + nvidia = { + package = config.boot.kernelPackages.nvidiaPackages.stable; + modesetting.enable = true; + nvidiaPersistenced = true; + powerManagement.enable = true; + }; + opengl = { + enable = true; + # make steam work + driSupport32Bit = true; + extraPackages = with pkgs; [ + vaapiVdpau + ]; + }; + }; - services.xserver.videoDrivers = ["nvidia"]; + services.xserver.videoDrivers = [ "nvidia" ]; } diff --git a/hosts/common/locale.nix b/hosts/common/locale.nix index 3c2ea9f..3e28cfd 100644 --- a/hosts/common/locale.nix +++ b/hosts/common/locale.nix @@ -1,13 +1,13 @@ _: { - i18n = { - defaultLocale = "en_US.UTF-8"; - extraLocaleSettings = { - LC_MESSAGES = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - }; + i18n = { + defaultLocale = "en_US.UTF-8"; + extraLocaleSettings = { + LC_MESSAGES = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + }; - time = { - timeZone = "America/New_York"; - }; + time = { + timeZone = "America/New_York"; + }; } diff --git a/hosts/common/packages.nix b/hosts/common/packages.nix index 174e984..297e9e8 100644 --- a/hosts/common/packages.nix +++ b/hosts/common/packages.nix @@ -1,37 +1,38 @@ +{ pkgs +, desktop +, ... +}: +let + gui = desktop != ""; + pinentry = + if desktop == "gnome" + then pkgs.pinentry-gnome + else pkgs.pinentry-curses; +in { - pkgs, - desktop, - ... -}: let - gui = desktop != ""; - pinentry = - if desktop == "gnome" - then pkgs.pinentry-gnome - else pkgs.pinentry-curses; -in { - environment.systemPackages = with pkgs; - [ - git - neofetch - python311 - vim - ] - ++ ( - if gui - then with pkgs; [firefox] - else [] - ) - ++ [pinentry]; + environment.systemPackages = with pkgs; + [ + git + neofetch + python311 + vim + ] + ++ ( + if gui + then with pkgs; [ firefox ] + else [ ] + ) + ++ [ pinentry ]; - programs = { - gnupg = { - agent = { - enable = true; - pinentryFlavor = - if desktop == "gnome" - then "gnome3" - else "curses"; - }; - }; - }; + programs = { + gnupg = { + agent = { + enable = true; + pinentryFlavor = + if desktop == "gnome" + then "gnome3" + else "curses"; + }; + }; + }; } diff --git a/hosts/common/security.nix b/hosts/common/security.nix index ed9be36..d150236 100644 --- a/hosts/common/security.nix +++ b/hosts/common/security.nix @@ -1,28 +1,28 @@ -{wsl, ...}: { - security = { - apparmor.enable = !wsl; - audit.enable = !wsl; - auditd.enable = !wsl; - rtkit.enable = true; - sudo = { - configFile = '' - Defaults env_reset - Defaults secure_path = /run/wrappers/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin - Defaults editor = /run/current-system/sw/bin/vim,!env_editor - ''; - execWheelOnly = true; - extraRules = [ - { - users = ["root"]; - groups = ["root"]; - commands = ["ALL"]; - } - { - users = ["seth"]; - commands = ["ALL"]; - } - ]; - }; - polkit.enable = true; - }; +{ wsl, ... }: { + security = { + apparmor.enable = !wsl; + audit.enable = !wsl; + auditd.enable = !wsl; + rtkit.enable = true; + sudo = { + configFile = '' + Defaults env_reset + Defaults secure_path = /run/wrappers/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin + Defaults editor = /run/current-system/sw/bin/vim,!env_editor + ''; + execWheelOnly = true; + extraRules = [ + { + users = [ "root" ]; + groups = [ "root" ]; + commands = [ "ALL" ]; + } + { + users = [ "seth" ]; + commands = [ "ALL" ]; + } + ]; + }; + polkit.enable = true; + }; } diff --git a/hosts/common/systemd.nix b/hosts/common/systemd.nix index 9ee7baf..d54a2ed 100644 --- a/hosts/common/systemd.nix +++ b/hosts/common/systemd.nix @@ -1,16 +1,16 @@ -{wsl, ...}: { - services = { - journald.extraConfig = '' - MaxRetentionSec=1w - ''; - resolved = { - enable = !wsl; - dnssec = "allow-downgrade"; - extraConfig = '' - [Resolve] - DNS=1.1.1.1 1.0.0.1 - DNSOverTLS=yes - ''; - }; - }; +{ wsl, ... }: { + services = { + journald.extraConfig = '' + MaxRetentionSec=1w + ''; + resolved = { + enable = !wsl; + dnssec = "allow-downgrade"; + extraConfig = '' + [Resolve] + DNS=1.1.1.1 1.0.0.1 + DNSOverTLS=yes + ''; + }; + }; } diff --git a/hosts/common/users.nix b/hosts/common/users.nix index bc5ef7f..fd31ab0 100644 --- a/hosts/common/users.nix +++ b/hosts/common/users.nix @@ -1,19 +1,18 @@ -{ - config, - pkgs, - ... +{ config +, pkgs +, ... }: { - users = { - defaultUserShell = pkgs.bash; - mutableUsers = false; + users = { + defaultUserShell = pkgs.bash; + mutableUsers = false; - users = { - root = { - home = "/root"; - uid = config.ids.uids.root; - group = "root"; - initialHashedPassword = "***REMOVED***"; - }; - }; - }; + users = { + root = { + home = "/root"; + uid = config.ids.uids.root; + group = "root"; + initialHashedPassword = "***REMOVED***"; + }; + }; + }; } diff --git a/hosts/glados-wsl/default.nix b/hosts/glados-wsl/default.nix index d8e9ccb..ec65d48 100644 --- a/hosts/glados-wsl/default.nix +++ b/hosts/glados-wsl/default.nix @@ -1,5 +1,5 @@ -{modulesPath, ...}: { - imports = [ - (modulesPath + "/profiles/minimal.nix") - ]; +{ modulesPath, ... }: { + imports = [ + (modulesPath + "/profiles/minimal.nix") + ]; } diff --git a/hosts/glados/boot.nix b/hosts/glados/boot.nix index b56de59..4d905cb 100644 --- a/hosts/glados/boot.nix +++ b/hosts/glados/boot.nix @@ -1,24 +1,23 @@ -{ - config, - lib, - pkgs, - ... +{ config +, lib +, pkgs +, ... }: { - environment.systemPackages = with pkgs; [ - sbctl - ]; + environment.systemPackages = with pkgs; [ + sbctl + ]; - boot = { - kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; - kernelParams = ["nohibernate"]; + boot = { + kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; + kernelParams = [ "nohibernate" ]; - bootspec.enable = true; - loader.systemd-boot.enable = lib.mkForce false; + bootspec.enable = true; + loader.systemd-boot.enable = lib.mkForce false; - lanzaboote = { - enable = true; - pkiBundle = "/etc/secureboot"; - }; - supportedFilesystems = ["zfs" "ntfs"]; - }; + lanzaboote = { + enable = true; + pkiBundle = "/etc/secureboot"; + }; + supportedFilesystems = [ "zfs" "ntfs" ]; + }; } diff --git a/hosts/glados/default.nix b/hosts/glados/default.nix index 7e5c5be..0994349 100644 --- a/hosts/glados/default.nix +++ b/hosts/glados/default.nix @@ -1,9 +1,9 @@ _: { - imports = [ - ../common/hardware/nvidia.nix - ./boot.nix - ./hardware-configuration.nix - ./network.nix - ./services.nix - ]; + imports = [ + ../common/hardware/nvidia.nix + ./boot.nix + ./hardware-configuration.nix + ./network.nix + ./services.nix + ]; } diff --git a/hosts/glados/hardware-configuration.nix b/hosts/glados/hardware-configuration.nix index 9b000ba..891c896 100644 --- a/hosts/glados/hardware-configuration.nix +++ b/hosts/glados/hardware-configuration.nix @@ -1,60 +1,59 @@ # 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, - ... +{ config +, lib +, pkgs +, modulesPath +, ... }: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-amd"]; - boot.extraModulePackages = []; - - fileSystems."/" = { - device = "rpool/nixos/root"; - fsType = "zfs"; - options = ["zfsutil" "X-mount.mkdir"]; - }; - - fileSystems."/home" = { - device = "rpool/nixos/home"; - fsType = "zfs"; - options = ["zfsutil" "X-mount.mkdir"]; - }; - - fileSystems."/nix" = { - device = "rpool/nixos/nixstore"; - fsType = "zfs"; - options = ["zfsutil" "X-mount.mkdir"]; - }; - - fileSystems."/var/log" = { - device = "rpool/nixos/var/log"; - fsType = "zfs"; - options = ["zfsutil" "X-mount.mkdir"]; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/5B1B-6423"; - 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.<interface>.useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp4s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "rpool/nixos/root"; + fsType = "zfs"; + options = [ "zfsutil" "X-mount.mkdir" ]; + }; + + fileSystems."/home" = { + device = "rpool/nixos/home"; + fsType = "zfs"; + options = [ "zfsutil" "X-mount.mkdir" ]; + }; + + fileSystems."/nix" = { + device = "rpool/nixos/nixstore"; + fsType = "zfs"; + options = [ "zfsutil" "X-mount.mkdir" ]; + }; + + fileSystems."/var/log" = { + device = "rpool/nixos/var/log"; + fsType = "zfs"; + options = [ "zfsutil" "X-mount.mkdir" ]; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/5B1B-6423"; + 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.<interface>.useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp4s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hosts/glados/network.nix b/hosts/glados/network.nix index aef7253..11b2d6f 100644 --- a/hosts/glados/network.nix +++ b/hosts/glados/network.nix @@ -1,9 +1,9 @@ _: { - networking = { - hostId = "2bf6e602"; - networkmanager = { - enable = true; - dns = "systemd-resolved"; - }; - }; + networking = { + hostId = "2bf6e602"; + networkmanager = { + enable = true; + dns = "systemd-resolved"; + }; + }; } diff --git a/hosts/glados/services.nix b/hosts/glados/services.nix index 95a7882..6ed5411 100644 --- a/hosts/glados/services.nix +++ b/hosts/glados/services.nix @@ -1,13 +1,13 @@ _: { - services = { - dbus.enable = true; - pipewire = { - enable = true; - wireplumber.enable = true; - alsa.enable = true; - jack.enable = true; - pulse.enable = true; - }; - }; - hardware.pulseaudio.enable = false; + services = { + dbus.enable = true; + pipewire = { + enable = true; + wireplumber.enable = true; + alsa.enable = true; + jack.enable = true; + pulse.enable = true; + }; + }; + hardware.pulseaudio.enable = false; } diff --git a/users/seth/default.nix b/users/seth/default.nix index be8302e..6e3e8d9 100644 --- a/users/seth/default.nix +++ b/users/seth/default.nix @@ -1,32 +1,35 @@ -{ - config, - pkgs, - home-manager, - desktop, - ... +{ config +, pkgs +, home-manager +, desktop +, ... }: { - users.users.seth = { - extraGroups = ["wheel"]; - isNormalUser = true; - hashedPassword = "***REMOVED***"; - shell = pkgs.bash; - }; + users.users.seth = { + extraGroups = [ "wheel" ]; + isNormalUser = true; + hashedPassword = "***REMOVED***"; + shell = pkgs.bash; + }; - home-manager.users.seth = { - imports = - [ - ./home.nix - ./shell - ] - ++ ( - if (desktop != "") - then [./desktop] - else [] - ); + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.seth = { + imports = + [ + ./home.nix + ./shell + ] + ++ ( + if (desktop != "") + then [ ./desktop ] + else [ ] + ); - home.stateVersion = config.system.stateVersion; - nixpkgs.config.allowUnfree = true; - programs.home-manager.enable = true; - systemd.user.startServices = true; - }; + home.stateVersion = config.system.stateVersion; + nixpkgs.config.allowUnfree = true; + programs.home-manager.enable = true; + systemd.user.startServices = true; + }; + }; } diff --git a/users/seth/desktop/default.nix b/users/seth/desktop/default.nix index d8a0e74..7ad6434 100644 --- a/users/seth/desktop/default.nix +++ b/users/seth/desktop/default.nix @@ -1,22 +1,21 @@ -{ - pkgs, - desktop, - ... +{ pkgs +, desktop +, ... }: { - imports = - [ - ../programs/mangohud - ] - ++ ( - if (desktop == "gnome") - then [./gnome.nix] - else [./plasma.nix] - ); + imports = + [ + ../programs/mangohud.nix + ] + ++ ( + if (desktop == "gnome") + then [ ./gnome.nix ] + else [ ./plasma.nix ] + ); - home.packages = with pkgs; [ - discord - element-desktop - spotify - steam - ]; + home.packages = with pkgs; [ + discord + element-desktop + spotify + steam + ]; } diff --git a/users/seth/desktop/gnome.nix b/users/seth/desktop/gnome.nix index 482dae6..6b80e14 100644 --- a/users/seth/desktop/gnome.nix +++ b/users/seth/desktop/gnome.nix @@ -1,30 +1,30 @@ -{pkgs, ...}: { - home.packages = with pkgs; [adw-gtk3] ++ (with pkgs.gnomeExtensions; [appindicator blur-my-shell caffeine]); +{ pkgs, ... }: { + home.packages = with pkgs; [ adw-gtk3 ] ++ (with pkgs.gnomeExtensions; [ appindicator blur-my-shell caffeine ]); - dconf.settings = { - "org/gnome/shell" = { - disable-user-extensions = false; - enabled-extensions = [ - ]; - favorite-apps = [ - "firefox.desktop" - "org.gnome.Nautilus.desktop" - "discord.desktop" - ]; - }; - "org/gnome/desktop/interface" = { - color-scheme = "prefer-dark"; - }; - }; + dconf.settings = { + "org/gnome/shell" = { + disable-user-extensions = false; + enabled-extensions = [ + ]; + favorite-apps = [ + "firefox.desktop" + "org.gnome.Nautilus.desktop" + "discord.desktop" + ]; + }; + "org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + }; + }; - gtk = { - enable = true; - theme = { - name = "adw-gtk3"; - package = pkgs.adw-gtk3; - }; - }; + gtk = { + enable = true; + theme = { + name = "adw-gtk3"; + package = pkgs.adw-gtk3; + }; + }; } diff --git a/users/seth/desktop/plasma.nix b/users/seth/desktop/plasma.nix index 97e427f..dea84c2 100644 --- a/users/seth/desktop/plasma.nix +++ b/users/seth/desktop/plasma.nix @@ -1,3 +1,3 @@ -{pkgs, ...}: { - home.packages = with pkgs; [catppuccin-kde]; +{ pkgs, ... }: { + home.packages = with pkgs; [ catppuccin-kde ]; } diff --git a/users/seth/home.nix b/users/seth/home.nix index fb75b61..f5dec19 100644 --- a/users/seth/home.nix +++ b/users/seth/home.nix @@ -1,5 +1,5 @@ _: { - imports = [ - ./programs - ]; + imports = [ + ./programs + ]; } diff --git a/users/seth/programs/default.nix b/users/seth/programs/default.nix index 5394515..a3471af 100644 --- a/users/seth/programs/default.nix +++ b/users/seth/programs/default.nix @@ -1,26 +1,26 @@ -{pkgs, ...}: { - imports = [ - ./git.nix - ./neovim - ./starship.nix - ./vim.nix - ]; +{ pkgs, ... }: { + imports = [ + ./git.nix + ./neovim.nix + ./starship.nix + ./vim.nix + ]; - home.packages = with pkgs; [ - alejandra - bat - clang - deadnix - eclint - exa - fd - gh - lld - rclone - restic - ripgrep - statix - ]; + home.packages = with pkgs; [ + alejandra + bat + clang + deadnix + eclint + exa + fd + gh + lld + rclone + restic + ripgrep + statix + ]; - xdg.enable = true; + xdg.enable = true; } diff --git a/users/seth/programs/git.nix b/users/seth/programs/git.nix index 8daa18c..e4ddfa1 100644 --- a/users/seth/programs/git.nix +++ b/users/seth/programs/git.nix @@ -1,18 +1,18 @@ _: { - programs.git = { - enable = true; - extraConfig = { - init = {defaultBranch = "main";}; - safe = {directory = "/etc/nixos";}; - }; - signing = { - key = "D31BD0D494BBEE86"; - signByDefault = true; - }; - userEmail = "[email protected]"; - userName = "seth"; - }; - services.gpg-agent.extraConfig = '' - pinentry-program /run/current-system/sw/bin/pinentry - ''; + programs.git = { + enable = true; + extraConfig = { + init = { defaultBranch = "main"; }; + safe = { directory = "/etc/nixos"; }; + }; + signing = { + key = "D31BD0D494BBEE86"; + signByDefault = true; + }; + userEmail = "[email protected]"; + userName = "seth"; + }; + services.gpg-agent.extraConfig = '' + pinentry-program /run/current-system/sw/bin/pinentry + ''; } diff --git a/users/seth/programs/mangohud.nix b/users/seth/programs/mangohud.nix new file mode 100644 index 0000000..2b33471 --- /dev/null +++ b/users/seth/programs/mangohud.nix @@ -0,0 +1,17 @@ +{ pkgs, ... }: { + home.packages = with pkgs; [ mangohud ]; + + xdg.configFile."MangoHud.conf" = { + text = '' + legacy_layout=false + cpu_stats + cpu_temp + gpu_stats + gpu_temp + fps + frametime + media_player + media_player_name = spotify + ''; + }; +} diff --git a/users/seth/programs/mangohud/MangoHud.conf b/users/seth/programs/mangohud/MangoHud.conf deleted file mode 100644 index 8e02a99..0000000 --- a/users/seth/programs/mangohud/MangoHud.conf +++ /dev/null @@ -1,9 +0,0 @@ -legacy_layout=false -cpu_stats -cpu_temp -gpu_stats -gpu_temp -fps -frametime -media_player -media_player_name = spotify diff --git a/users/seth/programs/mangohud/default.nix b/users/seth/programs/mangohud/default.nix deleted file mode 100644 index 21dde0f..0000000 --- a/users/seth/programs/mangohud/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{pkgs, ...}: { - home.packages = with pkgs; [mangohud]; - - xdg.configFile.MangoHud = { - source = ./MangoHud.conf; - }; -} diff --git a/users/seth/programs/starship.nix b/users/seth/programs/starship.nix index 5c50b4b..7c213cf 100644 --- a/users/seth/programs/starship.nix +++ b/users/seth/programs/starship.nix @@ -1,8 +1,8 @@ _: { - programs.starship = { - enable = false; - settings = { - format = "" " + programs.starship = { + enable = false; + settings = { + format = "" " $username\ $hostname\ $directory\ @@ -24,6 +24,6 @@ _: { $shell\ $character " ""; - }; - }; + }; + }; } diff --git a/users/seth/programs/vim.nix b/users/seth/programs/vim.nix index b3dc52c..8a4c784 100644 --- a/users/seth/programs/vim.nix +++ b/users/seth/programs/vim.nix @@ -1,10 +1,30 @@ _: { - programs.vim = { - enable = true; - settings = { - expandtab = false; - shiftwidth = 2; - tabstop = 2; - }; - }; + programs.vim = { + enable = true; + settings = { + expandtab = false; + shiftwidth = 2; + tabstop = 2; + }; + extraConfig = '' + " https://wiki.archlinux.org/title/XDG_Base_Directory + set runtimepath^=$XDG_CONFIG_HOME/vim + set runtimepath+=$XDG_DATA_HOME/vim + set runtimepath+=$XDG_CONFIG_HOME/vim/after + + set packpath^=$XDG_DATA_HOME/vim,$XDG_CONFIG_HOME/vim + set packpath+=$XDG_CONFIG_HOME/vim/after,$XDG_DATA_HOME/vim/after + set packpath^=$XDG_DATA_HOME/vim,$XDG_CONFIG_HOME/vim + set packpath+=$XDG_CONFIG_HOME/vim/after,$XDG_DATA_HOME/vim/after + + let g:netrw_home = $XDG_DATA_HOME."/vim" + call mkdir($XDG_DATA_HOME."/vim/spell", 'p') + + set backupdir=$XDG_STATE_HOME/vim/backup | call mkdir(&backupdir, 'p') + set directory=$XDG_STATE_HOME/vim/swap | call mkdir(&directory, 'p') + set undodir=$XDG_STATE_HOME/vim/undo | call mkdir(&undodir, 'p') + set viewdir=$XDG_STATE_HOME/vim/view | call mkdir(&viewdir, 'p') + set viminfofile=$XDG_STATE_HOME/vim/viminfo + ''; + }; } diff --git a/users/seth/shell/bash.nix b/users/seth/shell/bash.nix index 0dfb717..031542b 100644 --- a/users/seth/shell/bash.nix +++ b/users/seth/shell/bash.nix @@ -1,31 +1,31 @@ -{config, ...}: { - programs.bash = { - enable = true; - bashrcExtra = '' - if [[ $(ps --no-header --pid=$PPID --format=comm) != "fish" && -z "$BASH_EXECUTION_STRING" ]] - then - exec fish - fi - ''; - historyFile = "${config.xdg.stateHome}/bash/history"; - historyFileSize = 1000; - historySize = 100; - sessionVariables = { - EDITOR = "nvim"; - VISUAL = "nvim"; - CARGO_HOME = "${config.xdg.dataHome}/cargo"; - RUSTUP_HOME = "${config.xdg.dataHome}/rustup"; - LESSHISTFILE = "${config.xdg.stateHome}/less/history"; - NPM_CONFIG_USERCONFIG = "${config.xdg.configHome}/npm/npmrc"; - }; - shellOptions = [ - "cdspell" - "checkjobs" - "checkwinsize" - "dirspell" - "globstar" - "histappend" - "no_empty_cmd_completion" - ]; - }; +{ config, ... }: { + programs.bash = { + enable = true; + bashrcExtra = '' + if [[ $(ps --no-header --pid=$PPID --format=comm) != "fish" && -z "$BASH_EXECUTION_STRING" ]] + then + exec fish + fi + ''; + historyFile = "${config.xdg.stateHome}/bash/history"; + historyFileSize = 1000; + historySize = 100; + sessionVariables = { + EDITOR = "nvim"; + VISUAL = "nvim"; + CARGO_HOME = "${config.xdg.dataHome}/cargo"; + RUSTUP_HOME = "${config.xdg.dataHome}/rustup"; + LESSHISTFILE = "${config.xdg.stateHome}/less/history"; + NPM_CONFIG_USERCONFIG = "${config.xdg.configHome}/npm/npmrc"; + }; + shellOptions = [ + "cdspell" + "checkjobs" + "checkwinsize" + "dirspell" + "globstar" + "histappend" + "no_empty_cmd_completion" + ]; + }; } diff --git a/users/seth/shell/default.nix b/users/seth/shell/default.nix index ae0afa8..2529a48 100644 --- a/users/seth/shell/default.nix +++ b/users/seth/shell/default.nix @@ -1,26 +1,26 @@ -{config, ...}: { - imports = [ - ./bash.nix - ./fish.nix - ./zsh - ]; +{ config, ... }: { + imports = [ + ./bash.nix + ./fish.nix + ./zsh + ]; - home.sessionVariables = { - EDITOR = "nvim"; - VISUAL = "nvim"; - CARGO_HOME = "${config.xdg.dataHome}/cargo"; - RUSTUP_HOME = "${config.xdg.dataHome}/rustup"; - LESSHISTFILE = "${config.xdg.stateHome}/less/history"; - NPM_CONFIG_USERCONFIG = "${config.xdg.configHome}/npm/npmrc"; - }; + home.sessionVariables = { + EDITOR = "nvim"; + VISUAL = "nvim"; + CARGO_HOME = "${config.xdg.dataHome}/cargo"; + RUSTUP_HOME = "${config.xdg.dataHome}/rustup"; + LESSHISTFILE = "${config.xdg.stateHome}/less/history"; + NPM_CONFIG_USERCONFIG = "${config.xdg.configHome}/npm/npmrc"; + }; - home.shellAliases = { - ls = "exa --icons"; - la = "ls -a"; - diff = "diff --color=auto"; - g = "git"; - gs = "g status"; - nixsw = "sudo nixos-rebuild switch"; - nixup = "nixsw --upgrade"; - }; + home.shellAliases = { + ls = "exa --icons"; + la = "ls -a"; + diff = "diff --color=auto"; + g = "git"; + gs = "g status"; + nixsw = "sudo nixos-rebuild switch"; + nixup = "nixsw --upgrade"; + }; } diff --git a/users/seth/shell/fish.nix b/users/seth/shell/fish.nix index a5f9480..f00174f 100644 --- a/users/seth/shell/fish.nix +++ b/users/seth/shell/fish.nix @@ -1,21 +1,21 @@ -{pkgs, ...}: { - programs.fish = { - enable = true; - plugins = [ - { - name = "autopair-fish"; - src = pkgs.fishPlugins.autopair-fish; - } +{ pkgs, ... }: { + programs.fish = { + enable = true; + plugins = [ + { + name = "autopair-fish"; + src = pkgs.fishPlugins.autopair-fish; + } - { - name = "puffer-fish"; - src = pkgs.fetchFromGitHub { - owner = "nickeb96"; - repo = "puffer-fish"; - rev = "fd0a9c95da59512beffddb3df95e64221f894631"; - sha256 = "sha256-aij48yQHeAKCoAD43rGhqW8X/qmEGGkg8B4jSeqjVU0="; - }; - } - ]; - }; + { + name = "puffer-fish"; + src = pkgs.fetchFromGitHub { + owner = "nickeb96"; + repo = "puffer-fish"; + rev = "fd0a9c95da59512beffddb3df95e64221f894631"; + sha256 = "sha256-aij48yQHeAKCoAD43rGhqW8X/qmEGGkg8B4jSeqjVU0="; + }; + } + ]; + }; } diff --git a/users/seth/shell/zsh/default.nix b/users/seth/shell/zsh/default.nix index 8f78bcd..eb9145a 100644 --- a/users/seth/shell/zsh/default.nix +++ b/users/seth/shell/zsh/default.nix @@ -1,95 +1,94 @@ -{ - config, - pkgs, - ... +{ config +, pkgs +, ... }: { - programs.zsh = { - enable = false; - enableAutosuggestions = true; - enableSyntaxHighlighting = true; - enableVteIntegration = true; - completionInit = '' - autoload -Uz bashcompinit compinit - local zdump="${config.xdg.cacheHome}/zsh/zdump" - bashcompinit - compinit -d "$zdump" - if [[ ! "$zdump.zwc" -nt "$zdump" ]] - then - zcompile "$zdump" - fi - unset zdump - ''; - defaultKeymap = "emacs"; - dotDir = ".config/zsh"; - initExtra = '' - autoload -Uz promptinit - prompt walters + programs.zsh = { + enable = false; + enableAutosuggestions = true; + enableSyntaxHighlighting = true; + enableVteIntegration = true; + completionInit = '' + autoload -Uz bashcompinit compinit + local zdump="${config.xdg.cacheHome}/zsh/zdump" + bashcompinit + compinit -d "$zdump" + if [[ ! "$zdump.zwc" -nt "$zdump" ]] + then + zcompile "$zdump" + fi + unset zdump + ''; + defaultKeymap = "emacs"; + dotDir = ".config/zsh"; + initExtra = '' + autoload -Uz promptinit + prompt walters - zmodload zsh/zutil - zmodload zsh/complist - zstyle ":completion::*" group-name "" - zstyle ":completion:*" menu "select" - zstyle ":completion:*" squeeze-slashes "true" - zstyle ":completion::*" use-cache "true" - zstyle ":completion::*" cache-path "$zdump" + zmodload zsh/zutil + zmodload zsh/complist + zstyle ":completion::*" group-name "" + zstyle ":completion:*" menu "select" + zstyle ":completion:*" squeeze-slashes "true" + zstyle ":completion::*" use-cache "true" + zstyle ":completion::*" cache-path "$zdump" - unsetopt beep - unsetopt hist_beep - unsetopt ignore_braces - unsetopt list_beep - setopt always_to_end - setopt prompt_subst - setopt share_history + unsetopt beep + unsetopt hist_beep + unsetopt ignore_braces + unsetopt list_beep + setopt always_to_end + setopt prompt_subst + setopt share_history - # clear backbuffer with ctrl-l - function clear-screen-and-scrollback() { - echoti civis >"$TTY" - printf '%b' '\e[H\e[2J' >"$TTY" - zle .reset-prompt - zle -R - printf '%b' '\e[3J' >"$TTY" - echoti cnorm >"$TTY" - } + # clear backbuffer with ctrl-l + function clear-screen-and-scrollback() { + echoti civis >"$TTY" + printf '%b' '\e[H\e[2J' >"$TTY" + zle .reset-prompt + zle -R + printf '%b' '\e[3J' >"$TTY" + echoti cnorm >"$TTY" + } - zle -N clear-screen-and-scrollback - bindkey '^L' clear-screen-and-scrollback - ''; - history = { - expireDuplicatesFirst = true; - path = "${config.xdg.stateHome}/zsh/zsh_history"; - save = 1000; - size = 100; - }; - plugins = [ - # { - # name = "powerlevel10k"; - # src = pkgs.zsh-powerlevel10k; - # file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; - # } + zle -N clear-screen-and-scrollback + bindkey '^L' clear-screen-and-scrollback + ''; + history = { + expireDuplicatesFirst = true; + path = "${config.xdg.stateHome}/zsh/zsh_history"; + save = 1000; + size = 100; + }; + plugins = [ + # { + # name = "powerlevel10k"; + # src = pkgs.zsh-powerlevel10k; + # file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; + # } - { - name = "zsh-completions"; - src = pkgs.zsh-completions; - file = "share/zsh-completions/zsh-completions.plugin.zsh"; - } + { + name = "zsh-completions"; + src = pkgs.zsh-completions; + file = "share/zsh-completions/zsh-completions.plugin.zsh"; + } - { - name = "cattppuccin-zsh-syntax-highlighting"; - src = pkgs.fetchFromGitHub { - owner = "catppuccin"; - repo = "zsh-syntax-highlighting"; - rev = "06d519c20798f0ebe275fc3a8101841faaeee8ea"; - sha256 = "sha256-Q7KmwUd9fblprL55W0Sf4g7lRcemnhjh4/v+TacJSfo="; - }; + { + name = "cattppuccin-zsh-syntax-highlighting"; + src = pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "zsh-syntax-highlighting"; + rev = "06d519c20798f0ebe275fc3a8101841faaeee8ea"; + sha256 = "sha256-Q7KmwUd9fblprL55W0Sf4g7lRcemnhjh4/v+TacJSfo="; + }; - file = "themes/catppuccin_mocha-zsh-syntax-highlighting.zsh"; - } + file = "themes/catppuccin_mocha-zsh-syntax-highlighting.zsh"; + } - # { - # name = "powerlevel10k-config"; - # src = ./files; - # file = ".p10k.zsh"; - # } - ]; - }; + # { + # name = "powerlevel10k-config"; + # src = ./files; + # file = ".p10k.zsh"; + # } + ]; + }; } diff --git a/util/default.nix b/util/default.nix index 1191065..7846328 100644 --- a/util/default.nix +++ b/util/default.nix @@ -1,4 +1,4 @@ -{home-manager, ...}: { - host = import ./host.nix {inherit home-manager;}; - user = import ./user.nix {inherit home-manager;}; +{ home-manager, ... }: { + host = import ./host.nix { inherit home-manager; }; + user = import ./user.nix { inherit home-manager; }; } diff --git a/util/host.nix b/util/host.nix index 869b674..a008566 100644 --- a/util/host.nix +++ b/util/host.nix @@ -1,41 +1,42 @@ -{home-manager, ...}: { - mkHost = { - name, - modules, - system ? "x86_64-linux", - specialArgs ? {}, - version ? "22.11", - pkgs, - }: { - ${name} = with pkgs.lib; - nixosSystem { - inherit system specialArgs; - modules = - [ - ../hosts/common - ../hosts/${name} +{ home-manager, ... }: { + mkHost = + { name + , modules + , system ? "x86_64-linux" + , specialArgs ? { } + , version ? "22.11" + , pkgs + , + }: { + ${name} = with pkgs.lib; + nixosSystem { + inherit system specialArgs; + modules = + [ + ../hosts/common + ../hosts/${name} - ({pkgs, ...}: { - system.stateVersion = version; - networking.hostName = mkDefault name; - # enable non-free packages - nixpkgs.config.allowUnfree = true; + ({ pkgs, ... }: { + system.stateVersion = version; + networking.hostName = mkDefault name; + # enable non-free packages + nixpkgs.config.allowUnfree = true; - # Enable nix flakes - nix.package = pkgs.nixFlakes; - nix.settings.experimental-features = ["nix-command" "flakes"]; - }) + # Enable nix flakes + nix.package = pkgs.nixFlakes; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + }) - home-manager.nixosModules.home-manager - { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - extraSpecialArgs = specialArgs; - }; - } - ] - ++ modules; - }; - }; + home-manager.nixosModules.home-manager + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = specialArgs; + }; + } + ] + ++ modules; + }; + }; } diff --git a/util/user.nix b/util/user.nix index 62c29f2..eb12e16 100644 --- a/util/user.nix +++ b/util/user.nix @@ -1,26 +1,27 @@ -{home-manager, ...}: { - mkHMUser = { - username, - stateVersion ? "22.11", - system ? "x86_64-linux", - channel, - modules ? [], - }: - home-manager.lib.homeManagerConfiguration { - pkgs = channel.legacyPackages.${system}; - modules = - [ - ../users/${username}/home.nix - { - nixpkgs.config.allowUnfree = true; - systemd.user.startServices = true; - home = { - inherit username stateVersion; - homeDirectory = "/home/${username}"; - }; - programs.home-manager.enable = true; - } - ] - ++ modules; - }; +{ home-manager, ... }: { + mkHMUser = + { username + , stateVersion ? "22.11" + , system ? "x86_64-linux" + , channel + , modules ? [ ] + , + }: + home-manager.lib.homeManagerConfiguration { + pkgs = channel.legacyPackages.${system}; + modules = + [ + ../users/${username}/home.nix + { + nixpkgs.config.allowUnfree = true; + systemd.user.startServices = true; + home = { + inherit username stateVersion; + homeDirectory = "/home/${username}"; + }; + programs.home-manager.enable = true; + } + ] + ++ modules; + }; } |
