Help with understanding this config!

Hi! I’m learning nixos by setting up my own config. Since I’m a doom emacs fan, I want to recreate it in my config. I stumbled upon hlissner config and I want to recreate his flake only getting what I need and iteratively building the config.
While doing this I get an error about lib.my not existing even though I recreated the authors lib extension.
How come?
The offending code:

      inherit (lib.my) mapModules mapModulesRec mapHosts;

      system = "x86_64-linux";

      mkPkgs = pkgs: extraOverlays: import pkgs {
        inherit system;
        config.allowUnfree = true;  # forgive me Stallman senpai
        overlays = extraOverlays ++ (lib.attrValues self.overlays);
      };
      pkgs  = mkPkgs nixpkgs [ self.overlay ];
      pkgs' = mkPkgs nixpkgs-unstable [];

      lib = nixpkgs.lib.extend
        (self: super: { my = import ./lib { inherit pkgs inputs; lib = self; }; });

my own flake.nix

Hey, I believe you should add the extended lib to specialArgs when setting up the nixosSystem (and possibly to home-manager with extraSpecialArgs): dotfiles/lib/nixos.nix at 089f1a9da9018df9e5fc200c2d7bef70f4546026 · hlissner/dotfiles · GitHub

BTW: trying to copy a complex setup while you’re still getting the hang of things might not be the best approach IMO :smiley:

1 Like