Stupiod blog engine
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Switch to Rust, lol

+155 -173
-49
.clangd
··· 1 - CompileFlags: 2 - # Let clangd see your real warnings from compile_commands.json 3 - # and also apply these extra default flags: 4 - Add: [ 5 - "-std=c23", 6 - "-Wall", 7 - "-Wextra", 8 - "-Wpedantic", 9 - "-Wshadow", 10 - "-Wconversion", 11 - "-Wuninitialized", 12 - "-Wundef", 13 - "-Werror=implicit-function-declaration" 14 - ] 15 - 16 - Diagnostics: 17 - # Enable ALL clang compiler diagnostics (this is the big one) 18 - ClangTidy: 19 - Add: 20 - - clang-diagnostic-* # enables clang's own warnings 21 - - clang-analyzer-* # enables static analyzer checks 22 - - bugprone-assign-if-reversed 23 - - bugprone-signal-handler 24 - - bugprone-suspicious-memory-comparison 25 - - readability-misleading-indentation 26 - 27 - Remove: 28 - # Remove C++-only checks that annoy C programmers. 29 - - modernize-* 30 - - cppcoreguidelines-* 31 - - readability-identifier-naming 32 - - readability-magic-numbers 33 - - llvm-* 34 - - hicpp-* 35 - - google-* 36 - - performance-* 37 - - portability-* 38 - - misc-non-private-member-variables-in-classes 39 - 40 - # Make warnings more like the real clang compiler 41 - MissingIncludes: true 42 - UnusedIncludes: true 43 - 44 - # Use the default formatter 45 - Formatting: 46 - Style: file 47 - 48 - InlayHints: 49 - Enabled: true
+5
.gitignore
··· 2 2 .jj/ 3 3 .git/ 4 4 target/ 5 + 6 + 7 + # Added by cargo 8 + 9 + /target
+7
Cargo.lock
··· 1 + # This file is automatically @generated by Cargo. 2 + # It is not intended for manual editing. 3 + version = 4 4 + 5 + [[package]] 6 + name = "clog" 7 + version = "0.1.0"
+6
Cargo.toml
··· 1 + [package] 2 + name = "clog" 3 + version = "0.1.0" 4 + edition = "2024" 5 + 6 + [dependencies]
-7
compile_commands.json
··· 1 - [ 2 - { 3 - "directory": ".", 4 - "file": "src/main.c", 5 - "command": "clang -std=c23 src/main.c" 6 - } 7 - ]
+114 -5
flake.lock
··· 1 1 { 2 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": "nixpkgs" 47 + }, 48 + "locked": { 49 + "lastModified": 1763384566, 50 + "narHash": "sha256-r+wgI+WvNaSdxQmqaM58lVNvJYJ16zoq+tKN20cLst4=", 51 + "owner": "nix-community", 52 + "repo": "naersk", 53 + "rev": "d4155d6ebb70fbe2314959842f744aa7cabbbf6a", 54 + "type": "github" 55 + }, 56 + "original": { 57 + "owner": "nix-community", 58 + "repo": "naersk", 59 + "type": "github" 60 + } 61 + }, 3 62 "nixpkgs": { 4 63 "locked": { 5 - "lastModified": 1763948260, 6 - "narHash": "sha256-dY9qLD0H0zOUgU3vWacPY6Qc421BeQAfm8kBuBtPVE0=", 64 + "lastModified": 1752077645, 65 + "narHash": "sha256-HM791ZQtXV93xtCY+ZxG1REzhQenSQO020cu6rHtAPk=", 7 66 "owner": "NixOS", 8 67 "repo": "nixpkgs", 9 - "rev": "1c8ba8d3f7634acac4a2094eef7c32ad9106532c", 68 + "rev": "be9e214982e20b8310878ac2baa063a961c1bdf6", 10 69 "type": "github" 11 70 }, 12 71 "original": { 13 72 "owner": "NixOS", 14 - "ref": "nixos-25.05", 73 + "ref": "nixpkgs-unstable", 74 + "repo": "nixpkgs", 75 + "type": "github" 76 + } 77 + }, 78 + "nixpkgs_2": { 79 + "locked": { 80 + "lastModified": 1764445028, 81 + "narHash": "sha256-ik6H/0Zl+qHYDKTXFPpzuVHSZE+uvVz2XQuQd1IVXzo=", 82 + "owner": "NixOS", 83 + "repo": "nixpkgs", 84 + "rev": "a09378c0108815dbf3961a0e085936f4146ec415", 85 + "type": "github" 86 + }, 87 + "original": { 88 + "owner": "NixOS", 89 + "ref": "nixpkgs-unstable", 15 90 "repo": "nixpkgs", 16 91 "type": "github" 17 92 } 18 93 }, 19 94 "root": { 20 95 "inputs": { 21 - "nixpkgs": "nixpkgs" 96 + "flake-utils": "flake-utils", 97 + "naersk": "naersk", 98 + "nixpkgs": "nixpkgs_2" 99 + } 100 + }, 101 + "rust-analyzer-src": { 102 + "flake": false, 103 + "locked": { 104 + "lastModified": 1752428706, 105 + "narHash": "sha256-EJcdxw3aXfP8Ex1Nm3s0awyH9egQvB2Gu+QEnJn2Sfg=", 106 + "owner": "rust-lang", 107 + "repo": "rust-analyzer", 108 + "rev": "591e3b7624be97e4443ea7b5542c191311aa141d", 109 + "type": "github" 110 + }, 111 + "original": { 112 + "owner": "rust-lang", 113 + "ref": "nightly", 114 + "repo": "rust-analyzer", 115 + "type": "github" 116 + } 117 + }, 118 + "systems": { 119 + "locked": { 120 + "lastModified": 1681028828, 121 + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 122 + "owner": "nix-systems", 123 + "repo": "default", 124 + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 125 + "type": "github" 126 + }, 127 + "original": { 128 + "owner": "nix-systems", 129 + "repo": "default", 130 + "type": "github" 22 131 } 23 132 } 24 133 },
+20 -63
flake.nix
··· 1 1 { 2 - description = "CK's stupid blog engine"; 3 - 4 2 inputs = { 5 - nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; 3 + flake-utils.url = "github:numtide/flake-utils"; 4 + naersk.url = "github:nix-community/naersk"; 5 + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; 6 6 }; 7 7 8 - outputs = { self, nixpkgs, ... }: 9 - let 10 - systems = [ 11 - "x86_64-linux" 12 - "aarch64-linux" 13 - "x86_64-darwin" 14 - "aarch64-darwin" 15 - ]; 16 - 17 - forAllSystems = f: 18 - builtins.listToAttrs (map (system: { 19 - name = system; 20 - value = f system; 21 - }) systems); 22 - in { 23 - packages = forAllSystems (system: 8 + outputs = { self, flake-utils, naersk, nixpkgs }: 9 + flake-utils.lib.eachDefaultSystem (system: 24 10 let 25 - pkgs = nixpkgs.legacyPackages.${system}; 26 - in { 27 - ck-clog = pkgs.stdenv.mkDerivation { 28 - pname = "ck-clog"; 29 - version = "0.1"; 11 + pkgs = (import nixpkgs) { 12 + inherit system; 13 + }; 14 + 15 + naersk' = pkgs.callPackage naersk {}; 30 16 31 - # Leave your directory structure: 17 + in rec { 18 + defaultPackage = naersk'.buildPackage { 32 19 src = ./.; 33 - 34 - buildPhase = '' 35 - make release 36 - ''; 37 - 38 - installPhase = '' 39 - mkdir -p $out/bin 40 - cp target/release $out/bin/ck-clog 41 - ''; 42 20 }; 43 21 44 - default = self.packages.${system}.ck-clog; 45 - }); 46 - 47 - apps = forAllSystems (system: { 48 - default = { 49 - type = "app"; 50 - # Correct binary path (was /bin/hello) 51 - program = "${self.packages.${system}.ck-clog}/bin/ck-clog"; 52 - }; 53 - }); 54 - 55 - defaultPackage = self.packages; 56 - defaultApp = self.apps; 57 - 58 - devShells = forAllSystems (system: 59 - let 60 - pkgs = nixpkgs.legacyPackages.${system}; 61 - in { 62 - default = pkgs.mkShell { 63 - name = "ck-clog-dev"; 64 - 65 - buildInputs = [ 66 - # C Compiler 67 - pkgs.gcc 68 - # C LSP and other tools 69 - pkgs.clang-tools 22 + devShell = pkgs.mkShell { 23 + nativeBuildInputs = with pkgs; [ 24 + cargo 25 + rust-analyzer 26 + rustc 27 + rustfmt 70 28 ]; 71 29 }; 72 - }); 73 - }; 30 + } 31 + ); 74 32 } 75 -
-36
makefile
··· 1 - # Source 2 - SRC := src/main.c 3 - 4 - # Output binaries 5 - DEBUG_BIN := target/debug 6 - RELEASE_BIN := target/release 7 - 8 - # Common flags (always applied) 9 - COMMON_CFLAGS := -std=c23 \ 10 - -Wall -Wextra -Wpedantic -Wshadow \ 11 - -Wconversion -Wuninitialized -Wundef \ 12 - -Werror=implicit-function-declaration 13 - 14 - # Debug-only flags 15 - DEBUG_CFLAGS := -fsanitize=address,undefined -g 16 - 17 - # Release-only flags 18 - # Do NOT specify -O2 or -O3; Nix stdenv already injects optimization flags. 19 - RELEASE_CFLAGS := 20 - 21 - .PHONY: debug release clean 22 - 23 - debug: $(DEBUG_BIN) 24 - 25 - $(DEBUG_BIN): $(SRC) 26 - mkdir -p target 27 - $(CC) $(COMMON_CFLAGS) $(DEBUG_CFLAGS) $< -o $@ 28 - 29 - release: $(RELEASE_BIN) 30 - 31 - $(RELEASE_BIN): $(SRC) 32 - mkdir -p target 33 - $(CC) $(COMMON_CFLAGS) $(RELEASE_CFLAGS) $< -o $@ 34 - 35 - clean: 36 - rm -rf target
-13
src/main.c
··· 1 - #include <stdio.h> 2 - 3 - int main(int argc, char **argv) { 4 - if (argc < 3) { 5 - puts("Usage: clog <input dir> <output dir>"); 6 - return 1; 7 - } 8 - char *input_dir = argv[1]; 9 - char *output_dir = argv[2]; 10 - printf("input dir: %s\n", input_dir); 11 - printf("output dir: %s\n", output_dir); 12 - return 0; 13 - }
+3
src/main.rs
··· 1 + fn main() { 2 + println!("Hello, world?"); 3 + }