diff --git a/.gitignore b/.gitignore index 0926b1a6..8a20a613 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ ./.luarc.json +result/ .luarc.json diff --git a/config/default.nix b/config/default.nix index 4ce70dab..8f7635c9 100644 --- a/config/default.nix +++ b/config/default.nix @@ -1,4 +1,4 @@ -{ pkgs, config, ... }: +{ pkgs, config, bob, ... }: let dotsDir = "${config.home.homeDirectory}/.dot_files/dots"; softLinkDots = dir: @@ -18,7 +18,7 @@ in programs.home-manager.enable = true; home = { packages = with pkgs; [ - gcc + bob.packages.${pkgs.system}.default sqlite luajit imagemagick diff --git a/flake.lock b/flake.lock index 42797553..01721743 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,40 @@ { "nodes": { + "bob": { + "inputs": { + "bob": "bob_2", + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1, + "narHash": "sha256-dRRtI4CfEMyPwPv8zwKkSfOZaGGsXVoUg2Lgp0yIj2M=", + "path": "./pkgs/bob-nvim", + "type": "path" + }, + "original": { + "path": "./pkgs/bob-nvim", + "type": "path" + } + }, + "bob_2": { + "flake": false, + "locked": { + "lastModified": 1702230475, + "narHash": "sha256-UwfFcYi193P/8jFMSrYKGQMsnhfnAHCWCQgOcwIYXNk=", + "owner": "MordechaiHadad", + "repo": "bob", + "rev": "6c2d6d83317b3ca2b4b20b27475e212a8cb7b7df", + "type": "github" + }, + "original": { + "owner": "MordechaiHadad", + "repo": "bob", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -62,6 +97,24 @@ "inputs": { "systems": "systems" }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "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=", @@ -120,7 +173,7 @@ }, "neovim-flake": { "inputs": { - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "nixpkgs": [ "neovim-nightly-overlay", "nixpkgs" @@ -198,6 +251,7 @@ }, "root": { "inputs": { + "bob": "bob", "home-manager": "home-manager", "neovim-nightly-overlay": "neovim-nightly-overlay", "nixpkgs": "nixpkgs_2" @@ -217,6 +271,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 2731d6b6..4187e3bd 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,10 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + bob = { + url = "path:./pkgs/bob-nvim"; + inputs.nixpkgs.follows = "nixpkgs"; + }; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; @@ -10,7 +14,7 @@ neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; }; - outputs = inputs @ { home-manager, nixpkgs, ... }: + outputs = inputs @ { home-manager, bob, nixpkgs, ... }: let system = "x86_64-linux"; username = "sam"; @@ -20,6 +24,9 @@ targets.genericLinux.enable = true; homeConfigurations.${username} = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.${system}; + extraSpecialArgs = { + inherit bob; + }; modules = [ ({ nixpkgs.overlays = [ diff --git a/pkgs/bob-nvim/flake.nix b/pkgs/bob-nvim/flake.nix new file mode 100644 index 00000000..8b5377c1 --- /dev/null +++ b/pkgs/bob-nvim/flake.nix @@ -0,0 +1,48 @@ +{ + description = "Flake for bob-nvim, a Neovim version manager."; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + bob = { + flake = false; + url = "github:MordechaiHadad/bob"; + }; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils, bob }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + rust-toolchain = pkgs.symlinkJoin { + name = "rust-toolchain"; + paths = with pkgs; [ + rustc + cargo + cargo-watch + rust-analyzer + rustfmt + ]; + }; + in + rec { + # This builds the blog binary then runs it and collects the output. Once done it throws away the binary and + # shoves the newly created static site into the result. + packages.default = pkgs.rustPlatform.buildRustPackage { + name = "bob-nvim"; + pname = "bob"; + src = "${bob}"; + cargoLock.lockFile = "${bob}/Cargo.lock"; + }; + + overlays.default = packages.default; + # Rust dev environment + devShells.default = pkgs.mkShell { + shellHook = '' + # For rust-analyzer 'hover' tooltips to work. + export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc} + ''; + nativeBuildInputs = [ rust-toolchain ]; + }; + }); +}