Add DOTFILES envvar & dotfiles NIX_PATH

This commit is contained in:
Henrik Lissner 2020-10-11 21:29:49 -04:00
parent fa546d6337
commit 2eb91b8bc3
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 9 additions and 7 deletions

View file

@ -27,7 +27,7 @@
let let
inherit (builtins) baseNameOf; inherit (builtins) baseNameOf;
inherit (lib) nixosSystem mkIf removeSuffix attrNames attrValues; inherit (lib) nixosSystem mkIf removeSuffix attrNames attrValues;
inherit (lib.my) mapModules mapModulesRec mapModulesRec'; inherit (lib.my) dotFilesDir mapModules mapModulesRec mapModulesRec';
system = "x86_64-linux"; system = "x86_64-linux";
@ -69,13 +69,15 @@
{ {
networking.hostName = removeSuffix ".nix" (baseNameOf modulePath); networking.hostName = removeSuffix ".nix" (baseNameOf modulePath);
environment.variables.NIXPKGS_ALLOW_UNFREE = "1"; environment.variables.NIXPKGS_ALLOW_UNFREE = "1";
environment.variables.DOTFILES = dotFilesDir;
nixpkgs.pkgs = pkgs; nixpkgs.pkgs = pkgs;
nix = { nix = {
package = unstable.nixFlakes; package = unstable.nixFlakes;
extraOptions = "experimental-features = nix-command flakes"; extraOptions = "experimental-features = nix-command flakes";
nixPath = [ nixPath = [
"nixpkgs=${nixos}" "nixpkgs=${nixos}"
"nixpkgs-overlays=${toString ./.}/overlays" "nixpkgs-overlays=${dotFilesDir}/overlays"
"dotfiles=${dotFilesDir}"
]; ];
binaryCaches = [ binaryCaches = [
"https://cache.nixos.org/" "https://cache.nixos.org/"

View file

@ -4,10 +4,10 @@ with builtins;
with lib; with lib;
rec { rec {
# ... # ...
dotFiles = toString ../.; dotFilesDir = toString ../.;
modulesDir = "${dotFiles}/modules"; modulesDir = "${dotFilesDir}/modules";
configDir = "${dotFiles}/config"; configDir = "${dotFilesDir}/config";
binDir = "${dotFiles}/bin"; binDir = "${dotFilesDir}/bin";
themeDir = "${modulesDir}/themes"; themeDir = "${modulesDir}/themes";
homeDir = "/home/${let name = getEnv "USERNAME"; in homeDir = "/home/${let name = getEnv "USERNAME"; in
if elem name [ "" "root" ] if elem name [ "" "root" ]