ark/flake.nix
Timothy DeHerrera 1b80806516
compat: fixes
* fix nixos-option
* use flake-compat for all backward compat concerns
* rebuild devshell after any nix file changes
* reexport system pkgs as legacyPackages
* provide lib flake output
* provide flake lib to nixos configs via `lib.flk`
* clean up flake.nix
2021-01-23 16:45:10 -07:00

97 lines
2.7 KiB
Nix

{
description = "A highly structured configuration database.";
inputs =
{
# Once desired, bump master's locked revision:
# nix flake update --update-input master
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/flatten-tree-system";
devshell.url = "github:numtide/devshell";
nixos-hardware.url = "github:nixos/nixos-hardware";
};
outputs = inputs@{ self, home, nixos, master, flake-utils, nur, devshell, nixos-hardware }:
let
inherit (builtins) attrValues;
inherit (flake-utils.lib) eachDefaultSystem flattenTreeSystem;
inherit (nixos.lib) recursiveUpdate;
inherit (self.lib) overlays nixosModules genPackages pkgImport;
externOverlays = [ nur.overlay devshell.overlay ];
externModules = [ home.nixosModules.home-manager ];
outputs =
let
system = "x86_64-linux";
pkgs = self.legacyPackages.${system};
in
{
inherit nixosModules overlays;
nixosConfigurations =
import ./hosts
(recursiveUpdate inputs {
inherit pkgs externModules system;
inherit (pkgs) lib;
});
overlay = import ./pkgs;
lib = import ./lib {
inherit (nixos) lib;
};
templates.flk.path = ./.;
templates.flk.description = "flk template";
defaultTemplate = self.templates.flk;
};
in
recursiveUpdate
(eachDefaultSystem
(system:
let
unstable = pkgImport master [ ] system;
pkgs =
let
override = import ./pkgs/override.nix;
overlays = (attrValues self.overlays)
++ externOverlays
++ [
self.overlay
(override unstable)
(final: prev: {
lib = (prev.lib or { }) // {
inherit (nixos.lib) nixosSystem;
flk = self.lib;
utils = flake-utils.lib;
};
})
];
in
pkgImport nixos overlays system;
packages = flattenTreeSystem system
(genPackages {
inherit self pkgs;
});
in
{
inherit packages;
devShell = import ./shell {
inherit pkgs nixos;
};
legacyPackages = pkgs;
}
)
)
outputs;
}