Rice laptop
Some checks failed
pre-commit / pre-commit (push) Failing after 23s
pre-commit / pre-commit (pull_request) Failing after 14m39s

This commit is contained in:
Torjus Håkestad 2024-04-21 11:46:33 +02:00
parent 8d151534b1
commit e1049f0a16
16 changed files with 312 additions and 19 deletions

View File

@ -0,0 +1,19 @@
general {
lock_cmd = hyprlock # dbus/sysd lock command (loginctl lock-session)
# unlock_cmd = notify-send "unlock!" # same as above, but unlock
before_sleep_cmd = hyprlock # command ran before sleep
# after_sleep_cmd = # command ran after sleep
ignore_dbus_inhibit = false # whether to ignore dbus-sent idle-inhibit requests (used by e.g. firefox or steam)
}
listener {
timeout = 240 # in seconds
on-timeout = hyprlock # command to run when timeout has passed
# on-resume = notify-send "Welcome back!" # command to run when activity is detected after timeout has fired.
}
listener {
timeout = 900
on-timeout = systemctl suspend # command to run when timeout has passed
# on-resume = notify-send "Welcome back!" # command to run when activity is detected after timeout has fired.
}

View File

@ -0,0 +1,12 @@
{ config, pkgs, ... }: {
home.packages = with pkgs; [
unstable.hypridle
];
xdg.configFile = {
"hypr/hypridle.conf" = {
source = config.lib.file.mkOutOfStoreSymlink ./. + "/hypridle.conf";
target = "hypr/hypridle.conf";
};
};
}

View File

