Add devenv registry

This commit is contained in:
outfoxxed 2023-06-23 00:43:29 -07:00
parent ade4371c44
commit e96641729d
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
5 changed files with 145 additions and 0 deletions

View file

@ -0,0 +1,11 @@
outerInputs @ { inputs, system, pkgs, ... }: {
nix.registry.devenv.flake.outPath = pkgs.runCommand "devenvs" {} ''
mkdir $out
cp -r ${./.}/* $out
cp ${inputs.self}/flake.lock $out/flake.lock
'';
system.extraDependencies = [
(import ./rust.nix outerInputs)
];
}

44
modules/devenv/flake.nix Normal file
View file

@ -0,0 +1,44 @@
{
# locked by the copied lockfile. inputs must match the main flake
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
stable.url = "nixpkgs/nixos-23.05";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland = {
url = "github:hyprwm/Hyprland";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland-hy3 = {
url = "github:outfoxxed/hy3";
inputs.hyprland.follows = "hyprland";
};
hyprpaper = {
url = "github:hyprwm/Hyprpaper";
inputs.nixpkgs.follows = "nixpkgs";
};
# devenv
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = finputs @ { nixpkgs, ... }: let
systems = [ "x86_64-linux" ];
in builtins.foldl' (a: b: a // b) {} (builtins.map (system: let
pkgs = import nixpkgs { inherit system; };
inputs = finputs // { inherit system pkgs inputs; };
in {
devShells.${system} = {
rust = import ./rust.nix inputs;
};
}) systems);
}

28
modules/devenv/rust.nix Normal file
View file

@ -0,0 +1,28 @@
outerInputs @ { inputs, ... }: let
pkgs = outerInputs.pkgs.appendOverlays [ (import inputs.rust-overlay) ];
in pkgs.mkShell {
name = "rust-devenv";
packages = with pkgs; [
(rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
extensions = [
"rustc"
"rust-src"
"rust-docs"
"rust-std"
"cargo"
"clippy"
"rust-analyzer"
"miri"
];
}))
cargo-expand
# common deps
clang
pkg-config
openssl.dev
];
shellHook = "exec $SHELL";
}