From 504f9637d9911431cb58cd022669ac82b9b67179 Mon Sep 17 00:00:00 2001 From: Christoph Schmatzler Date: Tue, 5 Aug 2025 19:13:18 +0200 Subject: [PATCH] nvim stuff --- flake.lock | 30 ++--- flake.nix | 106 +++++++++--------- hosts/darwin/chidi/default.nix | 4 +- hosts/darwin/jason/default.nix | 4 +- hosts/darwin/shared.nix | 4 +- hosts/nixos/default.nix | 18 ++- lib/systems.nix | 55 +++++---- profiles/base/default.nix | 22 ++-- profiles/base/home-manager/bat.nix | 7 +- profiles/base/home-manager/git.nix | 11 +- profiles/base/home-manager/neovim/autocmd.nix | 35 ++++++ profiles/base/home-manager/neovim/default.nix | 7 +- profiles/base/home-manager/neovim/options.nix | 1 - .../home-manager/neovim/plugins/conform.nix | 14 +++ .../base/home-manager/neovim/plugins/mini.nix | 59 ++++++++++ .../base/home-manager/neovim/plugins/oil.nix | 1 - .../neovim/plugins/treesitter.nix | 17 +++ profiles/base/home-manager/ssh.nix | 4 +- profiles/base/home-manager/starship.nix | 7 +- profiles/base/home-manager/zellij.nix | 3 +- profiles/base/packages.nix | 9 +- profiles/darwin/default.nix | 50 ++++----- profiles/darwin/dock/default.nix | 35 +++--- profiles/darwin/home-manager/ghostty.nix | 7 +- profiles/darwin/homebrew.nix | 6 +- profiles/darwin/packages.nix | 6 +- profiles/darwin/secrets.nix | 3 +- profiles/darwin/system.nix | 4 +- profiles/nixos/default.nix | 49 ++++---- 29 files changed, 322 insertions(+), 256 deletions(-) create mode 100644 profiles/base/home-manager/neovim/autocmd.nix delete mode 100644 profiles/base/home-manager/neovim/options.nix create mode 100644 profiles/base/home-manager/neovim/plugins/conform.nix create mode 100644 profiles/base/home-manager/neovim/plugins/mini.nix create mode 100644 profiles/base/home-manager/neovim/plugins/treesitter.nix diff --git a/flake.lock b/flake.lock index c2d1ec2..907f9fc 100644 --- a/flake.lock +++ b/flake.lock @@ -198,11 +198,11 @@ "homebrew-cask": { "flake": false, "locked": { - "lastModified": 1754394942, - "narHash": "sha256-ib1lYDLsu+e2xhnRmeTQrfnHwxvrOb3qMfR3MJcjkJo=", + "lastModified": 1754412068, + "narHash": "sha256-oCevHZdlmwe+0j2I3TVrr0ioQFqLMRE+HpB+oFd0MkI=", "owner": "homebrew", "repo": "homebrew-cask", - "rev": "9eb97f6ab87b3f49cfcd81f2ff0622e1f95dba45", + "rev": "e52ff1a5283b6f673b7344a74b12880b84151d5d", "type": "github" }, "original": { @@ -214,11 +214,11 @@ "homebrew-core": { "flake": false, "locked": { - "lastModified": 1754394738, - "narHash": "sha256-vNxvJ1E2l5PxrgFvci+Hah0FqmbIQL10C3Le9OYqVyg=", + "lastModified": 1754411121, + "narHash": "sha256-wVHJH09VJXm/FTJmXNYivpPcT6nt2/+tAL6tp0WPLr4=", "owner": "homebrew", "repo": "homebrew-core", - "rev": "04d935868909c9433d594352d854fab823c64e2e", + "rev": "3d0146a83f0a5f2f46b955794254c580725336bd", "type": "github" }, "original": { @@ -323,11 +323,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1754340878, - "narHash": "sha256-lgmUyVQL9tSnvvIvBp7x1euhkkCho7n3TMzgjdvgPoU=", + "lastModified": 1754278406, + "narHash": "sha256-jvIQTMN5EzoOP5RaGztpVese8a3wqy0M/h6tNzycW28=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "cab778239e705082fe97bb4990e0d24c50924c04", + "rev": "6a489c9482ca676ce23c0bcd7f2e1795383325fa", "type": "github" }, "original": { @@ -345,11 +345,11 @@ "systems": "systems_3" }, "locked": { - "lastModified": 1754379602, - "narHash": "sha256-Fvc2xy326XkjDCY/uuj05z8DJs+AKmugEITTCNAp2rs=", + "lastModified": 1754397955, + "narHash": "sha256-4hQT8mDSRNgPKiPdpYwr2QVJdA4FaUhOjT2lKkW8QHQ=", "owner": "nix-community", "repo": "nixvim", - "rev": "cd4fac45a450706c466af3bd5715b617b9efa1c6", + "rev": "8d47a07563120b36af149edf2273034563339a91", "type": "github" }, "original": { @@ -368,11 +368,11 @@ ] }, "locked": { - "lastModified": 1753771532, - "narHash": "sha256-Pmpke0JtLRzgdlwDC5a+aiLVZ11JPUO5Bcqkj0nHE/k=", + "lastModified": 1754301638, + "narHash": "sha256-aRgzcPDd2axHFOuMlPLuzmDptUM2JU8mUL3jfgbBeyc=", "owner": "NuschtOS", "repo": "search", - "rev": "2a65adaf2c0c428efb0f4a2bc406aab466e96a06", + "rev": "a60091045273484c040a91f5c229ba298f8ecc27", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 57616f7..5f9fdd8 100644 --- a/flake.nix +++ b/flake.nix @@ -35,63 +35,57 @@ flake = false; }; }; - outputs = - { - agenix, - darwin, - disko, - home-manager, - homebrew-bundle, - homebrew-cask, - homebrew-core, - nix-homebrew, - nixpkgs, - nixvim, - secrets, - self, - }@inputs: - let - systemLib = import ./lib/systems.nix inputs; - inherit (systemLib) - systemConfigs - mkDarwinSystem - mkNixosSystem - mkApps - ; - inherit (systemConfigs) darwinHosts nixosHosts; + outputs = { + agenix, + darwin, + disko, + home-manager, + homebrew-bundle, + homebrew-cask, + homebrew-core, + nix-homebrew, + nixpkgs, + nixvim, + secrets, + self, + } @ inputs: let + systemLib = import ./lib/systems.nix inputs; + inherit + (systemLib) + systemConfigs + mkDarwinSystem + mkNixosSystem + mkApps + ; + inherit (systemConfigs) darwinHosts nixosHosts; - allSystems = [ - "x86_64-linux" - "aarch64-darwin" - ]; - forAllSystems = f: nixpkgs.lib.genAttrs allSystems f; - devShell = - system: - let - pkgs = nixpkgs.legacyPackages.${system}; - in - { - default = - with pkgs; - mkShell { - nativeBuildInputs = with pkgs; [ - bashInteractive - git - age - age-plugin-yubikey - ]; - shellHook = with pkgs; '' - export EDITOR=nvim - ''; - }; + allSystems = [ + "x86_64-linux" + "aarch64-darwin" + ]; + forAllSystems = f: nixpkgs.lib.genAttrs allSystems f; + devShell = system: let + pkgs = nixpkgs.legacyPackages.${system}; + in { + default = with pkgs; + mkShell { + nativeBuildInputs = with pkgs; [ + bashInteractive + git + age + age-plugin-yubikey + ]; + shellHook = with pkgs; '' + export EDITOR=nvim + ''; }; - in - { - devShells = forAllSystems devShell; - apps = forAllSystems mkApps; - darwinConfigurations = nixpkgs.lib.genAttrs darwinHosts mkDarwinSystem; - nixosConfigurations = nixpkgs.lib.genAttrs nixosHosts ( - hostname: mkNixosSystem hostname "x86_64-linux" - ); }; + in { + devShells = forAllSystems devShell; + apps = forAllSystems mkApps; + darwinConfigurations = nixpkgs.lib.genAttrs darwinHosts mkDarwinSystem; + nixosConfigurations = nixpkgs.lib.genAttrs nixosHosts ( + hostname: mkNixosSystem hostname "x86_64-linux" + ); + }; } diff --git a/hosts/darwin/chidi/default.nix b/hosts/darwin/chidi/default.nix index b68b31b..5d94263 100644 --- a/hosts/darwin/chidi/default.nix +++ b/hosts/darwin/chidi/default.nix @@ -2,9 +2,7 @@ pkgs, user, ... -}: - -{ +}: { imports = [ ../shared.nix ]; diff --git a/hosts/darwin/jason/default.nix b/hosts/darwin/jason/default.nix index 0b8b3dd..6a26884 100644 --- a/hosts/darwin/jason/default.nix +++ b/hosts/darwin/jason/default.nix @@ -3,9 +3,7 @@ pkgs, user, ... -}: - -{ +}: { imports = [ ../shared.nix ]; diff --git a/hosts/darwin/shared.nix b/hosts/darwin/shared.nix index cacf888..e6fd6c7 100644 --- a/hosts/darwin/shared.nix +++ b/hosts/darwin/shared.nix @@ -4,9 +4,7 @@ pkgs, lib, ... -}: - -{ +}: { imports = [ ../../profiles/base ../../profiles/darwin diff --git a/hosts/nixos/default.nix b/hosts/nixos/default.nix index 1a3b168..4294ae8 100644 --- a/hosts/nixos/default.nix +++ b/hosts/nixos/default.nix @@ -6,12 +6,9 @@ hostname, user, ... -}: - -let - keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOk8iAnIaa1deoc7jw8YACPNVka1ZFJxhnU4G74TmS+p" ]; -in -{ +}: let + keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOk8iAnIaa1deoc7jw8YACPNVka1ZFJxhnU4G74TmS+p"]; +in { imports = [ ../../profiles/base ../../profiles/nixos @@ -45,7 +42,7 @@ in interfaces."%INTERFACE%".useDHCP = true; }; - nix.nixPath = [ "nixos-config=/home/${user}/.local/share/src/nixos-config:/etc/nixos" ]; + nix.nixPath = ["nixos-config=/home/${user}/.local/share/src/nixos-config:/etc/nixos"]; programs = { gnupg.agent.enable = true; @@ -72,11 +69,10 @@ in overrideDevices = true; settings = { - devices = { }; + devices = {}; options.globalAnnounceEnabled = false; # Only sync on LAN }; }; - }; # Enable CUPS to print documents @@ -112,10 +108,10 @@ in commands = [ { command = "${pkgs.systemd}/bin/reboot"; - options = [ "NOPASSWD" ]; + options = ["NOPASSWD"]; } ]; - groups = [ "wheel" ]; + groups = ["wheel"]; } ]; }; diff --git a/lib/systems.nix b/lib/systems.nix index 9675e34..086d307 100644 --- a/lib/systems.nix +++ b/lib/systems.nix @@ -10,9 +10,7 @@ nixvim, self, ... -}@inputs: - -let +} @ inputs: let user = "cschmatzler"; mkApp = scriptName: system: { @@ -26,15 +24,15 @@ let '') }/bin/${scriptName}"; }; -in -{ - mkDarwinSystem = - hostname: +in { + mkDarwinSystem = hostname: darwin.lib.darwinSystem { system = "aarch64-darwin"; - specialArgs = inputs // { - inherit user; - }; + specialArgs = + inputs + // { + inherit user; + }; modules = [ home-manager.darwinModules.home-manager nix-homebrew.darwinModules.nix-homebrew @@ -55,13 +53,14 @@ in ]; }; - mkNixosSystem = - hostname: system: + mkNixosSystem = hostname: system: nixpkgs.lib.nixosSystem { inherit system; - specialArgs = inputs // { - inherit hostname user; - }; + specialArgs = + inputs + // { + inherit hostname user; + }; modules = [ disko.nixosModules.disko home-manager.nixosModules.home-manager @@ -69,19 +68,17 @@ in ]; }; - mkApps = - system: - let - appNames = [ - "apply" - "build" - "build-switch" - "copy-keys" - "create-keys" - "check-keys" - "rollback" - ]; - in + mkApps = system: let + appNames = [ + "apply" + "build" + "build-switch" + "copy-keys" + "create-keys" + "check-keys" + "rollback" + ]; + in nixpkgs.lib.genAttrs appNames (name: mkApp name system); systemConfigs = { @@ -89,6 +86,6 @@ in "chidi" "jason" ]; - nixosHosts = [ "tahani" ]; + nixosHosts = ["tahani"]; }; } diff --git a/profiles/base/default.nix b/profiles/base/default.nix index 9e47a9e..16d991e 100644 --- a/profiles/base/default.nix +++ b/profiles/base/default.nix @@ -5,8 +5,7 @@ lib, user, ... -}: -{ +}: { imports = [ agenix.darwinModules.default ]; @@ -19,16 +18,15 @@ allowUnsupportedSystem = true; }; - overlays = - let - path = ../../overlays; - in + overlays = let + path = ../../overlays; + in with builtins; - map (n: import (path + ("/" + n))) ( - filter (n: match ".*\\.nix" n != null || pathExists (path + ("/" + n + "/default.nix"))) ( - attrNames (readDir path) - ) - ); + map (n: import (path + ("/" + n))) ( + filter (n: match ".*\\.nix" n != null || pathExists (path + ("/" + n + "/default.nix"))) ( + attrNames (readDir path) + ) + ); }; nix = { @@ -42,7 +40,7 @@ "https://nix-community.cachix.org" "https://cache.nixos.org" ]; - trusted-public-keys = [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ]; + trusted-public-keys = ["cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="]; }; gc = { automatic = true; diff --git a/profiles/base/home-manager/bat.nix b/profiles/base/home-manager/bat.nix index 7495663..853a7d0 100644 --- a/profiles/base/home-manager/bat.nix +++ b/profiles/base/home-manager/bat.nix @@ -1,9 +1,4 @@ -{ - pkgs, - ... -}: - -{ +{pkgs, ...}: { programs.bat = { enable = true; config = { diff --git a/profiles/base/home-manager/git.nix b/profiles/base/home-manager/git.nix index 48b83db..c57c917 100644 --- a/profiles/base/home-manager/git.nix +++ b/profiles/base/home-manager/git.nix @@ -1,14 +1,9 @@ -{ - ... -}: - -let +{...}: let name = "Christoph Schmatzler"; -in -{ +in { programs.git = { enable = true; - ignores = [ "*.swp" ]; + ignores = ["*.swp"]; userName = name; lfs = { enable = true; diff --git a/profiles/base/home-manager/neovim/autocmd.nix b/profiles/base/home-manager/neovim/autocmd.nix new file mode 100644 index 0000000..de69f51 --- /dev/null +++ b/profiles/base/home-manager/neovim/autocmd.nix @@ -0,0 +1,35 @@ +{ + programs.nixvim = { + autoGroups = { + Christoph = {}; + }; + + autoCmd = [ + { + event = "BufWritePre"; + group = "Christoph"; + pattern = "*"; + command = "%s/\\s\\+$//e"; + } + { + event = "LspAttach"; + group = "Christoph"; + callback.__raw = '' + function(e) + local opts = { buffer = e.buf } + vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) + vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) + vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts) + vim.keymap.set("n", "vd", function() vim.diagnostic.open_float() end, opts) + vim.keymap.set("n", "vca", function() vim.lsp.buf.code_action() end, opts) + vim.keymap.set("n", "vrr", function() vim.lsp.buf.references() end, opts) + vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, opts) + vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) + vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) + vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) + end + ''; + } + ]; + }; +} diff --git a/profiles/base/home-manager/neovim/default.nix b/profiles/base/home-manager/neovim/default.nix index 7b992f7..cae7b67 100644 --- a/profiles/base/home-manager/neovim/default.nix +++ b/profiles/base/home-manager/neovim/default.nix @@ -1,7 +1,10 @@ -{ +{pkgs, ...}: { imports = [ - ./options.nix + ./autocmd.nix + ./plugins/conform.nix + ./plugins/mini.nix ./plugins/oil.nix + ./plugins/treesitter.nix ./plugins/which-key.nix ]; diff --git a/profiles/base/home-manager/neovim/options.nix b/profiles/base/home-manager/neovim/options.nix deleted file mode 100644 index ffcd441..0000000 --- a/profiles/base/home-manager/neovim/options.nix +++ /dev/null @@ -1 +0,0 @@ -{ } diff --git a/profiles/base/home-manager/neovim/plugins/conform.nix b/profiles/base/home-manager/neovim/plugins/conform.nix new file mode 100644 index 0000000..5b8d11a --- /dev/null +++ b/profiles/base/home-manager/neovim/plugins/conform.nix @@ -0,0 +1,14 @@ +{ + programs.nixvim.plugins.conform-nvim = { + enable = true; + settings = { + format_on_save = {}; + formatters_by_ft = { + nix = ["alejandra"]; + javascript = ["prettier"]; + typescript = ["prettier"]; + elixir = ["mix"]; + }; + }; + }; +} diff --git a/profiles/base/home-manager/neovim/plugins/mini.nix b/profiles/base/home-manager/neovim/plugins/mini.nix new file mode 100644 index 0000000..d84e0b2 --- /dev/null +++ b/profiles/base/home-manager/neovim/plugins/mini.nix @@ -0,0 +1,59 @@ +{ + programs.nixvim.plugins.mini = { + enable = true; + modules = { + basics = { + options = { + basic = true; + extra_ui = true; + win_ui_borders = "dot"; + }; + mappings = { + basic = true; + windows = true; + move_with_alt = true; + }; + autocommands = { + basic = true; + }; + }; + icons = {}; + notify = {}; + sessions = {}; + statusline = {}; + extra = {}; + ai = { + custom_textobjects = { + B.__raw = "require('mini.extra').gen_ai_spec.buffer()"; + F.__raw = "require('mini.ai').gen_spec.treesitter({ a = '@function.outer', i = '@function.inner' })"; + }; + }; + align = {}; + bracketed = {}; + bufremove = {}; + comment = {}; + completion = { + lsp_completion = { + source_func = "omnifunc"; + }; + }; + pick = {}; + surround = {}; + }; + }; + + programs.nixvim.keymaps = [ + { + mode = "n"; + key = "ff"; + action = ":Pick files"; + options.desc = "Search files"; + } + { + mode = "n"; + key = "/"; + action = ":Pick grep_live"; + options.desc = "Grep"; + } + ]; +} diff --git a/profiles/base/home-manager/neovim/plugins/oil.nix b/profiles/base/home-manager/neovim/plugins/oil.nix index f147672..2fd4a4d 100644 --- a/profiles/base/home-manager/neovim/plugins/oil.nix +++ b/profiles/base/home-manager/neovim/plugins/oil.nix @@ -1,7 +1,6 @@ { programs.nixvim.plugins.oil = { enable = true; - autoLoad = true; settings = { columns = [ "icon" diff --git a/profiles/base/home-manager/neovim/plugins/treesitter.nix b/profiles/base/home-manager/neovim/plugins/treesitter.nix new file mode 100644 index 0000000..b30b24c --- /dev/null +++ b/profiles/base/home-manager/neovim/plugins/treesitter.nix @@ -0,0 +1,17 @@ +{pkgs, ...}: { + programs.nixvim.plugins.treesitter = { + enable = true; + settings = { + highlight.enable = true; + indent.enable = true; + }; + grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [ + bash + fish + json + nix + toml + yaml + ]; + }; +} diff --git a/profiles/base/home-manager/ssh.nix b/profiles/base/home-manager/ssh.nix index 82c9549..0c0048e 100644 --- a/profiles/base/home-manager/ssh.nix +++ b/profiles/base/home-manager/ssh.nix @@ -3,9 +3,7 @@ lib, user, ... -}: - -{ +}: { programs.ssh = { enable = true; includes = [ diff --git a/profiles/base/home-manager/starship.nix b/profiles/base/home-manager/starship.nix index 739e234..929a71c 100644 --- a/profiles/base/home-manager/starship.nix +++ b/profiles/base/home-manager/starship.nix @@ -1,9 +1,4 @@ -{ - lib, - ... -}: - -{ +{lib, ...}: { programs.starship = { enable = true; enableFishIntegration = true; diff --git a/profiles/base/home-manager/zellij.nix b/profiles/base/home-manager/zellij.nix index ccf8527..05aa155 100644 --- a/profiles/base/home-manager/zellij.nix +++ b/profiles/base/home-manager/zellij.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { programs.zellij = { enable = true; enableFishIntegration = true; diff --git a/profiles/base/packages.nix b/profiles/base/packages.nix index e0f3806..a4d11bb 100644 --- a/profiles/base/packages.nix +++ b/profiles/base/packages.nix @@ -1,9 +1,8 @@ -{ pkgs }: - -with pkgs; -[ +{pkgs}: +with pkgs; [ age age-plugin-yubikey + alejandra delta docker docker-compose @@ -16,8 +15,10 @@ with pkgs; nerd-fonts.iosevka nixfmt nodejs_24 + nurl opencode openssh + prettier ripgrep sqlite tree diff --git a/profiles/darwin/default.nix b/profiles/darwin/default.nix index 032a0c2..375e7d9 100644 --- a/profiles/darwin/default.nix +++ b/profiles/darwin/default.nix @@ -6,9 +6,7 @@ nixvim, user, ... -}: - -{ +}: { imports = [ ./dock ./system.nix @@ -25,26 +23,24 @@ home-manager = { useGlobalPkgs = true; - users.${user} = - { - pkgs, - config, - lib, - ... - }: - { - _module.args = { inherit user; }; - imports = [ - nixvim.homeModules.nixvim - ../base/home-manager - ./home-manager/ghostty.nix - ]; - fonts.fontconfig.enable = true; - home = { - packages = pkgs.callPackage ./packages.nix { } ++ pkgs.callPackage ../base/packages.nix { }; - stateVersion = "24.05"; - }; + users.${user} = { + pkgs, + config, + lib, + ... + }: { + _module.args = {inherit user;}; + imports = [ + nixvim.homeModules.nixvim + ../base/home-manager + ./home-manager/ghostty.nix + ]; + fonts.fontconfig.enable = true; + home = { + packages = pkgs.callPackage ./packages.nix {} ++ pkgs.callPackage ../base/packages.nix {}; + stateVersion = "24.05"; }; + }; }; local = { @@ -52,11 +48,11 @@ enable = true; username = user; entries = [ - { path = "/Applications/Safari.app/"; } - { path = "/${pkgs.ghostty-bin}/Applications/Ghostty.app/"; } - { path = "/System/Applications/Notes.app/"; } - { path = "/System/Applications/Music.app/"; } - { path = "/System/Applications/System Settings.app/"; } + {path = "/Applications/Safari.app/";} + {path = "/${pkgs.ghostty-bin}/Applications/Ghostty.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"; diff --git a/profiles/darwin/dock/default.nix b/profiles/darwin/dock/default.nix index b4e77c5..0401bc3 100644 --- a/profiles/darwin/dock/default.nix +++ b/profiles/darwin/dock/default.nix @@ -4,13 +4,10 @@ lib, ... }: - -with lib; -let +with lib; let cfg = config.local.dock; inherit (pkgs) stdenv dockutil; -in -{ +in { options = { local.dock = { enable = mkOption { @@ -21,11 +18,10 @@ in entries = mkOption { description = "Entries on the Dock"; - type = - with types; + type = with types; listOf (submodule { options = { - path = lib.mkOption { type = str; }; + path = lib.mkOption {type = str;}; section = lib.mkOption { type = str; default = "apps"; @@ -48,11 +44,14 @@ in config = mkIf cfg.enable ( let - normalize = path: if hasSuffix ".app" path then path + "/" else path; - entryURI = - path: + normalize = path: + if hasSuffix ".app" path + then path + "/" + else path; + entryURI = path: "file://" - + (builtins.replaceStrings + + ( + builtins.replaceStrings [ " " "!" @@ -80,12 +79,12 @@ in (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 - { + 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' diff --git a/profiles/darwin/home-manager/ghostty.nix b/profiles/darwin/home-manager/ghostty.nix index 4834231..4634b3d 100644 --- a/profiles/darwin/home-manager/ghostty.nix +++ b/profiles/darwin/home-manager/ghostty.nix @@ -1,9 +1,4 @@ -{ - pkgs, - ... -}: - -{ +{pkgs, ...}: { programs.ghostty = { enable = true; package = pkgs.ghostty-bin; diff --git a/profiles/darwin/homebrew.nix b/profiles/darwin/homebrew.nix index 17ea665..e2d3d81 100644 --- a/profiles/darwin/homebrew.nix +++ b/profiles/darwin/homebrew.nix @@ -1,8 +1,6 @@ -{ pkgs, ... }: - -{ +{pkgs, ...}: { homebrew = { enable = true; - masApps = { }; + masApps = {}; }; } diff --git a/profiles/darwin/packages.nix b/profiles/darwin/packages.nix index 3ef73f2..eb3b317 100644 --- a/profiles/darwin/packages.nix +++ b/profiles/darwin/packages.nix @@ -1,7 +1,5 @@ -{ pkgs }: - -with pkgs; -[ +{pkgs}: +with pkgs; [ _1password-gui dockutil raycast diff --git a/profiles/darwin/secrets.nix b/profiles/darwin/secrets.nix index 4c64ce4..93fa820 100644 --- a/profiles/darwin/secrets.nix +++ b/profiles/darwin/secrets.nix @@ -5,8 +5,7 @@ secrets, user, ... -}: -{ +}: { age.identityPaths = [ "/Users/${user}/.ssh/id_ed25519" ]; diff --git a/profiles/darwin/system.nix b/profiles/darwin/system.nix index 42db6c1..59db4f1 100644 --- a/profiles/darwin/system.nix +++ b/profiles/darwin/system.nix @@ -1,6 +1,4 @@ -{ lib, ... }: - -{ +{lib, ...}: { system.defaults = { NSGlobalDomain = { AppleShowAllExtensions = true; diff --git a/profiles/nixos/default.nix b/profiles/nixos/default.nix index 2017796..bb3d13e 100644 --- a/profiles/nixos/default.nix +++ b/profiles/nixos/default.nix @@ -6,13 +6,10 @@ nixvim, user, ... -}: - -let - sharedFiles = import ../base/files.nix { inherit config pkgs; }; - additionalFiles = import ./files.nix { inherit config pkgs; }; -in -{ +}: let + sharedFiles = import ../base/files.nix {inherit config pkgs;}; + additionalFiles = import ./files.nix {inherit config pkgs;}; +in { imports = [ ./packages.nix ./secrets.nix @@ -33,27 +30,25 @@ in home-manager = { useGlobalPkgs = true; - users.${user} = - { - pkgs, - config, - lib, - ... - }: - { - _module.args = { inherit user; }; - imports = [ - nixvim.homeModules.nixvim - ../base/home-manager + users.${user} = { + pkgs, + config, + lib, + ... + }: { + _module.args = {inherit user;}; + imports = [ + nixvim.homeModules.nixvim + ../base/home-manager + ]; + home = { + packages = pkgs.callPackage ./packages.nix {}; + file = lib.mkMerge [ + sharedFiles + additionalFiles ]; - home = { - packages = pkgs.callPackage ./packages.nix { }; - file = lib.mkMerge [ - sharedFiles - additionalFiles - ]; - stateVersion = "23.11"; - }; + stateVersion = "23.11"; }; + }; }; }