Add flake checks
This commit is contained in:
parent
494d24322a
commit
9a184ae55e
|
@ -0,0 +1,65 @@
|
||||||
|
{
|
||||||
|
self,
|
||||||
|
nixosSystem,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
# A dummy package with no maintainer
|
||||||
|
orphanPkg = pkgs.stdenv.mkDerivation {
|
||||||
|
name = "dummy-unmaintained-package";
|
||||||
|
installPhase = ''
|
||||||
|
echo "dummy-unmaintained-package" > $out
|
||||||
|
'';
|
||||||
|
meta = {
|
||||||
|
maintainers = [ ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# A dummy package with a maintainer
|
||||||
|
parentPkg = pkgs.stdenv.mkDerivation {
|
||||||
|
name = "dummy-maintained-package";
|
||||||
|
buildInputs = [ orphanPkg ];
|
||||||
|
installPhase = ''
|
||||||
|
echo "dummy-maintained-package" > $out
|
||||||
|
'';
|
||||||
|
meta = {
|
||||||
|
maintainers = [ { github = "github"; } ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# A dummy NixOS config with an unmaintained package in its closure
|
||||||
|
config = nixosSystem {
|
||||||
|
inherit (pkgs) system;
|
||||||
|
modules = [
|
||||||
|
(
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
environment.systemPackages = [ parentPkg ];
|
||||||
|
# Boilerplate so nixosSystem compiles
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "/dev/dvd";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
boot.loader.grub.device = "/dev/dvd";
|
||||||
|
system.stateVersion = "24.05";
|
||||||
|
}
|
||||||
|
)
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
inherit (self.bundlers.${pkgs.system}) all unmaintained;
|
||||||
|
|
||||||
|
grepCheck =
|
||||||
|
name: search: target:
|
||||||
|
pkgs.runCommandLocal name { } ''
|
||||||
|
wc -l ${target} >> test.log
|
||||||
|
grep ${search} ${target} >> test.log
|
||||||
|
cp test.log $out
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
package = grepCheck "package" orphanPkg.name (unmaintained orphanPkg);
|
||||||
|
packageClosure = grepCheck "packageClosure" orphanPkg.name (unmaintained parentPkg);
|
||||||
|
configClosure = grepCheck "configClosure" orphanPkg.name (unmaintained config);
|
||||||
|
}
|
15
flake.nix
15
flake.nix
|
@ -13,12 +13,12 @@
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
lib = forAllSystems (system: import ./lib.nix { pkgs = nixpkgsFor.${system}; });
|
||||||
|
|
||||||
bundlers = forAllSystems (
|
bundlers = forAllSystems (
|
||||||
system:
|
system:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgsFor.${system};
|
inherit (self.lib.${system}) allMaintainers expandInput noMaintainers;
|
||||||
lib = import ./lib.nix { inherit pkgs; };
|
|
||||||
inherit (lib) allMaintainers expandInput noMaintainers;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
default = self.bundlers.${system}.unmaintained;
|
default = self.bundlers.${system}.unmaintained;
|
||||||
|
@ -28,5 +28,14 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style);
|
formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style);
|
||||||
|
|
||||||
|
checks = forAllSystems (
|
||||||
|
system:
|
||||||
|
import ./checks.nix {
|
||||||
|
inherit self;
|
||||||
|
inherit (nixpkgs.lib) nixosSystem;
|
||||||
|
pkgs = nixpkgsFor.${system};
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
11
lib.nix
11
lib.nix
|
@ -9,11 +9,7 @@ let
|
||||||
tail
|
tail
|
||||||
;
|
;
|
||||||
inherit (pkgs) runCommandLocal writeText;
|
inherit (pkgs) runCommandLocal writeText;
|
||||||
inherit (pkgs.lib)
|
inherit (pkgs.lib) concatLines concatStringsSep filter;
|
||||||
concatLines
|
|
||||||
concatStringsSep
|
|
||||||
filter
|
|
||||||
;
|
|
||||||
inherit (import ./closure.nix { inherit pkgs; }) drvClosure;
|
inherit (import ./closure.nix { inherit pkgs; }) drvClosure;
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
|
@ -65,10 +61,7 @@ rec {
|
||||||
expandInput =
|
expandInput =
|
||||||
input:
|
input:
|
||||||
if (input.class or null == "nixos") && (input._type or null == "configuration") then
|
if (input.class or null == "nixos") && (input._type or null == "configuration") then
|
||||||
[
|
[ input.config.system.build.toplevel ] ++ input.config.environment.systemPackages
|
||||||
input.config.system.build.toplevel
|
|
||||||
input.config.environment.systemPackages
|
|
||||||
]
|
|
||||||
else
|
else
|
||||||
input;
|
input;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue