Source code for my personal quote bot project.

flake: Docker build implementation.

+165
+1
.gitignore
··· 8 8 .DS_Store 9 9 .env 10 10 assets/** 11 + result 11 12 12 13 # Added by cargo 13 14 /target
+121
flake.lock
··· 1 + { 2 + "nodes": { 3 + "fenix": { 4 + "inputs": { 5 + "nixpkgs": [ 6 + "naersk", 7 + "nixpkgs" 8 + ], 9 + "rust-analyzer-src": "rust-analyzer-src" 10 + }, 11 + "locked": { 12 + "lastModified": 1752475459, 13 + "narHash": "sha256-z6QEu4ZFuHiqdOPbYss4/Q8B0BFhacR8ts6jO/F/aOU=", 14 + "owner": "nix-community", 15 + "repo": "fenix", 16 + "rev": "bf0d6f70f4c9a9cf8845f992105652173f4b617f", 17 + "type": "github" 18 + }, 19 + "original": { 20 + "owner": "nix-community", 21 + "repo": "fenix", 22 + "type": "github" 23 + } 24 + }, 25 + "flake-utils": { 26 + "inputs": { 27 + "systems": "systems" 28 + }, 29 + "locked": { 30 + "lastModified": 1731533236, 31 + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", 32 + "owner": "numtide", 33 + "repo": "flake-utils", 34 + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", 35 + "type": "github" 36 + }, 37 + "original": { 38 + "owner": "numtide", 39 + "repo": "flake-utils", 40 + "type": "github" 41 + } 42 + }, 43 + "naersk": { 44 + "inputs": { 45 + "fenix": "fenix", 46 + "nixpkgs": [ 47 + "nixpkgs" 48 + ] 49 + }, 50 + "locked": { 51 + "lastModified": 1752689277, 52 + "narHash": "sha256-uldUBFkZe/E7qbvxa3mH1ItrWZyT6w1dBKJQF/3ZSsc=", 53 + "owner": "nix-community", 54 + "repo": "naersk", 55 + "rev": "0e72363d0938b0208d6c646d10649164c43f4d64", 56 + "type": "github" 57 + }, 58 + "original": { 59 + "owner": "nix-community", 60 + "repo": "naersk", 61 + "type": "github" 62 + } 63 + }, 64 + "nixpkgs": { 65 + "locked": { 66 + "lastModified": 1761907660, 67 + "narHash": "sha256-kJ8lIZsiPOmbkJypG+B5sReDXSD1KGu2VEPNqhRa/ew=", 68 + "owner": "NixOS", 69 + "repo": "nixpkgs", 70 + "rev": "2fb006b87f04c4d3bdf08cfdbc7fab9c13d94a15", 71 + "type": "github" 72 + }, 73 + "original": { 74 + "id": "nixpkgs", 75 + "ref": "nixos-unstable", 76 + "type": "indirect" 77 + } 78 + }, 79 + "root": { 80 + "inputs": { 81 + "flake-utils": "flake-utils", 82 + "naersk": "naersk", 83 + "nixpkgs": "nixpkgs" 84 + } 85 + }, 86 + "rust-analyzer-src": { 87 + "flake": false, 88 + "locked": { 89 + "lastModified": 1752428706, 90 + "narHash": "sha256-EJcdxw3aXfP8Ex1Nm3s0awyH9egQvB2Gu+QEnJn2Sfg=", 91 + "owner": "rust-lang", 92 + "repo": "rust-analyzer", 93 + "rev": "591e3b7624be97e4443ea7b5542c191311aa141d", 94 + "type": "github" 95 + }, 96 + "original": { 97 + "owner": "rust-lang", 98 + "ref": "nightly", 99 + "repo": "rust-analyzer", 100 + "type": "github" 101 + } 102 + }, 103 + "systems": { 104 + "locked": { 105 + "lastModified": 1681028828, 106 + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 107 + "owner": "nix-systems", 108 + "repo": "default", 109 + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 110 + "type": "github" 111 + }, 112 + "original": { 113 + "owner": "nix-systems", 114 + "repo": "default", 115 + "type": "github" 116 + } 117 + } 118 + }, 119 + "root": "root", 120 + "version": 7 121 + }
+43
flake.nix
··· 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 +