WIP: Integration branch with darwin and deck support
- Added darwin and jovian inputs - Added platform-specific package configurations - Added darwinConfigurations and deck nixosConfiguration - Copied darwin and deck specific files - Fixed darwin version compatibility Some configurations still need debugging
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
|
||||
## Layout
|
||||
```
|
||||
.
|
||||
├── dock # MacOS dock configuration
|
||||
├── casks.nix # List of homebrew casks
|
||||
├── default.nix # Defines module, system-level config
|
||||
├── files.nix # Non-Nix, static configuration files (now immutable!)
|
||||
├── home-manager.nix # Defines user programs
|
||||
├── packages.nix # List of packages to install for MacOS
|
||||
├── secrets.nix # Age-encrypted secrets with agenix
|
||||
```
|
||||
@@ -0,0 +1,67 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.local.dock;
|
||||
inherit (pkgs) stdenv dockutil;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
local.dock.enable = mkOption {
|
||||
description = "Enable dock";
|
||||
default = stdenv.isDarwin;
|
||||
example = false;
|
||||
};
|
||||
|
||||
local.dock.entries = mkOption
|
||||
{
|
||||
description = "Entries on the Dock";
|
||||
type = with types; listOf (submodule {
|
||||
options = {
|
||||
path = lib.mkOption { type = str; };
|
||||
section = lib.mkOption {
|
||||
type = str;
|
||||
default = "apps";
|
||||
};
|
||||
options = lib.mkOption {
|
||||
type = str;
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
});
|
||||
readOnly = true;
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
mkIf cfg.enable
|
||||
(
|
||||
let
|
||||
normalize = path: if hasSuffix ".app" path then path + "/" else path;
|
||||
entryURI = path: "file://" + (builtins.replaceStrings
|
||||
[" " "!" "\"" "#" "$" "%" "&" "'" "(" ")"]
|
||||
["%20" "%21" "%22" "%23" "%24" "%25" "%26" "%27" "%28" "%29"]
|
||||
(normalize path)
|
||||
);
|
||||
wantURIs = concatMapStrings
|
||||
(entry: "${entryURI entry.path}\n")
|
||||
cfg.entries;
|
||||
createEntries = concatMapStrings
|
||||
(entry: "${dockutil}/bin/dockutil --no-restart --add '${entry.path}' --section ${entry.section} ${entry.options}\n")
|
||||
cfg.entries;
|
||||
in
|
||||
{
|
||||
system.activationScripts.postUserActivation.text = ''
|
||||
echo >&2 "Setting up the Dock..."
|
||||
haveURIs="$(${dockutil}/bin/dockutil --list | ${pkgs.coreutils}/bin/cut -f2)"
|
||||
if ! diff -wu <(echo -n "$haveURIs") <(echo -n '${wantURIs}') >&2 ; then
|
||||
echo >&2 "Resetting Dock."
|
||||
${dockutil}/bin/dockutil --no-restart --remove all
|
||||
${createEntries}
|
||||
killall Dock
|
||||
else
|
||||
echo >&2 "Dock setup complete."
|
||||
fi
|
||||
'';
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
{ user, config, pkgs, ... }:
|
||||
|
||||
let
|
||||
xdg_configHome = "${config.users.users.${user}.home}/.config";
|
||||
xdg_dataHome = "${config.users.users.${user}.home}/.local/share";
|
||||
xdg_stateHome = "${config.users.users.${user}.home}/.local/state"; in
|
||||
{
|
||||
|
||||
# Raycast script so that "Run Emacs" is available and uses Emacs daemon
|
||||
"${xdg_dataHome}/bin/emacsclient" = {
|
||||
executable = true;
|
||||
text = ''
|
||||
#!/bin/zsh
|
||||
#
|
||||
# Required parameters:
|
||||
# @raycast.schemaVersion 1
|
||||
# @raycast.title Run Emacs
|
||||
# @raycast.mode silent
|
||||
#
|
||||
# Optional parameters:
|
||||
# @raycast.packageName Emacs
|
||||
# @raycast.icon ${xdg_dataHome}/img/icons/Emacs.icns
|
||||
# @raycast.iconDark ${xdg_dataHome}/img/icons/Emacs.icns
|
||||
|
||||
if [[ $1 = "-t" ]]; then
|
||||
# Terminal mode
|
||||
${pkgs.emacs}/bin/emacsclient -t $@
|
||||
else
|
||||
# GUI mode
|
||||
${pkgs.emacs}/bin/emacsclient -c -n $@
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
# Script to import Drafts into Emacs org-roam
|
||||
"${xdg_dataHome}/bin/import-drafts" = {
|
||||
executable = true;
|
||||
text = ''
|
||||
#!/bin/sh
|
||||
|
||||
for f in ${xdg_stateHome}/drafts/*
|
||||
do
|
||||
if [[ ! "$f" =~ "done" ]]; then
|
||||
echo "Importing $f"
|
||||
filename="$(head -c 10 $f)"
|
||||
output="${xdg_dataHome}/org-roam/daily/$filename.org"
|
||||
echo '\n' >> "$output"
|
||||
tail -n +3 $f >> "$output"
|
||||
mv $f done
|
||||
fi
|
||||
done
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
{ config, pkgs, lib, home-manager, ... }:
|
||||
|
||||
let
|
||||
user = "anishlakhwara";
|
||||
# Define the content of your file as a derivation
|
||||
myEmacsLauncher = pkgs.writeScript "emacs-launcher.command" ''
|
||||
#!/bin/sh
|
||||
emacsclient -c -n &
|
||||
'';
|
||||
sharedFiles = import ../shared/files.nix { inherit config pkgs; };
|
||||
additionalFiles = import ./files.nix { inherit user config pkgs; };
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./dock
|
||||
];
|
||||
|
||||
# It me
|
||||
users.users.${user} = {
|
||||
name = "${user}";
|
||||
home = "/Users/${user}";
|
||||
isHidden = false;
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
|
||||
# Enable home-manager
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
users.${user} = { pkgs, config, lib, ... }:{
|
||||
home = {
|
||||
enableNixpkgsReleaseCheck = false;
|
||||
packages = pkgs.callPackage ./packages.nix {};
|
||||
file = lib.mkMerge [
|
||||
sharedFiles
|
||||
additionalFiles
|
||||
{ "emacs-launcher.command".source = myEmacsLauncher; }
|
||||
];
|
||||
|
||||
stateVersion = "23.11";
|
||||
};
|
||||
|
||||
programs = {} // import ../shared/home-manager.nix { inherit config pkgs lib; };
|
||||
|
||||
# Marked broken Oct 20, 2022 check later to remove this
|
||||
# https://github.com/nix-community/home-manager/issues/3344
|
||||
manual.manpages.enable = false;
|
||||
};
|
||||
};
|
||||
|
||||
# Fully declarative dock using the latest from Nix Store
|
||||
local = {
|
||||
dock.enable = true;
|
||||
dock.entries = [
|
||||
{ path = "/Applications/Slack.app/"; }
|
||||
{ path = "/System/Applications/Messages.app/"; }
|
||||
{ path = "/System/Applications/Facetime.app/"; }
|
||||
{ path = "/Applications/Telegram.app/"; }
|
||||
{ path = "${pkgs.alacritty}/Applications/Alacritty.app/"; }
|
||||
{ path = "/System/Applications/Music.app/"; }
|
||||
{ path = "/System/Applications/News.app/"; }
|
||||
{ path = "/System/Applications/Photos.app/"; }
|
||||
{ path = "/System/Applications/Photo Booth.app/"; }
|
||||
{ path = "/System/Applications/TV.app/"; }
|
||||
{ path = "${pkgs.jetbrains.phpstorm}/Applications/PhpStorm.app/"; }
|
||||
{ path = "/Applications/TablePlus.app/"; }
|
||||
{ path = "/Applications/Asana.app/"; }
|
||||
{ path = "/Applications/Drafts.app/"; }
|
||||
{ path = "/System/Applications/Home.app/"; }
|
||||
{
|
||||
path = toString myEmacsLauncher;
|
||||
section = "others";
|
||||
}
|
||||
{
|
||||
path = "${config.users.users.${user}.home}/.local/share/";
|
||||
section = "others";
|
||||
options = "--sort name --view grid --display folder";
|
||||
}
|
||||
{
|
||||
path = "${config.users.users.${user}.home}/.local/share/downloads";
|
||||
section = "others";
|
||||
options = "--sort name --view grid --display stack";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{ pkgs }:
|
||||
|
||||
with pkgs;
|
||||
let shared-packages = import ../shared/packages.nix { inherit pkgs; }; in
|
||||
shared-packages ++ [
|
||||
dockutil
|
||||
]
|
||||
@@ -0,0 +1,47 @@
|
||||
{ config, pkgs, agenix, secrets, ... }:
|
||||
|
||||
let user = "dustin"; in
|
||||
{
|
||||
age = {
|
||||
identityPaths = [
|
||||
"/Users/${user}/.ssh/id_ed25519"
|
||||
];
|
||||
|
||||
secrets = {
|
||||
"syncthing-cert" = {
|
||||
symlink = true;
|
||||
path = "/Users/${user}/Library/Application Support/Syncthing/cert.pem";
|
||||
file = "${secrets}/darwin-syncthing-cert.age";
|
||||
mode = "644";
|
||||
owner = "${user}";
|
||||
group = "staff";
|
||||
};
|
||||
|
||||
"syncthing-key" = {
|
||||
symlink = true;
|
||||
path = "/Users/${user}/Library/Application Support/Syncthing/key.pem";
|
||||
file = "${secrets}/darwin-syncthing-key.age";
|
||||
mode = "600";
|
||||
owner = "${user}";
|
||||
group = "staff";
|
||||
};
|
||||
|
||||
"github-ssh-key" = {
|
||||
symlink = true;
|
||||
path = "/Users/${user}/.ssh/id_github";
|
||||
file = "${secrets}/github-ssh-key.age";
|
||||
mode = "600";
|
||||
owner = "${user}";
|
||||
group = "staff";
|
||||
};
|
||||
|
||||
"github-signing-key" = {
|
||||
symlink = false;
|
||||
path = "/Users/${user}/.ssh/pgp_github.key";
|
||||
file = "${secrets}/github-signing-key.age";
|
||||
mode = "600";
|
||||
owner = "${user}";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user