mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-25 18:28:41 +02:00
refactor: use lib.optionals instead of if...then...else...
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
{pkgs, ...}: {
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs;
|
||||
[
|
||||
# general tools
|
||||
@@ -26,12 +30,10 @@
|
||||
aliyun-cli
|
||||
]
|
||||
++ (
|
||||
if pkgs.stdenv.isLinux
|
||||
then [
|
||||
lib.optionals pkgs.stdenv.isLinux [
|
||||
# cloud tools that nix do not have cache for.
|
||||
terraform
|
||||
terraformer # generate terraform configs from existing cloud resources
|
||||
]
|
||||
else []
|
||||
);
|
||||
}
|
||||
|
||||
@@ -41,8 +41,7 @@
|
||||
exercism
|
||||
]
|
||||
++ (
|
||||
if pkgs.stdenv.isLinux
|
||||
then [
|
||||
lib.optionals pkgs.stdenv.isLinux [
|
||||
# Automatically trims your branches whose tracking remote refs are merged or gone
|
||||
# It's really useful when you work on a project for a long time.
|
||||
git-trim
|
||||
@@ -57,7 +56,6 @@
|
||||
wireshark # network analyzer
|
||||
ventoy # create bootable usb
|
||||
]
|
||||
else []
|
||||
);
|
||||
|
||||
programs = {
|
||||
|
||||
@@ -129,9 +129,7 @@
|
||||
(ripgrep.override {withPCRE2 = true;}) # recursively searches directories for a regex pattern
|
||||
]
|
||||
++ (
|
||||
if pkgs.stdenv.isDarwin
|
||||
then []
|
||||
else [
|
||||
lib.optionals pkgs.stdenv.isLinux [
|
||||
#-- verilog / systemverilog
|
||||
verible
|
||||
gdb
|
||||
|
||||
@@ -18,18 +18,23 @@
|
||||
# we can add wezterm as a flake input once this PR is merged:
|
||||
# https://github.com/wez/wezterm/pull/3547
|
||||
|
||||
programs.wezterm =
|
||||
{
|
||||
enable = false; # disable
|
||||
programs.wezterm = {
|
||||
enable = true; # disable
|
||||
|
||||
# TODO: Fix: https://github.com/wez/wezterm/issues/4483
|
||||
# package = pkgs.wezterm.override { };
|
||||
# install wezterm via homebrew on macOS to avoid compilation, dummy package here.
|
||||
package =
|
||||
if pkgs.stdenv.isLinux
|
||||
then pkgs.wezterm
|
||||
else pkgs.hello;
|
||||
|
||||
enableBashIntegration = pkgs.stdenv.isLinux;
|
||||
enableZshIntegration = pkgs.stdenv.isLinux;
|
||||
|
||||
extraConfig = let
|
||||
fontsize =
|
||||
if pkgs.stdenv.isDarwin
|
||||
then "14.0"
|
||||
else "13.0";
|
||||
if pkgs.stdenv.isLinux
|
||||
then "13.0"
|
||||
else "14.0";
|
||||
in ''
|
||||
-- Pull in the wezterm API
|
||||
local wezterm = require 'wezterm'
|
||||
@@ -96,15 +101,5 @@
|
||||
|
||||
return config
|
||||
'';
|
||||
}
|
||||
// (
|
||||
if pkgs.stdenv.isDarwin
|
||||
then {
|
||||
# install wezterm via homebrew on macOS to avoid compilation, dummy package here.
|
||||
# package = pkgs.hello;
|
||||
enableBashIntegration = false;
|
||||
enableZshIntegration = false;
|
||||
}
|
||||
else {}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
nur-ryan4yin,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
home.packages = with pkgs;
|
||||
[
|
||||
# Misc
|
||||
tldr
|
||||
cowsay
|
||||
@@ -53,10 +54,9 @@
|
||||
# productivity
|
||||
caddy # A webserver with automatic HTTPS via Let's Encrypt(replacement of nginx)
|
||||
croc # File transfer between computers securely and easily
|
||||
|
||||
]
|
||||
# self-hosted nix cache server
|
||||
attic.packages.${pkgs.system}.attic-client
|
||||
];
|
||||
++ lib.optionals pkgs.stdenv.isLinux [attic.packages.${pkgs.system}.attic-client];
|
||||
|
||||
programs = {
|
||||
# A modern replacement for ‘ls’
|
||||
|
||||
Reference in New Issue
Block a user