From 878dc5f386668f453332a2bfe195ca52ffd52224 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 21 Mar 2024 14:32:53 +0100 Subject: [PATCH] rot8000 Signed-off-by: Harald Hoyer --- .gitattributes | 1 + modules/home/tools/git/default.nix | 4 ++ modules/nixos/services/base/default.nix | 21 ++++++++-- packages/rot8000/Cargo.lock | 54 +++++++++++++++++++++++++ packages/rot8000/default.nix | 28 +++++++++++++ 5 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 .gitattributes create mode 100644 packages/rot8000/Cargo.lock create mode 100644 packages/rot8000/default.nix diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..b5040d3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +systems/x86_64-linux/mx/mailserver.nix text filter=rot8000 diff --git a/modules/home/tools/git/default.nix b/modules/home/tools/git/default.nix index e72d040..b48c5a5 100644 --- a/modules/home/tools/git/default.nix +++ b/modules/home/tools/git/default.nix @@ -56,6 +56,10 @@ in interactive.diffFilter = "${pkgs.delta}/bin/delta --color-only"; merge.conflictStyle = "diff3"; diff.colorMoved = "default"; + filter.rot8000 = { + clean = "${pkgs.metacfg.rot8000}/bin/rot8000"; + smudge = "${pkgs.metacfg.rot8000}/bin/rot8000"; + }; }; }; }; diff --git a/modules/nixos/services/base/default.nix b/modules/nixos/services/base/default.nix index f892988..18493d3 100644 --- a/modules/nixos/services/base/default.nix +++ b/modules/nixos/services/base/default.nix @@ -1,8 +1,18 @@ -{ options, config, lib, pkgs, ... }: - +{ options +, config +, lib +, pkgs +, ... +}: with lib; with lib.metacfg; -let cfg = config.metacfg.base; +let + cfg = config.metacfg.base; + gitconfig = pkgs.writeText "gitconfig" '' + [filter "rot8000"] + smudge = ${pkgs.metacfg.rot8000}/bin/rot8000 + clean = ${pkgs.metacfg.rot8000}/bin/rot8000 + ''; in { options.metacfg.base = with types; { @@ -38,6 +48,7 @@ in delta efibootmgr git + git-crypt git-delete-merged-branches home-manager htop @@ -137,6 +148,10 @@ in ]; flake = "git+https://git.hoyer.xyz/harald/nixcfg"; }; + systemd.services.nixos-upgrade = { + path = [ pkgs.metacfg.rot8000 ]; + environment.GIT_CONFIG_GLOBAL = toString gitconfig; + }; virtualisation.libvirtd.enable = true; diff --git a/packages/rot8000/Cargo.lock b/packages/rot8000/Cargo.lock new file mode 100644 index 0000000..9fc021d --- /dev/null +++ b/packages/rot8000/Cargo.lock @@ -0,0 +1,54 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "memchr" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" + +[[package]] +name = "regex" +version = "1.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "rot8000" +version = "0.1.0" +dependencies = [ + "regex", +] diff --git a/packages/rot8000/default.nix b/packages/rot8000/default.nix new file mode 100644 index 0000000..b4483b2 --- /dev/null +++ b/packages/rot8000/default.nix @@ -0,0 +1,28 @@ +{ lib +, stdenv +, rustPlatform +, fetchFromGitHub +, ... +}: +rustPlatform.buildRustPackage rec { + pname = "rot8000"; + version = "0.0.1"; + + src = fetchFromGitHub { + owner = "haraldh"; + rev = "3e3c4e4d6ed5b572ca2b09c8dc7f5bc3bd86e554"; + repo = "mailsmudge"; + sha256 = "sha256-4cG4Mn94lewxj1qstor8R0xLWIBFxf0rOHTMxzgHyFQ="; + }; + + cargoLock = { + lockFile = ./Cargo.lock; + }; + + meta = with lib; { + description = "mailsmudge"; + homepage = "https://github.com/haraldh/mailsmudge"; + license = licenses.unlicense; + maintainers = [ maintainers.tailhook ]; + }; +}