Giter Club home page Giter Club logo

Comments (8)

Pacman99 avatar Pacman99 commented on August 25, 2024 1

I was just looking at the core branch and thought about this, it would be good if extern has a specialArgs attribute. It would also be useful for mobile-nixos usage, which will be getting flakes support soon.

from digga.

Pacman99 avatar Pacman99 commented on August 25, 2024 1

for one thing, specialArgs only affects the nixos configurations and not home-manager. So you would have to do the import in your user profile:

{ hm-modules, ... }:
{ home-manager.users.me.imports = hm-modules; }

Then you can use the modulle in any user profile.

But I have no idea how you got an infinite recursion error, I would have thought the error would be from the file not being called with hmModule.

from digga.

nrdxp avatar nrdxp commented on August 25, 2024

you could try using builtins.getFlake inside your user profile as a better workaround. We could probably solve this by adding another specialArg to all modules.

from digga.

diogox avatar diogox commented on August 25, 2024

I followed your builtins.getFlake advice. It's a better workaround.

Only downside is that I need to specify the commit hash I want to fetch (as far as I can tell).

Which makes it harder to update. But it's not a big deal.

Thanks 🙌

from digga.

nrdxp avatar nrdxp commented on August 25, 2024

Just inherit the modules into the empty attribute set...

from digga.

figgyc avatar figgyc commented on August 25, 2024

Hi, is there a good example on the proper usage? I'm trying to import nix-doom-emacs as described in the docs but I'm having some issues.

extern/default.nix:

{ inputs }: with inputs;
let
  hmModules = {
    inherit (nix-doom-emacs.hmModule) hmModule; # I've tried without .hmModule to the same effect
  };
in
{
  modules = [
    home.nixosModules.home-manager
    ci-agent.nixosModules.agent-profile
  ];

  overlays = [
    nur.overlay
    devshell.overlay
    emacs.overlay
    (final: prev: {
      deploy-rs = deploy.packages.${prev.system}.deploy-rs;
    })
  ];

  # passed to all nixos modules
  specialArgs = {
    inherit hmModules; # sidenote - I think this needs changing as it's "hm-modules" still in the current core branch
    overrideModulesPath = "${override}/nixos/modules";
    hardware = nixos-hardware.nixosModules;
  };
}

users/profiles/emacs/default.nix:

{ config, lib, pkgs, hmModules, ... }:

{
  imports = [ hmModules.hmModule ];
  programs.doom-emacs = {
    enable = true;
    package = pkgs.emacsPgtkGcc;
    doomPrivateDir = ./doom.d;
  };

  services.emacs = {
    enable = true;
    #package = programs.doom-emacs.package;
  };

}

The error I get:

$ flk home e7240 figgyc switch --show-trace
error: --- EvalError ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- nix
at: (303:28) in file: /nix/store/pz44872rmpd7ygqfmdcwh4ac6hk1hy4s-source/lib/modules.nix

   302|         value = builtins.addErrorContext (context name)
   303|           (args.${name} or config._module.args.${name});
      |                            ^
   304|       }) requiredArgs);

infinite recursion encountered
(use '--show-trace' to show detailed location information)

from digga.

nrdxp avatar nrdxp commented on August 25, 2024

I fixed the typo in lastest core, also put a bit of documentation up last night, I'll expand with this example later. But for now, get it working. Also made it available by default from the community branch.

from digga.

figgyc avatar figgyc commented on August 25, 2024

Yeah that works perfectly. Thanks!

from digga.

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.