From e2c9d8eba7f690ef6a92de113a569e7dc7406061 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Mon, 24 Jul 2023 13:27:05 +0100 Subject: [PATCH] Use custom neovim flake, centralise tokyonight source nvim repo has been converted to flake for easier inclusion but still stand-alone for non-nix systems Move tokyonight repo fetch to flake input to keep consistent and reduce multiple fetch calls --- Makefile | 38 ++++--------------- flake.lock | 73 +++++++++++++++++++++++++++++++++---- flake.nix | 24 +++++++----- home/git/default.nix | 12 +----- home/hyprland/default.nix | 9 +++-- home/hyprland/hyprland.conf | 36 +++++++++--------- home/shell/default.nix | 2 +- home/shell/fish.nix | 11 +----- home/tui/bat.nix | 26 ------------- home/tui/default.nix | 31 +++++++++++++--- home/tui/gitui.nix | 19 ---------- home/tui/neovim.nix | 44 ---------------------- hosts/Legion/home.nix | 11 +----- hosts/Ronin/home.nix | 5 +-- hosts/Vanguard/home.nix | 11 +----- hosts/desktop.nix | 4 +- 16 files changed, 146 insertions(+), 210 deletions(-) delete mode 100644 home/tui/bat.nix delete mode 100644 home/tui/gitui.nix delete mode 100644 home/tui/neovim.nix diff --git a/Makefile b/Makefile index 7cc2ebb8..555654c4 100644 --- a/Makefile +++ b/Makefile @@ -1,36 +1,12 @@ -.PHONY: test switch build debug lock update hyprland waybar home full - -test: - sudo nixos-rebuild test --flake . - -switch: - sudo nixos-rebuild switch --flake . +.PHONY: build switch test build: sudo nixos-rebuild build --flake . + -nix run nixpkgs#home-manager -- build --flake . -debug: - sudo nixos-rebuild build --flake . --show-trace --refresh +switch: + sudo nixos-rebuild switch --flake . + -nix run nixpkgs#home-manager -- switch --flake . -lock: - nix flake lock --update-input nixpkgs --update-input home-manager - -update: - nix flake update --refresh --commit-lock-file - -hyprland: - -hyprctl reload - -pkill -1 kanshi - -waybar: - -pkill -9 waybar - -hyprctl dispatch exec waybar - -home: - nix run nixpkgs#home-manager -- switch --flake . - make hyprland - make waybar - -full: - make switch - make home +test: + sudo nixos-rebuild test --flake . diff --git a/flake.lock b/flake.lock index 01abec40..24fbff9a 100644 --- a/flake.lock +++ b/flake.lock @@ -19,6 +19,7 @@ "flake-parts": { "inputs": { "nixpkgs-lib": [ + "neovim-custom", "neovim-nightly-overlay", "nixpkgs" ] @@ -57,6 +58,7 @@ "flake-parts_3": { "inputs": { "nixpkgs-lib": [ + "neovim-custom", "neovim-nightly-overlay", "hercules-ci-effects", "hercules-ci-agent", @@ -135,6 +137,7 @@ "flake-parts": "flake-parts_2", "hercules-ci-agent": "hercules-ci-agent", "nixpkgs": [ + "neovim-custom", "neovim-nightly-overlay", "nixpkgs" ] @@ -217,21 +220,41 @@ "type": "github" } }, + "neovim-custom": { + "inputs": { + "neovim-nightly-overlay": "neovim-nightly-overlay", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1690191730, + "narHash": "sha256-jaigjILRn7hU75nsRn7qqqqtD6vHpgT56inwOuYDImI=", + "ref": "refs/heads/main", + "rev": "01ea9bc452dd58e6071fa02b2e05ff6e8d3547c7", + "revCount": 114, + "type": "git", + "url": "https://git.xenia.me.uk/xenia/nvim.git" + }, + "original": { + "type": "git", + "url": "https://git.xenia.me.uk/xenia/nvim.git" + } + }, "neovim-flake": { "inputs": { "flake-utils": "flake-utils", "nixpkgs": [ + "neovim-custom", "neovim-nightly-overlay", "nixpkgs" ] }, "locked": { "dir": "contrib", - "lastModified": 1689722072, - "narHash": "sha256-Rjk2nAYMEB7+jy+4an3oTSQ7gn8K5U8ZGWLMaaCdHtI=", + "lastModified": 1689836628, + "narHash": "sha256-CDbbn0N6eiknKa4KrYc6+4LAb4za2IYSw/YGy5BPdcQ=", "owner": "neovim", "repo": "neovim", - "rev": "ab5cdbd167353a0c6a0ef0b864d78af13029339c", + "rev": "63b3408551561127f7845470eb51404bcd6f547b", "type": "github" }, "original": { @@ -248,15 +271,16 @@ "hercules-ci-effects": "hercules-ci-effects", "neovim-flake": "neovim-flake", "nixpkgs": [ + "neovim-custom", "nixpkgs" ] }, "locked": { - "lastModified": 1689725104, - "narHash": "sha256-NQ9GCkrlk7NVnKA0JCprpjVwmE1J5/Xv5nj0WasXsP0=", + "lastModified": 1689897867, + "narHash": "sha256-qr3jIEZh6k83i5JBfJ1GuwSTybekrioSnd3iaZACr5g=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "f42a9b1db59af2dff882803c38c51be7d5680da2", + "rev": "258dfdf8fec67a1cea88a71d7613584300e062a0", "type": "github" }, "original": { @@ -300,6 +324,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1690031011, + "narHash": "sha256-kzK0P4Smt7CL53YCdZCBbt9uBFFhE0iNvCki20etAf4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "12303c652b881435065a98729eb7278313041e49", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1689534811, "narHash": "sha256-jnSUdzD/414d94plCyNlvTJJtiTogTep6t7ZgIKIHiE=", @@ -319,8 +359,9 @@ "inputs": { "home-manager": "home-manager", "hyprland": "hyprland", - "neovim-nightly-overlay": "neovim-nightly-overlay", - "nixpkgs": "nixpkgs_2", + "neovim-custom": "neovim-custom", + "nixpkgs": "nixpkgs_3", + "tokyonight": "tokyonight", "wallpapers": "wallpapers" } }, @@ -339,6 +380,22 @@ "type": "github" } }, + "tokyonight": { + "flake": false, + "locked": { + "lastModified": 1689285710, + "narHash": "sha256-x26qLaZzg7sJIc1d/5Q/DJ/YvRSc3s87PwPHTPTl+Xk=", + "owner": "folke", + "repo": "tokyonight.nvim", + "rev": "1ee11019f8a81dac989ae1db1a013e3d582e2033", + "type": "github" + }, + "original": { + "owner": "folke", + "repo": "tokyonight.nvim", + "type": "github" + } + }, "wallpapers": { "locked": { "lastModified": 1687523055, diff --git a/flake.nix b/flake.nix index d0524880..051e79fe 100644 --- a/flake.nix +++ b/flake.nix @@ -7,23 +7,27 @@ url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; - wallpapers.url = "git+https://git.xenia.me.uk/xenia/wallpapers.git"; - neovim-nightly-overlay = { - url = "github:nix-community/neovim-nightly-overlay"; - inputs.nixpkgs.follows = "nixpkgs"; - }; hyprland = { url = "github:hyprwm/Hyprland"; inputs.nixpkgs.follows = "nixpkgs"; }; + wallpapers.url = "git+https://git.xenia.me.uk/xenia/wallpapers.git"; + neovim-custom.url = "git+https://git.xenia.me.uk/xenia/nvim.git"; + tokyonight = { + url = "github:folke/tokyonight.nvim"; + flake = false; + }; }; outputs = { self, nixpkgs, home-manager, - ... - } @ inputs: let + hyprland, + wallpapers, + neovim-custom, + tokyonight, + }: let shell = "zsh"; in { nixosConfigurations = let @@ -35,7 +39,7 @@ shell = pkgs.${shell}; openssh.authorizedKeys.keys = import ./auth/authorized_keys.nix; }; - specialArgs = {inherit inputs shell userConfig;}; + specialArgs = {inherit shell userConfig hyprland;}; waybar-experimental-overlay = final: prev: { waybar = prev.waybar.overrideAttrs (oldAttrs: { mesonFlags = oldAttrs.mesonFlags ++ ["-Dexperimental=true"]; @@ -47,7 +51,7 @@ config.allowUnfree = true; overlays = [ waybar-experimental-overlay - inputs.neovim-nightly-overlay.overlay + neovim-custom.outputs.overlay ]; }; in { @@ -75,7 +79,7 @@ }; homeConfigurations = let extraSpecialArgs = { - inherit inputs; + inherit hyprland wallpapers neovim-custom tokyonight; shellConfig = ./home/shell/${shell}.nix; }; in { diff --git a/home/git/default.nix b/home/git/default.nix index 4e6566d1..4fb42b1c 100644 --- a/home/git/default.nix +++ b/home/git/default.nix @@ -1,13 +1,5 @@ -{pkgs, ...}: { - xdg.configFile."git/tokyonight_night.gitconfig".source = - pkgs.fetchFromGitHub - { - owner = "folke"; - repo = "tokyonight.nvim"; - rev = "cd5156f4b4a6c4c337a46deb0c0bd37319920833"; - sha256 = "/ht+ixR1eyYR0la00Xq5q1gCsgb5Ly90JghERwbaDPQ="; - } - + "/extras/delta/tokyonight_night.gitconfig"; +{tokyonight, ...}: { + xdg.configFile."git/tokyonight_night.gitconfig".source = "${tokyonight}/extras/delta/tokyonight_night.gitconfig"; programs.git = { enable = true; userName = "Evie Litherland-Smith"; diff --git a/home/hyprland/default.nix b/home/hyprland/default.nix index 2e1d53ae..629f2dd1 100644 --- a/home/hyprland/default.nix +++ b/home/hyprland/default.nix @@ -2,7 +2,8 @@ pkgs, lib, config, - inputs, + hyprland, + wallpapers, ... }: let configure-gtk = pkgs.writeTextFile { @@ -25,7 +26,7 @@ }; in { imports = [ - inputs.hyprland.homeManagerModules.default + hyprland.homeManagerModules.default ./waybar ./rofi ./swaylock.nix @@ -56,8 +57,8 @@ in { }; xdg.configFile = { "hypr/hyprpaper.conf".text = lib.mkDefault '' - preload = ${inputs.wallpapers.outputs.default} - wallpaper = ,${inputs.wallpapers.outputs.default} + preload = ${wallpapers.outputs.default} + wallpaper = ,${wallpapers.outputs.default} ''; "hypr/macchiato.conf".source = ./macchiato.conf; "hypr/display.conf".text = lib.mkDefault ''''; diff --git a/home/hyprland/hyprland.conf b/home/hyprland/hyprland.conf index 43b70e4a..ef71d5c2 100644 --- a/home/hyprland/hyprland.conf +++ b/home/hyprland/hyprland.conf @@ -108,34 +108,34 @@ bind = SUPER SHIFT, K, movewindow, u bind = SUPER SHIFT, J, movewindow, d # 1: home -bind = SUPER, A, moveworkspacetomonitor, 1 current bind = SUPER, A, workspace, 1 -bind = SUPER SHIFT, A, movetoworkspace, 1 +bind = SUPER SHIFT, A, moveworkspacetomonitor, 1 current +bind = SUPER SHIFT, A, workspace, 1 # 2: dev -bind = SUPER, D, moveworkspacetomonitor, 2 current bind = SUPER, D, workspace, 2 -bind = SUPER SHIFT, D, movetoworkspace, 2 +bind = SUPER SHIFT, D, moveworkspacetomonitor, 2 current +bind = SUPER SHIFT, D, workspace, 2 # 3: browser -bind = SUPER, W, moveworkspacetomonitor, 3 current bind = SUPER, W, workspace, 3 -bind = SUPER SHIFT, W, movetoworkspace, 3 +bind = SUPER SHIFT, W, moveworkspacetomonitor, 3 current +bind = SUPER SHIFT, W, workspace, 3 windowrule = workspace 3,(firefox) windowrulev2 = float,title:(File|Picture-in-Picture),class:(firefox) windowrulev2 = pin,title:(File|Picture-in-Picture),class:(firefox) # 4: files -bind = SUPER, F, moveworkspacetomonitor, 4 current bind = SUPER, F, workspace, 4 -bind = SUPER SHIFT, F, movetoworkspace, 4 +bind = SUPER SHIFT, F, moveworkspacetomonitor, 4 current +bind = SUPER SHIFT, F, workspace, 4 windowrule = workspace 4,^(libreoffice).* windowrule = workspace 4,(Zotero) # 5: chat -bind = SUPER, C, moveworkspacetomonitor, 5 current bind = SUPER, C, workspace, 5 -bind = SUPER SHIFT, C, movetoworkspace, 5 +bind = SUPER SHIFT, C, moveworkspacetomonitor, 5 current +bind = SUPER SHIFT, C, workspace, 5 windowrule = workspace 5,(Signal) windowrule = workspace 5,(fractal) windowrule = workspace 5,(discord) @@ -144,30 +144,30 @@ windowrulev2 = workspace 5,title:^(Zoom|zoom).* windowrulev2 = float,title:^(Zoom|zoom).* # 6: mail -bind = SUPER, Z, moveworkspacetomonitor, 6 current bind = SUPER, Z, workspace, 6 -bind = SUPER SHIFT, Z, movetoworkspace, 6 +bind = SUPER SHIFT, Z, moveworkspacetomonitor, 6 current +bind = SUPER SHIFT, Z, workspace, 6 windowrule = workspace 6,(thunderbird) # 7: remote -bind = SUPER, R, moveworkspacetomonitor, 7 current bind = SUPER, R, workspace, 7 -bind = SUPER SHIFT, R, movetoworkspace, 7 +bind = SUPER SHIFT, R, moveworkspacetomonitor, 7 current +bind = SUPER SHIFT, R, workspace, 7 windowrule = workspace 7,(Nxplayer.bin) windowrule = float,(Nxplayer.bin) windowrule = center,(Nxplayer.bin) # 8: steam -bind = SUPER, S, moveworkspacetomonitor, 8 current bind = SUPER, S, workspace, 8 -bind = SUPER SHIFT, S, movetoworkspace, 8 +bind = SUPER SHIFT, S, moveworkspacetomonitor, 8 current +bind = SUPER SHIFT, S, workspace, 8 windowrule = workspace 8,^(steam).* windowrule = workspace 8,(.gamescope-wrapped) # 9: misc -bind = SUPER, X, moveworkspacetomonitor, 9 current bind = SUPER, X, workspace, 9 -bind = SUPER SHIFT, X, movetoworkspace, 9 +bind = SUPER SHIFT, X, moveworkspacetomonitor, 9 current +bind = SUPER SHIFT, X, workspace, 9 bind = SUPER, period, workspace, m+1 bind = SUPER SHIFT, period, movetoworkspace, r+1 diff --git a/home/shell/default.nix b/home/shell/default.nix index e4f43b6e..8bdc1b6e 100644 --- a/home/shell/default.nix +++ b/home/shell/default.nix @@ -31,7 +31,7 @@ starship.enable = true; taskwarrior = { enable = true; - colorTheme = ./taskwarrior.theme; + # colorTheme = ./taskwarrior.theme; }; }; xdg.configFile = { diff --git a/home/shell/fish.nix b/home/shell/fish.nix index d839d545..1d1f45de 100644 --- a/home/shell/fish.nix +++ b/home/shell/fish.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{tokyonight, ...}: { imports = [./default.nix]; programs = { fish = { @@ -6,14 +6,7 @@ plugins = [ { name = "tokyonight"; - src = - pkgs.fetchFromGitHub { - owner = "folke"; - repo = "tokyonight.nvim"; - rev = "cd5156f4b4a6c4c337a46deb0c0bd37319920833"; - sha256 = "/ht+ixR1eyYR0la00Xq5q1gCsgb5Ly90JghERwbaDPQ="; - } - + "/extras/fish/tokyonight_night.fish"; + src = "${tokyonight}/extras/fish/tokyonight_night.fish"; } ]; }; diff --git a/home/tui/bat.nix b/home/tui/bat.nix deleted file mode 100644 index 998dce9e..00000000 --- a/home/tui/bat.nix +++ /dev/null @@ -1,26 +0,0 @@ -{pkgs, ...}: { - programs.bat = { - enable = true; - config = { - theme = "tokyonight"; - }; - themes = { - tokyonight = builtins.readFile (pkgs.fetchFromGitHub - { - owner = "folke"; - repo = "tokyonight.nvim"; - rev = "cd5156f4b4a6c4c337a46deb0c0bd37319920833"; - sha256 = "/ht+ixR1eyYR0la00Xq5q1gCsgb5Ly90JghERwbaDPQ="; - } - + "/extras/sublime/tokyonight_night.tmTheme"); - Catppuccin-macchiato = builtins.readFile (pkgs.fetchFromGitHub - { - owner = "catppuccin"; - repo = "bat"; - rev = "ba4d16880d63e656acced2b7d4e034e4a93f74b1"; - sha256 = "6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw="; - } - + "/Catppuccin-macchiato.tmTheme"); - }; - }; -} diff --git a/home/tui/default.nix b/home/tui/default.nix index c88d7810..7a05df80 100644 --- a/home/tui/default.nix +++ b/home/tui/default.nix @@ -1,7 +1,26 @@ -{...}: { - imports = [ - ./neovim.nix - ./bat.nix - ./gitui.nix - ]; +{ + pkgs, + neovim-custom, + tokyonight, + ... +}: { + imports = [neovim-custom.homeManagerModules.default]; + programs = { + bat = { + enable = true; + config.theme = "tokyonight"; + themes.tokyonight = builtins.readFile "${tokyonight}/extras/sublime/tokyonight_night.tmTheme"; + }; + gitui = { + enable = true; + keyConfig = builtins.readFile (pkgs.fetchFromGitHub { + owner = "extrawurst"; + repo = "gitui"; + rev = "8f7f35b8a97e38a0e181032285554cd0961d588e"; + sha256 = "sha256-zJDf6WhaUe8QTPCoVAdfCdUvYEcQpm2qddQiKw41kjY="; + } + + "/vim_style_key_config.ron"); + theme = builtins.readFile "${tokyonight}/extras/gitui/tokyonight_night.ron"; + }; + }; } diff --git a/home/tui/gitui.nix b/home/tui/gitui.nix deleted file mode 100644 index ed2d258f..00000000 --- a/home/tui/gitui.nix +++ /dev/null @@ -1,19 +0,0 @@ -{pkgs, ...}: { - programs.gitui = { - enable = true; - keyConfig = builtins.readFile (pkgs.fetchFromGitHub { - owner = "extrawurst"; - repo = "gitui"; - rev = "8f7f35b8a97e38a0e181032285554cd0961d588e"; - sha256 = "sha256-zJDf6WhaUe8QTPCoVAdfCdUvYEcQpm2qddQiKw41kjY="; - } - + "/vim_style_key_config.ron"); - theme = builtins.readFile (pkgs.fetchFromGitHub { - owner = "folke"; - repo = "tokyonight.nvim"; - rev = "1ee11019f8a81dac989ae1db1a013e3d582e2033"; - sha256 = "sha256-x26qLaZzg7sJIc1d/5Q/DJ/YvRSc3s87PwPHTPTl+Xk="; - } - + "/extras/gitui/tokyonight_night.ron"); - }; -} diff --git a/home/tui/neovim.nix b/home/tui/neovim.nix deleted file mode 100644 index b0d26f6a..00000000 --- a/home/tui/neovim.nix +++ /dev/null @@ -1,44 +0,0 @@ -{pkgs, ...}: { - programs.neovim = { - enable = true; - defaultEditor = true; - viAlias = true; - vimAlias = true; - vimdiffAlias = true; - withNodeJs = true; - withRuby = true; - withPython3 = true; - extraPackages = with pkgs; [ - # Misc utils - curl - fzf - git - gnutar - gnumake - gnused - gcc - ripgrep - tree-sitter - - # Language servers - nil - lua-language-server - fortls - nodePackages.pyright - nodePackages.yaml-language-server - nodePackages.vim-language-server - nodePackages.bash-language-server - - # Null LSP formatters - alejandra - beautysh - black - nodePackages.fixjson - fprettify - isort - python3Packages.mdformat - shellharden - stylua - ]; - }; -} diff --git a/hosts/Legion/home.nix b/hosts/Legion/home.nix index 2dd7ffef..a3749bee 100644 --- a/hosts/Legion/home.nix +++ b/hosts/Legion/home.nix @@ -1,8 +1,4 @@ -{ - pkgs, - shellConfig, - ... -}: let +{shellConfig, ...}: let username = "xenia"; homeDirectory = "/home/${username}"; in { @@ -16,8 +12,5 @@ in { inherit username homeDirectory; stateVersion = "22.11"; }; - programs = { - home-manager.enable = true; - neovim.package = pkgs.neovim-nightly; - }; + programs.home-manager.enable = true; } diff --git a/hosts/Ronin/home.nix b/hosts/Ronin/home.nix index a02f7457..35047a84 100644 --- a/hosts/Ronin/home.nix +++ b/hosts/Ronin/home.nix @@ -31,10 +31,7 @@ in { zoom-us ]; }; - programs = { - home-manager.enable = true; - neovim.package = pkgs.neovim-nightly; - }; + programs.home-manager.enable = true; services.kanshi = { enable = true; systemdTarget = "hyprland-session.target"; diff --git a/hosts/Vanguard/home.nix b/hosts/Vanguard/home.nix index 08254cc7..56446e12 100644 --- a/hosts/Vanguard/home.nix +++ b/hosts/Vanguard/home.nix @@ -1,8 +1,4 @@ -{ - pkgs, - shellConfig, - ... -}: let +{shellConfig, ...}: let username = "xenia"; homeDirectory = "/home/${username}"; in { @@ -17,10 +13,7 @@ in { inherit username homeDirectory; stateVersion = "22.11"; }; - programs = { - home-manager.enable = true; - neovim.package = pkgs.neovim-nightly; - }; + programs.home-manager.enable = true; xdg.configFile."hypr/display.conf".text = '' monitor=DP-1,highrr,auto,1 monitor=DP-2,highrr,auto,1 diff --git a/hosts/desktop.nix b/hosts/desktop.nix index c3967c73..12e4e1b6 100644 --- a/hosts/desktop.nix +++ b/hosts/desktop.nix @@ -1,10 +1,10 @@ { pkgs, - inputs, + hyprland, ... }: { imports = [ - inputs.hyprland.nixosModules.default + hyprland.nixosModules.default ./common.nix ]; environment.systemPackages = with pkgs; [