Compare commits

..

7 Commits

14 changed files with 99 additions and 31 deletions

View File

@@ -46,11 +46,14 @@
mySystem = {
boot = {
plymouth.enable = true;
kernel = {
cpuVendor = "amd";
v4l2loopback.enable = true;
extraModprobeConfig = ''
options snd_usb_audio vid=0x1235 pid=0x8212 device_setup=1
'';
plymouth.enable = true;
kernel.cpuVendor = "amd";
};
systemd-boot = true;
};
desktop = {
@@ -103,13 +106,13 @@
programs.steam.enable = true;
services = {
fwupd.enable = true;
languagetool.enable = true;
printing.enable = true;
ssh.enable = true;
sunshine = {
enable = true;
autostart = true;
};
languagetool.enable = true;
};
users = {
root.disablePassword = true;

View File

@@ -8,13 +8,6 @@ with lib; let
cfg = config.mySystem.boot;
in {
options.mySystem.boot = {
extraModprobeConfig = mkOption {
type = types.lines;
default = "";
example = ''
options snd_usb_audio vid=0x1235 pid=0x8212 device_setup=1
'';
};
kernel = {
package = mkOption {
type = types.raw;
@@ -29,12 +22,15 @@ in {
type = types.enum ["intel" "amd"];
default = "amd";
};
v4l2loopback = mkOption {
description = "Enables v4l2loopback";
type = types.bool;
default = true;
};
v4l2loopback.enable = mkEnableOption "Enables v4l2loopback kernel module";
hardened = mkEnableOption "Enables hardened Linux kernel";
extraModprobeConfig = mkOption {
type = types.lines;
default = "";
example = ''
options snd_usb_audio vid=0x1235 pid=0x8212 device_setup=1
'';
};
};
systemd-boot = mkOption {
type = types.bool;
@@ -64,6 +60,10 @@ in {
then "amdgpu"
else "i915"
);
extraModulePackages = lists.optional cfg.kernel.v4l2loopback.enable config.boot.kernelPackages.v4l2loopback;
extraModulePackages =
strings.concatLines (strings.optionalString cfg.kernel.v4l2loopback.enable "options v4l2loopback exclusive_caps=1 devices=1 video_nr=0 card_label=" "OBS Studio" "")
cfg.kernel.extraModprobeConfig;
loader = {
systemd-boot.enable = cfg.systemd-boot;
efi.canTouchEfiVariables = cfg.systemd-boot;
@@ -80,7 +80,6 @@ in {
kernelModules =
cfg.kernel.modules
++ ["kvm-${cfg.kernel.cpuVendor}"]
++ lists.optional cfg.kernel.v4l2loopback "v4l2loopback"
++ lists.optional cfg.kernel.hardened "tcp_bbr";
kernel.sysctl = mkIf cfg.kernel.hardened {
"kernel.sysrq" = 0; # Disable magic SysRq key

View File

@@ -1,10 +1,22 @@
{pkgs, ...}: {
{
pkgs,
config,
...
}:
let
inherit (config.home) gpuType;
in
{
programs.btop = {
enable = true;
package = pkgs.btop.override {
rocmSupport = true;
cudaSupport = true;
};
package =
if gpuType != null then
pkgs.btop.override {
rocmSupport = gpuType == "amd";
cudaSupport = gpuType == "nvidia";
}
else
pkgs.btop;
settings = {
color_theme = "${pkgs.btop}/share/btop/themes/nord.theme";
cpu_bottom = false;

View File

@@ -1,3 +1,3 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "mp42webm" ''
${pkgs.ffmpeg}/bin/ffmpeg -i "$1" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "$1".webm''
${pkgs.ffmpeg}/bin/ffmpeg -i "$1" -c:v libvpx -crf 10 -b:v 1M -c:a -hwaccel=auto libvorbis "$1".webm''

View File

@@ -1,16 +1,40 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "plock" ''
LOG_FILE="$HOME/.local/share/plock.log"
logger() {
local level="$1"
local message="$2"
local timestamp
timestamp=$(date +"%Y-%m-%d %H:%M:%S")
printf "[%s] [%-7s] %s\n" "$timestamp" "''${level^^}" "$message" >> "$LOG_FILE"
}
CAELESTIA_ACTIVE=$(systemctl --user is-active caelestia.service)
logger debug "Caelestia activity: $CAELESTIA_ACTIVE"
if systemctl --user is-active caelestia.service | grep 'active' &> /dev/null ; then
logger info "locking Caelestia session"
caelestia shell lock lock || \
logger error "failed to lock Caelestia session"
exit 0
fi
TMPBG="/tmp/screen.png"
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
logger info "wayland session detected"
SCREENER=${pkgs.grim}/bin/grim
LOCKER="${pkgs.swaylock}/bin/swaylock -feF"
else
logger info "x11 session detected"
SCREENER=${pkgs.scrot}/bin/scrot
LOCKER="${pkgs.i3lock}/bin/i3lock -ef"
fi
$SCREENER "$TMPBG"
${pkgs.corrupter}/bin/corrupter -add 0 "$TMPBG" "$TMPBG"
logger info "generating lock screen image"
${pkgs.corrupter}/bin/corrupter -add 0 "$TMPBG" "$TMPBG" || logger error "failed to generate lock screen image"
logger info "locking screen"
logger debug "locking screen with command `''${SCREENER}`"
$LOCKER -ti "$TMPBG"
rm "$TMPBG"
''

View File

@@ -17,7 +17,14 @@ in {
./shell
];
options.home.fullDesktop = mkEnableOption "Enable most modules";
options.home = {
fullDesktop = mkEnableOption "Enable most modules";
gpuType = mkOption {
type = types.nullOr (types.enum ["nvidia" "amd" "intel"]);
default = null;
example = "amd";
};
};
config.home = {
cli.fullDesktop = mkDefault cfg.fullDesktop;
desktop.fullDesktop = mkDefault cfg.fullDesktop;

View File

@@ -52,6 +52,7 @@ in {
wallpapers = true;
};
};
osd.enableMicrophone = true;
bar = {
status = {
showAudio = true;
@@ -59,7 +60,9 @@ in {
};
tray.compact = true;
};
services.gpuType = "amd";
services = mkIf (config.home.gpuType != null) {
inherit (config.home) gpuType;
};
session.commands = {
logout = ["uwsm" "stop"];
shutdown = ["systemctl" "poweroff"];

View File

@@ -172,6 +172,8 @@ in {
bind = SUPER_SHIFT, minus, movetoworkspace, 8
bind = SUPER_SHIFT, slash, movetoworkspace, 9
bind = SUPER_SHIFT, asterisk, movetoworkspace, 10
env = XCURSOR_SIZE,12
'';
};
};

View File

@@ -8,15 +8,15 @@ with lib; let
cfg = config.home.dev.ai;
in {
imports = [
./ollama.nix
./claude.nix
./ollama.nix
];
options.home.dev.ai.enable = mkEnableOption "Enables AI features";
config.home = mkIf cfg.enable {
dev.ai = {
ollama.enable = mkDefault cfg.enable;
claude.enable = mkDefault cfg.enable;
ollama.enable = mkDefault cfg.enable;
};
packages = [pkgs.lmstudio];
};

View File

@@ -15,7 +15,7 @@ in {
force-seekable = true; # force streams to be seekable
slang = "jpn,jp,eng,en,fra,fr";
alang = "eng,en,fra,fr";
gpu-api = "vulkan";
gpu-api = "auto";
osc = true;
profile = "gpu-hq";
# geometry = "50%x50%";

View File

@@ -63,7 +63,13 @@
LSP_USE_PLISTS = "true";
OPENAI_API_URL = "http://localhost:1234/";
};
desktop.caelestia.enable = true;
desktop = {
caelestia.enable = true;
spotify = {
enable = true;
spicetify.enable = false;
};
};
dev = {
ai.claude.enable = true;
editors.emacs.package = emacsPackage;

View File

@@ -5,4 +5,5 @@
desktop.hyprland.host = "gampo";
phundrak.sshKey.content = builtins.readFile ../keys/id_gampo.pub;
};
programs.caelestia.settings.bar.persistent = false;
}

View File

@@ -1,6 +1,7 @@
{config, ...}: {
imports = [../home.nix];
home = {
gpuType = "amd";
cli.nh.flake = "${config.home.homeDirectory}/.dotfiles";
dev.ai = {
enable = true;
@@ -9,4 +10,8 @@
desktop.hyprland.host = "marpa";
phundrak.sshKey.content = builtins.readFile ../keys/id_marpa.pub;
};
programs.caelestia.settings.bar = {
showBattery = false;
showWifi = false;
};
}

View File

@@ -26,6 +26,7 @@
fullscreen = import ./fullscreen.nix {inherit pkgs;};
logout = import ./logout.nix {inherit pkgs;};
ytplay = import ../../modules/cli/scripts/ytplay.nix {inherit pkgs;};
plock = import ../../modules/cli/scripts/plock.nix {inherit pkgs;};
in [
{
key = "a";
@@ -165,6 +166,11 @@
}
];
}
{
key = "l";
desc = "Lock session";
cmd = "${plock}/bin/plock";
}
{
key = "p";
desc = "Power";