Skip to content

CS50-like C library with Nix flakes, designed for learning C and Nix flakes.

Notifications You must be signed in to change notification settings

aldosierra/libgets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Libgets

Libgets is a CS50-like C library with Nix flakes, designed for learning C and Nix flakes.

Table of Contents.

  1. How to use it in your devShell.
  2. To do List.

How to use it in your devShell.

  1. Add it to inputs in your flake.nix file.
inputs = {
    nixpkgs.url = "nixpkgs/nixos-24.05";
    libgets = {
        url = "github:aldosierra/libgets";
        inputs.nixpkgs.follows = "nixpkgs";
    };
};
  1. Add it to the devShell buildInputs.
devShells = {
    default = pkgs.mkShell {
        name = "sample-env";
        buildInputs = with pkgs; [ gcc libgets.packages."x86_64-linux".default ];
    };
};
  1. Import it on your c file.
#include "libgets.h"

int main(void) {
    char *name = GetString("What is your name? ");
    printf("Hi, %s\n", name);

    return 0;
}

Optionally you can add libgets to C_INCLUDE_PATH to include it on the standard system include directories, here is an example.

devShells = {
    default = pkgs.mkShell {
        name = "sample-env";
        buildInputs = with pkgs; [ gcc libgets.packages."x86_64-linux".default ];
        C_INCLUDE_PATH = "${libgets.packages.${system}.default}/include:$C_INCLUDE_PATH";
    };
};

This will work with both #include <...> and #include "...".

#include <libgets.h>

int main(void) {
    char *name = GetString("What is your name? ");
    printf("Hi, %s\n", name);

    return 0;
}

To do List.

  • Add a list of functions include it on this library.
  • Add options parameters for format messages.
  • Check for missing functions on the og cs50 library.

About

CS50-like C library with Nix flakes, designed for learning C and Nix flakes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published