Add nix files

This commit is contained in:
Alexander Wainwright
2025-06-24 15:47:52 +10:00
parent d5884cd899
commit 7568457984
2 changed files with 103 additions and 0 deletions

61
flake.lock generated Normal file
View File

@@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1750506804,
"narHash": "sha256-VLFNc4egNjovYVxDGyBYTrvVCgDYgENp5bVi9fPTDYc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4206c4cb56751df534751b058295ea61357bbbaa",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"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
}

42
flake.nix Normal file
View File

@@ -0,0 +1,42 @@
{
description = "Locutus - A simple Borg wrapper";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
python = pkgs.python313; # or python312 if you prefer
pythonPackages = python.pkgs;
locutus = pythonPackages.buildPythonApplication {
pname = "locutus";
version = "0.1.0";
src = ./.;
format = "pyproject";
nativeBuildInputs = with pkgs; [ makeWrapper python.pkgs.setuptools ];
propagatedBuildInputs = with pythonPackages; [
];
# Install the CLI entrypoint
postInstall = ''
wrapProgram $out/bin/locutus --prefix PATH : ${pkgs.borgbackup}/bin
'';
};
in {
packages.default = locutus;
apps.default = flake-utils.lib.mkApp {
drv = locutus;
};
devShells.default = pkgs.mkShell {
buildInputs = [
python
pkgs.borgbackup
locutus
];
};
}
);
}