colmena/flake.nix
David Arnold 9bd5e7bb25 imp: soc of eval, modules & options
- the reason for this change is to have more transparent separation
  of concern between effectuations of the module system and pre-module
  system effectuations

- with improved flakes support down the line, pre-module system
  effectuations will get more complex

- this also allows to patch the aspects of the evaluation individually
  while tracking other components from upstream. eg. path options & eval
  but not modules
2022-05-22 01:54:52 -07:00

76 lines
2.3 KiB
Nix

{
description = "A simple, stateless NixOS deployment tool modeled after NixOps.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
stable.url = "github:NixOS/nixpkgs/nixos-21.11";
utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, nixpkgs, utils, ... }: let
supportedSystems = [ "x86_64-linux" "i686-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
colmenaOptions = import ./src/nix/hive/options.nix;
colmenaModules = import ./src/nix/hive/modules.nix;
evalNix = import ./src/nix/hive/eval.nix {
hermetic = true;
inherit colmenaOptions colmenaModules;
};
in utils.lib.eachSystem supportedSystems (system: let
pkgs = import nixpkgs {
inherit system;
};
in rec {
# We still maintain the expression in a Nixpkgs-acceptable form
defaultPackage = self.packages.${system}.colmena;
packages = rec {
colmena = pkgs.callPackage ./package.nix { };
# Full user manual
manual = let
colmena = self.packages.${system}.colmena;
deploymentOptionsMd = (pkgs.nixosOptionsDoc {
options = evalNix.docs.deploymentOptions pkgs;
}).optionsCommonMark;
metaOptionsMd = (pkgs.nixosOptionsDoc {
options = evalNix.docs.metaOptions pkgs;
}).optionsCommonMark;
in pkgs.callPackage ./manual {
inherit colmena deploymentOptionsMd metaOptionsMd;
};
# User manual without the CLI reference
manualFast = manual.override { colmena = null; };
# User manual with the version treated as stable
manualForceStable = manual.override { unstable = false; };
};
defaultApp = self.apps.${system}.colmena;
apps.colmena = {
type = "app";
program = "${defaultPackage}/bin/colmena";
};
devShell = pkgs.mkShell {
inputsFrom = [ defaultPackage packages.manualFast ];
packages = with pkgs; [
python3 editorconfig-checker
clippy rust-analyzer cargo-outdated
];
shellHook = ''
export NIX_PATH=nixpkgs=${pkgs.path}
'';
};
}) // {
overlay = final: prev: {
colmena = final.callPackage ./package.nix { };
};
inherit (evalNix) nixosModules;
};
}