diff --git a/Makefile b/Makefile index 7d7a45b..7bddfb1 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,10 @@ ${NAME}: @${CC} ${FLAGS} ${SRCS} -o ${NAME}; \ printf "\e[1;32m[build successfull]\e[1;00m\n" +auto-name : + @${CC} ${FLAGS} ${SRCS} -D USER=\"$(USER)\" -o ${NAME}; \ + printf "\e[1;32m[build successfull]\e[1;00m\n" + install : @read -p "Enter your username, it will appear on your 42Header as (USERNAME@EMAIL) : " class_username; \ read -p "Enter your email, it will appear on your 42Header as (USERNAME@EMAIL): " class_email; \ diff --git a/README.md b/README.md index 7b3620f..ff9684c 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ A C program destined to make C++ classes faster following the orthodox canonical ## How to install +### Standalone First clone the repository: ```bash git clone https://github.com/Namonay/fastclass.git @@ -25,6 +26,16 @@ If you want to install to a custom path, you can input it as a make parameter: # This is the default path make install INSTALL_PATH="$HOME/.local/bin" ``` +### Nix way + +Add the input into the your flake +```nix +fastclass.url = "github:seekrs/fastclass"; +``` +And add the package into +```nix +inputs.fastclass.packages.${pkgs.system}.fastclass +``` ## How to use diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..040b119 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1731755305, + "narHash": "sha256-v5P3dk5JdiT+4x69ZaB18B8+Rcu3TIOrcdG4uEX7WZ8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "057f63b6dc1a2c67301286152eb5af20747a9cb4", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..5a12cd0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,33 @@ +{ + description = "Fastclass flake"; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; + }; + + outputs = { self, nixpkgs, ... }: + let + supportedSystems = [ "x86_64-linux" ]; + forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f { + pkgs = import nixpkgs { inherit system; }; + }); + in + { + packages = forAllSystems ({ pkgs }: rec { + default = fastclass; + fastclass = pkgs.stdenv.mkDerivation { + name = "fastclass"; + src = self; + buildInputs = with pkgs; [ + clang + ]; + buildPhase = '' + make + ''; + installPhase = '' + mkdir -p $out/bin + cp class $out/bin + ''; + }; + }); + }; +}