From 971ab02a11e029f42048878911993d72e2d00b4c Mon Sep 17 00:00:00 2001 From: Sky Hearn Date: Tue, 27 Feb 2024 04:51:16 +0000 Subject: [PATCH] Nixos stuff! --- .gitignore | 3 ++ .gitmodules | 3 ++ configuration.nix | 89 ++++++++++++++++++++++++++++++++++++++++------- rebuild | 32 +++++++++++++++++ slstatus | 1 + 5 files changed, 116 insertions(+), 12 deletions(-) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100755 rebuild create mode 160000 slstatus diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..166ce9c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +result +nixos-switch.log +hardware_configuration.nix diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..a32a18c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "slstatus"] + path = slstatus + url = git://git.suckless.org/slstatus diff --git a/configuration.nix b/configuration.nix index 5314a03..fbc1bcf 100644 --- a/configuration.nix +++ b/configuration.nix @@ -8,19 +8,35 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + ]; - + # Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; + # amdgpu stuffs + boot.initrd.kernelModules = [ "amdgpu" ]; + services.xserver.videoDrivers = [ "amdgpu" ]; + + # opengl support + hardware.opengl.enable = true; + # opengl packages + hardware.opengl.extraPackages = with pkgs; [ + rocm-opencl-icd + rocm-opencl-runtime + vaapiVdpau + libvdpau-va-gl + ]; + hardware.opengl.driSupport = true; + networking.hostName = "sky-laptop"; # Define your hostname. # Pick only one of the below networking options. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. # Set your time zone. - time.timeZone = "US/SanFrancisco"; + time.timeZone = "America/Los_Angeles"; # Configure network proxy if necessary # networking.proxy.default = "http://user:password@proxy:port/"; @@ -54,26 +70,63 @@ # Enable dwm services.xserver.windowManager.dwm.enable = true; + - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.sky = { - isNormalUser = true; - extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. - packages = with pkgs; [ - firefox + # Sky User + users.users.sky.isNormalUser = true; + users.users.sky.extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + + # Home Manager for Sky + home-manager.users.sky = {pkgs, ...}: { + + home.packages = with pkgs; [ + firefox-bin + neofetch + ncpamixer tree - git + neovim + xclip + grpc + clipcat keepassxc + jellyfin-media-player ]; - }; + + services.picom = { + enable = true; + vSync = true; + backend = "glx"; + }; + programs.git = { + enable = true; + userName = "Sky Hearn"; + userEmail = "sky.hearn@pm.me"; + signing = { + key = "DAB485883AE426EC"; + signByDefault = true; + }; + }; + home.stateVersion = "23.11"; + }; # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ + pulseaudio + bash vim wget + acpi st dmenu + (let local_slstatus = pkgs.slstatus.overrideAttrs (_: { + src = ./slstatus; + }); in + (local_slstatus.override { + conf = ./slstatus/config.def.h; + }) + ) + libva-utils ]; # Some programs need SUID wrappers, can be configured further or are @@ -84,8 +137,21 @@ enableSSHSupport = true; }; - # List services that you want to enable: + # clipcat systemd service + systemd.services.clipcat = { + partOf = [ "graphical-session.target" ]; + wantedBy = [ "graphical-session.target" ]; + description = "Clipcat Daemon"; + serviceConfig = { + ExecStart = ''/usr/bin/clipcatd --no-daemon --replace''; # TODO: find where to actually run clipcatd + Restart = "on-failure"; + Type = "simple"; + }; + }; + + # List services that you want to enable: + # Enable the OpenSSH daemon. services.openssh.enable = true; @@ -119,4 +185,3 @@ system.stateVersion = "23.11"; # Did you read the comment? } - diff --git a/rebuild b/rebuild new file mode 100755 index 0000000..e5fe2a6 --- /dev/null +++ b/rebuild @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# A rebuild script that commits on a successful build +set -e + +# cd to your config dir +pushd ~/nixos/ + +# Edit your config +nvim configuration.nix + +# Autoformat your nix files +# alejandra . &>/dev/null + +# Shows your changes +git diff -U0 *.nix + +echo "NixOS Rebuilding..." + +# Rebuild, output simplified errors, log trackebacks +sudo nixos-rebuild switch &>nixos-switch.log || (cat nixos-switch.log | grep --color error && false) + +# Get current generation metadata +current=$(nixos-rebuild list-generations | grep current) + +# Commit all changes witih the generation metadata +git commit -am "$current" + +# Back to where you were +popd + +# Notify all OK! +notify-send -e "NixOS Rebuilt OK!" --icon=software-update-available diff --git a/slstatus b/slstatus new file mode 160000 index 0000000..3f2d2b2 --- /dev/null +++ b/slstatus @@ -0,0 +1 @@ +Subproject commit 3f2d2b2dc1f8326805fe3276f2a893bf5a58c8da