From 79cb717ee536811ddfab24b885a434d050f03966 Mon Sep 17 00:00:00 2001 From: Yadunand Prem Date: Wed, 24 Apr 2024 11:13:31 +0800 Subject: [PATCH] feat: add everything --- falcon-nixos/flake.nix | 19 ++++---- falcon-nixos/home.nix | 38 ++++++++++----- flake.lock | 102 +++++++++++++++++++++++++++++++++++++++-- flake.nix | 30 +++++++++--- modules/git.nix | 3 -- modules/neovim.nix | 2 + modules/zsh.nix | 35 +++++++------- yadunut-mbp/home.nix | 10 +++- 8 files changed, 187 insertions(+), 52 deletions(-) diff --git a/falcon-nixos/flake.nix b/falcon-nixos/flake.nix index b07313d..12a2445 100644 --- a/falcon-nixos/flake.nix +++ b/falcon-nixos/flake.nix @@ -6,6 +6,7 @@ agenix.url = "github:ryantm/agenix"; home-manager.url = "github:nix-community/home-manager/release-23.11"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-utils.url = "github:numtide/flake-utils"; }; outputs = { self, nixpkgs, home-manager, agenix, ... }@inputs: { @@ -13,15 +14,15 @@ system = "x86_64-linux"; modules = [ - ./configuration.nix - agenix.nixosModules.default - { _module.args = { inherit inputs; };} - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.yadunut = import ./home.nix; - } + ./configuration.nix + agenix.nixosModules.default + { _module.args = { inherit inputs; };} + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.yadunut = import ./home.nix; + } ]; }; }; diff --git a/falcon-nixos/home.nix b/falcon-nixos/home.nix index 702f32c..0477a4f 100644 --- a/falcon-nixos/home.nix +++ b/falcon-nixos/home.nix @@ -7,26 +7,42 @@ ripgrep ]; - programs.zsh.enable = true; - programs.zoxide.enable = true; - programs.zoxide.enableZshIntegration = true; - programs.starship.enable = true; + imports = [ + (import ../modules/zsh.nix) + (import ../modules/git.nix) + (import ../modules/neovim.nix) + ]; + + programs.direnv = { + enable = true; + enableZshIntegration = true; + nix-direnv.enable = true; + config = { + hide_env_diff = true; + }; + }; + programs.home-manager.enable = true; programs.lazygit.enable = true; programs.git = { - enable = true; - userName = "Yadunand Prem"; - userEmail = "yadunand@yadunut.com"; - delta.enable = true; - lfs.enable = true; extraConfig = { - commit.gpgsign = true; - gpg.format = "ssh"; user.signingkey = "~/.ssh/id_ed25519.pub"; }; }; + programs.tmux = { + enable = true; + newSession = true; + mouse = true; + keyMode = "vi"; + plugins = with pkgs.tmuxPlugins; [ + sensible + sessionist + pain-control + ]; + }; + home.stateVersion = "23.11"; } diff --git a/flake.lock b/flake.lock index 685f70e..3548c2c 100644 --- a/flake.lock +++ b/flake.lock @@ -1,8 +1,51 @@ { "nodes": { + "agenix": { + "inputs": { + "darwin": "darwin", + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "systems": "systems" + }, + "locked": { + "lastModified": 1712079060, + "narHash": "sha256-/JdiT9t+zzjChc5qQiF+jhrVhRt8figYH29rZO7pFe4=", + "owner": "ryantm", + "repo": "agenix", + "rev": "1381a759b205dff7a6818733118d02253340fd5e", + "type": "github" + }, + "original": { + "owner": "ryantm", + "repo": "agenix", + "type": "github" + } + }, + "darwin": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1700795494, + "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, "flake-utils": { "inputs": { - "systems": "systems" + "systems": "systems_2" }, "locked": { "lastModified": 1710146030, @@ -19,6 +62,27 @@ } }, "home-manager": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703113217, + "narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { "inputs": { "nixpkgs": [ "nixpkgs" @@ -39,6 +103,22 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 1703013332, + "narHash": "sha256-+tFNwMvlXLbJZXiMHqYq77z/RfmpfpiI3yjL6o/Zo9M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "54aac082a4d9bb5bbc5c4e899603abfb76a3f6d6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1712608508, "narHash": "sha256-vMZ5603yU0wxgyQeHJryOI+O61yrX2AHwY6LOFyV1gM=", @@ -56,9 +136,10 @@ }, "root": { "inputs": { + "agenix": "agenix", "flake-utils": "flake-utils", - "home-manager": "home-manager", - "nixpkgs": "nixpkgs" + "home-manager": "home-manager_2", + "nixpkgs": "nixpkgs_2" } }, "systems": { @@ -75,6 +156,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 35c4d32..f22452d 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,7 @@ inputs = { # Specify the source of Home Manager and Nixpkgs. nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + agenix.url = "github:ryantm/agenix"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; @@ -11,16 +12,31 @@ flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { nixpkgs, home-manager, flake-utils, ... }: { + outputs = { nixpkgs, home-manager, flake-utils, agenix, ... }@inputs: { homeConfigurations."yadunut@yadunut-mbp" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.aarch64-darwin; + pkgs = import nixpkgs { + system = "aarch64-darwin"; + config = { + allowUnfree = true; + }; + }; + modules = [ ./yadunut-mbp/home.nix ]; + }; - # Specify your home configuration modules here, for example, - # the path to your home.nix. - modules = [ ./yadunut-mbp/home.nix ./modules/zsh.nix ./modules/neovim.nix ./modules/git.nix ]; + nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; - # Optionally use extraSpecialArgs - # to pass through arguments to home.nix + modules = [ + ./configuration.nix + agenix.nixosModules.default + { _module.args = { inherit inputs; };} + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.yadunut = import ./home.nix; + } + ]; }; }; } diff --git a/modules/git.nix b/modules/git.nix index 73fb921..6213406 100644 --- a/modules/git.nix +++ b/modules/git.nix @@ -13,11 +13,8 @@ rebase.autostash = true; - core.excludefile = "~/.gitignore_global"; - push.autoSetupRemote = true; - commit.gpgsign = true; commit.verbose = true; diff --git a/modules/neovim.nix b/modules/neovim.nix index 8ca626e..4ed6403 100644 --- a/modules/neovim.nix +++ b/modules/neovim.nix @@ -3,6 +3,8 @@ programs.neovim = { enable = true; defaultEditor = true; + viAlias = true; + vimAlias = true; # extraLuaConfig = '' ''; # extraPackages = [ ]; }; diff --git a/modules/zsh.nix b/modules/zsh.nix index 4797241..4bc3233 100644 --- a/modules/zsh.nix +++ b/modules/zsh.nix @@ -1,13 +1,12 @@ { config, pkgs, ... }: { - - home.packages = [ - pkgs.zsh-completions - pkgs.bat - pkgs.fd - pkgs.htop - pkgs.ripgrep - pkgs.wget + home.packages = with pkgs; [ + zsh-completions + bat + fd + htop + ripgrep + wget ]; programs.zsh = { enable = true; @@ -17,17 +16,17 @@ editor.dotExpansion = true; pmodules = [ "environment" - "terminal" - "utility" - "directory" - "editor" - "history" - "syntax-highlighting" - "history-substring-search" - "autosuggestions" - "completion" + "terminal" + "utility" + "directory" + "editor" + "history" + "syntax-highlighting" + "history-substring-search" + "autosuggestions" + "completion" ]; - }; + }; shellAliases = { cat = "bat"; diff = "delta"; diff --git a/yadunut-mbp/home.nix b/yadunut-mbp/home.nix index 0878d07..e5f1574 100644 --- a/yadunut-mbp/home.nix +++ b/yadunut-mbp/home.nix @@ -1,6 +1,11 @@ { config, pkgs, ... }: { + imports = [ + (import ../modules/zsh.nix) + (import ../modules/git.nix) + (import ../modules/neovim.nix) + ]; # Home Manager needs a bit of information about you and the paths it should # manage. home.username = "yadunut"; @@ -25,6 +30,7 @@ pkgs.entr pkgs.fava pkgs.typst + pkgs.typst-lsp pkgs.lazygit # Neovim deps @@ -43,7 +49,8 @@ # (pkgs.writeShellScriptBin "my-hello" '' # echo "Hello, ${config.home.username}!" # '') - ]; + ]; + # Home Manager is pretty good at managing dotfiles. The primary way to manage # plain files is through 'home.file'. @@ -85,6 +92,7 @@ programs.git.extraConfig = { gpg.ssh.program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign"; user.signingkey = "~/.ssh/yadunut_ed25519.pub"; + core.excludesFile = "~/.gitignore_global"; }; programs.gh = {