Added support for multiple machines and also added more config

This commit is contained in:
KoenDR06 2024-03-18 16:28:10 +01:00
parent af315f0993
commit 59700c5739
6 changed files with 470 additions and 14 deletions

View file

@ -6,19 +6,91 @@
"org/gnome/shell" = { "org/gnome/shell" = {
favorite-apps = [ favorite-apps = [
"firefox.desktop" "firefox.desktop"
"code.desktop"
"org.gnome.Terminal.desktop"
"spotify.desktop"
"virt-manager.desktop"
"org.gnome.Nautilus.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" = { "org/gnome/desktop/interface" = {
color-scheme = "prefer-dark"; color-scheme = "prefer-dark";
enable-hot-corners = false; 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 = ["<Super>t"];
command = "kgx";
name = "Console";
};
"org/gnome/desktop/wm/keybindings" = {
switch-windows = ["<Alt>Tab"];
switch-windows-backward = ["<Shift><Alt>Tab"];
minimize = ["<Super>Down"];
toggle-maximized = ["<Super>Up"];
close = ["<Alt>F4"];
panel-run-dialog = ["<Alt>F2"];
switch-to-workspace-left = ["<Control><Super>Left"];
switch-to-workspace-right = ["<Control><Super>Right"];
};
"org/gnome/settings-daemon/plugins/media-keys" = {
screensaver = ["<Super>l"];
home = ["<Super>e"];
};
"org/gnome/shell/keybindings" = {
screenshot = ["Print"];
show-screenshot-ui = ["<Shift><Super>s"];
toggle-message-tray = ["<Super>v"];
};
"org/gnome/mutter/wayland/keybindings" = {
restore-shortcuts = "@as []";
}; };
# "org/gnome/wm/keybindings/toggle-maximized" = {
# ['<Super>Up']
# };
}; };
} }

View file

@ -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, inputs,
outputs, outputs,
@ -8,7 +6,6 @@
pkgs, pkgs,
... ...
}: { }: {
# You can import other home-manager modules here
imports = [ imports = [
./gnome.nix ./gnome.nix
]; ];
@ -52,16 +49,17 @@
home.packages = with pkgs; [ home.packages = with pkgs; [
# Unbuilt # Unbuilt
bitwarden bitwarden
discord discord
jetbrains-toolbox jetbrains-toolbox
gnomeExtensions.just-perfection
htop
parsec-bin parsec-bin
platformio-core
spotify spotify
tailscale tailscale
whatsapp-for-linux
zoxide zoxide
zsh
]; ];
programs.home-manager.enable = true; programs.home-manager.enable = true;
@ -72,7 +70,16 @@
}; };
programs.firefox.enable = true; programs.firefox.enable = true;
programs.gh.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 # Nicely reload system units when changing configs
systemd.user.startServices = "sd-switch"; systemd.user.startServices = "sd-switch";

View file

@ -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";
}

View file

@ -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.<interface>.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;
}

View file

@ -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";
}

View file

@ -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.<interface>.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;
}