diff --git a/flake.lock b/flake.lock index b2bc0dc..4cbc85b 100644 --- a/flake.lock +++ b/flake.lock @@ -1,33 +1,12 @@ { "nodes": { - "fenix": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ], - "rust-analyzer-src": "rust-analyzer-src" - }, - "locked": { - "lastModified": 1751352216, - "narHash": "sha256-dJj8TUoZGj55Ttro37vvFGF2L+xlYNfspQ9u4BfqTFw=", - "owner": "nix-community", - "repo": "fenix", - "rev": "61b4f1e21bd631da91981f1ed74c959d6993f554", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "fenix", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1751271578, - "narHash": "sha256-P/SQmKDu06x8yv7i0s8bvnnuJYkxVGBWLWHaU+tt4YY=", + "lastModified": 1760038930, + "narHash": "sha256-Oncbh0UmHjSlxO7ErQDM3KM0A5/Znfofj2BSzlHLeVw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "3016b4b15d13f3089db8a41ef937b13a9e33a8df", + "rev": "0b4defa2584313f3b781240b29d61f6f9f7e0df3", "type": "github" }, "original": { @@ -39,26 +18,8 @@ }, "root": { "inputs": { - "fenix": "fenix", "nixpkgs": "nixpkgs" } - }, - "rust-analyzer-src": { - "flake": false, - "locked": { - "lastModified": 1751296293, - "narHash": "sha256-oaGMVdCcI32y6jQ7RE0+CqshZngfI19XnY31eYjdinI=", - "owner": "rust-lang", - "repo": "rust-analyzer", - "rev": "eaf37e2c98b66ff7f7a0ac04e4cada39e51fde4b", - "type": "github" - }, - "original": { - "owner": "rust-lang", - "ref": "nightly", - "repo": "rust-analyzer", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index bbec243..105c672 100644 --- a/flake.nix +++ b/flake.nix @@ -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; + }; } ); };