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,
lib,
pkgs,
dmsPkgs,
...
}: let
cfg = config.programs.dankMaterialShell;
in {
qmlPath = "${dmsPkgs.dms-shell}/share/quickshell/dms";
config,
lib,
pkgs,
dmsPkgs,
...
}:
let
cfg = config.programs.dankMaterialShell;
in
{
qmlPath = "${dmsPkgs.dms-shell}/share/quickshell/dms";
packages =
[
pkgs.material-symbols
pkgs.inter
pkgs.fira-code
packages = [
pkgs.material-symbols
pkgs.inter
pkgs.fira-code
pkgs.ddcutil
pkgs.libsForQt5.qt5ct
pkgs.kdePackages.qt6ct
pkgs.ddcutil
pkgs.libsForQt5.qt5ct
pkgs.kdePackages.qt6ct
dmsPkgs.dms-shell
]
++ lib.optional cfg.enableSystemMonitoring dmsPkgs.dgop
++ lib.optionals cfg.enableClipboard [pkgs.cliphist pkgs.wl-clipboard]
++ lib.optionals cfg.enableVPN [pkgs.glib pkgs.networkmanager]
++ 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;
dmsPkgs.dms-shell
]
++ lib.optional cfg.enableSystemMonitoring dmsPkgs.dgop
++ lib.optionals cfg.enableClipboard [
pkgs.cliphist
pkgs.wl-clipboard
]
++ lib.optionals cfg.enableVPN [
pkgs.glib
pkgs.networkmanager
]
++ 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,
config,
pkgs,
dmsPkgs,
...
}: let
inherit (lib) types;
cfg = config.programs.dankMaterialShell.greeter;
lib,
config,
pkgs,
dmsPkgs,
...
}:
let
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";
greeterScript = pkgs.writeShellScriptBin "dms-greeter" ''
export PATH=$PATH:${lib.makeBinPath [cfg.quickshell.package config.programs.${cfg.compositor.name}.package]}
${lib.escapeShellArgs ([
"sh"
"${../../quickshell/Modules/Greetd/assets/dms-greeter}"
"--cache-dir"
cacheDir
"--command"
cfg.compositor.name
"-p"
"${dmsPkgs.dms-shell}/share/quickshell/dms"
cacheDir = "/var/lib/dms-greeter";
greeterScript = pkgs.writeShellScriptBin "dms-greeter" ''
export PATH=$PATH:${
lib.makeBinPath [
cfg.quickshell.package
config.programs.${cfg.compositor.name}.package
]
}
${
lib.escapeShellArgs (
[
"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 != "") [
"-C"
"${pkgs.writeText "dmsgreeter-compositor-config" cfg.compositor.customConfig}"
])} ${lib.optionalString cfg.logs.save "> ${cfg.logs.path} 2>&1"}
'';
"-C"
"${pkgs.writeText "dmsgreeter-compositor-config" cfg.compositor.customConfig}"
]
)
} ${lib.optionalString cfg.logs.save "> ${cfg.logs.path} 2>&1"}
'';
jq = lib.getExe pkgs.jq;
in {
imports = 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)];
jq = lib.getExe pkgs.jq;
in
{
imports =
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 = {
enable = lib.mkEnableOption "DankMaterialShell greeter";
compositor.name = lib.mkOption {
type = types.enum ["niri" "hyprland" "sway" "scroll"];
description = "Compositor to run greeter in";
};
compositor.customConfig = lib.mkOption {
type = types.lines;
default = "";
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
'';
};
options.programs.dankMaterialShell.greeter = {
enable = lib.mkEnableOption "DankMaterialShell greeter";
compositor.name = lib.mkOption {
type = types.enum [
"niri"
"hyprland"
"sway"
];
description = "Compositor to run greeter in";
};
config = lib.mkIf cfg.enable {
assertions = [
{
assertion = (config.users.users.${user} or {}) != {};
message = ''
dmsgreeter: user set for greetd default_session ${user} does not exist. Please create it before referencing it.
'';
}
];
services.greetd = {
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 = {
user = 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}: * || :
compositor.customConfig = lib.mkOption {
type = types.lines;
default = "";
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 {
assertions = [
{
assertion = (config.users.users.${user} or { }) != { };
message = ''
dmsgreeter: user set for greetd default_session ${user} does not exist. Please create it before referencing it.
'';
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"
];
}
];
services.greetd = {
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,
pkgs,
lib,
dmsPkgs,
...
} @ args: let
cfg = config.programs.dankMaterialShell;
jsonFormat = pkgs.formats.json {};
common = import ./common.nix {inherit config pkgs 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"])
config,
pkgs,
lib,
dmsPkgs,
...
}@args:
let
cfg = config.programs.dankMaterialShell;
jsonFormat = pkgs.formats.json { };
common = import ./common.nix {
inherit
config
pkgs
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; {
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;
};
home.packages = common.packages;
};
}

View File

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

View File

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

View File

@@ -1,70 +1,72 @@
{
lib,
dmsPkgs,
...
}: let
inherit (lib) types;
in {
options.programs.dankMaterialShell = {
enable = lib.mkEnableOption "DankMaterialShell";
lib,
dmsPkgs,
...
}:
let
inherit (lib) types;
in
{
options.programs.dankMaterialShell = {
enable = lib.mkEnableOption "DankMaterialShell";
systemd = {
enable = lib.mkEnableOption "DankMaterialShell systemd startup";
restartIfChanged = lib.mkOption {
type = types.bool;
default = true;
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).";
};
};
systemd = {
enable = lib.mkEnableOption "DankMaterialShell systemd startup";
restartIfChanged = lib.mkOption {
type = types.bool;
default = true;
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).";
};
};
};
}

287
flake.nix
View File

@@ -1,167 +1,178 @@
{
description = "Dank Material Shell";
description = "Dank Material Shell";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
dgop = {
url = "github:AvengeMedia/dgop";
inputs.nixpkgs.follows = "nixpkgs";
};
quickshell = {
url = "git+https://git.outfoxxed.me/quickshell/quickshell?rev=26531fc46ef17e9365b03770edd3fb9206fcb460";
inputs.nixpkgs.follows = "nixpkgs";
};
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
dgop = {
url = "github:AvengeMedia/dgop";
inputs.nixpkgs.follows = "nixpkgs";
};
quickshell = {
url = "git+https://git.outfoxxed.me/quickshell/quickshell?rev=26531fc46ef17e9365b03770edd3fb9206fcb460";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
dgop,
quickshell,
...
}: let
forEachSystem = fn:
nixpkgs.lib.genAttrs ["aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux"] (
system: fn system nixpkgs.legacyPackages.${system}
);
buildDmsPkgs = pkgs: {
dms-shell = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
dgop = dgop.packages.${pkgs.stdenv.hostPlatform.system}.dgop;
quickshell = quickshell.packages.${pkgs.stdenv.hostPlatform.system}.default;
outputs =
{
self,
nixpkgs,
dgop,
quickshell,
...
}:
let
forEachSystem =
fn:
nixpkgs.lib.genAttrs [ "aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux" ] (
system: fn system nixpkgs.legacyPackages.${system}
);
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, ...}: {
imports = [
(import path (args // {dmsPkgs = buildDmsPkgs pkgs;}))
in
{
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)
];
};
in {
formatter = forEachSystem (_: pkgs: pkgs.alejandra);
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=";
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 =
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" ];
subPackages = ["cmd/dms"];
ldflags = [
"-s"
"-w"
"-X main.Version=${version}"
];
ldflags = [
"-s"
"-w"
"-X main.Version=${version}"
];
nativeBuildInputs = with pkgs; [
installShellFiles
makeWrapper
];
nativeBuildInputs = with pkgs; [
installShellFiles
makeWrapper
];
postInstall = ''
mkdir -p $out/share/quickshell/dms
cp -r ${rootSrc}/quickshell/. $out/share/quickshell/dms/
postInstall = ''
mkdir -p $out/share/quickshell/dms
cp -r ${rootSrc}/quickshell/. $out/share/quickshell/dms/
chmod u+w $out/share/quickshell/dms/VERSION
echo "${version}" > $out/share/quickshell/dms/VERSION
chmod u+w $out/share/quickshell/dms/VERSION
echo "${version}" > $out/share/quickshell/dms/VERSION
# Install desktop file and icon
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
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"
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 \
$out/lib/systemd/user/dms.service
substituteInPlace $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 \
--replace-fail /usr/bin/dms $out/bin/dms \
--replace-fail /usr/bin/pkill ${pkgs.procps}/bin/pkill
substituteInPlace $out/share/quickshell/dms/Modules/Greetd/assets/dms-greeter \
--replace-fail /bin/bash ${pkgs.bashInteractive}/bin/bash
substituteInPlace $out/share/quickshell/dms/Modules/Greetd/assets/dms-greeter \
--replace-fail /bin/bash ${pkgs.bashInteractive}/bin/bash
substituteInPlace $out/share/quickshell/dms/assets/pam/fprint \
--replace-fail pam_fprintd.so ${pkgs.fprintd}/lib/security/pam_fprintd.so
substituteInPlace $out/share/quickshell/dms/assets/pam/fprint \
--replace-fail pam_fprintd.so ${pkgs.fprintd}/lib/security/pam_fprintd.so
installShellCompletion --cmd dms \
--bash <($out/bin/dms completion bash) \
--fish <($out/bin/dms completion fish) \
--zsh <($out/bin/dms completion zsh)
'';
installShellCompletion --cmd dms \
--bash <($out/bin/dms completion bash) \
--fish <($out/bin/dms completion fish) \
--zsh <($out/bin/dms completion zsh)
'';
meta = {
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;
meta = {
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;
};
}
);
);
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 (
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;
nixosModules.greeter = mkModuleWithDmsPkgs ./distro/nix/greeter.nix;
shellHook = ''
touch quickshell/.qmlls.ini 2>/dev/null
'';
devShells = forEachSystem (
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);
};
}
);
};
}