diff options
Diffstat (limited to 'nix')
| -rw-r--r-- | nix/containerize.nix | 16 | ||||
| -rw-r--r-- | nix/package.nix | 3 | ||||
| -rw-r--r-- | nix/static.nix | 47 |
3 files changed, 26 insertions, 40 deletions
diff --git a/nix/containerize.nix b/nix/containerize.nix new file mode 100644 index 0000000..d83b998 --- /dev/null +++ b/nix/containerize.nix @@ -0,0 +1,16 @@ +{ lib, dockerTools }: +let + containerize = + nixpkgs-tracker-bot: + let + inherit (nixpkgs-tracker-bot.passthru) crossPkgs; + architecture = crossPkgs.go.GOARCH; + in + dockerTools.buildLayeredImage { + name = "nixpkgs-tracker-bot"; + tag = "latest-${architecture}"; + config.Cmd = [ (lib.getExe nixpkgs-tracker-bot) ]; + inherit architecture; + }; +in +containerize diff --git a/nix/package.nix b/nix/package.nix index 261e785..b216242 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -3,13 +3,12 @@ rustPlatform, openssl, pkg-config, - version, lto ? true, optimizeSize ? false, }: rustPlatform.buildRustPackage { pname = "nixpkgs-tracker-bot"; - inherit version; + inherit ((lib.importTOML ../Cargo.toml).workspace.package) version; src = lib.fileset.toSource { root = ../.; diff --git a/nix/static.nix b/nix/static.nix index 86a1cc3..8def285 100644 --- a/nix/static.nix +++ b/nix/static.nix @@ -1,45 +1,16 @@ -{ - lib, - fenix, - pkgsCross, - nixpkgs-tracker-bot, -}: +{ pkgsCross }: let crossPkgsFor = with pkgsCross; { x86_64 = musl64.pkgsStatic; aarch64 = aarch64-multiplatform; }; - - rustcTargetFor = lib.mapAttrs (lib.const ( - pkgs: pkgs.stdenv.hostPlatform.rust.rustcTarget - )) crossPkgsFor; - rustStdFor = lib.mapAttrs (lib.const ( - rustcTarget: fenix.targets.${rustcTarget}.stable.rust-std - )) rustcTargetFor; - - toolchain = - with fenix; - combine ( - [ - stable.cargo - stable.rustc - ] - ++ lib.attrValues rustStdFor - ); - - crossPlatformFor = lib.mapAttrs (lib.const ( - pkgs: - pkgs.makeRustPlatform ( - lib.genAttrs [ - "cargo" - "rustc" - ] (lib.const toolchain) - ) - )) crossPkgsFor; in { arch }: -nixpkgs-tracker-bot.override { - rustPlatform = crossPlatformFor.${arch}; - inherit (crossPkgsFor.${arch}) openssl; - optimizeSize = true; -} +let + crossPkgs = crossPkgsFor.${arch}; +in +(crossPkgs.callPackage ./package.nix { optimizeSize = true; }).overrideAttrs (old: { + passthru = old.passthru or { } // { + inherit crossPkgs; + }; +}) |
