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";
# 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
cfg = config.programs.dankMaterialShell;
cfg = config.programs.dank-material-shell;
in
{
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
inherit (lib) types;
cfg = config.programs.dankMaterialShell.greeter;
cfg = config.programs.dank-material-shell.greeter;
inherit (config.services.greetd.settings.default_session) user;
@@ -44,19 +44,20 @@ in
{
imports =
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
[
(lib.mkRemovedOptionModule [
"programs"
"dankMaterialShell"
"dank-material-shell"
"greeter"
"compositor"
"extraConfig"
] msg)
./dms-rename.nix
];
options.programs.dankMaterialShell.greeter = {
options.programs.dank-material-shell.greeter = {
enable = lib.mkEnableOption "DankMaterialShell greeter";
compositor.name = lib.mkOption {
type = types.enum [
@@ -177,7 +178,7 @@ in
mv dms-colors.json colors.json || :
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}/.local/state/DankMaterialShell/session.json"
"${cfg.configHome}/.cache/DankMaterialShell/dms-colors.json"

View File

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

View File

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

View File

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

View File

@@ -7,7 +7,7 @@ let
inherit (lib) types;
path = [
"programs"
"dankMaterialShell"
"dank-material-shell"
];
builtInRemovedMsg = "This is now built-in in DMS and doesn't need additional dependencies.";
@@ -20,16 +20,17 @@ in
(lib.mkRemovedOptionModule (
path ++ [ "enableSystemSound" ]
) "qtmultimedia is now included on dms-shell package.")
./dms-rename.nix
];
options.programs.dankMaterialShell = {
options.programs.dank-material-shell = {
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";
description = "Auto-restart dms.service when dank-material-shell changes";
};
};
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.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 (
system: pkgs:
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:
```nix
imports = [
inputs.dankMaterialShell.nixosModules.greeter
inputs.dank-material-shell.nixosModules.greeter
]
```
Enable the greeter with this in your NixOS config:
```nix
programs.dankMaterialShell.greeter = {
programs.dank-material-shell.greeter = {
enable = true;
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