working flake

This commit is contained in:
Emil Lerch 2025-01-11 08:54:18 -08:00
parent 3d35509c2e
commit 926bf118f2
Signed by: lobo
GPG Key ID: A7B62D657EF764F8
6 changed files with 112 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
result

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Emil Lerch
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

7
README.md Normal file
View File

@ -0,0 +1,7 @@
Nix flake for Chawan web browser
================================
Uses [Chawan app image](https://git.lerch.org/chawan-appimage)
I do not believe this flake will work on NixOS proper. Appimages use a wrapper
there that do not work outside of NixOS.

26
flake.lock generated Normal file
View File

@ -0,0 +1,26 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1736344531,
"narHash": "sha256-8YVQ9ZbSfuUk2bUf2KRj60NRraLPKPS0Q4QFTbc+c2c=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bffc22eb12172e6db3c5dde9e3e5628f8e3e7912",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

56
flake.nix Normal file
View File

@ -0,0 +1,56 @@
{
description = "Chawan AppImage";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs }: {
packages.x86_64-linux.default =
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
shorthash = "80e4a90"; # This is the shorthash of the appimage builder repo
upstreamShorthash = "d9ddc31"; # This is the shorthash of the Chawan repo itself
appimagename = "Chawan-x86_64-${upstreamShorthash}.AppImage";
exename = "cha";
in
pkgs.stdenv.mkDerivation {
pname = "cha";
version = "0.1+${upstreamShorthash}";
src = pkgs.fetchurl {
url = "https://git.lerch.org/api/packages/lobo/generic/chawan-appimage/${shorthash}/${appimagename}";
hash = "sha256-Egh7SX3nMBXprHNiXwP4sU2sHyp4xOZOizj2DJZQP9I=";
};
nativeBuildInputs = [ pkgs.makeWrapper ];
buildInputs = [
pkgs.appimage-run
];
dontUnpack = true;
installPhase = ''
mkdir -p $out/bin $out/share/applications
cp $src $out/share/${appimagename}
chmod +x $out/share/${appimagename}
# Create desktop entry
cat > $out/share/applications/Chawan.desktop <<EOF
[Desktop Entry]
Name=Chawan
Exec=$out/bin/${exename}
Type=Application
Categories=Utility;
Terminal=true;
EOF
ln -s "$out/share/${appimagename}" "$out/bin/${exename}"
# makeWrapper ${pkgs.appimage-run}/bin/appimage-run "$out/bin/${exename}" \
# --add-flags "$out/share/${appimagename}"
'';
};
};
}

1
result Symbolic link
View File

@ -0,0 +1 @@
/nix/store/2ndmr8wg90mbdpb2rq08sihvldsrbzkr-cha-0.1+d9ddc31