Source code for my personal quote bot project.
at rust 1.2 kB view raw
1{ 2 description = "Nix Docker Layered Image test."; 3 4 # Nixpkgs / NixOS version to use. 5 inputs = { 6 nixpkgs.url = "nixpkgs/nixos-unstable"; 7 naersk = { 8 url = "github:nix-community/naersk"; 9 inputs.nixpkgs.follows = "nixpkgs"; 10 }; 11 flake-utils.url = "github:numtide/flake-utils"; 12 }; 13 14 outputs = { self, nixpkgs, naersk, flake-utils }: 15 flake-utils.lib.eachDefaultSystem (system: 16 let 17 pkgs = (import nixpkgs) { 18 inherit system; 19 }; 20 pkgName = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.name; 21 naersk' = pkgs.callPackage naersk {}; 22 rustApp = naersk'.buildPackage { 23 src = ./.; 24 }; 25 in { 26 packages = { 27 default = rustApp; 28 docker = pkgs.dockerTools.streamLayeredImage { 29 name = "localhost/${pkgName}"; 30 tag = "latest"; 31 contents = [ rustApp ]; 32 config.Cmd = "${rustApp}/bin/${pkgName}"; 33 }; 34 }; 35 36 # For `nix develop` (optional, can be skipped): 37 devShell = pkgs.mkShell { 38 nativeBuildInputs = with pkgs; [ rustc cargo jujutsu ]; 39 }; 40 } 41 ); 42} 43