Fixing error: attribute 'currentSystem' missing in flake

You cannot really update existing variables like this in Nix.

I meant something like the following:

-{ pkgs ? import <nixpkgs> {} }:
+{ system ? builtins.currentSystem, pkgs ? import <nixpkgs> { inherit system; } }:
 
 with pkgs;
 let
     pkgs = import (builtins.fetchGit {
          # Descriptive name to make the store path easier to identify                
          name = "my-old-revision";                                                 
          url = "https://github.com/NixOS/nixpkgs/";                       
          ref = "refs/heads/nixpkgs-unstable";                     
          rev = "ff8b619cfecb98bb94ae49ca7ceca937923a75fa";                                           
-     }) {};
+    }) {
+      inherit system;
+    };                                                       
   outputs = { self, nixpkgs, flake-utils }:
     flake-utils.lib.eachDefaultSystem
       (system:
         let pkgs = nixpkgs.legacyPackages.${system}; in
         {
-          system = builtins.currentSystem;
-          devShell = import ./shell.nix { inherit pkgs; };
+          devShell = import ./shell.nix { inherit pkgs system; };
         }
       );
3 Likes