Use devenv

This commit is contained in:
Invariantspace 2025-03-20 11:16:32 +08:00
parent c6d125fca9
commit 458c94c1fe
Signed by: macronova
GPG key ID: CE969670FB4B4A56
12 changed files with 86 additions and 155 deletions

View file

@ -1,22 +0,0 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
flake-utils,
nixpkgs,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
devShells.default = pkgs.mkShell {
packages = with pkgs; [texlive.combined.scheme-full];
TEXMFHOME = "$XDG_DATA_HOME/texmf";
TEXMFVAR = "$XDG_CACHE_HOME/texlive/texmf-var";
EXMFCONFIG = "$XDG_CONFIG_HOME/texlive/texmf-config";
};
});
}

2
template/devenv/.envrc Normal file
View file

@ -0,0 +1,2 @@
export CARGO_HOME=$(pwd)/.cargo
use flake . --no-pure-eval

5
template/devenv/.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
*
!.envrc
!.gitignore
!flake.nix
!flake.lock

43
template/devenv/flake.nix Normal file
View file

@ -0,0 +1,43 @@
{
inputs = {
devenv.url = "github:cachix/devenv";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-python.url = "github:cachix/nixpkgs-python";
};
outputs = inputs @ {
self,
devenv,
flake-utils,
nixpkgs,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
in {
packages = {
devenv-up = self.devShells.${system}.default.config.procfileScript;
devenv-test = self.devShells.${system}.default.config.test;
};
devShells.default = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
{
git-hooks.hooks.alejandra.enable = true;
languages = {
nix.enable = true;
# python.enable = true;
# r.enable = true;
# rust.enable = true;
# typst.enable = true;
};
}
];
};
});
}

View file

@ -1,28 +0,0 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
flake-utils,
nixpkgs,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
devShells.default = pkgs.mkShell {
packages = with pkgs; [
(
python3.withPackages (pyPkgs:
with pyPkgs; [
pylsp-mypy
python-lsp-ruff
python-lsp-server
])
)
];
};
});
}

View file

@ -1,23 +0,0 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
flake-utils,
nixpkgs,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
devShells.default = pkgs.mkShell {
packages = with pkgs; [
(rWrapper.override {
packages = with rPackages; [tidyverse];
})
];
};
});
}

View file

@ -1,2 +0,0 @@
export CARGO_HOME=$(pwd)/cargo
use flake

View file

@ -1,28 +0,0 @@
{
inputs = {
crane.url = "github:ipetkov/crane";
flake-utils.url = "github:numtide/flake-utils";
fenix.url = "github:nix-community/fenix";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs = {
self,
crane,
fenix,
flake-utils,
nixpkgs,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
fenixPkgs = fenix.packages.${system};
craneLib = crane.mkLib pkgs;
in {
devShells.default = craneLib.devShell {
packages = [
fenixPkgs.rust-analyzer
];
RUST_SRC_PATH = "${fenixPkgs.complete.rust-src}/lib/rustlib/src/rust/library";
};
});
}

View file

@ -1,19 +0,0 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
flake-utils,
nixpkgs,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
devShells.default = pkgs.mkShell {
packages = with pkgs; [typst];
};
});
}