Skip to content

Commit 2903638

Browse files
committed
Fix CI, Fix Nix build
1 parent 63a27f7 commit 2903638

File tree

7 files changed

+160
-41
lines changed

7 files changed

+160
-41
lines changed
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
name: "Build flatpak"
1+
name: "Build and test"
22
on:
33
pull_request:
44
push:
55
jobs:
66
tests:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@master
10-
- run: sudo apt install flatpak-builder flatpak jq
11-
- run: bash ./build-aux/build-flatpak.sh build ./build-aux/com.ranfdev.Geopard.json
12-
9+
- uses: actions/[email protected]
10+
- uses: cachix/install-nix-action@v15
11+
with:
12+
extra_nix_config: |
13+
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
14+
- run: nix build
15+
- run: nix flake check

README.gemini

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,12 @@ If you have gnome-builder installed, use it to the open the folder of the source
3232
code and hit the run button.
3333

3434
### Build with Nix
35-
** currently broken **
3635
If you have the
3736
=> https://nixos.org/ nix
38-
package manager, you can simply do:
37+
package manager and flakes enabled, you can simply do:
3938
```sh
4039
git clone https://github.com/ranfdev/Geopard.git
41-
nix-build nix/default.nix
40+
nix build
4241
./result/bin/geopard
4342
```
4443

flake.lock

Lines changed: 43 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
{
22
description = "A gemini browser";
33
inputs = {
4-
nixpkgs.url = "github:NixOS/nixpkgs";
5-
};
6-
outputs = { self, nixpkgs }:
7-
with import nixpkgs { system = "x86_64-linux"; };
8-
{
9-
# geopard = callPackage ./nix/geopard.nix {};
10-
build-flatpak = callPackage ./nix/build-flatpak.nix {};
4+
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
5+
microvm.url = "github:astro/microvm.nix";
6+
microvm.inputs.nixpkgs.follows = "nixpkgs";
117
};
8+
outputs = { self, nixpkgs, microvm }:
9+
with import nixpkgs { system = "x86_64-linux"; };
10+
rec {
11+
packages.x86_64-linux.blueprint-compiler = callPackage ./nix/blueprint-compiler.nix { };
12+
packages.x86_64-linux.geopard = callPackage ./nix/geopard.nix { blueprint-compiler = packages.x86_64-linux.blueprint-compiler; };
13+
packages.x86_64-linux.build-flatpak = callPackage ./nix/build-flatpak.nix { };
14+
packages.x86_64-linux.default = packages.x86_64-linux.geopard;
15+
};
1216
}

nix/blueprint-compiler.nix

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{ python3
2+
, python3Packages
3+
, stdenv
4+
, fetchgit
5+
, meson
6+
, ninja
7+
, gtk4
8+
, glib
9+
, gobject-introspection
10+
, libadwaita
11+
, wrapGAppsHook4
12+
}:
13+
python3Packages.buildPythonApplication {
14+
pname = "blueprint-compiler";
15+
version = "0.1.0";
16+
17+
src = fetchgit {
18+
url = "https://gitlab.gnome.org/jwestman/blueprint-compiler.git";
19+
rev = "db2e662d3173f6348b86d2350d4e2f0340ec939c";
20+
sha256 = "sha256-aFx+aUDpc9wNgG/NUyIDgSZnURFShyTH1HhDjElTApY=";
21+
};
22+
23+
preBuild = ''
24+
cat >setup.py <<'EOF'
25+
from setuptools import setup
26+
setup(
27+
name='blueprint-compiler',
28+
version='0.1.0',
29+
scripts=[
30+
"blueprint-compiler.py",
31+
],
32+
)
33+
EOF
34+
'';
35+
doCheck = false;
36+
postInstall = ''
37+
mv -v $out/bin/blueprint-compiler.py $out/bin/blueprint-compiler
38+
'';
39+
nativeBuildInputs = [
40+
wrapGAppsHook4
41+
];
42+
buildInputs = [
43+
gtk4
44+
glib
45+
gobject-introspection
46+
python3Packages.pygobject3
47+
libadwaita
48+
wrapGAppsHook4
49+
];
50+
propagatedBuildInputs = [
51+
gobject-introspection
52+
];
53+
}

nix/geopard.nix

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,70 @@
44
, gtk4
55
, libadwaita
66
, pango
7-
, rustc
87
, rustPlatform
8+
, rustfmt
99
, openssl
1010
, pkg-config
1111
, lib
12-
, wrapGAppsHook
12+
, wrapGAppsHook4
1313
, meson
14+
, ninja
15+
, gdk-pixbuf
16+
, cmake
17+
, desktop-file-utils
18+
, gettext
19+
, blueprint-compiler
20+
, gobject-introspection
21+
, appstream-glib
1422
}:
1523

16-
rustPlatform.buildRustPackage rec {
24+
stdenv.mkDerivation rec {
1725
pname = "geopard";
18-
version = "1.0.0-alpha";
26+
version = "1.0.1";
1927

20-
src = lib.cleanSource ../.;
21-
cargoSha256 = "sha256-X2gVBKl37+FnDlzAQnLN6I99pEliytW/pMgMY6tJPd4=";
28+
src = ../.;
29+
30+
cargoDeps = rustPlatform.fetchCargoTarball {
31+
inherit src;
32+
name = "${pname}-${version}";
33+
hash = "sha256-gqScVEkf/rw1W7Z4M5k1rr9VwOFuLKIUWxmjqxc1x00=";
34+
};
2235

2336
nativeBuildInputs = [
24-
cargo
25-
rustc
2637
openssl
38+
gettext
39+
glib # for glib-compile-schemas
40+
meson
41+
ninja
2742
pkg-config
43+
rustPlatform.rust.cargo
44+
rustPlatform.cargoSetupHook
45+
rustPlatform.rust.rustc
46+
wrapGAppsHook4
47+
cmake
48+
blueprint-compiler
49+
desktop-file-utils
50+
appstream-glib
51+
blueprint-compiler
52+
rustfmt
2853
];
2954

3055
buildInputs = [
56+
desktop-file-utils
57+
gdk-pixbuf
3158
glib
3259
gtk4
3360
libadwaita
34-
pango
3561
openssl
36-
wrapGAppsHook
37-
meson
3862
];
39-
40-
doCheck = false;
41-
63+
checkPhase = ''
64+
cargo fmt --check
65+
'';
66+
doCheck = true;
4267
meta = with lib; {
43-
homepage = "https://git.ranfdev.com/Geopard";
44-
description = "Browse the geminiverse";
45-
longDescription = ''
46-
Geopard is a gemini browser. It's colored and fast.
47-
'';
48-
maintainers = [ "[email protected]" ];
68+
homepage = "https://github.com/ranfdev/Geopard";
69+
description = "Colorful, adaptive gemini browser";
70+
maintainers = with maintainers; [ ranfdev ];
4971
license = licenses.gpl3Plus;
5072
platforms = platforms.linux;
5173
};

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use gtk::gio;
99
use std::cell::RefCell;
1010
use std::rc::Rc;
1111

12+
#[rustfmt::skip]
1213
mod build_config;
1314
mod common;
1415
mod config;
@@ -21,7 +22,6 @@ mod tab;
2122
mod window;
2223

2324
use gtk::prelude::*;
24-
2525
async fn read_config() -> anyhow::Result<config::Config> {
2626
toml::from_str(&async_fs::read_to_string(&*SETTINGS_FILE_PATH).await?)
2727
.context("Reading config file")

0 commit comments

Comments
 (0)