Skip to content

Commit

Permalink
Setup devenv
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfelton committed May 28, 2024
1 parent f68830d commit 1ce12d6
Show file tree
Hide file tree
Showing 4 changed files with 285 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Devenv
.devenv*
devenv.local.nix

# Direnv
.direnv
.envrc.local
207 changes: 207 additions & 0 deletions devenv.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1716847473,
"owner": "cachix",
"repo": "devenv",
"rev": "60ed3dba92ed027bb886611b53cf9b9d1e7f149e",
"treeHash": "49b91d3d9100c91ae358bfb703ee7f636ec245ee",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"treeHash": "2addb7b71a20a25ea74feeaf5c2f6a6b30898ecb",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"treeHash": "bd263f021e345cb4a39d80c126ab650bebc3c10c",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"treeHash": "ca14199cabdfe1a06a7b1654c76ed49100a689f9",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"mk-shell-bin": {
"locked": {
"lastModified": 1677004959,
"owner": "rrbutani",
"repo": "nix-mk-shell-bin",
"rev": "ff5d8bd4d68a347be5042e2f16caee391cd75887",
"treeHash": "496327dabdc787353a29987f492dd4939151baad",
"type": "github"
},
"original": {
"owner": "rrbutani",
"repo": "nix-mk-shell-bin",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1713361204,
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "285676e87ad9f0ca23d8714a6ab61e7e027020c6",
"treeHash": "50354b35a3e0277d4a83a0a88fa0b0866b5f392f",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "rolling",
"repo": "devenv-nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1716633019,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9d29cd266cebf80234c98dd0b87256b6be0af44e",
"treeHash": "9c88f2c9f0cdeaddeb5d49c2faaf65b936fc11d3",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1716715802,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e2dd4e18cc1c7314e24154331bae07df76eb582f",
"treeHash": "52be98f562d6c56c7dceffc946d3b96f29a1b95b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1716213921,
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "0e8fcc54b842ad8428c9e705cb5994eaf05c26a0",
"treeHash": "17b9f9f9983467bcff247b09761dca9831d3d3be",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"mk-shell-bin": "mk-shell-bin",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1716862669,
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "47b2d15658b37716393b2463a019000dbd6ce4bc",
"treeHash": "dc9f31c00298b96da7866b954f8ee60e2eb7773e",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"treeHash": "cce81f2a0f0743b2eb61bc2eb6c7adbe2f2c6beb",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
62 changes: 62 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{ pkgs ? import <nixpkgs>, lib, ... }:




# let
# uniffi-bindgen-cs = pkgs.rustPlatform.buildRustPackage rec {
# name = "uniffi-bindgen-cs-${version}";
# version = "0.8.0+v0.25.0";

# src = pkgs.fetchFromGitHub {
# owner = "NordSecurity";
# repo = "uniffi-bindgen-cs";
# rev = "v${version}";
# sha256 = "sha256:1ixvl6lkjmds7gyvhfc4dibjy8g4c5vr4ra32flkvns0f3h60bd0";
# fetchSubmodules = true;
# };

# cargoSha256 = "sha256:1ixvl6lkjmds7gyvhfc4dibjy8g4c5vr4ra32flkvns0f3h60bd0";

# nativeBuildInputs = with pkgs; [ pkg-config ];
# buildInputs = with pkgs; [ openssl ];
# };
# in
{
name = "dnssec_prover";

packages = [
pkgs.git
pkgs.rustup
pkgs.nix-prefetch-git
pkgs.wasm-pack
# uniffi-bindgen-cs
] ++ lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk; [
frameworks.Security
]);

languages = {
rust = let
rustVersion = pkgs.rust-bin.stable.latest.default;
in {
enable = true;
toolchain.rustc = (rustVersion.override {
extensions = [ "rust-src" ];
targets = [ "wasm32-unknown-unknown" "wasm32-wasi"];
});
};
};

# macOS workaround:
# The linker on macOS doesn't like the frameworks option when compiling to wasm32.
# See https://github.com/rust-lang/rust/issues/122333
env.RUSTFLAGS = lib.mkIf pkgs.stdenv.isDarwin (lib.mkForce "");

# FIXME: This is a workaround for the fact that the uniffi-bindgen-cs package is not available in nixpkgs
enterShell = ''
if ! command -v uniffi-bindgen-cs &> /dev/null
then
cargo install uniffi-bindgen-cs --git https://github.com/NordSecurity/uniffi-bindgen-cs --tag v0.8.0+v0.25.0
fi
'';
}
9 changes: 9 additions & 0 deletions devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
inputs:
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling
mk-shell-bin:
url: github:rrbutani/nix-mk-shell-bin
rust-overlay:
url: github:oxalica/rust-overlay
overlays:
- default

0 comments on commit 1ce12d6

Please sign in to comment.