ctucx.git: nixfiles

ctucx' nixfiles

commit f928ad075e0739f7e17730d40b46d1be0248e5f9
parent 71129a3a91c7d5cc3c107de894348990c4fcb954
Author: Leah (ctucx) <git@ctu.cx>
Date: Tue, 17 Jan 2023 17:32:55 +0100

configurations/common: use local nixpkgs for `use`
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/configurations/common/default.nix b/configurations/common/default.nix
@@ -1,6 +1,9 @@
 { inputs, config, pkgs, lib, currentSystem, ... }:
 
-{
+let
+  NIX_PATH = lib.cleanSource pkgs.path;
+
+in {
 
   imports = (builtins.concatLists [
     [

@@ -28,15 +31,19 @@
     ] else [])
   ]);
 
-  home-manager.useGlobalPkgs = true;
   time.timeZone              = "Europe/Berlin";
 
+  home-manager.useGlobalPkgs    = true;
+  home-manager.users.leah.home.sessionVariables = {
+      NIX_PATH = NIX_PATH;
+  };
+
   environment.systemPackages = with pkgs; [
     alacritty.terminfo
   ];
 
   nix = {
-    nixPath  = lib.mkForce [ "nixpkgs=${lib.cleanSource pkgs.path}" ];
+    nixPath  = lib.mkForce [ "nixpkgs=${NIX_PATH}" ];
     package  = pkgs.nix;
     settings = {
       trusted-users         = [ "root" "leah" "@wheel" ];
diff --git a/configurations/common/programs/bash.nix b/configurations/common/programs/bash.nix
@@ -49,18 +49,15 @@
 
           backgrounditems     = "bgiparser -f  \"\$HOME/Library/Application Support/com.apple.backgroundtaskmanagementagent/backgrounditems.btm\" -c";
 
-          eval-system-config  = "nix-instantiate \"<nixpkgs/nixos>\" -A config.system.build.toplevel -I /etc/nixos/configuration.nix";
-
           yt-dlp-audio        = "yt-dlp --format bestaudio -x --audio-format opus --add-metadata --embed-thumbnail";
 
-          nix-collect-garbage = "sudo nix-collect-garbage";
         };
 
         bashrcExtra = ''
           use() {
             declare -a all
             for p in "$@"; do
-              all+=("nixpkgs#$p")
+              all+=("''${NIX_PATH}#$p")
             done
             eval nix shell ''${all[@]}
           }