2021-06-29 10:02:43 +02:00
|
|
|
{
|
|
|
|
description = "A simple, stateless NixOS deployment tool modeled after NixOps.";
|
|
|
|
|
|
|
|
inputs = {
|
2022-01-28 03:48:25 +01:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
stable.url = "github:NixOS/nixpkgs/nixos-21.11";
|
|
|
|
|
2021-06-29 10:02:43 +02:00
|
|
|
utils.url = "github:numtide/flake-utils";
|
|
|
|
|
|
|
|
flake-compat = {
|
|
|
|
url = "github:edolstra/flake-compat";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-02-05 08:28:14 +01:00
|
|
|
outputs = { self, nixpkgs, utils, ... }: let
|
2022-01-02 01:41:35 +01:00
|
|
|
supportedSystems = [ "x86_64-linux" "i686-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
2022-01-23 19:06:41 +01:00
|
|
|
evalNix = import ./src/nix/hive/eval.nix {
|
|
|
|
hermetic = true;
|
|
|
|
};
|
2021-06-29 10:02:43 +02:00
|
|
|
in utils.lib.eachSystem supportedSystems (system: let
|
2022-01-23 02:50:53 +01:00
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
overlays = [ self._evalJobsOverlay ];
|
|
|
|
};
|
2021-06-29 10:02:43 +02:00
|
|
|
in rec {
|
|
|
|
# We still maintain the expression in a Nixpkgs-acceptable form
|
2021-09-20 07:03:39 +02:00
|
|
|
defaultPackage = self.packages.${system}.colmena;
|
2021-11-18 07:21:00 +01:00
|
|
|
packages = rec {
|
2022-01-21 09:45:12 +01:00
|
|
|
colmena = pkgs.callPackage ./package.nix { };
|
2021-11-18 07:21:00 +01:00
|
|
|
|
2021-11-18 22:15:20 +01:00
|
|
|
# Full user manual
|
2021-11-18 07:21:00 +01:00
|
|
|
manual = let
|
|
|
|
colmena = self.packages.${system}.colmena;
|
|
|
|
deploymentOptionsMd = (pkgs.nixosOptionsDoc {
|
|
|
|
options = evalNix.docs.deploymentOptions pkgs;
|
2022-01-02 01:41:35 +01:00
|
|
|
}).optionsCommonMark;
|
2021-11-18 07:21:00 +01:00
|
|
|
metaOptionsMd = (pkgs.nixosOptionsDoc {
|
|
|
|
options = evalNix.docs.metaOptions pkgs;
|
2022-01-02 01:41:35 +01:00
|
|
|
}).optionsCommonMark;
|
2021-11-18 07:21:00 +01:00
|
|
|
in pkgs.callPackage ./manual {
|
|
|
|
inherit colmena deploymentOptionsMd metaOptionsMd;
|
|
|
|
};
|
|
|
|
|
2021-11-18 22:15:20 +01:00
|
|
|
# User manual without the CLI reference
|
2021-11-18 07:21:00 +01:00
|
|
|
manualFast = manual.override { colmena = null; };
|
2021-11-18 22:15:20 +01:00
|
|
|
|
|
|
|
# User manual with the version treated as stable
|
|
|
|
manualForceStable = manual.override { unstable = false; };
|
2021-11-18 07:21:00 +01:00
|
|
|
};
|
2021-06-29 10:02:43 +02:00
|
|
|
|
|
|
|
defaultApp = self.apps.${system}.colmena;
|
|
|
|
apps.colmena = {
|
|
|
|
type = "app";
|
|
|
|
program = "${defaultPackage}/bin/colmena";
|
|
|
|
};
|
|
|
|
|
|
|
|
devShell = pkgs.mkShell {
|
|
|
|
inputsFrom = [ defaultPackage ];
|
2022-02-16 09:54:53 +01:00
|
|
|
packages = with pkgs; [ clippy mdbook python3 editorconfig-checker rust-analyzer cargo-outdated ];
|
2021-06-29 11:04:54 +02:00
|
|
|
shellHook = ''
|
|
|
|
export NIX_PATH=nixpkgs=${pkgs.path}
|
|
|
|
'';
|
2021-06-29 10:02:43 +02:00
|
|
|
};
|
2021-09-20 07:03:39 +02:00
|
|
|
}) // {
|
2022-01-23 02:50:53 +01:00
|
|
|
# For use in integration tests
|
2022-01-23 02:53:54 +01:00
|
|
|
_evalJobsOverlay =
|
2022-01-23 02:50:53 +01:00
|
|
|
(final: prev: {
|
2022-02-05 08:28:14 +01:00
|
|
|
nix-eval-jobs = prev.nix-eval-jobs.overrideAttrs (old: {
|
|
|
|
version = old.version + "-colmena";
|
|
|
|
patches = (old.patches or []) ++ [
|
|
|
|
(final.fetchpatch {
|
|
|
|
url = "https://github.com/nix-community/nix-eval-jobs/commit/1e0f309fefc9b2d597f8475a74c82ce29c189152.patch";
|
|
|
|
sha256 = "sha256-246t3SGRA/9JsV2XPcI4Exp+TxmyYBoldQ43Wr5CcsM=";
|
|
|
|
})
|
|
|
|
];
|
2022-01-23 02:50:53 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-09-20 07:03:39 +02:00
|
|
|
overlay = final: prev: {
|
2022-01-21 09:45:12 +01:00
|
|
|
colmena = final.callPackage ./package.nix { };
|
2021-09-20 07:03:39 +02:00
|
|
|
};
|
2022-01-23 19:06:41 +01:00
|
|
|
inherit (evalNix) nixosModules;
|
2021-09-20 07:03:39 +02:00
|
|
|
};
|
2021-06-29 10:02:43 +02:00
|
|
|
}
|