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

nix: refactor module structure and flake output (#1014)

- The program module is now called dank-material-shell
- The homeModules structure is flattened
This commit is contained in:
musjj
2025-12-17 18:12:30 +07:00
committed by GitHub
parent b7911475b6
commit d082d41ab9
10 changed files with 54 additions and 23 deletions

View File

@@ -163,7 +163,7 @@ quickshell -p quickshell/
inputs.dms.url = "github:AvengeMedia/DankMaterialShell"; inputs.dms.url = "github:AvengeMedia/DankMaterialShell";
# Use in home-manager or NixOS configuration # Use in home-manager or NixOS configuration
imports = [ inputs.dms.homeModules.dankMaterialShell.default ]; imports = [ inputs.dms.homeModules.dank-material-shell ];
} }
``` ```

View File

@@ -6,7 +6,7 @@
... ...
}: }:
let let
cfg = config.programs.dankMaterialShell; cfg = config.programs.dank-material-shell;
in in
{ {
packages = [ packages = [

15
distro/nix/dms-rename.nix Normal file
View File

@@ -0,0 +1,15 @@
{ lib, ... }:
{
imports = [
(lib.mkRenamedOptionModule
[
"programs"
"dankMaterialShell"
]
[
"programs"
"dank-material-shell"
]
)
];
}

View File

@@ -7,7 +7,7 @@
}: }:
let let
inherit (lib) types; inherit (lib) types;
cfg = config.programs.dankMaterialShell.greeter; cfg = config.programs.dank-material-shell.greeter;
inherit (config.services.greetd.settings.default_session) user; inherit (config.services.greetd.settings.default_session) user;
@@ -44,19 +44,20 @@ in
{ {
imports = imports =
let let
msg = "The option 'programs.dankMaterialShell.greeter.compositor.extraConfig' is deprecated. Please use 'programs.dankMaterialShell.greeter.compositor.customConfig' instead."; msg = "The option 'programs.dank-material-shell.greeter.compositor.extraConfig' is deprecated. Please use 'programs.dank-material-shell.greeter.compositor.customConfig' instead.";
in in
[ [
(lib.mkRemovedOptionModule [ (lib.mkRemovedOptionModule [
"programs" "programs"
"dankMaterialShell" "dank-material-shell"
"greeter" "greeter"
"compositor" "compositor"
"extraConfig" "extraConfig"
] msg) ] msg)
./dms-rename.nix
]; ];
options.programs.dankMaterialShell.greeter = { options.programs.dank-material-shell.greeter = {
enable = lib.mkEnableOption "DankMaterialShell greeter"; enable = lib.mkEnableOption "DankMaterialShell greeter";
compositor.name = lib.mkOption { compositor.name = lib.mkOption {
type = types.enum [ type = types.enum [
@@ -177,7 +178,7 @@ in
mv dms-colors.json colors.json || : mv dms-colors.json colors.json || :
chown ${user}: * || : chown ${user}: * || :
''; '';
programs.dankMaterialShell.greeter.configFiles = lib.mkIf (cfg.configHome != null) [ programs.dank-material-shell.greeter.configFiles = lib.mkIf (cfg.configHome != null) [
"${cfg.configHome}/.config/DankMaterialShell/settings.json" "${cfg.configHome}/.config/DankMaterialShell/settings.json"
"${cfg.configHome}/.local/state/DankMaterialShell/session.json" "${cfg.configHome}/.local/state/DankMaterialShell/session.json"
"${cfg.configHome}/.cache/DankMaterialShell/dms-colors.json" "${cfg.configHome}/.cache/DankMaterialShell/dms-colors.json"

View File

@@ -6,7 +6,7 @@
... ...
}@args: }@args:
let let
cfg = config.programs.dankMaterialShell; cfg = config.programs.dank-material-shell;
jsonFormat = pkgs.formats.json { }; jsonFormat = pkgs.formats.json { };
common = import ./common.nix { common = import ./common.nix {
inherit inherit
@@ -22,16 +22,16 @@ in
(import ./options.nix args) (import ./options.nix args)
(lib.mkRemovedOptionModule [ (lib.mkRemovedOptionModule [
"programs" "programs"
"dankMaterialShell" "dank-material-shell"
"enableNightMode" "enableNightMode"
] "Night mode is now always available.") ] "Night mode is now always available.")
(lib.mkRenamedOptionModule (lib.mkRenamedOptionModule
[ "programs" "dankMaterialShell" "enableSystemd" ] [ "programs" "dank-material-shell" "enableSystemd" ]
[ "programs" "dankMaterialShell" "systemd" "enable" ] [ "programs" "dank-material-shell" "systemd" "enable" ]
) )
]; ];
options.programs.dankMaterialShell = with lib.types; { options.programs.dank-material-shell = with lib.types; {
default = { default = {
settings = lib.mkOption { settings = lib.mkOption {
type = jsonFormat.type; type = jsonFormat.type;

View File

@@ -4,10 +4,14 @@
... ...
}: }:
let let
cfg = config.programs.dankMaterialShell; cfg = config.programs.dank-material-shell;
in in
{ {
options.programs.dankMaterialShell = { imports = [
./dms-rename.nix
];
options.programs.dank-material-shell = {
niri = { niri = {
enableKeybinds = lib.mkEnableOption "DankMaterialShell niri keybinds"; enableKeybinds = lib.mkEnableOption "DankMaterialShell niri keybinds";
enableSpawn = lib.mkEnableOption "DankMaterialShell niri spawn-at-startup"; enableSpawn = lib.mkEnableOption "DankMaterialShell niri spawn-at-startup";

View File

@@ -6,7 +6,7 @@
... ...
}@args: }@args:
let let
cfg = config.programs.dankMaterialShell; cfg = config.programs.dank-material-shell;
common = import ./common.nix { common = import ./common.nix {
inherit inherit
config config

View File

@@ -7,7 +7,7 @@ let
inherit (lib) types; inherit (lib) types;
path = [ path = [
"programs" "programs"
"dankMaterialShell" "dank-material-shell"
]; ];
builtInRemovedMsg = "This is now built-in in DMS and doesn't need additional dependencies."; builtInRemovedMsg = "This is now built-in in DMS and doesn't need additional dependencies.";
@@ -20,16 +20,17 @@ in
(lib.mkRemovedOptionModule ( (lib.mkRemovedOptionModule (
path ++ [ "enableSystemSound" ] path ++ [ "enableSystemSound" ]
) "qtmultimedia is now included on dms-shell package.") ) "qtmultimedia is now included on dms-shell package.")
./dms-rename.nix
]; ];
options.programs.dankMaterialShell = { options.programs.dank-material-shell = {
enable = lib.mkEnableOption "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 dank-material-shell changes";
}; };
}; };
enableSystemMonitoring = lib.mkOption { enableSystemMonitoring = lib.mkOption {

View File

@@ -149,14 +149,24 @@
} }
); );
homeModules.dankMaterialShell.default = mkModuleWithDmsPkgs ./distro/nix/home.nix; homeModules.dank-material-shell = mkModuleWithDmsPkgs ./distro/nix/home.nix;
homeModules.dankMaterialShell.niri = import ./distro/nix/niri.nix; homeModules.default = self.homeModules.dank-material-shell;
nixosModules.dankMaterialShell = mkModuleWithDmsPkgs ./distro/nix/nixos.nix; homeModules.niri = import ./distro/nix/niri.nix;
homeModules.dankMaterialShell.default = builtins.warn "dank-material-shell: flake output `homeModules.dankMaterialShell.default` has been renamed to `homeModules.dank-material-shell`" self.homeModules.dank-material-shell;
homeModules.dankMaterialShell.niri = builtins.warn "dank-material-shell: flake output `homeModules.dankMaterialShell.niri` has been renamed to `homeModules.niri`" self.homeModules.niri;
nixosModules.dank-material-shell = mkModuleWithDmsPkgs ./distro/nix/nixos.nix;
nixosModules.default = self.nixosModules.dank-material-shell;
nixosModules.greeter = mkModuleWithDmsPkgs ./distro/nix/greeter.nix; nixosModules.greeter = mkModuleWithDmsPkgs ./distro/nix/greeter.nix;
nixosModules.dankMaterialShell = builtins.warn "dank-material-shell: flake output `nixosModules.dankMaterialShell` has been renamed to `nixosModules.dank-material-shell`" self.nixosModules.dank-material-shell;
devShells = forEachSystem ( devShells = forEachSystem (
system: pkgs: system: pkgs:
let let

View File

@@ -177,13 +177,13 @@ If you prefer the old method with separate shell scripts and config files:
To install the greeter on NixOS add the repo to your flake inputs as described in the readme. Then somewhere in your NixOS config add this to imports: To install the greeter on NixOS add the repo to your flake inputs as described in the readme. Then somewhere in your NixOS config add this to imports:
```nix ```nix
imports = [ imports = [
inputs.dankMaterialShell.nixosModules.greeter inputs.dank-material-shell.nixosModules.greeter
] ]
``` ```
Enable the greeter with this in your NixOS config: Enable the greeter with this in your NixOS config:
```nix ```nix
programs.dankMaterialShell.greeter = { programs.dank-material-shell.greeter = {
enable = true; enable = true;
compositor.name = "niri"; # or set to hyprland compositor.name = "niri"; # or set to hyprland
configHome = "/home/user"; # optionally copyies that users DMS settings (and wallpaper if set) to the greeters data directory as root before greeter starts configHome = "/home/user"; # optionally copyies that users DMS settings (and wallpaper if set) to the greeters data directory as root before greeter starts