Skip to content

Commit

Permalink
Merge pull request #2 from deemp/main
Browse files Browse the repository at this point in the history
Update flake
  • Loading branch information
ParfenovIgor authored Jan 7, 2025
2 parents 3aa3e31 + 9278ef5 commit 8fc707e
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 18 deletions.
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,30 @@ For further usage preferably add a new environmental variable:

* `ALTLIB` - **absolute** path to `build/altlib_ext`

## flakes.nix
## Get `calias` using Nix

Required dependencies:

* nix
* [Nix](https://nixos.org)
* Use [this](https://github.com/DeterminateSystems/nix-installer) or [this](https://nixos.org/download/) way to install Nix

Enter the development shell for `calias`:

```
nix develop github:ParfenovIgor/alias-c
```

Check that `calias` is present:

```
nix shell github:ParfenovIgor/alias-c#calias
calias
```

`calias` will appear in a new shell.
Check that `ALTLIB` is set:

```
echo "$ALTLIB"
```

## Example

Expand Down
6 changes: 3 additions & 3 deletions flake.lock

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

48 changes: 37 additions & 11 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,47 @@
system:
let
pkgs = inputs.nixpkgs.legacyPackages.${system};
packages.calias = pkgs.stdenv.mkDerivation {
name = "calias";
src = ./.;
buildInputs = [pkgs.nasm];
installPhase = ''
mkdir -p $out/bin
cp build/calias $out/bin/calias
'';
fs = pkgs.lib.fileset;
packages = {
calias = pkgs.stdenv.mkDerivation {
name = "calias";
meta.mainProgram = "calias";
src = fs.toSource {
root = ./.;
fileset = fs.unions [
./altlib
./arch
./compiler
./docs
./stdlib
./test
./Makefile
];
};
buildInputs = [ pkgs.nasm ];
buildPhase = ''
make compiler
make altlib
'';
checkPhase = ''
make test
make perftest
'';
installPhase = ''
mkdir -p $out/bin
cp -r build $out
cp build/calias $out/bin/calias
'';
};
};
in
{
inherit packages;
devShells = pkgs.mkShell {
buildInputs = [ packages.default ];
bash.extra = '''';
devShells.default = pkgs.mkShell {
buildInputs = [ packages.calias ];
shellHook = ''
export ALTLIB="${packages.calias}/build/altlib_ext"
'';
};
}
);
Expand Down

0 comments on commit 8fc707e

Please sign in to comment.