nix: Use variables

This should make things easier to change and maintain over time, with
the ultimate goal of making it easy to provide example configurations
that can be expanded upon.
This commit is contained in:
Donovan Glover 2023-06-03 13:51:35 -04:00
parent d400ad5986
commit a22b9355dd
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
2 changed files with 9 additions and 3 deletions

4
examples/laptop.nix Normal file
View File

@ -0,0 +1,4 @@
{
hostname = "nixos";
system = "x86_64-linux";
}

View File

@ -31,9 +31,11 @@
}; };
}; };
outputs = { self, nixpkgs, home-manager, hyprland, stylix, hypr-contrib, nix-gaming, ... }@attrs: { outputs = { self, nixpkgs, home-manager, hyprland, stylix, hypr-contrib, nix-gaming, ... }@attrs: let
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { variables = import ./examples/laptop.nix;
system = "x86_64-linux"; in {
nixosConfigurations."${variables.hostname}" = nixpkgs.lib.nixosSystem {
system = variables.system;
specialArgs = attrs; specialArgs = attrs;
modules = [ modules = [
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager