From 287974c466f366df155627fd350fdc61d11161ee Mon Sep 17 00:00:00 2001 From: Tyler Kelley Date: Fri, 12 Jan 2024 01:07:42 -0600 Subject: [PATCH] Added Variables For Username & Hostname in Flake --- flake.nix | 8 ++++---- home.nix | 2 +- workstation/configuration.nix | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/flake.nix b/flake.nix index bf4a940..727e8a0 100644 --- a/flake.nix +++ b/flake.nix @@ -6,13 +6,13 @@ home-manager.url = "github:nix-community/home-manager/release-23.11"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; hyprland.url = "github:hyprwm/Hyprland"; - hostname = "hyprnix"; - username = "zaney"; }; outputs = inputs@{ nixpkgs, home-manager, ... }: let system = "x86_64-linux"; + hostname = "hyprnix"; + username = "zaney"; pkgs = import nixpkgs { inherit system; config = { @@ -22,12 +22,12 @@ in { nixosConfigurations = { laptop = nixpkgs.lib.nixosSystem { - specialArgs = { inherit system; inherit inputs; }; + specialArgs = { inherit system; inherit inputs; inherit username; inherit hostname }; modules = [ ./laptop/configuration.nix home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.${username} = import ./home.nix; + home-manager.users.zaney = import ./home.nix; } ]; }; diff --git a/home.nix b/home.nix index 8f89a42..9a0d93c 100644 --- a/home.nix +++ b/home.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, username, ... }: { home.username = ${username}; diff --git a/workstation/configuration.nix b/workstation/configuration.nix index 661f319..ace547d 100644 --- a/workstation/configuration.nix +++ b/workstation/configuration.nix @@ -2,7 +2,7 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ inputs, config, pkgs, ... }: +{ inputs, config, pkgs, username, hostname, ... }: { imports = @@ -16,7 +16,7 @@ boot.kernelModules = [ "v4l2loopback" ]; boot.extraModulePackages = [ config.boot.kernelPackages.v4l2loopback ]; - networking.hostName = "hyprnix"; # Define your hostname. + networking.hostName = ${hostname}; # Define your hostname. # Enable networking networking.networkmanager.enable = true;