nix/graphical/desktop/shell.nix
2026-04-08 11:51:33 +10:00

111 lines
2.6 KiB
Nix

{
pkgs,
lib,
inputs,
mainUser,
getPkgs,
config,
...
}:
let
inherit (lib) getExe;
shotta =
let
grim = lib.getExe pkgs.grim;
slurp = lib.getExe pkgs.slurp;
wl-copy = lib.getExe' pkgs.wl-clipboard-rs "wl-copy";
wl-paste = lib.getExe' pkgs.wl-clipboard-rs "wl-paste";
in
pkgs.writeScriptBin "shotta" ''
#! /usr/bin/env nu
let savePath = $"~/screenshots/(date now | format date "%Y-%m-%d-%H-%M-%S").png" | path expand
${grim} -g $"(${slurp})" -c - | ${wl-copy}
${wl-paste} o> $savePath
'';
ui = config.rice.roles config.rice.palette.hex;
in
{
environment.systemPackages = getPkgs {
inherit shotta;
inherit (pkgs.kdePackages) qtbase qtdeclarative;
inherit (pkgs) wl-clipboard quickshell;
};
imports = [
inputs.stasis.nixosModules.default
inputs.stash.nixosModules.default
];
services.stasis = {
enable = false;
extraConfig = ''
default:
dpms_off:
timeout 300
command "niri msg action power-off-monitors"
end
suspend:
timeout 600
command "systemctl suspend"
end
end
'';
};
services.stash-clipboard = {
enable = true;
excludedApps = [ "Bitwarden" ];
};
environment.files."/home/${mainUser}/.config/quickshell" = {
source = "/home/${mainUser}/.nix/graphical/desktop/quickshell";
uid = 1000;
gid = 100;
};
# generate Colours.qml from palette into the source tree via arbys
environment.files."/home/${mainUser}/.nix/graphical/desktop/quickshell/rice/Colours.qml" =
let
pal = config.rice.palette.hex;
in
{
source = pkgs.writeText "Colours.qml" ''
pragma Singleton
import Quickshell
Singleton {
property var c: {
"bg": "${ui.bg}",
"fg": "${ui.fg}",
"black": "${pal.normal.black}",
"black_b": "${pal.bright.black}",
"red": "${pal.normal.red}",
"red_b": "${pal.bright.red}",
"green": "${pal.normal.green}",
"green_b": "${pal.bright.green}",
"yellow": "${pal.normal.yellow}",
"yellow_b": "${pal.bright.yellow}",
"blue": "${pal.normal.blue}",
"blue_b": "${pal.bright.blue}",
"magenta": "${pal.normal.magenta}",
"magenta_b": "${pal.bright.magenta}",
"cyan": "${pal.normal.cyan}",
"cyan_b": "${pal.bright.cyan}",
"white": "${pal.normal.white}",
"white_b": "${pal.bright.white}",
}
}
'';
uid = 1000;
gid = 100;
};
}