From 0dd1df7e1dbc66056cce4e05988e2341d562b86a Mon Sep 17 00:00:00 2001 From: Bit Borealis Date: Wed, 16 Aug 2023 12:43:10 +0000 Subject: [PATCH] build successfully in nix --- .gitignore | 1 + Cargo.lock | 18 +++++++++--------- Cargo.toml | 2 +- default.nix | 31 +++++++++++++++++++++++-------- flake.lock | 25 +++++++++++++++++++++++++ flake.nix | 24 +++++++----------------- shell.nix | 1 + 7 files changed, 67 insertions(+), 35 deletions(-) create mode 100644 flake.lock diff --git a/.gitignore b/.gitignore index ea8c4bf..d787b70 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +/result diff --git a/Cargo.lock b/Cargo.lock index 13d607e..43e4a49 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -829,15 +829,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "neon-gtk" -version = "0.1.0" -dependencies = [ - "gtk4", - "libadwaita", - "webrender", -] - [[package]] name = "num-traits" version = "0.2.16" @@ -1406,6 +1397,15 @@ dependencies = [ "euclid", ] +[[package]] +name = "xenon-browser" +version = "0.1.0" +dependencies = [ + "gtk4", + "libadwaita", + "webrender", +] + [[package]] name = "xml-rs" version = "0.8.16" diff --git a/Cargo.toml b/Cargo.toml index 89952ff..a079e2c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "neon-gtk" +name = "xenon-browser" version = "0.1.0" edition = "2021" diff --git a/default.nix b/default.nix index c9ed42b..7e272ef 100644 --- a/default.nix +++ b/default.nix @@ -1,11 +1,26 @@ -with import {}; +{ lib, fetchFromGitHub, rustPlatform, cmake, pkg-config, gtk4, gdk-pixbuf, cairo, libadwaita, pango }: -let - rustChannel = rustChannelOf { - channel = "stable"; - date = "2023-08-16"; - }; -in -rustChannel.workspaceMembers.libadwaita.build.override { +rustPlatform.buildRustPackage rec { + pname = "xenon-browser"; + version = "0.1.0"; + src = ./.; + + buildInputs = [ gtk4 gdk-pixbuf cairo libadwaita pango ]; + nativeBuildInputs = [cmake pkg-config]; + + cargoLock.lockFile = ./Cargo.lock; +# src = fetchFromGitHub { +# owner = "BurntSushi"; +# repo = pname; +# rev = version; +# hash = "sha256-+s5RBC3XSgb8omTbUNLywZnP6jSxZBKSS1BmXOjRF8M="; +# }; + + meta = { + description = "an experimental browser written with servo and gtk, inspired by neon."; + # homepage = "https://github.com/BurntSushi/ripgrep"; + # license = licenses.unlicense; + # maintainers = [ maintainers.tailhook ]; + }; } diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..7edcd10 --- /dev/null +++ b/flake.lock @@ -0,0 +1,25 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1692128808, + "narHash": "sha256-Di1Zm/P042NuwThMiZNrtmaAjd4Tm2qBOKHX7xUOfMk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4ed9856be002a730234a1a1ed9dcd9dd10cbdb40", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index c0c0dc9..5ccb2d3 100644 --- a/flake.nix +++ b/flake.nix @@ -1,19 +1,9 @@ { - description = "A libadwaita application in Rust"; + description = "xenon-browser"; - 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; }; - appDerivation = import ./default.nix { inherit pkgs; }; - in - { - defaultPackage = appDerivation; - } - ); -} + outputs = { self, nixpkgs }: + let pkgs = nixpkgs.legacyPackages.x86_64-linux; in + { + packages.x86_64-linux.default = pkgs.callPackage ./default.nix {}; + }; +} \ No newline at end of file diff --git a/shell.nix b/shell.nix index 7ae23dd..8292339 100644 --- a/shell.nix +++ b/shell.nix @@ -21,6 +21,7 @@ mkShell { # editor deps lapce rust-analyzer + nil ]; }