about summary refs log tree commit diff stats
path: root/nix-conf
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2023-01-13 07:47:03 +0000
committerDavid Morgan <djm_uk@protonmail.com>2023-01-13 07:47:03 +0000
commitf0f1ee1af0eb3968513e9ea904a59607c86478b6 (patch)
treefdc275e5cac228ad91030017f87fd98badba66ad /nix-conf
parent92f56b3048c9879f5b7651412784870aecca1cf1 (diff)
downloaddotfiles-f0f1ee1af0eb3968513e9ea904a59607c86478b6.tar.gz
Only use nvm on darwin
Diffstat (limited to 'nix-conf')
-rw-r--r--nix-conf/home/includes/zsh.nix8
1 files changed, 6 insertions, 2 deletions
diff --git a/nix-conf/home/includes/zsh.nix b/nix-conf/home/includes/zsh.nix
index 21ff059..fc39509 100644
--- a/nix-conf/home/includes/zsh.nix
+++ b/nix-conf/home/includes/zsh.nix
@@ -1,5 +1,7 @@
-{ config, pkgs, lib, ... }:
-
+{ config, pkgs, lib, isDarwin, ... }:
+let
+    inherit (lib) optionals;
+in
 {
   home.packages = with pkgs; [
     zsh-completions
@@ -270,6 +272,8 @@
         };
         file = "per-directory-history.zsh";
       }
+    ]
+    ++ optionals stdenv.isDarwin [
       {
         name = "zsh-nvm";
         src = fetchFromGitHub {
ighlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#!/bin/sh
# Translate a Mu program to a _minified_ bootable disk image.
#
# Hacky; only intended for some stats at the moment, even though all programs
# I've run through it seem to continue to work. If there are no power-on unit
# tests, I don't trust it.

set -ev

# Map of the Mu code disk
export DISK=20160  # 20*16*63 512-byte sectors = almost 10MB
dd if=/dev/zero of=code.img count=$DISK status=none
# code: sectors 0-8999
# font: sectors 9000-10079  (1080 sectors = space enough for 16k glyphs (1080 * 512 / 34 bytes per glyph))
export FONT=9000  # keep this sync'd with boot.subx
# debug: sector 10080 onwards
export DEBUG=10080

## Code

cat $* [0-9]*.mu                                          |linux/mu                         > a.subx

cat boot.subx                                             |grep -vh '^\s*$\|^\s*#'          > a.boot.strip
cat           tools/mu-init-minify.subx [0-9]*.subx a.subx|grep -vh '^\s*$\|^\s*#'          > a.strip

# treeshake everything but boot.subx, which isn't quite standard SubX and
# doesn't get parsed correctly by treeshake for some reason.
cat a.strip                                               |tools/treeshake                  > a.treeshake

cat a.boot.strip a.treeshake                              |linux/braces                     > a.braces

cat a.braces                                              |linux/calls                      > a.calls

cat a.calls                                               |linux/sigils                     > a.sigils

cat a.sigils                                              |linux/tests                      > a.tests

# no assort since baremetal SubX doesn't have segments yet

cat a.tests                                               |linux/dquotes                    > a.dquotes

cat a.dquotes                                             |linux/pack                       > a.pack

cat a.pack                                                |linux/survey_baremetal > labels
cat a.pack                                                |linux/labels_baremetal   labels  > a.survey

cat a.survey                                              |linux/hex                        > a.bin

dd if=a.bin of=code.img conv=notrunc status=none

if [ `stat --printf="%s" a.bin` -ge 492544 ]  # 15 tracks * 63 sectors per track * 512 bytes per sector (keep this sync'd with boot.subx)
then
  echo "a.bin won't all be loaded on boot"
  exit 1
fi

if [ `stat --printf="%s" a.bin` -ge 492544 ]  # 15 tracks * 63 sectors per track * 512 bytes per sector
then
  echo "a.bin will overwrite BIOS/Video memory; you'll need to adjust boot.subx to load code to some other non-contiguous area of memory"
  exit 1
fi

if [ `stat --printf="%s" a.bin` -ge $(($FONT*512)) ]
then
  echo "a.bin will overwrite font in disk"
  exit 1
fi

## Latter half of disk is for debug info

if [ `stat --printf="%s" labels` -ge 1048576 ]  # 8 reads * 256 sectors * 512 bytes per sector
then
  echo "labels won't all be loaded on abort"
  exit 1
fi

if [ `wc -l < labels` -gt 20480 ]  # 0x5000 stream capacity in abort.subx
then
  echo "abort will go into infinite regress"
  exit 1
fi

dd if=labels of=code.img seek=$DEBUG conv=notrunc status=none  # keep this sync'd with abort.subx

## Font data at another well-defined location
cat font.subx   |sed 's,/[^ ]*,,'    |linux/hex    > a.font

if [ `stat --printf="%s" a.font` -ge 262144 ]  # 0x200 sectors * 512 bytes per sector (keep this sync'd with boot.subx)
then
  echo "font won't all be loaded on boot"
  exit 1
fi

if [ `stat --printf="%s" a.font` -ge 14680064 ]  # 0x00e00000 = 0x00f00000 - 0x00100000
then
  echo "font is so large it overlaps the ISA memory hole; see https://wiki.osdev.org/Memory_Map_(x86)"
  exit 1
fi

if [ `stat --printf="%s" a.font` -ge $(( ($DEBUG - $FONT) * 512 )) ]
then
  echo "font will overwrite debug info in disk"
  exit 1
fi

dd if=a.font of=code.img seek=$FONT conv=notrunc status=none