legacy: ensure config exists
This commit is contained in:
parent
f69c5a59f1
commit
063d05c680
@ -3,16 +3,21 @@
|
|||||||
# flake support (e.g `nixos-option`), can work as expected.
|
# flake support (e.g `nixos-option`), can work as expected.
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
let
|
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
|
in
|
||||||
{
|
{
|
||||||
imports = builtins.attrValues (import ./modules) ++ [
|
imports = builtins.attrValues (import ./modules) ++ [
|
||||||
"${builtins.fetchTarball https://github.com/rycee/home-manager/archive/master.tar.gz}/nixos"
|
"${builtins.fetchTarball https://github.com/rycee/home-manager/archive/master.tar.gz}/nixos"
|
||||||
/etc/nixos/profiles/core.nix
|
/etc/nixos/profiles/core.nix
|
||||||
"/etc/nixos/hosts/${host}.nix"
|
] ++ config;
|
||||||
];
|
|
||||||
|
|
||||||
networking.hostName = host;
|
|
||||||
|
networking.hostName = hostname;
|
||||||
nix.nixPath = [
|
nix.nixPath = [
|
||||||
"nixpkgs=${<nixpkgs>}"
|
"nixpkgs=${<nixpkgs>}"
|
||||||
"nixos-config=/etc/nixos/configuration.nix"
|
"nixos-config=/etc/nixos/configuration.nix"
|
||||||
|
Loading…
Reference in New Issue
Block a user