Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove customBuilds, nixos-generate has --flake #436

Merged
merged 1 commit into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions examples/devos/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions examples/devos/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
naersk.inputs.nixpkgs.follows = "nixos";

nixos-hardware.url = "github:nixos/nixos-hardware";

nixos-generators.url = "github:nix-community/nixos-generators";
};

outputs =
Expand Down
5 changes: 3 additions & 2 deletions examples/devos/shell/devos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ in
(docs mdbook)
(devos inputs.deploy.packages.${pkgs.system}.deploy-rs)
]

++ lib.optional
(system != "i686-linux")
(devos cachix)

++ lib.optional
(system != "aarch64-darwin")
(devos inputs.nixos-generators.defaultPackage.${pkgs.system})
;
}
37 changes: 0 additions & 37 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
devshell.url = "github:numtide/devshell";
flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus";

nixos-generators.url = "github:nix-community/nixos-generators";
nixos-generators.inputs.nixpkgs.follows = "blank";

flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
Expand All @@ -38,7 +35,6 @@
, deploy
, devshell
, flake-utils-plus
, nixos-generators
, home-manager
, ...
}@inputs:
Expand All @@ -48,7 +44,6 @@

internal-modules = import ./src/modules.nix {
inherit (nixlib) lib;
inherit nixos-generators;
};

importers = import ./src/importers.nix {
Expand Down
1 change: 0 additions & 1 deletion src/mkFlake/fup-adapter.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ let
''
{ });
})
internal-modules.customBuilds
];

unifyOverlays = channels: map (o: if builtins.isFunction (o null null) then o channels else o);
Expand Down
31 changes: 1 addition & 30 deletions src/modules.nix
Original file line number Diff line number Diff line change
@@ -1,34 +1,5 @@
{ lib, nixos-generators }:
{ lib }:
{
customBuilds =
{ lib, pkgs, config, baseModules, modules, ... }@args:
{
# created in modules system for access to specialArgs and modules
lib.digga.mkBuild = buildModule:
import "${toString pkgs.path}/nixos/lib/eval-config.nix" {
inherit (pkgs) system;
inherit baseModules;
modules = modules ++ [ buildModule ];
# Newer versions of module system pass specialArgs to modules
# so try to pass that to eval if possible.
specialArgs = args.specialArgs or { };
};
system.build =
let
builds = lib.mapAttrs
(format: module:
let build = config.lib.digga.mkBuild module;
in
build // build.config.system.build.${build.config.formatAttr}
)
(if (lib.versionAtLeast config.system.stateVersion "22.05") then
builtins.removeAttrs nixos-generators.nixosModules [ "vm" ]
else nixos-generators);
in
# ensure these builds can be overriden by other modules
lib.mkDefault builds;
};

hmNixosDefaults = { specialArgs, modules }:
{ options, ... }: {
config = lib.optionalAttrs (options ? home-manager) {
Expand Down