Compare commits

...

12 Commits

Author SHA1 Message Date
3855d7e7a0
don't spam notifications when changing volume 2024-02-03 13:56:15 +01:00
b33638d944
Fix keysym and make volume keys repeat 2024-02-03 13:45:06 +01:00
98d59e9517
hyprland: add volume control 2024-02-03 13:33:04 +01:00
7e54b6fa0f
Add workspace helper function 2024-02-03 13:32:12 +01:00
785c1be757
Enable hyprland on slab 2024-02-03 13:30:04 +01:00
2758d43722
ooprs :3 2024-02-02 15:37:34 +01:00
752a145bb5
Make some hyprland changes
- switch from wofi to rofi-wayland
- enable polkit kde agent
- add brightnessctl to env
2024-02-02 15:32:40 +01:00
3b8eec4491
Update flake.lock 2024-02-01 18:26:11 +01:00
762e73ceab
lock flake.lock 2024-02-01 18:24:48 +01:00
173990f4ba
Enable asusd on laptop 2024-02-01 18:22:17 +01:00
8a3b87b2af
Add mkWSLSystem function 2024-02-01 12:21:45 +01:00
4d103c3fb5
move _username out of flake's global scope 2024-02-01 11:43:13 +01:00
7 changed files with 173 additions and 19 deletions

90
flake.lock generated
View File

