2023-04-02 17:20:29 +00:00
|
|
|
{
|
|
|
|
inputs = {
|
|
|
|
naersk.url = "github:nix-community/naersk/master";
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
|
|
utils.url = "github:numtide/flake-utils";
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = { self, nixpkgs, utils, naersk }:
|
|
|
|
utils.lib.eachDefaultSystem (system:
|
|
|
|
let
|
|
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
naersk-lib = pkgs.callPackage naersk { };
|
|
|
|
in {
|
2024-01-08 20:35:03 +00:00
|
|
|
packages.default = naersk-lib.buildPackage ./.;
|
|
|
|
devShells.default = with pkgs;
|
2023-04-02 17:20:29 +00:00
|
|
|
mkShell {
|
|
|
|
buildInputs = [
|
|
|
|
cargo
|
|
|
|
rustc
|
|
|
|
rustfmt
|
|
|
|
pre-commit
|
|
|
|
rustPackages.clippy
|
|
|
|
rust-analyzer
|
|
|
|
];
|
|
|
|
RUST_SRC_PATH = rustPlatform.rustLibSrc;
|
|
|
|
};
|
2023-04-15 10:29:10 +00:00
|
|
|
}) // {
|
2024-01-08 20:35:03 +00:00
|
|
|
nixosModules.default = { config, lib, pkgs, ... }:
|
2023-04-15 10:29:10 +00:00
|
|
|
with lib;
|
|
|
|
let cfg = config.services.url-eater;
|
|
|
|
in {
|
|
|
|
options.services.url-eater = {
|
|
|
|
enable = mkEnableOption "Enables the URL Eater service";
|
|
|
|
filters = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
example = ''
|
|
|
|
category "Spotify" {
|
|
|
|
params "context@open.spotify.com" "si@open.spotify.com"
|
|
|
|
}
|
|
|
|
category "Twitter" {
|
|
|
|
params "cxt@*.twitter.com" "ref_*@*.twitter.com" "s@*.twitter.com" "t@*.twitter.com" "twclid"
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
description = mdDoc ''
|
|
|
|
A list of filters to use, in the KDL file format.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.user.services."url-eater" = let
|
|
|
|
filters = pkgs.writeText "filters.kdl" cfg.filters;
|
2024-01-10 11:51:08 +00:00
|
|
|
pkg = self.packages.${pkgs.system}.default;
|
2023-04-15 10:29:10 +00:00
|
|
|
in {
|
|
|
|
description = "Clipboard URL cleanup service";
|
|
|
|
|
|
|
|
after = [ "graphical-session-pre.target" ];
|
|
|
|
wantedBy = [ "graphical-session.target" ];
|
|
|
|
|
|
|
|
script = ''
|
|
|
|
exec ${pkg}/bin/url-eater ${filters}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-04-02 17:20:29 +00:00
|
|
|
}
|