devenv
This commit is contained in:
parent
004b442296
commit
5b9fdb8172
9
.envrc
Normal file
9
.envrc
Normal file
|
@ -0,0 +1,9 @@
|
|||
watch_file flake.nix
|
||||
watch_file flake.lock
|
||||
|
||||
DEVENV_ROOT_FILE="$(mktemp)"
|
||||
printf %s "$PWD" > "$DEVENV_ROOT_FILE"
|
||||
if ! use flake . --override-input devenv-root "file+file://$DEVENV_ROOT_FILE"
|
||||
then
|
||||
echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
|
||||
fi
|
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
.direnv/
|
||||
.devenv/
|
||||
|
||||
.pre-commit-config.yaml
|
8
devenv.nix
Normal file
8
devenv.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
pre-commit.hooks = {
|
||||
alejandra.enable = true;
|
||||
deadnix.enable = true;
|
||||
statix.enable = true;
|
||||
flake-checker.enable = true;
|
||||
};
|
||||
}
|
31
flake.lock
31
flake.lock
|
@ -1,5 +1,23 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1733312601,
|
||||
"narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1734424634,
|
||||
|
@ -16,8 +34,21 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1733096140,
|
||||
"narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
|
|
62
flake.nix
62
flake.nix
|
@ -1,21 +1,51 @@
|
|||
{
|
||||
description = "A wrapper for Helix that provides language support";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
outputs = {nixpkgs, ...}: let
|
||||
supportedSystems = nixpkgs.lib.systems.flakeExposed;
|
||||
forAllSupportedSystems = f:
|
||||
nixpkgs.lib.genAttrs supportedSystems (
|
||||
system:
|
||||
f (import nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
})
|
||||
);
|
||||
in {
|
||||
packages = forAllSupportedSystems (pkgs: {
|
||||
default = pkgs.callPackage ./package.nix {};
|
||||
});
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
devenv-root = {
|
||||
url = "file+file:///dev/null";
|
||||
flake = false;
|
||||
};
|
||||
devenv.url = "github:cachix/devenv";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-parts,
|
||||
devenv,
|
||||
devenv-root,
|
||||
} @ inputs:
|
||||
flake-parts.lib.mkFlake {inherit inputs;} {
|
||||
imports = [
|
||||
devenv.flakeModule
|
||||
];
|
||||
|
||||
systems = nixpkgs.lib.systems.flakeExposed;
|
||||
|
||||
flake = {
|
||||
lib = nixpkgs.lib.extend (import ./lib.nix);
|
||||
|
||||
nixosConfigurations = self.lib.genNixosConfigurations {inherit inputs;};
|
||||
};
|
||||
|
||||
perSystem = {pkgs, ...}: {
|
||||
devenv.shells.default = {
|
||||
devenv.root = let
|
||||
devenvRootFileContent = builtins.readFile devenv-root.outPath;
|
||||
in
|
||||
pkgs.lib.mkIf (devenvRootFileContent != "") devenvRootFileContent;
|
||||
|
||||
name = "hxwrap";
|
||||
|
||||
imports = [
|
||||
./devenv.nix
|
||||
];
|
||||
};
|
||||
|
||||
packages.default = pkgs.callPackage ./package.nix {};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue