Progress on desktop system, added integration with nixgreety

This commit is contained in:
Jan-Bulthuis 2025-02-23 14:51:56 +01:00
parent 86b8a5571b
commit 63093d8a87
6 changed files with 134 additions and 20 deletions

View File

@ -32,6 +32,7 @@ in
programs.waybar = { programs.waybar = {
enable = true; enable = true;
systemd.enable = false;
settings = { settings = {
mainBar = { mainBar = {
layer = "top"; layer = "top";

View File

@ -20,12 +20,6 @@ in
options.modules.desktop = { options.modules.desktop = {
wayland = mkEnableOption "wayland"; wayland = mkEnableOption "wayland";
# TODO: Remove, not needed with session/display manager
initScript = mkOption {
type = types.lines;
default = "${pkgs.bash}/bin/bash";
description = "Bash script to execute after logging in.";
};
# TODO: Find a nicer way to do this as this is also executed on startup # TODO: Find a nicer way to do this as this is also executed on startup
reloadScript = mkOption { reloadScript = mkOption {
type = types.lines; type = types.lines;
@ -69,16 +63,16 @@ in
); );
}; };
home.file.".initrc" = { # home.file.".initrc" = {
enable = true; # enable = true;
executable = true; # executable = true;
text = # text =
'' # ''
#!${pkgs.bash}/bin/bash # #!${pkgs.bash}/bin/bash
'' # ''
+ cfg.initScript; # + cfg.initScript;
}; # };
} }
( (
# TODO: Move to dedicated module within desktop or maybe theming? # TODO: Move to dedicated module within desktop or maybe theming?

View File

@ -16,7 +16,7 @@ in
# modules.desktop.x11 = true; # modules.desktop.x11 = true;
modules.rofi.enable = true; modules.rofi.enable = true;
modules.desktop.initScript = '' desktop.initScript = ''
i3 i3
''; '';

View File

@ -32,10 +32,13 @@ in
]; ];
# Change desktop to execute river # Change desktop to execute river
modules.desktop.initScript = '' desktop.initScript = ''
river ${pkgs.dbus}/bin/dbus-run-session ${pkgs.river}/bin/river
''; '';
desktop.session.type = "wayland";
desktop.session.desktop = "river";
# TODO: Fix this # TODO: Fix this
# modules.desktop.reloadScript = '' # modules.desktop.reloadScript = ''
# ${pkgs.river}/bin/riverctl background-color 0x${config.theming.colors.bg} # ${pkgs.river}/bin/riverctl background-color 0x${config.theming.colors.bg}
@ -62,6 +65,7 @@ in
wayland.windowManager.river = { wayland.windowManager.river = {
enable = true; enable = true;
xwayland.enable = false; xwayland.enable = false;
systemd.enable = false;
settings = settings =
let let
layout = "filtile"; layout = "filtile";

View File

@ -1,8 +1,124 @@
{ ... }: {
lib,
config,
pkgs,
...
}:
with lib;
let
# Desktop configuration module
desktopConfigurationModule = types.submodule {
options = {
name = mkOption {
type = types.str;
description = "Desktop environment name.";
};
type = mkOption {
type = types.enum [
"custom"
"gnome"
];
description = "Desktop environment type.";
};
config = mkOption {
type = types.attrs;
default = { };
description = "Desktop environment configuration";
};
extraConfig = mkOption {
type = types.attrs;
default = { };
description = "Extra configuration for the configured desktop environment";
};
};
};
customBuilder = config: {
configuration = recursiveUpdate { desktop.name = config.name; } config.extraConfig;
};
# Environment builders
environmentBuilders = {
custom = customBuilder;
};
cfg = config.desktop;
in
{ {
imports = [ imports = [
./custom/default.nix ./custom/default.nix
./theming/default.nix ./theming/default.nix
]; ];
options.desktop = {
name = mkOption {
type = types.str;
default = "Shell";
description = "Desktop configuration name.";
};
initScript = mkOption {
type = types.lines;
default = ''
${pkgs.ncurses}/bin/clear
${pkgs.bashInteractive}/bin/bash
'';
description = "Bash script to execute after logging in.";
};
session = {
type = mkOption {
type = types.enum [
"wayland"
"x11"
"tty"
];
default = "tty";
description = "Session type.";
};
desktop = mkOption {
type = types.str;
default = "tty";
description = "Desktop environment name.";
};
};
environments = mkOption {
type = types.attrsOf desktopConfigurationModule;
default = { };
description = "Desktop environments. Every environment will be built as a specialization.";
};
};
config = {
specialisation = mapAttrs (
name: value: (environmentBuilders."${value.type}" value)
) cfg.environments;
# Create session files
home.extraBuilderCommands = ''
mkdir $out/session
echo "${cfg.name}" > $out/session/name
ln -s ${
pkgs.writeTextFile {
name = "desktop-init";
text =
''
#!${pkgs.bash}/bin/bash
''
+ cfg.initScript;
executable = true;
}
} $out/session/init
ln -s ${
pkgs.writeTextFile {
name = "session-env";
text = ''
XDG_SESSION_TYPE=${cfg.session.type}
XDG_CURRENT_DESKTOP=${cfg.session.desktop}
XDG_SESSION_DESKTOP=${cfg.session.desktop}
'';
}
} $out/session/env
'';
};
} }

View File

@ -10,7 +10,6 @@
layout = "us"; layout = "us";
xkbVariant = ""; xkbVariant = "";
enable = true; enable = true;
windowManager.i3.enable = true;
desktopManager = { desktopManager = {
xterm.enable = true; xterm.enable = true;
xfce = { xfce = {