feat: nix config helper

This commit is contained in:
Gustavo "Guz" L. de Mello
2024-01-07 15:45:18 -03:00
parent db81831dc0
commit 4c909faa20
7 changed files with 65 additions and 15 deletions

View File

@@ -23,13 +23,26 @@
};
};
outputs = { self, nixpkgs, home-manager, ... }@inputs: {
nixosConfigurations.desktop = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
inputs.home-manager.nixosModules.default
./hosts/desktop/configuration.nix
];
outputs = { self, nixpkgs, home-manager, ... }@inputs:
let
create-host = (configs: builtins.listToAttrs (map
(c: {
name = c;
value = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
inputs.home-manager.nixosModules.default
(./. + ("/hosts/" + builtins.replaceStrings [ "@" ] [ "/" ] c) + /configuration.nix)
];
};
})
configs));
in
{
nixosConfigurations = (create-host [
"desktop@default"
"desktop@work"
]);
};
};
}

View File

@@ -0,0 +1,15 @@
{ config, pkgs, inputs, lib, ... }:
{
imports = [
../shared-configuration.nix
];
set-user.users = [
{
username = "guz";
shell = pkgs.zsh;
home = import ./home.nix;
}
];
}

View File

@@ -0,0 +1,7 @@
{ config, pkgs, inputs, ... }:
{
imports = [
../shared-home.nix
];
}

View File

@@ -27,13 +27,6 @@
programs.zsh.enable = true;
# Define a user account. Don't forget to set a password with passwd.
set-user.users = [
{
username = "guz";
shell = pkgs.zsh;
home = import ./home.nix;
}
];
services.flatpak.enable = true;

View File

@@ -0,0 +1,15 @@
{ config, pkgs, inputs, lib, ... }:
{
imports = [
../shared-configuration.nix
];
set-user.users = [
{
username = "guz";
shell = pkgs.zsh;
home = import ./home.nix;
}
];
}

View File

@@ -0,0 +1,7 @@
{ config, pkgs, inputs, ... }:
{
imports = [
../shared-home.nix
];
}