~damien/gtk-webby

dafa7b88ba6f6f32e89cc3701b208eac7df041f1 — Damien Radtke 5 months ago 72bb314
Add flake for development
4 files changed, 140 insertions(+), 1 deletions(-)

M README.md
A flake.lock
A flake.nix
M shell.nix
M README.md => README.md +1 -1
@@ 14,7 14,7 @@ To run, first make sure you have the following installed:
2. GTK4 development libraries
3. Lua 5.4 development libraries

An easy way to do this is to use `nix-shell`, or you can use your package manager.
An easy way to do this is to use `nix develop`, or you can use your package manager.

Once these are installed, running is simply


A flake.lock => flake.lock +84 -0
@@ 0,0 1,84 @@
{
  "nodes": {
    "flake-utils": {
      "inputs": {
        "systems": "systems"
      },
      "locked": {
        "lastModified": 1701680307,
        "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
        "owner": "numtide",
        "repo": "flake-utils",
        "rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
        "type": "github"
      },
      "original": {
        "owner": "numtide",
        "repo": "flake-utils",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1704816751,
        "narHash": "sha256-psA1Lcas9Q8eONhXGkGPzywcYNTDXmM4zYDzoIc+IFc=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "f98ec4f73c762223d62bee706726138cb6ea27cc",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "flake-utils": "flake-utils",
        "nixpkgs": "nixpkgs",
        "rust-overlay": "rust-overlay"
      }
    },
    "rust-overlay": {
      "inputs": {
        "flake-utils": [
          "flake-utils"
        ],
        "nixpkgs": [
          "nixpkgs"
        ]
      },
      "locked": {
        "lastModified": 1704766659,
        "narHash": "sha256-Q2wQ9jzp4j96HokmhUQey+pyZMp4Fye/ZPSLtBBV1J8=",
        "owner": "oxalica",
        "repo": "rust-overlay",
        "rev": "afa87241c19241aca9b7a9103635b82db2b147bb",
        "type": "github"
      },
      "original": {
        "owner": "oxalica",
        "repo": "rust-overlay",
        "type": "github"
      }
    },
    "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
}

A flake.nix => flake.nix +54 -0
@@ 0,0 1,54 @@
# Inspired by https://fasterthanli.me/series/building-a-rust-service-with-nix/part-10
#
# To hop into a dev shell:
#
#   $ nix develop
#
{
	inputs = {
		nixpkgs.url = "github:NixOS/nixpkgs";
		flake-utils.url = "github:numtide/flake-utils";
		rust-overlay = {
			url = "github:oxalica/rust-overlay";
			inputs = {
				nixpkgs.follows = "nixpkgs";
				flake-utils.follows = "flake-utils";
			};
		};
	};

	outputs = { self, nixpkgs, flake-utils, rust-overlay }:
		flake-utils.lib.eachDefaultSystem(system: let
			overlays = [(import rust-overlay)];
			pkgs = import nixpkgs {
				inherit system overlays;
			};
			toolchain = pkgs.rust-bin.stable.latest.default.override {
				extensions = ["rust-src"];
			};
		in with pkgs; {
				devShells.default = mkShell {
					buildInputs = [
						gtk4
						gtksourceview5
						libadwaita
						pkg-config
						lua5_4
						toolchain
					] ++ (
						# SSL support is platform-specific
						if lib.strings.hasSuffix "-darwin" system then [
							darwin.apple_sdk.frameworks.Security
							darwin.apple_sdk.frameworks.CoreServices
							openssl
						]
						else if lib.strings.hasSuffix "-linux" system then [
							openssl
						]
						else []
					);
					RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
				};
			}
		);
}

M shell.nix => shell.nix +1 -0
@@ 2,6 2,7 @@
#
# Nixpkgs can be updated with: nix-shell -p niv --run "niv update"
#
# This file is deprecated in favor of Nix flakes; see flake.nix

{ sources ? import ./nix/sources.nix, pkgs ? import sources.nixpkgs {} }: