Skip to content
This repository has been archived by the owner on Dec 29, 2024. It is now read-only.

Commit

Permalink
feat(nix): updated nix package and configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Wittano committed Mar 17, 2024
1 parent 2676ef2 commit 7230cac
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 27 deletions.
13 changes: 0 additions & 13 deletions default.nix

This file was deleted.

6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 17 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
{
description = "Filebot - program to automaticlly moving files from one place to another";
description =
"Filebot - program to automaticlly moving files from one place to another";

inputs.nixpkgs.url = "nixpkgs/nixos-unstable";

outputs = { self, nixpkgs, }:
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
filebot = pkgs.callPackage ./default.nix { };
go = pkgs.go;
in
{
packages.x86_64-linux.default = filebot;
nixosModules."filebot" = import ./service.nix;
in rec {
packages.x86_64-linux.default = pkgs.buildGoModule {
name = "filebot";
src = ./.;
version = "v1.0.0";

vendorHash = "sha256-zga1pCBqisDLzDN6rO68iCQlGXmTfkUk+fqNI54yhNo=";

patches = [ "./patches/fix(config)__changed_path_for_nix_build.patch" ];
};
nixosModules."filebot" = pkgs.callPackage ./service.nix { filebot = packages.x86_64-linux.default; };
devShells.x86_64-linux.default = pkgs.mkShell {
hardeningDisable = [ "all" ];
buildInputs = with pkgs; [
# Go tools
go
golangci-lint

# Nix
nixfmt

# Github actions
act
];

GOROOT = "${go}/share/go";
GOROOT = "${pkgs.go}/share/go";
};
};
}
5 changes: 2 additions & 3 deletions service.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, filebot, ... }:

let
cfg = config.services.filebot;
program = pkgs.callPackage ./default.nix { };
in
{
options = {
Expand Down Expand Up @@ -46,7 +45,7 @@ in
serviceConfig.User = "${cfg.user}";
wantedBy = [ "multi-user.target" ];
script = ''
${program}/bin/filebot -c ${builtins.toString cfg.configPath} -u ${cfg.updateInterval}
${filebot}/bin/filebot -c ${builtins.toString cfg.configPath} -u ${cfg.updateInterval}
'';
};
};
Expand Down

0 comments on commit 7230cac

Please sign in to comment.