From f4cb733e54c986a032f728901688eded5d3b2cf3 Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Fri, 16 Oct 2020 17:58:01 +0200 Subject: [PATCH 1/5] nix/os/devices/steveej-t480s-work: bump versions --- nix/os/devices/steveej-t480s-work/versions.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/os/devices/steveej-t480s-work/versions.nix b/nix/os/devices/steveej-t480s-work/versions.nix index 129842c..1e0fb97 100644 --- a/nix/os/devices/steveej-t480s-work/versions.nix +++ b/nix/os/devices/steveej-t480s-work/versions.nix @@ -10,7 +10,7 @@ nixpkgsMaster = { url = "https://github.com/NixOS/nixpkgs/"; ref = "master"; - rev = "e7add4afc1615e12474a79098b897e11686953b7"; + rev = "253418be119d59900054e8b71190679b8d186843"; }; homeManagerModule = { url = "https://github.com/rycee/home-manager"; From 8bec9d20bd5721f72381338d7953f9359a307059 Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Fri, 16 Oct 2020 18:21:05 +0200 Subject: [PATCH 2/5] nix/os/devices/steveej-t480s-work: bump versions --- nix/os/devices/steveej-t480s-work/versions.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/os/devices/steveej-t480s-work/versions.nix b/nix/os/devices/steveej-t480s-work/versions.nix index 1e0fb97..5738178 100644 --- a/nix/os/devices/steveej-t480s-work/versions.nix +++ b/nix/os/devices/steveej-t480s-work/versions.nix @@ -10,7 +10,7 @@ nixpkgsMaster = { url = "https://github.com/NixOS/nixpkgs/"; ref = "master"; - rev = "253418be119d59900054e8b71190679b8d186843"; + rev = "c0e65c63401c9c75c403df207e4bd6439b965cb4"; }; homeManagerModule = { url = "https://github.com/rycee/home-manager"; From 3bcf7b0397c16995a2091886ca20ffa68b295c4b Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Fri, 16 Oct 2020 22:30:13 +0200 Subject: [PATCH 3/5] Justfile: fix superfluous argstr --- Justfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Justfile b/Justfile index e4588df..ccb5215 100755 --- a/Justfile +++ b/Justfile @@ -15,7 +15,7 @@ update-default-versions: esh -o ${outfile} ${template} _get_nix_path versionsPath: - echo $(set -x; nix-build --no-link --show-trace {{invocation_directory()}}/nix/default.nix -A channelSources --argstr versionsPath {{versionsPath}} --argstr rebuildarg "dummy") + echo $(set -x; nix-build --no-link --show-trace {{invocation_directory()}}/nix/default.nix -A channelSources --argstr versionsPath {{versionsPath}}) _device recipe dir +moreargs="": #!/usr/bin/env bash From 522d7279bdcc93ee00c3f093d56b72523c770f9e Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Fri, 16 Oct 2020 22:31:01 +0200 Subject: [PATCH 4/5] 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. --- nix/default.nix | 59 ++++++++++--------- .../configuration/graphical-fullblown.nix | 8 ++- .../configuration/graphical-removable.nix | 8 ++- .../configuration/text-minimal.nix | 8 ++- nix/home-manager/programs/zsh.nix | 13 ++-- nix/os/devices/steveej-t480s-work/pkg.nix | 9 ++- .../vmd32387.contaboserver.net/pkg.nix | 5 +- nix/os/profiles/common/pkg.nix | 2 +- nix/os/profiles/common/system.nix | 4 ++ nix/os/profiles/removable-medium/pkg.nix | 9 ++- 10 files changed, 77 insertions(+), 48 deletions(-) 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; }; } From a80ba79b2658b45c8af275facd2967e455c5461f Mon Sep 17 00:00:00 2001 From: Stefan Junker Date: Fri, 16 Oct 2020 22:33:09 +0200 Subject: [PATCH 5/5] nix/graphcial-fullblown: cleanup PATH These PATH settings should be made on a directory basis using direnv. --- nix/home-manager/configuration/graphical-fullblown.nix | 4 ---- 1 file changed, 4 deletions(-) diff --git a/nix/home-manager/configuration/graphical-fullblown.nix b/nix/home-manager/configuration/graphical-fullblown.nix index 1f9a7c5..46cbd3e 100644 --- a/nix/home-manager/configuration/graphical-fullblown.nix +++ b/nix/home-manager/configuration/graphical-fullblown.nix @@ -71,10 +71,6 @@ in { PATH=pkgs.lib.concatStringsSep ":" [ "$HOME/.local/bin" - "$HOME/.cargo/bin" - "$HOME/.gem/ruby/2.3.0/bin" - "$HOME/.npm-packages/bin" - "$GOPATH/bin" "$PATH" ]; };