21.05 beta release
[NixPkgs.git] / flake.nix
blob537f91ee5e711ccc2e9b563594333c4661889ac8
1 # Experimental flake interface to Nixpkgs.
2 # See https://github.com/NixOS/rfcs/pull/49 for details.
4   description = "A collection of packages for the Nix package manager";
6   outputs = { self }:
7     let
8       jobs = import ./pkgs/top-level/release.nix {
9         nixpkgs = self;
10       };
12       lib = import ./lib;
14       systems = [
15         "x86_64-linux"
16         "i686-linux"
17         "x86_64-darwin"
18         "aarch64-linux"
19         "armv6l-linux"
20         "armv7l-linux"
21       ];
23       forAllSystems = f: lib.genAttrs systems (system: f system);
25     in
26     {
27       lib = lib.extend (final: prev: {
28         nixosSystem = { modules, ... } @ args:
29           import ./nixos/lib/eval-config.nix (args // {
30             modules =
31               let
32                 vmConfig = (import ./nixos/lib/eval-config.nix
33                   (args // {
34                     modules = modules ++ [ ./nixos/modules/virtualisation/qemu-vm.nix ];
35                   })).config;
37                 vmWithBootLoaderConfig = (import ./nixos/lib/eval-config.nix
38                   (args // {
39                     modules = modules ++ [
40                       ./nixos/modules/virtualisation/qemu-vm.nix
41                       { virtualisation.useBootLoader = true; }
42                       ({ config, ... }: {
43                         virtualisation.useEFIBoot =
44                           config.boot.loader.systemd-boot.enable ||
45                           config.boot.loader.efi.canTouchEfiVariables;
46                       })
47                     ];
48                   })).config;
49               in
50               modules ++ [
51                 {
52                   system.nixos.versionSuffix =
53                     ".${final.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}.${self.shortRev or "dirty"}";
54                   system.nixos.revision = final.mkIf (self ? rev) self.rev;
56                   system.build = {
57                     vm = vmConfig.system.build.vm;
58                     vmWithBootLoader = vmWithBootLoaderConfig.system.build.vm;
59                   };
60                 }
61               ];
62           });
63       });
65       checks.x86_64-linux.tarball = jobs.tarball;
67       htmlDocs = {
68         nixpkgsManual = jobs.manual;
69         nixosManual = (import ./nixos/release-small.nix {
70           nixpkgs = self;
71         }).nixos.manual.x86_64-linux;
72       };
74       legacyPackages = forAllSystems (system: import ./. { inherit system; });
76       nixosModules = {
77         notDetected = import ./nixos/modules/installer/scan/not-detected.nix;
78       };
79     };