Multi-host Nix framework

This commit is contained in:
Adam Gausmann 2024-08-28 11:58:09 -05:00
parent c50ed8a901
commit 3811e38dac
4 changed files with 31 additions and 23 deletions

View file

@ -12,26 +12,8 @@
nixGL.url = "github:nix-community/nixGL";
};
outputs = { nixpkgs, flake-utils, home-manager, nixGL, ... } @ inputs:
flake-utils.lib.eachSystem (with flake-utils.lib.system; [
x86_64-linux
]) (system:
let
lib = nixpkgs.lib;
pkgs = import nixpkgs {
inherit system;
overlays = [ nixGL.overlay ];
};
in {
packages.homeConfigurations = {
goose = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [ ./home.nix ];
extraSpecialArgs = {
inherit inputs;
};
};
outputs = { nixpkgs, ... } @ inputs:
(import ./modules/hosts.nix inputs) // {
# TODO devshell config
};
}
);
}

View file

@ -1,4 +1,6 @@
hm_flags := "--flake .#goose"
user := `whoami`
hostname := `hostname`
hm_flags := "--flake .#" + user + "@" + hostname
alias b := build
alias inst := install

24
modules/hosts.nix Normal file
View file

@ -0,0 +1,24 @@
{ nixpkgs, flake-utils, home-manager, nixGL, ... } @ inputs:
let
getNixOsPkgs = system: import nixpkgs { inherit system; };
getPkgs = system: import nixpkgs {
inherit system;
overlays = [ nixGL.overlay ];
};
makeHostSystem = pkgs: modules: home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [ ./common.nix ] ++ modules;
extraSpecialArgs = {
inherit inputs;
};
};
in
{
packages.x86_64-linux.homeConfigurations = let
pkgs = getPkgs "x86_64-linux";
makeHost = makeHostSystem pkgs;
in {
"goose@adventurer" = makeHost [ /*./hosts/adventurer.nix*/ ];
};
}