Compare commits
25 commits
314cd4956b
...
06cc34dc1c
Author | SHA1 | Date | |
---|---|---|---|
Bruno BELANYI | 06cc34dc1c | ||
Bruno BELANYI | 811a9f44c5 | ||
Bruno BELANYI | f6c476a07f | ||
Bruno BELANYI | 0745e450b9 | ||
Bruno BELANYI | 48beb9f1fe | ||
Bruno BELANYI | 6162f4f4d5 | ||
Bruno BELANYI | 8d2cf7f2c0 | ||
Bruno BELANYI | df79f36c87 | ||
Bruno BELANYI | 929c8ea9b0 | ||
Bruno BELANYI | 2dedb41a47 | ||
Bruno BELANYI | 7ebbb10568 | ||
Bruno BELANYI | 5df0574f41 | ||
Bruno BELANYI | c18054cad7 | ||
Bruno BELANYI | f9db06a6d4 | ||
Bruno BELANYI | b735eb4b98 | ||
Bruno BELANYI | 6a22a80d42 | ||
Bruno BELANYI | 06b760e3ee | ||
Bruno BELANYI | e43cdbfa65 | ||
Bruno BELANYI | 7e0cb867de | ||
Bruno BELANYI | a4ede5f6f4 | ||
Bruno BELANYI | 95c688766f | ||
Bruno BELANYI | 3e6b9f7161 | ||
Bruno BELANYI | 6efe2c12ba | ||
Bruno BELANYI | 6b51b4e2ab | ||
Bruno BELANYI | 10a3e684c8 |
36
flake.lock
36
flake.lock
|
@ -14,11 +14,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1707830867,
|
||||
"narHash": "sha256-PAdwm5QqdlwIqGrfzzvzZubM+FXtilekQ/FA0cI49/o=",
|
||||
"lastModified": 1714136352,
|
||||
"narHash": "sha256-BtWQ2Th/jamO1SlD+2ASSW5Jaf7JhA/JLpQHk0Goqpg=",
|
||||
"owner": "ryantm",
|
||||
"repo": "agenix",
|
||||
"rev": "8cb01a0e717311680e0cbca06a76cbceba6f3ed6",
|
||||
"rev": "24a7ea390564ccd5b39b7884f597cfc8d7f6f44e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -73,11 +73,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709336216,
|
||||
"narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=",
|
||||
"lastModified": 1714641030,
|
||||
"narHash": "sha256-yzcRNDoyVP7+SCNX0wmuDju1NUCt8Dz9+lyUXEI0dbI=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2",
|
||||
"rev": "e5d10a24b66c3ea8f150e47dfdb0416ab7c3390e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -136,11 +136,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1711604890,
|
||||
"narHash": "sha256-vbI/gxRTq/gHW1Q8z6D/7JG/qGNl3JTimUDX+MwnC3A=",
|
||||
"lastModified": 1714679908,
|
||||
"narHash": "sha256-KzcXzDvDJjX34en8f3Zimm396x6idbt+cu4tWDVS2FI=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "3142bdcc470e1e291e1fbe942fd69e06bd00c5df",
|
||||
"rev": "9036fe9ef8e15a819fa76f47a8b1f287903fb848",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -152,11 +152,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1711523803,
|
||||
"narHash": "sha256-UKcYiHWHQynzj6CN/vTcix4yd1eCu1uFdsuarupdCQQ=",
|
||||
"lastModified": 1714635257,
|
||||
"narHash": "sha256-4cPymbty65RvF1DWQfc+Bc8B233A1BWxJnNULJKQ1EY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2726f127c15a4cc9810843b96cad73c7eb39e443",
|
||||
"rev": "63c3a29ca82437c87573e4c6919b09a24ea61b0f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -168,11 +168,11 @@
|
|||
},
|
||||
"nur": {
|
||||
"locked": {
|
||||
"lastModified": 1711622043,
|
||||
"narHash": "sha256-nCNcHYlmmPPIDRkDCvNoEog+AuG7jdmkhkU0fqoS82A=",
|
||||
"lastModified": 1714825428,
|
||||
"narHash": "sha256-6U4cppyR0u6sqSSVr3GMrnIXhP2YGR0knfgrUGtr/1Y=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NUR",
|
||||
"rev": "b7ff69e152caedbe4d0e40173d61732ac139a09c",
|
||||
"rev": "5847f3365c16afafc10c56994beadd4cdc8552ee",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -197,11 +197,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1711519547,
|
||||
"narHash": "sha256-Q7YmSCUJmDl71fJv/zD9lrOCJ1/SE/okZ2DsrmRjzhY=",
|
||||
"lastModified": 1714478972,
|
||||
"narHash": "sha256-q//cgb52vv81uOuwz1LaXElp3XAe1TqrABXODAEF6Sk=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "7d47a32e5cd1ea481fab33c516356ce27c8cef4a",
|
||||
"rev": "2849da033884f54822af194400f8dff435ada242",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -10,6 +10,11 @@ in
|
|||
adblock = {
|
||||
enable = true;
|
||||
};
|
||||
# Audiobook and podcast library
|
||||
audiobookshelf = {
|
||||
enable = true;
|
||||
port = 9599;
|
||||
};
|
||||
# Backblaze B2 backup
|
||||
backup = {
|
||||
enable = true;
|
||||
|
@ -134,6 +139,7 @@ in
|
|||
podgrab = {
|
||||
enable = true;
|
||||
passwordFile = secrets."podgrab/password".path;
|
||||
dataDir = "/data/media/podcasts";
|
||||
port = 9598;
|
||||
};
|
||||
# Regular backups
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
};
|
||||
|
|
7
modules/home/vim/after/ftplugin/bp.vim
Normal file
7
modules/home/vim/after/ftplugin/bp.vim
Normal 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<'
|
6
modules/home/vim/after/ftplugin/json.vim
Normal file
6
modules/home/vim/after/ftplugin/json.vim
Normal file
|
@ -0,0 +1,6 @@
|
|||
" Create the `b:undo_ftplugin` variable if it doesn't exist
|
||||
call ftplugined#check_undo_ft()
|
||||
|
||||
" Use a small indentation value on JSON files
|
||||
setlocal shiftwidth=2
|
||||
let b:undo_ftplugin.='|setlocal shiftwidth<'
|
6
modules/home/vim/ftdetect/blueprint.lua
Normal file
6
modules/home/vim/ftdetect/blueprint.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
-- Use `bp` filetype for Blueprint files
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
bp = "bp",
|
||||
},
|
||||
})
|
|
@ -9,7 +9,7 @@ in
|
|||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Enable touchpad support
|
||||
services.xserver.libinput.enable = true;
|
||||
services.libinput.enable = true;
|
||||
|
||||
# Enable TLP power management
|
||||
my.services.tlp.enable = true;
|
||||
|
|
39
modules/nixos/services/audiobookshelf/default.nix
Normal file
39
modules/nixos/services/audiobookshelf/default.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
# Audiobook and podcast library
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.services.audiobookshelf;
|
||||
in
|
||||
{
|
||||
options.my.services.audiobookshelf = with lib; {
|
||||
enable = mkEnableOption "Audiobookshelf, a self-hosted podcast manager";
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 8000;
|
||||
example = 4242;
|
||||
description = "The port on which Audiobookshelf will listen for incoming HTTP traffic.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.audiobookshelf = {
|
||||
enable = true;
|
||||
inherit (cfg) port;
|
||||
|
||||
group = "media";
|
||||
};
|
||||
|
||||
# Set-up media group
|
||||
users.groups.media = { };
|
||||
|
||||
my.services.nginx.virtualHosts = {
|
||||
audiobookshelf = {
|
||||
inherit (cfg) port;
|
||||
# Proxy websockets for RPC
|
||||
extraConfig = {
|
||||
locations."/".proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -4,6 +4,7 @@
|
|||
imports = [
|
||||
./adblock
|
||||
./aria
|
||||
./audiobookshelf
|
||||
./backup
|
||||
./blog
|
||||
./calibre-web
|
||||
|
|
|
@ -31,7 +31,7 @@ in
|
|||
config = lib.mkIf cfg.enable {
|
||||
services.nextcloud = {
|
||||
enable = true;
|
||||
package = pkgs.nextcloud28;
|
||||
package = pkgs.nextcloud29;
|
||||
hostName = "nextcloud.${config.networking.domain}";
|
||||
home = "/var/lib/nextcloud";
|
||||
maxUploadSize = cfg.maxSize;
|
||||
|
|
|
@ -17,6 +17,15 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
dataDir = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
example = "/mnt/podgrab";
|
||||
description = ''
|
||||
Path to the directory to store the podcasts. Use default if null
|
||||
'';
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 8080;
|
||||
|
@ -29,8 +38,14 @@ in
|
|||
services.podgrab = {
|
||||
enable = true;
|
||||
inherit (cfg) passwordFile port;
|
||||
|
||||
group = "media";
|
||||
dataDirectory = lib.mkIf (cfg.dataDir != null) cfg.dataDir;
|
||||
};
|
||||
|
||||
# Set-up media group
|
||||
users.groups.media = { };
|
||||
|
||||
my.services.nginx.virtualHosts = {
|
||||
podgrab = {
|
||||
inherit (cfg) port;
|
||||
|
|
|
@ -20,24 +20,28 @@ in
|
|||
|
||||
# Taken from the manual
|
||||
(lib.mkIf cfg.upgradeScript {
|
||||
containers.temp-pg.config.services.postgresql = {
|
||||
enable = true;
|
||||
package = pkgs.postgresql_13;
|
||||
};
|
||||
|
||||
environment.systemPackages =
|
||||
let
|
||||
newpg = config.containers.temp-pg.config.services.postgresql;
|
||||
pgCfg = config.services.postgresql;
|
||||
newPackage' = pkgs.postgresql_13;
|
||||
|
||||
oldPackage = if pgCfg.enableJIT then pgCfg.package.withJIT else pgCfg.package;
|
||||
oldData = pgCfg.dataDir;
|
||||
oldBin = "${if pgCfg.extraPlugins == [] then oldPackage else oldPackage.withPackages pgCfg.extraPlugins}/bin";
|
||||
|
||||
newPackage = if pgCfg.enableJIT then newPackage'.withJIT else newPackage';
|
||||
newData = "/var/lib/postgresql/${newPackage.psqlSchema}";
|
||||
newBin = "${if pgCfg.extraPlugins == [] then newPackage else newPackage.withPackages pgCfg.extraPlugins}/bin";
|
||||
in
|
||||
[
|
||||
(pkgs.writeScriptBin "upgrade-pg-cluster" ''
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -x
|
||||
export OLDDATA="${config.services.postgresql.dataDir}"
|
||||
export NEWDATA="${newpg.dataDir}"
|
||||
export OLDBIN="${config.services.postgresql.package}/bin"
|
||||
export NEWBIN="${newpg.package}/bin"
|
||||
set -eux
|
||||
export OLDDATA="${oldData}"
|
||||
export NEWDATA="${newData}"
|
||||
export OLDBIN="${oldBin}"
|
||||
export NEWBIN="${newBin}"
|
||||
|
||||
if [ "$OLDDATA" -ef "$NEWDATA" ]; then
|
||||
echo "Cannot migrate to same data directory" >&2
|
||||
|
@ -46,14 +50,21 @@ in
|
|||
|
||||
install -d -m 0700 -o postgres -g postgres "$NEWDATA"
|
||||
cd "$NEWDATA"
|
||||
sudo -u postgres $NEWBIN/initdb -D "$NEWDATA"
|
||||
sudo -u postgres "$NEWBIN/initdb" -D "$NEWDATA"
|
||||
|
||||
systemctl stop postgresql # old one
|
||||
|
||||
sudo -u postgres $NEWBIN/pg_upgrade \
|
||||
sudo -u postgres "$NEWBIN/pg_upgrade" \
|
||||
--old-datadir "$OLDDATA" --new-datadir "$NEWDATA" \
|
||||
--old-bindir $OLDBIN --new-bindir $NEWBIN \
|
||||
--old-bindir "$OLDBIN" --new-bindir "$NEWBIN" \
|
||||
"$@"
|
||||
|
||||
cat << EOF
|
||||
Run the following commands after setting:
|
||||
services.postgresql.package = pkgs.postgresql_${lib.versions.major newPackage.version}
|
||||
sudo -u postgres vacuumdb --all --analyze-in-stages
|
||||
${newData}/delete_old_cluster.sh
|
||||
EOF
|
||||
'')
|
||||
];
|
||||
})
|
||||
|
|
|
@ -11,7 +11,9 @@ in
|
|||
config = lib.mkIf cfg.enable {
|
||||
services.rss-bridge = {
|
||||
enable = true;
|
||||
whitelist = [ "*" ]; # Whitelist all
|
||||
config = {
|
||||
system.enabled_bridges = [ "*" ]; # Whitelist all
|
||||
};
|
||||
virtualHost = "rss-bridge.${config.networking.domain}";
|
||||
};
|
||||
|
||||
|
|
|
@ -44,6 +44,8 @@ in
|
|||
serviceConfig = {
|
||||
# Same option as upstream, without @setuid
|
||||
SystemCallFilter = lib.mkForce "~@clock @privileged @cpu-emulation @debug @keyring @module @mount @obsolete @raw-io @reboot @swap";
|
||||
# NodeJS requires RWX memory...
|
||||
MemoryDenyWriteExecute = lib.mkForce false;
|
||||
|
||||
BindPaths = [
|
||||
"/nix/var/nix/daemon-socket/socket"
|
||||
|
|
|
@ -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";
|
||||
};
|
||||
}
|
|
@ -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 { };
|
||||
|
|
|
@ -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 ];
|
||||
};
|
||||
}
|
|
@ -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 ];
|
||||
};
|
||||
})
|
3
templates/c++-bazel/.bazelignore
Normal file
3
templates/c++-bazel/.bazelignore
Normal file
|
@ -0,0 +1,3 @@
|
|||
.pre-commit-config.yaml
|
||||
result
|
||||
.direnv
|
6
templates/c++-bazel/.bazelrc
Normal file
6
templates/c++-bazel/.bazelrc
Normal file
|
@ -0,0 +1,6 @@
|
|||
# rule_nixpkgs' specific configuration
|
||||
build --host_platform=@io_tweag_rules_nixpkgs//nixpkgs/platforms:host
|
||||
build --crosstool_top=@nixpkgs_config_cc//:toolchain
|
||||
|
||||
# Use C++20
|
||||
build:linux --cxxopt=-std=c++20
|
23
templates/c++-bazel/.clang-format
Normal file
23
templates/c++-bazel/.clang-format
Normal file
|
@ -0,0 +1,23 @@
|
|||
# vim: ft=yaml
|
||||
---
|
||||
BasedOnStyle: LLVM
|
||||
IndentWidth: 4
|
||||
---
|
||||
Language: Cpp
|
||||
# Force pointers to the type for C++.
|
||||
DerivePointerAlignment: false
|
||||
PointerAlignment: Left
|
||||
|
||||
# Short functions should not be on a single line, unless empty
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
|
||||
# Make them level
|
||||
AccessModifierOffset: -4
|
||||
|
||||
# It makes more sense this way
|
||||
BreakBeforeBinaryOperators: All
|
||||
BreakBeforeTernaryOperators: true
|
||||
|
||||
# Aesthetic
|
||||
AlignOperands: AlignAfterOperator
|
||||
---
|
5
templates/c++-bazel/.envrc
Normal file
5
templates/c++-bazel/.envrc
Normal 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/c++-bazel/.gitignore
vendored
Normal file
6
templates/c++-bazel/.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Bazel build directories
|
||||
/bazel-*/
|
||||
|
||||
# Nix generated files
|
||||
/.pre-commit-config.yaml
|
||||
/result
|
31
templates/c++-bazel/.woodpecker/check.yml
Normal file
31
templates/c++-bazel/.woodpecker/check.yml
Normal 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
|
0
templates/c++-bazel/BUILD
Normal file
0
templates/c++-bazel/BUILD
Normal file
48
templates/c++-bazel/WORKSPACE
Normal file
48
templates/c++-bazel/WORKSPACE
Normal file
|
@ -0,0 +1,48 @@
|
|||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
|
||||
http_archive(
|
||||
name = "io_tweag_rules_nixpkgs",
|
||||
sha256 = "980edfceef2e59e1122d9be6c52413bc298435f0a3d452532b8a48d7562ffd67",
|
||||
strip_prefix = "rules_nixpkgs-0.10.0",
|
||||
urls = ["https://github.com/tweag/rules_nixpkgs/releases/download/v0.10.0/rules_nixpkgs-0.10.0.tar.gz"],
|
||||
)
|
||||
|
||||
load("@io_tweag_rules_nixpkgs//nixpkgs:repositories.bzl", "rules_nixpkgs_dependencies")
|
||||
|
||||
# load everything that rules_nixpkgs rules need to work
|
||||
rules_nixpkgs_dependencies()
|
||||
|
||||
load("@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl", "nixpkgs_cc_configure", "nixpkgs_local_repository")
|
||||
|
||||
# Define nixpkgs version using the flakes lock file.
|
||||
nixpkgs_local_repository(
|
||||
name = "nixpkgs",
|
||||
nix_file_deps = ["//:flake.lock"],
|
||||
nix_flake_lock_file = "//:flake.lock",
|
||||
)
|
||||
|
||||
nixpkgs_cc_configure(
|
||||
name = "nixpkgs_config_cc",
|
||||
repository = "@nixpkgs",
|
||||
)
|
||||
|
||||
# load rules_cc
|
||||
http_archive(
|
||||
name = "rules_cc",
|
||||
sha256 = "4dccbfd22c0def164c8f47458bd50e0c7148f3d92002cdb459c2a96a68498241",
|
||||
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.1/rules_cc-0.0.1.tar.gz"],
|
||||
)
|
||||
|
||||
load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies", "rules_cc_toolchains")
|
||||
|
||||
rules_cc_dependencies()
|
||||
|
||||
rules_cc_toolchains()
|
||||
|
||||
# Load dependencies
|
||||
http_archive(
|
||||
name = "com_google_googletest",
|
||||
sha256 = "8ad598c73ad796e0d8280b082cebd82a630d73e73cd3c70057938a6501bba5d7",
|
||||
strip_prefix = "googletest-1.14.0",
|
||||
urls = ["https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz"],
|
||||
)
|
143
templates/c++-bazel/flake.lock
Normal file
143
templates/c++-bazel/flake.lock
Normal file
|
@ -0,0 +1,143 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"futils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1694529238,
|
||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"ref": "main",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"pre-commit-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1660459072,
|
||||
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1698134075,
|
||||
"narHash": "sha256-foCD+nuKzfh49bIoiCBur4+Fx1nozo+4C/6k8BYk4sg=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "8efd5d1e283604f75a808a20e6cde0ef313d07d4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1685801374,
|
||||
"narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": [
|
||||
"futils"
|
||||
],
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1698227354,
|
||||
"narHash": "sha256-Fi5H9jbaQLmLw9qBi/mkR33CoFjNbobo5xWdX4tKz1Q=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "bd38df3d508dfcdff52cd243d297f218ed2257bf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"ref": "master",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"futils": "futils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"pre-commit-hooks": "pre-commit-hooks"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
126
templates/c++-bazel/flake.nix
Normal file
126
templates/c++-bazel/flake.nix
Normal file
|
@ -0,0 +1,126 @@
|
|||
{
|
||||
description = "A C++ 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; buildBazelPackage {
|
||||
pname = "project";
|
||||
version = "0.0.0";
|
||||
|
||||
src = self;
|
||||
|
||||
inherit (pkgs) bazel;
|
||||
|
||||
fetchAttrs = {
|
||||
# Fixed output derivation hash after bazel fetch.
|
||||
# This varies per platform, probably from the JDK pulled in being part
|
||||
# of the output derivation ? Is there a more robust way to do this ?
|
||||
# (Hashes extracted from the ofborg build logs)
|
||||
sha256 = let inherit (stdenv.hostPlatform) system; in {
|
||||
x86_64-linux = "${lib.fakeHash}";
|
||||
}.${system} or (throw "No hash for system: ${system}");
|
||||
|
||||
|
||||
# Use WORKSPACE file to fetch `rule_cc`
|
||||
removeRulesCC = false;
|
||||
};
|
||||
|
||||
buildAttrs = {
|
||||
installPhase = ''
|
||||
mkdir -p "$out/bin"
|
||||
|
||||
install bazel-bin/src/project "$out/bin"
|
||||
'';
|
||||
};
|
||||
|
||||
doCheck = true;
|
||||
|
||||
meta = with lib; {
|
||||
description = "A C++ project";
|
||||
homepage = "https://gitea.belanyi.fr/ambroisie/project";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ ambroisie ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
} // 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 = {
|
||||
nixpkgs-fmt = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
clang-format = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
checks = {
|
||||
inherit (self.packages.${system}) project;
|
||||
|
||||
inherit pre-commit;
|
||||
};
|
||||
|
||||
devShells = {
|
||||
default = pkgs.mkShellNoCC {
|
||||
inputsFrom = with self.packages.${system}; [
|
||||
project
|
||||
];
|
||||
|
||||
packages = with pkgs; [
|
||||
clang-tools
|
||||
];
|
||||
|
||||
inherit (pre-commit) shellHook;
|
||||
};
|
||||
};
|
||||
|
||||
packages = futils.lib.flattenTree {
|
||||
default = pkgs.project;
|
||||
inherit (pkgs) project;
|
||||
};
|
||||
});
|
||||
}
|
6
templates/c++-bazel/src/BUILD
Normal file
6
templates/c++-bazel/src/BUILD
Normal file
|
@ -0,0 +1,6 @@
|
|||
cc_binary(
|
||||
name = "project",
|
||||
srcs = [
|
||||
"main.cc",
|
||||
],
|
||||
)
|
5
templates/c++-bazel/src/main.cc
Normal file
5
templates/c++-bazel/src/main.cc
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "Hello World!\n";
|
||||
}
|
10
templates/c++-bazel/tests/unit/BUILD
Normal file
10
templates/c++-bazel/tests/unit/BUILD
Normal file
|
@ -0,0 +1,10 @@
|
|||
cc_test(
|
||||
name = "dummy_test",
|
||||
size = "small",
|
||||
srcs = [
|
||||
"dummy_test.cc",
|
||||
],
|
||||
deps = [
|
||||
"@com_google_googletest//:gtest_main",
|
||||
],
|
||||
)
|
5
templates/c++-bazel/tests/unit/dummy_test.cc
Normal file
5
templates/c++-bazel/tests/unit/dummy_test.cc
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(misc, passing) {
|
||||
ASSERT_EQ(1, 1);
|
||||
}
|
|
@ -7,4 +7,8 @@
|
|||
path = ./c++-meson;
|
||||
description = "A C++ project using Meson";
|
||||
};
|
||||
"rust-cargo" = {
|
||||
path = ./rust-cargo;
|
||||
description = "A Rust project using Cargo";
|
||||
};
|
||||
}
|
||||
|
|
5
templates/rust-cargo/.envrc
Normal file
5
templates/rust-cargo/.envrc
Normal 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
6
templates/rust-cargo/.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Rust build directory
|
||||
/target
|
||||
|
||||
# Nix generated files
|
||||
/.pre-commit-config.yaml
|
||||
/result
|
31
templates/rust-cargo/.woodpecker/check.yml
Normal file
31
templates/rust-cargo/.woodpecker/check.yml
Normal 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
7
templates/rust-cargo/Cargo.lock
generated
Normal 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"
|
8
templates/rust-cargo/Cargo.toml
Normal file
8
templates/rust-cargo/Cargo.toml
Normal 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]
|
112
templates/rust-cargo/flake.nix
Normal file
112
templates/rust-cargo/flake.nix
Normal 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;
|
||||
};
|
||||
});
|
||||
}
|
0
templates/rust-cargo/rustfmt.toml
Normal file
0
templates/rust-cargo/rustfmt.toml
Normal file
3
templates/rust-cargo/src/main.rs
Normal file
3
templates/rust-cargo/src/main.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
Loading…
Reference in a new issue