1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 13:32:50 -05:00

nix: switch to standard nixpkgs rfc formatting (#962)

This commit is contained in:
Marcus Ramberg
2025-12-10 08:55:45 +01:00
committed by GitHub
parent 8615950bd6
commit 98769ecd88
8 changed files with 664 additions and 580 deletions

View File

@@ -1 +0,0 @@
indentation = "FourSpaces"

View File

@@ -1,33 +1,40 @@
{ {
config, config,
lib, lib,
pkgs, pkgs,
dmsPkgs, dmsPkgs,
... ...
}: let }:
cfg = config.programs.dankMaterialShell; let
in { cfg = config.programs.dankMaterialShell;
qmlPath = "${dmsPkgs.dms-shell}/share/quickshell/dms"; in
{
qmlPath = "${dmsPkgs.dms-shell}/share/quickshell/dms";
packages = packages = [
[ pkgs.material-symbols
pkgs.material-symbols pkgs.inter
pkgs.inter pkgs.fira-code
pkgs.fira-code
pkgs.ddcutil pkgs.ddcutil
pkgs.libsForQt5.qt5ct pkgs.libsForQt5.qt5ct
pkgs.kdePackages.qt6ct pkgs.kdePackages.qt6ct
dmsPkgs.dms-shell dmsPkgs.dms-shell
] ]
++ lib.optional cfg.enableSystemMonitoring dmsPkgs.dgop ++ lib.optional cfg.enableSystemMonitoring dmsPkgs.dgop
++ lib.optionals cfg.enableClipboard [pkgs.cliphist pkgs.wl-clipboard] ++ lib.optionals cfg.enableClipboard [
++ lib.optionals cfg.enableVPN [pkgs.glib pkgs.networkmanager] pkgs.cliphist
++ lib.optional cfg.enableBrightnessControl pkgs.brightnessctl pkgs.wl-clipboard
++ lib.optional cfg.enableColorPicker pkgs.hyprpicker ]
++ lib.optional cfg.enableDynamicTheming pkgs.matugen ++ lib.optionals cfg.enableVPN [
++ lib.optional cfg.enableAudioWavelength pkgs.cava pkgs.glib
++ lib.optional cfg.enableCalendarEvents pkgs.khal pkgs.networkmanager
++ lib.optional cfg.enableSystemSound pkgs.kdePackages.qtmultimedia; ]
++ lib.optional cfg.enableBrightnessControl pkgs.brightnessctl
++ lib.optional cfg.enableColorPicker pkgs.hyprpicker
++ lib.optional cfg.enableDynamicTheming pkgs.matugen
++ lib.optional cfg.enableAudioWavelength pkgs.cava
++ lib.optional cfg.enableCalendarEvents pkgs.khal
++ lib.optional cfg.enableSystemSound pkgs.kdePackages.qtmultimedia;
} }

View File

@@ -1,140 +1,164 @@
{ {
lib, lib,
config, config,
pkgs, pkgs,
dmsPkgs, dmsPkgs,
... ...
}: let }:
inherit (lib) types; let
cfg = config.programs.dankMaterialShell.greeter; inherit (lib) types;
cfg = config.programs.dankMaterialShell.greeter;
user = config.services.greetd.settings.default_session.user; inherit (config.services.greetd.settings.default_session) user;
cacheDir = "/var/lib/dms-greeter"; cacheDir = "/var/lib/dms-greeter";
greeterScript = pkgs.writeShellScriptBin "dms-greeter" '' greeterScript = pkgs.writeShellScriptBin "dms-greeter" ''
export PATH=$PATH:${lib.makeBinPath [cfg.quickshell.package config.programs.${cfg.compositor.name}.package]} export PATH=$PATH:${
${lib.escapeShellArgs ([ lib.makeBinPath [
"sh" cfg.quickshell.package
"${../../quickshell/Modules/Greetd/assets/dms-greeter}" config.programs.${cfg.compositor.name}.package
"--cache-dir" ]
cacheDir }
"--command" ${
cfg.compositor.name lib.escapeShellArgs (
"-p" [
"${dmsPkgs.dms-shell}/share/quickshell/dms" "sh"
"${../../quickshell/Modules/Greetd/assets/dms-greeter}"
"--cache-dir"
cacheDir
"--command"
cfg.compositor.name
"-p"
"${dmsPkgs.dms-shell}/share/quickshell/dms"
] ]
++ lib.optionals (cfg.compositor.customConfig != "") [ ++ lib.optionals (cfg.compositor.customConfig != "") [
"-C" "-C"
"${pkgs.writeText "dmsgreeter-compositor-config" cfg.compositor.customConfig}" "${pkgs.writeText "dmsgreeter-compositor-config" cfg.compositor.customConfig}"
])} ${lib.optionalString cfg.logs.save "> ${cfg.logs.path} 2>&1"} ]
''; )
} ${lib.optionalString cfg.logs.save "> ${cfg.logs.path} 2>&1"}
'';
jq = lib.getExe pkgs.jq; jq = lib.getExe pkgs.jq;
in { in
imports = let {
msg = "The option 'programs.dankMaterialShell.greeter.compositor.extraConfig' is deprecated. Please use 'programs.dankMaterialShell.greeter.compositor.customConfig' instead."; imports =
in [(lib.mkRemovedOptionModule ["programs" "dankMaterialShell" "greeter" "compositor" "extraConfig"] msg)]; let
msg = "The option 'programs.dankMaterialShell.greeter.compositor.extraConfig' is deprecated. Please use 'programs.dankMaterialShell.greeter.compositor.customConfig' instead.";
in
[
(lib.mkRemovedOptionModule [
"programs"
"dankMaterialShell"
"greeter"
"compositor"
"extraConfig"
] msg)
];
options.programs.dankMaterialShell.greeter = { options.programs.dankMaterialShell.greeter = {
enable = lib.mkEnableOption "DankMaterialShell greeter"; enable = lib.mkEnableOption "DankMaterialShell greeter";
compositor.name = lib.mkOption { compositor.name = lib.mkOption {
type = types.enum ["niri" "hyprland" "sway" "scroll"]; type = types.enum [
description = "Compositor to run greeter in"; "niri"
}; "hyprland"
compositor.customConfig = lib.mkOption { "sway"
type = types.lines; ];
default = ""; description = "Compositor to run greeter in";
description = "Custom compositor config";
};
configFiles = lib.mkOption {
type = types.listOf types.path;
default = [];
description = "Config files to copy into data directory";
example = [
"/home/user/.config/DankMaterialShell/settings.json"
];
};
configHome = lib.mkOption {
type = types.nullOr types.str;
default = null;
example = "/home/user";
description = ''
User home directory to copy configurations for greeter
If DMS config files are in non-standard locations then use the configFiles option instead
'';
};
quickshell = {
package = lib.mkPackageOption dmsPkgs "quickshell" {
extraDescription = "The quickshell package to use (defaults to be built from source, in the commit 26531f due to unreleased features used by DMS).";
};
};
logs.save = lib.mkEnableOption "saving logs from DMS greeter to file";
logs.path = lib.mkOption {
type = types.path;
default = "/tmp/dms-greeter.log";
description = ''
File path to save DMS greeter logs to
'';
};
}; };
config = lib.mkIf cfg.enable { compositor.customConfig = lib.mkOption {
assertions = [ type = types.lines;
{ default = "";
assertion = (config.users.users.${user} or {}) != {}; description = "Custom compositor config";
message = '' };
dmsgreeter: user set for greetd default_session ${user} does not exist. Please create it before referencing it. configFiles = lib.mkOption {
''; type = types.listOf types.path;
} default = [ ];
]; description = "Config files to copy into data directory";
services.greetd = { example = [
enable = lib.mkDefault true; "/home/user/.config/DankMaterialShell/settings.json"
settings.default_session.command = lib.mkDefault (lib.getExe greeterScript); ];
}; };
fonts.packages = with pkgs; [ configHome = lib.mkOption {
fira-code type = types.nullOr types.str;
inter default = null;
material-symbols example = "/home/user";
]; description = ''
systemd.tmpfiles.settings."10-dmsgreeter" = { User home directory to copy configurations for greeter
${cacheDir}.d = { If DMS config files are in non-standard locations then use the configFiles option instead
user = user; '';
group = };
if config.users.users.${user}.group != "" quickshell = {
then config.users.users.${user}.group package = lib.mkPackageOption dmsPkgs "quickshell" {
else "greeter"; extraDescription = "The quickshell package to use (defaults to be built from source, in the commit 26531f due to unreleased features used by DMS).";
mode = "0750"; };
}; };
}; logs.save = lib.mkEnableOption "saving logs from DMS greeter to file";
systemd.services.greetd.preStart = '' logs.path = lib.mkOption {
cd ${cacheDir} type = types.path;
${lib.concatStringsSep "\n" (lib.map (f: '' default = "/tmp/dms-greeter.log";
if [ -f "${f}" ]; then description = ''
cp "${f}" . File path to save DMS greeter logs to
fi '';
'') };
cfg.configFiles)} };
config = lib.mkIf cfg.enable {
if [ -f session.json ]; then assertions = [
if cp "$(${jq} -r '.wallpaperPath' session.json)" wallpaper.jpg; then {
mv session.json session.orig.json assertion = (config.users.users.${user} or { }) != { };
${jq} '.wallpaperPath = "${cacheDir}/wallpaper.jpg"' session.orig.json > session.json message = ''
fi dmsgreeter: user set for greetd default_session ${user} does not exist. Please create it before referencing it.
fi
if [ -f settings.json ]; then
if cp "$(${jq} -r '.customThemeFile' settings.json)" custom-theme.json; then
mv settings.json settings.orig.json
${jq} '.customThemeFile = "${cacheDir}/custom-theme.json"' settings.orig.json > settings.json
fi
fi
mv dms-colors.json colors.json || :
chown ${user}: * || :
''; '';
programs.dankMaterialShell.greeter.configFiles = lib.mkIf (cfg.configHome != null) [ }
"${cfg.configHome}/.config/DankMaterialShell/settings.json" ];
"${cfg.configHome}/.local/state/DankMaterialShell/session.json" services.greetd = {
"${cfg.configHome}/.cache/DankMaterialShell/dms-colors.json" enable = lib.mkDefault true;
]; settings.default_session.command = lib.mkDefault (lib.getExe greeterScript);
}; };
fonts.packages = with pkgs; [
fira-code
inter
material-symbols
];
systemd.tmpfiles.settings."10-dmsgreeter" = {
${cacheDir}.d = {
inherit user;
group =
if config.users.users.${user}.group != "" then config.users.users.${user}.group else "greeter";
mode = "0750";
};
};
systemd.services.greetd.preStart = ''
cd ${cacheDir}
${lib.concatStringsSep "\n" (
lib.map (f: ''
if [ -f "${f}" ]; then
cp "${f}" .
fi
'') cfg.configFiles
)}
if [ -f session.json ]; then
if cp "$(${jq} -r '.wallpaperPath' session.json)" wallpaper.jpg; then
mv session.json session.orig.json
${jq} '.wallpaperPath = "${cacheDir}/wallpaper.jpg"' session.orig.json > session.json
fi
fi
if [ -f settings.json ]; then
if cp "$(${jq} -r '.customThemeFile' settings.json)" custom-theme.json; then
mv settings.json settings.orig.json
${jq} '.customThemeFile = "${cacheDir}/custom-theme.json"' settings.orig.json > settings.json
fi
fi
mv dms-colors.json colors.json || :
chown ${user}: * || :
'';
programs.dankMaterialShell.greeter.configFiles = lib.mkIf (cfg.configHome != null) [
"${cfg.configHome}/.config/DankMaterialShell/settings.json"
"${cfg.configHome}/.local/state/DankMaterialShell/session.json"
"${cfg.configHome}/.cache/DankMaterialShell/dms-colors.json"
];
};
} }

View File

@@ -1,94 +1,114 @@
{ {
config, config,
pkgs, pkgs,
lib, lib,
dmsPkgs, dmsPkgs,
... ...
} @ args: let }@args:
cfg = config.programs.dankMaterialShell; let
jsonFormat = pkgs.formats.json {}; cfg = config.programs.dankMaterialShell;
common = import ./common.nix {inherit config pkgs lib dmsPkgs;}; jsonFormat = pkgs.formats.json { };
in { common = import ./common.nix {
imports = [ inherit
(import ./options.nix args) config
(lib.mkRemovedOptionModule ["programs" "dankMaterialShell" "enableNightMode"] "Night mode is now always available.") pkgs
(lib.mkRenamedOptionModule ["programs" "dankMaterialShell" "enableSystemd"] ["programs" "dankMaterialShell" "systemd" "enable"]) lib
dmsPkgs
;
};
in
{
imports = [
(import ./options.nix args)
(lib.mkRemovedOptionModule [
"programs"
"dankMaterialShell"
"enableNightMode"
] "Night mode is now always available.")
(lib.mkRenamedOptionModule
[ "programs" "dankMaterialShell" "enableSystemd" ]
[ "programs" "dankMaterialShell" "systemd" "enable" ]
)
];
options.programs.dankMaterialShell = with lib.types; {
default = {
settings = lib.mkOption {
type = jsonFormat.type;
default = { };
description = "The default settings are only read if the settings.json file don't exist";
};
session = lib.mkOption {
type = jsonFormat.type;
default = { };
description = "The default session are only read if the session.json file don't exist";
};
};
plugins = lib.mkOption {
type = attrsOf (
types.submodule (
{ config, ... }:
{
options = {
enable = lib.mkOption {
type = types.bool;
default = true;
description = "Whether to link this plugin";
};
src = lib.mkOption {
type = types.path;
description = "Source to link to DMS plugins directory";
};
};
}
)
);
default = { };
description = "DMS Plugins to install";
};
};
config = lib.mkIf cfg.enable {
programs.quickshell = {
enable = true;
inherit (cfg.quickshell) package;
configs.dms = common.qmlPath;
};
systemd.user.services.dms = lib.mkIf cfg.systemd.enable {
Unit = {
Description = "DankMaterialShell";
PartOf = [ config.wayland.systemd.target ];
After = [ config.wayland.systemd.target ];
X-Restart-Triggers = lib.optional cfg.systemd.restartIfChanged common.qmlPath;
};
Service = {
ExecStart = lib.getExe dmsPkgs.dms-shell + " run --session";
Restart = "on-failure";
};
Install.WantedBy = [ config.wayland.systemd.target ];
};
xdg.stateFile."DankMaterialShell/default-session.json" = lib.mkIf (cfg.default.session != { }) {
source = jsonFormat.generate "default-session.json" cfg.default.session;
};
xdg.configFile = lib.mkMerge [
(lib.mapAttrs' (name: plugin: {
name = "DankMaterialShell/plugins/${name}";
value.source = plugin.src;
}) (lib.filterAttrs (n: v: v.enable) cfg.plugins))
{
"DankMaterialShell/default-settings.json" = lib.mkIf (cfg.default.settings != { }) {
source = jsonFormat.generate "default-settings.json" cfg.default.settings;
};
}
]; ];
options.programs.dankMaterialShell = with lib.types; { home.packages = common.packages;
default = { };
settings = lib.mkOption {
type = jsonFormat.type;
default = {};
description = "The default settings are only read if the settings.json file don't exist";
};
session = lib.mkOption {
type = jsonFormat.type;
default = {};
description = "The default session are only read if the session.json file don't exist";
};
};
plugins = lib.mkOption {
type = attrsOf (types.submodule ({config, ...}: {
options = {
enable = lib.mkOption {
type = types.bool;
default = true;
description = "Whether to link this plugin";
};
src = lib.mkOption {
type = types.path;
description = "Source to link to DMS plugins directory";
};
};
}));
default = {};
description = "DMS Plugins to install";
};
};
config = lib.mkIf cfg.enable
{
programs.quickshell = {
enable = true;
package = cfg.quickshell.package;
configs.dms = common.qmlPath;
};
systemd.user.services.dms = lib.mkIf cfg.systemd.enable {
Unit = {
Description = "DankMaterialShell";
PartOf = [config.wayland.systemd.target];
After = [config.wayland.systemd.target];
X-Restart-Triggers = lib.optional cfg.systemd.restartIfChanged common.qmlPath;
};
Service = {
ExecStart = lib.getExe dmsPkgs.dms-shell + " run --session";
Restart = "on-failure";
};
Install.WantedBy = [config.wayland.systemd.target];
};
xdg.stateFile."DankMaterialShell/default-session.json" = lib.mkIf (cfg.default.session != {}) {
source = jsonFormat.generate "default-session.json" cfg.default.session;
};
xdg.configFile = lib.mkMerge [
(lib.mapAttrs' (name: plugin: {
name = "DankMaterialShell/plugins/${name}";
value.source = plugin.src;
}) (lib.filterAttrs (n: v: v.enable) cfg.plugins))
{
"DankMaterialShell/default-settings.json" = lib.mkIf (cfg.default.settings != {}) {
source = jsonFormat.generate "default-settings.json" cfg.default.settings;
};
}
];
home.packages = common.packages;
};
} }

