flake: initial multiarch support

This commit is contained in:
Timothy DeHerrera 2020-12-27 21:19:45 -07:00
parent b7016c8d92
commit 7a6e725b53
No known key found for this signature in database
GPG Key ID: 8985725DB5B0C122
2 changed files with 72 additions and 30 deletions

View File

@ -1,5 +1,20 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1605370193,
"narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5021eac20303a61fafe17224c087f5519baed54d",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home": {
"inputs": {
"nixpkgs": "nixpkgs"
@ -78,6 +93,7 @@
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"home": "home",
"master": "master",
"nixos": "nixos",

View File

@ -6,15 +6,17 @@
master.url = "nixpkgs/master";
nixos.url = "nixpkgs/release-20.09";
home.url = "github:nix-community/home-manager/release-20.09";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = inputs@{ self, home, nixos, master, nur }:
outputs = inputs@{ self, home, nixos, master, flake-utils, nur }:
let
inherit (builtins) attrNames attrValues readDir;
inherit (builtins) attrNames attrValues readDir elem;
inherit (flake-utils.lib) eachDefaultSystem;
inherit (nixos) lib;
inherit (lib) removeSuffix recursiveUpdate genAttrs filterAttrs;
inherit (lib) all removeSuffix recursiveUpdate genAttrs filterAttrs;
inherit (utils) pathsToImportedAttrs genPkgset overlayPaths modules
genPackages;
genPackages pkgImport;
utils = import ./lib/utils.nix { inherit lib; };
@ -27,33 +29,57 @@
genPkgset {
inherit master nixos overlays system;
};
outputs = {
nixosConfigurations =
import ./hosts (recursiveUpdate inputs {
inherit lib pkgset system utils;
});
overlay = import ./pkgs;
overlays = pathsToImportedAttrs overlayPaths;
nixosModules = modules;
templates.flk.path = ./.;
templates.flk.description = "flk template";
defaultTemplate = self.templates.flk;
};
in
with pkgset;
{
nixosConfigurations =
import ./hosts (recursiveUpdate inputs {
inherit lib pkgset system utils;
});
(eachDefaultSystem (system':
let
pkgs' = pkgImport {
pkgs = nixos;
system = system';
overlays = [ ];
};
in
{
devShell = import ./shell.nix {
pkgs = pkgs';
};
devShell."${system}" = import ./shell.nix {
pkgs = osPkgs;
};
packages =
let
packages' = genPackages {
overlay = self.overlay;
overlays = self.overlays;
pkgs = pkgs';
};
overlay = import ./pkgs;
overlays = pathsToImportedAttrs overlayPaths;
packages."${system}" = genPackages {
overlay = self.overlay;
overlays = self.overlays;
pkgs = osPkgs;
};
nixosModules = modules;
templates.flk.path = ./.;
templates.flk.description = "flk template";
defaultTemplate = self.templates.flk;
};
filtered = filterAttrs
(_: v:
(v.meta ? platforms)
&& (elem system' v.meta.platforms)
&& (
(all (dev: dev.meta ? platforms) v.buildInputs)
&& (all (dev: elem system' dev.meta.platforms) v.buildInputs)
))
packages';
in
filtered;
})) // outputs;
}