-
-
Notifications
You must be signed in to change notification settings - Fork 1
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 #33 from Miaxos/nix-flake
Nix flake
- Loading branch information
Showing
6 changed files
with
306 additions
and
1 deletion.
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 |
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,3 +1,60 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
target/ | ||
private/ | ||
deployment/ | ||
|
||
# dependencies | ||
node_modules | ||
.pnp | ||
.pnp.js | ||
|
||
# testing | ||
coverage | ||
|
||
# build output | ||
.next/ | ||
out/ | ||
/build | ||
dist | ||
target | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# local env files | ||
.env | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# turbo | ||
.turbo | ||
|
||
# ide | ||
.idea | ||
.vscode | ||
.now | ||
|
||
# direnv | ||
.envrc | ||
.direnv/ | ||
|
||
# Jujutsu | ||
.jj/ | ||
|
||
# Direnv | ||
.envrc | ||
.env | ||
.direnv/ | ||
|
||
# Nix | ||
/result |
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.
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,100 @@ | ||
{ | ||
description = "Roster Dev env"; | ||
|
||
inputs = { | ||
crane = { | ||
url = "github:ipetkov/crane"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
rust-overlay = { | ||
url = "github:oxalica/rust-overlay"; | ||
inputs = { | ||
nixpkgs.follows = "nixpkgs"; | ||
flake-utils.follows = "flake-utils"; | ||
}; | ||
}; | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
flake-parts.url = "github:hercules-ci/flake-parts"; | ||
}; | ||
|
||
outputs = inputs @ { | ||
flake-parts, | ||
nixpkgs, | ||
flake-utils, | ||
crane, | ||
rust-overlay, | ||
... | ||
}: let | ||
inherit (nixpkgs.lib) optional concatStringsSep; | ||
systems = flake-utils.lib.system; | ||
flake = flake-utils.lib.eachDefaultSystem (system: let | ||
overlays = [ (import rust-overlay) ]; | ||
pkgs = import nixpkgs { | ||
inherit system overlays; | ||
}; | ||
|
||
aarch64DarwinExternalCargoCrates = concatStringsSep " " ["[email protected]" "[email protected]"]; | ||
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; | ||
|
||
defaultShellConf = { | ||
buildInputs = [ | ||
toolchain | ||
]; | ||
|
||
nativeBuildInputs = with pkgs; | ||
[ | ||
# Testing | ||
cargo-insta | ||
cargo-nextest | ||
|
||
# Benchmark tool to send multiple requests | ||
hey | ||
|
||
# Rust | ||
mold | ||
] | ||
++ optional (system == systems.aarch64-darwin) [ | ||
# cargo-binstall | ||
darwin.apple_sdk.frameworks.Foundation | ||
darwin.apple_sdk.frameworks.CoreFoundation | ||
darwin.apple_sdk.frameworks.CoreServices | ||
darwin.apple_sdk.frameworks.Security | ||
darwin.apple_sdk.frameworks.SystemConfiguration | ||
] | ||
++ optional (system != systems.aarch64-darwin) [ | ||
cargo-about | ||
]; | ||
|
||
shellHook = '' | ||
# project_root="$(git rev-parse --show-toplevel 2>/dev/null || jj workspace root 2>/dev/null)" | ||
# export CARGO_INSTALL_ROOT="./.cargo"; | ||
# if [[ "${system}" == "aarch64-darwin" ]]; then | ||
# cargo binstall --no-confirm --no-symlinks --quiet ${aarch64DarwinExternalCargoCrates} | ||
# fi | ||
''; | ||
}; | ||
in { | ||
devShells.default = pkgs.mkShell defaultShellConf; | ||
}); | ||
in | ||
flake-parts.lib.mkFlake {inherit inputs;} { | ||
inherit flake; | ||
|
||
systems = flake-utils.lib.defaultSystems; | ||
|
||
perSystem = { | ||
config, | ||
system, | ||
... | ||
}: { | ||
_module.args = { | ||
inherit crane; | ||
pkgs = import nixpkgs { | ||
inherit system; | ||
overlays = [(import rust-overlay)]; | ||
}; | ||
}; | ||
}; | ||
}; | ||
} |
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