at 22.05-pre 3.4 kB view raw
1# Experimental flake interface to Nixpkgs. 2# See https://github.com/NixOS/rfcs/pull/49 for details. 3{ 4 description = "A collection of packages for the Nix package manager"; 5 6 outputs = { self }: 7 let 8 jobs = import ./pkgs/top-level/release.nix { 9 nixpkgs = self; 10 }; 11 12 lib = import ./lib; 13 14 systems = lib.systems.supported.hydra; 15 16 forAllSystems = f: lib.genAttrs systems (system: f system); 17 18 in 19 { 20 lib = lib.extend (final: prev: { 21 nixosSystem = { modules, ... } @ args: 22 import ./nixos/lib/eval-config.nix (args // { 23 modules = 24 let 25 vmConfig = (import ./nixos/lib/eval-config.nix 26 (args // { 27 modules = modules ++ [ ./nixos/modules/virtualisation/qemu-vm.nix ]; 28 })).config; 29 30 vmWithBootLoaderConfig = (import ./nixos/lib/eval-config.nix 31 (args // { 32 modules = modules ++ [ 33 ./nixos/modules/virtualisation/qemu-vm.nix 34 { virtualisation.useBootLoader = true; } 35 ({ config, ... }: { 36 virtualisation.useEFIBoot = 37 config.boot.loader.systemd-boot.enable || 38 config.boot.loader.efi.canTouchEfiVariables; 39 }) 40 ]; 41 })).config; 42 43 moduleDeclarationFile = 44 let 45 # Even though `modules` is a mandatory argument for `nixosSystem`, it doesn't 46 # mean that the evaluator always keeps track of its position. If there 47 # are too many levels of indirection, the position gets lost at some point. 48 intermediatePos = builtins.unsafeGetAttrPos "modules" args; 49 in 50 if intermediatePos == null then null else intermediatePos.file; 51 52 # Add the invoking file as error message location for modules 53 # that don't have their own locations; presumably inline modules. 54 addModuleDeclarationFile = 55 m: if moduleDeclarationFile == null then m else { 56 _file = moduleDeclarationFile; 57 imports = [ m ]; 58 }; 59 60 in 61 map addModuleDeclarationFile modules ++ [ 62 { 63 system.nixos.versionSuffix = 64 ".${final.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}.${self.shortRev or "dirty"}"; 65 system.nixos.revision = final.mkIf (self ? rev) self.rev; 66 67 system.build = { 68 vm = vmConfig.system.build.vm; 69 vmWithBootLoader = vmWithBootLoaderConfig.system.build.vm; 70 }; 71 } 72 ]; 73 }); 74 }); 75 76 checks.x86_64-linux.tarball = jobs.tarball; 77 78 htmlDocs = { 79 nixpkgsManual = jobs.manual; 80 nixosManual = (import ./nixos/release-small.nix { 81 nixpkgs = self; 82 }).nixos.manual.x86_64-linux; 83 }; 84 85 legacyPackages = forAllSystems (system: import ./. { inherit system; }); 86 87 nixosModules = { 88 notDetected = import ./nixos/modules/installer/scan/not-detected.nix; 89 }; 90 }; 91}