about summary refs log tree commit diff
path: root/flake.nix
AgeCommit message (Collapse)AuthorFilesLines
8 daysflake.nix: remove power64 from from nixos check due to broken packageTristan Ross1-1/+2
2024-06-06flake.nix: make checks friendly for non-x86_64-linux systemsTristan Ross1-6/+7
2024-06-06flake.nix: make pureTristan Ross1-6/+8
2024-02-03nixos/flake: put nixpkgs in NIX_PATH and system registry for flake configsJade Lovelace1-1/+13
Currently there are a bunch of really wacky hacks required to get nixpkgs path correctly set up under flake configs such that `nix run nixpkgs#hello` and `nix run -f '<nixpkgs>' hello` hit the nixpkgs that the system was built with. In particular you have to use specialArgs or an anonymous module, and everyone has to include this hack in their own configs. We can do this for users automatically. I have tested these manually with a basic config; I don't know if it is even possible to write a nixos test for it since you can't really get a string-with-context to yourself unless you are in a flake context.
2023-12-30flake.nix: Add caveatsRobert Hensing1-1/+4
2023-12-29flake: add a test case for the nixosSystem to the flake checksr-vdp1-1/+19
2023-12-29flake: allow specifying the lib argument to nixosSystemr-vdp1-2/+3
Some configs rely on being able to pass their own lib argument into nixosSystem, for instance in order to add their own additional overlay to nixpkgs.lib. This was broken by 039f73f134.
2023-12-10flake: drop libVersionInfoOverlayMaximilian Bosch1-5/+3
It's not really a pkgs overlay, but a lib overlay.
2023-12-10flake: be backwards-compatible for `--impure`Maximilian Bosch1-4/+3
We cannot pass `overlays = ...` to `nixpkgs` directly because by default overlays from `~/.config/nixpkgs` are loaded in there. This doesn't happen by default, but when using `--impure`. Explicitly specifying that ignores these overlays. By using `pkgs.extend` the old behavior can be kept and the new overlay can be applied. Co-authored-by: Silvan Mosberger <contact@infinisil.com>
2023-12-10flake/version overlay: review fixesMaximilian Bosch1-1/+1
* Improves the comments of `lib/flake-version-info.nix` and drops the `__`-prefix from the filename. * `lib'` -> `lib0` in `nixpkgs/lib`. * Drop the declaration of `trivial.version` in the overlay because this declaration already uses the final expressions of `versionSuffix` and `release` now. * No need to fall back to `self.lastModified` anymore, this was a workaround for pre2.4 Nix. Co-authored-by: Robert Hensing <robert@roberthensing.nl> Co-authored-by: Silvan Mosberger <contact@infinisil.com>
2023-12-09flake: also provide proper version info for lib's flakeMaximilian Bosch1-9/+1
This effectively means that nixpkgs$ nix eval ./lib#lib.trivial.version "23.11.20231020.ee0d6b5" now gives meaningful results as well. See https://github.com/NixOS/nixpkgs/pull/257100#discussion_r1352075369 for the discussion around this.
2023-12-09flake: fix `lib.trivial.version` when used from a flakeMaximilian Bosch1-9/+19
A lot of fetchers from Nix's own `libfetchers` also provide the information that `lib.trivial` aims to expose with `version`/`versionSuffix`/`revision`. In fact you don't even need a `nixpkgs` channel to get a proper version suffix because of that! Unfortunately this isn't used currently. When using the nixpkgs flake, but not `nixpkgs.lib.nixosSystem` to build a NixOS configuration, the version will always be `YY.MMpre-git`. One example is e.g. `colmena` which evaluates configurations via `import (npkgs.path + "/nixos/lib/eval-config.nix")`. This patch ensures that the version suffix (i.e. the normalized last modified date + git revision) is correctly exposed in `lib.trivial`. Additionally, the change is injected into the following locations: * `lib`: with that, something like $ nix eval nixpkgs#lib.trivial.version 23.05.20230921.cf8bf79 is working fine (i.e. rather than `23.05pre-git`). * `legacyPackages` to make sure that e.g. `legacyPackages.<system>.nixos` has correct version info. This also applies to everything else using `pkgs.lib.trivial` for that purpose. * `overlays.default` which can be applied to a `nixpkgs` and changes the previous `pkgs.lib` from said `nixpkgs` to also contain the correct `version`/`revision`/etc.. This is useful for people using `nixpkgs` as flake input, but importing it manually with import inputs.nixpkgs { } Co-authored-by: Linus Heckemann <git@sphalerite.org>
2023-05-10nixosModules.pkgsReadOnly: initRobert Hensing1-0/+13
2022-11-13Merge pull request #194763 from ↵Robert Hensing1-1/+1
hercules-ci/flake-improve-nixosModules-notDetected-error-location-reporting flake.nix: Improve nixosModules.notDetected error location reporting
2022-11-08flake.nix: simplify forAllSystems (#190527)Jörg Thalheim1-2/+1
2022-10-29doc: use evaluating instead of iteratingLuc Perkins1-4/+4
2022-10-29doc: add code comment clarifying the meaning of legacyPackagesLuc Perkins1-0/+9
2022-10-06flake.nix: Improve nixosModules.notDetected error location reportingRobert Hensing1-1/+1
This is mostly equivalent, but `import` was hiding the location from the module system, breaking error location reporting and breaking `disabledModules` support for this module (unlikely).
2022-07-10flake.nix: FormatRobert Hensing1-12/+14
2022-07-10flake.lib.nixosSystem: Allow nixpkgs.system to be set insteadRobert Hensing1-0/+5
2022-05-23lib.systems: remove supported, replace with flakeExposedsternenseemann1-3/+1
Since the list only gates the platforms the nixpkgs flake exposes packages to build on, the `hydra` label made little sense. It was also only used for this purpose, so the `tier*` attributes were largely unnecessary. To reflect the intention more accurately, we expose `lib.systems.flakeExposed` and use it to gate flake.nix's system list.
2022-01-27nixos: move default module location logic to `eval-config.nix`Naïm Favier1-28/+6
2022-01-27Revert "pkgs.path: Avoid copying when used via flake"Robert Hensing1-1/+1
This reverts commit 813f9da8ab69f106055dd4a8fead7bc0a21a251b.
2022-01-27Revert "flake.nix: Set nixpkgs.config.path"Robert Hensing1-4/+0
This reverts commit 0b222173dba00680074ef9e98a5bad224f62967e.
2022-01-22flake.nix: Set nixpkgs.config.pathRobert Hensing1-0/+4
2022-01-22pkgs.path: Avoid copying when used via flakeRobert Hensing1-1/+1
2022-01-20Merge pull request #153211 from hercules-ci/minimal-nixosRobert Hensing1-0/+3
Add minimal NixOS entrypoint
2022-01-07nixos/lib: init (experimental)Robert Hensing1-0/+3
2021-12-17flake.nix: Remove redundant module lambdaRobert Hensing1-2/+2
2021-12-17nixos: Make system.build.vm a standard attribute based on vmVariantRobert Hensing1-5/+0
2021-12-17flake.nix: lib.nixosSystem: Set system.build.vm* with lib.mkDefaultRobert Hensing1-2/+2
This will help anyone who imports the qemu module themselves, to avoid a collision.
2021-12-17flake.nix: Deduplicate vmConfig, vmWithBootloaderConfigRobert Hensing1-22/+4
2021-10-05lib: add list of supported systems (#140428)Jonas Chevalier1-9/+1
Adds the first 3 tiers of RFC0046 that are being used in flake.nix.
2021-07-18flake.nix: Only add `_file`-key if position of `args.modules` is actually ↵Maximilian Bosch1-2/+8
known to the evaluator This happens if the evaluator "loses" the position of an attr-declaration[1] because of e.g. too many nested function-calls to build the final attr-set. While the actual issue should be fixed in Nix itself, this is IMHO a fair workaround to unblock affected users[2]. [1] https://github.com/NixOS/nixpkgs/commit/e14c24593420bb9057e7f38b40d17137eaeff9dd#commitcomment-53645936 [2] It seems as everyone using `divnix/digga` or `flake-utils-plus` are affected: * https://github.com/divnix/digga/issues/87
2021-07-14flake/lib.nixosSystem: add `_file`-keys for error-locationMaximilian Bosch1-1/+13
When inlining a module with a problematic declaration, you usually get get a not-so helpful error like this: $ cat flake.nix { description = "A very basic flake"; inputs.nixpkgs.url = path:../.; outputs = { self, nixpkgs }: { nixosConfigurations.foo = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ ({ lib, ... }: { services.wrong = 2; }) { services.nginx.enable = true; } ]; }; }; } $ nixos-rebuild build --flake .#foo -L error: The option `services.wrong' does not exist. Definition values: - In `<unknown-file>': 2 While it's certainly possible to guess where this comes from, this is IMHO fairly confusing for beginners (and kinda reminds me of the infamous "infinite recursion at undefined position"-error). The module-system determines the position of a declaration using the `_file`-key: this is either `toString path` if `path` is e.g. a value from `imports = [ ./foo.nix ]` or the file used as `NIXOS_CONFIG` in `<nixpkgs/nixos>`. However such a mechanism doesn't exist (yet) for inlined flake modules, so I tried to implement this in a fairly basic way: * For non-path declarations, the position of `modules` inside the `flake.nix` which declares these modules is determined by doing `unsafeGetAttrPos` on the `modules`-argument of `lib.nixosSystem`. So the `flake.nix` from above would now raise the following error-message: $ nixos-rebuild build --flake .#foo -L error: The option `services.wrong' does not exist. Definition values: - In `/nix/store/4vi3nhqjyma73ygs4f93q38qjkhkaxw8-source/flake.nix': 2 Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com> Co-authored-by: Silvan Mosberger <github@infinisil.com> Co-authored-by: Robert Hensing <robert@roberthensing.nl>
2021-05-17flake.nix: add aarch64-darwinMatthew Bauer1-0/+1
2021-01-08nixos: fix "nixos-rebuild build-vm-with-bootloader" for EFI systemsBjørn Forsman1-0/+5
(The first version of this change, in commit 39fad297fd, broke `nix-build -A nixosTests.installer.simpleUefiSystemdBoot`. This is the 2nd version, which hopefully does not break anything.) `nixos-rebuild build-vm-with-bootloader` currently fails with the default NixOS EFI configuration: $ cat >configuration.nix <<EOF { fileSystems."/".device = "/dev/sda1"; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; } EOF $ nixos-rebuild build-vm-with-bootloader -I nixos-config=$PWD/configuration.nix -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-20.09.tar.gz [...] insmod: ERROR: could not insert module /nix/store/1ibmgfr13r8b6xyn4f0wj115819f359c-linux-5.4.83/lib/modules/5.4.83/kernel/fs/efivarfs/efivarfs.ko.xz: No such device mount: /sys/firmware/efi/efivars: mount point does not exist. [ 1.908328] reboot: Power down builder for '/nix/store/dx2ycclyknvibrskwmii42sgyalagjxa-nixos-boot-disk.drv' failed with exit code 32 [...] Fix it by setting virtualisation.useEFIBoot = true when needed. Before: * release-20.03: successful build, unsuccessful run * release-20.09 (and master): unsuccessful build After: * Successful build and run. Fixes #107255
2020-10-13flake.nix: allow inclusion of `nixpkgs` as `path:/.../`Maximilian Bosch1-1/+1
When adding `nixpkgs` as flake-input using the `path`-fetcher, you currently get the following error since neither `lastModifiedDate` nor `lastModified` are stored in `flake.lock` for paths: ``` error: --- EvalError --------------------------------------------------------------------------- nix-build at: (48:71) in file: /nix/store/147clg8svaxyj7pl80ra9kmmm72mdg94-source/flake.nix 47| system.nixos.versionSuffix = 48| ".${final.substring 0 8 (self.lastModifiedDate or self.lastModified)}.${self.shortRev or "dirty"}"; | ^ 49| system.nixos.revision = final.mkIf (self ? rev) self.rev; attribute 'lastModified' missing ``` This patch adds the fallback-value `19700101` to `versionSuffix` if none of `lastModified{,Date}` are set in the lockfile.
2020-09-17nixos-rebuild: add flake support for build-vmCole Helbling1-3/+23
This relies on users using `nixpkgs.lib.nixosSystem` to define their system; otherwise, the `vm` and `vmWithBootLoader` attributes will not exist.
2020-07-28Merge pull request #92423 from Mic92/arm-flakesJörg Thalheim1-1/+8
flake.nix: add armv6l/armv7l systems
2020-07-23flake.nix: use lib.extendFabian Möller1-4/+4
This preserves the nixosSystem function if another flake uses lib.extend itself.
2020-07-06flake.nix: add armv6l/armv7l systemsJörg Thalheim1-1/+8
We built at least armv7l on hydra, therefor nixpkgs should also expose it.
2020-06-08flake.nix: Remove edition fieldEelco Dolstra1-2/+0
2020-04-03Don't pin 'nixpkgs' in the system registry by defaultEelco Dolstra1-1/+0
Nixpkgs takes up a lot of disk space so we shouldn't do this by default.
2020-04-02nix-daemon.nix: Add option nix.registryEelco Dolstra1-1/+2
This allows you to specify the system-wide flake registry. One use is to pin 'nixpkgs' to the Nixpkgs version used to build the system: nix.registry.nixpkgs.flake = nixpkgs; where 'nixpkgs' is a flake input. This ensures that commands like $ nix run nixpkgs#hello pull in a minimum of additional store paths. You can also use this to redirect flakes, e.g. nix.registry.nixpkgs.to = { type = "github"; owner = "my-org"; repo = "my-nixpkgs"; };
2020-02-10flake.nix: Add noteEelco Dolstra1-0/+2
2020-02-10Fix 'nix flake check'Eelco Dolstra1-2/+2
2020-02-05flake.nix: Handle missing rev attributeEelco Dolstra1-2/+2
Dirty trees no longer set 'rev', so we need to handle this.
2020-02-05flake.nix: Support more systemsEelco Dolstra1-1/+8
2020-02-05flake.nix: Remove packages, builders outputsEelco Dolstra1-10/+1