From c046bffd5de2e57bd13b766174cb5d7b1eb16796 Mon Sep 17 00:00:00 2001 From: Nikos Papadakis Date: Sat, 28 Oct 2023 14:25:31 +0300 Subject: [PATCH] nix --- flake.lock | 36 +++++++++++++++++++++++++++++++++++- flake.nix | 51 ++++++++++++++++++++++++++------------------------- home.nix | 16 ++++++++++++---- 3 files changed, 73 insertions(+), 30 deletions(-) diff --git a/flake.lock b/flake.lock index 50f543b..3ee6251 100644 --- a/flake.lock +++ b/flake.lock @@ -4,6 +4,24 @@ "inputs": { "systems": "systems" }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, "locked": { "lastModified": 1685518550, "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", @@ -40,7 +58,7 @@ }, "neovim": { "inputs": { - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "nixpkgs": [ "nixpkgs" ] @@ -79,6 +97,7 @@ }, "root": { "inputs": { + "flake-utils": "flake-utils", "home-manager": "home-manager", "neovim": "neovim", "nixpkgs": "nixpkgs" @@ -98,6 +117,21 @@ "repo": "default", "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" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 30b555f..0254a46 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,7 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; home-manager = { url = "github:nix-community/home-manager"; @@ -15,32 +16,32 @@ }; }; - outputs = { nixpkgs, home-manager, neovim, ... }: - let - system = "x86_64-linux"; # change your system type here - user = "nikos"; # change your user here - dotfilesHome = "/home/nikos/.dotfiles"; # specify your dotfiles path - pkgs = nixpkgs.legacyPackages.${system}; - in - { - homeConfigurations.${user} = home-manager.lib.homeManagerConfiguration { - inherit pkgs; + outputs = { nixpkgs, home-manager, flake-utils, neovim, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + user = "nikos"; # change your user here + dotfilesHome = "/home/${user}/.dotfiles"; # specify your dotfiles path + pkgs = nixpkgs.legacyPackages.${system}; + in + { + packages.homeConfigurations.${user} = home-manager.lib.homeManagerConfiguration { + inherit pkgs; - # Specify your home configuration modules here, for example, - # the path to your home.nix. - modules = [ - ./home.nix + # Specify your home configuration modules here, for example, + # the path to your home.nix. + modules = [ + ./home.nix - { - nixpkgs.overlays = [ - (final: prev: { - neovim = neovim.packages.${system}.neovim; - }) - ]; - } - ]; + { + nixpkgs.overlays = [ + (final: prev: { + neovim = neovim.packages.${system}.neovim; + }) + ]; + } + ]; - extraSpecialArgs = { extra = { inherit user dotfilesHome; }; }; - }; - }; + extraSpecialArgs = { extra = { inherit user dotfilesHome; }; }; + }; + }); } diff --git a/home.nix b/home.nix index 5c091ce..5471008 100644 --- a/home.nix +++ b/home.nix @@ -28,15 +28,11 @@ # The home.packages option allows you to install Nix packages into your # environment. home.packages = with pkgs; [ - neovim # neovim nightly ripgrep # "rg" cli, alternative to grep, used by nvim fd # find alternative, used by nvim lsd # "ls" alternative zoxide # "z" command - nil # Nix LSP - nixpkgs-fmt # Nix formatter (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) # nerdfonts jetbrains mono - efm-langserver # Generic language server ]; fonts.fontconfig.enable = true; @@ -69,6 +65,18 @@ ); }; + programs.neovim = { + enable = true; + defaultEditor = true; + package = pkgs.neovim; + extraPackages = [ + pkgs.nil # Nix lsp + pkgs.nixpkgs-fmt # Nix formatter + pkgs.efm-langserver # Generic language server + pkgs.lua-language-server + ]; + }; + programs.direnv = { enable = true; nix-direnv.enable = true;