Split into more modules

This commit is contained in:
Paul-Henri Froidmont 2023-03-23 19:01:42 +01:00
parent b6760195ce
commit 70f3e0a538
Signed by: phfroidmont
GPG key ID: BE948AFD7E7873BE
15 changed files with 219 additions and 124 deletions

View file

@ -10,7 +10,6 @@
vscode.enable = true;
dunst.enable = true;
htop.enable = true;
mpd.enable = true;
};
editor = {
vim.enable = true;
@ -23,6 +22,10 @@
libvirt.enable = true;
};
apps = { newsboat.enable = true; };
media = {
mpd.enable = true;
ncmpcpp.enable = true;
};
};
# Monitor backlight control

View file

@ -10,7 +10,6 @@
vscode.enable = true;
dunst.enable = true;
htop.enable = true;
mpd.enable = true;
};
editor = {
vim.enable = true;
@ -23,6 +22,13 @@
libvirt.enable = true;
};
apps = { newsboat.enable = true; };
media = {
mpd.enable = true;
ncmpcpp.enable = true;
emulators.gc.enable = true;
steam.enable = true;
lutris.enable = true;
};
};
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];

View file

@ -114,15 +114,7 @@ in {
};
file = {
".wallpaper.png".source = ./files/wallpaper.png;
".config/ncmpcpp" = {
source = ./files/ncmpcpp;
recursive = true;
};
".xmonad/scripts" = {
source = ./files/scripts;
recursive = true;
};
".wallpaper.png".source = ./wallpaper.png;
".themes/oomox-gruvmox-dark-medium-default" = {
source = ./files/oomox-gruvmox-dark-medium-default;
recursive = true;
@ -146,9 +138,6 @@ in {
xorg.xkill
numix-gtk-theme
(ncmpcpp.override { visualizerSupport = true; })
mpc_cli
# Ranger preview utils
w3m
xclip
@ -180,12 +169,6 @@ in {
thefuck
atool
linuxPackages.perf
glxinfo
steam
protontricks
lutris
dolphinEmu
];
};

View file

@ -1,37 +0,0 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.desktop.mpd;
in {
options.modules.desktop.mpd = {
enable = mkBoolOpt false;
};
config = mkIf cfg.enable {
home-manager.users.${config.user.name} = { config, ... }: {
services.mpd =
{
enable = true;
network.listenAddress = "any";
musicDirectory = "${config.home.homeDirectory}/Nextcloud/Media/Music";
playlistDirectory = "${config.home.homeDirectory}/Nextcloud/Playlists";
extraConfig = ''
max_output_buffer_size "16384"
auto_update "yes"
audio_output {
type "pulse"
name "pulse audio"
device "pulse"
mixer_type "hardware"
}
audio_output {
type "fifo"
name "toggle_visualizer"
path "/tmp/mpd.fifo"
format "44100:16:2"
}
'';
};
};
};
}

View file

@ -3,41 +3,13 @@
with lib;
with lib.my;
let cfg = config.modules.desktop.xmonad;
let cfg = config.modules.desktop.polybar;
in {
options.modules.desktop.xmonad = { enable = mkBoolOpt false; };
options.modules.desktop.polybar = { enable = mkBoolOpt false; };
config = mkIf cfg.enable {
services.xserver = {
enable = true;
layout = "fr";
desktopManager.xterm.enable = false;
windowManager.xmonad.enable = true;
displayManager.lightdm = {
enable = true;
background = ./files/wallpaper.png;
greeters.mini = {
enable = true;
user = config.user.name;
extraConfig = ''
text-color = "#fbf1c7"
password-background-color = "#3c3836"
window-color = "#282828"
border-color = "#458588"
'';
};
};
};
home-manager.users.${config.user.name} = {
xsession = {
windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
config = ./files/xmonad.hs;
};
};
services.polybar = {
enable = true;
@ -97,19 +69,18 @@ in {
width = "100%";
height = "34";
offset-x = 0;
offset-y = 0;
bottom = true;
padding-left = 2;
padding-right = 2;
padding = 2;
font-0 = "MesloLGS Nerd Font Mono:pixelsize=12;2";
font-1 = "MesloLGS Nerd Font Mono:pixelsize=20;5";
modules-left = "pulseaudio pad cpu memory pad fs pad xwindow";
modules-left = "pulseaudio cpu memory fs xwindow";
modules-center = "ewmh";
modules-right = "mpd pad battery pad date";
modules-right = "mpd battery date";
separator = " ";
tray-position = "right";
};
@ -156,16 +127,14 @@ in {
label-padding-left = 2;
};
"module/pad" = {
type = "custom/text";
content = " ";
};
"module/fs" = {
type = "internal/fs";
mount-0 = "/";
interval = 30;
format-mounted = "<bar-used>";
format-mounted-prefix = "󰋊 ";
format-mounted-prefix = "󰋊";
format-mounted-prefix-padding = 1;
# format-mounted-prefix-padding-right = 0;
format-mounted-prefix-font = 2;
format-mounted-foreground = "\${colors.accent}";
@ -174,12 +143,16 @@ in {
label-unmounted-foreground = "\${colors.fg-alt}";
bar-used-indicator = "";
bar-used-width = 8;
bar-used-width = 10;
bar-used-foreground-0 = "\${colors.fg}";
bar-used-foreground-1 = "\${colors.fg}";
bar-used-foreground-2 = "\${colors.yellow}";
bar-used-foreground-3 = "\${colors.red}";
bar-used-foreground-4 = "\${colors.red}";
bar-used-foreground-2 = "\${colors.fg}";
bar-used-foreground-3 = "\${colors.fg}";
bar-used-foreground-4 = "\${colors.fg}";
bar-used-foreground-5 = "\${colors.yellow}";
bar-used-foreground-6 = "\${colors.yellow}";
bar-used-foreground-7 = "\${colors.yellow}";
bar-used-foreground-8 = "\${colors.red}";
bar-used-fill = "|";
bar-used-empty = "¦";
bar-used-empty-foreground = "\${colors.fg-alt}";
@ -188,18 +161,23 @@ in {
type = "internal/cpu";
interval = 2;
format = "<bar-load>";
format-prefix = " ";
format-prefix = "";
format-prefix-padding = 1;
# format-prefix-padding-right = 1;
format-prefix-font = 2;
format-foreground = "\${colors.accent}";
format-padding = 1;
bar-load-indicator = "";
bar-load-width = 8;
bar-load-width = 10;
bar-load-foreground-0 = "\${colors.fg}";
bar-load-foreground-1 = "\${colors.fg}";
bar-load-foreground-2 = "\${colors.yellow}";
bar-load-foreground-3 = "\${colors.red}";
bar-load-foreground-4 = "\${colors.red}";
bar-load-foreground-2 = "\${colors.fg}";
bar-load-foreground-3 = "\${colors.fg}";
bar-load-foreground-4 = "\${colors.fg}";
bar-load-foreground-5 = "\${colors.yellow}";
bar-load-foreground-6 = "\${colors.yellow}";
bar-load-foreground-7 = "\${colors.yellow}";
bar-load-foreground-8 = "\${colors.red}";
bar-load-fill = "|";
bar-load-empty = "¦";
bar-load-empty-foreground = "\${colors.fg-alt}";
@ -208,18 +186,23 @@ in {
type = "internal/memory";
interval = 3;
format = "<bar-used>";
format-prefix = " ";
format-prefix = "";
format-prefix-padding = 1;
# format-prefix-padding-right = 1;
format-prefix-font = 2;
format-prefix-foreground = "\${colors.accent}";
format-padding-left = 1;
bar-used-indicator = "";
bar-used-width = 8;
bar-used-width = 10;
bar-used-foreground-0 = "\${colors.fg}";
bar-used-foreground-1 = "\${colors.fg}";
bar-used-foreground-2 = "\${colors.yellow}";
bar-used-foreground-3 = "\${colors.red}";
bar-used-foreground-4 = "\${colors.red}";
bar-used-foreground-2 = "\${colors.fg}";
bar-used-foreground-3 = "\${colors.fg}";
bar-used-foreground-4 = "\${colors.fg}";
bar-used-foreground-5 = "\${colors.yellow}";
bar-used-foreground-6 = "\${colors.yellow}";
bar-used-foreground-7 = "\${colors.yellow}";
bar-used-foreground-8 = "\${colors.red}";
bar-used-fill = "|";
bar-used-empty = "¦";
bar-used-empty-foreground = "\${colors.fg-alt}";
@ -248,28 +231,24 @@ in {
ramp-volume-2 = "󰕾";
ramp-volume-font = 2;
};
"module/mpd" = {
"module/mpd" = (mkIf config.modules.media.mpd.enable {
type = "internal/mpd";
host = "127.0.0.1";
port = "6600";
label-song = "%artist% - %title%";
format-playing-prefix = "󰎈 ";
format-playing-prefix = "󰎈";
format-palying-prefix-padding = 1;
format-playing-prefix-font = 2;
format-playing-foreground = "\${colors.fg}";
format-paused-prefix = "󰎊 ";
format-paused-prefix = "󰎊";
format-paused-prefix-padding = 1;
format-paused-prefix-font = 2;
format-paused-foreground = "\${colors.fg-alt}";
};
});
};
};
home.packages = with pkgs.unstable; [
i3lock
feh
scrot
];
};
};

View file

Before

Width:  |  Height:  |  Size: 252 KiB

After

Width:  |  Height:  |  Size: 252 KiB

Before After
Before After

View file

@ -0,0 +1,60 @@
{ options, config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.desktop.xmonad;
in {
options.modules.desktop.xmonad = { enable = mkBoolOpt false; };
config = mkIf cfg.enable {
modules.desktop.polybar.enable = true;
services.xserver = {
enable = true;
layout = "fr";
desktopManager.xterm.enable = false;
windowManager.xmonad.enable = true;
displayManager.lightdm = {
enable = true;
background = ../wallpaper.png;
greeters.mini = {
enable = true;
user = config.user.name;
extraConfig = ''
text-color = "#fbf1c7"
password-background-color = "#3c3836"
window-color = "#282828"
border-color = "#458588"
'';
};
};
};
home-manager.users.${config.user.name} = {
xsession = {
windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
config = ./xmonad.hs;
};
};
home = {
file.".xmonad/scripts" = {
source = ./scripts;
recursive = true;
};
packages = with pkgs.unstable; [
i3lock
feh
scrot
];
};
};
};
}

View file

@ -0,0 +1,24 @@
{ options, config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.media.emulators;
in {
options.modules.media.emulators = {
psx.enable = mkBoolOpt false; # Playstation
ds.enable = mkBoolOpt false; # Nintendo DS
gc.enable = mkBoolOpt false; # GameCube
gb.enable = mkBoolOpt false; # GameBoy + GameBoy Color
gba.enable = mkBoolOpt false; # GameBoy Advance
snes.enable = mkBoolOpt false; # Super Nintendo
};
config = {
user.packages = with pkgs; [
(mkIf cfg.psx.enable epsxe)
(mkIf cfg.ds.enable desmume)
(mkIf cfg.gc.enable dolphinEmu)
(mkIf (cfg.gba.enable || cfg.gb.enable || cfg.snes.enable) higan)
];
};
}

19
modules/media/games.nix Normal file
View file

@ -0,0 +1,19 @@
{ options, config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.media;
in {
options.modules.media = {
steam.enable = mkBoolOpt false;
lutris.enable = mkBoolOpt false;
};
config = {
user.packages = with pkgs; [
(mkIf cfg.steam.enable steam)
(mkIf cfg.lutris.enable lutris)
(mkIf (cfg.steam.enable || cfg.lutris.enable) protontricks)
];
};
}

34
modules/media/mpd.nix Normal file
View file

@ -0,0 +1,34 @@
{ config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.media.mpd;
in {
options.modules.media.mpd = { enable = mkBoolOpt false; };
config = mkIf cfg.enable {
home-manager.users.${config.user.name} = { config, ... }: {
services.mpd = {
enable = true;
network.listenAddress = "any";
musicDirectory = "${config.home.homeDirectory}/Nextcloud/Media/Music";
playlistDirectory = "${config.home.homeDirectory}/Nextcloud/Playlists";
extraConfig = ''
max_output_buffer_size "16384"
auto_update "yes"
audio_output {
type "pulse"
name "pulse audio"
device "pulse"
mixer_type "hardware"
}
audio_output {
type "fifo"
name "toggle_visualizer"
path "/tmp/mpd.fifo"
format "44100:16:2"
}
'';
};
};
};
}

View file

@ -0,0 +1,24 @@
{ inputs, config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.media.ncmpcpp;
in {
options.modules.media.ncmpcpp = { enable = mkBoolOpt false; };
config = mkIf cfg.enable {
home-manager.users.${config.user.name} = {
home = {
packages = with pkgs.unstable; [
(ncmpcpp.override { visualizerSupport = true; })
mpc_cli
];
file.".config/ncmpcpp/config".source = ./config;
file.".config/ncmpcpp/bindings".source = ./bindings;
};
};
};
}