mirror of
https://github.com/willemml/dotfiles.nix.git
synced 2025-04-12 19:27:17 +00:00
more darwin config, fix freecad
This commit is contained in:
parent
6a027c3971
commit
32a4fc9430
7 changed files with 136 additions and 40 deletions
|
@ -33,6 +33,12 @@
|
|||
"${pkgs.pass}/bin/pass 'music/spotify' | head -n1"
|
||||
"--backend"
|
||||
"portaudio"
|
||||
"--bitrate"
|
||||
"320"
|
||||
"--device-type"
|
||||
"computer"
|
||||
"--volume_controller"
|
||||
"softvol"
|
||||
];
|
||||
KeepAlive = true;
|
||||
UserName = "${config.home.username}";
|
||||
|
|
|
@ -14,7 +14,7 @@ let
|
|||
spotify-mac
|
||||
vlc-mac
|
||||
];
|
||||
linux = with pkgs; [ vlc qbittorrent ];
|
||||
linux = with pkgs; [ vlc qbittorrent freecad spotify ];
|
||||
pass-extended = pkgs.pass.withExtensions (exts: [ exts.pass-genphrase exts.pass-otp exts.pass-import ]);
|
||||
python-wp = pkgs.python310.withPackages (p: with p; [ setuptools pyaml requests latexify-py ]);
|
||||
node-packages = with pkgs.nodePackages; [ bash-language-server ];
|
||||
|
@ -44,6 +44,7 @@ in
|
|||
htop
|
||||
jq
|
||||
nix-review
|
||||
nix-zsh-completions
|
||||
nixfmt
|
||||
nixpkgs-fmt
|
||||
nmap
|
||||
|
@ -59,6 +60,7 @@ in
|
|||
rsync
|
||||
rustup
|
||||
shellcheck
|
||||
shfmt
|
||||
spotify-tui
|
||||
spotifyd
|
||||
sqlite
|
||||
|
@ -71,6 +73,7 @@ in
|
|||
unzip
|
||||
wget
|
||||
yq
|
||||
zsh-completions
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin darwin
|
||||
++ lib.optionals stdenv.isLinux linux
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
{
|
||||
programs = {
|
||||
bash.enableCompletion = true;
|
||||
|
||||
browserpass = {
|
||||
enable = true;
|
||||
browsers = [
|
||||
|
@ -138,57 +140,62 @@
|
|||
|
||||
zsh = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
enableSyntaxHighlighting = true;
|
||||
enableVteIntegration = true;
|
||||
|
||||
autocd = true;
|
||||
defaultKeymap = "emacs";
|
||||
envExtra = ''
|
||||
#!/usr/bin/env zsh
|
||||
export GPG_TTY=$(tty)
|
||||
eval $(gpg-agent --daemon -q 2>/dev/null)
|
||||
|
||||
function gsearch() {
|
||||
open -a Safari "https://google.com/search?q=$(echo $@ | sed -e 's/ /%20/g')"
|
||||
}
|
||||
|
||||
function plistxml2nix() {
|
||||
tail -n +4 |
|
||||
sed -e "s/<dict>/{/g" \
|
||||
-e "s/<\/dict>/\}\;/g" \
|
||||
-e "s/<key>/\"/g" \
|
||||
-e "s/<\/key>/\"=/g" \
|
||||
-e "s/<real>//g" \
|
||||
-e "s/<\/real>/;/g" \
|
||||
-e "s/<integer>//g" \
|
||||
-e "s/<\/integer>/;/g" \
|
||||
-e "s/<string>/\"/g" \
|
||||
-e "s/<\/string>/\"\;/g" \
|
||||
-e "s/<array>/\[/g" \
|
||||
-e "s/<\/array>/\];/g" \
|
||||
-e "s/<true\/>/true;/g" \
|
||||
-e "s/<false\/>/false;/g" \
|
||||
-e "$ d" |
|
||||
sed \-e "$ s/;//"
|
||||
}
|
||||
'';
|
||||
dotDir = ".config/zsh";
|
||||
enableAutosuggestions = true;
|
||||
enableCompletion = true;
|
||||
enableSyntaxHighlighting = true;
|
||||
enableVteIntegration = true;
|
||||
|
||||
history = {
|
||||
path = "$HOME/.local/zsh/history";
|
||||
extended = true;
|
||||
ignoreDups = true;
|
||||
};
|
||||
|
||||
historySubstringSearch.enable = true;
|
||||
|
||||
loginExtra = ''
|
||||
#!/usr/bin/env zsh
|
||||
export GPG_TTY=$(tty)
|
||||
eval $(gpg-agent --daemon -q 2>/dev/null)
|
||||
function gsearch() {
|
||||
open -a Safari "https://google.com/search?q=$(echo $@ | sed -e 's/ /%20/g')"
|
||||
}
|
||||
function plistxml2nix() {
|
||||
tail -n +4 |
|
||||
sed -e "s/<dict>/{/g" \
|
||||
-e "s/<\/dict>/\}\;/g" \
|
||||
-e "s/<key>/\"/g" \
|
||||
-e "s/<\/key>/\"=/g" \
|
||||
-e "s/<real>//g" \
|
||||
-e "s/<\/real>/;/g" \
|
||||
-e "s/<integer>//g" \
|
||||
-e "s/<\/integer>/;/g" \
|
||||
-e "s/<string>/\"/g" \
|
||||
-e "s/<\/string>/\"\;/g" \
|
||||
-e "s/<array>/\[/g" \
|
||||
-e "s/<\/array>/\];/g" \
|
||||
-e "s/<true\/>/true;/g" \
|
||||
-e "s/<false\/>/false;/g" \
|
||||
-e "$ d" |
|
||||
sed \-e "$ s/;//"
|
||||
}
|
||||
'';
|
||||
|
||||
shellAliases = {
|
||||
cd = "z";
|
||||
drs = "darwin-rebuild switch --flake ${config.home.homeDirectory}/.config/dotfiles.nix#";
|
||||
e = "emacsclient -c -nw";
|
||||
em = "emacs -nw";
|
||||
emw = "emacs";
|
||||
ew = "emacsclient -c";
|
||||
drs = "darwin-rebuild switch --flake ${config.home.homeDirectory}/.config/dotfiles.nix#";
|
||||
l = "ls -1";
|
||||
np = "nix-shell -p";
|
||||
org = "z ${config.home.sessionVariables.ORGDIR}";
|
||||
ubc = "z ${config.home.sessionVariables.UBCDIR}";
|
||||
emw = "emacs";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
32
overlays/darwin-zsh-completions.nix
Normal file
32
overlays/darwin-zsh-completions.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
# taken from nix-darwin repo
|
||||
# https://github.com/LnL7/nix-darwin/blob/87b9d090ad39b25b2400029c64825fc2a8868943/modules/examples/lnl.nix
|
||||
{ pkgs, stdenv, ... }:
|
||||
|
||||
stdenv.runCommand "darwin-zsh-completions-0.0.0"
|
||||
{ preferLocalBuild = true; }
|
||||
''
|
||||
mkdir -p $out/share/zsh/site-functions
|
||||
cat <<-'EOF' > $out/share/zsh/site-functions/_darwin-rebuild
|
||||
#compdef darwin-rebuild
|
||||
#autoload
|
||||
_nix-common-options
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'switch:Build, activate, and update the current generation'\
|
||||
'build:Build without activating or updating the current generation'\
|
||||
'check:Build and run the activation sanity checks'\
|
||||
'changelog:Show most recent entries in the changelog'\
|
||||
)
|
||||
_arguments \
|
||||
'--list-generations[Print a list of all generations in the active profile]'\
|
||||
'--rollback[Roll back to the previous configuration]'\
|
||||
{--switch-generation,-G}'[Activate specified generation]'\
|
||||
'(--profile-name -p)'{--profile-name,-p}'[Profile to use to track current and previous system configurations]:Profile:_nix_profiles'\
|
||||
'1:: :->subcmds' && return 0
|
||||
case $state in
|
||||
subcmds)
|
||||
_describe -t commands 'darwin-rebuild subcommands' _1st_arguments
|
||||
;;
|
||||
esac
|
||||
EOF
|
||||
''
|
|
@ -1,5 +1,6 @@
|
|||
self: super: {
|
||||
chromium-mac = super.callPackage ./chromium-mac.nix { pkgs = super; };
|
||||
darwin-zsh-completions = import ./darwin-zsh-completions.nix { pkgs = super; };
|
||||
firefox-mac = super.callPackage ./firefox-mac.nix { pkgs = super; };
|
||||
freecad-mac = super.callPackage ./freecad-mac.nix { pkgs = super; };
|
||||
pinentry-touchid = super.callPackage ./pinentry-touchid.nix { pkgs = super; };
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
{ pkgs, fetchurl, ... }:
|
||||
|
||||
let
|
||||
version = "31483";
|
||||
date = "2022-12-31";
|
||||
version = "0.20.2";
|
||||
date = "2022-12-27";
|
||||
appName = "FreeCAD";
|
||||
pname = "freecad";
|
||||
|
||||
src = fetchurl {
|
||||
url =
|
||||
"https://github.com/FreeCAD/FreeCAD-Bundle/releases/download/weekly-builds/FreeCAD_weekly-builds-${version}-${date}-conda-macOS-arm-py311.dmg";
|
||||
sha256 = "sha256-dm6QbAazx1vFrkakkCsfCqyGzRED9guI7yFMQ24mU9o=";
|
||||
"https://github.com/FreeCAD/FreeCAD/releases/download/${version}/FreeCAD_${version}-${date}-conda-macOS-x86_64-py310.dmg";
|
||||
sha256 = "sha256-OAi98HUacHcLHVYSadnQFPnEhutJvE4YfRBtPSZk00c=";
|
||||
};
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
|
|
|
@ -1,6 +1,22 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.etc."nix/user-sandbox.sb".text = ''
|
||||
(version 1)
|
||||
(allow default)
|
||||
(deny file-write*
|
||||
(subpath "/nix"))
|
||||
(allow file-write*
|
||||
(subpath "/nix/var/nix/gcroots/per-user")
|
||||
(subpath "/nix/var/nix/profiles/per-user"))
|
||||
(allow process-exec
|
||||
(literal "/bin/ps")
|
||||
(with no-sandbox))
|
||||
'';
|
||||
|
||||
environment.loginShell = "${pkgs.zsh}/bin/zsh -l";
|
||||
environment.variables.SHELL = "${pkgs.zsh}/bin/zsh";
|
||||
environment.variables.LANG = "en_US.UTF-8";
|
||||
environment.systemPackages = with pkgs; [ ];
|
||||
|
||||
nix = {
|
||||
|
@ -15,8 +31,39 @@
|
|||
};
|
||||
|
||||
programs.bash.enable = true;
|
||||
|
||||
|
||||
programs.nix-index.enable = true;
|
||||
|
||||
programs.zsh.enable = true;
|
||||
programs.zsh.enableBashCompletion = true;
|
||||
programs.zsh.enableFzfCompletion = true;
|
||||
programs.zsh.enableFzfGit = true;
|
||||
programs.zsh.enableFzfHistory = true;
|
||||
programs.zsh.loginShellInit = ''
|
||||
reexec() {
|
||||
unset __NIX_DARWIN_SET_ENVIRONMENT_DONE
|
||||
unset __ETC_ZPROFILE_SOURCED __ETC_ZSHENV_SOURCED __ETC_ZSHRC_SOURCED
|
||||
exec $SHELL -c 'echo >&2 "reexecuting shell: $SHELL" && exec $SHELL -l'
|
||||
}
|
||||
reexec-sandbox() {
|
||||
unset __NIX_DARWIN_SET_ENVIRONMENT_DONE
|
||||
unset __ETC_ZPROFILE_SOURCED __ETC_ZSHENV_SOURCED __ETC_ZSHRC_SOURCED
|
||||
export IN_NIX_SANDBOX=1
|
||||
exec /usr/bin/sandbox-exec -f /etc/nix/user-sandbox.sb $SHELL -l
|
||||
}
|
||||
'';
|
||||
programs.zsh.promptInit = ''
|
||||
autoload -U promptinit && promptinit
|
||||
setopt PROMPTSUBST
|
||||
_prompt_nix() {
|
||||
[ -z "$IN_NIX_SHELL" ] || echo "%F{yellow}%B[''${name:+$name}]%b%f "
|
||||
}
|
||||
PS1='%F{red}%B%(?..%? )%b%f%# '
|
||||
RPS1='$(_prompt_nix)%F{green}%~%f'
|
||||
if [ -n "$IN_NIX_SANDBOX" ]; then
|
||||
PS1+='%F{red}[sandbox]%f '
|
||||
fi
|
||||
'';
|
||||
|
||||
services.nix-daemon.enable = true;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue