feat: preliminary setup for work laptop

This commit is contained in:
Swarsel 2024-07-17 04:13:51 +02:00
parent 9db4166cfd
commit 6b43f84933
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
4 changed files with 298 additions and 47 deletions

View file

@ -1369,7 +1369,7 @@ My work machine.
Mostly just sets some opened ports for several games, enables virtualbox (which I do not want everywhere because of resource considerations) and enables thinkfan, which allows for better fan control on Lenovo Thinkpad machines. Mostly just sets some opened ports for several games, enables virtualbox (which I do not want everywhere because of resource considerations) and enables thinkfan, which allows for better fan control on Lenovo Thinkpad machines.
#+begin_src nix :noweb yes :tangle profiles/fourside/nixos.nix #+begin_src nix :noweb yes :tangle profiles/winters/nixos.nix
{ config, lib, pkgs, inputs, ... }: { config, lib, pkgs, inputs, ... }:
@ -1389,25 +1389,21 @@ Mostly just sets some opened ports for several games, enables virtualbox (which
boot = { boot = {
loader.systemd-boot.enable = true; loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true; loader.efi.canTouchEfiVariables = true;
# kernelPackages = pkgs.linuxPackages_latest; kernelPackages = pkgs.linuxPackages_latest;
}; };
networking = { networking = {
hostName = "fourside"; # Define your hostname. hostName = "winters"; # Define your hostname.
nftables.enable = true; nftables.enable = true;
enableIPv6 = false; enableIPv6 = true;
firewall.checkReversePath = false; firewall.checkReversePath = "strict";
firewall = { firewall = {
enable = true; enable = true;
allowedUDPPorts = [ 4380 27036 14242 34197 51820 ]; # 34197: factorio; 4380 27036 14242: barotrauma; 51820: wireguard allowedUDPPorts = [ ];
allowedTCPPorts = [ ]; # 34197: factorio; 4380 27036 14242: barotrauma; 51820: wireguard allowedTCPPorts = [ ];
allowedTCPPortRanges = [ allowedTCPPortRanges = [
{from = 27015; to = 27030;} # barotrauma
{from = 27036; to = 27037;} # barotrauma
]; ];
allowedUDPPortRanges = [ allowedUDPPortRanges = [
{from = 27000; to = 27031;} # barotrauma
{from = 58962; to = 58964;} # barotrauma
]; ];
}; };
}; };
@ -1431,16 +1427,9 @@ Mostly just sets some opened ports for several games, enables virtualbox (which
enable = true; enable = true;
enable32Bit = true; enable32Bit = true;
extraPackages = with pkgs; [ extraPackages = with pkgs; [
vulkan-loader
vulkan-validation-layers
vulkan-extension-layer
]; ];
}; };
bluetooth.enable = true; bluetooth.enable = true;
trackpoint = {
enable = true;
device = "TPPS/2 Elan TrackPoint";
};
}; };
programs.steam = { programs.steam = {
@ -1450,11 +1439,6 @@ Mostly just sets some opened ports for several games, enables virtualbox (which
]; ];
}; };
# Configure keymap in X11 (only used for login)
services.thinkfan = {
enable = false;
};
services.power-profiles-daemon.enable = true; services.power-profiles-daemon.enable = true;
users.users.swarsel = { users.users.swarsel = {
@ -1465,6 +1449,7 @@ Mostly just sets some opened ports for several games, enables virtualbox (which
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
sbctl
# gog games installing # gog games installing
heroic heroic
# minecraft # minecraft
@ -1481,14 +1466,14 @@ Mostly just sets some opened ports for several games, enables virtualbox (which
#+end_src #+end_src
***** Home Manager ***** TODO Home Manager
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h:85f7110c-2f25-4506-b64a-fce29f29d0d0 :CUSTOM_ID: h:85f7110c-2f25-4506-b64a-fce29f29d0d0
:END: :END:
This is basically just adjusted to the core count, path to the =hwmon= (this was very bothersome on this machine due to changing address), as well as making use of the top-row function keys. TODO: Adjust =hwmon= path, I/O modules and XF86 keys once laptop arrives.
#+begin_src nix :noweb yes :tangle profiles/fourside/home.nix #+begin_src nix :noweb yes :tangle profiles/winters/home.nix
{ config, pkgs, lib, fetchFromGitHub, ... }: { config, pkgs, lib, fetchFromGitHub, ... }:
@ -1508,7 +1493,7 @@ This is basically just adjusted to the core count, path to the =hwmon= (this was
# waybar config - TEMPLATE - update for cores and temp # waybar config - TEMPLATE - update for cores and temp
programs.waybar.settings.mainBar = { programs.waybar.settings.mainBar = {
cpu.format = "{icon0} {icon1} {icon2} {icon3} {icon4} {icon5} {icon6} {icon7}"; cpu.format = "{icon0} {icon1} {icon2} {icon3} {icon4} {icon5} {icon6} {icon7}";
# temperature.hwmon-path = "/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon4/temp1_input";
temperature.hwmon-path.abs = "/sys/devices/platform/thinkpad_hwmon/hwmon/"; temperature.hwmon-path.abs = "/sys/devices/platform/thinkpad_hwmon/hwmon/";
temperature.input-filename = "temp1_input"; temperature.input-filename = "temp1_input";
}; };
@ -1544,6 +1529,7 @@ This is basically just adjusted to the core count, path to the =hwmon= (this was
position = "1920,0"; position = "1920,0";
# bg = "~/.dotfiles/wallpaper/lenovowp.png fill"; # bg = "~/.dotfiles/wallpaper/lenovowp.png fill";
}; };
# external monitor
HDMI-A-1 = { HDMI-A-1 = {
mode = "2560x1440"; mode = "2560x1440";
scale = "1"; scale = "1";
@ -1561,19 +1547,7 @@ This is basically just adjusted to the core count, path to the =hwmon= (this was
keybindings = let keybindings = let
modifier = config.wayland.windowManager.sway.config.modifier; modifier = config.wayland.windowManager.sway.config.modifier;
in { in {
"${modifier}+w" = "exec \"bash ~/.dotfiles/scripts/checkelement.sh\"";
"XF86MonBrightnessUp" = "exec brightnessctl set +5%";
"XF86MonBrightnessDown"= "exec brightnessctl set 5%-";
"XF86Display" = "exec wl-mirror eDP-1";
# these are left open to use
# "XF86WLAN" = "exec wl-mirror eDP-1";
# "XF86Messenger" = "exec wl-mirror eDP-1";
# "XF86Go" = "exec wl-mirror eDP-1";
# "XF86Favorites" = "exec wl-mirror eDP-1";
# "XF86HomePage" = "exec wtype -P Escape -p Escape";
# "XF86AudioLowerVolume" = "pactl set-sink-volume alsa_output.pci-0000_08_00.6.HiFi__hw_Generic_1__sink -5%";
# "XF86AudioRaiseVolume" = "pactl set-sink-volume alsa_output.pci-0000_08_00.6.HiFi__hw_Generic_1__sink +5% ";
"XF86AudioMute" = "pactl set-sink-mute alsa_output.pci-0000_08_00.6.HiFi__hw_Generic_1__sink toggle";
}; };
startup = [ startup = [

View file

@ -205,6 +205,20 @@
]; ];
}; };
winters = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs pkgs; };
modules = nixModules ++ [
nixos-hardware.nixosModules.framework-16-inch-7040-amd
./profiles/winters/nixos.nix
home-manager.nixosModules.home-manager
{
home-manager.users.swarsel.imports = mixedModules ++ [
./profiles/winters/home.nix
];
}
];
};
stand = nixpkgs.lib.nixosSystem { stand = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs pkgs; }; specialArgs = {inherit inputs pkgs; };
modules = nixModules ++ [ modules = nixModules ++ [

118
profiles/winters/home.nix Normal file
View file

@ -0,0 +1,118 @@
{ config, pkgs, lib, fetchFromGitHub, ... }:
{
services.gpg-agent = {
enable = true;
enableSshSupport = true;
enableExtraSocket = true;
pinentryPackage = pkgs.pinentry.gtk2;
defaultCacheTtl = 600;
maxCacheTtl = 7200;
extraConfig = ''
allow-loopback-pinentry
allow-emacs-pinentry
'';
};
home = {
username = "swarsel";
homeDirectory = "/home/swarsel";
stateVersion = "23.05"; # TEMPLATE -- Please read the comment before changing.
keyboard.layout = "us"; # TEMPLATE
packages = with pkgs; [
];
};
sops.age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/sops" ];
# waybar config - TEMPLATE - update for cores and temp
programs.waybar.settings.mainBar = {
cpu.format = "{icon0} {icon1} {icon2} {icon3} {icon4} {icon5} {icon6} {icon7}";
temperature.hwmon-path.abs = "/sys/devices/platform/thinkpad_hwmon/hwmon/";
temperature.input-filename = "temp1_input";
};
programs.waybar.settings.mainBar.modules-right = ["custom/outer-left-arrow-dark"
"mpris"
"custom/left-arrow-light"
"network"
"custom/left-arrow-dark"
"pulseaudio"
"custom/left-arrow-light"
"custom/pseudobat"
"battery"
"custom/left-arrow-dark"
"group/hardware"
"custom/left-arrow-light"
"clock#2"
"custom/left-arrow-dark"
"clock#1"
];
wayland.windowManager.sway= {
config = rec {
# update for actual inputs here,
input = {
"36125:53060:splitkb.com_Kyria_rev3" = {
xkb_layout = "us";
xkb_variant = "altgr-intl";
};
"1:1:AT_Translated_Set_2_keyboard" = { # TEMPLATE
xkb_layout = "us";
xkb_options = "grp:win_space_toggle";
xkb_variant = "altgr-intl";
};
"type:touchpad" = {
dwt = "enabled";
tap = "enabled";
natural_scroll = "enabled";
middle_emulation = "enabled";
};
};
output = {
eDP-1 = {
mode = "1920x1080"; # TEMPLATE
scale = "1";
position = "1920,0";
# bg = "~/.dotfiles/wallpaper/lenovowp.png fill";
};
# external monitor
HDMI-A-1 = {
mode = "2560x1440";
scale = "1";
# bg = "~/.dotfiles/wallpaper/lenovowp.png fill";
position = "0,0";
};
};
workspaceOutputAssign = [
{ output = "eDP-1"; workspace = "1:";}
{ output = "HDMI-A-1"; workspace = "2:";}
];
keybindings = let
modifier = config.wayland.windowManager.sway.config.modifier;
in {
};
startup = [
{ command = "nextcloud --background";}
{ command = "discord --start-minimized";}
{ command = "element-desktop --hidden -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds";}
{ command = "ANKI_WAYLAND=1 anki";}
{ command = "OBSIDIAN_USE_WAYLAND=1 obsidian";}
{ command = "nm-applet";}
];
};
};
}

145
profiles/winters/nixos.nix Normal file
View file

@ -0,0 +1,145 @@
{ config, lib, pkgs, inputs, ... }:
{
#
# imports =
# [
# ./hardware-configuration.nix
# ];
#
imports =
[
./hardware-configuration.nix
];
services = {
getty.autologinUser = "swarsel";
greetd.settings.initial_session.user="swarsel";
};
boot = {
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;
kernelPackages = pkgs.linuxPackages_latest;
};
networking = {
hostName = "winters"; # Define your hostname.
nftables.enable = true;
enableIPv6 = true;
firewall.checkReversePath = "strict";
firewall = {
enable = true;
allowedUDPPorts = [ ];
allowedTCPPorts = [ ];
allowedTCPPortRanges = [
];
allowedUDPPortRanges = [
];
};
};
virtualisation.virtualbox = {
host = {
enable = true;
enableExtensionPack = true;
};
# leaving this here for future notice. setting guest.enable = true will make 'restarting sysinit-reactivation.target' take till timeout on nixos-rebuild switch
guest = {
enable = false;
};
};
stylix.image = ../../wallpaper/lenovowp.png;
stylix = {
enable = true;
base16Scheme = ../../wallpaper/swarsel.yaml;
# base16Scheme = "${pkgs.base16-schemes}/share/themes/shapeshifter.yaml";
polarity = "dark";
opacity.popups = 0.5;
cursor = {
package = pkgs.capitaine-cursors;
name = "capitaine-cursors";
size = 16;
};
fonts = {
sizes = {
terminal = 10;
applications = 11;
};
serif = {
# package = (pkgs.nerdfonts.override { fonts = [ "FiraMono" "FiraCode"]; });
package = pkgs.cantarell-fonts;
# package = pkgs.montserrat;
name = "Cantarell";
# name = "FiraCode Nerd Font Propo";
# name = "Montserrat";
};
sansSerif = {
# package = (pkgs.nerdfonts.override { fonts = [ "FiraMono" "FiraCode"]; });
package = pkgs.cantarell-fonts;
# package = pkgs.montserrat;
name = "Cantarell";
# name = "FiraCode Nerd Font Propo";
# name = "Montserrat";
};
monospace = {
package = (pkgs.nerdfonts.override { fonts = [ "FiraCode"]; });
name = "FiraCode Nerd Font Mono";
};
emoji = {
package = pkgs.noto-fonts-emoji;
name = "Noto Color Emoji";
};
};
};
hardware = {
graphics = {
enable = true;
enable32Bit = true;
extraPackages = with pkgs; [
];
};
bluetooth.enable = true;
};
programs.steam = {
enable = true;
extraCompatPackages = [
pkgs.proton-ge-bin
];
};
services.power-profiles-daemon.enable = true;
users.users.swarsel = {
isNormalUser = true;
description = "Leon S";
extraGroups = [ "networkmanager" "wheel" "lp" "audio" "video" "vboxusers" "scanner" ];
packages = with pkgs; [];
};
environment.systemPackages = with pkgs; [
sbctl
# gog games installing
heroic
# minecraft
temurin-bin-17
(prismlauncher.override {
glfw = pkgs.glfw-wayland-minecraft;
})
];
system.stateVersion = "23.05";
}