Add support for building natter via nix.
This commit is contained in:
86
flake.nix
Normal file
86
flake.nix
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
description = "Natter static site generator";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs = {
|
||||
nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
rust-overlay,
|
||||
}:
|
||||
let
|
||||
forAllSystems =
|
||||
func:
|
||||
builtins.listToAttrs (
|
||||
map (system: {
|
||||
name = system;
|
||||
value = func system;
|
||||
}) nixpkgs.lib.systems.flakeExposed
|
||||
);
|
||||
in
|
||||
{
|
||||
devShells = forAllSystems (
|
||||
system:
|
||||
let
|
||||
overlays = [ (import rust-overlay) ];
|
||||
pkgs = import nixpkgs {
|
||||
inherit system overlays;
|
||||
};
|
||||
rustToolchain = (pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml);
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
nativeBuildInputs = [
|
||||
rustToolchain
|
||||
];
|
||||
buildInputs = with pkgs; [
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
packages = forAllSystems (
|
||||
system:
|
||||
let
|
||||
overlays = [ (import rust-overlay) ];
|
||||
pkgs = import nixpkgs {
|
||||
inherit system overlays;
|
||||
};
|
||||
appliedOverlay = self.overlays.default pkgs pkgs;
|
||||
in
|
||||
rec {
|
||||
default = release;
|
||||
inherit (appliedOverlay.natter)
|
||||
release
|
||||
;
|
||||
docker_env = pkgs.buildEnv {
|
||||
name = "natter";
|
||||
paths = with pkgs; [
|
||||
appliedOverlay.natter.release
|
||||
bash
|
||||
uutils-coreutils-noprefix
|
||||
# toybox # Smaller than uutils-coreutils?
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
overlays.default = final: prev: {
|
||||
natter = final.lib.makeScope final.newScope (natterScope: {
|
||||
release = (
|
||||
natterScope.callPackage ./nix/package.nix {
|
||||
inherit rust-overlay;
|
||||
buildType = "lto";
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user