nix: set NIX_PATH per device versions at buildtime
Previously all devices would have NIX_PATH set on the common verion file defindd in *nix/variables/versions.nix*. Now NIX_PATH is populated with the versions of the respective device.
This commit is contained in:
parent
3bcf7b0397
commit
522d7279bd
10 changed files with 77 additions and 48 deletions
|
@ -1,7 +1,5 @@
|
||||||
{ versionsPath }:
|
{ versionsPath }:
|
||||||
|
|
||||||
{
|
|
||||||
channelSources =
|
|
||||||
let
|
let
|
||||||
channelVersions = (import versionsPath);
|
channelVersions = (import versionsPath);
|
||||||
mkChannelSource = channel:
|
mkChannelSource = channel:
|
||||||
|
@ -17,7 +15,7 @@
|
||||||
ref = (builtins.getAttr channel channelVersions)."ref";
|
ref = (builtins.getAttr channel channelVersions)."ref";
|
||||||
rev = (builtins.getAttr channel channelVersions)."rev";
|
rev = (builtins.getAttr channel channelVersions)."rev";
|
||||||
};
|
};
|
||||||
nix_path = builtins.foldl' (sum: elem: sum +":" + builtins.concatStringsSep "=" elem) "" [
|
nixPath = builtins.foldl' (sum: elem: sum +":" + builtins.concatStringsSep "=" elem) "" [
|
||||||
[ "nixpkgs" (mkChannelSource "channelsNixosStable") ]
|
[ "nixpkgs" (mkChannelSource "channelsNixosStable") ]
|
||||||
[ "nixos" (mkChannelSource "channelsNixosStable" + "/nixos") ]
|
[ "nixos" (mkChannelSource "channelsNixosStable" + "/nixos") ]
|
||||||
[ "channels-nixos-stable" (mkChannelSource "channelsNixosStable") ]
|
[ "channels-nixos-stable" (mkChannelSource "channelsNixosStable") ]
|
||||||
|
@ -25,7 +23,12 @@
|
||||||
[ "nixpkgs-master" (mkChannelSource "nixpkgsMaster") ]
|
[ "nixpkgs-master" (mkChannelSource "nixpkgsMaster") ]
|
||||||
[ "home-manager-module" (mkChannelSource "homeManagerModule") ]
|
[ "home-manager-module" (mkChannelSource "homeManagerModule") ]
|
||||||
];
|
];
|
||||||
in (import (mkChannelSource "channelsNixosStable") {}).writeText "channels.rc" ''
|
pkgs = import (mkChannelSource "channelsNixosStable") {};
|
||||||
export NIX_PATH=${nix_path}
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
inherit nixPath;
|
||||||
|
channelSources = pkgs.writeText "channels.rc" ''
|
||||||
|
export NIX_PATH=${nixPath}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
{ pkgs }:
|
||||||
|
|
||||||
|
let
|
||||||
|
zshCurried = import ../programs/zsh.nix { inherit pkgs; };
|
||||||
|
in
|
||||||
|
|
||||||
{ pkgs
|
{ pkgs
|
||||||
, config
|
, config
|
||||||
, ... }:
|
, ... }:
|
||||||
|
@ -20,7 +26,7 @@ in {
|
||||||
../programs/libreoffice.nix
|
../programs/libreoffice.nix
|
||||||
../programs/neovim.nix
|
../programs/neovim.nix
|
||||||
../programs/pass.nix
|
../programs/pass.nix
|
||||||
../programs/zsh.nix
|
zshCurried
|
||||||
];
|
];
|
||||||
|
|
||||||
nixpkgs.config = {
|
nixpkgs.config = {
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
{ pkgs }:
|
||||||
|
|
||||||
|
let
|
||||||
|
zshCurried = import ../programs/zsh.nix { inherit pkgs; };
|
||||||
|
in
|
||||||
|
|
||||||
{ pkgs
|
{ pkgs
|
||||||
, config,
|
, config,
|
||||||
... }:
|
... }:
|
||||||
|
@ -17,7 +23,7 @@ in {
|
||||||
../programs/libreoffice.nix
|
../programs/libreoffice.nix
|
||||||
../programs/neovim.nix
|
../programs/neovim.nix
|
||||||
../programs/pass.nix
|
../programs/pass.nix
|
||||||
../programs/zsh.nix
|
zshCurried
|
||||||
];
|
];
|
||||||
|
|
||||||
nixpkgs.config = {
|
nixpkgs.config = {
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
{ pkgs }:
|
||||||
|
|
||||||
|
let
|
||||||
|
zshCurried = import ../programs/zsh.nix { inherit pkgs; };
|
||||||
|
in
|
||||||
|
|
||||||
{ pkgs
|
{ pkgs
|
||||||
, config
|
, config
|
||||||
, ... }:
|
, ... }:
|
||||||
|
@ -9,7 +15,7 @@ in {
|
||||||
../profiles/common.nix
|
../profiles/common.nix
|
||||||
../profiles/nix-channels.nix
|
../profiles/nix-channels.nix
|
||||||
../programs/neovim.nix
|
../programs/neovim.nix
|
||||||
../programs/zsh.nix
|
zshCurried
|
||||||
];
|
];
|
||||||
|
|
||||||
nixpkgs.config = {
|
nixpkgs.config = {
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
{ pkgs
|
{ pkgs }:
|
||||||
, config
|
|
||||||
, ...
|
{ ... }:
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
let
|
||||||
channelSources = (import ../../default.nix {
|
|
||||||
versionsPath = ../../variables/versions.nix;
|
|
||||||
}).channelSources;
|
|
||||||
|
|
||||||
just-plugin =
|
just-plugin =
|
||||||
let
|
let
|
||||||
plugin_file = pkgs.writeText "_just" ''
|
plugin_file = pkgs.writeText "_just" ''
|
||||||
|
@ -71,7 +66,7 @@ in {
|
||||||
# don't cd into directories when executed
|
# don't cd into directories when executed
|
||||||
unsetopt AUTO_CD
|
unsetopt AUTO_CD
|
||||||
|
|
||||||
source ${channelSources}
|
export NIX_PATH="${pkgs.nixPath}"
|
||||||
|
|
||||||
# print lines without termination
|
# print lines without termination
|
||||||
setopt PROMPT_CR
|
setopt PROMPT_CR
|
||||||
|
|
|
@ -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;
|
services.teamviewer.enable = true;
|
||||||
system.stateVersion = "19.09";
|
system.stateVersion = "19.09";
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 = {
|
services.hydra = {
|
||||||
enable = false;
|
enable = false;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
"${<home-manager-module>}/nixos"
|
"${<home-manager-module>}/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 = {
|
nixpkgs.config = {
|
||||||
allowBroken = false;
|
allowBroken = false;
|
||||||
|
|
|
@ -29,6 +29,10 @@
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
environment.variables = {
|
||||||
|
NIX_PATH = lib.mkForce pkgs.nixPath;
|
||||||
|
};
|
||||||
|
|
||||||
# Fonts, I18N, Date ...
|
# Fonts, I18N, Date ...
|
||||||
fonts.fonts = [
|
fonts.fonts = [
|
||||||
pkgs.corefonts
|
pkgs.corefonts
|
||||||
|
|
|
@ -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; };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue