Warn about things not being set

This commit is contained in:
Benson Chu 2024-09-02 11:20:44 -05:00
parent 4984b2bcab
commit 314b110456
2 changed files with 17 additions and 6 deletions

View file

@ -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, lib, ... }:
let
system = "x86_64-linux";
in
@ -35,7 +35,7 @@ in
nixPath = [
"/home/benson/.nix-defexpr/channels"
"nixpkgs=${inputs.nixpkgs}"
"nixos-config=${config.my.flakeLocation}/hosts/${config.networking.hostName}/configuration.nix"
config.my.nixosConfigLocation
"/nix/var/nix/profiles/per-user/root/channels"];
# MY GOD, this is what is used for nix develop, nix run, etc.

View file

@ -1,13 +1,24 @@
{ inputs, config, lib, pkgs, ... }:
let
system = "x86_64-linux";
in
{
options = {
my.flakeLocation = lib.mkOption {
default = "/etc/nixos/";
default = null;
description = "Location of nixos flake for config";
type = lib.types.nullOr lib.types.path;
};
my.nixosConfigLocation = lib.mkOption {
# default = "/etc/nixos/";
internal = true;
description = "Location of nixos configuration";
type = lib.types.path;
};
};
config = {
my.nixosConfigLocation =
if (config.my.flakeLocation != null)
then "${config.my.flakeLocation}/hosts/${config.networking.hostName}/configuration.nix"
else lib.warn "Didn't set 'my.flakeLocation', NIX_PATH functionality will degrade a little"
"${inputs.self}/hosts/${config.networking.hostName}/configuration.nix";
};
}