forked from Alex222222222222/CopyClip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
110 lines (101 loc) · 3.21 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
{
description = "Alex222222222222 configuration for arm64 nix os";
nixConfig = {
experimental-features =
[ "nix-command" "flakes" "auto-allocate-uids" "configurable-impure-env" ];
substituters = [
"https://cache.nixos.org/"
"https://mirrors.bfsu.edu.cn/nix-channels/store"
];
# nix community's cache server
extra-substituters =
[ "https://nix-community.cachix.org" "https://hyprland.cachix.org" ];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
};
inputs = {
# NixOS 官方软件源,这里使用 nixos-unstable 分支
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, rust-overlay, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system: {
devShells =
let
inherit (pkgs.stdenv) isLinux;
pkgs = import nixpkgs {
system = system;
config.allowUnfree = true;
overlays = [ rust-overlay.overlay ];
};
toolchain = pkgs.rust-bin.nightly.latest.default.override {
extensions = [ "rust-src" "rust-std" ];
targets = [ "wasm32-unknown-unknown" ];
};
buildInputs = with pkgs; [
unzip
git
curl
wget
ncdu
neovim
htop
nixfmt
sqlite
tokei
mosh
vscode
nil
nodejs-18_x
nodePackages.npm
pkg-config
nodePackages_latest.tailwindcss
];
rust-packages-linux = with pkgs; [
protobuf
binaryen
wasm-pack
trunk
wasm-bindgen-cli
rustfmt
clippy
rust-analyzer
cargo-tauri
toolchain
gtk3
webkitgtk
libayatana-appindicator.dev
alsa-lib.dev
];
rust-packages-darwin = with pkgs; [
# libiconv
# darwin.apple_sdk.frameworks.Security
# darwin.apple_sdk.frameworks.CoreServices
# darwin.apple_sdk.frameworks.CoreFoundation
# darwin.apple_sdk.frameworks.Foundation
# darwin.apple_sdk.frameworks.AppKit
# darwin.apple_sdk.frameworks.WebKit
# darwin.apple_sdk.frameworks.Cocoa
];
rust-packages =
if isLinux then rust-packages-linux else rust-packages-darwin;
rust-packages-with-my-packages = buildInputs ++ rust-packages;
shellHook = ''
export EDITOR=nvim
export VISUAL=nvim
export PATH=$PATH:$HOME/.local/bin
'';
in
{
default = pkgs.mkShell {
buildInputs = rust-packages-with-my-packages;
shellHook = shellHook;
};
};
formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt;
});
}