From 063d05c6804a3ac3f0fd2d850d51f4f4eba2c66a Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Wed, 1 Jan 2020 17:16:38 -0700 Subject: [PATCH] legacy: ensure config exists --- configuration.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/configuration.nix b/configuration.nix index 5d22f5ef..4eb81321 100644 --- a/configuration.nix +++ b/configuration.nix @@ -3,16 +3,21 @@ # flake support (e.g `nixos-option`), can work as expected. { lib, ... }: let - host = lib.fileContents /etc/hostname; + hostname = lib.fileContents /etc/hostname; + host = "/etc/nixos/hosts/${hostname}.nix"; + config = + if (builtins.pathExists host) + then [ host ] + else [ /etc/nixos/hosts/NixOS.nix ]; in { imports = builtins.attrValues (import ./modules) ++ [ "${builtins.fetchTarball https://github.com/rycee/home-manager/archive/master.tar.gz}/nixos" /etc/nixos/profiles/core.nix - "/etc/nixos/hosts/${host}.nix" - ]; + ] ++ config; - networking.hostName = host; + + networking.hostName = hostname; nix.nixPath = [ "nixpkgs=${}" "nixos-config=/etc/nixos/configuration.nix"