@ -1,4 +1,8 @@
{ inputs, pkgs, lib, config, ... }: {
imports = [
./hyprlock.nix
./hypridle.nix
];
options.hyprland.enable = lib.mkEnableOption "Hyprland";
config = {
home.packages = with pkgs; [
@ -104,6 +108,9 @@
"$mainMod,D,exec,rofi-launcher"
"$mainMod,P,exec,rofi-rbw"
# hyprlock
"$shiftMainMod,l,exec,hyprlock"
# hyprland
"$mainMod,Q,killactive,"
"CTRLALT,Delete,exit,"
@ -129,11 +136,11 @@
# ",code:202,exec,mumble rpc starttalking"
#",code:202,pass,^(info\.mumble\.Mumble)$"
# ",code:202,exec,pamixer --default-source -u"
",code:202,pass,^discord$"
# ",code:202,pass,^discord$"
# worspace switching
"$mainMod,1,workspace,name:main 1"
"$mainMod,2,workspace,name:main 2"
"$mainMod,1,workspace,1"
"$mainMod,2,workspace,2"
"$mainMod,3,workspace,3"
"$mainMod,4,workspace,4"
"$mainMod,5,workspace,5"
@ -143,7 +150,7 @@
exec-once = [
"waybar"
"hyprpaper & sleep 2 && randomwp"
"easyeffects --gapplication-service"
"hypridle"
# "dunst"
];
};

View File

@ -0,0 +1,78 @@
source = ~/.cache/wal/colors-hyprland.conf
# BACKGROUND
background {
monitor =
path = ~/wallpapers/current
blur_passes = 3
contrast = 0.8916
brightness = 0.8172
vibrancy = 0.1696
vibrancy_darkness = 0.0
}
# GENERAL
general {
no_fade_in = false
grace = 0
disable_loading_bar = true
}
# INPUT FIELD
input-field {
monitor =
size = 250, 60
outline_thickness = 2
dots_size = 0.2 # Scale of input-field height, 0.2 - 0.8
dots_spacing = 0.2 # Scale of dots' absolute size, 0.0 - 1.0
dots_center = true
outer_color = rgba(0, 0, 0, 0)
inner_color = rgba(0, 0, 0, 0.5)
font_color = rgb(200, 200, 200)
fade_on_empty = false
font_family = JetBrains Mono Nerd Font Mono
placeholder_text = <i><span foreground="##cdd6f4">Input Password...</span></i>
hide_input = false
position = 0, -120
halign = center
valign = center
}
# TIME
label {
monitor =
text = cmd[update:1000] echo "$(date +"%b %d %H:%M")"
color = $foreground
#color = rgba(255, 255, 255, 0.6)
font_size = 120
font_family = JetBrains Mono Nerd Font Mono ExtraBold
position = 0, -300
halign = center
valign = top
}
## USER
#label {
# monitor =
# text = Hi there, $USER
# color = $foreground
# #color = rgba(255, 255, 255, 0.6)
# font_size = 25
# font_family = JetBrains Mono Nerd Font Mono
# position = 0, -40
# halign = center
# valign = center
#}
# Battery level
label {
monitor =
text = cmd[update:1000] echo "$(batlvl)"
color = $foreground
#color = rgba(255, 255, 255, 0.6)
font_size = 18
# font_family = JetBrainsMono, Font Awesome 6 Free Solid
font_family = JetBrains Mono Nerd Font Mono
position = 0, -50
halign = center
valign = bottom
}

View File

@ -0,0 +1,12 @@
{ config, pkgs, ... }: {
home.packages = with pkgs; [
unstable.hyprlock
];
xdg.configFile = {
"hypr/hyprlock.conf" = {
source = config.lib.file.mkOutOfStoreSymlink ./. + "/hyprlock.conf";
target = "hypr/hyprlock.conf";
};
};
}

View File

@ -1,4 +1,15 @@
{ pkgs, lib, ... }: {
{ pkgs, lib, ... }:
let
flakestat = pkgs.writeShellApplication {
name = "flakestat";
runtimeInputs = with pkgs; [
git
jq
];
text = builtins.readFile ./flakestat.sh;
};
in
{
xdg.configFile."waybar/macchiato.css" = {
source = pkgs.fetchFromGitHub
{
@ -96,6 +107,7 @@
#network,
#battery,
#custom-powermenu,
#custom-flakestat,
#custom-cava-internal {
padding-left: 10px;
padding-right: 10px;
@ -143,7 +155,7 @@
modules-left = [ "custom/launcher" "hyprland/workspaces" ];
modules-center = [ "clock" ];
modules-right =
[ "pulseaudio" "pulseaudio#microphone" "memory" "cpu" "tray" ];
[ "custom/flakestat" "pulseaudio" "pulseaudio#microphone" "memory" "cpu" "tray" "battery" ];
"custom/launcher" = {
"format" = " ";
"on-click" = "pkill rofi || ~/.config/rofi/launcher.sh";
@ -190,6 +202,25 @@
"icon-size" = 15;
"spacing" = 6;
};
"battery" = {
"interval" = 60;
"states" = {
"warning" = 20;
"critical" = 5;
};
"format" = "{icon} {capacity}%";
"format-icons" = [
""
""
""
""
""
];
};
"custom/flakestat" = {
"exec" = "${flakestat}/bin/flakestat";
"interval" = 600;
};
}];
};
}

View File

@ -0,0 +1,25 @@
#!/usr/bin/env bash
FLAKE_DIR="/home/torjus/nixos"
NIXPKGS_DIR="/home/torjus/git/nixpkgs"
flake_metadata=$(nix flake metadata --json "$FLAKE_DIR" 2>/dev/null)
stable_input=$(echo "$flake_metadata" | jq '.locks.nodes.root.inputs.nixpkgs')
stable_rev=$(echo "$flake_metadata" | jq -r ".locks.nodes.$stable_input.locked.rev")
stable_branch=$(echo "$flake_metadata" | jq -r ".locks.nodes.$stable_input.original.ref")
unstable_input=$(echo "$flake_metadata" | jq '.locks.nodes.root.inputs."nixpkgs-unstable"')
unstable_rev=$(echo "$flake_metadata" | jq -r ".locks.nodes.$unstable_input.locked.rev")
unstable_branch=$(echo "$flake_metadata" | jq -r ".locks.nodes.$unstable_input.original.ref")
cd "$NIXPKGS_DIR" || exit 1
git fetch -q
git switch -q "$stable_branch"
git pull -q
stable_commit_count=$(git rev-list "$stable_rev..HEAD"|wc -l)
git switch -q "$unstable_branch"
git pull -q
unstable_commit_count=$(git rev-list "$unstable_rev..HEAD"|wc -l)
echo "$stable_commit_count|$unstable_commit_count"

View File

@ -1,4 +1,5 @@
{ pkgs, ... }: {
{ pkgs, ... }:
{
programs.waybar = {
enable = true;
systemd = {
@ -133,7 +134,7 @@
modules-left = [ "custom/launcher" "hyprland/workspaces" ];
modules-center = [ "clock" ];
modules-right =
[ "pulseaudio" "pulseaudio#microphone" "memory" "cpu" "tray" ];
[ "pulseaudio" "pulseaudio#microphone" "memory" "cpu" "tray" "battery" ];
"custom/launcher" = {
"format" = " ";
"on-click" = "pkill rofi || ~/.config/rofi/launcher.sh";
@ -180,6 +181,21 @@
"icon-size" = 15;
"spacing" = 6;
};
"battery" = {
"interval" = 60;
"states" = {
"warning" = 30;
"critical" = 5;
};
"format" = "{icon} {capacity}%";
"format-icons" = [
""
""
""
""
""
];
};
}];
};
}

View File

@ -16,7 +16,9 @@
./programs/rofi
./programs/obs-studio
./programs/vscode
./programs/pywal
./scripts
./scripts/batlvl.nix
./zsh
./packages
./hyprland/magicman.nix

View File

@ -0,0 +1,27 @@
{ config, pkgs, ... }: {
programs.pywal.enable = true;
xdg.configFile = {
"wal/templates/colors-hyprland.conf" = {
text = ''$foreground = 0xff{foreground.strip}
$background = 0xff{background.strip}
$color0 = 0xff{color0.strip}
$color1 = 0xff{color1.strip}
$color2 = 0xff{color2.strip}
$color3 = 0xff{color3.strip}
$color4 = 0xff{color4.strip}
$color5 = 0xff{color5.strip}
$color6 = 0xff{color6.strip}
$color7 = 0xff{color7.strip}
$color8 = 0xff{color8.strip}
$color9 = 0xff{color9.strip}
$color10 = 0xff{color10.strip}
$color11 = 0xff{color11.strip}
$color12 = 0xff{color12.strip}
$color13 = 0xff{color13.strip}
$color14 = 0xff{color14.strip}
$color15 = 0xff{color15.strip}
'';
};
};
}

14
home/scripts/batlvl.nix Normal file
View File

@ -0,0 +1,14 @@
{ config, pkgs, ... }:
let
batlvl = pkgs.writeShellApplication {
name = "batlvl";
runtimeInputs = [
];
text = builtins.readFile ./batlvl.sh;
};
in
{
home.packages = [
batlvl
];
}

12
home/scripts/batlvl.sh Normal file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
ac_status=$(cat /sys/class/power_supply/AC/online)
bat_status=$(cat /sys/class/power_supply/BAT0/status)
bat_lvl=$(cat /sys/class/power_supply/BAT0/capacity)
if (("$ac_status" == 0)); then
echo "$bat_status - $bat_lvl%"
else
if [ "$bat_lvl" -lt "90" ]; then
echo "$bat_status - $bat_lvl%"
fi
fi

View File

@ -10,7 +10,7 @@ if ! [ -d "$WALLPAPER_DIR" ]; then
exit 1
fi
wallpaper_path=$(find "$WALLPAPER_DIR" -mindepth 1 | sort -R | tail -n 1)
wallpaper_path=$(find "$WALLPAPER_DIR" -mindepth 1 | grep png| sort -R | tail -n 1)
if [ -z "$wallpaper_path" ]; then
echo "Unable to find wallpaper"
@ -26,6 +26,13 @@ echo "setting $wallpaper_path as wallpaper"
hyprctl hyprpaper unload all
hyprctl hyprpaper preload "$wallpaper_path"
if command -v wal &> /dev/null; then
wal -i "$wallpaper_path"
fi
unlink "$WALLPAPER_DIR/current" || true
ln -s "$wallpaper_path" "$WALLPAPER_DIR/current"
for monitor in $(hyprctl monitors | grep 'Monitor' | awk '{ print $2 }'); do
hyprctl hyprpaper wallpaper "$monitor,$wallpaper_path"
done

View File

@ -8,10 +8,28 @@
"quiet"
"splash"
"rd.systemd.show_status=false"
"acpi_backlight=native"
"video=efifb:nobgrt"
"loglevel=3"
"rd.udev.log_level=3"
];
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.loader.systemd-boot = { enable = true; };
boot.loader.efi = { canTouchEfiVariables = true; };
boot.initrd.systemd.enable = true;
boot.plymouth = {
enable = true;
themePackages = with pkgs; [
catppuccin-plymouth
];
theme = "catppuccin-macchiato";
extraConfig = ''
UseFirmwareBackground=false
'';
};
# Networking stuff
networking.hostName = "magicman"; # Define your hostname.
networking.networkmanager.enable = true;
@ -27,9 +45,9 @@
hardware.opengl = {
enable = true;
extraPackages = with pkgs; [
# intel-media-driver
# vaapiVdpau
# libvdpau-va-gl
intel-media-driver
vaapiVdpau
libvdpau-va-gl
];
};
@ -45,6 +63,15 @@
portalPackage = pkgs.xdg-desktop-portal-hyprland;
};
# TRIM
services.fstrim.enable = true;
# TLP
services.tlp.enable = true;
# Brillo
hardware.brillo.enable = true;
# Setup common XDG env vars
environment.sessionVariables = rec {
XDG_CACHE_HOME = "$HOME/.cache";
@ -65,6 +92,8 @@
]);
};
programs.steam.enable = true;
# Enable flakes
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.settings.trusted-users = [ "root" "torjus" ];

View File

@ -5,29 +5,31 @@
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.initrd.kernelModules = [ "i915" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/31b20f4c-24bb-4fd1-9a3e-8ccc19fe3d64";
{
device = "/dev/disk/by-uuid/31b20f4c-24bb-4fd1-9a3e-8ccc19fe3d64";
fsType = "xfs";
};
boot.initrd.luks.devices."root".device = "/dev/disk/by-uuid/4bbadd2c-94dd-4d80-94bf-9332d24b57bd";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/7FF3-B061";
{
device = "/dev/disk/by-uuid/7FF3-B061";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/6f2c4906-ad88-4d7e-88ec-61cdda41ce28"; }
];
[{ device = "/dev/disk/by-uuid/6f2c4906-ad88-4d7e-88ec-61cdda41ce28"; }];
# 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

View File

@ -12,7 +12,7 @@
home = "/home/torjus";
description = "Torjus";
shell = pkgs.zsh;
extraGroups = [ "wheel" "input" "networkmanager" ];
extraGroups = [ "wheel" "input" "networkmanager" "video" ];
# Install some user packages
packages = with pkgs; [
];