Giter Club home page Giter Club logo

Comments (12)

lovesegfault avatar lovesegfault commented on June 17, 2024

I closed some of the PRs because they didn't actually solve the IFD, but rather just moved it around.

I think the right solution there might be to turn most of those fetchFromGitHubs into flake inputs

from stylix.

lovesegfault avatar lovesegfault commented on June 17, 2024

I guess all the templates would need to be added as flake inputs, and then we could have a moduleArgs inputs that would let individual modules reference inputs.base16-alacritty, for example.

from stylix.

danth avatar danth commented on June 17, 2024

Also, some of the templates are quite short, so we could consider just embedding them as a string.

from stylix.

lovesegfault avatar lovesegfault commented on June 17, 2024

Alright, with the two open PRs listed above and #165 we get rid of all IFD except for xresources, which I can't see a clear way to do without IFD, but folks can also just disable it :)

from stylix.

lovesegfault avatar lovesegfault commented on June 17, 2024

Another plus of the approach taken in #165 is that it's not possible to easily override the templates used, and they get auto-updated with the rest of the flake inputs :)

from stylix.

lovesegfault avatar lovesegfault commented on June 17, 2024

I'm now running all these changes on my systems, everything working AOK and evaluation is much faster 🚀

from stylix.

lovesegfault avatar lovesegfault commented on June 17, 2024

I may have a solution for xresources.

All home-manager does is create the .Xresources file: https://github.com/nix-community/home-manager/blob/master/modules/xresources.nix#L90-L100

And then configure the xsession to merge it to xrdb: https://github.com/nix-community/home-manager/blob/master/modules/xresources.nix#L102

And that is just a command that points to the file: https://github.com/nix-community/home-manager/blob/master/modules/xresources.nix#L26

We could do something similar with:

{
  home.file.".Xstylix" = {
    source = theme;
    onChange = ''
      if [[ -v DISPLAY ]]; then
        ${pkgs.xorg.xrdb}/bin/xrdb -merge ${config.home.homeDirectory}/.Xstylix
      fi
    '';
  };

  xsession.initExtra = "${pkgs.xorg.xrdb}/bin/xrdb -merge ${config.home.homeDirectory}/.Xstylix";
}

And that does no IFD.

I can't really test this because I don't know what the .Xresources theme even impacts.

cc. @danth

from stylix.

danth avatar danth commented on June 17, 2024

It should have an effect on rxvt and xterm.

I think we can avoid linking the file too:

let
  # theme = ;
  command = "${pkgs.xorg.xrdb}/bin/xrdb -merge ${theme}";

in {
  xsession.initExtra = command;

  home.activation.Xresources = lib.hm.dag.mkEntryAfter [ "writeBoundary" ] ''
    if [[ -v DISPLAY ]]; then
      $DRY_RUN_CMD ${command}
    fi
  '';
}

On the other hand the template is fairly simple, so we could translate it to xresources.properties and remove the dependency:

{
  xresources.properties =
    with config.lib.stylix.colors.withHashtag;
    {
      "*foreground" = base05;
      "*cursorColor" = base05;
      ...
    };
}

Then it goes through the Home Manager module as usual.

from stylix.

lovesegfault avatar lovesegfault commented on June 17, 2024

Ah, good idea, let me give it a shot :)

from stylix.

lovesegfault avatar lovesegfault commented on June 17, 2024

Seems to work! Done in #168

from stylix.

trueNAHO avatar trueNAHO commented on June 17, 2024

Looking at the modules, though, they mostly don't need IFD, and could be reworked to avoid it. One example is bat, where I was able to remove the need for IFD by improving the underlying HomeManager module.

I think most of the others on the list can also avoid IFD by just linking the theme file, and then referencing the linked path instead of trying to embed the theme in the configuration files.

(Source: #159 (comment))

Would replacing the current Mustache templates with upstream Home Manager and NixOS options not further improve evaluation time? Additionally, unlike Mustache templates, Nix options can be seamlessly overwritten by end users in Stylix, Home Manager, or NixOS.

I guess all the templates would need to be added as flake inputs, and then we could have a moduleArgs inputs that would let individual modules reference inputs.base16-alacritty, for example.

(Source: #159 (comment))

For reference, this is quite similar to what #222 does.

from stylix.

danth avatar danth commented on June 17, 2024

Yes, using Nix options is a better option.

from stylix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.