expose helpers in self.lib
This commit is contained in:
parent
41785098de
commit
c5e248e9ff
41
flake.nix
41
flake.nix
@ -40,25 +40,28 @@
|
||||
...
|
||||
} @ inputs:
|
||||
let
|
||||
systems = [
|
||||
flake = inputs: system: nixpkgs.lib.mapAttrs (name: flake: {
|
||||
# TODO filter non-flake inputs
|
||||
nixos = flake.nixosModules
|
||||
or null;
|
||||
pkgs = flake.packages.${system}
|
||||
or flake.legacyPackages.${system}
|
||||
or null;
|
||||
lib = flake.lib.${system}
|
||||
or flake.lib
|
||||
or null;
|
||||
}) inputs;
|
||||
forSystems = systems: f: nixpkgs.lib.genAttrs systems (system: f rec {
|
||||
inherit system;
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
lib = nixpkgs.legacyPackages.${system}.lib;
|
||||
flakes = flake inputs system;
|
||||
});
|
||||
forAllSystems = forSystems [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
#"riscv64-linux"
|
||||
];
|
||||
flake = system: nixpkgs.lib.mapAttrs (name: flake: {
|
||||
# TODO filter non-flake inputs
|
||||
lib = flake.lib.${system} or null;
|
||||
nixos = flake.nixosModules or null;
|
||||
pkgs = flake.packages.${system}
|
||||
or flake.legacyPackages.${system}
|
||||
or null;
|
||||
}) inputs;
|
||||
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f rec {
|
||||
inherit system;
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
lib = nixpkgs.legacyPackages.${system}.lib;
|
||||
flakes = flake system;
|
||||
});
|
||||
|
||||
# TODO: move unstable here?
|
||||
tmpConfig = {
|
||||
@ -73,7 +76,7 @@
|
||||
inherit system;
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
flakes = flake system;
|
||||
flakes = flake inputs system;
|
||||
};
|
||||
modules = modules ++ [ ./base.nix "${self}/hosts/${hostname}" tmpConfig ({
|
||||
home-manager.extraSpecialArgs = {
|
||||
@ -109,6 +112,12 @@
|
||||
mpv-webm = pkgs.callPackage ./pkgs/mpv-webm.nix {}; # https://github.com/NixOS/nixpkgs/pull/238659
|
||||
});
|
||||
|
||||
lib = {
|
||||
inherit flake forSystems;
|
||||
} // forAllSystems({ ... }: {
|
||||
inherit flake forSystems;
|
||||
});
|
||||
|
||||
nixosConfigurations = let nm = nixos-hardware.nixosModules; in {
|
||||
# TODO: move nixos-hardware imports to the nixos configs?
|
||||
noximilien = mkConfig "noximilien" "pbsds.net" "x86_64-linux" (with nm; [ common-pc common-pc-ssd common-cpu-intel ]);
|
||||
|
Loading…
Reference in New Issue
Block a user