feat(home-manager): service defs and fmt

fmt: reformatted using nixpkgs-fmt prettifier
mpd: created configuration
hypr: add window rules
commons: add usingMusicPlayerDaemon variable
This commit is contained in:
Zhongheng Liu 2025-01-08 14:12:29 +02:00
commit 7d88765f5d
Signed by: steven
GPG key ID: 805A28B071DAD84B
67 changed files with 633 additions and 573 deletions

View file

@ -1,15 +1,17 @@
{
config,
pkgs,
lib,
...
}: let
{ config
, pkgs
, lib
, ...
}:
let
monitorMaxBrightness = "255";
monitorMinBrightness = "32";
in {
in
{
# Type definitions for nix variables used in this configuration
options = with lib;
with types; {
usingMusicPlayerDaemon = mkOption { type = bool; };
defaultApplications = {
fileManager = mkOption { type = str; };
appLauncher = mkOption { type = str; };
@ -54,5 +56,6 @@ in {
fileManager = "${pkgs.nemo}/bin/nemo";
appLauncher = "${pkgs.walker}/bin/walker";
};
usingMusicPlayerDaemon = true;
};
}

View file

@ -1,10 +1,4 @@
{
pkgs,
lib,
config,
inputs,
...
}: {
{ pkgs, lib, config, inputs, ... }: {
# https://devenv.sh/basics/
env.GREET = "devenv";
cachix.enable = false;
@ -15,7 +9,7 @@
# languages.rust.enable = true;
languages.nix.enable = true;
pre-commit.hooks = {
alejandra.enable = true;
nixpkgs-fmt.enable = true;
shellcheck.enable = true;
commitizen.enable = true;
};
@ -38,9 +32,7 @@
# https://devenv.sh/tests/
enterTest =
/*
shell
*/
# shell
''
echo "Running tests"
git --version | grep --color=auto "${pkgs.git.version}"

View file

@ -30,18 +30,20 @@
hyprland-qtutils.url = "github:hyprwm/hyprland-qtutils";
};
outputs = {
self,
nixpkgs,
home-manager,
stylix,
spicetify-nix,
...
} @ inputs: let
outputs =
{ self
, nixpkgs
, home-manager
, stylix
, spicetify-nix
, ...
} @ inputs:
let
inherit (self) outputs;
myHostName = "nixos-msi";
stevenUserName = "stvnliu";
in {
in
{
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {

View file

@ -1,7 +1,7 @@
const hyprland = await Service.import("hyprland")
const dispatch = ws => hyprland.messageAsync(`dispatch workspace ${ws}`);
const wsSymbols = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
const wsSymbols = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"]
const Workspaces = () => Widget.EventBox({
onScrollUp: () => dispatch('+1'),
onScrollDown: () => dispatch('-1'),

View file

@ -0,0 +1,17 @@
const mpris = await Service.import('mpris')
/**
* @param {import('types/service/mpris').MprisPlayer} player
* */
const Player = (player, count) => Widget.Button({
onClicked: () => player.playPause(),
child: Widget.Label().hook(player, label => {
const { track_artists, track_title } = player;
label.label = `${count} PLAYING`;
}),
})
export const players = Widget.Box({
children: mpris.bind('players').as(p => p.map(
(this_player, index, array) => { return Player(this_player, array.length) }))
})

View file

@ -1,7 +1,6 @@
{
pkgs,
config,
...
{ pkgs
, config
, ...
}: {
config = {
home.file = {

View file

@ -1,7 +1,5 @@
{
pkgs,
config,
lib,
...
}: {
}
{ pkgs
, config
, lib
, ...
}: { }

View file

@ -1,8 +1,7 @@
{
lib,
pkgs,
config,
...
{ lib
, pkgs
, config
, ...
}: {
imports = [
#./vscode.nix
@ -11,8 +10,13 @@
programs.nixvim = import ./nixvim;
# dependencies for nixvim configuration
home.packages = with pkgs; [ ripgrep fd ];
programs.helix = {
enable = true;
};
/*
programs.vscode = {
enable = true;
package = pkgs.vscode.fhs;
};
*/
}

View file

@ -1,7 +1,6 @@
{
pkgs,
config,
...
{ pkgs
, config
, ...
}: {
gtk = {
enable = true;

View file

@ -1,9 +1,8 @@
{
inputs,
lib,
config,
pkgs,
...
{ inputs
, lib
, config
, pkgs
, ...
}: {
imports = [
./hypr
@ -69,6 +68,7 @@
teams-for-linux
sxiv
heroic
vscodium-fhs
];
myAutostartCommands = [
#"${pkgs.clash-verge-rev}/bin/clash-verge"

View file

@ -1,8 +1,7 @@
{
pkgs,
config,
lib,
...
{ pkgs
, config
, lib
, ...
}: {
imports = [
./hyprland

View file

@ -1,6 +1,8 @@
{pkgs, ...}: let
{ pkgs, ... }:
let
timeoutSeconds = 600;
in {
in
{
services.hypridle = {
enable = true;
settings = {

View file

@ -1,8 +1,8 @@
{
config,
pkgs,
...
}: let
{ config
, pkgs
, ...
}:
let
terminalCmd = config.defaultApplications.terminal;
screenshotLocation = "/home/${config.myUserName}/Screenshots/$(date '+%Y-%m-%d-%H-%M-%S').png";
in
@ -34,7 +34,7 @@ in
TODO Fix floating window rule
*/
# "$mod, N, exec, [float] ${terminalCmd} ${pkgs.networkmanager}/bin/nmtui"
"$mod, M, exec, [float] ${terminalCmd} ${pkgs.zenith}/bin/zenith"
#"$mod, M, exec, [float] ${terminalCmd} ${pkgs.zenith}/bin/zenith"
# vimkeys navigation
"$mod, H, movefocus, l"
@ -42,6 +42,9 @@ in
"$mod, K, movefocus, u"
"$mod, L, movefocus, r"
]
++ (
if config.services.mpd.enable then [ "$mod, M, exec, ${terminalCmd} --title=ncmpc ${pkgs.ncmpc}/bin/ncmpc -h 127.0.0.1" ] else [ ]
)
++ (
if config.services.swaync.enable
then [ "$mod, N, exec, ${pkgs.swaynotificationcenter}/bin/swaync-client -t" ]
@ -50,11 +53,23 @@ in
++ (
# workspaces
# binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
builtins.concatLists (builtins.genList (x: let
builtins.concatLists (builtins.genList
(x:
let
ws = let c = (x + 1) / 10; in builtins.toString (x + 1 - (c * 10));
in [
in
[
"$mod, ${ws}, workspace, ${toString (x + 1)}"
"$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}"
])
10)
]) 10)
# workspaces
# binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
/*
builtins.concatLists (builtins.genList (x:
let ws = let c = (x + 1) / 10; in builtins.toString (x + 1 - (c * 10));
in [
"$mod M, ${ws}, workspace, ${toString (x + 10 + 1)}"
"$mod SHIFT M, ${ws}, movetoworkspace, ${toString (x + 10 + 1)}"
]) 10)
*/
)

View file

@ -1,20 +1,13 @@
{
inputs,
config,
pkgs,
lib,
...
}: {
home.packages = [
inputs.hyprland-qtutils.packages.x86_64-linux.default
pkgs.foot
];
{ inputs, config, pkgs, lib, ... }: {
home.packages =
[ inputs.hyprland-qtutils.packages.x86_64-linux.default pkgs.foot ];
wayland.windowManager.hyprland = {
# Whether to enable Hyprland wayland compositor
enable = true;
# The hyprland package to use
package = pkgs.hyprland;
plugins = with pkgs.hyprlandPlugins; [
plugins = with pkgs.hyprlandPlugins;
[
# hyprfocus
# hycov
];
@ -37,7 +30,7 @@
gaps_out = 5;
allow_tearing = true;
};
windowrulev2 = ["immediate, class:^(cs2)$"];
windowrulev2 = import ./window_rules.nix;
decoration = { rounding = 5; };
input = {
# xset rate 250 50 replacement on wayland...
@ -46,13 +39,10 @@
repeat_delay = 250;
accel_profile = "flat";
};
exec-once =
config.myAutostartCommands
++ [
# future hyprland-specific exec commands
#"${config.programs.firefox.package}/bin/firefox"
#"${pkgs.thunderbird}/bin/thunderbird"
];
exec-once = config.myAutostartCommands ++ import ./hypr_autostart.nix {
inherit pkgs;
inherit config;
};
misc = {
disable_hyprland_logo = true;
disable_splash_rendering = true;

View file

@ -0,0 +1,8 @@
{ pkgs, config }:
let
term = config.defaultApplications.terminal;
shell = config.myShells.defaultShell;
in
[
"${term} --title=autorun ${shell}"
]

View file

@ -0,0 +1,7 @@
[
"workspace special silent, class:^(foot.*)$, title:autorun"
"float, tag:floats"
"float, title:ncmpc"
"size 50% 50%, title:ncmpc"
"immediate, class:^(cs2)$"
]

View file

@ -1,6 +1,6 @@
{
pkgs,
config,
{ pkgs
, config
,
}: [
", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl play-pause"
", XF86AudioStop, exec, ${pkgs.playerctl}/bin/playerctl stop"

View file

@ -1,8 +1,7 @@
{
pkgs,
config,
lib,
...
{ pkgs
, config
, lib
, ...
}: {
programs.hyprlock = {
enable = true;

View file

@ -1,7 +1,6 @@
{
pkgs,
config,
...
{ pkgs
, config
, ...
}: {
services.hyprpaper = {
enable = true;

View file

@ -1,10 +1,11 @@
{
pkgs,
lib,
...
}: let
{ pkgs
, lib
, ...
}:
let
defaultTimeoutMillis = 5 * 1000;
in {
in
{
services.mako = {
enable = true;
defaultTimeout = defaultTimeoutMillis;

View file

@ -1,8 +1,7 @@
{
pkgs,
config,
lib,
...
{ pkgs
, config
, lib
, ...
}: {
imports = [
./util-programs.nix
@ -11,5 +10,6 @@
./wayland-utils.nix
./pentesting.nix
./dev.nix
./gaming.nix
];
}

View file

@ -1,7 +1,6 @@
{
pkgs,
config,
...
{ pkgs
, config
, ...
}: {
home.packages = with pkgs; [
wget

View file

@ -1,8 +1,7 @@
{
pkgs,
config,
lib,
...
{ pkgs
, config
, lib
, ...
}: {
home.packages = with pkgs; [ vesktop ];
xdg.desktopEntries.discord = {

View file

@ -0,0 +1,4 @@
{ pkgs, config, ... }:
{
home.packages = with pkgs; [ bottles ];
}

View file

@ -1,8 +1,7 @@
{
pkgs,
config,
lib,
...
{ pkgs
, config
, lib
, ...
}: {
home.packages = with pkgs; [
libreoffice

View file

@ -1,7 +1,6 @@
{
pkgs,
config,
...
{ pkgs
, config
, ...
}: {
home.packages = with pkgs; [
openvpn

View file

@ -1,8 +1,7 @@
{
pkgs,
config,
lib,
...
{ pkgs
, config
, lib
, ...
}: {
home.packages = with pkgs; [
bottom

View file

@ -0,0 +1,4 @@
{ pkgs, config, ... }: {
home.packages = with pkgs; [ vscodium-fhs ];
xdg.desktopEntries.codium = { };
}

View file

@ -1,8 +1,7 @@
{
pkgs,
config,
lib,
...
{ pkgs
, config
, lib
, ...
}: {
home.packages = with pkgs; [ wl-clipboard ];
}

View file

@ -1,8 +1,7 @@
{
pkgs,
config,
lib,
...
{ pkgs
, config
, lib
, ...
}: {
imports = [
./git.nix

View file

@ -1,8 +1,7 @@
{
pkgs,
config,
lib,
...
{ pkgs
, config
, lib
, ...
}: {
programs.foot = {
enable = true;

View file

@ -1,8 +1,7 @@
{
pkgs,
config,
lib,
...
{ pkgs
, config
, lib
, ...
}: {
programs.git = {
enable = true;

View file

@ -1,8 +1,7 @@
{
pkgs,
config,
lib,
...
{ pkgs
, config
, lib
, ...
}: {
programs.rofi = {
enable = true;

View file

@ -1,8 +1,7 @@
{
pkgs,
config,
lib,
...
{ pkgs
, config
, lib
, ...
}: {
programs.tmux = {
enable = true;

View file

@ -1,7 +1,6 @@
{
pkgs,
config,
...
{ pkgs
, config
, ...
}: {
programs.walker = {
enable = true;

View file

@ -1,7 +1,6 @@
{
config,
pkgs,
...
{ config
, pkgs
, ...
}: {
home.packages = [
(import ./heic-to-jpg.script.nix { inherit pkgs; })

View file

@ -1,7 +1,8 @@
{
pkgs,
config,
}: let
{ pkgs
, config
,
}:
let
git = config.programs.git.package;
# checks for any Git repositories with uncommitted changes
# used because I am too lazy

View file

@ -1,7 +1,8 @@
{
pkgs,
config,
}: let
{ pkgs
, config
,
}:
let
tmux = config.programs.tmux.package;
windowName = "code-mode";
in

View file

@ -1,9 +1,9 @@
{
pkgs,
config,
...
{ pkgs
, config
, ...
}: {
imports = [
./swaync.nix
./mpd.nix
];
}

View file

@ -0,0 +1,29 @@
{ pkgs, config, lib, ... }:
lib.mkIf config.usingMusicPlayerDaemon {
home.packages = [ pkgs.ncmpc ];
services.mpd = {
enable = true;
network.listenAddress = "any";
network.port = 6600;
extraConfig = ''
audio_output {
type "pipewire"
name "my pipewire output"
}
audio_output {
type "httpd"
name "My HTTP Stream"
encoder "vorbis" # optional, vorbis or lame
port "8000"
# bind_to_address "0.0.0.0" # optional, IPv4 or IPv6
quality "5.0" # do not define if bitrate is defined
# bitrate "128" # do not define if quality is defined
format "44100:16:1"
max_clients "5" # optional 0=no limit
}
'';
};
services.mpd-mpris = {
enable = true;
};
}

View file

@ -1,7 +1,6 @@
{
pkgs,
config,
...
{ pkgs
, config
, ...
}: {
services.swaync = {
enable = true;

View file

@ -1,9 +1,9 @@
{
pkgs,
lib,
config,
...
}: let
{ pkgs
, lib
, config
, ...
}:
let
cfg = config.myShells;
in
with lib; {

View file

@ -1,7 +1,6 @@
{
pkgs,
config,
...
{ pkgs
, config
, ...
}: {
EDITOR = "nvim";
}

View file

@ -1,9 +1,9 @@
{
pkgs,
config,
lib,
...
}: let
{ pkgs
, config
, lib
, ...
}:
let
cfg = config.myShells.fish;
in
with lib; {

View file

@ -1,9 +1,9 @@
{
pkgs,
config,
lib,
...
}: let
{ pkgs
, config
, lib
, ...
}:
let
cfg = config.myShells.nushell;
in
with lib; {

View file

@ -1,9 +1,9 @@
{
lib,
pkgs,
config,
...
}: let
{ lib
, pkgs
, config
, ...
}:
let
cfg = config.myShells.prompts.starship;
in
with lib; {

View file

@ -1,8 +1,7 @@
{
pkgs,
config,
lib,
...
{ pkgs
, config
, lib
, ...
}: {
programs.zoxide = {
enable = true;

View file

@ -1,9 +1,9 @@
{
pkgs,
lib,
config,
...
}: let
{ pkgs
, lib
, config
, ...
}:
let
cfg = config.shell.zsh;
in
with lib; {

View file

@ -1,11 +1,12 @@
{
pkgs,
lib,
inputs,
...
}: let
{ pkgs
, lib
, inputs
, ...
}:
let
spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.system};
in {
in
{
# allow spotify to be installed if you don't have unfree enabled already
nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [

View file

@ -1,10 +1,11 @@
{
pkgs,
config,
...
}: let
{ pkgs
, config
, ...
}:
let
globalOpacity = 0.75;
in {
in
{
stylix = {
enable = true;
autoEnable = true;

View file

@ -1,6 +1,7 @@
{ pkgs, ... }: {
xdg = {
enable = true;
userDirs.enable = true;
mimeApps = {
enable = true;
defaultApplications = {