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

@ -1,5 +1,23 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -126,9 +144,31 @@
"hyprland-hy3": "hyprland-hy3",
"hyprpaper": "hyprpaper",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay",
"stable": "stable"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1687400833,
"narHash": "sha256-rVENiSupjAE8o1+ZXNRIqewUzM2brm+aeme8MUrwl0U=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "fc0a266e836c079a9131108f4334e5af219dbb93",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"stable": {
"locked": {
"lastModified": 1687093939,
@ -144,6 +184,21 @@
"type": "indirect"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"wlroots": {
"flake": false,
"locked": {

View File

@ -22,6 +22,12 @@
url = "github:hyprwm/Hyprpaper";
inputs.nixpkgs.follows = "nixpkgs";
};
# devenv
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ { self, nixpkgs, ... }: {
@ -33,6 +39,7 @@
modules = [
(import ./modules/impurity.nix self)
./modules/preserve-system.nix
./modules/devenv
./modules/overlay-pkgs
./modules/core
./modules/system.nix

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";
}