@ -1,5 +1,39 @@
{
"nodes": {
"flake-compat": {
"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-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -28,11 +62,11 @@
]
},
"locked": {
"lastModified": 1705806513,
"narHash": "sha256-FcOmNjhHFfPz2udZbRpZ1sfyhVMr+C2O8kOxPj+HDDk=",
"lastModified": 1706411424,
"narHash": "sha256-BzziJYucEZvdCE985vjPoo3ztWcmUiSQ1wJ2CoT6jCc=",
"owner": "nix-community",
"repo": "nix-index-database",
"rev": "f8e04fbcebcc24cebc91989981bd45f69b963ed7",
"rev": "c782f2a4f6fc94311ab5ef31df2f1149a1856181",
"type": "github"
},
"original": {
@ -41,13 +75,35 @@
"type": "github"
}
},
"nix-wsl": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1706608109,
"narHash": "sha256-Yc7pmonKJX/dOFm+qEInE+JlskMiN9OmOwUd/EKp4a0=",
"owner": "nix-community",
"repo": "NixOS-WSL",
"rev": "0b52d9e7a6c779f8b88c6e3bdfe6064fad648dcf",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "NixOS-WSL",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1706098335,
"narHash": "sha256-r3dWjT8P9/Ah5m5ul4WqIWD8muj5F+/gbCdjiNVBKmU=",
"lastModified": 1706718339,
"narHash": "sha256-S+S97c/HzkO2A/YsU7ZmNF9w2s7Xk6P8dzmfDdckzLs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a77ab169a83a4175169d78684ddd2e54486ac651",
"rev": "53fbe41cf76b6a685004194e38e889bc8857e8c2",
"type": "github"
},
"original": {
@ -59,11 +115,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1706173671,
"narHash": "sha256-lciR7kQUK2FCAYuszyd7zyRRmTaXVeoZsCyK6QFpGdk=",
"lastModified": 1706683685,
"narHash": "sha256-FtPPshEpxH/ewBOsdKBNhlsL2MLEFv1hEnQ19f/bFsQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4fddc9be4eaf195d631333908f2a454b03628ee5",
"rev": "5ad9903c16126a7d949101687af0aa589b1d7d3d",
"type": "github"
},
"original": {
@ -93,10 +149,26 @@
"inputs": {
"home-manager": "home-manager",
"nix-index-database": "nix-index-database",
"nix-wsl": "nix-wsl",
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable",
"pkg-android-tools": "pkg-android-tools"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View File

@ -20,6 +20,11 @@
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-wsl = {
url = "github:nix-community/NixOS-WSL";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixpkgs-unstable, ... }@inputs:
@ -47,13 +52,11 @@
};
# this is needed to work around an infinite recursion (it probably isn't
# but i'm stupid)
_username=username;
# This function produces a module that adds the home-manager module to the
# system and configures the given module to the user's Home Manager
# configuration
homeManagerInit = {system, username ? _username , module ? _ : {}, rootModule ? (import ./home/root.nix), userModules ? { ${username} = [ module ] ; root = [ rootModule ]; }, stateVersion }:
homeManagerInit = let _username=username;
in {system, username ? _username , module ? _ : {}, rootModule ? (import ./home/root.nix), userModules ? { ${username} = [ module ] ; root = [ rootModule ]; }, stateVersion }:
{ config, lib, pkgs, ... }:
let
mapUserModules = lib.attrsets.mapAttrs (user: modules: {...}:
@ -83,7 +86,8 @@
# This function produces a nixosSystem which imports configuration.nix and
# a Home Manager home.nix for the given user from ./hosts/${hostname}/
mkSystem = {system, hostname, username ? _username, stateVersion, extraModules ? [] }:
mkSystem = let _username=username;
in {system, hostname, username ? _username, stateVersion, extraModules ? [] }:
lib.nixosSystem {
inherit system;
modules = [
@ -108,6 +112,19 @@
};
};
mkWSLSystem = let _username=username; in
{username ? _username, extraModules ? [], ...}@args: let
WSLModule = {...}: {
imports = [
inputs.nix-wsl.nixosModules.wsl
];
wsl.enable = true;
wsl.defaultUser = username;
};
override = {extraModules = extraModules ++ [WSLModule];};
in
mkSystem (args // override);
# values to be passed to nixosModules and homeManagerModules wrappers
moduleInputs = {
inherit mkExtraPkgs;

View File

@ -3,16 +3,33 @@ let
mkd = lib.mkDefault;
terminal = "${pkgs.kitty}/bin/kitty";
files = "${pkgs.dolphin}/bin/dolphin";
rofi = "${pkgs.wofi}/bin/wofi";
rofi = "${pkgs.rofi-wayland}/bin/rofi";
notifydaemon = "${pkgs.dunst}/bin/dunst";
brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl";
polkit-agent = "${pkgs.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1";
# Hyprland workspace configuration
mainWorkspaces = builtins.genList (x: x+1) (9 ++ [0]);
workspaceName = key: let
hasAttr = attr: lib.hasAttrByPath [ attr ];
keyNames = {
"0" = "10";
};
in
if hasAttr key keyNames then keyNames."${key}" else key;
wm-helpers = import ./wm-helpers.nix {inherit lib pkgs;};
inherit (wm-helpers) keysetting;
in
{
home.packages = with pkgs; [
kitty
dolphin
wofi
rofi-wayland
wev
dunst
pkgs.brightnessctl
];
wayland.windowManager.hyprland = {
@ -32,6 +49,7 @@ in
exec-once = [
notifydaemon
polkit-agent
];
# Source a file (multi-file configs)
@ -141,7 +159,7 @@ in
"$mod, M, exit, "
"$mod, E, exec, ${files}"
"$mod, V, togglefloating, "
"$mod, R, exec, ${rofi} --show drun"
"$mod, R, exec, ${rofi} -show drun"
"$mod, P, pseudo," # dwindle"
"$mod, O, togglesplit," # dwindle"
@ -167,7 +185,8 @@ in
"$mod, 8, workspace, 8"
"$mod, 9, workspace, 9"
"$mod, 0, workspace, 10"
#] ++ map () [] ++ TODO reconfigure these with workspace helper function
#[
# Move active window to a workspace with mod + SHIFT + [0-9]
"$mod SHIFT, 1, movetoworkspace, 1"
"$mod SHIFT, 2, movetoworkspace, 2"
@ -192,6 +211,22 @@ in
("$mod, slash, exec, ${terminal} -e ${pkgs.neovim}/bin/nvim '+set nomodifiable' '+noremap q :q<CR>' " + args.vars.self.outPath + "/home/hyprland.nix")
];
# repeat, ignore mods
bindei = [
# Volume controls
",XF86AudioRaiseVolume, exec, ${keysetting} volumeup"
",XF86AudioLowerVolume, exec, ${keysetting} volumedown"
",XF86AudioMute, exec, ${keysetting} mute"
",XF86AudioMicMute, exec, ${keysetting} micmute"
# brightness
",XF86KbdBrightnessDown, exec, ${keysetting} keydown"
",XF86KbdBrightnessUp, exec, ${keysetting} keyup"
",XF86MonBrightnessDown, exec, ${keysetting} mondown"
",XF86MonBrightnessUp, exec, ${keysetting} monup"
];
bindm = [
# Move/resize windows with mod + LMB/RMB and dragging
"$mod, mouse:272, movewindow"

26
home/wm-helpers.nix Normal file
View File

@ -0,0 +1,26 @@
# TODO make this into a package
{ pkgs, ...}:
{
keysetting = pkgs.writeShellScript "keysetting" ''
wpctl=${pkgs.wireplumber}/bin/wpctl
notify_send=${pkgs.libnotify}/bin/notify-send
notify-send () {
$notify_send -h string:x-canonical-private-synchronous:keysetting "$@"
}
notifyvol () {
notify-send "$(wpctl get-volume @DEFAULT_SINK@)"
}
setvol () {
$wpctl set-volume @DEFAULT_SINK@ "$1"
notifyvol
}
case "$1" in
volumeup) setvol 5%+ ;;
volumedown) setvol 5%- ;;
mute) $wpctl set-mute @DEFAULT_SINK@ toggle; notifyvol;;
esac
'';
}

View File

@ -23,6 +23,7 @@
../../system/fragments/opengl.nix
../../system/gaming.nix
../../system/android.nix
../../system/hyprland.nix
];
networking.hostName = "slab";
@ -75,6 +76,8 @@
# Set your time zone.
time.timeZone = vars.mobileTimeZone;
services.asusd.enable = true;
# {{{ old config
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";

View File

@ -2,7 +2,7 @@
{
imports = [
../../home/common.nix
# ../../home/hyprland.nix
../../home/hyprland.nix
];
home.stateVersion = "23.11";

View File

@ -19,5 +19,6 @@
rofi
hyprpicker
udiskie
polkit-kde-agent
];
}