flake.nix: make users pass pkgs explicitly

This commit is contained in:
Alexander Sosedkin 2024-06-22 19:37:11 +02:00
parent 3d24441837
commit 54a535b91b
7 changed files with 29 additions and 21 deletions

View file

@ -2,6 +2,16 @@
## Release 24.05 (unreleased)
### Compatibility considerations
* `nixOnDroidConfigurations` `pkgs` argument is now mandatory.
Put simply, if one's using a flake config, they need to add `nixpkgs` to
`outputs = { self, nixpkgs, ... }:` if it was previously missing,
then add a
`pkgs = import nixpkgs { system = "aarch64-linux"; };`
as an argument to `nixOnDroidConfiguration`.
If in doubt, refer to the `templates`.
## Release 23.11
### New Options

View file

@ -33,11 +33,6 @@
overlay = nixpkgs.lib.composeManyExtensions (import ./overlays);
pkgsPerSystem = system: import nixpkgs {
inherit system;
overlays = [ overlay ];
};
formatterPackArgsFor = forEachSystem (system: {
inherit nixpkgs system;
checkFiles = [ ./. ];
@ -74,22 +69,22 @@
formatter = forEachSystem (system: nix-formatter-pack.lib.mkFormatter formatterPackArgsFor.${system});
lib.nixOnDroidConfiguration =
{ modules ? [ ]
, system ? "aarch64-linux"
{ pkgs
, modules ? [ ]
, extraSpecialArgs ? { }
, pkgs ? pkgsPerSystem system
, home-manager-path ? home-manager.outPath
# deprecated:
, config ? null
, extraModules ? null
, system ? null # pkgs.system is used to detect user's arch
}:
if ! (builtins.elem system [ "aarch64-linux" "x86_64-linux" ]) then
if ! (builtins.elem pkgs.system [ "aarch64-linux" "x86_64-linux" ]) then
throw
("${system} is not supported; aarch64-linux / x86_64-linux " +
("${pkgs.system} is not supported; aarch64-linux / x86_64-linux " +
"are the only currently supported system types")
else
pkgs.lib.throwIf
(config != null || extraModules != null)
(config != null || extraModules != null || system != null)
''
The 'nixOnDroidConfiguration' arguments
@ -97,15 +92,17 @@
- 'extraModules'
- 'system'
have been removed. Instead use the argument 'modules'. The
'system' will be inferred by 'pkgs.system'.
have been removed.
Instead of 'extraModules' use the argument 'modules'.
The 'system' will be inferred by 'pkgs.system',
so pass a 'pkgs = import nixpkgs { system = "aarch64-linux"; };'
See the 22.11 release notes for more.
''
(import ./modules {
inherit extraSpecialArgs home-manager-path pkgs;
config.imports = modules;
config.build.arch =
nixpkgs.lib.strings.removeSuffix "-linux" system;
nixpkgs.lib.strings.removeSuffix "-linux" pkgs.system;
isFlake = true;
});

View file

@ -19,6 +19,7 @@
outputs = { self, nixpkgs, home-manager, nix-on-droid }: {
nixOnDroidConfigurations.default = nix-on-droid.lib.nixOnDroidConfiguration {
pkgs = import nixpkgs { system = "aarch64-linux"; };
modules = [ ./nix-on-droid.nix ];
};

View file

@ -13,7 +13,7 @@
outputs = { self, nixpkgs, nix-on-droid }: {
nixOnDroidConfigurations.default = nix-on-droid.lib.nixOnDroidConfiguration {
system = "aarch64-linux";
pkgs = import nixpkgs { system = "aarch64-linux"; };
modules = [ ./nix-on-droid.nix ];
};

View file

@ -7,10 +7,10 @@
nix-on-droid.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { nix-on-droid, ... }: {
outputs = { nix-on-droid, nixpkgs, ... }: {
nixOnDroidConfigurations = {
default = nix-on-droid.lib.nixOnDroidConfiguration {
system = "<<SYSTEM>>";
pkgs = import nixpkgs { system = "<<SYSTEM>>"; };
modules = [ ./nix-on-droid.nix ];
};
};

View file

@ -11,10 +11,10 @@
};
};
outputs = { nix-on-droid, ... }: {
outputs = { nix-on-droid, nixpkgs, ... }: {
nixOnDroidConfigurations = {
device = nix-on-droid.lib.nixOnDroidConfiguration {
system = "<<SYSTEM>>";
pkgs = import nixpkgs { system = "<<SYSTEM>>"; };
modules = [ ./nix-on-droid.nix ];
};
};

View file

@ -7,10 +7,10 @@
nix-on-droid.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { nix-on-droid, ... }: {
outputs = { nix-on-droid, nixpkgs, ... }: {
nixOnDroidConfigurations = {
device = nix-on-droid.lib.nixOnDroidConfiguration {
system = "<<SYSTEM>>";
pkgs = import nixpkgs { system = "<<SYSTEM>>"; };
modules = [ ./nix-on-droid.nix ];
};
};