View File

@@ -1,105 +1,118 @@
{ {
config, config,
lib, lib,
... ...
}: let }:
cfg = config.programs.dankMaterialShell; let
in { cfg = config.programs.dankMaterialShell;
options.programs.dankMaterialShell = { in
niri = { {
enableKeybinds = lib.mkEnableOption "DankMaterialShell niri keybinds"; options.programs.dankMaterialShell = {
enableSpawn = lib.mkEnableOption "DankMaterialShell niri spawn-at-startup"; niri = {
}; enableKeybinds = lib.mkEnableOption "DankMaterialShell niri keybinds";
enableSpawn = lib.mkEnableOption "DankMaterialShell niri spawn-at-startup";
}; };
};
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
programs.niri.settings = lib.mkMerge [ programs.niri.settings = lib.mkMerge [
(lib.mkIf cfg.niri.enableKeybinds { (lib.mkIf cfg.niri.enableKeybinds {
binds = with config.lib.niri.actions; let binds =
dms-ipc = spawn "dms" "ipc"; with config.lib.niri.actions;
in let
{ dms-ipc = spawn "dms" "ipc";
"Mod+Space" = { in
action = dms-ipc "spotlight" "toggle"; {
hotkey-overlay.title = "Toggle Application Launcher"; "Mod+Space" = {
}; action = dms-ipc "spotlight" "toggle";
"Mod+N" = { hotkey-overlay.title = "Toggle Application Launcher";
action = dms-ipc "notifications" "toggle"; };
hotkey-overlay.title = "Toggle Notification Center"; "Mod+N" = {
}; action = dms-ipc "notifications" "toggle";
"Mod+Comma" = { hotkey-overlay.title = "Toggle Notification Center";
action = dms-ipc "settings" "toggle"; };
hotkey-overlay.title = "Toggle Settings"; "Mod+Comma" = {
}; action = dms-ipc "settings" "toggle";
"Mod+P" = { hotkey-overlay.title = "Toggle Settings";
action = dms-ipc "notepad" "toggle"; };
hotkey-overlay.title = "Toggle Notepad"; "Mod+P" = {
}; action = dms-ipc "notepad" "toggle";
"Super+Alt+L" = { hotkey-overlay.title = "Toggle Notepad";
action = dms-ipc "lock" "lock"; };
hotkey-overlay.title = "Toggle Lock Screen"; "Super+Alt+L" = {
}; action = dms-ipc "lock" "lock";
"Mod+X" = { hotkey-overlay.title = "Toggle Lock Screen";
action = dms-ipc "powermenu" "toggle"; };
hotkey-overlay.title = "Toggle Power Menu"; "Mod+X" = {
}; action = dms-ipc "powermenu" "toggle";
"XF86AudioRaiseVolume" = { hotkey-overlay.title = "Toggle Power Menu";
allow-when-locked = true; };
action = dms-ipc "audio" "increment" "3"; "XF86AudioRaiseVolume" = {
}; allow-when-locked = true;
"XF86AudioLowerVolume" = { action = dms-ipc "audio" "increment" "3";
allow-when-locked = true; };
action = dms-ipc "audio" "decrement" "3"; "XF86AudioLowerVolume" = {
}; allow-when-locked = true;
"XF86AudioMute" = { action = dms-ipc "audio" "decrement" "3";
allow-when-locked = true; };
action = dms-ipc "audio" "mute"; "XF86AudioMute" = {
}; allow-when-locked = true;
"XF86AudioMicMute" = { action = dms-ipc "audio" "mute";
allow-when-locked = true; };
action = dms-ipc "audio" "micmute"; "XF86AudioMicMute" = {
}; allow-when-locked = true;
"Mod+Alt+N" = { action = dms-ipc "audio" "micmute";
allow-when-locked = true; };
action = dms-ipc "night" "toggle"; "Mod+Alt+N" = {
hotkey-overlay.title = "Toggle Night Mode"; allow-when-locked = true;
}; action = dms-ipc "night" "toggle";
} hotkey-overlay.title = "Toggle Night Mode";
// lib.attrsets.optionalAttrs cfg.enableSystemMonitoring { };
"Mod+M" = { }
action = dms-ipc "processlist" "toggle"; // lib.attrsets.optionalAttrs cfg.enableSystemMonitoring {
hotkey-overlay.title = "Toggle Process List"; "Mod+M" = {
}; action = dms-ipc "processlist" "toggle";
} hotkey-overlay.title = "Toggle Process List";
// lib.attrsets.optionalAttrs cfg.enableClipboard { };
"Mod+V" = { }
action = dms-ipc "clipboard" "toggle"; // lib.attrsets.optionalAttrs cfg.enableClipboard {
hotkey-overlay.title = "Toggle Clipboard Manager"; "Mod+V" = {
}; action = dms-ipc "clipboard" "toggle";
} hotkey-overlay.title = "Toggle Clipboard Manager";
// lib.attrsets.optionalAttrs cfg.enableBrightnessControl { };
"XF86MonBrightnessUp" = { }
allow-when-locked = true; // lib.attrsets.optionalAttrs cfg.enableBrightnessControl {
action = dms-ipc "brightness" "increment" "5" ""; "XF86MonBrightnessUp" = {
}; allow-when-locked = true;
"XF86MonBrightnessDown" = { action = dms-ipc "brightness" "increment" "5" "";
allow-when-locked = true; };
action = dms-ipc "brightness" "decrement" "5" ""; "XF86MonBrightnessDown" = {
}; allow-when-locked = true;
}; action = dms-ipc "brightness" "decrement" "5" "";
}) };
};
})
(lib.mkIf cfg.niri.enableSpawn { (lib.mkIf cfg.niri.enableSpawn {
spawn-at-startup = spawn-at-startup = [
[ {
{command = ["dms" "run"];} command = [
] "dms"
++ lib.optionals cfg.enableClipboard [ "run"
{ ];
command = ["wl-paste" "--watch" "cliphist" "store"]; }
} ]
]; ++ lib.optionals cfg.enableClipboard [
}) {
command = [
"wl-paste"
"--watch"
"cliphist"
"store"
];
}
]; ];
}; })
];
};
} }

