Compare commits

..

No commits in common. "ecfbf9a5570ef56077b60118f8c733d03dad6c61" and "139bd596daad19e52cdc4523a14d646a1623c245" have entirely different histories.

14 changed files with 85 additions and 183 deletions

View File

@ -10,7 +10,7 @@ let
local = mkOption {
type = types.nonEmptyStr;
default = "$HOME/" + (concatStrings (builtins.match "/*(.+)" config.remote));
default = "$HOME/" + (lib.strings.concatStrings (builtins.match "/*(.+)" config.remote));
description = "local path to sync";
};
};

View File

@ -4,7 +4,7 @@ let
screen = with lib; types.submodule {
options = {
fps = mkOption {
type = types.either types.int (types.nonEmptyListOf types.int);
type = types.int;
default = 60;
description = "max framerate of screen";
};

View File

@ -15,12 +15,6 @@ let
description = "set of commands to be run at sway startup";
};
execAlways = mkOption {
type = types.listOf (types.either types.nonEmptyStr types.package);
default = [ ];
description = "set of commands to be run at sway reload";
};
extraConfig = mkOption {
type = types.str;
default = "";
@ -40,35 +34,6 @@ let
};
};
});
build_screen_def = fps_func: with lib; let
output_def = mapAttrsToList
(name: value:
"output ${value.id} mode ${value.mode}@${toString (fps_func value.fps)}Hz"
+ (optionalString (value.pos != null) " position ${value.pos}")
)
cfg.screens;
in
''
for pid in $(${pkgs.procps}/bin/pgrep sway -x)
do
uid=$(id -u $(${pkgs.procps}/bin/ps -o user= -p $pid))
export SWAYSOCK="/run/user/$uid/sway-ipc.$uid.$pid.sock"
if [[ -e "$SWAYSOCK" ]] ; then
echo "sock is $SWAYSOCK"
${config.programs.sway.package}/bin/swaymsg '${concatMapStrings (s: s + " ; ") output_def}'
fi
done
'';
inherit (lib) getExe;
fps_min = fps: with lib; if isInt fps then fps else (foldl' min 2147483647 fps);
fps_max = fps: with lib; if isInt fps then fps else (foldl' max 0 fps);
init_screens_min_fps = with lib; pkgs.writeShellScriptBin "init-screens-min"
(build_screen_def fps_min);
init_screens_max_fps = with lib; pkgs.writeShellScriptBin "init-screens-max"
(build_screen_def fps_max);
init_screens_auto = pkgs.writeShellScriptBin "init-screens-auto" "which run-on-ac && which run-on-bat && run-on-ac ${getExe init_screens_max_fps} && run-on-bat ${getExe init_screens_min_fps} || ${getExe init_screens_max_fps}";
in
{
config =
@ -81,7 +46,7 @@ in
bar_config = ''
bar {
swaybar_command ${getExe waybar_full}
swaybar_command ${lib.getExe waybar_full}
}
'';
@ -95,16 +60,15 @@ in
let
build_definition_lines = mapAttrsToList (name: value: "set \$${name} ${value}");
build_keybind_lines = mapAttrsToList (key: value: "bindsym ${key} ${value}");
build_exec_lines = e: map (item: "${e} " + (if isString item then item else (getExe item)));
build_exec_lines = map (item: "exec " + (if isString item then item else (getExe item)));
build_mode_lines = mapAttrsToList (name: value: ''
mode "${name}" {
${concatLines (map (item: " " + item ) (build_conf value))}}'');
${strings.concatLines (map (item: " " + item ) (build_conf value))}}'');
in
([ ]
++ (build_definition_lines sway_conf.definitions)
++ (build_keybind_lines sway_conf.keybinds)
++ (build_exec_lines "exec" sway_conf.autolaunch)
++ (build_exec_lines "exec_always" sway_conf.execAlways)
++ (build_exec_lines sway_conf.autolaunch)
++ (build_mode_lines sway_conf.modes)
++ optional (sway_conf.extraConfig != "") sway_conf.extraConfig
);
@ -114,7 +78,7 @@ in
++ lib.optional cfg.sway.bar.enable bar_config
++ (lib.mapAttrsToList
(name: value:
"output ${value.id} mode ${value.mode}"
"output ${value.id} mode ${value.mode}@${toString value.fps}Hz"
+ (lib.optionalString (value.pos != null) " position ${value.pos}")
)
cfg.screens)
@ -125,17 +89,11 @@ in
with cfg; lib.mkIf (enable && sway.enable) {
environment.etc."${conf_path}".text = sway_conf;
grimmShared.sway.config.execAlways = [
dbus-sway-environment
init_screens_auto
];
grimmShared.sway.config.autolaunch = lib.singleton dbus-sway-environment;
environment.systemPackages = [
waybar_full
dbus-sway-environment
init_screens_min_fps
init_screens_max_fps
init_screens_auto
] ++ (with pkgs; [
procps
slurp

View File

@ -11,8 +11,6 @@ in
usbutils
opentabletdriver
ddcutil
python312Packages.py-cpuinfo
(writeShellScriptBin "lsiommu" ./lsiommu)
] ++ lib.optionals graphical [
ddcui
];
@ -46,15 +44,14 @@ in
boot = {
kernelParams = [
# "splash"
# "quiet"
# "intel_iommu=on"
# "iommu=force"
# "pcie_acs_override=downstream"
# "mmio_stale_data=full,nosmt"
# "pcie_aspm=off"
"splash"
"quiet"
"intel_iommu=on"
"iommu=force"
"pcie_acs_override=downstream"
"mmio_stale_data=full,nosmt"
"pcie_aspm=off"
]; # "vfio-pci.ids=10de:1aeb,10de:2191,10de:1aed,10de:1aec" ];
loader.efi.canTouchEfiVariables = true;
initrd.availableKernelModules = [
"xhci_pci"
"ahci"
@ -76,10 +73,10 @@ in
}))
];
kernelModules = [
# "kvm-intel"
# "vfio_pci"
# "vfio_iommu_type1"
# "vfio"
"kvm-intel"
"vfio_pci"
"vfio_iommu_type1"
"vfio"
"ddcci_backlight"
"i2c-dev"
];

View File

@ -1,57 +1,23 @@
{ pkgs, config, lib, system, ... }:
let
cfg = config.grimmShared;
inherit (lib) optionals optional optionalString concatLines getExe;
inherit (config.boot.kernelPackages) x86_energy_perf_policy cpupower;
enable_perf_policy = (lib.elem system x86_energy_perf_policy.meta.platforms);
powersave = with pkgs; writeShellScriptBin "powersave-mode" (concatLines ([
"${getExe cpupower} frequency-set -g powersave -u 2000000" # clock speed
"${getExe pkgs.brightnessctl} s 20%" # display brightness
] ++ optionals enable_perf_policy [
"${getExe x86_energy_perf_policy} 15" # power save preference
"${getExe x86_energy_perf_policy} --turbo-enable 0" # disable turbo
] ++ optional cfg.sway.enable "init-screens-min"));
performance = pkgs.writeShellScriptBin "performance-mode" (concatLines ([
"${getExe cpupower} frequency-set frequency-set -g performance -u 5000000" # clock speed
"${getExe pkgs.brightnessctl} s 100%" # display brightness
] ++ optionals enable_perf_policy [
"${getExe x86_energy_perf_policy} 0" # performance preference
"${getExe x86_energy_perf_policy} --turbo-enable 1" # enable turbo
] ++ optional cfg.sway.enable "init-screens-max"));
auto = let inherit (pkgs) tlp; in pkgs.writeShellScriptBin "auto-mode" ''
${tlp}/bin/run-on-ac ${getExe performance}
${tlp}/bin/run-on-bat ${getExe powersave}
'';
perf_policy = lib.optional (lib.systems.elaborate system).isx86 config.boot.kernelPackages.x86_energy_perf_policy;
in
{
config = with cfg; lib.mkIf (enable && laptop_hardware.enable) {
environment.systemPackages = with pkgs; [
acpi
powertop
brightnessctl
cpupower
powersave
performance
auto
] ++ optionals graphical [
] ++ lib.optionals graphical [
tlpui
] ++ optional enable_perf_policy x86_energy_perf_policy;
services.acpid = {
enable = true;
acEventCommands = getExe auto;
};
] ++ perf_policy;
powerManagement.scsiLinkPolicy = lib.mkIf (!config.services.tlp.enable) "min_power";
powerManagement.cpuFreqGovernor = lib.mkDefault "normal";
services.power-profiles-daemon.enable = false;
services.upower.enable = true;
#boot.extraModulePackages = [
# cpupower
#] ++ optional enable_perf_policy x86_energy_perf_policy;
boot.extraModulePackages = perf_policy;
services.tlp = {
enable = true;

View File

@ -13,6 +13,7 @@ in
config = with cfg; lib.mkIf (enable && tooling.enable) {
environment.systemPackages = with pkgs; [
(writeShellScriptBin "systemd-owner" "systemctl show -pUser,UID $@")
(writeShellScriptBin "lsiommu" ./lsiommu)
(writeShellScriptBin "tree" "${lib.getExe pkgs.eza} -T --git -lh --no-permissions --no-user --no-filesize --no-time")
urlencode
pstree
@ -29,7 +30,7 @@ in
fbcat
gomuks
btop
gotop
ranger
wget
file

View File

@ -36,7 +36,7 @@ in
{
config = with cfg; lib.mkIf (enable && portals && graphical) {
environment.systemPackages = with pkgs; [
(callPackage ../../custom/deskwhich/package.nix { })
(callPackage ../../custom/deskwhich/package.nix {})
zathura
imhex
@ -99,7 +99,7 @@ in
"ranger.desktop"
"dolphin.desktop"
];
"x-scheme-handler/mailto" = "thunderbird.desktop";
"x-scheme-handler/mailto"="thunderbird.desktop";
"application/vnd.oasis.opendocument.chart" = "calc.desktop";
"application/vnd.oasis.opendocument.chart-template" = "calc.desktop";

View File

@ -17,12 +17,12 @@ in
];
wlr.enable = true;
wlr.settings = with lib; mapAttrs'
(name: value: nameValuePair ("screencast_" + name) {
wlr.settings = lib.mapAttrs'
(name: value: lib.nameValuePair ("screencast_" + name) {
output_name = value.id;
max_fps = if isInt value.fps then value.fps else (foldl' min 2147483647 value.fps);
max_fps = value.fps;
chooser_type = "simple";
chooser_cmd = "${getExe pkgs.slurp} -f %o -or";
chooser_cmd = "${lib.getExe pkgs.slurp} -f %o -or";
})
cfg.screens;
};

View File

@ -78,11 +78,11 @@
"yafas": "yafas"
},
"locked": {
"lastModified": 1714566321,
"narHash": "sha256-cTWwPbwYtE8r6MuR+0ybG4CFeE8Sid5XHbFJq4itO+A=",
"lastModified": 1714482312,
"narHash": "sha256-qs41DgEGR2d6Hh+FnfL/6NagoCtRXDXC7yaGD398EXE=",
"owner": "chaotic-cx",
"repo": "nyx",
"rev": "5939d3fb76b25a48a8c0db716ebb6fe28eab3719",
"rev": "8cfa2aa1528faa6319e2e5ab664ff463ba57708c",
"type": "github"
},
"original": {
@ -186,7 +186,7 @@
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/ipetkov/crane/%3D0.16.1.tar.gz"
"url": "https://flakehub.com/f/ipetkov/crane/%2A.tar.gz"
}
},
"darwin": {
@ -220,12 +220,12 @@
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1714544767,
"narHash": "sha256-kF1bX+YFMedf1g0PAJYwGUkzh22JmULtj8Rm4IXAQKs=",
"rev": "73124e1356bde9411b163d636b39fe4804b7ca45",
"revCount": 1852,
"lastModified": 1711952616,
"narHash": "sha256-WJvDdOph001fA1Ap3AyaQtz/afJAe7meSG5uJAdSE+A=",
"rev": "209048d7c545905c470f6f8c05c5061f391031a8",
"revCount": 1822,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/nix-community/fenix/0.1.1852%2Brev-73124e1356bde9411b163d636b39fe4804b7ca45/018f333a-c195-795f-9e07-b43b47d5391f/source.tar.gz"
"url": "https://api.flakehub.com/f/pinned/nix-community/fenix/0.1.1822%2Brev-209048d7c545905c470f6f8c05c5061f391031a8/018e98ba-d842-7dad-9d6a-0d0ee173b6b1/source.tar.gz"
},
"original": {
"type": "tarball",
@ -382,11 +382,11 @@
]
},
"locked": {
"lastModified": 1714515075,
"narHash": "sha256-azMK7aWH0eUc3IqU4Fg5rwZdB9WZBvimOGG3piqvtsY=",
"lastModified": 1714430505,
"narHash": "sha256-SSJQ/KOy8uISnoZgqDoRha7g7PFLSFP/BtMWm0wUz8Q=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "6d3b6dc9222c12b951169becdf4b0592ee9576ef",
"rev": "f8e6694edabe4aaa7a85aac47b43ea5d978b116d",
"type": "github"
},
"original": {
@ -430,11 +430,11 @@
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1714532637,
"narHash": "sha256-2oWMEjkJKYzxLXy3OZ/M41VdbZgZLWmwttry551lUE4=",
"lastModified": 1714411325,
"narHash": "sha256-td58oD5JOlL8LPglrk+c7rP+nJSJmK7zu0kFGF16XPI=",
"owner": "martinvonz",
"repo": "jj",
"rev": "7093d5d359fb3649be0d12a975f26d5607ad8f61",
"rev": "e54e83b0f5c4a5b7d80894c713ae402a5bb280d0",
"type": "github"
},
"original": {
@ -467,11 +467,11 @@
]
},
"locked": {
"lastModified": 1714551038,
"narHash": "sha256-/b4HT/RYfNkKUUpIzIwsHThLLAuKA70O8W/32sh2N0M=",
"lastModified": 1714468768,
"narHash": "sha256-lxbNfjtTOcY18E9ODj3ZwJiF8UWr58CH+/9V3eHdtoQ=",
"owner": "YaLTeR",
"repo": "niri",
"rev": "af9caa1d9b176fe3606323a8c05c0c741c1f6c0a",
"rev": "68ff36f6834beecf74b30a724ae3ef31874a3518",
"type": "github"
},
"original": {
@ -657,11 +657,11 @@
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1714501997,
"narHash": "sha256-g31zfxwUFzkPgX0Q8sZLcrqGmOxwjEZ/iqJjNx4fEGo=",
"lastModified": 1711885694,
"narHash": "sha256-dyezzeSbWMpflma+E9USmvSxuLgGcNGcGw3cOnX36ko=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "49e502b277a8126a9ad10c802d1aaa3ef1a280ef",
"rev": "e4a405f877efd820bef9c0e77a02494e47c17512",
"type": "github"
},
"original": {

View File

@ -42,10 +42,6 @@
url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/307541.patch";
hash = "sha256-cyxiWCxBOKrET710C8o9Cwksy64HRez6mB1qF+anHMI=";
}
{
url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/308476.patch";
hash = "sha256-J/Bvz4RUn9lP7H4s/c6bZEX9dfWsxfG/dpXYF99U3Vs=";
}
];
customNixosSystem = system: definitions:

View File

@ -8,6 +8,10 @@
networking.hostName = "grimmauld-nixos";
environment.sessionVariables = {
OMP_NUM_THREADS = "12";
};
system.stateVersion = "23.05";
grimmShared.gaming = true;

View File

@ -2,9 +2,7 @@
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
let
cpus = "12";
in
{
imports =
[
@ -14,7 +12,6 @@ in
boot.initrd.kernelModules = [ ];
boot.extraModulePackages = [ ];
boot.kernelParams = [ "possible_cpus=${cpus}" ];
fileSystems."/" =
{
@ -35,20 +32,16 @@ in
size = 48 * 1024;
}];
environment.sessionVariables = {
OMP_NUM_THREADS = cpus;
};
grimmShared = {
screens = {
external = {
id = "HDMI-A-1";
pos = "0 0";
pos = "0,0";
};
internal = {
id = "eDP-1";
fps = [ 144 60 ];
fps = 144;
};
};
laptop_hardware.enable = true;

View File

@ -1,12 +1,12 @@
{ inputs, system, pkgs, config, lib, ... }:
let
{ inputs, system, pkgs, config, lib, ... }:
let
searchclip = pkgs.writeShellScriptBin "searchclip" ''
xdg-open https://www.google.com/search?q=$(wl-paste -p | urlencode)
browser=$(xdg-settings get default-web-browser | sed "s/\.desktop//")
swaymsg [app_id="$browser" urgent="newest"] focus
'';
xdg-open https://www.google.com/search?q=$(wl-paste -p | urlencode)
browser=$(xdg-settings get default-web-browser | sed "s/\.desktop//")
swaymsg [app_id="$browser" urgent="newest"] focus
'';
in
{
{
environment.systemPackages = with pkgs; [
alacritty
rmenu
@ -18,7 +18,6 @@ in
qt6ct
swaynotificationcenter
searchclip
ydotool
];
grimmShared.sway = {
@ -30,10 +29,9 @@ in
style = ./bar/style.css;
};
config = with pkgs; let
config = with pkgs; let
inherit (lib) getExe;
in
{
in {
definitions = {
mod = "Mod4";
left = "h";
@ -154,34 +152,23 @@ in
XF86MonBrightnessDown = "exec ${getExe brightnessctl} s 10-%";
XF86Explorer = "exec $term --command ${getExe ranger}";
XF86Search = "exec ${getExe searchclip}";
XF86HomePage =
let
open = pkgs.writeShellScriptBin "open_or_switch_browser" ''
browser=$(xdg-settings get default-web-browser | sed "s/\.desktop//")
swaymsg [app_id="$browser"] focus || deskwhich $browser | xargs gio launch
'';
in
"exec ${getExe open}";
XF86Tools =
let
open = pkgs.writeShellScriptBin "open_or_switch_spotify" ''
# FIXME: spotify is being weird
while IFS= read -r pid; do
swaymsg [pid=$pid] focus && exit 0
done <<< $(pgrep spotify -u "$(whoami)")
deskwhich spotify | xargs gio launch
'';
in
"exec ${getExe open}"; # for some reason tools = audio media on my keyboard??
XF86Mail =
let
open = pkgs.writeShellScriptBin "open_or_switch_mail" ''
desk=$(xdg-settings get default-url-scheme-handler mailto | sed "s/\.desktop//")
swaymsg [app_id="$desk"] focus || deskwhich $desk | xargs gio launch
'';
in
"exec ${getExe open}";
# XF86Bluetooth = "exec blueman-manager";
XF86HomePage = let open = pkgs.writeShellScriptBin "open_or_switch_browser" ''
browser=$(xdg-settings get default-web-browser | sed "s/\.desktop//")
swaymsg [app_id="$browser"] focus || deskwhich $browser | xargs gio launch
''; in "exec ${getExe open}";
XF86Tools = let open = pkgs.writeShellScriptBin "open_or_switch_spotify" ''
# FIXME: spotify is being weird
while IFS= read -r pid; do
swaymsg [pid=$pid] focus && exit 0
done <<< $(pgrep spotify -u "$(whoami)")
deskwhich spotify | xargs gio launch
''; in "exec ${getExe open}"; # for some reason tools = audio media on my keyboard??
XF86Mail = let open = pkgs.writeShellScriptBin "open_or_switch_mail" ''
desk=$(xdg-settings get default-url-scheme-handler mailto | sed "s/\.desktop//")
swaymsg [app_id="$desk"] focus || deskwhich $desk | xargs gio launch
'';
in "exec ${getExe open}";
};
autolaunch = with pkgs; [
# fixme: absolute paths