aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Hiar <cody@hiar.ca>2023-07-03 12:42:08 -0600
committerCody Hiar <cody@hiar.ca>2023-07-03 12:42:08 -0600
commit4e1d414208f7884d5b28ddbb99d75b134ad1087b (patch)
tree1802d25ddc2dd1ee5a37098b344171275fc69a37
parente2f6f268674a2c66cf57e9c5a1e4a81e30d8875f (diff)
Initial stab at adding multi architecture support
-rw-r--r--flake.lock34
-rw-r--r--flake.nix252
2 files changed, 162 insertions, 124 deletions
diff --git a/flake.lock b/flake.lock
index e1cbfa5..c516da4 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,5 +1,23 @@
{
"nodes": {
+ "flake-utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1687709756,
+ "narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
"nixpkgs": {
"locked": {
"lastModified": 1687898314,
@@ -17,8 +35,24 @@
},
"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",
diff --git a/flake.nix b/flake.nix
index d183620..b5f7ccd 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,138 +1,142 @@
{
description = "My Completely Inelegant Neovim Flake";
- inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; };
+ inputs = {
+ nixpkgs.url = "nixpkgs/nixos-unstable";
+ flake-utils.url = "github:numtide/flake-utils";
+ };
- outputs = { self, nixpkgs, ... }@inputs:
- let
- system = "x86_64-linux";
- pkgs = import nixpkgs {
- inherit system;
- # This is where I import any custom packages that I want to install. By
- # placing them in the overlay the become available in 'pkgs' further
- # below.
- overlays = [
- (self: super: {
- # Kept having issues with ones in stable and unstable so built custom revision
- vale = super.callPackage ./nix/vale.nix { };
- # Wasn't packaged
- flake8-isort =
- super.python3Packages.callPackage ./nix/flake8-isort.nix { };
- # Python with linting and such
- mypython = super.python3Packages.callPackage ./nix/mypython.nix { };
- # Wasn't packaged
- vim-angry-reviewer =
- super.callPackage ./nix/vim-angry-reviewer.nix { };
- })
- ];
- };
- in rec {
- # For nix < 2.7
- # For nix >= 2.7 they should grab automatically from:
- # apps.${system}.default
- # packages.${system}.default
- defaultApp.${system} = apps.${system}.default;
- defaultPackage.${system} = packages.${system}.default;
+ outputs = { self, nixpkgs, flake-utils, ... }:
+ flake-utils.lib.eachDefaultSystem (system:
+ let
+ pkgs = import nixpkgs {
+ inherit system;
+ # This is where I import any custom packages that I want to install. By
+ # placing them in the overlay the become available in 'pkgs' further
+ # below.
+ overlays = [
+ (self: super: {
+ # Kept having issues with ones in stable and unstable so built custom revision
+ vale = super.callPackage ./nix/vale.nix { };
+ # Wasn't packaged
+ flake8-isort =
+ super.python3Packages.callPackage ./nix/flake8-isort.nix { };
+ # Python with linting and such
+ mypython =
+ super.python3Packages.callPackage ./nix/mypython.nix { };
+ # Wasn't packaged
+ vim-angry-reviewer =
+ super.callPackage ./nix/vim-angry-reviewer.nix { };
+ })
+ ];
+ };
+ in rec {
+ # For nix < 2.7
+ # For nix >= 2.7 they should grab automatically from:
+ # apps.${system}.default
+ # packages.${system}.default
+ defaultApp = apps.${system}.default;
+ defaultPackage = packages.${system}.default;
- apps.${system} = rec {
- nvim = {
- type = "app";
- program = "${packages.${system}.default}/bin/nvim";
+ apps = rec {
+ nvim = flake-utils.lib.mkApp {
+ type = "app";
+ program = "${packages.${system}.default}/bin/nvim";
+ };
+ default = nvim;
};
- default = nvim;
- };
- packages.${system} = with pkgs;
- let
- # My custom neovim with my init file and all the plugins I use.
- myneovim = (neovim.override {
- configure = {
- # customRC expects vimscript but I've already converted to lua
- customRC = ''
- lua << EOF
- ${pkgs.lib.readFile ./init.lua}
- EOF
- " lua doesn't like the special characters
- nnoremap <leader>pl vipJV:s/[.!?] */& /g :noh
- let g:languagetool_server_command = '${languagetool}/bin/languagetool-http-server'
- '';
- packages.myPlugins = with vimPlugins; {
- start = [
- # Colorscheme
- gruvbox-nvim
+ packages = with pkgs;
+ let
+ # My custom neovim with my init file and all the plugins I use.
+ myneovim = (neovim.override {
+ configure = {
+ # customRC expects vimscript but I've already converted to lua
+ customRC = ''
+ lua << EOF
+ ${pkgs.lib.readFile ./init.lua}
+ EOF
+ " lua doesn't like the special characters
+ nnoremap <leader>pl vipJV:s/[.!?] */& /g :noh
+ let g:languagetool_server_command = '${languagetool}/bin/languagetool-http-server'
+ '';
+ packages.myPlugins = with vimPlugins; {
+ start = [
+ # Colorscheme
+ gruvbox-nvim
- # Syntax coloring
- nvim-ts-rainbow
- nvim-treesitter.withAllGrammars
+ # Syntax coloring
+ nvim-ts-rainbow
+ nvim-treesitter.withAllGrammars
- # Autocompletes
- nvim-lspconfig
- nvim-cmp
- cmp-nvim-lsp
+ # Autocompletes
+ nvim-lspconfig
+ nvim-cmp
+ cmp-nvim-lsp
- # File navigation
- lf-vim
- vim-floaterm
+ # File navigation
+ lf-vim
+ vim-floaterm
- # The rest
- vim-commentary
- vim-surround
- vim-repeat
- fzf-vim
- vim-argwrap
- vim-fugitive
- indent-blankline-nvim
- camelcasemotion
- hop-nvim
- ale
- goyo-vim
- vim-oscyank
- ack-vim
- vim-angry-reviewer
- LanguageTool-nvim
- camelcasemotion
- vim-table-mode
- vim-bufkill
- emmet-vim
- tagbar
- vim-markdown
- ];
+ # The rest
+ vim-commentary
+ vim-surround
+ vim-repeat
+ fzf-vim
+ vim-argwrap
+ vim-fugitive
+ indent-blankline-nvim
+ camelcasemotion
+ hop-nvim
+ ale
+ goyo-vim
+ vim-oscyank
+ ack-vim
+ vim-angry-reviewer
+ LanguageTool-nvim
+ camelcasemotion
+ vim-table-mode
+ vim-bufkill
+ emmet-vim
+ tagbar
+ vim-markdown
+ ];
+ };
};
+ });
+ in rec {
+ default = neovimCH;
+ # symlinkJoin might not be the best solution here but it worked so I
+ # just use it for now.
+ neovimCH = symlinkJoin {
+ name = "neovim";
+ paths = [ myneovim ];
+ buildInputs = [ pkgs.makeWrapper ];
+ postBuild = with pkgs; ''
+ rm $out/bin/nvim
+ BINPATH=${
+ lib.makeBinPath [
+ ctags
+ gcc
+ nodejs
+ mypython
+ pyright
+ vale
+ tree-sitter
+ nodePackages.bash-language-server
+ shellcheck
+ hadolint
+ nixfmt
+ languagetool
+ lf
+ terraform-ls
+ ansible-language-server
+ ansible-lint
+ ansible
+ ]
+ }
+ makeWrapper ${myneovim}/bin/nvim $out/bin/nvim --prefix PATH : $BINPATH
+ '';
};
- });
- in rec {
- default = neovimCH;
- # symlinkJoin might not be the best solution here but it worked so I
- # just use it for now.
- neovimCH = symlinkJoin {
- name = "neovim";
- paths = [ myneovim ];
- buildInputs = [ pkgs.makeWrapper ];
- postBuild = with pkgs; ''
- rm $out/bin/nvim
- BINPATH=${
- lib.makeBinPath [
- ctags
- gcc
- nodejs
- mypython
- pyright
- vale
- tree-sitter
- nodePackages.bash-language-server
- shellcheck
- hadolint
- nixfmt
- languagetool
- lf
- terraform-ls
- ansible-language-server
- ansible-lint
- ansible
- ]
- }
- makeWrapper ${myneovim}/bin/nvim $out/bin/nvim --prefix PATH : $BINPATH
- '';
};
- };
- };
+ });
}