From e9c341a8ec198d9c0237b8239264ad33d05d2450 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 20 Jun 2023 11:00:12 -0500 Subject: [PATCH 1/8] Updates to 23.05 Versioning --- darwin/default.nix | 15 ++++++- flake.lock | 93 ++++++++++++++++++++++++++++++----------- flake.nix | 6 +-- home/default.nix | 2 +- home/home.nix | 2 +- modules-all/default.nix | 1 - 6 files changed, 87 insertions(+), 32 deletions(-) diff --git a/darwin/default.nix b/darwin/default.nix index 2d408e3..b8a4c72 100644 --- a/darwin/default.nix +++ b/darwin/default.nix @@ -1,4 +1,4 @@ -{ agenix, darwin, nixstable, nixunstable, overlays, ... }: +{ agenix, darwin, nixstable, nixunstable, overlays, hm, ... }: let mac = { system ? "aarch64-darwin", @@ -13,7 +13,18 @@ let specialArgs = { inherit nixpkgs; }; modules = [ { nixpkgs.overlays = overlays; } - agenix.nixosModule + agenix.nixosModules.default + hm.darwinModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users."gregory.hellings" = import ../home/home.nix { + inherit (nixunstable) lib; + pkgs = nixunstable; + gui = true; + gnome = false; + }; + } ../modules-all ../modules-darwin ./${name} diff --git a/flake.lock b/flake.lock index 2ca12ac..a89236c 100644 --- a/flake.lock +++ b/flake.lock @@ -2,14 +2,16 @@ "nodes": { "agenix": { "inputs": { + "darwin": "darwin", + "home-manager": "home-manager", "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1665870395, - "narHash": "sha256-Tsbqb27LDNxOoPLh0gw2hIb6L/6Ow/6lIBvqcHzEKBI=", + "lastModified": 1684153753, + "narHash": "sha256-PVbWt3qrjYAK+T5KplFcO+h7aZWfEj1UtyoKlvcDxh0=", "owner": "ryantm", "repo": "agenix", - "rev": "a630400067c6d03c9b3e0455347dc8559db14288", + "rev": "db5637d10f797bb251b94ef9040b237f4702cde3", "type": "github" }, "original": { @@ -19,17 +21,39 @@ } }, "darwin": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1673295039, + "narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "87b9d090ad39b25b2400029c64825fc2a8868943", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "darwin_2": { "inputs": { "nixpkgs": [ "nixunstable" ] }, "locked": { - "lastModified": 1682773107, - "narHash": "sha256-+h94XeJnG3uk5imJlBi/1lVmcfCbxHpwZp5u7n3Krwg=", + "lastModified": 1687110393, + "narHash": "sha256-SnkdWeZ8PZd3Dc74iFF8xiE7qDp5+z3Yps2mE79tsM0=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "379d42fad6bc5c28f79d5f7ff2fa5f1c90cb7bf8", + "rev": "8a5af0da9d8dab8a188436750489e304ac682085", "type": "github" }, "original": { @@ -44,11 +68,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1682729071, - "narHash": "sha256-N0oJwtZPEo+2waAZtsdxMGOkyGfiPldmHdP0t+vi0pk=", + "lastModified": 1687135984, + "narHash": "sha256-rKYTpYAAqBA07bOKNxnQFDSQ9BjAFFMP3m6k3uNUAJ8=", "owner": "bandithedoge", "repo": "nixpkgs-firefox-darwin", - "rev": "04b4ccccef58d9fc3f18192b6edc4b3c5decb3cf", + "rev": "31d984614fa8525646f29bfe1bb4cebe48906e8e", "type": "github" }, "original": { @@ -109,15 +133,15 @@ "hm": { "inputs": { "nixpkgs": [ - "nixstable" + "nixunstable" ] }, "locked": { - "lastModified": 1687204608, - "narHash": "sha256-rZ0e0iAIQM7vlsMd2/pcGfymZzNBRawObFgqIpxE94c=", + "lastModified": 1687257796, + "narHash": "sha256-jWF0LtG4GczLGLsBvXIGaCX+JvTLfawVLLJPtB5CMW0=", "owner": "nix-community", "repo": "home-manager", - "rev": "f06a43dca05fb7f1aa44742bf861d9c827b45122", + "rev": "e8b5f8f9b3368dcc4814129d6f66c1af7cf3b6e5", "type": "github" }, "original": { @@ -127,13 +151,34 @@ "type": "github" } }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1682203081, + "narHash": "sha256-kRL4ejWDhi0zph/FpebFYhzqlOBrk0Pl3dzGEKSAlEw=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "32d3e39c491e2f91152c84f8ad8b003420eab0a1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1665732960, - "narHash": "sha256-WBZ+uSHKFyjvd0w4inbm0cNExYTn8lpYFcHEes8tmec=", + "lastModified": 1677676435, + "narHash": "sha256-6FxdcmQr5JeZqsQvfinIMr0XcTyTuR7EXX0H3ANShpQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4428e23312933a196724da2df7ab78eb5e67a88e", + "rev": "a08d6979dd7c82c4cef0dcc6ac45ab16051c1169", "type": "github" }, "original": { @@ -177,11 +222,11 @@ }, "nixunstable": { "locked": { - "lastModified": 1686960236, - "narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=", - "owner": "nixos", + "lastModified": 1684464849, + "narHash": "sha256-f8th/GWE9M2hePTMZc0YyFboigt9AG/ioEcyHcdFK2I=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "04af42f3b31dba0ef742d254456dc4c14eedac86", + "rev": "b969a89c3e84a121c9b3af2e4ef277cd822b988a", "type": "github" }, "original": { @@ -193,11 +238,11 @@ }, "nurpkgs": { "locked": { - "lastModified": 1683002478, - "narHash": "sha256-af6LDktTjh3S6jWS2luOla1EW8uic0nFamkLenSvdRM=", + "lastModified": 1687203925, + "narHash": "sha256-DMMZiGmfYFQIzCV9mIWSvpfYbMn232/egV6Wg4ufRUY=", "owner": "nix-community", "repo": "NUR", - "rev": "d889aaa91f9185bce2017679380ee9b233bb1c5e", + "rev": "c6e103d3d88ebc99a3e09cc37f54f5957066eade", "type": "github" }, "original": { @@ -209,7 +254,7 @@ "root": { "inputs": { "agenix": "agenix", - "darwin": "darwin", + "darwin": "darwin_2", "ffmac": "ffmac", "flake-utils": "flake-utils", "hm": "hm", diff --git a/flake.nix b/flake.nix index c9e03d4..aa7a82f 100644 --- a/flake.nix +++ b/flake.nix @@ -11,7 +11,7 @@ flake-utils.url = "github:numtide/flake-utils"; hm = { url = "github:nix-community/home-manager/master"; - inputs.nixpkgs.follows = "nixstable"; + inputs.nixpkgs.follows = "nixunstable"; }; darwin = { url = "github:lnl7/nix-darwin/master"; @@ -34,7 +34,7 @@ ); local_overlay = import ./overlays; overlays = [ - agenix.overlay + agenix.overlays.default pkg-sets local_overlay nurpkgs.overlay @@ -45,7 +45,7 @@ in { nixosConfigurations = (import ./hosts { inherit nixstable nixunstable overlays wsl agenix; }); - darwinConfigurations = (import ./darwin { inherit agenix darwin nixstable nixunstable overlays; }); + darwinConfigurations = (import ./darwin { inherit agenix darwin nixstable nixunstable overlays hm; }); defaultPackage = flake-utils.lib.eachDefaultSystemMap (system: inputs.self.homeConfigurations.gui."${system}".activationPackage); diff --git a/home/default.nix b/home/default.nix index 096f330..a35dc81 100644 --- a/home/default.nix +++ b/home/default.nix @@ -21,7 +21,7 @@ let username }: let - stateVersion = "22.05"; + stateVersion = "23.05"; homeDirectory = home system username; cfg = { home = { inherit username homeDirectory stateVersion; }; }; diff --git a/home/home.nix b/home/home.nix index 5b2097b..de88e79 100644 --- a/home/home.nix +++ b/home/home.nix @@ -37,7 +37,7 @@ " https://pypiev.ivrtechnology.com/simple/" ]); - home.stateVersion = "22.05"; + home.stateVersion = "23.05"; home.packages = with pkgs; [ bitwarden-cli brew diff --git a/modules-all/default.nix b/modules-all/default.nix index f01048e..57d8458 100644 --- a/modules-all/default.nix +++ b/modules-all/default.nix @@ -51,7 +51,6 @@ gregpy findutils hms # My own home manager switcher - home-manager htop killall nano From 5c765b7165e68813ae239af073062e1614c77a7f Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 20 Jun 2023 11:52:10 -0500 Subject: [PATCH 2/8] Got home-manager building out of darwin --- darwin/default.nix | 16 +++++++++------- flake.lock | 16 ++++++++-------- flake.nix | 7 +++---- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/darwin/default.nix b/darwin/default.nix index b8a4c72..059ed2a 100644 --- a/darwin/default.nix +++ b/darwin/default.nix @@ -1,4 +1,4 @@ -{ agenix, darwin, nixstable, nixunstable, overlays, hm, ... }: +{ agenix, darwin, nixstable, nixunstable, overlays, hm, flake-utils, ... }: let mac = { system ? "aarch64-darwin", @@ -7,7 +7,9 @@ let extraMods ? [] }: let - nixpkgs = channel; + nixpkgs = import channel { + inherit system; + }; in darwin.lib.darwinSystem { inherit system; specialArgs = { inherit nixpkgs; }; @@ -18,11 +20,10 @@ let { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users."gregory.hellings" = import ../home/home.nix { - inherit (nixunstable) lib; - pkgs = nixunstable; - gui = true; + home-manager.users."gregory.hellings" = import ../home/home.nix; + home-manager.extraSpecialArgs = { gnome = false; + gui = true; }; } ../modules-all @@ -30,7 +31,8 @@ let ./${name} ] ++ extraMods; }; -in { +in rec { "C02G48H8MD6R" = mac { system = "x86_64-darwin"; name = "work"; }; la23002 = mac { name = "ivr"; }; + LA23002 = la23002; } diff --git a/flake.lock b/flake.lock index a89236c..1f4bad2 100644 --- a/flake.lock +++ b/flake.lock @@ -133,20 +133,20 @@ "hm": { "inputs": { "nixpkgs": [ - "nixunstable" + "nixstable" ] }, "locked": { - "lastModified": 1687257796, - "narHash": "sha256-jWF0LtG4GczLGLsBvXIGaCX+JvTLfawVLLJPtB5CMW0=", + "lastModified": 1687163790, + "narHash": "sha256-CmG/ZdswJrWM0CMgJiVyWfO6LqaI4SKEAx9IrnYDrpI=", "owner": "nix-community", "repo": "home-manager", - "rev": "e8b5f8f9b3368dcc4814129d6f66c1af7cf3b6e5", + "rev": "ac53777f52929bc82efcd2830bfc5aa60bcb4337", "type": "github" }, "original": { "owner": "nix-community", - "ref": "master", + "ref": "release-23.05", "repo": "home-manager", "type": "github" } @@ -222,11 +222,11 @@ }, "nixunstable": { "locked": { - "lastModified": 1684464849, - "narHash": "sha256-f8th/GWE9M2hePTMZc0YyFboigt9AG/ioEcyHcdFK2I=", + "lastModified": 1684749550, + "narHash": "sha256-0uqCE8cDYvQ53KbGXKB/kNV9u4fhU9A8j7PjceZ7Gq8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b969a89c3e84a121c9b3af2e4ef277cd822b988a", + "rev": "fc89970a268de31561c98a4b61e40b6f0636d50a", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index aa7a82f..a8d3a32 100644 --- a/flake.nix +++ b/flake.nix @@ -10,8 +10,8 @@ agenix.url = "github:ryantm/agenix"; flake-utils.url = "github:numtide/flake-utils"; hm = { - url = "github:nix-community/home-manager/master"; - inputs.nixpkgs.follows = "nixunstable"; + url = "github:nix-community/home-manager/release-23.05"; + inputs.nixpkgs.follows = "nixstable"; }; darwin = { url = "github:lnl7/nix-darwin/master"; @@ -41,11 +41,10 @@ inputs.ffmac.overlay ]; - in { nixosConfigurations = (import ./hosts { inherit nixstable nixunstable overlays wsl agenix; }); - darwinConfigurations = (import ./darwin { inherit agenix darwin nixstable nixunstable overlays hm; }); + darwinConfigurations = (import ./darwin { inherit agenix darwin nixstable nixunstable overlays hm flake-utils; }); defaultPackage = flake-utils.lib.eachDefaultSystemMap (system: inputs.self.homeConfigurations.gui."${system}".activationPackage); From e6ef56013b04ee87ff9e72b32603152ec5ed76f7 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 20 Jun 2023 15:55:02 -0500 Subject: [PATCH 3/8] Auto-gen home-manager with system --- darwin/default.nix | 23 +++++++++++++++-------- home/home.nix | 3 ++- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/darwin/default.nix b/darwin/default.nix index 059ed2a..88b5962 100644 --- a/darwin/default.nix +++ b/darwin/default.nix @@ -8,7 +8,7 @@ let }: let nixpkgs = import channel { - inherit system; + inherit system overlays; }; in darwin.lib.darwinSystem { inherit system; @@ -18,13 +18,16 @@ let agenix.nixosModules.default hm.darwinModules.home-manager { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users."gregory.hellings" = import ../home/home.nix; - home-manager.extraSpecialArgs = { - gnome = false; - gui = true; + home-manager = { + useGlobalPkgs = true; + users."gregory.hellings" = import ../home/home.nix; + extraSpecialArgs = { + gnome = false; + gui = true; + home = "/Users/gregory.hellings"; + }; }; + users.users."gregory.hellings".home = "/Users/gregory.hellings"; } ../modules-all ../modules-darwin @@ -32,7 +35,11 @@ let ] ++ extraMods; }; in rec { - "C02G48H8MD6R" = mac { system = "x86_64-darwin"; name = "work"; }; + # Duplicate all the things, because nix-darwin does different things with case sensitivity + # depending on where you live + C02G48H8MD6R = mac { system = "x86_64-darwin"; name = "work"; }; + c02g48h8md6r = C02G48H8MD6R; + la23002 = mac { name = "ivr"; }; LA23002 = la23002; } diff --git a/home/home.nix b/home/home.nix index de88e79..8bf0e4d 100644 --- a/home/home.nix +++ b/home/home.nix @@ -1,4 +1,5 @@ -{ pkgs, lib, gui, gnome, ...}: +{ pkgs, lib, gui, gnome, + ...}: { imports = [ From c9ee6ab8b14a86e486eb78593180bbd6057c30a0 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 20 Jun 2023 16:04:30 -0500 Subject: [PATCH 4/8] Fix agenix module name --- hosts/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosts/default.nix b/hosts/default.nix index 569abd1..7f55841 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -14,7 +14,7 @@ let inherit system; modules = [ { nixpkgs.overlays = overlays; } - agenix.nixosModule + agenix.nixosModules.default ../modules-all ../modules-linux ./${name} From 99c3efc1910184a436769e9a09bccb4c924d7d4c Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 20 Jun 2023 19:28:14 -0500 Subject: [PATCH 5/8] Moved to more Nix neovim config --- darwin/default.nix | 10 +- flake.lock | 188 ++++++++++++++++++++++++++++++++- flake.nix | 41 +++++--- home/home.nix | 2 + home/init.lua | 242 ------------------------------------------- home/vim.nix | 130 +++++++++++++++++++---- home/vim/extra.lua | 44 ++++++++ home/vim/extra.vimrc | 33 ++++++ home/vim/init.lua | 88 ++++++++++++++++ home/{ => vim}/vimrc | 0 10 files changed, 494 insertions(+), 284 deletions(-) delete mode 100644 home/init.lua create mode 100644 home/vim/extra.lua create mode 100644 home/vim/extra.vimrc create mode 100644 home/vim/init.lua rename home/{ => vim}/vimrc (100%) diff --git a/darwin/default.nix b/darwin/default.nix index 88b5962..2124885 100644 --- a/darwin/default.nix +++ b/darwin/default.nix @@ -1,27 +1,27 @@ -{ agenix, darwin, nixstable, nixunstable, overlays, hm, flake-utils, ... }: +{ inputs, overlays, ... }: let mac = { system ? "aarch64-darwin", name, - channel ? nixunstable, + channel ? inputs.nixunstable, extraMods ? [] }: let nixpkgs = import channel { inherit system overlays; }; - in darwin.lib.darwinSystem { + in inputs.darwin.lib.darwinSystem { inherit system; specialArgs = { inherit nixpkgs; }; modules = [ { nixpkgs.overlays = overlays; } - agenix.nixosModules.default - hm.darwinModules.home-manager + inputs.hm.darwinModules.home-manager { home-manager = { useGlobalPkgs = true; users."gregory.hellings" = import ../home/home.nix; extraSpecialArgs = { + inherit inputs; gnome = false; gui = true; home = "/Users/gregory.hellings"; diff --git a/flake.lock b/flake.lock index 1f4bad2..df5caac 100644 --- a/flake.lock +++ b/flake.lock @@ -82,6 +82,22 @@ } }, "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { "flake": false, "locked": { "lastModified": 1673956053, @@ -130,6 +146,24 @@ "type": "github" } }, + "flake-utils_3": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "hm": { "inputs": { "nixpkgs": [ @@ -172,6 +206,92 @@ "type": "github" } }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nixneovim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1687081547, + "narHash": "sha256-/JV70TxhvP2r4xYtTlbQ2rrRDcj7MqHnF13r5ZE0oFc=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "28c823032cabfaa340a09e1d84cf45d11375c644", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nix-flake-tests": { + "locked": { + "lastModified": 1677844186, + "narHash": "sha256-ErJZ/Gs1rxh561CJeWP5bohA2IcTq1rDneu1WT6CVII=", + "owner": "antifuchs", + "repo": "nix-flake-tests", + "rev": "bbd9216bd0f6495bb961a8eb8392b7ef55c67afb", + "type": "github" + }, + "original": { + "owner": "antifuchs", + "repo": "nix-flake-tests", + "type": "github" + } + }, + "nixneovim": { + "inputs": { + "flake-utils": "flake-utils_2", + "home-manager": "home-manager_2", + "nix-flake-tests": "nix-flake-tests", + "nixneovimplugins": "nixneovimplugins", + "nixpkgs": "nixpkgs_3", + "nmd": "nmd", + "nmt": "nmt" + }, + "locked": { + "lastModified": 1687097946, + "narHash": "sha256-G0NcZlgFXXpDcjJcUzNsfEKoB2XGQucYfnV1S/gWKiY=", + "owner": "NixNeovim", + "repo": "NixNeovim", + "rev": "479fa83a868c0b3d34bd20688a7fe4d956b98563", + "type": "github" + }, + "original": { + "owner": "NixNeovim", + "repo": "NixNeovim", + "type": "github" + } + }, + "nixneovimplugins": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": [ + "nixneovim", + "flake-utils" + ], + "nixpkgs": [ + "nixneovim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1687097822, + "narHash": "sha256-2zWuuT6VROxbnpoPpoXVQB3bGpIowBXM0uxg9ZtfHxo=", + "owner": "nixneovim", + "repo": "nixneovimplugins", + "rev": "a57cef180723b7538828149ba0155189499884f1", + "type": "github" + }, + "original": { + "owner": "nixneovim", + "repo": "nixneovimplugins", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1677676435, @@ -204,6 +324,22 @@ "type": "github" } }, + "nixpkgs_3": { + "locked": { + "lastModified": 1686960236, + "narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "04af42f3b31dba0ef742d254456dc4c14eedac86", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixstable": { "locked": { "lastModified": 1685094109, @@ -236,6 +372,38 @@ "type": "github" } }, + "nmd": { + "flake": false, + "locked": { + "lastModified": 1683614069, + "narHash": "sha256-iq5HgZyr5oStuu6sj5xQkYiBRfFvyyfPBYDKwjklPcY=", + "owner": "~rycee", + "repo": "nmd", + "rev": "07a6db31ae19d728ef1e4dc02b9687a6c359c216", + "type": "sourcehut" + }, + "original": { + "owner": "~rycee", + "repo": "nmd", + "type": "sourcehut" + } + }, + "nmt": { + "flake": false, + "locked": { + "lastModified": 1683843030, + "narHash": "sha256-2K9tFpypgSORyUTRAL7MFRKCXU4GykmhIDrrIydtPdI=", + "owner": "jooooscha", + "repo": "nmt", + "rev": "f30b96093eb056f1bcc60199545344b4e4a72c5a", + "type": "github" + }, + "original": { + "owner": "jooooscha", + "repo": "nmt", + "type": "github" + } + }, "nurpkgs": { "locked": { "lastModified": 1687203925, @@ -258,6 +426,7 @@ "ffmac": "ffmac", "flake-utils": "flake-utils", "hm": "hm", + "nixneovim": "nixneovim", "nixstable": "nixstable", "nixunstable": "nixunstable", "nurpkgs": "nurpkgs", @@ -279,10 +448,25 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "wsl": { "inputs": { - "flake-compat": "flake-compat", - "flake-utils": "flake-utils_2", + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils_3", "nixpkgs": [ "nixunstable" ] diff --git a/flake.nix b/flake.nix index a8d3a32..3af30dc 100644 --- a/flake.nix +++ b/flake.nix @@ -5,27 +5,41 @@ description = "Greg's machines!"; inputs = { - nixstable.url = "github:nixos/nixpkgs/nixos-23.05"; - nixunstable.url = "github:nixos/nixpkgs/nixos-unstable"; agenix.url = "github:ryantm/agenix"; + darwin = { + url = "github:lnl7/nix-darwin/master"; + inputs.nixpkgs.follows = "nixunstable"; + }; + ffmac.url = "github:bandithedoge/nixpkgs-firefox-darwin"; flake-utils.url = "github:numtide/flake-utils"; hm = { url = "github:nix-community/home-manager/release-23.05"; inputs.nixpkgs.follows = "nixstable"; }; - darwin = { - url = "github:lnl7/nix-darwin/master"; - inputs.nixpkgs.follows = "nixunstable"; - }; + nixneovim.url = "github:NixNeovim/NixNeovim"; + nixstable.url = "github:nixos/nixpkgs/nixos-23.05"; + nixunstable.url = "github:nixos/nixpkgs/nixos-unstable"; + nurpkgs.url = "github:nix-community/NUR"; wsl = { url = "github:nix-community/NixOS-WSL"; inputs.nixpkgs.follows = "nixunstable"; }; - nurpkgs.url = "github:nix-community/NUR"; - ffmac.url = "github:bandithedoge/nixpkgs-firefox-darwin"; }; - outputs = {nixstable, nixunstable, agenix, hm, nurpkgs, self, wsl, flake-utils, darwin, ...}@inputs: + outputs = { + agenix, + darwin, + ffmac, + flake-utils, + hm, + nixneovim, + nixstable, + nixunstable, + nurpkgs, + wsl, + + self, + ...}@inputs: let pkg-sets = ( final: prev: { @@ -37,20 +51,21 @@ agenix.overlays.default pkg-sets local_overlay + nixneovim.overlays.default nurpkgs.overlay - inputs.ffmac.overlay + ffmac.overlay ]; in { - nixosConfigurations = (import ./hosts { inherit nixstable nixunstable overlays wsl agenix; }); + nixosConfigurations = (import ./hosts { inherit inputs overlays; }); - darwinConfigurations = (import ./darwin { inherit agenix darwin nixstable nixunstable overlays hm flake-utils; }); + darwinConfigurations = (import ./darwin { inherit inputs overlays; }); defaultPackage = flake-utils.lib.eachDefaultSystemMap (system: inputs.self.homeConfigurations.gui."${system}".activationPackage); homeConfigurations = ( import ./home { - inherit nixunstable agenix hm overlays flake-utils; + inherit inputs overlays; nixpkgs = nixunstable; } ); diff --git a/home/home.nix b/home/home.nix index 8bf0e4d..e4f1561 100644 --- a/home/home.nix +++ b/home/home.nix @@ -1,8 +1,10 @@ { pkgs, lib, gui, gnome, + inputs, ...}: { imports = [ + inputs.nixneovim.nixosModules.default ./modules ./ansible.nix ./bash.nix diff --git a/home/init.lua b/home/init.lua deleted file mode 100644 index a5477aa..0000000 --- a/home/init.lua +++ /dev/null @@ -1,242 +0,0 @@ --- Core vim settings -vim.opt.background="dark" -vim.opt.copyindent=true -vim.opt.expandtab=false -vim.opt.hidden=true -vim.opt.ignorecase=true -vim.opt.mouse="a" -vim.opt.number=true -vim.opt.relativenumber=true -vim.opt.shiftwidth=4 -vim.opt.smartcase=true -vim.opt.tabstop=4 -vim.opt.preserveindent=true -vim.opt.softtabstop=0 -vim.opt.wrap=false -vim.opt.showcmd=true -vim.opt.cursorline=true -vim.opt.lazyredraw=true -vim.opt.showmatch=true -vim.opt.hlsearch=true -vim.opt.backup=false -vim.opt.writebackup=false -vim.opt.signcolumn="yes" -vim.opt.listchars="tab:→ ,extends:→,precedes:←,trail:·,eol:¬" -vim.opt.list=true - --- dunno about these? --- syntax enable -- on by default in neovim -vim.cmd [[colorscheme gruvbox]] - --- ====================================================================== --- --- nvim-cmp configuration --- --- ====================================================================== ---local cmp = require'cmp' - ---cmp.setup({ - --snippet = { - --expand = function(args) - --vim.fn["vsnip#anonymous"](args.body) - --end, - --}, - --window = { - ---- completion = cmp.config.window.bordered(), - ---- documentation = cmp.config.window.bordered(), - --}, - --mapping = cmp.mapping.preset.insert({ - --[''] = cmp.mapping.scroll_docs(-4), - --[''] = cmp.mapping.scroll_docs(4), - --[''] = cmp.mapping.complete(), - --[''] = cmp.mapping.abort(), - --[''] = cmp.mapping.confirm({ select = true }), - --}), - --sources = cmp.config.sources({ - --{ name = 'nvim_lspconfig' }, - --{ name = 'vsnip' }, - --},{ - --{ name = 'buffer' } - --}) ---}) --- ---cmp.setup.filetype('gitcommit', { - --sources = cmp.config.sources({ - --{ name = 'git' } - --},{ - --{ name = 'buffer' } - --}) ---}) --- ---cmp.setup.cmdline({ '/', '?' }, { - --mapping = cmp.mapping.preset.cmdline(), - --sources = { { name = 'buffer' } } ---}) --- ---cmp.setup.cmdline(':', { - --mapping = cmp.mapping.preset.cmdline(), - --sources = cmp.config.sources({ - --{ name = 'path' } - --},{ - --{ name = 'cmdline' } - --}) ---}) --- ---local capabilities = require('cmp_nvim_lsp').default_capabilities() ---local lspconfig = require('lspconfig') ----- Add each LSP that you have configured here -----require('lspconfig')[''].setup { ----- capabilities = capabilities -----} -----lspconfig.pyright.setup { capabilities = capabilities } ---lspconfig.ansiblels.setup { capabilities = capabilities } ---lspconfig.jedi_language_server.setup { capabilities = capabilities } - --- ====================================================================== --- --- automatic commands --- --- ====================================================================== -local api = vim.api - --- Highlights bad whitespace ---api.nvim_create_autocmd("ColorScheme", { command = "highlight ExtraWhitespace ctermbg=red guibg=red" }) ---api.nvim_create_autocmd("BufWinEnter", { command = "match ExtraWhitespace /\s\+$/" }) ---api.nvim_create_autocmd("InsertEnter", { command = "match ExtraWhitespace /\s\+\%#\@ \be --- imap \be -vim.keymap.set(all, "", "\\be") --- map :NERDTreeToggle -vim.keymap.set(all, "", ":NERDTreeToggle") --- Which file list to pop up --- silent !git rev-parse --is-inside-work-tree --- if v:shell_error == 0 --- map :GFiles --cached --others --exclude-standard --- map :GFiles? ---else --- map :Files ---endif -if api.nvim_command_output("!git rev-parse --is-inside-work-tree") == true then - vim.keymap.set(all, "", ":GFiles --cached --others --exclude-standard") - vim.keymap.set(all, "", ":GFiles?") -else - vim.keymap.set(all, "", ":Files") -end --- map :Files -vim.keymap.set(all, "", ":Files") - --- Allows navigating splits --- map j --- map k --- map h --- map l -vim.keymap.set(all, "", "j") -vim.keymap.set(all, "", "k") -vim.keymap.set(all, "", "h") -vim.keymap.set(all, "", "l") - --- ============================================================================ --- User functions to just make life easier --- ============================================================================ --- Creates the directory for a file if it doesn't already exist. -bufWritePres = vim.cmd [[ - function! s:MkNonExDir(file, buf) - if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/' - let dir=fnamemodify(a:file, ':h') - if !isdirectory(dir) - call mkdir(dir, 'p') - endif - endif - endfunction - augroup BWCCreateDir - autocmd! - autocmd BufWritePre * :call s:MkNonExDir(expand(''), +expand('')) - augroup END -]] - --- Return indent (all whitespace at start of a line), converted from --- tabs to spaces if what = 1, or from spaces to tabs otherwise. --- When converting to tabs, result has no redundant spaces. -vim.cmd [[ -function! Indenting(indent, what, cols) - let spccol = repeat(' ', a:cols) - let result = substitute(a:indent, spccol, '\t', 'g') - let result = substitute(result, ' \+\ze\t', ''', 'g') - if a:what == 1 - let result = substitute(result, '\t', spccol, 'g') - endif - return result -endfunction -]] - ---Convert whitespace used for indenting (before first non-whitespace). ---what = 0 (convert spaces to tabs), or 1 (convert tabs to spaces). ---cols = string with number of columns per tab, or empty to use 'tabstop'. ---The cursor position is restored, but the cursor will be in a different ---column when the number of characters in the indent of the line is changed. -vim.cmd [[ -function! IndentConvert(line1, line2, what, cols) - let savepos = getpos('.') - let cols = empty(a:cols) ? &tabstop : a:cols - execute a:line1 . ',' . a:line2 . 's/^\s\+/\=Indenting(submatch(0), a:what, cols)/e' - call histdel('search', -1) - call setpos('.', savepos) -endfunction -command! -nargs=? -range=% Space2Tab call IndentConvert(,,0,) -command! -nargs=? -range=% Tab2Space call IndentConvert(,,1,) -command! -nargs=? -range=% RetabIndent call IndentConvert(,,&et,) -]] diff --git a/home/vim.nix b/home/vim.nix index 60a7e50..1546038 100644 --- a/home/vim.nix +++ b/home/vim.nix @@ -27,39 +27,125 @@ in pyright ]; - programs.neovim = { + #programs.neovim = { + # enable = true; + # viAlias = true; + # vimAlias = true; + # vimdiffAlias = true; + # plugins = with pkgs.vimPlugins; [ + # ansible-vim + # bufexplorer +# +# #cmp-nvim-lsp +# #cmp-vsnip +# #nvim-lspconfig +# nvim-cmp +# +# jedi-vim +# +# context-vim +# direnv-vim +# fzf-vim +# nerdtree +# nvim-notify +# vim-airline +# vim-gitgutter +# vim-flake8 +# vim-fugitive +# vim-indent-guides +# vim-packer +# vim-rooter +# vim-xonsh +# gruvbox +# ]; +# extraLuaConfig = builtins.readFile ./init.lua; +# coc = { +# # Currently waiting on resolution of https://github.com/NixOS/nixpkgs/issues/236560 +# enable = false; +# }; +# }; + programs.nixneovim = { enable = true; - viAlias = true; - vimAlias = true; - vimdiffAlias = true; - plugins = with pkgs.vimPlugins; [ - ansible-vim + colorscheme = "gruvbox"; + globals = { + indent_guides_enable_on_vim_startup = 1; + nix_recommended_style = 0; + NERDTreeIgnore = [ + "\\.pyc$" + "\\.pyo$" + "\\.o$" + "\\.class$" + ]; + }; + options = { + background = "dark"; + backup = false; + copyindent = true; + cursorline = true; + expandtab = false; + hidden = true; + hlsearch = true; + ignorecase = true; + lazyredraw = true; + list = true; + listchars = "tab:→ ,extends:→,precedes:←,trail:·,eol:¬"; + mouse = "a"; + number = true; + preserveindent = true; + relativenumber = true; + shiftwidth = 4; + showcmd = true; + showmatch = true; + signcolumn = "yes"; + smartcase = true; + softtabstop = 4; + tabstop = 4; + # Setting for CtrlP + wildignore = "*.swp,*.pyc,*.class,.tox"; + wrap = false; + writebackup = false; + }; + mappings = { + normalVisualOp = { + "" = ''":BufExplorer"''; + "" = ''":NERDTreeToggle"''; + "" = ''":Files"''; + "" = ''"j"''; + "" = ''"k"''; + "" = ''"h"''; + "" = ''"l"''; + }; + }; + plugins = { + airline.enable = true; + gitgutter.enable = true; + gruvbox.enable = true; + fugitive.enable = true; + notify.enable = true; + packer = { + enable = true; + plugins = [ + ]; + }; + }; + extraConfigLua = builtins.readFile ./vim/extra.lua; + extraConfigVim = builtins.readFile ./vim/extra.vimrc; + extraPlugins = with pkgs.vimPlugins; [ bufexplorer + nerdtree + nvim-cmp - #cmp-nvim-lsp - #cmp-vsnip - #nvim-lspconfig - #nvim-cmp + jedi-vim context-vim direnv-vim fzf-vim - nerdtree - nvim-notify - vim-airline - vim-gitgutter vim-flake8 - vim-fugitive vim-indent-guides - vim-packer vim-rooter vim-xonsh - gruvbox ]; - #extraConfig = builtins.readFile ./vimrc; - extraLuaConfig = builtins.readFile ./init.lua; - coc = { - enable = true; - }; + viAlias = true; + vimAlias = true; }; } diff --git a/home/vim/extra.lua b/home/vim/extra.lua new file mode 100644 index 0000000..7aac317 --- /dev/null +++ b/home/vim/extra.lua @@ -0,0 +1,44 @@ +-- ====================================================================== +-- +-- automatic commands +-- +-- ====================================================================== +local api = vim.api +local all = {"n", "v", "i"} + +-- Highlights bad whitespace +--api.nvim_create_autocmd("ColorScheme", { command = "highlight ExtraWhitespace ctermbg=red guibg=red" }) +--api.nvim_create_autocmd("BufWinEnter", { command = "match ExtraWhitespace /\s\+$/" }) +--api.nvim_create_autocmd("InsertEnter", { command = "match ExtraWhitespace /\s\+\%#\@", ":GFiles --cached --others --exclude-standard") + vim.keymap.set(all, "", ":GFiles?") +else + vim.keymap.set(all, "", ":Files") +end diff --git a/home/vim/extra.vimrc b/home/vim/extra.vimrc new file mode 100644 index 0000000..2390437 --- /dev/null +++ b/home/vim/extra.vimrc @@ -0,0 +1,33 @@ +function! s:MkNonExDir(file, buf) + if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/' + let dir=fnamemodify(a:file, ':h') + if !isdirectory(dir) + call mkdir(dir, 'p') + endif + endif +endfunction +augroup BWCCreateDir + autocmd! + autocmd BufWritePre * :call s:MkNonExDir(expand(''), +expand('')) +augroup END + +function! Indenting(indent, what, cols) + let spccol = repeat(' ', a:cols) + let result = substitute(a:indent, spccol, '\t', 'g') + let result = substitute(result, ' \+\ze\t', ''', 'g') + if a:what == 1 + let result = substitute(result, '\t', spccol, 'g') + endif + return result +endfunction + +function! IndentConvert(line1, line2, what, cols) + let savepos = getpos('.') + let cols = empty(a:cols) ? &tabstop : a:cols + execute a:line1 . ',' . a:line2 . 's/^\s\+/\=Indenting(submatch(0), a:what, cols)/e' + call histdel('search', -1) + call setpos('.', savepos) +endfunction +command! -nargs=? -range=% Space2Tab call IndentConvert(,,0,) +command! -nargs=? -range=% Tab2Space call IndentConvert(,,1,) +command! -nargs=? -range=% RetabIndent call IndentConvert(,,&et,) diff --git a/home/vim/init.lua b/home/vim/init.lua new file mode 100644 index 0000000..0031df6 --- /dev/null +++ b/home/vim/init.lua @@ -0,0 +1,88 @@ +-- ====================================================================== +-- +-- nvim-cmp configuration +-- +-- ====================================================================== +local cmp = require'cmp' + +cmp.setup({ + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + }, + window = { + -- completion = cmp.config.window.bordered(), + -- documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lspconfig' }, + { name = 'vsnip' }, + },{ + { name = 'buffer' } + }) +}) + +cmp.setup.filetype('gitcommit', { + sources = cmp.config.sources({ + { name = 'git' } + },{ + { name = 'buffer' } + }) +}) + +cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { { name = 'buffer' } } +}) + +cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + },{ + { name = 'cmdline' } + }) +}) + +local capabilities = require('cmp_nvim_lsp').default_capabilities() +local lspconfig = require('lspconfig') +-- Add each LSP that you have configured here +--require('lspconfig')[''].setup { +-- capabilities = capabilities +--} +--lspconfig.pyright.setup { capabilities = capabilities } +lspconfig.ansiblels.setup { capabilities = capabilities } +--lspconfig.jedi_language_server.setup { capabilities } + +-- ====================================================================== +-- +-- Plugin configurations +-- +-- ====================================================================== +-- Set filetype to the way I want it +-- Settings for CtrlP +vim.opt.wildignore="*.swp,*.pyc,*.class,.tox" +-- Settings for NerdTree +vim.g.NERDTreeIgnore = {'\\.pyc$', '\\.o$', '\\.class$'} +-- indent guides +vim.g.indent_guides_enable_on_vim_startup = 1 +-- Tell syntastic to use yamllint +vim.g.syntastic_yaml_checkers = {'yamllint'} +vim.g.syntastic_yaml_yamllint_args = {} +vim.g.syntastic_shell = "${pkgs.bash}/bin/bash" +-- Shortcuts for resolving git diff conflicts +vim.g.diffget_local_map = "gl" +vim.g.diffget_upstream_map = "gu" + + +-- ============================================================================ +-- User functions to just make life easier +-- ============================================================================ diff --git a/home/vimrc b/home/vim/vimrc similarity index 100% rename from home/vimrc rename to home/vim/vimrc From ea78d26e8d8a6e43b701121f93c59695d29194e3 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 21 Jun 2023 10:58:40 -0500 Subject: [PATCH 6/8] Move hosts to using inputs --- home/default.nix | 16 +++++++--------- hosts/default.nix | 12 ++++++------ 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/home/default.nix b/home/default.nix index a35dc81..a2c9bc9 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,18 +1,16 @@ { - nixpkgs, + inputs, overlays, - hm, - flake-utils, ... }: let # I'm "greg" everywhere except Darwin where I'm "gregory.hellings" user = system: - ( if ( nixpkgs.lib.hasSuffix "-darwin" system ) then "gregory.hellings" else "greg" ); + ( if ( inputs.nixstable.lib.hasSuffix "-darwin" system ) then "gregory.hellings" else "greg" ); home = system: username: if username == "root" then "/root" else - ( if ( nixpkgs.lib.hasSuffix "-darwin" system ) then "/Users/${username}" else "/home/${username}" ); + ( if ( inputs.nixstable.lib.hasSuffix "-darwin" system ) then "/Users/${username}" else "/home/${username}" ); mkhome = { system, @@ -27,24 +25,24 @@ let configDir = "${homeDirectory}/.config"; - pkgs = import nixpkgs { + pkgs = import inputs.nixstable { inherit overlays system; config.allowUnfree = true; config.xdg.configHome = configDir; }; - in hm.lib.homeManagerConfiguration rec { + in inputs.hm.lib.homeManagerConfiguration rec { inherit pkgs; modules = [ (import ./home.nix { - inherit pkgs gui gnome; + inherit inputs pkgs gui gnome; inherit (pkgs) config lib stdenv; }) cfg ]; }; -in flake-utils.lib.eachDefaultSystem (system: { +in inputs.flake-utils.lib.eachDefaultSystem (system: { gui = mkhome { inherit system; gui = true; diff --git a/hosts/default.nix b/hosts/default.nix index 7f55841..9ce016d 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,20 +1,20 @@ -{ nixstable, nixunstable, overlays, wsl, agenix, ... }: +{ inputs, overlays, ... }: let - wsl = args: (unstable (args // { extraMods = [ wsl.nixosModules.wsl ]; })); - unstable = args: (machine (args // { channel = nixunstable; })); + wsl = args: (unstable (args // { extraMods = [ inputs.wsl.nixosModules.wsl ]; })); + unstable = args: (machine (args // { channel = inputs.nixunstable; })); machine = { system ? "x86_64-linux", name, - channel ? nixstable, + channel ? inputs.nixstable, extraMods ? [] }: let nixpkgs = channel; - in nixpkgs.lib.nixosSystem { + in inputs.nixpkgs.lib.nixosSystem { inherit system; modules = [ { nixpkgs.overlays = overlays; } - agenix.nixosModules.default + inputs.agenix.nixosModules.default ../modules-all ../modules-linux ./${name} From 18c8e1ff6bf32097299b6eacbbbb336582ef6c02 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 21 Jun 2023 11:07:11 -0500 Subject: [PATCH 7/8] Move home configurations out of garnix --- flake.nix | 2 -- garnix.yaml | 5 +---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/flake.nix b/flake.nix index 3af30dc..5d09188 100644 --- a/flake.nix +++ b/flake.nix @@ -61,8 +61,6 @@ darwinConfigurations = (import ./darwin { inherit inputs overlays; }); - defaultPackage = flake-utils.lib.eachDefaultSystemMap (system: inputs.self.homeConfigurations.gui."${system}".activationPackage); - homeConfigurations = ( import ./home { inherit inputs overlays; diff --git a/garnix.yaml b/garnix.yaml index eed88ba..e438fac 100644 --- a/garnix.yaml +++ b/garnix.yaml @@ -3,7 +3,4 @@ builds: - '*.x86_64-linux.*' - '*.aarch64-linux.*' - nixosConfigurations.* - - defaultPackage.x86_64-linux - - defaultPackage.aarch64-linux - - defaultPackage.x86_64-darwin - - defaultPackage.aarch64-darwin + - darwinConfigurations.* From 4b3069cea62fae1ab5addfd39903fd0589fc6244 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 21 Jun 2023 11:10:41 -0500 Subject: [PATCH 8/8] Use current instead of inputs --- hosts/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosts/default.nix b/hosts/default.nix index 9ce016d..07e6c5d 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -10,7 +10,7 @@ let }: let nixpkgs = channel; - in inputs.nixpkgs.lib.nixosSystem { + in nixpkgs.lib.nixosSystem { inherit system; modules = [ { nixpkgs.overlays = overlays; }