View File

@@ -1,36 +1,44 @@
{ {
config, config,
pkgs, pkgs,
lib, lib,
dmsPkgs, dmsPkgs,
... ...
} @ args: let }@args:
cfg = config.programs.dankMaterialShell; let
common = import ./common.nix {inherit config pkgs lib dmsPkgs;}; cfg = config.programs.dankMaterialShell;
in { common = import ./common.nix {
imports = [ inherit
(import ./options.nix args) config
]; pkgs
lib
dmsPkgs
;
};
in
{
imports = [
(import ./options.nix args)
];
config = lib.mkIf cfg.enable config = lib.mkIf cfg.enable {
{ environment.etc."xdg/quickshell/dms".source = "${dmsPkgs.dms-shell}/share/quickshell/dms";
environment.etc."xdg/quickshell/dms".source = "${dmsPkgs.dms-shell}/share/quickshell/dms";
systemd.user.services.dms = lib.mkIf cfg.systemd.enable { systemd.user.services.dms = lib.mkIf cfg.systemd.enable {
description = "DankMaterialShell"; description = "DankMaterialShell";
path = lib.mkForce []; path = lib.mkForce [ ];
partOf = ["graphical-session.target"]; partOf = [ "graphical-session.target" ];
after = ["graphical-session.target"]; after = [ "graphical-session.target" ];
wantedBy = ["graphical-session.target"]; wantedBy = [ "graphical-session.target" ];
restartTriggers = lib.optional cfg.systemd.restartIfChanged common.qmlPath; restartTriggers = lib.optional cfg.systemd.restartIfChanged common.qmlPath;
serviceConfig = { serviceConfig = {
ExecStart = lib.getExe dmsPkgs.dms-shell + " run --session"; ExecStart = lib.getExe dmsPkgs.dms-shell + " run --session";
Restart = "on-failure"; Restart = "on-failure";
}; };
};
environment.systemPackages = [cfg.quickshell.package] ++ common.packages;
}; };
environment.systemPackages = [ cfg.quickshell.package ] ++ common.packages;
};
} }

