feat: Initial commit

This commit is contained in:
uttarayan21
2025-10-26 03:11:00 +05:30
commit dfd1b0b866
7 changed files with 564 additions and 0 deletions

131
flake.nix Normal file
View File

@@ -0,0 +1,131 @@
{
description = "Linux File Converter Addon - File conversion from context menu";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
linux-file-converter-addon = pkgs.callPackage ./package.nix {};
in {
packages = {
default = linux-file-converter-addon;
linux-file-converter-addon = linux-file-converter-addon;
};
apps = {
default = {
type = "app";
program = "${linux-file-converter-addon}/bin/linux-file-converter-addon";
};
test = {
type = "app";
program = "${pkgs.callPackage ./test.nix {}}/bin/test-linux-file-converter-addon";
};
};
devShells.default = pkgs.callPackage ./shell.nix {};
# For NixOS modules
nixosModules.default = {
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.services.linux-file-converter-addon;
in {
options.services.linux-file-converter-addon = {
enable = mkEnableOption "Linux File Converter Addon";
package = mkOption {
type = types.package;
default = linux-file-converter-addon;
description = "The linux-file-converter-addon package to use";
};
};
config = mkIf cfg.enable {
environment.systemPackages = [cfg.package];
# Ensure nautilus-python is available for Nautilus integration
environment.pathsToLink = [
"/share/nautilus-python"
"/share/nemo/actions"
"/share/kio/servicemenus"
];
};
};
# For home-manager modules
homeManagerModules.default = {
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.programs.linux-file-converter-addon;
in {
options.programs.linux-file-converter-addon = {
enable = mkEnableOption "Linux File Converter Addon";
package = mkOption {
type = types.package;
default = linux-file-converter-addon;
description = "The linux-file-converter-addon package to use";
};
extraConfig = mkOption {
type = types.attrs;
default = {};
description = "Extra configuration for the addon";
example = {
automaticUpdates = false;
showPatchNotes = true;
timeInNames = true;
};
};
};
config = mkIf cfg.enable {
home.packages = [cfg.package];
# Create config file if extraConfig is provided
xdg.configFile."linux-file-converter-addon/config.json" = mkIf (cfg.extraConfig != {}) {
text = builtins.toJSON (
{
automaticUpdates = false;
showPatchNotes = true;
showPatchNoteButton = true;
showConfigHint = true;
convertToSquares = true;
timeInNames = true;
convertFromOctetStream = false;
showDummyOption = true;
displayFinishNotification = true;
alwaysCreateNemoAction = false;
alwaysCreateDolphinServicemenu = false;
convertToLandscapeWallpapers = true;
convertToPortraitWallpapers = true;
}
// cfg.extraConfig
);
};
};
};
})
// {
# Overlay for adding to nixpkgs
overlays.default = final: prev: {
linux-file-converter-addon = final.callPackage ./package.nix {};
};
};
}