feat(niri,xbacklight): Brightness control
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
wifi.enable = true;
|
||||
stylix.enable = true;
|
||||
niri.enable = true;
|
||||
xbacklight-permissions.enable = true;
|
||||
users.users = [
|
||||
"crumb"
|
||||
];
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
# sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode disko /persist/dots/hosts/nixos-testbed/disko-config.nix
|
||||
# time sudo nixos-install --flake /persist/dots#nixos-testbed
|
||||
{ lib, ... }:
|
||||
{
|
||||
# imports = [ disko.nixosModules.disko ];
|
||||
boot.initrd.supportedFilesystems.btrfs = true;
|
||||
boot.supportedFilesystems.btrfs = true;
|
||||
|
||||
# From Impermanence's README: "Important note: Make sure your persistent
|
||||
# volumes are marked with neededForBoot, otherwise you will run into
|
||||
# problems."
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
|
||||
disko.devices = {
|
||||
disk = {
|
||||
bootroot = {
|
||||
type = "disk";
|
||||
device = "/dev/disk/by-id/ata-APPLE_SSD_SM0512G_S29ANYAH526520-part4";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
size = "512M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
|
||||
mountpoint = "/partition-root";
|
||||
swap.swapfile.size = "4G";
|
||||
|
||||
# Override existing partitions.
|
||||
extraArgs = [ "-f" ];
|
||||
|
||||
# Subvolumes must set a mountpoint in order to be mounted,
|
||||
# *unless their parent is mounted*.
|
||||
subvolumes = {
|
||||
# Subvolume names do not necessarily correspond to
|
||||
# mountpoints, despite the structural resemblance to a file
|
||||
# path.
|
||||
"/rootfs" = {
|
||||
mountpoint = "/";
|
||||
};
|
||||
"/nix" = {
|
||||
mountpoint = "/nix";
|
||||
};
|
||||
"/persist" = {
|
||||
mountpoint = "/persist";
|
||||
};
|
||||
"/persist/home" = {
|
||||
mountpoint = "/persist/home";
|
||||
};
|
||||
"/swap" = {
|
||||
mountpoint = "/.swapvol";
|
||||
swap.swapfile.size = "4G";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -73,7 +73,7 @@ in {
|
||||
|
||||
spawn-at-startup =
|
||||
[{ command = [ "${pkgs.swaynotificationcenter}/bin/swaync" ]; }
|
||||
{ command = [ "${pkgs.gammastep}/bin/gammastep" "-o" "-O" "4000k"
|
||||
{ command = [ (lib.getExe pkgs.gammastep) "-o" "-O" "4000k"
|
||||
"-b" "0.9:0.9" "-l" "0:0"]; }]
|
||||
++ lib.optional
|
||||
(! builtins.isNull cfg.wallpaper)
|
||||
@@ -226,8 +226,9 @@ in {
|
||||
binds = {
|
||||
"Mod+Q".action.close-window = [];
|
||||
"Mod+Shift+Q".action.quit = [];
|
||||
"Mod+Ctrl+L".action.spawn = ["${pkgs.swaylock}/bin/swaylock"];
|
||||
"Mod+D".action.spawn = ["${pkgs.fuzzel}/bin/fuzzel"];
|
||||
"Mod+Ctrl+L".action.spawn = [ (lib.getExe pkgs.swaylock) ];
|
||||
"Mod+D".action.spawn = [ (lib.getExe pkgs.fuzzel) ];
|
||||
"XF86LaunchB".action.spawn = [ (lib.getExe pkgs.fuzzel) ];
|
||||
"Mod+Shift+Slash".action.show-hotkey-overlay = [];
|
||||
|
||||
# Powers off the monitors. They will be powered back on upon any
|
||||
@@ -280,6 +281,11 @@ in {
|
||||
"Mod+Shift+K".action.move-window-up = [];
|
||||
"Mod+Shift+L".action.move-column-right = [];
|
||||
|
||||
"XF86MonBrightnessDown".action.spawn =
|
||||
["${lib.getExe pkgs.acpilight}" "-dec" "10"];
|
||||
"XF86MonBrightnessUp".action.spawn =
|
||||
["${lib.getExe pkgs.acpilight}" "-inc" "10"];
|
||||
|
||||
"Mod+1".action.focus-workspace = [1];
|
||||
"Mod+2".action.focus-workspace = [2];
|
||||
"Mod+3".action.focus-workspace = [3];
|
||||
|
||||
35
modules/nixos/xbacklight-permissions.nix
Normal file
35
modules/nixos/xbacklight-permissions.nix
Normal file
@@ -0,0 +1,35 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let cfg = config.sydnix.xbacklight-permissions;
|
||||
in {
|
||||
options.sydnix.xbacklight-permissions = {
|
||||
enable =
|
||||
lib.mkEnableOption "the user group that is allowed to use xbacklight";
|
||||
group = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "xbacklight";
|
||||
};
|
||||
paths = lib.mkOption {
|
||||
type = with lib.types; listOf str;
|
||||
default = [
|
||||
"/sys/class/backlight/intel_backlight/brightness"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
users.groups.${cfg.group} = {};
|
||||
|
||||
systemd.tmpfiles.settings."50-xbacklight" =
|
||||
lib.mergeAttrsList
|
||||
(builtins.map
|
||||
(path: {
|
||||
${path}.z = {
|
||||
inherit (cfg) group;
|
||||
mode = "0664";
|
||||
user = "root";
|
||||
};
|
||||
})
|
||||
cfg.paths);
|
||||
};
|
||||
}
|
||||
@@ -3,7 +3,13 @@
|
||||
isNormalUser = true;
|
||||
# TODO: Don't hard-code `persist`. Use
|
||||
# config.sydnix.impermanence.persistGroupName.
|
||||
extraGroups = [ "wheel" "persist" "input" "networkmanager" ];
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"persist"
|
||||
"input"
|
||||
"networkmanager"
|
||||
"xbacklight"
|
||||
];
|
||||
initialHashedPassword =
|
||||
"$y$j9T$aEFDDwdTZbAc6VQRXrkBJ0$K8wxTGTWDihyX1wxJ.ZMH//wmQFfrGGUkLkxIU0Lyq8";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user