View File

@@ -1,70 +1,72 @@
{ {
lib, lib,
dmsPkgs, dmsPkgs,
... ...
}: let }:
inherit (lib) types; let
in { inherit (lib) types;
options.programs.dankMaterialShell = { in
enable = lib.mkEnableOption "DankMaterialShell"; {
options.programs.dankMaterialShell = {
enable = lib.mkEnableOption "DankMaterialShell";
systemd = { systemd = {
enable = lib.mkEnableOption "DankMaterialShell systemd startup"; enable = lib.mkEnableOption "DankMaterialShell systemd startup";
restartIfChanged = lib.mkOption { restartIfChanged = lib.mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
description = "Auto-restart dms.service when dankMaterialShell changes"; description = "Auto-restart dms.service when dankMaterialShell changes";
}; };
};
enableSystemMonitoring = lib.mkOption {
type = types.bool;
default = true;
description = "Add needed dependencies to use system monitoring widgets";
};
enableClipboard = lib.mkOption {
type = types.bool;
default = true;
description = "Add needed dependencies to use the clipboard widget";
};
enableVPN = lib.mkOption {
type = types.bool;
default = true;
description = "Add needed dependencies to use the VPN widget";
};
enableBrightnessControl = lib.mkOption {
type = types.bool;
default = true;
description = "Add needed dependencies to have brightness/backlight support";
};
enableColorPicker = lib.mkOption {
type = types.bool;
default = true;
description = "Add needed dependencies to have color picking support";
};
enableDynamicTheming = lib.mkOption {
type = types.bool;
default = true;
description = "Add needed dependencies to have dynamic theming support";
};
enableAudioWavelength = lib.mkOption {
type = types.bool;
default = true;
description = "Add needed dependencies to have audio wavelength support";
};
enableCalendarEvents = lib.mkOption {
type = types.bool;
default = true;
description = "Add calendar events support via khal";
};
enableSystemSound = lib.mkOption {
type = types.bool;
default = true;
description = "Add needed dependencies to have system sound support";
};
quickshell = {
package = lib.mkPackageOption dmsPkgs "quickshell" {
extraDescription = "The quickshell package to use (defaults to be built from source, in the commit 26531f due to unreleased features used by DMS).";
};
};
}; };
enableSystemMonitoring = lib.mkOption {
type = types.bool;
default = true;
description = "Add needed dependencies to use system monitoring widgets";
};
enableClipboard = lib.mkOption {
type = types.bool;
default = true;
description = "Add needed dependencies to use the clipboard widget";
};
enableVPN = lib.mkOption {
type = types.bool;
default = true;
description = "Add needed dependencies to use the VPN widget";
};
enableBrightnessControl = lib.mkOption {
type = types.bool;
default = true;
description = "Add needed dependencies to have brightness/backlight support";
};
enableColorPicker = lib.mkOption {
type = types.bool;
default = true;
description = "Add needed dependencies to have color picking support";
};
enableDynamicTheming = lib.mkOption {
type = types.bool;
default = true;
description = "Add needed dependencies to have dynamic theming support";
};
enableAudioWavelength = lib.mkOption {
type = types.bool;
default = true;
description = "Add needed dependencies to have audio wavelength support";
};
enableCalendarEvents = lib.mkOption {
type = types.bool;
default = true;
description = "Add calendar events support via khal";
};
enableSystemSound = lib.mkOption {
type = types.bool;
default = true;
description = "Add needed dependencies to have system sound support";
};
quickshell = {
package = lib.mkPackageOption dmsPkgs "quickshell" {
extraDescription = "The quickshell package to use (defaults to be built from source, in the commit 26531f due to unreleased features used by DMS).";
};
};
};
} }

