From 4984b2bcab304ad2dbc5e1ca28ac033f1ec0b5bc Mon Sep 17 00:00:00 2001 From: Benson Chu Date: Mon, 2 Sep 2024 10:21:22 -0500 Subject: [PATCH] Each machine can specify where the flake directory is --- common/configuration.nix | 10 ++++++---- common/flake-location.nix | 13 +++++++++++++ hosts/NixDawn/configuration.nix | 2 ++ 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 common/flake-location.nix diff --git a/common/configuration.nix b/common/configuration.nix index 395e830..f7d3c9f 100644 --- a/common/configuration.nix +++ b/common/configuration.nix @@ -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; diff --git a/common/flake-location.nix b/common/flake-location.nix new file mode 100644 index 0000000..4ac37fd --- /dev/null +++ b/common/flake-location.nix @@ -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; + }; + }; +} diff --git a/hosts/NixDawn/configuration.nix b/hosts/NixDawn/configuration.nix index fd4dedb..7e9fd6c 100644 --- a/hosts/NixDawn/configuration.nix +++ b/hosts/NixDawn/configuration.nix @@ -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;