summaryrefslogtreecommitdiff
path: root/flake.nix (follow)
Commit message (Expand)AuthorAgeFilesLines
* flake: fix `nix flake check --all-systems --no-build` again•••This regressed in be4d27febe7776aac010f1ce11e1ff1f60f09bdd, because sphinx-issues depends on pandoc at build-time (which depends on GHC). Previously fixed in https://github.com/NixOS/nixpkgs/pull/349076. Cole Helbling2025-04-021-6/+25
* Revert "flake: fix `nix flake check --all-systems --no-build` again"Cole Helbling2025-04-021-4/+0
* flake: fix `nix flake check --all-systems --no-build` again•••This regressed in be4d27febe7776aac010f1ce11e1ff1f60f09bdd, because sphinx-issues depends on pandoc at build-time (which depends on GHC). Previously fixed in https://github.com/NixOS/nixpkgs/pull/349076. Cole Helbling2025-04-021-0/+4
* treewide: Format all Nix files•••Format all Nix files using the officially approved formatter, making the CI check introduced in the previous commit succeed: nix-build ci -A fmt.check This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153) of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166). This commit will lead to merge conflicts for a number of PRs, up to an estimated ~1100 (~33%) among the PRs with activity in the past 2 months, but that should be lower than what it would be without the previous [partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537). Merge conflicts caused by this commit can now automatically be resolved while rebasing using the [auto-rebase script](https://github.com/NixOS/nixpkgs/tree/8616af08d915377bd930395f3b700a0e93d08728/maintainers/scripts/auto-rebase). If you run into any problems regarding any of this, please reach out to the [formatting team](https://nixos.org/community/teams/formatting/) by pinging @NixOS/nix-formatting. Silvan Mosberger2025-04-011-99/+136
* flake.nix: Set formatter•••This enables `nix fmt`, though it won't be practically usable without also reformatting all files, which is done in a following commit. Silvan Mosberger2025-04-011-0/+2
* lib: Discourage use of extend•••It creates interoperability issues that can not be reconciled by `lib` or maintainers of projects that use the Nixpkgs library. Occasionally, end users may be able to solve the problems they run into, but most are not prepared to deal with this set of problems, nor should they be. Typical conflict: - User wants to propagate their own lib, because it has some function they like to use throughout their projects - Project maintainer requires the project's lib to be used No sane language uses a single namespace for combining all the things. (Arguably not even C with its extensive use of prefixing) Meanwhile, in Nix, all symbols are first class variables. We don't even have the concept of a global top-level namespace to pour everything into. With `lib` you can try to approximate that, I get the appeal of its apparent simplicity, but since `lib` can't be global, we just don't even get that apparent simplicity. I apologize for not offering concrete solutions to this in the text. The manuals are limited to reference documentation. Alternatives - of which we have multiple - are best provided in task-oriented documentation, e.g. nix.dev. Robert Hensing2025-01-231-0/+2
* flake.nix: relax checks after shellcheck filterTristan Ross2025-01-091-4/+0
* flake.nix: exclude armv6-linux, riscv64-linux, and FreeBSD from devShells•••nixfmt-rfc-style is built with Haskell, and the packaged GHC compiler does not support any of these platforms (currently?). error: … while checking flake output 'devShells' at /nix/store/p36amaznf46ic90fb2rw5c952mgj6mfi-source/flake.nix:123:7: 122| 123| devShells = forAllSystems (system: { } // lib.optionalAttrs (system != "armv6l-linux" && system != "riscv64-linux") { | ^ 124| /** A shell to get tooling for Nixpkgs development. See nixpkgs/shell.nix. */ … while checking the derivation 'devShells.x86_64-freebsd.default' at /nix/store/p36amaznf46ic90fb2rw5c952mgj6mfi-source/flake.nix:125:9: 124| /** A shell to get tooling for Nixpkgs development. See nixpkgs/shell.nix. */ 125| default = import ./shell.nix { inherit system; }; | ^ 126| }); (stack trace truncated; use '--show-trace' to show the full, detailed trace) error: Package ‘ghc-9.6.6’ in /nix/store/8akjd9ngyzhzi1412nxmw26rnj93l3gp-source/pkgs/development/compilers/ghc/common-hadrian.nix:579 is not available on the requested hostPlatform: hostPlatform.config = "x86_64-unknown-freebsd" package.meta.platforms = [ "aarch64-darwin" "aarch64-linux" "i686-linux" "x86_64-darwin" "x86_64-linux" ] package.meta.badPlatforms = [ ] , refusing to evaluate. Cole Helbling2024-10-161-4/+14
* flake.nix: exclude armv6-linux and riscv64-linux from checks•••Otherwise, `nix flake check --all-systems --json` fails with: error: … while calling the 'head' builtin at /nix/store/0jy5khqx0rfw8avcq6z5zaxaj2ppz8d3-source/lib/attrsets.nix:1575:11: 1574| || pred here (elemAt values 1) (head values) then 1575| head values | ^ 1576| else … while evaluating the attribute 'value' at /nix/store/0jy5khqx0rfw8avcq6z5zaxaj2ppz8d3-source/lib/modules.nix:816:9: 815| in warnDeprecation opt // 816| { value = addErrorContext "while evaluating the option `${showOption loc}':" value; | ^ 817| inherit (res.defsFinal') highestPrio; … while evaluating the option `system.build.toplevel': … while evaluating definitions from `/nix/store/0jy5khqx0rfw8avcq6z5zaxaj2ppz8d3-source/nixos/modules/system/activation/top-level.nix': … while evaluating the option `system.systemBuilderArgs': … while evaluating definitions from `/nix/store/0jy5khqx0rfw8avcq6z5zaxaj2ppz8d3-source/nixos/modules/system/activation/activatable-system.nix': … while evaluating the option `system.activationScripts.etc.text': … while evaluating definitions from `/nix/store/0jy5khqx0rfw8avcq6z5zaxaj2ppz8d3-source/nixos/modules/system/etc/etc-activation.nix': … while evaluating definitions from `/nix/store/0jy5khqx0rfw8avcq6z5zaxaj2ppz8d3-source/nixos/modules/system/etc/etc.nix': … while evaluating the option `environment.etc.dbus-1.source': (stack trace truncated; use '--show-trace' to show the full, detailed trace) error: cannot bootstrap GHC on this platform ('riscv64-linux' with libc 'defaultLibc') Cole Helbling2024-10-161-2/+11
* flake.nix: Add doc comments (#343235)Aleksana2024-09-301-10/+72
|\
| * flake.nix: Add doc commentsRobert Hensing2024-09-201-10/+72
* | treewide: replace `stdenv.is` with `stdenv.hostPlatform.is`•••In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ``` Artturin2024-09-251-1/+1
* | nixos: set system.stateVersion from the nixpkgs release, not version•••The nixpkgs/nixos version includes a suffix like "pre-git" or "pre676716.6f16e67b4921", which does not match the conventional "XX.YY" format of system.stateVersion. Unifying the format to "XX.YY" allows for (stricter) validation (see #317858), and the introduction in 3a5ff9a68c9dbb8b707555d44988575b3e9544bf was only concerned with silencing warnings, so the addition of the "pre.*" suffix into stateVersion was probably unintentional. tilpner2024-09-231-1/+1
|/
* flake.nix: add pinned devshellTristan Ross2024-08-091-0/+4
* flake.nix: remove power64 from from nixos check due to broken packageTristan Ross2024-06-171-1/+2
* flake.nix: make checks friendly for non-x86_64-linux systemsTristan Ross2024-06-061-6/+7
* flake.nix: make pureTristan Ross2024-06-061-6/+8
* nixos/flake: put nixpkgs in NIX_PATH and system registry for flake configs•••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. Jade Lovelace2024-02-031-1/+13
* flake.nix: Add caveatsRobert Hensing2023-12-301-1/+4
* flake: add a test case for the nixosSystem to the flake checksr-vdp2023-12-291-1/+19
* flake: allow specifying the lib argument to nixosSystem•••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. r-vdp2023-12-291-2/+3
* flake: drop libVersionInfoOverlay•••It's not really a pkgs overlay, but a lib overlay. Maximilian Bosch2023-12-101-5/+3
* flake: be backwards-compatible for `--impure`•••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> Maximilian Bosch2023-12-101-4/+3
* flake/version overlay: review fixes•••* 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> Maximilian Bosch2023-12-101-1/+1
* flake: also provide proper version info for lib's flake•••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. Maximilian Bosch2023-12-091-9/+1
* flake: fix `lib.trivial.version` when used from a flake•••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> Maximilian Bosch2023-12-091-9/+19
* nixosModules.pkgsReadOnly: initRobert Hensing2023-05-101-0/+13
* Merge pull request #194763 from hercules-ci/flake-improve-nixosModules-notDet...•••flake.nix: Improve nixosModules.notDetected error location reportingRobert Hensing2022-11-131-1/+1
|\
| * flake.nix: Improve nixosModules.notDetected error location reporting•••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). Robert Hensing2022-10-061-1/+1
* | flake.nix: simplify forAllSystems (#190527)Jörg Thalheim2022-11-081-2/+1
* | doc: use evaluating instead of iteratingLuc Perkins2022-10-291-4/+4
* | doc: add code comment clarifying the meaning of legacyPackagesLuc Perkins2022-10-291-0/+9
|/
* flake.nix: FormatRobert Hensing2022-07-101-12/+14
* flake.lib.nixosSystem: Allow nixpkgs.system to be set insteadRobert Hensing2022-07-101-0/+5
* lib.systems: remove supported, replace with flakeExposed•••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. sternenseemann2022-05-231-3/+1
* nixos: move default module location logic to `eval-config.nix`Naïm Favier2022-01-271-28/+6
* Revert "pkgs.path: Avoid copying when used via flake"•••This reverts commit 813f9da8ab69f106055dd4a8fead7bc0a21a251b. Robert Hensing2022-01-271-1/+1
* Revert "flake.nix: Set nixpkgs.config.path"•••This reverts commit 0b222173dba00680074ef9e98a5bad224f62967e. Robert Hensing2022-01-271-4/+0
* flake.nix: Set nixpkgs.config.pathRobert Hensing2022-01-221-0/+4
* pkgs.path: Avoid copying when used via flakeRobert Hensing2022-01-221-1/+1
* Merge pull request #153211 from hercules-ci/minimal-nixos•••Add minimal NixOS entrypointRobert Hensing2022-01-201-0/+3
|\
| * nixos/lib: init (experimental)Robert Hensing2022-01-071-0/+3
* | flake.nix: Remove redundant module lambdaRobert Hensing2021-12-171-2/+2
* | nixos: Make system.build.vm a standard attribute based on vmVariantRobert Hensing2021-12-171-5/+0
* | flake.nix: lib.nixosSystem: Set system.build.vm* with lib.mkDefault•••This will help anyone who imports the qemu module themselves, to avoid a collision. Robert Hensing2021-12-171-2/+2
* | flake.nix: Deduplicate vmConfig, vmWithBootloaderConfigRobert Hensing2021-12-171-22/+4
|/
* lib: add list of supported systems (#140428)•••Adds the first 3 tiers of RFC0046 that are being used in flake.nix.Jonas Chevalier2021-10-051-9/+1
* flake.nix: Only add `_file`-key if position of `args.modules` is actually kno...•••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 Maximilian Bosch2021-07-181-2/+8
* flake/lib.nixosSystem: add `_file`-keys for error-location•••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> Maximilian Bosch2021-07-141-1/+13
* flake.nix: add aarch64-darwinMatthew Bauer2021-05-171-0/+1