Each machine can specify where the flake directory is

This commit is contained in:
Benson Chu 2024-09-02 10:21:22 -05:00
parent 965d060901
commit 4984b2bcab
3 changed files with 21 additions and 4 deletions

View file

@ -9,6 +9,7 @@ in
{
imports = [
../modules/default.nix
./flake-location.nix
];
nixpkgs.overlays = [
@ -29,9 +30,12 @@ in
];
nix = {
nixPath = [ # "/home/benson/.nix-defexpr/channels"
settings.experimental-features = "nix-command flakes";
nixPath = [
"/home/benson/.nix-defexpr/channels"
"nixpkgs=${inputs.nixpkgs}"
"nixos-config=${inputs.self}/hosts/${config.networking.hostName}/configuration.nix"
"nixos-config=${config.my.flakeLocation}/hosts/${config.networking.hostName}/configuration.nix"
"/nix/var/nix/profiles/per-user/root/channels"];
# MY GOD, this is what is used for nix develop, nix run, etc.
@ -46,8 +50,6 @@ in
};
};
nix.settings.experimental-features = "nix-command flakes";
# Enable networking
networking.networkmanager.enable = true;

13
common/flake-location.nix Normal file
View file

@ -0,0 +1,13 @@
{ inputs, config, lib, pkgs, ... }:
let
system = "x86_64-linux";
in
{
options = {
my.flakeLocation = lib.mkOption {
default = "/etc/nixos/";
description = "Location of nixos flake for config";
type = lib.types.path;
};
};
}

View file

@ -14,6 +14,8 @@
./hardware-configuration.nix
];
my.flakeLocation = "/home/benson/nixos-config/";
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;