diff --git a/home-manager/gnome.nix b/home-manager/gnome.nix index 15f001a..36e6f0f 100644 --- a/home-manager/gnome.nix +++ b/home-manager/gnome.nix @@ -6,19 +6,91 @@ "org/gnome/shell" = { favorite-apps = [ "firefox.desktop" - "code.desktop" - "org.gnome.Terminal.desktop" - "spotify.desktop" - "virt-manager.desktop" "org.gnome.Nautilus.desktop" + "spotify.desktop" + "com.github.eneshecan.WhatsAppForLinux.desktop" + "discord.desktop" + ]; + enabled-extensions = [ + "just-perfection-desktop@just-perfection" + "window-list@gnome-shell-extensions.gcampax.github.com" ]; }; "org/gnome/desktop/interface" = { color-scheme = "prefer-dark"; enable-hot-corners = false; + show-battery-percentage = true; + }; + "org/gnome/desktop/search-providers" = { + disabled = [ + "org.gnome.seahorse.Application.desktop" + "org.gnome.Photos.desktop" + "org.gnome.Epiphany.desktop" + "org.gnome.clocks.desktop" + "org.gnome.Contacts.desktop" + "org.gnome.Calendar.desktop" + ]; + sort-order = [ + "org.gnome.Settings.desktop" + "org.gnome.Documents.desktop" + "org.gnome.Calculator.desktop" + "org.gnome.Characters.desktop" + "org.gnome.Contacts.desktop" + "org.gnome.Nautilus.desktop" + "org.gnome.Calendar.desktop" + "org.gnome.clocks.desktop" + "org.gnome.seahorse.Application.desktop" + "org.gnome.Photos.desktop" + ]; + }; + "org/gnome/settings-daemon/plugins/power" = { + power-button-action = "nothing"; + }; + "org/gnome/mutter" = { + edge-tiling = true; + dynamic-workspaces = true; + }; + + "org/gnome/shell/extensions/just-perfection" = { + activities-button = false; + app-menu = false; + app-menu-label = false; + ripple-box = false; + windows-demands-attention-focus = true; + switcher-popup-delay = true; + animation = 5; + alt-tab-small-icon-size = 64; + alt-tab-window-preview-size = 256; + }; + + + # Keybindings + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = { + binding = ["t"]; + command = "kgx"; + name = "Console"; + }; + "org/gnome/desktop/wm/keybindings" = { + switch-windows = ["Tab"]; + switch-windows-backward = ["Tab"]; + minimize = ["Down"]; + toggle-maximized = ["Up"]; + close = ["F4"]; + panel-run-dialog = ["F2"]; + switch-to-workspace-left = ["Left"]; + switch-to-workspace-right = ["Right"]; + }; + "org/gnome/settings-daemon/plugins/media-keys" = { + screensaver = ["l"]; + home = ["e"]; + }; + "org/gnome/shell/keybindings" = { + screenshot = ["Print"]; + show-screenshot-ui = ["s"]; + toggle-message-tray = ["v"]; + }; + "org/gnome/mutter/wayland/keybindings" = { + restore-shortcuts = "@as []"; }; - # "org/gnome/wm/keybindings/toggle-maximized" = { - # ['Up'] - # }; }; } diff --git a/home-manager/home.nix b/home-manager/home.nix index edcf02d..072d272 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -1,5 +1,3 @@ -# This is your home-manager configuration file -# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) { inputs, outputs, @@ -8,7 +6,6 @@ pkgs, ... }: { - # You can import other home-manager modules here imports = [ ./gnome.nix ]; @@ -51,17 +48,18 @@ # Enable programs home.packages = with pkgs; [ # Unbuilt - bitwarden discord jetbrains-toolbox + gnomeExtensions.just-perfection + htop parsec-bin + platformio-core spotify tailscale + whatsapp-for-linux zoxide - zsh - ]; programs.home-manager.enable = true; @@ -72,7 +70,16 @@ }; programs.firefox.enable = true; programs.gh.enable = true; - + programs.zsh = { + shellAliases = { + update = "sudo nixos-rebuild switch --flake .#laptop-koen"; + }; + oh-my-zsh = { + enable = true; + plugins = [ "git" ]; + theme = "agnoster"; + }; + }; # Nicely reload system units when changing configs systemd.user.startServices = "sd-switch"; diff --git a/machines/laptop/configuration.nix b/machines/laptop/configuration.nix new file mode 100644 index 0000000..2309552 --- /dev/null +++ b/machines/laptop/configuration.nix @@ -0,0 +1,127 @@ + +# This is your system's configuration file. +# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + # You can import other NixOS modules here + imports = [ + # If you want to use modules your own flake exports (from modules/nixos): + # outputs.nixosModules.example + + # Or modules from other flakes (such as nixos-hardware): + # inputs.hardware.nixosModules.common-cpu-amd + # inputs.hardware.nixosModules.common-ssd + + # You can also split up your configuration and import pieces of it here: + # ./users.nix + + # Import your generated (nixos-generate-config) hardware configuration + inputs.home-manager.nixosModules.home-manager + ./hardware-configuration.nix + ]; + + + home-manager = { + extraSpecialArgs = { inherit inputs outputs; }; + users = { + # Import your home-manager configuration + horseman = import ../home-manager/home.nix; + }; + }; + + nixpkgs = { + # You can add overlays here + overlays = [ + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + + # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + }; + }; + + # This will add each flake input as a registry + # To make nix3 commands consistent with your flake + nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); + + # This will additionally add your inputs to the system's legacy channels + # Making legacy nix commands consistent as well, awesome! + nix.nixPath = ["/etc/nix/path"]; + environment.etc = + lib.mapAttrs' + (name: value: { + name = "nix/path/${name}"; + value.source = value.flake; + }) + config.nix.registry; + + nix.settings = { + # Enable flakes and new 'nix' command + experimental-features = "nix-command flakes"; + # Deduplicate and optimize nix store + auto-optimise-store = true; + }; + + networking.hostName = "laptop-koen"; + + # time.timeZone = "Europe/Amsterdam"; + + # i18n.defaultLocale = "en_US.UTF-8"; + + services.xserver.enable = true; + services.xserver.desktopManager.gnome.enable = true; + services.xserver.displayManager.gdm.enable = true; + boot.loader.systemd-boot.enable = true; + + + # TODO: Configure your system-wide user settings (groups, etc), add more users as needed. + users.users = { + horseman = { + # TODO: You can set an initial password for your user. + # If you do, you can skip setting a root password by passing '--no-root-passwd' to nixos-install. + # Be sure to change it (using passwd) after rebooting! + initialPassword = "1234"; + isNormalUser = true; + openssh.authorizedKeys.keys = [ + # TODO: Add your SSH public key(s) here, if you plan on using SSH to connect + ]; + # TODO: Be sure to add any other groups you need (such as networkmanager, audio, docker, etc) + extraGroups = ["wheel"]; + }; + }; + + # This setups a SSH server. Very important if you're setting up a headless system. + # Feel free to remove if you don't need it. + services.openssh = { + enable = true; + settings = { + # Forbid root login through SSH. + PermitRootLogin = "no"; + # Use keys only. Remove if you want to SSH using password (not recommended) + PasswordAuthentication = false; + }; + }; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "23.05"; +} diff --git a/machines/laptop/hardware-configuration.nix b/machines/laptop/hardware-configuration.nix new file mode 100644 index 0000000..c1cbcb0 --- /dev/null +++ b/machines/laptop/hardware-configuration.nix @@ -0,0 +1,41 @@ +# 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, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/4c50d5fb-2734-4acf-9aa9-daa4dbd8c982"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/7FE8-93C8"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/1a5004e0-dfcb-4986-aa3d-e2cc9e81f70b"; } + ]; + + # 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.enp3s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/machines/pc/configuration.nix b/machines/pc/configuration.nix new file mode 100644 index 0000000..a8c048e --- /dev/null +++ b/machines/pc/configuration.nix @@ -0,0 +1,170 @@ +# This is your system's configuration file. +# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + # You can import other NixOS modules here + imports = [ + # If you want to use modules your own flake exports (from modules/nixos): + # outputs.nixosModules.example + + # Or modules from other flakes (such as nixos-hardware): + # inputs.hardware.nixosModules.common-cpu-amd + # inputs.hardware.nixosModules.common-ssd + + # You can also split up your configuration and import pieces of it here: + # ./users.nix + + # Import your generated (nixos-generate-config) hardware configuration + inputs.home-manager.nixosModules.home-manager + ./hardware-configuration.nix + ]; + + # NVIDIA Drivers + # Enable OpenGL + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + + # Load nvidia driver for Xorg and Wayland + services.xserver.videoDrivers = ["nvidia"]; # or "nvidiaLegacy470 etc. + + hardware.nvidia = { + + # Modesetting is required. + modesetting.enable = true; + + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + # Enable this if you have graphical corruption issues or application crashes after waking + # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead + # of just the bare essentials. + powerManagement.enable = false; + + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; + + # Use the NVidia open source kernel module (not to be confused with the + # independent third-party "nouveau" open source driver). + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + # Only available from driver 515.43.04+ + # Currently alpha-quality/buggy, so false is currently the recommended setting. + open = false; + + # Enable the Nvidia settings menu, + # accessible via `nvidia-settings`. + nvidiaSettings = true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + + + + home-manager = { + extraSpecialArgs = { inherit inputs outputs; }; + users = { + # Import your home-manager configuration + horseman = import ../home-manager/home.nix; + }; + }; + + nixpkgs = { + # You can add overlays here + overlays = [ + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + + # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + }; + }; + + # This will add each flake input as a registry + # To make nix3 commands consistent with your flake + nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); + + # This will additionally add your inputs to the system's legacy channels + # Making legacy nix commands consistent as well, awesome! + nix.nixPath = ["/etc/nix/path"]; + environment.etc = + lib.mapAttrs' + (name: value: { + name = "nix/path/${name}"; + value.source = value.flake; + }) + config.nix.registry; + + nix.settings = { + # Enable flakes and new 'nix' command + experimental-features = "nix-command flakes"; + # Deduplicate and optimize nix store + auto-optimise-store = true; + }; + + networking.hostName = "pc-koen"; + + # time.timeZone = "Europe/Amsterdam"; + + # i18n.defaultLocale = "en_US.UTF-8"; + + services.xserver.enable = true; + services.xserver.desktopManager.gnome.enable = true; + services.xserver.displayManager.gdm.enable = true; + boot.loader.systemd-boot.enable = true; + + + # TODO: Configure your system-wide user settings (groups, etc), add more users as needed. + users.users = { + horseman = { + # TODO: You can set an initial password for your user. + # If you do, you can skip setting a root password by passing '--no-root-passwd' to nixos-install. + # Be sure to change it (using passwd) after rebooting! + initialPassword = "1234"; + isNormalUser = true; + openssh.authorizedKeys.keys = [ + # TODO: Add your SSH public key(s) here, if you plan on using SSH to connect + ]; + # TODO: Be sure to add any other groups you need (such as networkmanager, audio, docker, etc) + extraGroups = ["wheel"]; + }; + }; + + # This setups a SSH server. Very important if you're setting up a headless system. + # Feel free to remove if you don't need it. + services.openssh = { + enable = true; + settings = { + # Forbid root login through SSH. + PermitRootLogin = "no"; + # Use keys only. Remove if you want to SSH using password (not recommended) + PasswordAuthentication = false; + }; + }; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "23.05"; +} diff --git a/machines/pc/hardware-configuration.nix b/machines/pc/hardware-configuration.nix new file mode 100644 index 0000000..b2e1477 --- /dev/null +++ b/machines/pc/hardware-configuration.nix @@ -0,0 +1,39 @@ +# 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, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/0854d787-c362-4077-8c4b-bea85a108eba"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/6978-DAA0"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/728d324f-f856-4327-b868-bb1883172d77"; } + ]; + + # 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.eno1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}