72 lines
1.8 KiB
Nix
72 lines
1.8 KiB
Nix
|
{
|
||
|
description = "Redlib: Private front-end for Reddit";
|
||
|
|
||
|
inputs = {
|
||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||
|
|
||
|
crane = {
|
||
|
url = "github:ipetkov/crane";
|
||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||
|
};
|
||
|
|
||
|
flake-utils.url = "github:numtide/flake-utils";
|
||
|
|
||
|
rust-overlay = {
|
||
|
url = "github:oxalica/rust-overlay";
|
||
|
inputs = {
|
||
|
nixpkgs.follows = "nixpkgs";
|
||
|
flake-utils.follows = "flake-utils";
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
|
||
|
outputs = { nixpkgs, crane, flake-utils, rust-overlay, ... }:
|
||
|
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
|
||
|
let
|
||
|
pkgs = import nixpkgs {
|
||
|
inherit system;
|
||
|
overlays = [ (import rust-overlay) ];
|
||
|
};
|
||
|
|
||
|
inherit (pkgs) lib;
|
||
|
|
||
|
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
|
||
|
targets = [ "x86_64-unknown-linux-musl" ];
|
||
|
};
|
||
|
|
||
|
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
|
||
|
|
||
|
|
||
|
src = lib.cleanSourceWith {
|
||
|
src = craneLib.path ./.;
|
||
|
filter = path: type:
|
||
|
(lib.hasInfix "/templates/" path) ||
|
||
|
(lib.hasInfix "/static/" path) ||
|
||
|
(craneLib.filterCargoSources path type);
|
||
|
};
|
||
|
|
||
|
redlib = craneLib.buildPackage {
|
||
|
inherit src;
|
||
|
strictDeps = true;
|
||
|
doCheck = false;
|
||
|
|
||
|
CARGO_BUILD_TARGET = "x86_64-unknown-linux-musl";
|
||
|
CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static";
|
||
|
};
|
||
|
in
|
||
|
{
|
||
|
checks = {
|
||
|
my-crate = redlib;
|
||
|
};
|
||
|
|
||
|
packages.default = redlib;
|
||
|
packages.docker = pkgs.dockerTools.buildImage {
|
||
|
name = "quay.io/redlib/redlib";
|
||
|
tag = "latest";
|
||
|
created = "now";
|
||
|
copyToRoot = with pkgs.dockerTools; [ caCertificates fakeNss ];
|
||
|
config.Cmd = "${redlib}/bin/redlib";
|
||
|
};
|
||
|
});
|
||
|
}
|