287
flake.nix
View File

@@ -1,167 +1,178 @@
{ {
description = "Dank Material Shell"; description = "Dank Material Shell";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
dgop = { dgop = {
url = "github:AvengeMedia/dgop"; url = "github:AvengeMedia/dgop";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
};
quickshell = {
url = "git+https://git.outfoxxed.me/quickshell/quickshell?rev=26531fc46ef17e9365b03770edd3fb9206fcb460";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
quickshell = {
url = "git+https://git.outfoxxed.me/quickshell/quickshell?rev=26531fc46ef17e9365b03770edd3fb9206fcb460";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { outputs =
self, {
nixpkgs, self,
dgop, nixpkgs,
quickshell, dgop,
... quickshell,
}: let ...
forEachSystem = fn: }:
nixpkgs.lib.genAttrs ["aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux"] ( let
system: fn system nixpkgs.legacyPackages.${system} forEachSystem =
); fn:
buildDmsPkgs = pkgs: { nixpkgs.lib.genAttrs [ "aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux" ] (
dms-shell = self.packages.${pkgs.stdenv.hostPlatform.system}.default; system: fn system nixpkgs.legacyPackages.${system}
dgop = dgop.packages.${pkgs.stdenv.hostPlatform.system}.dgop; );
quickshell = quickshell.packages.${pkgs.stdenv.hostPlatform.system}.default; buildDmsPkgs = pkgs: {
dms-shell = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
inherit (dgop.packages.${pkgs.stdenv.hostPlatform.system}) dgop;
quickshell = quickshell.packages.${pkgs.stdenv.hostPlatform.system}.default;
};
mkModuleWithDmsPkgs =
path:
args@{ pkgs, ... }:
{
imports = [
(import path (args // { dmsPkgs = buildDmsPkgs pkgs; }))
];
}; };
mkModuleWithDmsPkgs = path: args @ {pkgs, ...}: { in
imports = [ {
(import path (args // {dmsPkgs = buildDmsPkgs pkgs;})) packages = forEachSystem (
system: pkgs:
let
mkDate =
longDate:
pkgs.lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]; ];
}; version =
in { pkgs.lib.removePrefix "v" (pkgs.lib.trim (builtins.readFile ./quickshell/VERSION))
formatter = forEachSystem (_: pkgs: pkgs.alejandra); + "+date="
+ mkDate (self.lastModifiedDate or "19700101")
+ "_"
+ (self.shortRev or "dirty");
in
{
dms-shell = pkgs.buildGoModule (
let
rootSrc = ./.;
in
{
inherit version;
pname = "dms-shell";
src = ./core;
vendorHash = "sha256-2PCqiW4frxME8IlmwWH5ktznhd/G1bah5Ae4dp0HPTQ=";
packages = forEachSystem ( subPackages = [ "cmd/dms" ];
system: pkgs: let
mkDate = longDate:
pkgs.lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
];
version =
pkgs.lib.removePrefix "v" (pkgs.lib.trim (builtins.readFile ./quickshell/VERSION))
+ "+date="
+ mkDate (self.lastModifiedDate or "19700101")
+ "_"
+ (self.shortRev or "dirty");
in {
dms-shell = pkgs.buildGoModule (
let
rootSrc = ./.;
in {
inherit version;
pname = "dms-shell";
src = ./core;
vendorHash = "sha256-2PCqiW4frxME8IlmwWH5ktznhd/G1bah5Ae4dp0HPTQ=";
subPackages = ["cmd/dms"]; ldflags = [
"-s"
"-w"
"-X main.Version=${version}"
];
ldflags = [ nativeBuildInputs = with pkgs; [
"-s" installShellFiles
"-w" makeWrapper
"-X main.Version=${version}" ];
];
nativeBuildInputs = with pkgs; [ postInstall = ''
installShellFiles mkdir -p $out/share/quickshell/dms
makeWrapper cp -r ${rootSrc}/quickshell/. $out/share/quickshell/dms/
];
postInstall = '' chmod u+w $out/share/quickshell/dms/VERSION
mkdir -p $out/share/quickshell/dms echo "${version}" > $out/share/quickshell/dms/VERSION
cp -r ${rootSrc}/quickshell/. $out/share/quickshell/dms/
chmod u+w $out/share/quickshell/dms/VERSION # Install desktop file and icon
echo "${version}" > $out/share/quickshell/dms/VERSION install -D ${rootSrc}/assets/dms-open.desktop \
$out/share/applications/dms-open.desktop
install -D ${rootSrc}/core/assets/danklogo.svg \
$out/share/hicolor/scalable/apps/danklogo.svg
# Install desktop file and icon wrapProgram $out/bin/dms --add-flags "-c $out/share/quickshell/dms"
install -D ${rootSrc}/assets/dms-open.desktop \
$out/share/applications/dms-open.desktop
install -D ${rootSrc}/core/assets/danklogo.svg \
$out/share/hicolor/scalable/apps/danklogo.svg
wrapProgram $out/bin/dms --add-flags "-c $out/share/quickshell/dms" install -Dm644 ${rootSrc}/assets/systemd/dms.service \
$out/lib/systemd/user/dms.service
install -Dm644 ${rootSrc}/assets/systemd/dms.service \ substituteInPlace $out/lib/systemd/user/dms.service \
$out/lib/systemd/user/dms.service --replace-fail /usr/bin/dms $out/bin/dms \
--replace-fail /usr/bin/pkill ${pkgs.procps}/bin/pkill
substituteInPlace $out/lib/systemd/user/dms.service \ substituteInPlace $out/share/quickshell/dms/Modules/Greetd/assets/dms-greeter \
--replace-fail /usr/bin/dms $out/bin/dms \ --replace-fail /bin/bash ${pkgs.bashInteractive}/bin/bash
--replace-fail /usr/bin/pkill ${pkgs.procps}/bin/pkill
substituteInPlace $out/share/quickshell/dms/Modules/Greetd/assets/dms-greeter \ substituteInPlace $out/share/quickshell/dms/assets/pam/fprint \
--replace-fail /bin/bash ${pkgs.bashInteractive}/bin/bash --replace-fail pam_fprintd.so ${pkgs.fprintd}/lib/security/pam_fprintd.so
substituteInPlace $out/share/quickshell/dms/assets/pam/fprint \ installShellCompletion --cmd dms \
--replace-fail pam_fprintd.so ${pkgs.fprintd}/lib/security/pam_fprintd.so --bash <($out/bin/dms completion bash) \
--fish <($out/bin/dms completion fish) \
--zsh <($out/bin/dms completion zsh)
'';
installShellCompletion --cmd dms \ meta = {
--bash <($out/bin/dms completion bash) \ description = "Desktop shell for wayland compositors built with Quickshell & GO";
--fish <($out/bin/dms completion fish) \ homepage = "https://danklinux.com";
--zsh <($out/bin/dms completion zsh) changelog = "https://github.com/AvengeMedia/DankMaterialShell/releases/tag/v${version}";
''; license = pkgs.lib.licenses.mit;
mainProgram = "dms";
meta = { platforms = pkgs.lib.platforms.linux;
description = "Desktop shell for wayland compositors built with Quickshell & GO"; };
homepage = "https://danklinux.com";
changelog = "https://github.com/AvengeMedia/DankMaterialShell/releases/tag/v${version}";
license = pkgs.lib.licenses.mit;
mainProgram = "dms";
platforms = pkgs.lib.platforms.linux;
};
}
);
default = self.packages.${system}.dms-shell;
} }
); );
homeModules.dankMaterialShell.default = mkModuleWithDmsPkgs ./distro/nix/home.nix; default = self.packages.${system}.dms-shell;
}
);
homeModules.dankMaterialShell.niri = import ./distro/nix/niri.nix; homeModules.dankMaterialShell.default = mkModuleWithDmsPkgs ./distro/nix/home.nix;
nixosModules.dankMaterialShell = mkModuleWithDmsPkgs ./distro/nix/nixos.nix; homeModules.dankMaterialShell.niri = import ./distro/nix/niri.nix;
nixosModules.greeter = mkModuleWithDmsPkgs ./distro/nix/greeter.nix; nixosModules.dankMaterialShell = mkModuleWithDmsPkgs ./distro/nix/nixos.nix;
devShells = forEachSystem ( nixosModules.greeter = mkModuleWithDmsPkgs ./distro/nix/greeter.nix;
system: pkgs: let
qmlPkgs =
[
quickshell.packages.${system}.default
]
++ (with pkgs.kdePackages; [
qtdeclarative
kirigami.unwrapped
sonnet
qtmultimedia
]);
in {
default = pkgs.mkShell {
buildInputs = with pkgs;
[
go_1_24
gopls
delve
go-tools
gnumake
]
++ qmlPkgs;
shellHook = '' devShells = forEachSystem (
touch quickshell/.qmlls.ini 2>/dev/null system: pkgs:
''; let
qmlPkgs = [
quickshell.packages.${system}.default
]
++ (with pkgs.kdePackages; [
qtdeclarative
kirigami.unwrapped
sonnet
qtmultimedia
]);
in
{
default = pkgs.mkShell {
buildInputs =
with pkgs;
[
go_1_24
gopls
delve
go-tools
gnumake
]
++ qmlPkgs;
QML2_IMPORT_PATH = pkgs.lib.concatStringsSep ":" (map (o: "${o}/lib/qt-6/qml") qmlPkgs); shellHook = ''
}; touch quickshell/.qmlls.ini 2>/dev/null
} '';
);
QML2_IMPORT_PATH = pkgs.lib.concatStringsSep ":" (map (o: "${o}/lib/qt-6/qml") qmlPkgs);
};
}
);
}; };
} }