You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i made 2 custom libs because the one i was using earlier couldnt be made to have config since that only is exposed during module eval, so i had to make another one that exposed. I didnt combine them into one because i was dealing with a stupid sx issue and was sick of it after ~5 hours.
Claude said to do it like this which looks like it would work
# lib/default.nix{lib,config,pkgs}:
let# Your library functions herecustomLib={mkCustomService={name}: {systemd.services.${name}={description="Service using ${config.networking.hostName}";# ... rest of your service config};};mkUserEnv={username}: {users.users.${username}={shell=config.users.defaultShell;# ... other user settings};};};in# Extend the original lib with your additionslib.extend(final: prev: customLib)# flake.nix{description="System with extended lib";outputs={self,nixpkgs, ... }: {nixosConfigurations.myhost=nixpkgs.lib.nixosSystem{system="x86_64-linux";modules=[# Make the extended lib available to all modules({lib,config,pkgs, ... }: {_module.args.lib=import./lib{inherit(nixpkgs)lib;inheritconfigpkgs;};})# Your actual configuration({lib, ... }: {# Now you can use your custom functions directly from libimports=[(lib.mkCustomService{name="myservice";})];networking.hostName="myhost";})];};};}
The text was updated successfully, but these errors were encountered:
i made 2 custom libs because the one i was using earlier couldnt be made to have
config
since that only is exposed during module eval, so i had to make another one that exposed. I didnt combine them into one because i was dealing with a stupidsx
issue and was sick of it after ~5 hours.Claude said to do it like this which looks like it would work
The text was updated successfully, but these errors were encountered: