feat(devenv): make new devenv config that integrates alejandra and commitizen

This commit is contained in:
Zhongheng Liu 2024-08-09 18:06:06 +08:00
commit c811d1979c
No known key found for this signature in database
8 changed files with 413 additions and 196 deletions

3
.envrc Normal file
View file

@ -0,0 +1,3 @@
source_url "https://raw.githubusercontent.com/cachix/devenv/95f329d49a8a5289d31e0982652f7058a189bfca/direnvrc" "sha256-d+8cBpDfDBj41inrADaJt+bDWhOktwslgoP5YiGJ1v0="
use devenv

9
.gitignore vendored Normal file
View file

@ -0,0 +1,9 @@
# Devenv
.devenv*
devenv.local.nix
# direnv
.direnv
# pre-commit
.pre-commit-config.yaml

122
devenv.lock Normal file
View file

@ -0,0 +1,122 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1723156315,
"owner": "cachix",
"repo": "devenv",
"rev": "ff5eb4f2accbcda963af67f1a1159e3f6c7f5f91",
"treeHash": "6624b16e4203ef3eae59ce8d5d19005e04741537",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"treeHash": "2addb7b71a20a25ea74feeaf5c2f6a6b30898ecb",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"treeHash": "ca14199cabdfe1a06a7b1654c76ed49100a689f9",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1716977621,
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "4267e705586473d3e5c8d50299e71503f16a6fb6",
"treeHash": "6d9f1f7ca0faf1bc2eeb397c78a49623260d3412",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "rolling",
"repo": "devenv-nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1722869614,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "883180e6550c1723395a3a342f830bfc5c371f6b",
"treeHash": "e3ce01703c0d0324121e0d3ec6336275025b4ae6",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1723056346,
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "3c977f1c9930f54066c085305b4b2291385e7a73",
"treeHash": "d6f89338ffb2ca32c20bc0f8d50009e1894ab804",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks"
}
}
},
"root": "root",
"version": 7
}

48
devenv.nix Normal file
View file

@ -0,0 +1,48 @@
{
pkgs,
lib,
config,
inputs,
...
}: {
# https://devenv.sh/basics/
env.GREET = "devenv";
cachix.enable = false;
# https://devenv.sh/packages/
packages = [pkgs.git];
# https://devenv.sh/languages/
# languages.rust.enable = true;
languages.nix.enable = true;
pre-commit.hooks = {
alejandra.enable = true;
shellcheck.enable = true;
commitizen.enable = true;
};
# https://devenv.sh/processes/
# processes.cargo-watch.exec = "cargo-watch";
# https://devenv.sh/services/
# services.postgres.enable = true;
# https://devenv.sh/scripts/
scripts.hello.exec = ''
echo hello from $GREET
'';
enterShell = ''
hello
git --version
'';
# https://devenv.sh/tests/
enterTest = ''
echo "Running tests"
git --version | grep --color=auto "${pkgs.git.version}"
'';
# https://devenv.sh/pre-commit-hooks/
# pre-commit.hooks.shellcheck.enable = true;
# See full reference at https://devenv.sh/reference/options/
}

15
devenv.yaml Normal file
View file

@ -0,0 +1,15 @@
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
inputs:
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling
# If you're using non-OSS software, you can set allowUnfree to true.
# allowUnfree: true
# If you're willing to use a package that's vulnerable
# permittedInsecurePackages:
# - "openssl-1.1.1w"
# If you have more than one devenv you can merge them
#imports:
# - ./backend

View file

@ -6,38 +6,38 @@
config,
pkgs,
...
}:
{
# You can import other home-manager modules here
}: {
# You can import other home-manager modules here
imports = [
# If you want to use home-manager modules from other flakes (such as nix-colors):
# inputs.nix-colors.homeManagerModule
# If you want to use home-manager modules from other flakes (such as nix-colors):
# inputs.nix-colors.homeManagerModule
# You can also split up your configuration and import pieces of it here:
#./swaywm.nix
# You can also split up your configuration and import pieces of it here:
#./swaywm.nix
./hypr
./shells
./variables.nix
./mako.nix
];
nixpkgs = {
# You can add overlays here
# You can add overlays here
overlays = [
# If you want to use overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
# If you want to use overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
# Or define it inline, for example:
# (final: prev: {
# hi = final.hello.overrideAttrs (oldAttrs: {
# patches = [ ./change-hello-to-hi.patch ];
# });
# })
# Or define it inline, for example:
# (final: prev: {
# hi = final.hello.overrideAttrs (oldAttrs: {
# patches = [ ./change-hello-to-hi.patch ];
# });
# })
];
# Configure your nixpkgs instance
# Configure your nixpkgs instance
config = {
# Disable if you don't want unfree packages
# Disable if you don't want unfree packages
allowUnfree = true;
# Workaround for https://github.com/nix-community/home-manager/issues/2942
# Workaround for https://github.com/nix-community/home-manager/issues/2942
allowUnfreePredicate = _: true;
};
};
@ -71,7 +71,7 @@
programs.home-manager.enable = true;
programs.firefox.enable = true;
# Nicely reload system units when changing configs
# Nicely reload system units when changing configs
systemd.user.startServices = "sd-switch";
services.kanshi = {
enable = true;
@ -102,6 +102,6 @@
};
systemdTarget = "hyprland-session.target";
};
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
home.stateVersion = "24.05";
}

View file

@ -0,0 +1,12 @@
{
pkgs,
lib,
...
}: let
defaultTimeoutMillis = 5 * 1000;
in {
services.mako = {
enable = true;
defaultTimeout = defaultTimeoutMillis;
};
}

View file

@ -6,8 +6,7 @@
config,
pkgs,
...
}:
{
}: {
imports = [
./variables.nix
#./greetd-sway.nix
@ -18,7 +17,16 @@
];
security.pam.services.hyprlock = {};
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
};
systemd.user.services.mpris-proxy = {
description = "Mpris proxy";
after = ["network.target" "sound.target"];
wantedBy = ["default.target"];
serviceConfig.ExecStart = "${pkgs.bluez}/bin/mpris-proxy";
};
boot.loader = {
efi.canTouchEfiVariables = true;
grub = {
@ -26,7 +34,7 @@
useOSProber = true;
efiSupport = true;
fsIdentifier = "label";
devices = [ "nodev" ];
devices = ["nodev"];
extraEntries = ''
menuentry "Reboot" {
reboot
@ -100,6 +108,6 @@
};
};
services.automatic-timezoned.enable = true;
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
system.stateVersion = "24.05";
}