nix-configs

Personal NixOS and home-manager configuration files
Log | Files | Refs

entrypoint.nix (497B)


      1 { config, pkgs, lib, ... }:
      2 
      3 let
      4   vars = import ./variables.nix { inherit lib; };
      5 
      6   hostname =
      7     if builtins.pathExists "/etc/hostname"
      8     then lib.strings.removeSuffix "\n" (builtins.readFile "/etc/hostname")
      9     else throw "Error: /etc/hostname not found. Please ensure the hostname is set before rebuild.";
     10 
     11   machine = lib.strings.removeSuffix "\n" hostname;
     12   osConfigPath = ./machines + "/${machine}.nix";
     13 in {
     14   _module.args = { inherit machine vars; };
     15   imports = [ osConfigPath ];
     16 }