···11# crescentrose's dotfiles
2233-43
5465
7687## Setup
9899+There are two variants: a pure NixOS variant with a custom desktop shell, and a
1010+macOS variant that shares a small part of the command-line configuration for
1111+consistency with my work machine.
1212+1313+### NixOS
1414+1015This is a standard Nix flake. so on a NixOS system, running `sudo nixos-rebuild
1116--flake ./nixos#starlight switch` should do the trick. Note that you will need a
1217handful of _secrets_ - refer to the flake files for details. Also, the wallpaper
···1419the artists - find your own wallpapers! Improving the setup experience is on my
1520to-do list, but it's not yet ready.
16211717-Note that this set-up is tweaked for my desktop PC and is currently not very
1818-modular or extensible. Improving this is also on my to-do list.
2222+This set-up is tweaked for my desktop PC and is currently not very modular or
2323+extensible. Improving this is also on my to-do list.
2424+2525+### macOS
2626+2727+The macOS variant assumes [Determinate Nix](https://determinate.systems/nix/)
2828+as it has a better setup experience and plays better with various corporate
2929+tools.
3030+3131+In addition to Determinate Nix, you should also set up [Homebrew](https://brew.sh/).
3232+3333+For initial set-up, run:
3434+3535+```sh
3636+sudo nix run nix-darwin/master#darwin-rebuild -- switch --flake .
3737+```
3838+3939+Afterwards, you can use `darwin-rebuild` to apply changes:
4040+4141+```sh
4242+sudo darwin-rebuild switch --flake .
4343+```
···11-{ pkgs, ... }:
21{
32 # only import the subset supported by macOS
43 imports = [
54 ./base.nix
65 ./programs/git.nix
76 ./programs/ssh.nix
88- ./programs/ghostty.nix
97 ./programs/helix.nix
108 ./shell
119 ];
12101311 # corporate mandated
1412 home.username = "ivan.ostric";
1515- home.directory = "/Users/ivan.ostric";
1313+ home.homeDirectory = "/Users/ivan.ostric";
16141717- # :squints:
1818- programs.ghostty.settings.font-size = pkgs.mkForce 12;
1515+ # TODO: Ghostty is not packaged for macOS in Nix, so we can't use the same
1616+ # config. This should be fixed.
1717+ xdg.configFile."ghostty/config".text = ''
1818+ command = /usr/bin/env zsh -c nu
1919+ font-family = Iosevka
2020+ font-size = 14
2121+ theme = dark:Catppuccin Macchiato,light:Catppuccin Latte
2222+ '';
1923}
+2
home/programs/ghostty.nix
···11+# TODO: Ghostty is not packaged for macOS in Nix, so we can't use the same
22+# config. This should be fixed.
13{
24 programs.ghostty = {
35 enable = true;
···2727 $env.NU_LIB_DIRS ++= ["${config.xdg.dataHome}/scripts/lib"]
2828 $env.PATH ++= ["${config.xdg.dataHome}/scripts/bin"]
2929 '';
3030+3131+ extraConfig = ''
3232+ use pm switch # for fast swap between directories
3333+ '';
3034 };
3135}
+1
home/shell/starship.nix
···22 programs.starship = {
33 enable = true;
44 enableNushellIntegration = true;
55+ enableZshIntegration = true;
56 settings = {
6778 # Inserts a blank line between shell prompts
+65
machines/work/default.nix
···11+{ pkgs, ... }:
22+let
33+ # Another joy of the corporate life: your full legal name as the device
44+ # user...
55+ user = "ivan.ostric";
66+in
77+{
88+ system.primaryUser = user;
99+1010+ environment.systemPackages = with pkgs; [
1111+ # macOS-specific Docker stuff
1212+ podman
1313+ docker # use `docker` commands with podman
1414+ docker-buildx
1515+ ];
1616+1717+ # Ideally we would manage everything with Nix, but life is sad and some
1818+ # packages are only available through Brew.
1919+ #
2020+ # Note that Homebrew needs to be installed manually for this to work.
2121+ homebrew = {
2222+ enable = true;
2323+ brews = [
2424+ "mas"
2525+ ];
2626+ casks = [
2727+ "1password"
2828+ "1password-cli"
2929+ "ghostty"
3030+ "obsidian"
3131+ "podman-desktop"
3232+ "raycast"
3333+ "font-cascadia-code-nf"
3434+ "font-fira-code-nerd-font"
3535+ "font-symbols-only-nerd-font"
3636+ ];
3737+ };
3838+3939+ # Run a PostgreSQL development database
4040+ services.postgresql.enable = true;
4141+4242+ # Use ZSH as the main shell
4343+ programs.zsh.enable = true;
4444+ # Use Homebrew through zsh
4545+ programs.zsh.shellInit = ''
4646+ eval "$(/opt/homebrew/bin/brew shellenv)"
4747+ '';
4848+4949+ # Use Touch ID for authentication with `sudo`
5050+ security.pam.services.sudo_local.touchIdAuth = true;
5151+5252+ # Using Determinate Nix, because upstream Nix does not work as well when
5353+ # your corporate provisioned device is loaded with Microsoft endpoint
5454+ # security "features"
5555+ nix.enable = false;
5656+ nixpkgs.hostPlatform = "aarch64-darwin";
5757+5858+ users.users."${user}" = {
5959+ name = user;
6060+ home = "/Users/${user}";
6161+ };
6262+6363+ # WARN: Here be dragons!
6464+ system.stateVersion = 6;
6565+}
resources/scripts/bin/kctx
+1-1
resources/scripts/lib/pm/mod.nu
···66}
7788# Change to a project directory (directory under ~/Code).
99-export def --env go [dir: string@list] {
99+export def --env switch [dir: string@list] {
1010 cd $"($env.HOME)/Code/($dir)"
1111}
1212