From b7394a55d3e4f0dbd14fa82a4b3c19def6b1988b Mon Sep 17 00:00:00 2001 From: Nikos Papadakis Date: Tue, 26 Sep 2023 18:12:40 +0300 Subject: [PATCH] nix changes --- flake.lock | 97 ++++++++++++++++++++++++++++++++- flake.nix | 8 ++- home.nix | 21 ++++--- nvim/after/plugin/lspconfig.lua | 2 +- packages.nix | 1 + 5 files changed, 114 insertions(+), 15 deletions(-) diff --git a/flake.lock b/flake.lock index 50f543b..6e2e79f 100644 --- a/flake.lock +++ b/flake.lock @@ -18,6 +18,24 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1687709756, + "narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -61,7 +79,43 @@ "type": "github" } }, + "nil": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1695485017, + "narHash": "sha256-aQyRBJnT4tftexM/Y3etfOk8tfMFZzt+vSVtL2J0KLY=", + "owner": "oxalica", + "repo": "nil", + "rev": "510bc6e9b41d39c81b9c815065cb5b7e23a2428c", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "nil", + "type": "github" + } + }, "nixpkgs": { + "locked": { + "lastModified": 1690441914, + "narHash": "sha256-Ac+kJQ5z9MDAMyzSc0i0zJDx2i3qi9NjlW5Lz285G/I=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "db8672b8d0a2593c2405aed0c1dfa64b2a2f428f", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1695360818, "narHash": "sha256-JlkN3R/SSoMTa+CasbxS1gq+GpGxXQlNZRUh9+LIy/0=", @@ -81,7 +135,33 @@ "inputs": { "home-manager": "home-manager", "neovim": "neovim", - "nixpkgs": "nixpkgs" + "nil": "nil", + "nixpkgs": "nixpkgs_2" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "nil", + "flake-utils" + ], + "nixpkgs": [ + "nil", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1688783586, + "narHash": "sha256-HHaM2hk2azslv1kH8zmQxXo2e7i5cKgzNIuK4yftzB0=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "7a29283cc242c2486fc67f60b431ef708046d176", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" } }, "systems": { @@ -98,6 +178,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 46cf59f..68f69d5 100644 --- a/flake.nix +++ b/flake.nix @@ -11,12 +11,14 @@ url = "github:neovim/neovim?dir=contrib"; inputs.nixpkgs.follows = "nixpkgs"; }; + nil.url = "github:oxalica/nil"; }; outputs = { nixpkgs, home-manager, neovim, ... }: let - system = "x86_64-linux"; # change your system type here - user = "nikos"; # change your user here + 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 { @@ -36,6 +38,8 @@ ]; } ]; + + extraSpecialArgs = { extra = { inherit user dotfilesHome; }; }; }; }; } diff --git a/home.nix b/home.nix index c1abd03..7537703 100644 --- a/home.nix +++ b/home.nix @@ -1,8 +1,8 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, lib, extra, ... }: { - home.username = "nikos"; - home.homeDirectory = "/home/nikos"; + home.username = "${extra.user}"; + home.homeDirectory = "/home/${extra.user}"; # This value determines the Home Manager release that your configuration is # compatible with. This helps avoid breakage when a new Home Manager release @@ -22,7 +22,7 @@ xdg.dataFile = { "nvim/lazy-lock.json".source = - config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/lazy-lock.json"; + config.lib.file.mkOutOfStoreSymlink "${extra.dotfilesHome}/lazy-lock.json"; }; # The home.packages option allows you to install Nix packages into your @@ -49,15 +49,14 @@ programs.fish = { enable = true; - shellInit = builtins.readFile ./fish/config.fish; - functions = lib.attrsets.mapAttrs' + shellInit = lib.strings.concatStringsSep "\n" ([ + (builtins.readFile ./fish/config.fish) + ] ++ lib.attrsets.mapAttrsToList ( - name: value: { - name = builtins.replaceStrings [ ".fish" ] [ "" ] name; - value = builtins.readFile (./fish/functions + ("/" + name)); - } + name: value: builtins.readFile (./fish/functions + ("/" + name)) ) - (builtins.readDir ./fish/functions); + (builtins.readDir ./fish/functions) + ); }; # Let Home Manager install and manage itself. diff --git a/nvim/after/plugin/lspconfig.lua b/nvim/after/plugin/lspconfig.lua index f339777..63ede75 100644 --- a/nvim/after/plugin/lspconfig.lua +++ b/nvim/after/plugin/lspconfig.lua @@ -125,7 +125,7 @@ local servers = { }, }, gopls = {}, - rnix = {}, + nil_ls = {}, jedi_language_server = {}, -- python lsp ruff_lsp = {}, -- python linter rust_analyzer = { diff --git a/packages.nix b/packages.nix index eee2dac..d6543da 100644 --- a/packages.nix +++ b/packages.nix @@ -3,5 +3,6 @@ pkgs: with pkgs; [ ripgrep # "rg" cli, alternative to grep, used by nvim fd # find alternative, used by nvim lsd # "ls" alternative + nil # Nix LSP (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) # nerdfonts jetbrains mono ]