diff --git a/nix/default.nix b/nix/default.nix index 2d730ca..5941a14 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -1,31 +1,34 @@ { versionsPath }: -{ - channelSources = +let + channelVersions = (import versionsPath); + mkChannelSource = channel: let - channelVersions = (import versionsPath); - mkChannelSource = channel: - let - channelVersion = builtins.getAttr channel channelVersions; - in builtins.fetchGit { - # Descriptive name to make the store path easier to identify - name = "nixpkgs-channels-${channel}"; - url = if builtins.hasAttr "url" channelVersion - then channelVersion."url" - else "https://github.com/NixOS/nixpkgs-channels/" - ; - ref = (builtins.getAttr channel channelVersions)."ref"; - rev = (builtins.getAttr channel channelVersions)."rev"; - }; - nix_path = builtins.foldl' (sum: elem: sum +":" + builtins.concatStringsSep "=" elem) "" [ - [ "nixpkgs" (mkChannelSource "channelsNixosStable") ] - [ "nixos" (mkChannelSource "channelsNixosStable" + "/nixos") ] - [ "channels-nixos-stable" (mkChannelSource "channelsNixosStable") ] - [ "channels-nixos-unstable" (mkChannelSource "channelsNixosUnstable") ] - [ "nixpkgs-master" (mkChannelSource "nixpkgsMaster") ] - [ "home-manager-module" (mkChannelSource "homeManagerModule") ] - ]; - in (import (mkChannelSource "channelsNixosStable") {}).writeText "channels.rc" '' - export NIX_PATH=${nix_path} - ''; - } + channelVersion = builtins.getAttr channel channelVersions; + in builtins.fetchGit { + # Descriptive name to make the store path easier to identify + name = "nixpkgs-channels-${channel}"; + url = if builtins.hasAttr "url" channelVersion + then channelVersion."url" + else "https://github.com/NixOS/nixpkgs-channels/" + ; + ref = (builtins.getAttr channel channelVersions)."ref"; + rev = (builtins.getAttr channel channelVersions)."rev"; + }; + nixPath = builtins.foldl' (sum: elem: sum +":" + builtins.concatStringsSep "=" elem) "" [ + [ "nixpkgs" (mkChannelSource "channelsNixosStable") ] + [ "nixos" (mkChannelSource "channelsNixosStable" + "/nixos") ] + [ "channels-nixos-stable" (mkChannelSource "channelsNixosStable") ] + [ "channels-nixos-unstable" (mkChannelSource "channelsNixosUnstable") ] + [ "nixpkgs-master" (mkChannelSource "nixpkgsMaster") ] + [ "home-manager-module" (mkChannelSource "homeManagerModule") ] + ]; + pkgs = import (mkChannelSource "channelsNixosStable") {}; +in + +{ + inherit nixPath; + channelSources = pkgs.writeText "channels.rc" '' + export NIX_PATH=${nixPath} + ''; +} diff --git a/nix/home-manager/configuration/graphical-fullblown.nix b/nix/home-manager/configuration/graphical-fullblown.nix index 630f43b..1f9a7c5 100644 --- a/nix/home-manager/configuration/graphical-fullblown.nix +++ b/nix/home-manager/configuration/graphical-fullblown.nix @@ -1,3 +1,9 @@ +{ pkgs }: + +let + zshCurried = import ../programs/zsh.nix { inherit pkgs; }; +in + { pkgs , config , ... }: @@ -20,7 +26,7 @@ in { ../programs/libreoffice.nix ../programs/neovim.nix ../programs/pass.nix - ../programs/zsh.nix + zshCurried ]; nixpkgs.config = { diff --git a/nix/home-manager/configuration/graphical-removable.nix b/nix/home-manager/configuration/graphical-removable.nix index 4eb7a78..322415c 100644 --- a/nix/home-manager/configuration/graphical-removable.nix +++ b/nix/home-manager/configuration/graphical-removable.nix @@ -1,3 +1,9 @@ +{ pkgs }: + +let + zshCurried = import ../programs/zsh.nix { inherit pkgs; }; +in + { pkgs , config, ... }: @@ -17,7 +23,7 @@ in { ../programs/libreoffice.nix ../programs/neovim.nix ../programs/pass.nix - ../programs/zsh.nix + zshCurried ]; nixpkgs.config = { diff --git a/nix/home-manager/configuration/text-minimal.nix b/nix/home-manager/configuration/text-minimal.nix index 42d19d5..b6c9880 100644 --- a/nix/home-manager/configuration/text-minimal.nix +++ b/nix/home-manager/configuration/text-minimal.nix @@ -1,3 +1,9 @@ +{ pkgs }: + +let + zshCurried = import ../programs/zsh.nix { inherit pkgs; }; +in + { pkgs , config , ... }: @@ -9,7 +15,7 @@ in { ../profiles/common.nix ../profiles/nix-channels.nix ../programs/neovim.nix - ../programs/zsh.nix + zshCurried ]; nixpkgs.config = { diff --git a/nix/home-manager/programs/zsh.nix b/nix/home-manager/programs/zsh.nix index b44fd45..ff72af2 100644 --- a/nix/home-manager/programs/zsh.nix +++ b/nix/home-manager/programs/zsh.nix @@ -1,13 +1,8 @@ -{ pkgs -, config -, ... -}: +{ pkgs }: + +{ ... }: let - channelSources = (import ../../default.nix { - versionsPath = ../../variables/versions.nix; - }).channelSources; - just-plugin = let plugin_file = pkgs.writeText "_just" '' @@ -71,7 +66,7 @@ in { # don't cd into directories when executed unsetopt AUTO_CD - source ${channelSources} + export NIX_PATH="${pkgs.nixPath}" # print lines without termination setopt PROMPT_CR diff --git a/nix/os/devices/steveej-t480s-work/pkg.nix b/nix/os/devices/steveej-t480s-work/pkg.nix index 20f6488..aa7035f 100644 --- a/nix/os/devices/steveej-t480s-work/pkg.nix +++ b/nix/os/devices/steveej-t480s-work/pkg.nix @@ -1,9 +1,12 @@ -{ -... +{ pkgs +, ... }: { - home-manager.users.steveej = import ../../../home-manager/configuration/graphical-fullblown.nix; + nixpkgs.config.packageOverrides = pkgs: with pkgs; { + nixPath = (import ../../../default.nix { versionsPath = ./versions.nix; }).nixPath; + }; + home-manager.users.steveej = import ../../../home-manager/configuration/graphical-fullblown.nix { inherit pkgs; }; services.teamviewer.enable = true; system.stateVersion = "19.09"; } diff --git a/nix/os/devices/vmd32387.contaboserver.net/pkg.nix b/nix/os/devices/vmd32387.contaboserver.net/pkg.nix index 3ba136a..aa1b460 100644 --- a/nix/os/devices/vmd32387.contaboserver.net/pkg.nix +++ b/nix/os/devices/vmd32387.contaboserver.net/pkg.nix @@ -5,7 +5,10 @@ }: { - home-manager.users.steveej = import ../../../home-manager/configuration/text-minimal.nix; + nixpkgs.config.packageOverrides = pkgs: with pkgs; { + nixPath = (import ../../../default.nix { versionsPath = ./versions.nix; }).nixPath; + }; + home-manager.users.steveej = import ../../../home-manager/configuration/text-minimal.nix { inherit pkgs; }; services.hydra = { enable = false; diff --git a/nix/os/profiles/common/pkg.nix b/nix/os/profiles/common/pkg.nix index 4c2e87c..f74f7f7 100644 --- a/nix/os/profiles/common/pkg.nix +++ b/nix/os/profiles/common/pkg.nix @@ -6,7 +6,7 @@ imports = [ "${}/nixos" ]; - home-manager.users.root = import ../../../home-manager/configuration/text-minimal.nix; + home-manager.users.root = import ../../../home-manager/configuration/text-minimal.nix { inherit pkgs; }; nixpkgs.config = { allowBroken = false; diff --git a/nix/os/profiles/common/system.nix b/nix/os/profiles/common/system.nix index d56532b..91b7ce7 100644 --- a/nix/os/profiles/common/system.nix +++ b/nix/os/profiles/common/system.nix @@ -29,6 +29,10 @@ } ''; + environment.variables = { + NIX_PATH = lib.mkForce pkgs.nixPath; + }; + # Fonts, I18N, Date ... fonts.fonts = [ pkgs.corefonts diff --git a/nix/os/profiles/removable-medium/pkg.nix b/nix/os/profiles/removable-medium/pkg.nix index fa43b2e..bc04f92 100644 --- a/nix/os/profiles/removable-medium/pkg.nix +++ b/nix/os/profiles/removable-medium/pkg.nix @@ -1,7 +1,10 @@ -{ -... +{ pkgs +, ... }: { - home-manager.users.steveej = import ../../../home-manager/configuration/graphical-removable.nix; + nixpkgs.config.packageOverrides = pkgs: with pkgs; { + nixPath = (import ../../../default.nix { versionsPath = ./versions.nix; }).nixPath; + }; + home-manager.users.steveej = import ../../../home-manager/configuration/graphical-removable.nix { inherit pkgs; }; }