From 2a85c2668063634a33b9bebf2bbf38d4672ab657 Mon Sep 17 00:00:00 2001 From: LordGrimmauld Date: Sat, 20 Apr 2024 19:50:23 +0200 Subject: [PATCH] power weaking --- common/firefox.nix | 1 + common/laptop_hardware.nix | 6 +- common/sound.nix | 2 - common/spotifyd.nix | 4 +- common/sway.nix | 28 ++++++-- common/toolchains.nix | 3 + flake.lock | 127 +++++++++++++++++++++++++++++-------- flake.nix | 7 +- 8 files changed, 139 insertions(+), 39 deletions(-) diff --git a/common/firefox.nix b/common/firefox.nix index 0f68bf0..06644cd 100644 --- a/common/firefox.nix +++ b/common/firefox.nix @@ -50,6 +50,7 @@ in DontCheckDefaultBrowser = true; Preferences = lib.mkMerge ([{ "pdfjs.enableScripting" = false; + "media.hardware-video-decoding.enabled" = true; }] ++ lib.optional cfg.sway.enable { "browser.tabs.inTitlebar" = 0; } ); diff --git a/common/laptop_hardware.nix b/common/laptop_hardware.nix index 03dcdb2..d6822b0 100644 --- a/common/laptop_hardware.nix +++ b/common/laptop_hardware.nix @@ -5,13 +5,13 @@ in { config = with cfg; lib.mkIf (enable && laptop_hardware.enable) { environment.systemPackages = with pkgs; [ - upower acpi lm_sensors lshw pciutils usbutils powertop + # tlpui ]; services.ddccontrol.enable = true; @@ -32,6 +32,10 @@ in }; services.power-profiles-daemon.enable = false; + powerManagement.powertop.enable = true; + + services.upower.enable = true; + services.tlp = { enable = true; settings = { diff --git a/common/sound.nix b/common/sound.nix index 5e10670..e4d9719 100644 --- a/common/sound.nix +++ b/common/sound.nix @@ -14,14 +14,12 @@ in pulse.enable = true; jack.enable = true; # osu uses jack lowLatency.enable = true; - systemWide = true; # required for spotifyd as spotifyd runs as the spotifyd user }; environment.systemPackages = with pkgs; [ pwvucontrol playerctl openal - flite pulseaudio ]; }; diff --git a/common/spotifyd.nix b/common/spotifyd.nix index 537f34c..f95be45 100644 --- a/common/spotifyd.nix +++ b/common/spotifyd.nix @@ -39,6 +39,8 @@ in ''; }; + services.pipewire.systemWide = true; # required for spotifyd as spotifyd runs as the spotifyd user + # spotifyd config services.spotifyd = { enable = true; @@ -73,7 +75,7 @@ in }; # spotifyd is also a group - users.groups = { spotifyd = { }; }; + users.groups.spotifyd = { }; }; options.grimmShared.spotify.spotifyd = with lib; { diff --git a/common/sway.nix b/common/sway.nix index 9b8368c..5e5882a 100644 --- a/common/sway.nix +++ b/common/sway.nix @@ -67,7 +67,7 @@ in ++ optional (sway_conf.extraConfig != "") sway_conf.extraConfig ); - text = lib.concatLines ( + sway_conf = lib.concatLines ( (build_conf cfg.sway.config) ++ lib.optional cfg.sway.bar.enable bar_config ++ (lib.mapAttrsToList @@ -78,12 +78,24 @@ in cfg.screens) ); - sway_conf = pkgs.writeText "sway.conf" text; + conf_path = "sway.conf"; + + # sway_conf = pkgs.writeText "sway.conf" text; in with cfg; lib.mkIf (enable && sway.enable) { - environment.etc."sway.conf" = { - source = sway_conf; - }; + nixpkgs.overlays = [ + (final: prev: { + wlroots = prev.wlroots.overrideAttrs (o: { + patches = (o.patches or [ ]) ++ [ + ./patches/lessflicker.patch + # ./patches/screenshare.patch + ]; + }); + }) + ]; + + + environment.etc."${conf_path}".text = sway_conf; environment.systemPackages = [ waybar_full @@ -109,13 +121,14 @@ in fi done ''; - reloadTriggers = [ text ]; + reloadTriggers = [ config.environment.etc."${conf_path}".source ]; }; programs.waybar.enable = true; programs.sway = { enable = true; + wrapperFeatures = { gtk = true; base = true; @@ -127,13 +140,14 @@ in wl-clipboard wf-recorder dmenu + # wlroots_0_16 wmenu waybar-mpris ]; extraOptions = [ "--unsupported-gpu" "--config" - "/etc/sway.conf" + "/etc/${conf_path}" ]; extraSessionCommands = '' export XDG_CURRENT_DESKTOP=sway diff --git a/common/toolchains.nix b/common/toolchains.nix index f02a4f2..3921306 100644 --- a/common/toolchains.nix +++ b/common/toolchains.nix @@ -8,6 +8,8 @@ in (writeShellScriptBin "silent-add" "git add --intent-to-add $@ ; git update-index --assume-unchanged $@") (writeShellScriptBin "systemd-owner" "systemctl show -pUser,UID $@") (writeShellScriptBin "nix-referrers" "nix-store --query --referrers $@") + (writeShellScriptBin "nixpkgs-review-head" "nixpkgs-review rev HEAD") + nixpkgs-review nixpkgs-fmt gcc jdk17 @@ -38,6 +40,7 @@ in glib glibc # inputs.nix-locate.packages."${system}".default + inputs.hammering.packages."${system}".default nix-output-monitor expect ] ++ lib.optionals cfg.graphical [ diff --git a/flake.lock b/flake.lock index c9c1cf9..9ef67fc 100644 --- a/flake.lock +++ b/flake.lock @@ -78,11 +78,11 @@ "yafas": "yafas" }, "locked": { - "lastModified": 1713389985, - "narHash": "sha256-yq7LxfTHqp8cOEVWj0PbNC2AJMz6UPsPzqOjbBIcATg=", + "lastModified": 1713554347, + "narHash": "sha256-Li6DK5JqKesOhTBwSoqxWzOxUR0pcPxE/L7vVyEsZpM=", "owner": "chaotic-cx", "repo": "nyx", - "rev": "86b0f39a5f88964f72c9086927db83db455d5f15", + "rev": "72c35184e8260a612b00977d0bb26d63cb385cb0", "type": "github" }, "original": { @@ -138,11 +138,11 @@ ] }, "locked": { - "lastModified": 1713180885, - "narHash": "sha256-G9yAD8l8XJr3AyTADtM6j4T+tEMwn9z3ojy1lFOki5U=", + "lastModified": 1713379868, + "narHash": "sha256-L/QhOkRmzB/gmwrWrqxct/sD6XIL4AOGguRhb4ahO/8=", "owner": "girlbossceo", "repo": "conduwuit", - "rev": "6d47c20efa5b15a53b98d73ea72a759adaea00d1", + "rev": "d0a9666a2976b983daf72eb0c0f8d41c04443f84", "type": "github" }, "original": { @@ -230,6 +230,22 @@ } }, "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_3": { "flake": false, "locked": { "lastModified": 1673956053, @@ -297,6 +313,28 @@ "url": "https://flakehub.com/f/numtide/flake-utils/0.1.%2A.tar.gz" } }, + "hammering": { + "inputs": { + "flake-compat": "flake-compat_2", + "nixpkgs": [ + "nixpkgs" + ], + "utils": "utils" + }, + "locked": { + "lastModified": 1711325025, + "narHash": "sha256-kr3zMr7aWt4W/+Jcol5Ctiq0KjXSxViPhGtyqvX9dqE=", + "owner": "jtojnar", + "repo": "nixpkgs-hammering", + "rev": "6851ecea8c6da45870b7c06d6495cba3fb2d7c7c", + "type": "github" + }, + "original": { + "owner": "jtojnar", + "repo": "nixpkgs-hammering", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -326,16 +364,17 @@ ] }, "locked": { - "lastModified": 1702537497, - "narHash": "sha256-br4Z7OFEHWN8oOnKf40BoS6QFt1EyVLqwaVGBG7/DT8=", - "rev": "7a88cdedbda35f808ed2f329a7a811e0511870f9", - "revCount": 3192, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/nix-community/home-manager/0.1.3192%2Brev-7a88cdedbda35f808ed2f329a7a811e0511870f9/018c6725-7e9b-7e8e-bb57-f493c0e4f7dc/source.tar.gz" + "lastModified": 1713524465, + "narHash": "sha256-T1ZUTzBv5QHjus49MpKk/KJ8LEyJI1g+2NhwUhRT6bY=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "b1a5b3d6a524c80c7dd20888bff227d52adf5f03", + "type": "github" }, "original": { - "type": "tarball", - "url": "https://flakehub.com/f/nix-community/home-manager/0.1.%2A.tar.gz" + "owner": "nix-community", + "repo": "home-manager", + "type": "github" } }, "jovian": { @@ -373,11 +412,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1713295938, - "narHash": "sha256-Qe292vyfowvzST0Dv0iM1yR97t7CfOrBTMQ1fCba140=", + "lastModified": 1713499612, + "narHash": "sha256-IpvUlRDZkBXstPGwB1HDQWHwsUCUGybViAqD6G6siLc=", "owner": "martinvonz", "repo": "jj", - "rev": "87c4a2e46b20d50ed86400b25b665ae99f0ec39e", + "rev": "449fc423b864e5b83043b93f80114a793b05a9f2", "type": "github" }, "original": { @@ -410,11 +449,11 @@ ] }, "locked": { - "lastModified": 1713335746, - "narHash": "sha256-FxJezTeTI/4SrrJfVknOPD0rBEkUmNAgpKbfHkQO3i0=", + "lastModified": 1713523626, + "narHash": "sha256-BJX9d+IXZsmfiOyZv3n3ujom/q5iEvisxNTtoZ8MYRk=", "owner": "YaLTeR", "repo": "niri", - "rev": "c40d4f3268318ac295f21bfce38b9809c5e48f0d", + "rev": "b98b95883def5cd726c1e96a006f9cd7498d1730", "type": "github" }, "original": { @@ -484,7 +523,7 @@ }, "nix-locate": { "inputs": { - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat_3", "nixpkgs": [ "nixpkgs" ] @@ -505,11 +544,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1713248628, - "narHash": "sha256-NLznXB5AOnniUtZsyy/aPWOk8ussTuePp2acb9U+ISA=", + "lastModified": 1713537308, + "narHash": "sha256-XtTSSIB2DA6tOv+l0FhvfDMiyCmhoRbNB+0SeInZkbk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5672bc9dbf9d88246ddab5ac454e82318d094bb8", + "rev": "5c24cf2f0a12ad855f444c30b2421d044120c66f", "type": "github" }, "original": { @@ -555,11 +594,11 @@ }, "nixpkgs-stable_2": { "locked": { - "lastModified": 1713145326, - "narHash": "sha256-m7+IWM6mkWOg22EC5kRUFCycXsXLSU7hWmHdmBfmC3s=", + "lastModified": 1713344939, + "narHash": "sha256-jpHkAt0sG2/J7ueKnG7VvLLkBYUMQbXQ2L8OBpVG53s=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "53a2c32bc66f5ae41a28d7a9a49d321172af621e", + "rev": "e402c3eb6d88384ca6c52ef1c53e61bdc9b84ddd", "type": "github" }, "original": { @@ -573,6 +612,7 @@ "inputs": { "agenix": "agenix", "chaotic": "chaotic", + "hammering": "hammering", "nix-gaming": "nix-gaming", "nix-locate": "nix-locate", "nixpkgs": "nixpkgs", @@ -653,6 +693,39 @@ "type": "github" } }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "yafas": { "inputs": { "flake-schemas": [ diff --git a/flake.nix b/flake.nix index 3a50bd2..766db9d 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,7 @@ inputs = { nixpkgs = { url = "github:NixOS/nixpkgs/nixos-unstable"; + # url = "git+file:///home/grimmauld/coding/nixpkgs"; }; nixpkgs-stable = { url = "github:NixOS/nixpkgs/nixos-23.11"; @@ -24,9 +25,13 @@ url = "github:nix-community/nix-index"; inputs.nixpkgs.follows = "nixpkgs"; }; + hammering = { + url = "github:jtojnar/nixpkgs-hammering"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = inputs @ { self, nix-gaming, agenix, nixpkgs, nixpkgs-stable, nix-locate, chaotic, ... }: + outputs = inputs @ { self, nix-gaming, agenix, hammering, nixpkgs, nixpkgs-stable, nix-locate, chaotic, ... }: let system = "x86_64-linux"; stable = import nixpkgs-stable { inherit system; config.allowUnfree = true; };