nix-darwin icon indicating copy to clipboard operation
nix-darwin copied to clipboard

Conflict with Determinate Nix with `nix.enable = false`

Open StealthBadger747 opened this issue 8 months ago • 3 comments

I have attempted to make the simplest possible flake needed to reproduce this issue:

{
  description = "Simplified macOS Nix configuration";

  inputs = {
    nix.url = "https://flakehub.com/f/DeterminateSystems/nix/2";
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-24.11-darwin";
    nix-darwin.url = "github:LnL7/nix-darwin/nix-darwin-24.11";
    nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = { 
    self,
    nix,
    nix-darwin,
    nixpkgs,
    ...
  }: {
    darwinConfigurations = {
      "Eriks-MacBook-Pro" = let
        username = "erik";
        system = "aarch64-darwin";
        homedir = "/Users/${username}";
        specialArgs = {inherit username system homedir self;};
      in
      nix-darwin.lib.darwinSystem {
        inherit specialArgs;
        modules = [
          nix.darwinModules.default
          {
            nix.enable = false;
            nixpkgs.hostPlatform = "aarch64-darwin";
            system.stateVersion = 5;
          }
        ];
      };
    };

    packages."aarch64-darwin".default = self.darwinConfigurations."Eriks-MacBook-Pro".system;
  };
}

Error Log:

erik@Eriks-MacBook-Pro new-darwin % nix run nix-darwin -- switch --flake .# 

building the system configuration...
warning: Git tree '/Users/erik/.config/new-darwin' is dirty
error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37|   strict = derivationStrict drvAttrs;
             |            ^
           38|

       … while evaluating derivation 'darwin-system-24.11.fc84389'
         whose name attribute is located at «github:NixOS/nixpkgs/07bba54a1e6c02a6e88cecf4d6a8ef487956fb29?narHash=sha256-ZqjOyAtoOk4xI1K%2B56/XjCCFqeIfvECupMuKe/wiz7s%3D»/pkgs/stdenv/generic/make-derivation.nix:396:13

       … while evaluating attribute 'activationScript' of derivation 'darwin-system-24.11.fc84389'
         at «github:LnL7/nix-darwin/fc843893cecc1838a59713ee3e50e9e7edc6207c?narHash=sha256-%2BsMGqywrSr50BGMLMeY789mSrzjkoxZiu61eWjYS/8o%3D»/modules/system/default.nix:97:7:
           96|
           97|       activationScript = cfg.activationScripts.script.text;
             |       ^
           98|       activationUserScript = cfg.activationScripts.userScript.text;

       … while evaluating the option `system.activationScripts.script.text':
       … while evaluating definitions from `/nix/store/hj63xfp2c7gadsap3xs2av7c6py4rz07-source/modules/system/activation-scripts.nix':
       … while evaluating the option `system.activationScripts.launchd.text':
       … while evaluating definitions from `/nix/store/hj63xfp2c7gadsap3xs2av7c6py4rz07-source/modules/system/launchd.nix':
       … while evaluating the option `environment.launchDaemons."org.nixos.nix-daemon.plist".source':
       … while evaluating the option `environment.launchDaemons."org.nixos.nix-daemon.plist".text':
       … while evaluating definitions from `/nix/store/hj63xfp2c7gadsap3xs2av7c6py4rz07-source/modules/launchd':
       … while evaluating the option `launchd.daemons.nix-daemon.serviceConfig.EnvironmentVariables':
       … while evaluating definitions from `/nix/store/hj63xfp2c7gadsap3xs2av7c6py4rz07-source/modules/services/nix-daemon.nix':
       … while evaluating the option `nix.envVars':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: nix.envVars: accessed when `nix.enable` is off; this is a bug in
       nix-darwin or a third‐party module

I'm not sure what the workaround options are other than abandoning the Determinate Nix installation.

StealthBadger747 avatar Apr 02 '25 17:04 StealthBadger747

Hey folks, I just gave this a try and unfortunately I can't reproduce. I copied the above exactly, with the below flake.lock and it builds without error. Can you provide your flake.lock perhaps?

I would also note that I don't think you need the nix module from inputs.nix.url = "https://flakehub.com/f/DeterminateSystems/nix/2"; at all, but maybe I'm missing an important detail?

expand to see the the flake.lock ...
{
  "nodes": {
    "flake-compat": {
      "flake": false,
      "locked": {
        "lastModified": 1733328505,
        "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
        "owner": "edolstra",
        "repo": "flake-compat",
        "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
        "type": "github"
      },
      "original": {
        "owner": "edolstra",
        "repo": "flake-compat",
        "type": "github"
      }
    },
    "flake-parts": {
      "inputs": {
        "nixpkgs-lib": [
          "nix",
          "nix",
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1733312601,
        "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
        "owner": "hercules-ci",
        "repo": "flake-parts",
        "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
        "type": "github"
      },
      "original": {
        "owner": "hercules-ci",
        "repo": "flake-parts",
        "type": "github"
      }
    },
    "git-hooks-nix": {
      "inputs": {
        "flake-compat": [
          "nix",
          "nix"
        ],
        "gitignore": [
          "nix",
          "nix"
        ],
        "nixpkgs": [
          "nix",
          "nix",
          "nixpkgs"
        ],
        "nixpkgs-stable": [
          "nix",
          "nix",
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1734279981,
        "narHash": "sha256-NdaCraHPp8iYMWzdXAt5Nv6sA3MUzlCiGiR586TCwo0=",
        "owner": "cachix",
        "repo": "git-hooks.nix",
        "rev": "aa9f40c906904ebd83da78e7f328cd8aeaeae785",
        "type": "github"
      },
      "original": {
        "owner": "cachix",
        "repo": "git-hooks.nix",
        "type": "github"
      }
    },
    "nix": {
      "inputs": {
        "nix": "nix_2",
        "nixpkgs": "nixpkgs_2"
      },
      "locked": {
        "lastModified": 1747956878,
        "narHash": "sha256-we7sjiJf5djYVpTuiFSNMZhXrHD2js5pg4CTLLAYXF0=",
        "rev": "87407f66de4ddc252dba46a26c17ed2c6625c50d",
        "revCount": 132,
        "type": "tarball",
        "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/nix/2.29.0/0196fa5c-7773-7cde-94df-4174d0ceb324/source.tar.gz"
      },
      "original": {
        "type": "tarball",
        "url": "https://flakehub.com/f/DeterminateSystems/nix/2"
      }
    },
    "nix-darwin": {
      "inputs": {
        "nixpkgs": [
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1743127615,
        "owner": "LnL7",
        "repo": "nix-darwin",
        "rev": "fc843893cecc1838a59713ee3e50e9e7edc6207c",
        "type": "github"
      },
      "original": {
        "owner": "LnL7",
        "ref": "nix-darwin-24.11",
        "repo": "nix-darwin",
        "type": "github"
      }
    },
    "nix_2": {
      "inputs": {
        "flake-compat": "flake-compat",
        "flake-parts": "flake-parts",
        "git-hooks-nix": "git-hooks-nix",
        "nixpkgs": "nixpkgs",
        "nixpkgs-23-11": "nixpkgs-23-11",
        "nixpkgs-regression": "nixpkgs-regression"
      },
      "locked": {
        "lastModified": 1747665997,
        "narHash": "sha256-fkbE3RCIUPFjS9A6SoEJbgMW3Rs98cs0ZZV/eTtJjaU=",
        "rev": "0cd1fce3c3fde7dade50b23a19d9cdea0e6e2137",
        "revCount": 20033,
        "type": "tarball",
        "url": "https://api.flakehub.com/f/pinned/NixOS/nix/2.29.0/0196f80b-f2ef-7a65-8473-29dda5008aa0/source.tar.gz"
      },
      "original": {
        "type": "tarball",
        "url": "https://flakehub.com/f/NixOS/nix/%3D2.29.0"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1747179050,
        "narHash": "sha256-qhFMmDkeJX9KJwr5H32f1r7Prs7XbQWtO0h3V0a0rFY=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "adaa24fbf46737f3f1b5497bf64bae750f82942e",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "nixos-unstable",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "nixpkgs-23-11": {
      "locked": {
        "lastModified": 1717159533,
        "narHash": "sha256-oamiKNfr2MS6yH64rUn99mIZjc45nGJlj9eGth/3Xuw=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "a62e6edd6d5e1fa0329b8653c801147986f8d446",
        "type": "github"
      }
    },
    "nixpkgs-regression": {
      "locked": {
        "lastModified": 1643052045,
        "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
        "type": "github"
      }
    },
    "nixpkgs_2": {
      "locked": {
        "lastModified": 1747676747,
        "narHash": "sha256-LXkWBVqilgx7Pohwqu/ABxDVw+Cmi5/Mj2S2mpUH0Fw=",
        "rev": "72841a4a8761d1aed92ef6169a636872c986c76d",
        "revCount": 718112,
        "type": "tarball",
        "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2411.718112%2Brev-72841a4a8761d1aed92ef6169a636872c986c76d/0196eed4-afc5-7adf-84bd-d3331f09ffe7/source.tar.gz"
      },
      "original": {
        "type": "tarball",
        "url": "https://flakehub.com/f/NixOS/nixpkgs/%2A"
      }
    },
    "nixpkgs_3": {
      "locked": {
        "lastModified": 1748037224,
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "f09dede81861f3a83f7f06641ead34f02f37597f",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "nixpkgs-24.11-darwin",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "nix": "nix",
        "nix-darwin": "nix-darwin",
        "nixpkgs": "nixpkgs_3"
      }
    }
  },
  "root": "root",
  "version": 7
}

grahamc avatar May 26 '25 18:05 grahamc

@grahamc I think it resolved itself after a few weeks as I think I tried it again a while back and it worked

StealthBadger747 avatar May 26 '25 18:05 StealthBadger747

ack! ok, thanks for following up! I just had someone swing by our discord about this bug a few minutes ago, which is how I found it. Feel free to reach out if something like this is causing you trouble :)

grahamc avatar May 26 '25 18:05 grahamc