Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 3 additions & 42 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

151 changes: 71 additions & 80 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,109 +1,100 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { self, nixpkgs, fenix }:
outputs = { self, nixpkgs }:
let
eachSystem = nixpkgs.lib.genAttrs systems;
systems = [
"x86_64-linux"
"aarch64-linux"
];
crossTargets = [
"aarch64-unknown-linux-musl"
"x86_64-unknown-linux-musl"
];
in {
devShells =
let
extraRustStds = system: targets: map (target: fenix.packages.${system}.targets.${target}.stable.rust-std) targets;
toolchain = system: targets:
with fenix.packages.${system}; combine ([
stable.toolchain
] ++ (extraRustStds system targets));
in
eachSystem (system:
{
default =
with import nixpkgs { inherit system; };
mkShell {
nativeBuildInputs = [
(toolchain system crossTargets)
yaml-language-server
pkgsCross.aarch64-multiplatform-musl.pkgsStatic.stdenv.cc
pkgsStatic.stdenv.cc
gh
];
eachSystem (system:
{
default =
with import nixpkgs { inherit system; };
mkShell {
nativeBuildInputs = [
cargo
clippy
gdb
gh
openssl
pkg-config
rust-analyzer
rustc
rustfmt
yaml-language-server
];

CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER =
let cc = pkgsStatic.stdenv.cc;
in "${cc}/bin/${cc.targetPrefix}cc";
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER =
let cc = pkgsCross.aarch64-multiplatform-musl.pkgsStatic.stdenv.cc;
in "${cc}/bin/${cc.targetPrefix}cc";
# CARGO_BUILD_RUSTFLAGS = [ "-C" "target-feature=+crt-static" ];
# TARGET_CC = "${CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER}";
};
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER =
let cc = pkgsStatic.stdenv.cc;
in "${cc}/bin/${cc.targetPrefix}cc";
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER =
let cc = pkgsCross.aarch64-multiplatform-musl.pkgsStatic.stdenv.cc;
in "${cc}/bin/${cc.targetPrefix}cc";
# CARGO_BUILD_RUSTFLAGS = [ "-C" "target-feature=+crt-static" ];
# TARGET_CC = "${CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER}";
};

test =
with import nixpkgs { inherit system; };
mkShell {
nativeBuildInputs = [ fenix.packages.${system}.stable.minimalToolchain ];
};
}
);
test =
with import nixpkgs { inherit system; };
mkShell {
nativeBuildInputs = [
cargo
openssl
pkg-config
rustc
];
};
}
);

packages = eachSystem (system:
{
default =
with import nixpkgs { inherit system; };
let
toolchain =
with fenix.packages.${system};
combine [ stable.cargo stable.rustc ];
rustPlatform = makeRustPlatform { cargo = toolchain; rustc = toolchain; };
in
rustPlatform.buildRustPackage {
pname = "ipupdate";
version = "0.3.0";
src = self;
cargoLock.lockFile = ./Cargo.lock;
};
rustPlatform.buildRustPackage {
pname = "ipupdate";
version = "0.3.0";
src = self;
cargoLock.lockFile = ./Cargo.lock;
};

ipupdate-x86_64 =
with import nixpkgs { localSystem = system; crossSystem = { system = "x86_64-unknown-linux-musl"; isStatic = true; }; };
let
toolchain =
with fenix.packages.${system};
combine [ stable.cargo stable.rustc targets.x86_64-unknown-linux-musl.stable.rust-std ];
rustPlatform = makeRustPlatform { cargo = toolchain; rustc = toolchain; };
in
rustPlatform.buildRustPackage {
pname = "ipupdate";
version = "0.3.0";
src = self;
cargoLock.lockFile = ./Cargo.lock;
with import nixpkgs {
localSystem = system;
crossSystem = {
system = "x86_64-unknown-linux-musl";
isStatic = true;
rustc.rustcTarget = "x86_64-unknown-linux-musl";
};
};
rustPlatform.buildRustPackage {
pname = "ipupdate";
version = "0.3.0";
src = self;
cargoLock.lockFile = ./Cargo.lock;
};

ipupdate-aarch64 =
with import nixpkgs { localSystem = system; crossSystem = { system = "aarch64-unknown-linux-musl"; isStatic = true; }; };
let
toolchain =
with fenix.packages.${system};
combine [ stable.cargo stable.rustc targets.aarch64-unknown-linux-musl.stable.rust-std ];
rustPlatform = makeRustPlatform { cargo = toolchain; rustc = toolchain; };
in
rustPlatform.buildRustPackage {
pname = "ipupdate";
version = "0.3.0";
src = self;
cargoLock.lockFile = ./Cargo.lock;
with import nixpkgs {
localSystem = system;
crossSystem = {
system = "aarch64-unknown-linux-musl";
isStatic = true;
rustc.rustcTarget = "aarch64-unknown-linux-musl";
};
};
rustPlatform.buildRustPackage {
pname = "ipupdate";
version = "0.3.0";
src = self;
cargoLock.lockFile = ./Cargo.lock;
};
}
);
};
Expand Down