add nix files

build with 'nix build'
This commit is contained in:
Colin 2024-02-01 11:08:21 +00:00
parent 85d34a2c69
commit 8c4fa9c223
3 changed files with 102 additions and 0 deletions

54
default.nix Normal file
View File

@ -0,0 +1,54 @@
{ lib, stdenv
, desktop-file-utils
, gobject-introspection
, gtk4
, libadwaita
, meson
, ninja
, python3
, wrapGAppsHook4
}:
let
pyEnv = python3.withPackages (ps: with ps; [
pygobject3
requests
]);
in
stdenv.mkDerivation (final: with final; {
pname = "lemonade";
version = "2023.10.29";
src = ./.;
postPatch = ''
# see: <https://github.com/mdwalters/lemonade/issues/9>
substituteInPlace src/main.py \
--replace \
"{os.environ['XDG_RUNTIME_DIR']}/app/ml.mdwalters.Lemonade/cache" \
"{os.environ['HOME']}/.cache/ml.mdwalters.Lemonade" \
--replace \
'os.path.join(f"{os.environ['"'"'XDG_RUNTIME_DIR'"'"']}/app/ml.mdwalters.Lemonade", "cache")' \
'os.path.join(f"{os.environ['"'"'HOME'"'"']}/.cache", "ml.mdwalters.Lemonade")'
'';
nativeBuildInputs = [
desktop-file-utils
gobject-introspection
meson
ninja
wrapGAppsHook4
];
buildInputs = [
gtk4
libadwaita
pyEnv
];
meta = with lib; {
description = "🍋 Follow discussions on Lemmy";
homepage = "https://github.com/mdwalters/lemonade";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ colinsane ];
};
})

26
flake.lock Normal file
View File

@ -0,0 +1,26 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1706515015,
"narHash": "sha256-eFfY5A7wlYy3jD/75lx6IJRueg4noE+jowl0a8lIlVo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f4a8d6d5324c327dcc2d863eb7f3cc06ad630df4",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-23.11",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

22
flake.nix Normal file
View File

@ -0,0 +1,22 @@
{
inputs.nixpkgs.url = "nixpkgs/nixos-23.11";
outputs = { self, nixpkgs }:
let
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [ self.outputs.overlays.default ];
};
in with self.outputs.packages.x86_64-linux;
{
overlays.default = final: prev: with final; {
lemmy-lemonade = callPackage ./default.nix { };
};
packages.x86_64-linux = {
# avoid exposing ALL of nixpkgs
inherit (pkgs) lemmy-lemonade;
};
defaultPackage.x86_64-linux = lemmy-lemonade;
};
}