aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArpit Chakladar <arpitchakladar@gmail.com>2026-09-15 14:09:58 +0530
committerArpit Chakladar <arpitchakladar@gmail.com>2026-09-15 14:09:58 +0530
commit604224f7fd31094f46ab9c308ac6891e80f17e67 (patch)
tree61b0606596672e9c6499ceecef2a16e6ff4849ed
parent4b22768b10ac99c837382cd7d16b5c220df7a8b0 (diff)
downloadhome-manager-config-604224f7fd31094f46ab9c308ac6891e80f17e67.tar.gz
home-manager-config-604224f7fd31094f46ab9c308ac6891e80f17e67.zip
feat(development/direnv): using direnv as the development environment
-rw-r--r--.envrc1
-rw-r--r--.gitignore1
-rw-r--r--flake.lock240
-rw-r--r--flake.nix74
4 files changed, 33 insertions, 283 deletions
diff --git a/.envrc b/.envrc
new file mode 100644
index 0000000..3550a30
--- /dev/null
+++ b/.envrc
@@ -0,0 +1 @@
+use flake
diff --git a/.gitignore b/.gitignore
index b69855c..fa57bf9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
.pre-commit-config.yaml
.devenv
+.direnv
# Private/secret configuration - track example, ignore actual
users/*/private.nix
diff --git a/flake.lock b/flake.lock
index ab10dbd..29f9250 100644
--- a/flake.lock
+++ b/flake.lock
@@ -18,97 +18,18 @@
"type": "github"
}
},
- "cachix": {
- "inputs": {
- "devenv": [
- "devenv"
- ],
- "flake-compat": [
- "devenv",
- "flake-compat"
- ],
- "git-hooks": [
- "devenv",
- "git-hooks"
- ],
- "nixpkgs": [
- "devenv",
- "nixpkgs"
- ]
- },
- "locked": {
- "lastModified": 1788181969,
- "narHash": "sha256-OUB6hPlFBB9FRdZgZXSye4lDOg+fbrqKe8ePv2IM7NY=",
- "owner": "cachix",
- "repo": "cachix",
- "rev": "98093e8eea6c1635ef1337a576fa76f3e8bd4f39",
- "type": "github"
- },
- "original": {
- "owner": "cachix",
- "ref": "latest",
- "repo": "cachix",
- "type": "github"
- }
- },
- "crate2nix": {
- "flake": false,
- "locked": {
- "lastModified": 1772186516,
- "narHash": "sha256-8s28pzmQ6TOIUzznwFibtW1CMieMUl1rYJIxoQYor58=",
- "owner": "rossng",
- "repo": "crate2nix",
- "rev": "ba5dd398e31ee422fbe021767eb83b0650303a6e",
- "type": "github"
- },
- "original": {
- "owner": "rossng",
- "repo": "crate2nix",
- "rev": "ba5dd398e31ee422fbe021767eb83b0650303a6e",
- "type": "github"
- }
- },
- "devenv": {
- "inputs": {
- "cachix": "cachix",
- "crate2nix": "crate2nix",
- "flake-compat": "flake-compat",
- "flake-parts": "flake-parts",
- "ghostty": "ghostty",
- "git-hooks": "git-hooks",
- "nix": "nix",
- "nixd": "nixd",
- "nixpkgs": [
- "nixpkgs"
- ],
- "rust-overlay": "rust-overlay"
- },
- "locked": {
- "lastModified": 1789152246,
- "narHash": "sha256-8ESHEGygXS5lmDepm5cMbmVd8DjcwgwzsmjHc9ffY1c=",
- "owner": "cachix",
- "repo": "devenv",
- "rev": "6e323832a55097670dbd8eed04b1e63efc841dfa",
- "type": "github"
- },
- "original": {
- "owner": "cachix",
- "repo": "devenv",
- "type": "github"
- }
- },
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1767039857,
"narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
- "owner": "edolstra",
+ "owner": "NixOS",
"repo": "flake-compat",
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
"type": "github"
},
"original": {
- "owner": "edolstra",
+ "owner": "NixOS",
"repo": "flake-compat",
"type": "github"
}
@@ -116,27 +37,6 @@
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
- "devenv",
- "nixpkgs"
- ]
- },
- "locked": {
- "lastModified": 1788306937,
- "narHash": "sha256-lbrI1UYVpFgKSsyrU9oeF7FHfnu8nLD9ja0ou9f2rxk=",
- "owner": "hercules-ci",
- "repo": "flake-parts",
- "rev": "f16b25b8c3d2809b87925d0b76652d7821a75c68",
- "type": "github"
- },
- "original": {
- "owner": "hercules-ci",
- "repo": "flake-parts",
- "type": "github"
- }
- },
- "flake-parts_2": {
- "inputs": {
- "nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
@@ -171,31 +71,10 @@
"type": "github"
}
},
- "ghostty": {
- "flake": false,
- "locked": {
- "lastModified": 1786026742,
- "narHash": "sha256-tRtgTg/i3w1nFdRHU2IGekfJN8EyP+HARW4MtoUZyqk=",
- "owner": "ghostty-org",
- "repo": "ghostty",
- "rev": "22d13172cde98a0a4dda05d3d6a3fcb0dd8ed018",
- "type": "github"
- },
- "original": {
- "owner": "ghostty-org",
- "repo": "ghostty",
- "rev": "22d13172cde98a0a4dda05d3d6a3fcb0dd8ed018",
- "type": "github"
- }
- },
"git-hooks": {
"inputs": {
- "flake-compat": [
- "devenv",
- "flake-compat"
- ],
+ "flake-compat": "flake-compat",
"nixpkgs": [
- "devenv",
"nixpkgs"
]
},
@@ -234,72 +113,6 @@
"type": "github"
}
},
- "nix": {
- "inputs": {
- "flake-compat": [
- "devenv",
- "flake-compat"
- ],
- "flake-parts": [
- "devenv",
- "flake-parts"
- ],
- "git-hooks-nix": [
- "devenv",
- "git-hooks"
- ],
- "nixpkgs": [
- "devenv",
- "nixpkgs"
- ],
- "nixpkgs-23-11": [
- "devenv"
- ],
- "nixpkgs-regression": [
- "devenv"
- ]
- },
- "locked": {
- "lastModified": 1788036898,
- "narHash": "sha256-3NT3yTvoRT7+rxLDNovpyeTDIJkZlBoO72rcu2x9Y9o=",
- "owner": "cachix",
- "repo": "nix",
- "rev": "b9b81726b38469c55b9706d80d37d6c73cc7f76c",
- "type": "github"
- },
- "original": {
- "owner": "cachix",
- "ref": "devenv-2.35",
- "repo": "nix",
- "type": "github"
- }
- },
- "nixd": {
- "inputs": {
- "flake-parts": [
- "devenv",
- "flake-parts"
- ],
- "nixpkgs": [
- "devenv",
- "nixpkgs"
- ],
- "treefmt-nix": "treefmt-nix"
- },
- "locked": {
- "lastModified": 1788165251,
- "narHash": "sha256-ITHt6eU6DuwQqlNV1/wehvKYPE6J8sZIlv75CpDjcHI=",
- "owner": "nix-community",
- "repo": "nixd",
- "rev": "e2ca72c353cfbc3d63e942fe9aeae4ec497863bf",
- "type": "github"
- },
- "original": {
- "owner": "nix-community",
- "repo": "nixd",
- "type": "github"
- }
- },
"nixpkgs": {
"locked": {
"lastModified": 1789073787,
@@ -331,7 +144,7 @@
},
"nixvim": {
"inputs": {
- "flake-parts": "flake-parts_2",
+ "flake-parts": "flake-parts",
"nixpkgs": "nixpkgs_2",
"systems": "systems"
},
@@ -352,33 +165,12 @@
"root": {
"inputs": {
"base16": "base16",
- "devenv": "devenv",
+ "git-hooks": "git-hooks",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"nixvim": "nixvim"
}
},
- "rust-overlay": {
- "inputs": {
- "nixpkgs": [
- "devenv",
- "nixpkgs"
- ]
- },
- "locked": {
- "lastModified": 1788332415,
- "narHash": "sha256-BTFrmyh0oaVDsvA9NNw0YpbbeppTwU0t70iVx672Ew8=",
- "owner": "oxalica",
- "repo": "rust-overlay",
- "rev": "860d7c835ab91bfc8972b67092f5f2db8e9390a0",
- "type": "github"
- },
- "original": {
- "owner": "oxalica",
- "repo": "rust-overlay",
- "type": "github"
- }
- },
"systems": {
"flake": false,
"locked": {
@@ -395,28 +187,6 @@
"repo": "default",
"type": "github"
}
- },
- "treefmt-nix": {
- "inputs": {
- "nixpkgs": [
- "devenv",
- "nixd",
- "nixpkgs"
- ]
- },
- "locked": {
- "lastModified": 1786901030,
- "narHash": "sha256-WSFCsDSE5ffgD2MqzkM2CYjeFiKhRF/dJUN8uedb6YE=",
- "owner": "numtide",
- "repo": "treefmt-nix",
- "rev": "27b3b12a8e6375f28ebe122f07d230ca5459bbfa",
- "type": "github"
- },
- "original": {
- "owner": "numtide",
- "repo": "treefmt-nix",
- "type": "github"
- }
}
},
"root": "root",
diff --git a/flake.nix b/flake.nix
index 980718d..aa228d6 100644
--- a/flake.nix
+++ b/flake.nix
@@ -12,8 +12,8 @@
};
base16.url = "github:SenchoPens/base16.nix";
nixvim.url = "github:nix-community/nixvim";
- devenv = {
- url = "github:cachix/devenv";
+ git-hooks = {
+ url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
@@ -22,12 +22,10 @@
extra-substituters = [
"https://cache.nixos.org"
"https://nix-community.cachix.org"
- "https://devenv.cachix.org"
];
extra-trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
- "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
];
};
@@ -38,12 +36,12 @@
home-manager,
base16,
nixvim,
- devenv,
+ git-hooks,
...
- }@inputs:
+ }:
let
system = "x86_64-linux";
- pkgs = nixpkgs.legacyPackages.${system};
+ pkgs = import nixpkgs { inherit system; };
updates = import ./updates {
inherit pkgs;
lib = pkgs.lib;
@@ -65,6 +63,20 @@
];
scheme = lib.mkDefault ./assets/onedark-dark.yml;
};
+ preCommitCheck = git-hooks.lib.${system}.run {
+ src = ./.;
+ hooks = {
+ nixfmt.enable = true;
+ forbid-private = {
+ enable = true;
+ name = "Forbid committing private files";
+ entry = "found private file in staging! Do not commit users/arpit/private.nix.";
+ language = "system";
+ files = "users/arpit/private\\.nix$";
+ pass_filenames = false;
+ };
+ };
+ };
in
{
homeManagerModules = {
@@ -75,47 +87,13 @@
program = "${updates}/bin/updates";
};
formatter.${system} = pkgs.nixfmt-tree;
- devShells.${system}.default = devenv.lib.mkShell {
- inherit inputs pkgs;
- modules = [
- (
- { ... }:
- {
- git-hooks.hooks.nixfmt.enable = true;
-
- git-hooks.hooks.forbid-private = {
- enable = true;
- name = "Forbid committing private files";
- entry = "found private file in staging! Do not commit users/arpit/private.nix.";
- language = "fail";
- files = "users/arpit/private\\.nix$";
- };
-
- languages = {
- lua = {
- enable = true;
- lsp = {
- enable = true;
- package = pkgs.lua-language-server;
- };
- };
- nix = {
- enable = true;
- lsp = {
- enable = true;
- package = pkgs.nixd;
- };
- };
- shell = {
- enable = true;
- lsp = {
- enable = true;
- package = pkgs.bash-language-server;
- };
- };
- };
- }
- )
+ checks.${system}.pre-commit-check = preCommitCheck;
+ devShells.${system}.default = pkgs.mkShell {
+ inherit (preCommitCheck) shellHook;
+ buildInputs = preCommitCheck.enabledPackages ++ [
+ pkgs.lua-language-server
+ pkgs.nixd
+ pkgs.bash-language-server
];
};
homeConfigurations = {