Skip to content

Commit

Permalink
feat: refine nix integration with development (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
ulic-youthlic authored Feb 6, 2025
1 parent 1c03f3e commit 8071dd8
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 4 deletions.
6 changes: 5 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
use flake
watch_file flake.lock
watch_file rust-toolchain.toml

use flake || use nix
eval "$shellHook"
12 changes: 12 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# use flake's packages.default for non-flake-enabled nix instances
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
nodeName = lock.nodes.root.inputs.flake-compat;
compat = fetchTarball {
url =
lock.nodes.${nodeName}.locked.url
or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.${nodeName}.locked.rev}.tar.gz";
sha256 = lock.nodes.${nodeName}.locked.narHash;
};
in
(import compat { src = ./.; }).defaultNix
16 changes: 16 additions & 0 deletions flake.lock

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

11 changes: 8 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
url = "github:rustsec/advisory-db";
flake = false;
};
flake-compat = {
url = "github:edolstra/flake-compat";
};
};

outputs =
Expand Down Expand Up @@ -148,11 +151,14 @@
);
};
devShells.default = pkgs.mkShell {
inputsFrom = builtins.attrValues self.checks."${system}";
packages = with pkgs; [
(rust-bin.fromRustupToolchainFile ./rust-toolchain.toml)
rust-analyzer
cargo-flamegraph
cargo-tarpaulin
lldb
];
nativeBuildInputs = with pkgs; [ protobuf ];
shellHook = '''';
};
}
)
Expand All @@ -161,5 +167,4 @@
inherit (self.packages."${final.system}") mania;
};
};

}
12 changes: 12 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# use flake's devShells.default for non-flake-enabled nix instances
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
nodeName = lock.nodes.root.inputs.flake-compat;
compat = fetchTarball {
url =
lock.nodes.${nodeName}.locked.url
or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.${nodeName}.locked.rev}.tar.gz";
sha256 = lock.nodes.${nodeName}.locked.narHash;
};
in
(import compat { src = ./.; }).shellNix.default

0 comments on commit 8071dd8

Please sign in to comment.