Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

「✨」 feat(Flake): added nix flake for easier install #5

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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; \
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
description = "Fastclass flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
};

outputs = { self, nixpkgs, ... }:
let
supportedSystems = [ "x86_64-linux" ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Utilise https://github.com/nix-systems/ pour le support

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 = ''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pas nécessaire, make est test par default

make
'';
installPhase = ''
mkdir -p $out/bin
cp class $out/bin
'';
};
});
};
}