flake parts

This commit is contained in:
Harivansh Rathi 2026-03-30 00:06:09 -04:00
parent 6dfef30594
commit 9a13c35acd
7 changed files with 144 additions and 90 deletions

45
modules/nixpkgs.nix Normal file
View file

@ -0,0 +1,45 @@
{
self,
inputs,
lib,
...
}:
let
username = "rathi";
hosts = import ../lib/hosts.nix { inherit username; };
mkPkgs =
system:
import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
};
mkSpecialArgs = host: {
inherit inputs self username;
hostname = host.hostname;
};
mkHomeManagerModule =
host:
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = mkSpecialArgs host;
home-manager.backupCommand = "bash ${../scripts/home-manager-backup.sh}";
home-manager.users.${username} = import host.homeModule;
};
in
{
systems = lib.unique (map (host: host.system) (builtins.attrValues hosts));
_module.args = {
inherit
username
hosts
mkPkgs
mkSpecialArgs
mkHomeManagerModule
;
};
}