forked from adamantine-sim/adamantine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request adamantine-sim#365 from cadkin/nix-flake
Nix flake updates
- Loading branch information
Showing
18 changed files
with
535 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake -L |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
name: Nix | ||
on: [push, pull_request] | ||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
working-directory: ./ | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: cachix/install-nix-action@v27 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
extra_nix_config: | | ||
trusted-public-keys = mdfbaam.cachix.org-1:WCQinXaMJP7Ny4sMlKdisNUyhcO2MHnPoobUef5aTmQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | ||
substituters = https://mdfbaam.cachix.org https://cache.nixos.org | ||
- run: nix flake check | ||
- run: nix build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"version": 6, | ||
"configurePresets": [ | ||
{ | ||
"name": "generic-gcc-ninja", | ||
"displayName": "Generic (gcc-ninja)", | ||
"description": "Basic configuration with the GCC toolchain using Ninja generator.", | ||
"generator": "Ninja Multi-Config", | ||
"binaryDir": "${sourceDir}/build/${presetName}", | ||
"cacheVariables": { | ||
"CMAKE_CXX_COMPILER": "g++" | ||
} | ||
} | ||
], | ||
"buildPresets": [ | ||
{ | ||
"name": "debug-gcc-ninja", | ||
"displayName": "Debug (gcc-ninja)", | ||
"description": "Compile a debug build using GCC.", | ||
"configurePreset": "generic-gcc-ninja", | ||
"configuration": "Debug" | ||
}, | ||
{ | ||
"name": "release-gcc-ninja", | ||
"displayName": "Release (gcc-ninja)", | ||
"description": "Compile a release build using GCC.", | ||
"configurePreset": "generic-gcc-ninja", | ||
"configuration": "Release" | ||
} | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,81 @@ | ||
# Nix Install | ||
## Nix | ||
|
||
First install the [Nix package manager][NIX] and then enable | ||
[Flakes]. See [nix.dev][nix.dev] for more help with Nix. To install | ||
without cloning from this repository use, | ||
First install the [Nix package manager][NIX] and then enable [Flakes][Flakes]. | ||
Alternatively, check out the [Determinate Systems Installer][Determinate] for | ||
an out of the box experience. See [nix.dev][nix.dev] for more help with Nix. | ||
|
||
$ nix develop github:adamantine-sim/adamantine | ||
|
||
to install the latest version on master. To install the lastest release use, | ||
To get a shell with adamantine temporarily installed, run: | ||
|
||
$ nix develop github:adamantine-sim/adamantine#release | ||
|
||
To install from a working copy use, | ||
$ nix shell github:adamantine-sim/adamantine | ||
# Adamantine now available | ||
$ adamantine --help | ||
|
||
To install this permanently, run: | ||
|
||
$ nix profile install github:adamantine-sim/adamantine | ||
|
||
To get the latest stable release, use: | ||
|
||
$ nix shell github:adamantine-sim/adamantine#adamantine.versions.stable | ||
|
||
To build from a working copy use `nix develop` and run CMake manually: | ||
|
||
$ nix develop | ||
|
||
$ cmake -B build -GNinja | ||
$ cmake --build build | ||
|
||
## Cache | ||
|
||
To avoid unnecessary builds, you can use the cache as configured in | ||
`flake.nix`. The only requirement is that your user is a "trusted user" by the | ||
nix dameon. | ||
|
||
If you are not a trusted user, you may make yourself one by editing | ||
`/etc/nix/nix.conf` and add the following line: | ||
|
||
... | ||
trusted-users = [YOUR USERNAME HERE] | ||
... | ||
|
||
Then, when running a nix operation with the Adamantine flake, you should be | ||
prompted if you want to add the cache to your configuration. Say yes to all | ||
queries to enable the cache permanently. | ||
|
||
For more info, see the docs for this option [here][Trusted]. | ||
|
||
## direnv | ||
|
||
This repository also supports `direnv` for integration with both your shell and | ||
tools like VSCode. | ||
|
||
First install direnv from either your distro or via Nix: | ||
|
||
# Via apt... | ||
$ sudo apt install direnv | ||
# ... or nix. | ||
$ nix profile install direnv | ||
|
||
Setup direnv for your shell. Tutorials for various shells can be found | ||
[here][DirenvHook]. For bash: | ||
|
||
$ echo "eval \"\$(direnv hook bash)\"" >> ~/.bashrc | ||
|
||
Restart your shell and then allow direnv: | ||
|
||
$ cd path/to/my/adamantine | ||
$ direnv allow | ||
|
||
This will automatically enter the nix development shell whenever you enter the | ||
adamantine directory. | ||
|
||
If you use VSCode, a great extension that adds direnv support can be found | ||
[here][DirenvVSCode]. | ||
|
||
|
||
[NIX]: https://nixos.org/download.html | ||
[Flakes]: https://nixos.wiki/wiki/Flakes | ||
[nix.dev]: https://nix.dev | ||
[Determinate]: https://github.com/DeterminateSystems/nix-installer | ||
[DirenvHook]: https://direnv.net/docs/hook.html | ||
[DirenvVSCode]: https://marketplace.visualstudio.com/items?itemName=mkhl.direnv | ||
[Trusted]: https://nix.dev/manual/nix/2.24/command-ref/conf-file#conf-trusted-users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.