Skip to content

Commit

Permalink
update flake logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Pickles888 committed Aug 15, 2024
1 parent 07241f6 commit 3431a10
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 57 deletions.
72 changes: 46 additions & 26 deletions flake.lock

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

66 changes: 35 additions & 31 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,40 +1,44 @@
{
description = "Example Rust development environment for Zero to Nix";
description = "Todo list app made in iced";

# Flake inputs
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";

naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = {
self,
nixpkgs,
rust-overlay,
}: let
allSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
outputs = { self, flake-utils, naersk, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = (import nixpkgs) {
inherit system;
};

naersk' = pkgs.callPackage naersk {};
in {
defaultPackage = naersk'.buildPackage {
src = ./.;
};

forAllSystems = f:
nixpkgs.lib.genAttrs allSystems
(system: f {pkgs = import nixpkgs {inherit system;};});
in {
devShells = forAllSystems ({pkgs}: {
default = pkgs.mkShell {
packages =
(with pkgs; [rustup])
++ pkgs.lib.optionals pkgs.stdenv.isDarwin
(with pkgs; [libiconv]);
shellHook = "zsh && exit";
WINIT_UNIX_BACKEND = "wayland";
LD_LIBRARY_PATH = "$LD_LIBRARY_PATH:${ with pkgs; lib.makeLibraryPath [
wayland
libGL
vulkan-loader
vulkan-headers
libxkbcommon
fontconfig
] }";
devShell = pkgs.mkShell {
packages =
(with pkgs; [rustup])
++ pkgs.lib.optionals pkgs.stdenv.isDarwin
(with pkgs; [libiconv]);
shellHook = "zsh && exit";
WINIT_UNIX_BACKEND = "wayland";
LD_LIBRARY_PATH = "$LD_LIBRARY_PATH:${ with pkgs; lib.makeLibraryPath [
wayland
libGL
vulkan-loader
vulkan-headers
libxkbcommon
fontconfig
]}";
};
});
};
}

0 comments on commit 3431a10

Please sign in to comment.