Flake: Fix shells

This commit is contained in:
soraefir 2023-11-24 16:57:46 +01:00
parent 67fd69f9bc
commit b44e6d9e5b
6 changed files with 85 additions and 77 deletions

View File

@ -31,20 +31,10 @@
outputs = inputs:
let
gen = import ./generator.nix { inherit inputs; };
forEachSystem =
inputs.nixpkgs.lib.genAttrs [ "aarch64-linux" "x86_64-linux" ];
let gen = import ./generator.nix { inherit inputs; };
in {
devShells = forEachSystem (system:
let
overlays = import ./pkgs/overlay.nix { inherit pkgs; };
overrides = { custom = import ./pkgs { inherit pkgs; }; };
pkgs = import inputs.nixpkgs { inherit system overlays; }
// overrides;
in { default = import ./shells/vevsh { inherit pkgs; }; });
devShells = import ./shells { inherit inputs; };
nixosConfigurations = {
valinor = gen.generate {

View File

@ -12,7 +12,8 @@
width = "400";
scale = "0";
origin = "top-right";
offset = "${config.colorScheme.colors.gaps-bar}x${config.colorScheme.colors.gaps-screen}";
offset =
"${config.colorScheme.colors.gaps-bar}x${config.colorScheme.colors.gaps-screen}";
notification_limit = "0";
progress_bar = "true";
progress_bar_height = "10";

View File

@ -1,20 +1,25 @@
{ lib, config, pkgs, ... }:
{ lib, config, pkgs, ... }:
let
jsonOutput = name: { pre ? "", text ? "", tooltip ? "", alt ? "", class ? "", percentage ? "" }: "${pkgs.writeShellScriptBin "waybar-${name}" ''
set -euo pipefail
${pre}
${pkgs.jq}/bin/jq -cn \
--arg text "${text}" \
--arg tooltip "${tooltip}" \
--arg alt "${alt}" \
--arg class "${class}" \
--arg percentage "${percentage}" \
'{text:$text,tooltip:$tooltip,alt:$alt,class:$class,percentage:$percentage}'
''}/bin/waybar-${name}";
jsonOutput = name:
{ pre ? "", text ? "", tooltip ? "", alt ? "", class ? "", percentage ? ""
}:
"${
pkgs.writeShellScriptBin "waybar-${name}" ''
set -euo pipefail
${pre}
${pkgs.jq}/bin/jq -cn \
--arg text "${text}" \
--arg tooltip "${tooltip}" \
--arg alt "${alt}" \
--arg class "${class}" \
--arg percentage "${percentage}" \
'{text:$text,tooltip:$tooltip,alt:$alt,class:$class,percentage:$percentage}'
''
}/bin/waybar-${name}";
in {
config = lib.mkIf (config.homecfg.wm == "Wayland") {
home.packages = [pkgs.custom.amdgpu_top pkgs.jq];
home.packages = [ pkgs.custom.amdgpu_top pkgs.jq ];
programs.waybar = {
enable = true;
@ -105,11 +110,8 @@ in {
settings = [{
"layer" = "top";
"position" = "right";
modules-left = [
"hyprland/workspaces"
];
modules-center = [
];
modules-left = [ "hyprland/workspaces" ];
modules-center = [ ];
modules-right = [
"pulseaudio"
"backlight"
@ -133,21 +135,21 @@ in {
"focused" = "󰪥";
};
"persistent-workspaces" = {
"1" = [];
"2" = [];
"3" = [];
"4" = [];
"5" = [];
"6" = [];
"7" = [];
"8" = [];
"9" = [];
"10" = [];
"1" = [ ];
"2" = [ ];
"3" = [ ];
"4" = [ ];
"5" = [ ];
"6" = [ ];
"7" = [ ];
"8" = [ ];
"9" = [ ];
"10" = [ ];
};
"on-scroll-up" = "hyprctl dispatch workspace r-1";
"on-scroll-down" = "hyprctl dispatch workspace r+1";
};
"backlight" = {
"device" = "amd_backlight";
"on-scroll-up" = "light -A 5";
@ -163,7 +165,8 @@ in {
"on-click" = "amixer -D pulse sset Master toggle -q";
};
"battery" = {
"interval" = 30; "states" = {
"interval" = 30;
"states" = {
"warning" = 20;
"critical" = 10;
};
@ -174,32 +177,41 @@ in {
};
"clock" = {
"interval" = 30;
"format" = "{:<b>%H</b>\n%M}";
"tooltip-format" = "<big><b>{:%d/%m/%Y}</b></big>\n<tt><small>{calendar}</small></tt>";
"calendar" = {
"months"= "";
};
"format" = ''
{:<b>%H</b>
%M}'';
"tooltip-format" = ''
<big><b>{:%d/%m/%Y}</b></big>
<tt><small>{calendar}</small></tt>'';
"calendar" = { "months" = ""; };
};
"memory" = {
"interval" = 5;
"format" = "󰍛\n{icon}";
"format-icons" = [ "󰝦" "󰪞" "󰪟" "󰪠" "󰪡" "󰪢" "󰪣" "󰪤" "󰪥" ];
"format" = ''
󰍛
{icon}'';
"format-icons" = [ "󰝦" "󰪞" "󰪟" "󰪠" "󰪡" "󰪢" "󰪣" "󰪤" "󰪥" ];
"states" = { "warning" = 85; };
};
"cpu" = {
"interval" = 1;
"format-icons" = [ "󰝦" "󰪞" "󰪟" "󰪠" "󰪡" "󰪢" "󰪣" "󰪤" "󰪥" ];
"format" = "󱛠\n{icon}";
"format" = ''
󱛠
{icon}'';
};
"custom/gpu" = {
"exec" = jsonOutput "gpu" {
tooltip = ''...'';
percentage = ''$(amdgpu_top -J -n 1 | jq -r '.devices[0].GRBM2."Command Processor - Graphics".value')'';
"exec" = jsonOutput "gpu" {
tooltip = "...";
percentage = ''
$(amdgpu_top -J -n 1 | jq -r '.devices[0].GRBM2."Command Processor - Graphics".value')'';
};
"return-type" = "json";
"interval" = 5;
"format-icons" = [ "󰝦" "󰪞" "󰪟" "󰪠" "󰪡" "󰪢" "󰪣" "󰪤" "󰪥" ];
"format" = "󰇞\n{icon}";
"format" = ''
󰇞
{icon}'';
};
"network" = {
"format-disconnected" = "󰯡";

View File

@ -1,9 +1,9 @@
{ config, ... }: {
imports = [ ./sorahiro_soft.nix ];
{ config, ... }: {
imports = [ ./sorahiro_soft.nix ];
colorScheme.colors.border-radius = "#8";
colorScheme.colors.border-width = "#2";
colorScheme.colors.gaps-screen = "#8";
colorScheme.colors.gaps-window = "#4";
colorScheme.colors.gaps-bar = "#32";
colorScheme.colors.border-radius = "#8";
colorScheme.colors.border-width = "#2";
colorScheme.colors.gaps-screen = "#8";
colorScheme.colors.gaps-window = "#4";
colorScheme.colors.gaps-bar = "#32";
}

View File

@ -1,16 +1,5 @@
{ lib
, rustPlatform
, fetchFromGitHub
, libdrm
, libX11
, libGL
, wayland
, wayland-protocols
, libxkbcommon
, libXrandr
, libXi
, libXcursor
}:
{ lib, rustPlatform, fetchFromGitHub, libdrm, libX11, libGL, wayland
, wayland-protocols, libxkbcommon, libXrandr, libXi, libXcursor }:
rustPlatform.buildRustPackage rec {
pname = "amdgpu_top";
@ -25,7 +14,8 @@ rustPlatform.buildRustPackage rec {
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"libdrm_amdgpu_sys-0.2.2" = "sha256-2QXT/6octEzokW8+0mHx02R8qQ3kCBDxZT4yyfDkM5A=";
"libdrm_amdgpu_sys-0.2.2" =
"sha256-2QXT/6octEzokW8+0mHx02R8qQ3kCBDxZT4yyfDkM5A=";
};
};
@ -57,4 +47,4 @@ rustPlatform.buildRustPackage rec {
maintainers = with maintainers; [ geri1701 ];
platforms = platforms.linux;
};
}
}

15
shells/default.nix Normal file
View File

@ -0,0 +1,15 @@
{ ... }:
let
forEachSystem =
inputs.nixpkgs.lib.genAttrs [ "aarch64-linux" "x86_64-linux" ];
in
forEachSystem (system:
let
overlays = import ./pkgs/overlay.nix { inherit pkgs; };
overrides = { custom = import ./pkgs { inherit pkgs; }; };
pkgs = import inputs.nixpkgs { inherit system overlays; } // overrides;
in {
default = import ./shells/devsh { inherit pkgs; };
devsh = import ./shells/devsh { inherit pkgs; };
}
)