pkgs-lib: don't system space functions
have each function take pkgs as an argument, so a nixpkgs isn't created just for pkgs-lib and they support more systems
This commit is contained in:
parent
ba01aa7db7
commit
3986cc441b
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
pkgs-lib = import ./pkgs-lib {
|
pkgs-lib = import ./pkgs-lib {
|
||||||
lib = nixpkgs.lib // self;
|
lib = nixpkgs.lib // self;
|
||||||
inherit nixpkgs deploy devshell;
|
inherit deploy devshell;
|
||||||
};
|
};
|
||||||
|
|
||||||
inherit (attrs)
|
inherit (attrs)
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
{ lib, nixpkgs, deploy, devshell }:
|
{ lib, deploy, devshell }:
|
||||||
|
{
|
||||||
|
tests = import ./tests { inherit lib deploy; };
|
||||||
|
shell = import ./shell { inherit lib devshell deploy; };
|
||||||
|
}
|
||||||
|
|
||||||
lib.genAttrs
|
|
||||||
lib.defaultSystems
|
|
||||||
(system:
|
|
||||||
let
|
|
||||||
pkgs = import nixpkgs { inherit system; };
|
|
||||||
in
|
|
||||||
{
|
|
||||||
tests = import ./tests { inherit lib deploy nixpkgs pkgs system; };
|
|
||||||
shell = import ./shell { inherit lib devshell deploy nixpkgs system; };
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
@ -1,27 +1,30 @@
|
|||||||
{ lib, nixpkgs, devshell, deploy, system }:
|
{ lib, devshell, deploy }:
|
||||||
|
|
||||||
|
{ pkgs }:
|
||||||
let
|
let
|
||||||
overlays = [
|
overlays = [
|
||||||
|
|
||||||
devshell.overlay
|
devshell.overlay
|
||||||
|
|
||||||
(final: prev: {
|
(final: prev: {
|
||||||
deploy-rs =
|
deploy-rs =
|
||||||
deploy.packages.${prev.system}.deploy-rs;
|
deploy.packages.${prev.system}.deploy-rs;
|
||||||
})
|
})
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
pkgs = import nixpkgs { inherit system overlays; config = { }; };
|
pkgs' = import pkgs.path {
|
||||||
|
inherit (pkgs) system;
|
||||||
|
inherit overlays;
|
||||||
|
};
|
||||||
|
|
||||||
flk = pkgs.callPackage ./flk.nix { };
|
flk = pkgs'.callPackage ./flk.nix { };
|
||||||
|
|
||||||
installPkgs = (lib.nixosSystem {
|
installPkgs = (lib.nixosSystem {
|
||||||
inherit system;
|
inherit (pkgs') system;
|
||||||
modules = [ ];
|
modules = [ ];
|
||||||
}).config.system.build;
|
}).config.system.build;
|
||||||
in
|
in
|
||||||
pkgs.devshell.mkShell {
|
pkgs'.devshell.mkShell {
|
||||||
imports = [ (pkgs.devshell.importTOML ./devshell.toml) ];
|
imports = [ (pkgs'.devshell.importTOML ./devshell.toml) ];
|
||||||
|
|
||||||
packages = with installPkgs; [
|
packages = with installPkgs; [
|
||||||
nixos-install
|
nixos-install
|
||||||
@ -33,13 +36,13 @@ pkgs.devshell.mkShell {
|
|||||||
pre-commit.text = lib.fileContents ./pre-commit.sh;
|
pre-commit.text = lib.fileContents ./pre-commit.sh;
|
||||||
};
|
};
|
||||||
|
|
||||||
commands = with pkgs; [
|
commands = with pkgs'; [
|
||||||
{ package = flk; }
|
{ package = flk; }
|
||||||
{
|
{
|
||||||
name = "nix";
|
name = "nix";
|
||||||
help = pkgs.nixFlakes.meta.description;
|
help = pkgs'.nixFlakes.meta.description;
|
||||||
command = ''
|
command = ''
|
||||||
${pkgs.nixFlakes}/bin/nix --experimental-features "nix-command flakes ca-references" "${"\${@}"}"
|
${pkgs'.nixFlakes}/bin/nix --experimental-features "nix-command flakes ca-references" "${"\${@}"}"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1,25 +1,28 @@
|
|||||||
{ lib, nixpkgs, pkgs, deploy, system }:
|
{ lib, deploy }:
|
||||||
let
|
let
|
||||||
mkChecks = { hosts, nodes, homes ? { } }:
|
mkChecks = { pkgs, hosts, nodes, homes ? { } }:
|
||||||
let
|
let
|
||||||
deployHosts = lib.filterAttrs
|
deployHosts = lib.filterAttrs
|
||||||
(n: _: hosts.${n}.config.nixpkgs.system == system)
|
(n: _: hosts.${n}.config.nixpkgs.system == pkgs.system)
|
||||||
nodes;
|
nodes;
|
||||||
deployChecks = deploy.lib.${system}.deployChecks { nodes = deployHosts; };
|
deployChecks = deploy.lib.${pkgs.system}.deployChecks { nodes = deployHosts; };
|
||||||
tests =
|
tests =
|
||||||
lib.optionalAttrs (deployHosts != { })
|
lib.optionalAttrs (deployHosts != { })
|
||||||
{
|
{
|
||||||
profilesTest = profilesTest (hosts.${(builtins.head (builtins.attrNames deployHosts))});
|
profilesTest = profilesTest {
|
||||||
|
inherit pkgs;
|
||||||
|
host = hosts.${(builtins.head (builtins.attrNames deployHosts))};
|
||||||
|
};
|
||||||
} // lib.mapAttrs (n: v: v.activationPackage) homes;
|
} // lib.mapAttrs (n: v: v.activationPackage) homes;
|
||||||
|
|
||||||
in
|
in
|
||||||
lib.recursiveUpdate tests deployChecks;
|
lib.recursiveUpdate tests deployChecks;
|
||||||
|
|
||||||
mkTest = host:
|
mkTest = { pkgs, host }:
|
||||||
let
|
let
|
||||||
nixosTesting =
|
nixosTesting =
|
||||||
(import "${nixpkgs}/nixos/lib/testing-python.nix" {
|
(import "${toString pkgs.path}/nixos/lib/testing-python.nix" {
|
||||||
inherit system;
|
inherit (pkgs) system;
|
||||||
inherit (host.config.lib) specialArgs;
|
inherit (host.config.lib) specialArgs;
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
extraConfigurations = [
|
extraConfigurations = [
|
||||||
@ -40,15 +43,15 @@ let
|
|||||||
in
|
in
|
||||||
nixosTesting.makeTest calledTest;
|
nixosTesting.makeTest calledTest;
|
||||||
|
|
||||||
profilesTest = host: mkTest host {
|
profilesTest = args@{ host, ... }: mkTest args {
|
||||||
name = "profiles";
|
name = "profiles";
|
||||||
|
|
||||||
machine = { suites, ... }: {
|
machine = { suites, ... }: {
|
||||||
imports = suites.allProfiles ++ suites.allUsers;
|
imports = suites.allProfiles;
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
machine.systemctl("is-system-running --wait")
|
${host.config.networking.hostName}.systemctl("is-system-running --wait")
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
Loading…
Reference in New Issue
Block a user