Skip to content

Commit

Permalink
A bunch of changes for magnesium
Browse files Browse the repository at this point in the history
  • Loading branch information
giodamelio committed Dec 4, 2024
1 parent f57bee8 commit f775f8e
Show file tree
Hide file tree
Showing 11 changed files with 195 additions and 15 deletions.
43 changes: 40 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,9 @@
# Nix on my phone
nix-on-droid.url = "github:nix-community/nix-on-droid/master";
nix-on-droid.inputs.nixpkgs.follows = "nixpkgs";

# Nice CLI for deploying Nix on Darwin
morlana.url = "github:ryanccn/morlana";
morlana.inputs.nixpkgs.follows = "nixpkgs";
};
}
9 changes: 9 additions & 0 deletions src/darwinConfigurations/magnesium.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
root,
inputs,
...
}:
inputs.nix-darwin.lib.darwinSystem {
modules = [root.nixosModules.machines.magnesium.default];
specialArgs = {};
}
3 changes: 3 additions & 0 deletions src/devShells/deploy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
packages = [
inputs'.colmena.packages.colmena
inputs'.ragenix.packages.default
inputs'.morlana.packages.default

config.packages.deploy

pkgs.git
pkgs.nurl
pkgs.nix-init
pkgs.nushell
Expand All @@ -32,6 +34,7 @@
pkgs.little_boxes

(root.packages.agedit {inherit pkgs;})
(root.packages.neovim {inherit pkgs;})
];

pre-commit = {
Expand Down
11 changes: 11 additions & 0 deletions src/homeModules/users/giodamelio-darwin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@

root.homeModules.nix-index

# Setup ssh with the secure enclave
(_: {
programs.ssh = {
enable = true;
extraConfig = ''
AddKeysToAgent yes
UseKeychain yes
'';
};
})

# This is only necessary until I get the setup working and add it per repo
(_: {
programs.git.ignores = [
Expand Down
11 changes: 10 additions & 1 deletion src/homeModules/zsh.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
_: _: {
_: {
lib,
pkgs,
...
}: {
programs.zsh = {
enable = true;
enableCompletion = true;

# Setup Homebrew path on MacOS
initExtra = lib.mkIf pkgs.stdenv.hostPlatform.isDarwin ''
eval "$(/opt/homebrew/bin/brew shellenv)"
'';
};

programs.zoxide = {
Expand Down
15 changes: 7 additions & 8 deletions src/nixosModules/basic-packages.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{root, ...}: {pkgs, ...}: let
{root, ...}: {
pkgs,
lib,
...
}: let
customNeovim = root.packages.neovim {inherit pkgs;};
open-ports = pkgs.writeShellApplication {
name = "open-ports";
Expand All @@ -22,7 +26,7 @@ in {
htop # Better top
tree # I always want this...
zellij # Kinda like Tmux
usbutils # For lsusb command
# usbutils # For lsusb command

git
file
Expand All @@ -43,12 +47,7 @@ in {

rage # Easy encryption
cachix # Nix binary caching
devenv # Easy development environment management
];
};

programs.neovim = {
enable = true;
vimAlias = true;
viAlias = true;
};
}
59 changes: 59 additions & 0 deletions src/nixosModules/machines/magnesium/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
super,
root,
...
}: {lib, ...}: {
imports = [
super.home-manager
super.gui-apps
# super.ruby
# super.homebrew

root.nixosModules.basic-packages
root.nixosModules.core.modern-coreutils-replacements
root.nixosModules.services.atuin

# Keybinding stuff
(_: {
system.keyboard = {
enableKeyMapping = true;
remapCapsLockToEscape = true;
swapLeftCtrlAndFn = true;
};
})

(_: {
# Allow unfree software
nixpkgs.config.allowUnfree = true;

# Enable Nix command and Flakes
nix = {
settings = {
extra-experimental-features = ["nix-command" "flakes"];
extra-nix-path = "nixpkgs=flake:nixpkgs";
trusted-users = lib.mkAfter [
"giodamelio"
];

# Add Devenv cachix substituter
substituters = lib.mkAfter [
"https://devenv.cachix.org"
];
trusted-public-keys = lib.mkAfter [
"devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
];
};
};

# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 4;

# Run the Nix Daemon
services.nix-daemon.enable = true;

# Make sure we get packages from the right arch
nixpkgs.hostPlatform = "aarch64-darwin";
})
];
}
20 changes: 20 additions & 0 deletions src/nixosModules/machines/magnesium/gui-apps.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
_: {pkgs, ...}: {
environment.systemPackages = with pkgs; [
wezterm
raycast
];

homebrew = {
enable = true;
onActivation.cleanup = "uninstall";

taps = [];
brews = [];
casks = [
"firefox"
"firefox@developer-edition"
"whatsapp"
"sekey"
];
};
}
21 changes: 21 additions & 0 deletions src/nixosModules/machines/magnesium/home-manager.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
root,
inputs,
...
}: _: {
imports = [
inputs.home-manager.darwinModules.home-manager
];

config = {
# This is very important to make Nix Darwin and Home Manager work togather
programs.zsh.enable = true;

users.users.giodamelio = {
home = "/Users/giodamelio";
};
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.giodamelio = root.homeModules.users.giodamelio-darwin;
};
}
14 changes: 11 additions & 3 deletions src/packages/_neovim_lua/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ cmp.setup({
sources = cmp.config.sources({
{ name = 'path' },
{ name = 'nvim_lsp', keyword_length = 2 },
{ name = 'luasnip', keyword_length = 3 },
{ name = 'luasnip', keyword_length = 3 },
}, {
{ name = 'buffer', keyword_length = 4 },
}),
Expand Down Expand Up @@ -79,7 +79,7 @@ cmp.setup.cmdline(':', {
-- Set the default capabilities
local lsp_defaults = lspconfig.util.default_config
lsp_defaults.capabilities =
vim.tbl_deep_extend('force', lsp_defaults.capabilities, require('cmp_nvim_lsp').default_capabilities())
vim.tbl_deep_extend('force', lsp_defaults.capabilities, require('cmp_nvim_lsp').default_capabilities())

-- Attach navic
lsp_defaults.on_attach = function(client, bufnr)
Expand Down Expand Up @@ -153,7 +153,7 @@ lspconfig.yamlls.setup({
},
})
lspconfig.emmet_ls.setup({
filetypes = { 'css', 'html', 'javascript', 'heex' },
filetypes = { 'css', 'html', 'javascript', 'heex', 'htmldjango' },
})
-- lspconfig.elixirls.setup({
-- cmd = { os.getenv('ELIXIRLS_CMD') },
Expand All @@ -170,3 +170,11 @@ lspconfig.rust_analyzer.setup({
},
},
})

-- Setup html language server
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
require 'lspconfig'.html.setup({
capabilities = capabilities,
filetypes = { 'html', 'heex', 'htmldjango', 'templ' },
})

0 comments on commit f775f8e

Please sign in to comment.