Merge branch 'main' of github.com:LarssonMartin1998/.dotfiles

This commit is contained in:
Martin Larsson 2025-05-11 13:30:31 +02:00
commit 5e20a69903
6 changed files with 155 additions and 32 deletions

View file

@ -61,6 +61,12 @@
}: }:
let let
lib = nixpkgs.lib; lib = nixpkgs.lib;
get_pkgs = { system }: import nixpkgs {
inherit system;
config = {
allowUnfree = true;
};
};
makeSystemConfig = makeSystemConfig =
{ {
@ -70,17 +76,17 @@
extraModules ? [ ], extraModules ? [ ],
specialArgs ? { }, specialArgs ? { },
}: }:
builder { let
pkgs = get_pkgs { inherit system; };
in builder {
inherit system; inherit system;
pkgs = import nixpkgs { pkgs = pkgs;
inherit system;
config = {
allowUnfree = true;
};
};
modules = [ modules = [
{ {
nix.settings.experimental-features = "nix-command flakes"; nix.settings.experimental-features = "nix-command flakes";
environment.systemPackages = with pkgs; [
vim
];
} }
./nix/local_system.nix ./nix/local_system.nix
] ++ extraModules; ] ++ extraModules;
@ -93,14 +99,10 @@
name, name,
system, system,
extraModules ? [ ], extraModules ? [ ],
}: }: let
home-manager.lib.homeManagerConfiguration { pkgs = get_pkgs { inherit system; };
pkgs = import nixpkgs { in home-manager.lib.homeManagerConfiguration {
inherit system; pkgs = pkgs;
config = {
allowUnfree = true;
};
};
modules = [ modules = [
./nix/pkgs/home.nix ./nix/pkgs/home.nix
./nix/local_home.nix ./nix/local_home.nix
@ -128,7 +130,10 @@
name = "linux-x86"; name = "linux-x86";
system = "x86_64-linux"; system = "x86_64-linux";
builder = lib.nixosSystem; builder = lib.nixosSystem;
extraModules = [ ./nix/system/linux.nix ]; extraModules = [
./nix/system/linux.nix
./nix/system/linux_x86.nix
];
}; };
"linux-aarch" = makeSystemConfig { "linux-aarch" = makeSystemConfig {

View file

@ -197,6 +197,7 @@ in
spotify-qt spotify-qt
librespot librespot
blueman blueman
playerctl
]; ];
file = { file = {

View file

@ -2,10 +2,6 @@
{ {
programs = { programs = {
zsh.enable = true; zsh.enable = true;
sway = {
enable = true;
package = pkgs.swayfx;
};
}; };
networking = { networking = {

View file

@ -5,6 +5,13 @@
apple-silicon-support.nixosModules.apple-silicon-support apple-silicon-support.nixosModules.apple-silicon-support
]; ];
programs = {
sway = {
enable = true;
package = pkgs.swayfx;
};
};
boot = { boot = {
consoleLogLevel = 0; consoleLogLevel = 0;
kernelParams = [ "apple_dcp.show_notch=1" ]; kernelParams = [ "apple_dcp.show_notch=1" ];

97
nix/system/linux_x86.nix Normal file
View file

@ -0,0 +1,97 @@
{ pkgs, config, ... }:
{
imports = [
./hardware-configuration.nix
];
boot = {
consoleLogLevel = 0;
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
kernelModules = [
"nvidia"
"nvidia_modeset"
"nvidia_uvm"
"nvidia_drm"
];
blacklistedKernelModules = [ "nouveau" ];
kernelParams = [
"nvidia-drm.modeset=1"
"nvidia-drm.fbdev=1"
];
};
hardware = {
nvidia = {
modesetting.enable = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
open = true;
powerManagement = {
enable = true;
finegrained = false;
};
nvidiaPersistenced = true;
};
graphics.enable = true;
bluetooth.enable = true;
bluetooth.powerOnBoot = true;
bluetooth.settings = {
General = {
Enable = "Source,Sink,Media,Socket";
Experimental = true;
};
};
};
networking.hostName = "walnut-nixos";
networking = {
wireless.iwd = {
enable = true;
settings.General.EnableNetworkConfiguration = true;
};
networkmanager = {
enable = true;
wifi.backend = "iwd";
wifi.powersave = true;
};
};
programs = {
xwayland.enable = true;
sway = {
enable = true;
package = pkgs.swayfx;
extraOptions = [
"--unsupported-gpu"
];
};
};
environment.variables = {
GBM_BACKEND = "nvidia-drm";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
NIXOS_OZONE_WL = "1";
WLR_NO_HARDWARE_CURSORS = "1";
WLR_RENDERER = "vulkan";
};
services = {
xserver = {
enable = true;
videoDrivers = [ "nvidia" ];
};
};
users.users.larssonmartin = {
isNormalUser = true;
home = "/home/larssonmartin";
extraGroups = [ "wheel" ];
packages = [ ];
shell = pkgs.zsh;
};
}

View file

@ -26,12 +26,18 @@ update_status() {
fi fi
# Network status # Network status
ssid=$(nmcli -t -f ACTIVE,SSID dev wifi | grep -E '^yes' | cut -d: -f2) ethernet_connected=$(nmcli -t -f DEVICE,STATE device | grep -E '^en.*:connected' | wc -l)
if [ -z "$ssid" ]; then if [ "$ethernet_connected" -gt 0 ]; then
network_display="$wifi_icon Disconnected" network_display=""
else else
network_display="$wifi_icon $ssid" # Check WiFi connection
fi ssid=$(nmcli -t -f ACTIVE,SSID dev wifi | grep -E '^yes' | cut -d: -f2)
if [ -z "$ssid" ]; then
network_display="$wifi_icon Disconnected"
else
network_display="$wifi_icon $ssid"
fi
fi
# Date/time # Date/time
date_time_icon="$date_icon $(date +"%a %b %d, %H:%M")" date_time_icon="$date_icon $(date +"%a %b %d, %H:%M")"
@ -39,9 +45,14 @@ update_status() {
# Battery # Battery
battery=$("$HOME/.config/confutils/get-battery.sh") battery=$("$HOME/.config/confutils/get-battery.sh")
# Brightness # Only show brightness if a laptop/internal display is detected
brightness=$(brightnessctl | grep -oP '[0-9]+(?=%)') internal_display_active=$(swaymsg -t get_outputs | jq -r '.[] | select(.name == "eDP-1" or .name == "LVDS-1") | .name' | wc -l)
brightness_display="$brightness_icon $brightness%" if [ "$internal_display_active" -gt 0 ] && command -v brightnessctl &> /dev/null; then
brightness=$(brightnessctl | grep -oP '[0-9]+(?=%)')
brightness_display="$brightness_icon $brightness%"
else
brightness_display=""
fi
# Bluetooth # Bluetooth
bluetooth_device=$(bluetoothctl devices Connected \ bluetooth_device=$(bluetoothctl devices Connected \
@ -82,11 +93,17 @@ update_status() {
space=" " # Using standard spaces for separation space=" " # Using standard spaces for separation
final_status="$final_status$space$volume_display" final_status="$final_status$space$volume_display"
final_status="$final_status$space$brightness_display" if [ -n "$brightness_display" ]; then
final_status="$final_status$space$battery" final_status="$final_status$space$brightness_display"
fi
if [ -n "$battery" ]; then
final_status="$final_status$space$battery"
fi
final_status="$final_status$space$keyboard_display" final_status="$final_status$space$keyboard_display"
final_status="$final_status$space$vpn_display" final_status="$final_status$space$vpn_display"
final_status="$final_status$space$network_display" if [ -n "$network_display" ]; then
final_status="$final_status$space$network_display"
fi
final_status="$final_status$space$date_time_icon" final_status="$final_status$space$date_time_icon"
final_status="$final_status " # Trailing space final_status="$final_status " # Trailing space