From a22b9355dd30c479018f200a8d226e89bd565122 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Sat, 3 Jun 2023 13:51:35 -0400 Subject: [PATCH] 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. --- examples/laptop.nix | 4 ++++ flake.nix | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 examples/laptop.nix diff --git a/examples/laptop.nix b/examples/laptop.nix new file mode 100644 index 0000000..967c27f --- /dev/null +++ b/examples/laptop.nix @@ -0,0 +1,4 @@ +{ + hostname = "nixos"; + system = "x86_64-linux"; +} diff --git a/flake.nix b/flake.nix index 30f3c60..2b24add 100644 --- a/flake.nix +++ b/flake.nix @@ -31,9 +31,11 @@ }; }; - outputs = { self, nixpkgs, home-manager, hyprland, stylix, hypr-contrib, nix-gaming, ... }@attrs: { - nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; + outputs = { self, nixpkgs, home-manager, hyprland, stylix, hypr-contrib, nix-gaming, ... }@attrs: let + variables = import ./examples/laptop.nix; + in { + nixosConfigurations."${variables.hostname}" = nixpkgs.lib.nixosSystem { + system = variables.system; specialArgs = attrs; modules = [ home-manager.nixosModules.home-manager