Compare commits

...

7 commits

Author SHA1 Message Date
Bruno BELANYI b735eb4b98 home: direnv: set 'DIRENV_DEFAULT_FLAKE' as needed
All checks were successful
ci/woodpecker/push/check Pipeline was successful
2024-04-19 11:22:15 +00:00
Bruno BELANYI 6a22a80d42 home: direnv: update default flake
Now that I (usually?) override `nixpkgs` in the registry, there's not
much use in defaulting to `pkgs`.
2024-04-19 11:22:15 +00:00
Bruno BELANYI 06b760e3ee pkgs: remove 'bt-migrate'
I have packaged it upstream.
2024-04-19 11:22:15 +00:00
Bruno BELANYI e43cdbfa65 pkgs: remove 'sqlite_orm'
I have packaged it upstream.
2024-04-19 11:22:15 +00:00
Bruno BELANYI 7e0cb867de pkgs: remove 'digestpp'
I have packaged it upstream.
2024-04-19 11:22:15 +00:00
Bruno BELANYI a4ede5f6f4 templates: add rust-cargo 2024-04-19 11:22:15 +00:00
Bruno BELANYI 95c688766f home: vim: ftplugin: add bp 2024-04-19 11:22:15 +00:00
15 changed files with 187 additions and 134 deletions

View file

