From 46844b9f267e853622d30d8d3d258d60de75433d Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Tue, 20 Feb 2024 00:58:17 +0800 Subject: [PATCH] repo: add flake.nix --- flake.lock | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 38 ++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ae5e8b2 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1708118438, + "narHash": "sha256-kk9/0nuVgA220FcqH/D2xaN6uGyHp/zoxPNUmPCMmEE=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "5863c27340ba4de8f83e7e3c023b9599c3cb3c80", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "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", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d803451 --- /dev/null +++ b/flake.nix @@ -0,0 +1,38 @@ +{ + description = "Guanran928's nvim config"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = inputs: + inputs.flake-utils.lib.eachDefaultSystem ( + system: let + inherit (inputs.nixpkgs) lib; + pkgs = inputs.nixpkgs.legacyPackages.${system}; + in { + packages.default = let + runtimeDeps = with pkgs; [gcc]; + in ( + pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped + (pkgs.neovimUtils.makeNeovimConfig + { + customRC = '' + set runtimepath^=${./.} + source ${./.}/init.lua + ''; + } + // { + wrapperArgs = ["--prefix" "PATH" ":" "${lib.makeBinPath runtimeDeps}"]; + }) + ); + + devShells.default = pkgs.mkShell { + nativeBuildInputs = [ + pkgs.stylua + ]; + }; + } + ); +}