dragnpkgs/flake.nix

65 lines
1.9 KiB
Nix

{
description = "dragnpkgs together with nixpkgs and lix";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
lix-module = {
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.1-1.tar.gz";
flake = false;
};
lix = {
url = "https://git.lix.systems/lix-project/lix/archive/2.91.1.tar.gz";
flake = false;
};
};
outputs = { self, nixpkgs, lix, lix-module }:
let
overlays = [
(import ./overlay.nix)
(import "${lix-module}/overlay.nix" { inherit lix; })
];
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
in {
lib = nixpkgs.lib.extend (final: prev: {
nixosSystem = args:
import "${nixpkgs}/nixos/lib/eval-config.nix" (
{
lib = final;
system = null;
modules = args.modules ++ [
({ config, pkgs, lib, ... }: {
config.nixpkgs.flake.source = self.outPath;
config.nixpkgs.overlays = overlays;
})
(import ./module.nix)
];
} // builtins.removeAttrs args [ "modules" ]
);
mkFlake = flakeDef:
let
rewritePerSystem = sectionDef: (forAllSystems (system:
builtins.mapAttrs (name: value:
nixpkgs.legacyPackages.${system}.callPackage value {}
) sectionDef
));
in
builtins.mapAttrs (name: value:
if name == "packages" || name == "legacyPackages" || name == "devShells" then
rewritePerSystem value
else
value
) flakeDef;
});
legacyPackages = forAllSystems (system:
nixpkgs.legacyPackages.${system}.appendOverlays overlays
);
nixosModules = nixpkgs.nixosModules;
};
}