@ -7,9 +7,9 @@ in
enable = my.mkDisableOption "direnv configuration";
defaultFlake = mkOption {
type = types.str;
default = "pkgs";
example = "nixpkgs";
type = with types; nullOr str;
default = null;
example = "pkgs";
description = ''
Which flake from the registry should be used for
<command>use pkgs</command> by default.
@ -39,7 +39,7 @@ in
in
lib.my.genAttrs' files linkLibFile;
home.sessionVariables = {
home.sessionVariables = lib.mkIf (cfg.defaultFlake != null) {
DIRENV_DEFAULT_FLAKE = cfg.defaultFlake;
};
};

View file

@ -0,0 +1,7 @@
" Create the `b:undo_ftplugin` variable if it doesn't exist
call ftplugined#check_undo_ft()
" Add comment format
setlocal comments=b://,s1:/*,mb:*,ex:*/
setlocal commentstring=//\ %s
let b:undo_ftplugin.='|setlocal comments< commentstring<'

View file

@ -1,61 +0,0 @@
{ lib
, boost
, cmake
, cxxopts
, digestpp
, fetchFromGitHub
, fmt
, jsoncons
, pugixml
, sqlite_orm
, stdenv
}:
stdenv.mkDerivation {
pname = "bt-migrate";
version = "0-unstable-2023-08-17";
src = fetchFromGitHub {
owner = "mikedld";
repo = "bt-migrate";
rev = "e15a489c0c76f98355586ebbee08223af4e9bf50";
hash = "sha256-kA6yxhbIh3ThmgF8Zyoe3I79giLVmdNr9IIrw5Xx4s0=";
};
nativeBuildInputs = [
cmake
];
buildInputs = [
boost
cxxopts
fmt
jsoncons
pugixml
sqlite_orm
];
cmakeFlags = [
(lib.strings.cmakeBool "USE_VCPKG" false)
# NOTE: digestpp does not have proper CMake packaging (yet?)
(lib.strings.cmakeBool "USE_FETCHCONTENT" true)
(lib.strings.cmakeFeature "FETCHCONTENT_SOURCE_DIR_DIGESTPP" "${digestpp}/include/digestpp")
];
# NOTE: no install target in CMake...
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp BtMigrate $out/bin
runHook postInstall
'';
meta = with lib; {
description = "Torrent state migration tool";
homepage = "https://github.com/mikedld/bt-migrate";
license = licenses.gpl3Only;
maintainers = with maintainers; [ ambroisie ];
mainProgram = "BtMigrate";
};
}

View file

@ -1,7 +1,5 @@
{ pkgs }:
pkgs.lib.makeScope pkgs.newScope (pkgs: {
bt-migrate = pkgs.callPackage ./bt-migrate { };
bw-pass = pkgs.callPackage ./bw-pass { };
change-audio = pkgs.callPackage ./change-audio { };
@ -12,8 +10,6 @@ pkgs.lib.makeScope pkgs.newScope (pkgs: {
diff-flake = pkgs.callPackage ./diff-flake { };
digestpp = pkgs.callPackage ./digestpp { };
dragger = pkgs.callPackage ./dragger { };
drone-rsync = pkgs.callPackage ./drone-rsync { };
@ -30,8 +26,6 @@ pkgs.lib.makeScope pkgs.newScope (pkgs: {
rbw-pass = pkgs.callPackage ./rbw-pass { };
sqlite_orm = pkgs.callPackage ./sqlite_orm { };
unbound-zones-adblock = pkgs.callPackage ./unbound-zones-adblock { };
zsh-done = pkgs.callPackage ./zsh-done { };

View file

@ -1,31 +0,0 @@
{ lib
, fetchFromGitHub
, stdenv
}:
stdenv.mkDerivation {
pname = "digestpp";
version = "0-unstable-2023-11-07";
src = fetchFromGitHub {
owner = "kerukuro";
repo = "digestpp";
rev = "ebb699402c244e22c3aff61d2239bcb2e87b8ef8";
hash = "sha256-9X/P7DgZB6bSYjQWRli4iAXEFjhmACOVv3EYQrXuH5c=";
};
installPhase = ''
runHook preInstall
mkdir -p $out/include/digestpp
cp -r *.hpp algorithm/ detail/ $out/include/digestpp
runHook postInstall
'';
meta = with lib; {
description = "C++11 header-only message digest library";
homepage = "https://github.com/kerukuro/digestpp";
license = licenses.unlicense;
maintainers = with maintainers; [ ambroisie ];
};
}

View file

@ -1,32 +0,0 @@
{ lib
, cmake
, fetchFromGitHub
, sqlite
, stdenv
}:
stdenv.mkDerivation (finalAttrs: {
pname = "sqlite_orm";
version = "1.8.2";
src = fetchFromGitHub {
owner = "fnc12";
repo = "sqlite_orm";
rev = "v${finalAttrs.version}";
hash = "sha256-KqphGFcnR1Y11KqL7sxODSv7lEvcURdF6kLd3cg84kc=";
};
nativeBuildInputs = [
cmake
];
propagatedBuildInputs = [
sqlite
];
meta = with lib; {
description = "Light header only SQLite ORM";
homepage = "https://sqliteorm.com/";
license = licenses.agpl3Only; # MIT license is commercial
maintainers = with maintainers; [ ambroisie ];
};
})

View file

@ -7,4 +7,8 @@
path = ./c++-meson;
description = "A C++ project using Meson";
};
"rust-cargo" = {
path = ./rust-cargo;
description = "A Rust project using Cargo";
};
}

View file

@ -0,0 +1,5 @@
if ! has nix_direnv_version || ! nix_direnv_version 3.0.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.0/direnvrc" "sha256-21TMnI2xWX7HkSTjFFri2UaohXVj854mgvWapWrxRXg="
fi
use flake

6
templates/rust-cargo/.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
# Rust build directory
/target
# Nix generated files
/.pre-commit-config.yaml
/result

View file

@ -0,0 +1,31 @@
labels:
backend: local
steps:
- name: pre-commit check
image: bash
commands:
- nix develop --command pre-commit run --all
- name: nix flake check
image: bash
commands:
- nix flake check
- name: notifiy
image: bash
environment:
ADDRESS:
from_secret: matrix_homeserver
ROOM:
from_secret: matrix_roomid
USER:
from_secret: matrix_username
PASS:
from_secret: matrix_password
commands:
- nix run github:ambroisie/matrix-notifier
when:
status:
- failure
- success

7
templates/rust-cargo/Cargo.lock generated Normal file
View file

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "project"
version = "0.0.0"

View file

@ -0,0 +1,8 @@
[package]
name = "project"
version = "0.0.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View file

@ -0,0 +1,112 @@
{
description = "A Rust project";
inputs = {
futils = {
type = "github";
owner = "numtide";
repo = "flake-utils";
ref = "main";
};
nixpkgs = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
ref = "nixos-unstable";
};
pre-commit-hooks = {
type = "github";
owner = "cachix";
repo = "pre-commit-hooks.nix";
ref = "master";
inputs = {
flake-utils.follows = "futils";
nixpkgs.follows = "nixpkgs";
};
};
};
outputs = { self, futils, nixpkgs, pre-commit-hooks }:
{
overlays = {
default = final: _prev: {
project = with final; rustPlatform.buildRustPackage {
pname = "project";
version = (final.lib.importTOML ./Cargo.toml).package.version;
src = self;
cargoLock = {
lockFile = "${self}/Cargo.lock";
};
meta = with lib; {
description = "A Rust project";
homepage = "https://git.belanyi.fr/ambroisie/project";
license = licenses.mit;
maintainers = with maintainers; [ ambroisie ];
};
};
};
};
} // futils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
self.overlays.default
];
};
pre-commit = pre-commit-hooks.lib.${system}.run {
src = self;
hooks = {
clippy = {
enable = true;
settings = {
denyWarnings = true;
};
};
nixpkgs-fmt = {
enable = true;
};
rustfmt = {
enable = true;
};
};
};
in
{
checks = {
inherit (self.packages.${system}) project;
};
devShells = {
default = pkgs.mkShell {
inputsFrom = with self.packages.${system}; [
project
];
packages = with pkgs; [
clippy
rust-analyzer
rustfmt
];
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
inherit (pre-commit) shellHook;
};
};
packages = futils.lib.flattenTree {
default = pkgs.project;
inherit (pkgs) project;
};
});
}

View file

View file

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}