From f79db0b4bdd3503b57fc60fb51687ae5ec850642 Mon Sep 17 00:00:00 2001 From: Leon Liu Date: Fri, 10 Nov 2023 19:55:41 +0900 Subject: [PATCH] update. --- configuration.nix | 1 + flake.lock | 236 +++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 11 ++- home.nix | 25 ++++- 4 files changed, 264 insertions(+), 9 deletions(-) diff --git a/configuration.nix b/configuration.nix index deb0202..94b3f5d 100644 --- a/configuration.nix +++ b/configuration.nix @@ -15,6 +15,7 @@ in ./hardware-configuration.nix ./containers.nix ]; + nix.settings.trusted-users = [ "root" "liu" ]; virtualisation.docker.enable = true; nix.settings.experimental-features = [ "nix-command" "flakes" ]; diff --git a/flake.lock b/flake.lock index e1fc214..99842ae 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,102 @@ { "nodes": { + "beautysh": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ], + "poetry2nix": "poetry2nix", + "utils": "utils" + }, + "locked": { + "lastModified": 1680308980, + "narHash": "sha256-aUEHV0jk2qIFP3jlsWYWhBbm+w/N9gzH3e4I5DcdB5s=", + "owner": "lovesegfault", + "repo": "beautysh", + "rev": "9845efc3ea3e86cc0d41465d720a47f521b2799c", + "type": "github" + }, + "original": { + "owner": "lovesegfault", + "repo": "beautysh", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "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=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixvim", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -36,10 +133,147 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1685801374, + "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixvim": { + "inputs": { + "beautysh": "beautysh", + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ], + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1699308475, + "narHash": "sha256-sFHOFiE+GV1JkwDmHi0LLJLSRyggdIK1Yra02oj2eZg=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "6b93c8fa6db999320d53f13e0ebd555e33f86577", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, + "poetry2nix": { + "inputs": { + "flake-utils": [ + "nixvim", + "beautysh", + "utils" + ], + "nixpkgs": [ + "nixvim", + "beautysh", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1658665240, + "narHash": "sha256-/wkx7D7enyBPRjIkK0w7QxLQhzEkb3UxNQnjyc3FTUI=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "8b8edc85d24661d5a6d0d71d6a7011f3e699780f", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils_2", + "gitignore": "gitignore", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1698852633, + "narHash": "sha256-Hsc/cCHud8ZXLvmm8pxrXpuaPEeNaaUttaCvtdX/Wug=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "dec10399e5b56aa95fcd530e0338be72ad6462a0", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "home-manager": "home-manager", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "nixvim": "nixvim" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "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" + } + }, + "utils": { + "locked": { + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 8c8595f..13a8526 100644 --- a/flake.nix +++ b/flake.nix @@ -5,20 +5,25 @@ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; + nixvim = { + url = "github:nix-community/nixvim"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = inputs@{ nixpkgs, home-manager, ... }: { + outputs = inputs@{ nixpkgs, home-manager, nixvim, ... }: { nixosConfigurations = { nixosDesktop = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; + modules = [ ./configuration.nix home-manager.nixosModules.home-manager - { + { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.users.liu = import ./home.nix; - + home-manager.extraSpecialArgs = { inherit nixvim; }; # Optionally, use home-manager.extraSpecialArgs to pass # arguments to home.nix } diff --git a/home.nix b/home.nix index 4c7cd8b..1c269ae 100644 --- a/home.nix +++ b/home.nix @@ -1,6 +1,10 @@ -{ config, pkgs, ... }: +{ config, pkgs, nixvim, ... }: { + + imports = [ + nixvim.homeManagerModules.nixvim + ]; # Home Manager needs a bit of information about you and the paths it should # manage. home.username = "liu"; @@ -71,7 +75,7 @@ # # if you don't want to manage your shell through Home Manager. home.sessionVariables = { - # EDITOR = "emacs"; + # EDITOR = "hx"; }; # Let Home Manager install and manage itself. @@ -97,11 +101,9 @@ plugins = [ "git" "history-substring-search" ]; theme = "robbyrussell"; }; - initExtra = '' - VISUAL=vim + VISUAL=hx EDITOR="$VISUAL" - PATH=$PATH:$HOME/.cargo/bin/ ''; }; @@ -122,4 +124,17 @@ "editor.fontFamily" = "mononoki"; }; }; + programs.helix = { + enable = true; + defaultEditor = true; + settings = { + theme = "gruvbox_dark_hard"; + editor = { + file-picker = { + hidden = false; + }; + true-color = true; + }; + }; + }; }