fix nixos lib, limitation: only 1 user per machine :(
This commit is contained in:
@ -1,11 +1,11 @@
|
|||||||
{ inputs, pkgs, lib, ... }:
|
{ inputs, pkgs, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (inputs) nixpkgs home-manager;
|
inherit (inputs) home-manager;
|
||||||
|
|
||||||
in rec {
|
in rec {
|
||||||
mkNixosConfig = { system, hostname, extraModules, homeConfigs }:
|
mkNixosConfig = { system ? "x86_64-linux", hostname, username ? "christoph", extraModules ? [ ] }:
|
||||||
nixpkgs.lib.nixosSystem {
|
lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
|
||||||
# Make our inputs available to the configuration.nix (for importing modules)
|
# Make our inputs available to the configuration.nix (for importing modules)
|
||||||
@ -25,17 +25,12 @@ in rec {
|
|||||||
|
|
||||||
extraModules
|
extraModules
|
||||||
|
|
||||||
# Make a user home for every config supplied
|
# I included the home config statically like this as I am the only user
|
||||||
(builtins.map home-manager.nixosModules.home-manager homeConfigs)
|
# 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...
|
||||||
|
[
|
||||||
# Only returns the set that has to be passed to home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager {
|
||||||
# because then nix is able to automatically inject the dependencies
|
|
||||||
mkHomeConfig = { username }:
|
|
||||||
{
|
|
||||||
# Include the inputs just in case they might be needed somewhere
|
|
||||||
home-manager.extraSpecialArgs = { inherit inputs; };
|
|
||||||
|
|
||||||
# Use systems pkgs, disables nixpkgs.* options in home.nix
|
# Use systems pkgs, disables nixpkgs.* options in home.nix
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
@ -44,7 +39,10 @@ in rec {
|
|||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
|
|
||||||
# User specific config file
|
# User specific config file
|
||||||
# TODO: Do this for a list of users
|
# Is marked as error but correct
|
||||||
home-manager.users.${username}.imports = [ ../home/${username} ]; # Is marked as error but correct (I think)
|
home-manager.users.${username}.imports = [ ../home/${username} ];
|
||||||
|
}
|
||||||
|
]
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user