Skip to content

Commit

Permalink
Merge pull request #436 from Pacman99/remove-customBuilds
Browse files Browse the repository at this point in the history
Remove customBuilds, nixos-generate has --flake
  • Loading branch information
Pacman99 authored Apr 1, 2022
2 parents 336235e + 51d8ca3 commit 6740420
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 75 deletions.
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

0 comments on commit 6740420

Please sign in to comment.