feat(homes/rafiq): import desktop configs

This commit is contained in:
Mohammad Rafiq 2025-07-07 22:03:14 +08:00
parent 8166894b78
commit c2bae8cd85
No known key found for this signature in database
5 changed files with 298 additions and 24 deletions

24
flake.lock generated
View file

@ -257,6 +257,29 @@
"type": "github" "type": "github"
} }
}, },
"nur": {
"inputs": {
"flake-parts": [
"flake-parts"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1751894474,
"narHash": "sha256-0TIIRikLAi042jNgd+gLKYCji1p4uetlmm4gROjrlEw=",
"owner": "nix-community",
"repo": "NUR",
"rev": "85c0c20851e9250e587c33023b788f66b608ca36",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "NUR",
"type": "github"
}
},
"nvf": { "nvf": {
"inputs": { "inputs": {
"flake-parts": [ "flake-parts": [
@ -305,6 +328,7 @@
"make-shell": "make-shell", "make-shell": "make-shell",
"nix-index-database": "nix-index-database", "nix-index-database": "nix-index-database",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nur": "nur",
"nvf": "nvf", "nvf": "nvf",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
"systems": "systems", "systems": "systems",

View file

@ -1,34 +1,40 @@
{ {
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } (
(inputs.import-tree ./nix)
// {
systems = import inputs.systems;
flake.paths.root = ./.;
}
);
inputs = { inputs = {
# nixos-unstable provides a binary cache for all packages. ### SYSTEM ###
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# systems provides a list of supported nix systems. # systems provides a list of supported nix systems.
systems.url = "github:nix-systems/default"; systems.url = "github:nix-systems/default";
# nixos-unstable provides a binary cache for all packages.
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# impermanence provides a nice abstraction over linking files from /persist
impermanence.url = "github:nix-community/impermanence";
# flake-parts lets us define flake modules. # flake-parts lets us define flake modules.
flake-parts = { flake-parts = {
url = "github:hercules-ci/flake-parts"; url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs"; inputs.nixpkgs-lib.follows = "nixpkgs";
}; };
# home-manager manages our user packages and dotfiles
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
# disko provides declarative drive partitioning # disko provides declarative drive partitioning
disko = { disko = {
url = "github:nix-community/disko"; url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
# impermanence provides a nice abstraction over linking files from /persist
impermanence.url = "github:nix-community/impermanence";
### FLAKE PARTS MODULES ###
# sops-nix lets us version control secrets like passwords and api keys # sops-nix lets us version control secrets like passwords and api keys
sops-nix = { sops-nix = {
url = "github:Mic92/sops-nix"; url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
### FLAKE PARTS MODULES ###
# import-tree imports all nix files in a given directory. # import-tree imports all nix files in a given directory.
import-tree.url = "github:vic/import-tree"; import-tree.url = "github:vic/import-tree";
# files lets us write text files and automatically add checks for them # files lets us write text files and automatically add checks for them
@ -50,12 +56,24 @@
}; };
}; };
### PROGRAMS ### ### HOME-MANAGER ###
# home-manager manages our user packages and dotfiles
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
# nix-index-database indexes the nixpkgs binaries for use with comma # nix-index-database indexes the nixpkgs binaries for use with comma
nix-index-database = { nix-index-database = {
url = "github:nix-community/nix-index-database"; url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
# the nix user repository for mainly firefox extensions
nur = {
url = "github:nix-community/NUR";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-parts.follows = "flake-parts";
};
# nvf provides modules to wrap neovim # nvf provides modules to wrap neovim
nvf = { nvf = {
url = "github:notashelf/nvf"; url = "github:notashelf/nvf";
@ -69,7 +87,7 @@
}; };
### DEDUPE ### ### DEDUPE ###
# The following are not used in the flake
dedupe_flake-compat.url = "github:edolstra/flake-compat"; dedupe_flake-compat.url = "github:edolstra/flake-compat";
dedupe_flake-utils = { dedupe_flake-utils = {
url = "github:numtide/flake-utils"; url = "github:numtide/flake-utils";
@ -81,14 +99,4 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
}; };
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } (
(inputs.import-tree ./nix)
// {
systems = import inputs.systems;
flake.paths.root = ./.;
}
);
} }

View file

@ -0,0 +1,14 @@
{
animation = [ "workspaces, 1, 1, default" ];
general = {
border_size = 2;
gaps_in = 0;
gaps_out = 0;
resize_on_border = true;
};
decoration = {
rounding = 10;
rounding_power = 2;
inactive_opacity = 0.9;
};
}

View file

@ -0,0 +1,56 @@
{ pkgs, ... }:
{
"$hypr" = "CTRL_SUPER_ALT_SHIFT";
"$meh" = "CONTROL_SHIFT_ALT";
bind = [
"$hypr, Q, exec, uwsm stop"
"SUPER, W, killactive"
"SUPER, return, exec, uwsm app -- $TERMINAL"
"SUPER, O, exec, uwsm app -- $BROWSER"
"SUPER, Escape, exec, uwsm app -- $LOCKSCREEN"
#TODO:add file browser
#TODO: make it directional
"SUPER, H, cyclenext, visible"
"SUPER, L, cyclenext, visible prev"
"SUPER_ALT, H, movewindow, l"
"SUPER_ALT, J, movewindow, d"
"SUPER_ALT, K, movewindow, u"
"SUPER_ALT, L, movewindow, r"
"ALT_SHIFT, H, resizeactive, -10% 0"
"ALT_SHIFT, J, resizeactive, 0 -10%"
"ALT_SHIFT, K, resizeactive, 0 10%"
"ALT_SHIFT, L, resizeactive, 10% 0"
"SUPER_CTRL, H, workspace, r-1"
"SUPER_CTRL, L, workspace, r+1"
"$hypr, H, movetoworkspace, r-1"
"$hypr, L, movetoworkspace, r+1"
"$hypr, V, togglefloating"
];
bindr = [
# Activates on SUPER without any other modifier
"SUPER, Super_L, exec, uwsm app -- $($LAUNCHER --launch-prefix=\"uwsm app -- \")"
];
bindle = [
"SUPER, 6, exec, ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%-"
"SUPER, 7, exec, ${pkgs.playerctl}/bin/playerctl previous"
"SUPER, 8, exec, ${pkgs.playerctl}/bin/playerctl -a play-pause"
"SUPER, 9, exec, ${pkgs.playerctl}/bin/playerctl next"
"SUPER, 0, exec, ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"
"ALT, mouse_up, resizeactive, 10% 10%"
"ALT, mouse_down, resizeactive, -10% -10%"
];
bindm = [
"ALT, mouse:272, movewindow"
"ALT, mouse:273, resizeactive"
];
bindc = [
"ALT, mouse:272, togglefloating"
];
}

View file

@ -0,0 +1,172 @@
{ lib, inputs, ... }:
{
allowedUnfreePackages = [
"stremio-shell"
"stremio-server"
];
flake.homes.rafiq =
{ osConfig, pkgs, ... }:
let
inherit (lib.modules) mkMerge mkIf;
inherit (builtins) map listToAttrs;
inherit (lib.lists) findFirstIndex;
inherit (inputs.nur.legacyPackages.${pkgs.stdenv.hostPlatform.system}.repos.rycee) firefox-addons;
profiles = listToAttrs (
map (name: {
inherit name;
# If there are duplicate profile names, findFirstIndex will cause issues.
value = profileCfg (findFirstIndex (x: x == name) null syncedProfiles);
}) syncedProfiles
);
syncedProfiles = [
"rafiq"
"test"
];
profileCfg = id: {
inherit id;
settings."extensions.autoDisableScopes" = 0; # Auto enable extensions
#TODO: add default seach unduck and add rest of extensions
extensions = {
force = true;
packages = with firefox-addons; [
darkreader
gesturefy
sponsorblock
ublock-origin
];
};
};
in
mkIf osConfig.desktop.enable {
persistDirs = [
"docs"
"repos"
"vids"
"tmp"
".cache/Smart Code ltd/Stremio"
".local/share/Smart Code ltd/Stremio"
".mozilla/firefox"
];
home = {
packages = with pkgs; [ stremio ];
sessionVariables = {
BROWSER = "firefox";
LAUNCHER = "fuzzel";
LOCKSCREEN = "hyprlock";
NOTIFICATION_DAEMON = "mako";
TERMINAL = "ghostty";
STATUS_BAR = "waybar";
};
};
# TODO: add gamescope here or in nixos desktop module
programs = {
obs-studio.enable = true;
vesktop.enable = true;
thunderbird.enable = true;
thunderbird.profiles.rafiq.isDefault = true;
firefox = {
enable = true;
inherit profiles;
};
hyprlock.settings = {
general.hide_cursor = true;
general.ignore_empty_input = true;
background.blur_passes = 5;
background.blur_size = 5;
label = {
text = ''hi, $USER.'';
font_size = 32;
position = "0, 0";
halign = "center";
valign = "center";
zindex = 1;
shadow_passes = 5;
shadow_size = 5;
};
input-field = {
placeholder_text = "";
fade_on_empty = true;
size = "200, 45";
position = "0, -5%";
halign = "center";
valign = "center";
zindex = 1;
shadow_passes = 5;
shadow_size = 5;
};
};
ghostty = {
enable = true;
settings = {
confirm-close-surface = false;
};
};
waybar = {
enable = true;
settings = [
{
#TODO: review the rest of the modules to see what else can be added
layer = "top";
modules-left = [
"pulseaudio"
];
modules-right = [
"battery"
"clock"
];
"pulseaudio" = {
format = "{icon} {volume}%";
format-muted = "";
format-icons.default = [
""
""
];
on-click = "${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
};
"clock" = {
interval = 1;
format = "{:%F %T}";
};
"battery" = {
interval = 1;
bat-compatibility = true;
};
}
];
style = # css
''
window#waybar {
background-color: rgba(0, 0, 0, 0);
}
#pulseaudio,
#battery,
#clock {
padding-top: 5px;
padding-bottom: 5px;
padding-right: 5px;
color: #ffffff;
}
'';
};
};
services = {
mako.enable = true;
mako.settings.default-timeout = 10000;
};
wayland.windowManager.hyprland.settings = mkMerge [
(import ./_hyprland/decoration.nix)
(import ./_hyprland/keybinds.nix { inherit pkgs; })
{
ecosystem.no_update_news = true;
xwayland.force_zero_scaling = true;
monitor = [ ", preferred, auto, 1" ];
exec-once = [
"uwsm app -- $LOCKSCREEN"
"uwsm app -- $NOTIFICATION_DAEMON"
"uwsm app -- $STATUS_BAR"
];
}
];
};
}