Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update nix config #4915

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# vi: ft=sh
# shellcheck disable=all
dotenv_if_exists
use flake
watch_file $(fd -tf -enix)

export PATH="${PWD}/node_modules/.bin:${PATH}"
102 changes: 60 additions & 42 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

98 changes: 47 additions & 51 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,67 +1,63 @@
{
description = "Flake template";

inputs = {
unstablePkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
fp.url = "github:hercules-ci/flake-parts";
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "unstablePkgs";
};
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, unstablePkgs, flake-utils, rust-overlay }:
flake-utils.lib.eachDefaultSystem
(system:
let
overlays = [ (import rust-overlay) ];
unstable = import unstablePkgs {
inherit system overlays;
};

rustToolchain = unstable.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
outputs = inputs: inputs.fp.lib.mkFlake { inherit inputs; } {
systems = inputs.nixpkgs.lib.systems.flakeExposed;

common = with unstable; [
gtk3
perSystem = { system, config, pkgs, lib, ... }:
{
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = with inputs; [
devshell.overlays.default
rust-overlay.overlays.default
];
};

devShells.default = with pkgs; let
nativeLibs = [
at-spi2-atk
cairo
gdk-pixbuf
glib
glib-networking
dbus
openssl_3
librsvg
gettext
libiconv
gtk3
harfbuzz
libsoup
libsoup_3
pango
webkitgtk
nodejs_20
corepack_20
];
in
devshell.mkShell {
imports = [ "${inputs.devshell}/extra/language/c.nix" ];

# runtime Deps
libraries = with unstable;[
cairo
pango
harfbuzz
gdk-pixbuf
] ++ common;
language.c = {
compiler = stdenv.cc;
includes = nativeLibs;
libraries = map (nl: nl.dev) nativeLibs;
};

# compile-time deps
packages = with unstable; [
curl
wget
packages = [
(rust-bin.fromRustupToolchainFile ./rust-toolchain.toml)
cmake
corepack_20
gnumake
nodejs_20
pkg-config
rustToolchain
] ++ common;
in
{
devShells.default = unstable.mkShell {
nativeBuildInputs = packages;
buildInputs = libraries;
shellHook = ''
export LD_LIBRARY_PATH=${unstable.lib.makeLibraryPath libraries}:$LD_LIBRARY_PATH
export XDG_DATA_DIRS=${unstable.gsettings-desktop-schemas}/share/gsettings-schemas/${unstable.gsettings-desktop-schemas.name}:${unstable.gtk3}/share/gsettings-schemas/${unstable.gtk3.name}:$XDG_DATA_DIRS
export GIO_MODULE_DIR="${unstable.glib-networking}/lib/gio/modules/"
'';
};
}
);
];
};
};
};
}