init
init
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
|
||||
## 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
|
||||
```
|
||||
@@ -1 +0,0 @@
|
||||
_: [ ]
|
||||
@@ -1,105 +0,0 @@
|
||||
{
|
||||
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;
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
username = mkOption {
|
||||
description = "Username to apply the dock settings to";
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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.postActivation.text = ''
|
||||
echo >&2 "Setting up the Dock for ${cfg.username}..."
|
||||
su ${cfg.username} -s /bin/sh <<'USERBLOCK'
|
||||
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
|
||||
USERBLOCK
|
||||
'';
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
user,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{ }
|
||||
@@ -1,76 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
home-manager,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
user = "cschmatzler";
|
||||
sharedFiles = import ../shared/files.nix { inherit config pkgs; };
|
||||
additionalFiles = import ./files.nix { inherit user config pkgs; };
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./dock
|
||||
];
|
||||
|
||||
users.users.${user} = {
|
||||
name = "${user}";
|
||||
home = "/Users/${user}";
|
||||
isHidden = false;
|
||||
shell = pkgs.fish;
|
||||
ignoreShellProgramCheck = true;
|
||||
};
|
||||
|
||||
homebrew = {
|
||||
enable = true;
|
||||
casks = pkgs.callPackage ./casks.nix { };
|
||||
|
||||
masApps = { };
|
||||
};
|
||||
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
users.${user} =
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
home = {
|
||||
enableNixpkgsReleaseCheck = false;
|
||||
packages = pkgs.callPackage ./packages.nix { };
|
||||
file = lib.mkMerge [
|
||||
sharedFiles
|
||||
additionalFiles
|
||||
];
|
||||
stateVersion = "23.11";
|
||||
};
|
||||
programs = { } // import ../shared/home-manager.nix { inherit config pkgs lib; };
|
||||
};
|
||||
};
|
||||
|
||||
local = {
|
||||
dock = {
|
||||
enable = true;
|
||||
username = user;
|
||||
entries = [
|
||||
{ path = "/Applications/Safari.app/"; }
|
||||
{ path = "/${pkgs.ghostty-bin}/Applications/Ghostty.app/"; }
|
||||
{ path = "${pkgs.alacritty}/Applications/Alacritty.app/"; }
|
||||
{ path = "/System/Applications/Notes.app/"; }
|
||||
{ path = "/System/Applications/Music.app/"; }
|
||||
{ path = "/System/Applications/System Settings.app/"; }
|
||||
{
|
||||
path = "${config.users.users.${user}.home}/Downloads";
|
||||
section = "others";
|
||||
options = "--sort name --view grid --display stack";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{ pkgs }:
|
||||
with pkgs;
|
||||
let
|
||||
shared-packages = import ../shared/packages.nix { inherit pkgs; };
|
||||
in
|
||||
shared-packages
|
||||
++ [
|
||||
_1password-gui
|
||||
dockutil
|
||||
raycast
|
||||
neovim
|
||||
]
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
agenix,
|
||||
secrets,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
user = "cschmatzler";
|
||||
in
|
||||
{
|
||||
age.identityPaths = [
|
||||
"/Users/${user}/.ssh/id_ed25519"
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user