Skip to content

Commit

Permalink
Add direnv config for work on nix systems.
Browse files Browse the repository at this point in the history
Add flake.nix and .envrc inputs for use on nix as declarative nix is
best nix.

Autogenerate flake.lock based on flake.nix.

Add .direnv/ to .gitignore.
  • Loading branch information
TheCodedProf committed Apr 27, 2024
1 parent f87526e commit dc71a8d
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 1 deletion.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use_flake .
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ rls/
*.ts
*.js
#*#
.DS_Store
.DS_Store
.direnv/
100 changes: 100 additions & 0 deletions flake.lock

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

49 changes: 49 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
description = "Direnv environment for rust";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { nixpkgs, flake-utils, fenix, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ fenix.overlays.default ];
};
in
{
devShells.default = pkgs.mkShell {
packages = [
(pkgs.fenix.stable.withComponents [
"cargo"
"clippy"
"rust-src"
"rustc"
"rustfmt"
"rust-analyzer"
])
pkgs.bacon
pkgs.pkg-config
pkgs.openssl
];
shellHook = ''
export PKG_CONFIG_PATH=${
pkgs.lib.makeSearchPathOutput "dev" "lib/pkgconfig" [
pkgs.glib
pkgs.gtk3
pkgs.pango
pkgs.gdk-pixbuf
pkgs.cairo
pkgs.at-spi2-atk
pkgs.harfbuzz
pkgs.zlib
pkgs.gtk-layer-shell
]
}
'';
};
});
}

0 comments on commit dc71a8d

Please sign in to comment.