nixpkgs/nixos/modules
Maximilian Bosch 8bc5104a6e
treewide: refactor .attrs.sh detection
When specifying the `builder` attribute in `stdenv.mkDerivation`, this
will be effectively transformed into

    builtins.derivation {
      builder = stdenv.shell;
      args = [ "-e" builder ];
    }

This also means that `default-builder.sh` is never sourced and as a
result it's not guaranteed that `$NIX_ATTRS_SH_FILE` is set to a correct
location[1].

Also, we need to source `.attrs.sh` to source `$stdenv`. So, the
following is done now:

* If `$NIX_ATTRS_SH_FILE` points to a correct location, then use it.
  Directly using `.attrs.sh` is problematic for `nix-shell(1)` usage
  (see previous commit for more context), so prefer the environment
  variable if possible.

* Otherwise, if `.attrs.sh` exists, then use it. See [1] for when this
  can happen.

* If neither applies, it can be assumed that `__structuredAttrs` is
  turned off and thus nothing needs to be done.

[1] It's possible that it doesn't exist at all - in case of Nix 2.3 or
    it can point to a wrong location on older Nix versions with a bug in
    `__structuredAttrs`.
2023-10-04 18:36:57 +02:00
..
config nixos/nano: add enable, package option, do not create /etc/nanorc by default 2023-09-29 00:24:34 +02:00
hardware treewide: use pkgs.config instead of config.nixpkgs.config 2023-10-01 20:48:40 +03:00
i18n/input-method uim: remove qt4, fix qt5 2023-09-04 13:54:50 +02:00
image nixos/image: fix for systemd 254 2023-09-13 12:03:50 +02:00
installer bcachefs: 2023-06-28 -> 2023-09-29 2023-10-03 22:00:26 +01:00
misc nixos/locate: cleanup optional parenthesis 2023-10-03 00:19:57 +02:00
profiles systemd-stage-1: Default to full systemd build. 2023-10-04 04:21:35 -04:00
programs nixos/environment: move XDG_CONFIG_DIRS to sessionVariables 2023-10-02 18:47:48 +00:00
security nixos/sudo-rs: add crossCompile 'fix' 2023-09-22 15:14:14 +02:00
services treewide: refactor .attrs.sh detection 2023-10-04 18:36:57 +02:00
system Merge pull request #258920 from ElvishJerricco/systemd-stage-1-full-build 2023-10-04 12:02:36 +03:00
tasks Merge staging-next into staging 2023-10-04 12:01:34 +00:00
testing Merge pull request #219106 from m-bdf/nixos-testing-increase-device-timeout 2023-06-20 11:48:45 +02:00
virtualisation nixos/qemu-vm: optionally disable overriding fileSystems 2023-10-02 11:13:26 +02:00
module-list.nix zitadel: init at 2.37.2; nixos/zitadel: init (#254896) 2023-10-03 07:11:18 +02:00
rename.nix nodePackages.tedicross: drop 2023-09-13 15:00:38 -07:00