Commit graph

27 commits

Author SHA1 Message Date
Bjørn Forsman
72d906a0ea nixos: fix "nixos-rebuild build-vm-with-bootloader" for EFI systems
(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
2021-01-08 19:36:10 +01:00
Maximilian Bosch
3743c42f23
flake.nix: allow inclusion of nixpkgs as path:/.../
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-10-13 12:05:19 +02:00
Cole Helbling
e26b348689
nixos-rebuild: add flake support for build-vm
This relies on users using `nixpkgs.lib.nixosSystem` to define their
system; otherwise, the `vm` and `vmWithBootLoader` attributes will not
exist.
2020-09-17 11:44:47 -07:00
Jörg Thalheim
55cd36a232
Merge pull request #92423 from Mic92/arm-flakes
flake.nix: add armv6l/armv7l systems
2020-07-28 10:02:22 +01:00
Fabian Möller
74430a81ff
flake.nix: use lib.extend
This preserves the nixosSystem function if another flake uses lib.extend
itself.
2020-07-23 17:36:45 +02:00
Jörg Thalheim
4c26d0ec5f
flake.nix: add armv6l/armv7l systems
We built at least armv7l on hydra, therefor nixpkgs should also expose it.
2020-07-06 07:52:01 +01:00
Eelco Dolstra
97fc8af29b
flake.nix: Remove edition field 2020-06-08 12:45:17 +02:00
Eelco Dolstra
469f14ef0f
Don't pin 'nixpkgs' in the system registry by default
Nixpkgs takes up a lot of disk space so we shouldn't do this by
default.
2020-04-03 14:41:48 +02:00
Eelco Dolstra
74e7ef35fe nix-daemon.nix: Add option nix.registry
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-04-02 19:38:00 +02:00
Eelco Dolstra
a1fa9e65ca flake.nix: Add note 2020-02-10 16:36:53 +01:00
Eelco Dolstra
64e5f4d53b Fix 'nix flake check' 2020-02-10 16:26:33 +01:00
Eelco Dolstra
60330b6065 flake.nix: Handle missing rev attribute
Dirty trees no longer set 'rev', so we need to handle this.
2020-02-05 23:15:18 +01:00
Eelco Dolstra
7ff2e743e8 flake.nix: Support more systems 2020-02-05 23:15:18 +01:00
Eelco Dolstra
0bf1ab421b flake.nix: Remove packages, builders outputs 2020-02-05 23:15:18 +01:00
Eelco Dolstra
bda94ae808 epoch -> edition 2020-02-05 23:15:18 +01:00
Eelco Dolstra
26e4d09c9c Export nixosModules.notDetected 2020-02-05 23:15:18 +01:00
Eelco Dolstra
b91803bf13 nixosSystem: Automatically set version suffix from flake
E.g.

  $ nixos-version
  19.03.20190913.af5eb77 (Koi)
2020-02-05 23:15:18 +01:00
Eelco Dolstra
6a210fa345 flake.nix: Remove obsolete name attribute 2020-02-05 23:14:32 +01:00
Eelco Dolstra
63bcbc19cd Update flake interface 2020-02-05 23:14:32 +01:00
Eelco Dolstra
2ba1f3c195 Add flake outputs for the manuals 2020-02-05 23:14:32 +01:00
Eelco Dolstra
395f044bbe flake.nix: Update epoch 2020-02-05 23:14:32 +01:00
Eelco Dolstra
b70a4436c6 flake.nix: provides -> outputs 2020-02-05 23:14:32 +01:00
Eelco Dolstra
0f913dee48 flake.nix: Add check 2020-02-05 23:14:32 +01:00
Eelco Dolstra
af376fdc23 legacyPkgs -> legacyPackages 2020-02-05 23:14:32 +01:00
Eelco Dolstra
57ccd736bb Export a function for building NixOS system configurations 2020-02-05 23:14:32 +01:00
Eelco Dolstra
123dea9b0d flake.nix: Set system explicitly for now
Flakes now are evaluated in pure mode, so we can't rely on
currentSystem anymore.
2020-02-05 23:14:32 +01:00
Eelco Dolstra
8eaf02b9cd Add flake.nix 2020-02-05 23:14:32 +01:00