Skip Navigation
Problem with Modularzing config

Hi all;

This is a bit of a long shot; but I'm having an issue with trying to modularize my config in preparation for a new laptop.

In particular the issue I have is around passing a path through to an import statement for a home-managed user.

In particular I'm getting undefinedVariable hmPath; but it doesn't seem to be having the same issue when I'm mapping groups and shell; so I can only assume that imports has to be treated differently but I'm at a loss.

Any help on what I've misunderstood would be greatly appreciated.

Snippet below

``` { pkgs, config, options, lib, home-manager, ... }:

with lib; let cfg = config.ltp.home;

user = types.submodule ({name, ...}: { options = { doas.enable = mkEnableOption { default = false; type = types.bool; };

groups = mkOption { default = []; type = types.listOf string; };

shell = mkOption { default = pkgs.bash; type = types.package; };

hmPath = mkOption { type = types.path; }; }; }); in { options.ltp.home = { users = mkOption { description = Attrset of home-manager users; default = {}; type = types.attrsOf user; }; };

config = mkIf (cfg.users != {}) (mkMerge [ { users.users = let mkUser = lib.attrsets.mapAttrs' ( name: value: lib.attrsets.nameValuePair "${builtins.baseNameOf name}" { isNormalUser = true; extraGroups = "${groups}"; shell = "${shell}"; } ) cfg.users; in mkUser;

home-manager.users = let mkHmUser = lib.attrsets.mapAttrs' ( name: value: lib.attrsets.nameValuePair "${builtins.baseNameOf name}" { imports = [ "${hmPath}" ]; } ) cfg.users; in mkHmUser; } ]); } ```

Edit...

Solved the initial issue I was confusing myself and should've been using value.hmPath and equivalent inside the lib functions.

Next issue; I'm having is I can't seem to pass through the path for the home-manager module for the user that is give to the import statement.

Edit 2...

I didn't manage to get it working how I was doing it so I've changed my approach; to implicitly reference the users home-manager base module based on the folder structure e.g. ./hosts/${hostname}/users/${builtins.baseNameOf name}

0
Issue with transparent cache.nixos.org proxy
  • Might be misunderstanding this myself, but I thought a transparent proxy intercepts the requests to the destination.

    Now if this is the case, I wouldn't expect any changes to your nix config, as it should be transparently intercepting the requests to cache.nixos.org. Now how this would work with nginx in this context I haven't quite gotten my head around.

    Unless your set your gateway to be your nginx box; to handle all requests and forward them on as necessary.

    Might give this a go on my build server if I get a chance.

  • Summer 2024 Transfers Round up thread
  • Leny Yoro confirmed, I never believed they would be able to pull that one off, hats off to inios at least so far they look more than competent.

    Also terms agreed with Ugarte, will this depend on PSG getting Neves done first, maybe but with the speed we're going as this is better done very soon as well.

  • Does anyone use NixNeovim to configure their Neovim?
  • I'm currently using nixvim, or at least attempting to, I was previously just using lazygit outside my nix config, but now I'm trying to very slowly create a config I like, but its very slow, and I've got some weird padding issues with neovim and alacritty that I'm trying to solve first.

    I hadn't heard of nixneovim, I think once I'm in a settled state I'll take a look at it, I just don't want to be pilling more change on top of an unstable base at the moment.

    P.s. I probably should have stated I'm fairy new to neovim in general, so still learning which plugins I like.

  • [home manager] [solved] Is there a way to automatically import all .nix files in a directory?
  • I do have a function that I cribbed from somewhere, unfortunately I didn't note down the source at the time so can't give them due credit here.

    filterNixFiles = k: v: v == "regular" && lib.hasSuffix ".nix" k;

    importNixFiles = path: (lib.lists.forEach (lib.mapAttrsToList (name: _: path + ("/" + name)) (lib.filterAttrs filterNixFiles (builtins.readDir path)))) import;

    Then used as normal

    modules = [ home-manager.nixosModules.home-manager vscode-server.nixosModule ] ++ (importNixFiles ./hosts/required) ++ (importNixFiles ./hosts/machines/${hostname})

    Edit

    Apologies for formatting on mobile

  • Play GB games
  • Modding with IPS screen is fairy easy nowadays with the GBA there is some no soldier options not sure if that is the same with an original dmg.

    Another option could be a Epligoue GB operator, which allows you to play your original cartridges on pc.

  • [solved] nix build error /homeless-shelter

    Hi all,

    For my sins I've been attempting to build my nix configuration on my build server and subsequently push it into a binary cache.

    I'm having an issue where the build is currently failing with the following error

    > error: home directory '/homeless-shelter' exists; please remove it to assure purity of builds without sandboxing

    The build is being run on a docker image node:20-bullseye to be precise with the following command.

    > nix build .#nixosConfigurations.${{ matrix.machine.host }}.config.system.build.toplevel

    Any thoughts would be greatly appreciated.

    Edit.

    Should have mentioned I've ran up the image with docker run and the directory didn't exist

    Edit 2.

    This is also about 23 minutes into the build when it throws this error; after having built a lot of packages and derivations already. I'm also using cachix/nix-install-action to get nix on the running container.

    Edit 3.

    Finally got it building this morning, I haven't dug into it but switching from the cachix/nix-install-action to manually installing the determinate systems nix installer (action didn't work for a strange reason).

    4
    [Post-Match Thread] Manchester United 1 - 0 Wolves
  • Well it's a better start than last season, was expecting more. Really don't like Rashford up top, just doesn't suit him, hopefully Rasmus will be available soon, as I think until we get him in the team, it's not going to be to dissimilar to last season.

  • [Laurie Whitwell T1] West Ham agree £30m Maguire deal with Man United
    theathletic.com West Ham agree £30m Maguire deal with Man United

    West Ham have reached an agreement to sign Manchester United defender Harry Maguire. The Athletic reported on Monday that the London club had offered £30million for Maguire, and that sum has now been accepted. David Moyes’ side are seeking reinforcements after selling Declan Rice to Arsenal in...

    West Ham agree £30m Maguire deal with Man United
    5
    Monitor recommendation.

    Hi all,

    It's been about 8 years since I've treated myself to some new monitors, so I'm a bit out the loop where to comes to what is currently available.

    I'm a software developer, so 95% of the time will be spent developing with a small amount of time gaming.

    I currently have a pair of Dell U2515H.

    Specs I would love

    Minimum QHD resolution, Single cable solution (power, display and data over single cable) Matte display Minimum 25"

    Bonus >60Hz display VESA mount

    Not sold on whether to go for duel screen again or ultrawide

    Budget is fairly flexible preferably under £1000 for a pair though.

    Looking forward to seeing what people recommend.

    If this is the wrong community then my apologies I couldn't see a monitor community.

    Edit,

    Thank you all for your replies, I'm currently looking at the dell u3223qe which ticks a lot of the boxes, was also considering one if the lg ultrafine models, but the usb hub + KVM is really selling me on the dell.

    So while I keep looking for a little longer to make sure I haven't missed anything, I think I'm going to end up with the dell (again)

    13
    InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)LE
    letThemPlay @lemmy.one
    Posts 4
    Comments 43