Set up nix building.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@
|
|||||||
/work
|
/work
|
||||||
/example_logs
|
/example_logs
|
||||||
TODO.org
|
TODO.org
|
||||||
|
/result
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ url = { version = "2.5.8", default-features = false, features = ["std"] }
|
|||||||
primal = { version = "0.3.3", default-features = false, features = [] }
|
primal = { version = "0.3.3", default-features = false, features = [] }
|
||||||
|
|
||||||
# Optimized build for any sort of release.
|
# Optimized build for any sort of release.
|
||||||
[profile.release-lto]
|
[profile.lto]
|
||||||
inherits = "release"
|
inherits = "release"
|
||||||
lto = true
|
lto = true
|
||||||
strip = "symbols"
|
strip = "symbols"
|
||||||
|
|||||||
71
flake.nix
71
flake.nix
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
description = "nix_builder development environment";
|
description = "nix_builder nix package builder";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
@@ -33,9 +33,10 @@
|
|||||||
system:
|
system:
|
||||||
let
|
let
|
||||||
overlays = [ (import rust-overlay) ];
|
overlays = [ (import rust-overlay) ];
|
||||||
pkgs = import nixpkgs {
|
pkgs =
|
||||||
|
(import nixpkgs {
|
||||||
inherit system overlays;
|
inherit system overlays;
|
||||||
};
|
}).pkgsStatic;
|
||||||
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@@ -62,5 +63,69 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
packages = forAllSystems (
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
overlays = [ (import rust-overlay) ];
|
||||||
|
pkgs =
|
||||||
|
(import nixpkgs {
|
||||||
|
inherit system overlays;
|
||||||
|
}).pkgsStatic;
|
||||||
|
cargoToml = (pkgs.lib.importTOML ./Cargo.toml);
|
||||||
|
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||||
|
rustPlatform = pkgs.makeRustPlatform {
|
||||||
|
cargo = rustToolchain;
|
||||||
|
rustc = rustToolchain;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
rec {
|
||||||
|
app = rustPlatform.buildRustPackage {
|
||||||
|
pname = "nix_builder";
|
||||||
|
version = cargoToml.package.version;
|
||||||
|
src = pkgs.lib.cleanSource ./.;
|
||||||
|
|
||||||
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
|
|
||||||
|
buildType = "lto";
|
||||||
|
# RUSTFLAGS = "-C target-cpu=x86-64-v3";
|
||||||
|
|
||||||
|
meta = with pkgs.lib; {
|
||||||
|
description = "A builder of nix configs for a build server.";
|
||||||
|
homepage = "https://code.fizz.buzz/talexander/nix_builder";
|
||||||
|
license = licenses.bsd0;
|
||||||
|
maintainers = [ ];
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
wrapProgram $out/bin/nix-builder --prefix PATH : ${
|
||||||
|
pkgs.lib.makeBinPath [
|
||||||
|
pkgs.git
|
||||||
|
pkgs.nix
|
||||||
|
pkgs.nixos-rebuild
|
||||||
|
]
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
# nativeBuildInputs = [
|
||||||
|
# pkgs.pkg-config
|
||||||
|
# ];
|
||||||
|
# buildInputs = [
|
||||||
|
# pkgs.openssl
|
||||||
|
# ];
|
||||||
|
};
|
||||||
|
docker_env = pkgs.buildEnv {
|
||||||
|
name = "nix_builder";
|
||||||
|
paths = with pkgs; [
|
||||||
|
app
|
||||||
|
# bash
|
||||||
|
# uutils-coreutils-noprefix
|
||||||
|
# toybox # Smaller than uutils-coreutils?
|
||||||
|
];
|
||||||
|
};
|
||||||
|
default = app;
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user