Sddm astronaut theme configuration

Hello. i want to customize the theme of my sddm astronaut config, as i was able to get the sddm astronaut theme working through the nixos wiki

the default theme is set to astronaut, and i want to change it to japanese aesthetic. however i have no idea on where to put the code snippet. how to use flakes to make it work or something etc.

this is how i got the theme working,

# Enable the KDE Plasma Desktop Environment.
  services.displayManager.sddm.enable = true;
  services.desktopManager.plasma6.enable = true;

  services.displayManager.sddm = {
    theme = "sddm-astronaut-theme";
    extraPackages = [ pkgs.sddm-astronaut ];
  };

*inside configuration.nix
and im supposed to put this code snippet somewhere and fill it out to customize my theme

let
  sddm-astronaut = (pkgs.sddm-astronaut.override {
    embeddedTheme = "japanese_aesthetic";  # or any other theme
    themeConfig = {
      # Customize colors and settings
      HeaderTextColor = "#d5c4a1";
      Background = "Backgrounds/your-custom-background.png";
      # ... other theme configuration options
    };
  }).overrideAttrs (oldAttrs: {
    # Optional: Inject custom background image
    installPhase = oldAttrs.installPhase + ''
      chmod u+w $out/share/sddm/themes/sddm-astronaut-theme/Backgrounds/
      cp ${./relative/path/to/your-custom-background.png} \
        $out/share/sddm/themes/sddm-astronaut-theme/Backgrounds/your-custom-background.png
    '';
  });
in
{
  environment.systemPackages = [ sddm-astronaut ];
  
  services.displayManager.sddm = {
    enable = true;
    package = pkgs.kdePackages.sddm;
    extraPackages = with pkgs; [
      kdePackages.qtmultimedia # Required for video backgrounds/audio
    ];
    theme = "sddm-astronaut-theme";
  };
}

has anyone done this before so they can give me pointers or something? ive been going on this issue back and forth for like 2 days now

this is the github link GitHub - Keyitdev/sddm-astronaut-theme: Series of modern looking themes for SDDM. · GitHub

Hello. You do not need flakes for this. I suppose you just do not understand code snippet.

let block is the simple construction (the example was taken from Learn X in Y minutes):

  # `let` blocks allow us to bind values to variables.
  (let x = "a"; in
    x + x + x)
  #=> "aaa"

I was wrong. Read my new reply.

Your code:

# DO NOT USE THIS CODE
let
  sddm-astronaut = (pkgs.sddm-astronaut.override {
    embeddedTheme = "japanese_aesthetic";  # or any other theme
# etc...

You are declaring a local variable sddm-astronaut and overriding its embeddedTheme to "japanese_aesthetic".

# DO NOT USE THIS CODE
in
{
  environment.systemPackages = [ sddm-astronaut ];
  
  services.displayManager.sddm = {
    enable = true;
    package = pkgs.kdePackages.sddm;
    extraPackages = with pkgs; [
      kdePackages.qtmultimedia # Required for video backgrounds/audio
    ];
    theme = "sddm-astronaut-theme";
  };
}

Note that in this scope, the sddm-astronaut package has been overridden to use a different theme. The embeddedTheme property of the sddm-astronaut package is now set within this scope to the theme you want. You simply need to enclose your configuration in curly braces.

So

# DO NOT USE THIS CODE
# Enable the KDE Plasma Desktop Environment.
  services.displayManager.sddm.enable = true;
  services.desktopManager.plasma6.enable = true;

  services.displayManager.sddm = {
    theme = "sddm-astronaut-theme";
    extraPackages = [ pkgs.sddm-astronaut ];
  };

becomes

# DO NOT USE THIS CODE
let
  sddm-astronaut = /* Code was omitted */
in
{
  services.displayManager.sddm = {
    enable = true;

    theme = "sddm-astronaut-theme";
    extraPackages = with pkgs; [
      pkgs.sddm-astronaut 
      kdePackages.qtmultimedia # Required for video backgrounds/audio
    ];
  };
}

services.desktopManager.plasma6.enable = true;

Note that the line services.desktopManager.plasma6.enable = true; is outside the curly braces because it does not use the sddm-astronaut variable. Only code that uses the sddm-astronaut variable should be inside the curly braces.

Also, to simplify the configuration, you can move the line services.displayManager.sddm.enable = true; to the services.displayManager.sddm section. The line will be enable = true; that is what I did.

P.S. Please let me know if this worked. I have not tested this configuration, but I think this code should help you.

Useful links:

for some reason, this syntax is invalid and i cant figure out why. the line after in has a { bracket and ruins the other code later down the line.

    sddm-astronaut = sddm-astronaut = (pkgs.sddm-astronaut.override {
      embeddedTheme = "japanese_aesthetic";
    });
  in
  {
    services.displayManager.sddm = {
      enable = true;

      theme = "sddm-astronaut-theme";
      extraPackages = with pkgs; [
        pkgs.sddm-astronaut 
        kdePackages.qtmultimedia # Required for video backgrounds/audio
      ];
    };
  }

so i had changed it to this

    sddm-astronaut = (pkgs.sddm-astronaut.override {
      embeddedTheme = "japanese_aesthetic";  # or any other theme
      themeConfig = {
        # Customize colors and settings
        HeaderTextColor = "#d5c4a1";
        Background = "/home/ebu/Downloads/dominik-mayer-6.jpg";
        # ... other theme configuration options
    };
  }).
  in
  {
    services.displayManager.sddm = {
      enable = true;

      theme = "sddm-astronaut-theme";
      extraPackages = with pkgs; [
        pkgs.sddm-astronaut
        kdePackages.qtmultimedia # Required for video backgrounds/audio
      ];
    };
  };

  services.desktopManager.plasma6.enable = true;

however, whenever i run sudo nixos-rebuild switch i get an error,
error: syntax error, unexpected 'let', expecting 'inherit'
but in the ide everything looks good?

I am sorry. Please do not follow my previous answer, it is incorrect. Let blocks are little bit different (a relevant question).

Here is the correct configuration:

# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

# My NixOS configuration
{ config, pkgs, ... }:
let
  sddm-astronaut =
    (pkgs.sddm-astronaut.override {
      embeddedTheme = "japanese_aesthetic"; # or any other theme
      themeConfig = {
        # Customize colors and settings
        HeaderTextColor = "#d5c4a1";
        Background = "Backgrounds/your-custom-background.png";
        # ... other theme configuration options
      };
    }).overrideAttrs
      (oldAttrs: {
        # Optional: Inject custom background image
        #installPhase = oldAttrs.installPhase + ''
        #  chmod u+w $out/share/sddm/themes/sddm-astronaut-theme/Backgrounds/
        #  cp ${./relative/path/to/your-custom-background.png} \
        #    $out/share/sddm/themes/sddm-astronaut-theme/Backgrounds/your-custom-background.png
        #'';
      });
in
{
  # ------------------------------
  #       CODE WAS OMITTED
  # ------------------------------

  # The SDDM declaration
  services.displayManager.sddm = {
    enable = true;
    extraPackages = with pkgs; [
      kdePackages.qtmultimedia # Required for video backgrounds/audio
    ];
    theme = "sddm-astronaut-theme";
  };

  # Your desktop environment
  services.desktopManager.plasma6.enable = true;

  # ------------------------------
  #       CODE WAS OMITTED
  # ------------------------------

   environment.systemPackages = with pkgs; [
     # Your system packages (omitted)

     # Add sddm-astrounaut pkg
     sddm-astronaut
   ];
  # ------------------------------
  #       CODE WAS OMITTED
  # ------------------------------
}