1
Files
flake-nixinator/lib/nixos.nix
Christoph Urlacher aab27a4025 Nixos: Switch to standalone Home-Manager
Not everything is working yet, derivations have to be rewritten
2024-10-11 04:29:03 +02:00

103 lines
2.6 KiB
Nix

{
inputs,
pkgs,
lib,
...
}: {
mkNixosConfigWithHomeManagerModule = {
system,
mylib,
hostname,
username,
extraModules ? [],
}:
lib.nixosSystem {
inherit system;
# Make our inputs available to the configuration.nix (for importing modules)
# specialArgs are propagated to all modules
specialArgs = {inherit inputs hostname username mylib system;};
modules = builtins.concatLists [
[
# Replace the pkgs to include overlays/unfree
{nixpkgs.pkgs = pkgs;}
# Main config file for all configs/hosts
../system
]
extraModules
# I included the home config statically like this as I am the only user.
# I would have liked to make it more flexible (for multiple users on the same host)
# but I failed because nix stopped autoinjecting the required arguments and I didn't
# know how to handle that...
[
inputs.home-manager.nixosModules.home-manager
{
# extraSpecialArgs are propagated to all hm config modules
home-manager.extraSpecialArgs = {inherit inputs hostname username mylib;};
# Use systems pkgs, disables nixpkgs.* options in home.nix
home-manager.useGlobalPkgs = true;
# Enable installing packages through users.christoph.packages to /etc/profiles instead of ~/.nix-profile
home-manager.useUserPackages = true;
# User specific config file
home-manager.users.${username}.imports = [../home/${username}];
}
]
];
};
mkNixosSystemConfig = {
system,
mylib,
hostname,
extraModules ? [],
}:
lib.nixosSystem {
inherit system;
# Make our inputs available to the configuration.nix (for importing modules)
# specialArgs are propagated to all modules
specialArgs = {inherit inputs hostname mylib system;};
modules = builtins.concatLists [
[
# Replace the pkgs to include overlays/unfree
{nixpkgs.pkgs = pkgs;}
# Main config file for all configs/hosts
../system
]
extraModules
];
};
mkNixosHomeConfig = {
system,
mylib,
username,
hostname,
extraModules ? [],
}:
inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs;
# Make this stuff available to the hm modules
extraSpecialArgs = {inherit inputs system mylib username hostname;};
modules = builtins.concatLists [
[
../home/${username}
]
extraModules
];
};
}