diff --git a/flake.lock b/flake.lock index 54bf5da..08f3592 100644 --- a/flake.lock +++ b/flake.lock @@ -18,28 +18,7 @@ }, "root": { "inputs": { - "nixpkgs": "nixpkgs", - "rust-overlay": "rust-overlay" - } - }, - "rust-overlay": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1727404165, - "narHash": "sha256-kZCiYpQJBZ3kL9QymS88mCxpQwqo8KqvZeHk6LATuY8=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "76f0a61e733259e1034dd6523e039d04932ffefc", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" + "nixpkgs": "nixpkgs" } } }, diff --git a/flake.nix b/flake.nix index b009218..c605a60 100644 --- a/flake.nix +++ b/flake.nix @@ -3,18 +3,12 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; - - rust-overlay = { - url = "github:oxalica/rust-overlay"; - inputs.nixpkgs.follows = "nixpkgs"; - }; }; outputs = { self, nixpkgs, - rust-overlay, }: let inherit (nixpkgs) lib; @@ -70,19 +64,8 @@ pkgs = nixpkgsFor.${system}; packages' = self.packages.${system}; - mkStatic = pkgs.callPackage ./nix/static.nix { - inherit (packages') refraction; - rust-overlay = rust-overlay.packages.${system}; - }; - - containerize = - refraction: - pkgs.dockerTools.buildLayeredImage { - name = "refraction"; - tag = "latest-${refraction.passthru.architecture}"; - config.Cmd = [ (lib.getExe refraction) ]; - inherit (refraction.passthru) architecture; - }; + mkStatic = pkgs.callPackage ./nix/static.nix { }; + containerize = pkgs.callPackage ./nix/containerize.nix { }; in { refraction = pkgs.callPackage ./nix/package.nix { }; diff --git a/nix/containerize.nix b/nix/containerize.nix new file mode 100644 index 0000000..558a7c8 --- /dev/null +++ b/nix/containerize.nix @@ -0,0 +1,9 @@ +{ lib, dockerTools }: +refraction: + +dockerTools.buildLayeredImage { + name = "refraction"; + tag = "latest-${refraction.passthru.dockerArchitecture}"; + config.Cmd = [ (lib.getExe refraction) ]; + architecture = refraction.passthru.dockerArchitecture; +} diff --git a/nix/static.nix b/nix/static.nix index 94b30ea..8df03c8 100644 --- a/nix/static.nix +++ b/nix/static.nix @@ -1,37 +1,9 @@ -{ - lib, - refraction, - rust-overlay, - pkgsCross, -}: +{ pkgsCross }: let crossPlatformFor = with pkgsCross; { x86_64 = musl64.pkgsStatic; aarch64 = aarch64-multiplatform.pkgsStatic; }; - - toolchain = rust-overlay.rust.minimal.override { - extensions = [ "rust-std" ]; - targets = lib.mapAttrsToList (_: pkgs: pkgs.stdenv.hostPlatform.rust.rustcTarget) crossPlatformFor; - }; - - rustPlatformFor = lib.mapAttrs ( - _: pkgs: - pkgs.makeRustPlatform ( - lib.genAttrs [ - "cargo" - "rustc" - ] (_: toolchain) - ) - ) crossPlatformFor; in { arch }: -(refraction.override { - rustPlatform = rustPlatformFor.${arch}; - optimizeSize = true; -}).overrideAttrs - (old: { - passthru = old.passthru or { } // { - inherit toolchain; - }; - }) +crossPlatformFor.${arch}.callPackage ./package.nix { optimizeSize = true; }