diff --git a/flake.nix b/flake.nix index 4e95e9a..6f26f62 100644 --- a/flake.nix +++ b/flake.nix @@ -17,56 +17,59 @@ nixvim.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = { - self, - nixpkgs, - home-manager, - nixvim, - ... - } @ inputs: let - inherit (self) outputs; - # Supported systems for your flake packages, shell, etc. - systems = [ - "x86_64-linux" - ]; - # This is a function that generates an attribute by calling a function you - # pass to it, with each system as an argument - forAllSystems = nixpkgs.lib.genAttrs systems; - in { - # Your custom packages - # Accessible through 'nix build', 'nix shell', etc - packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); + outputs = + { + self, + nixpkgs, + home-manager, + nixvim, + ... + }@inputs: + let + inherit (self) outputs; + # Supported systems for your flake packages, shell, etc. + systems = [ + "x86_64-linux" + ]; + # This is a function that generates an attribute by calling a function you + # pass to it, with each system as an argument + forAllSystems = nixpkgs.lib.genAttrs systems; + in + { + # Your custom packages + # Accessible through 'nix build', 'nix shell', etc + packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); - # Your custom packages and modifications, exported as overlays - overlays = import ./overlays {inherit inputs;}; - # Reusable nixos modules you might want to export - # These are usually stuff you would upstream into nixpkgs - nixosModules = import ./modules/nixos; - # Reusable home-manager modules you might want to export - # These are usually stuff you would upstream into home-manager - homeManagerModules = import ./modules/home-manager; + # Your custom packages and modifications, exported as overlays + overlays = import ./overlays { inherit inputs; }; + # Reusable nixos modules you might want to export + # These are usually stuff you would upstream into nixpkgs + nixosModules = import ./modules/nixos; + # Reusable home-manager modules you might want to export + # These are usually stuff you would upstream into home-manager + homeManagerModules = import ./modules/home-manager; - # NixOS configuration entrypoint - # Available through 'nixos-rebuild --flake .#your-hostname' - nixosConfigurations = { - desktop = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [ - ./nixos/configuration.nix - ]; + # NixOS configuration entrypoint + # Available through 'nixos-rebuild --flake .#your-hostname' + nixosConfigurations = { + desktop = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs outputs; }; + modules = [ + ./nixos/configuration.nix + ]; + }; + }; + + # Standalone home-manager configuration entrypoint + # Available through 'home-manager --flake .#your-username@your-hostname' + homeConfigurations = { + "leonhard@desktop" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance + extraSpecialArgs = { inherit inputs outputs; }; + modules = [ + ./home-manager/home.nix + ]; + }; }; }; - - # Standalone home-manager configuration entrypoint - # Available through 'home-manager --flake .#your-username@your-hostname' - homeConfigurations = { - "leonhard@desktop" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance - extraSpecialArgs = {inherit inputs outputs;}; - modules = [ - ./home-manager/home.nix - ]; - }; - }; - }; } diff --git a/home-manager/home.nix b/home-manager/home.nix index 6babe0d..3be937f 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -1,12 +1,11 @@ # This is your home-manager configuration file # Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) -{ inputs -, outputs -, lib -, config -, pkgs -, ... -}: { +{ + inputs, + outputs, + ... +}: +{ # You can import other home-manager modules here imports = [ outputs.homeManagerModules diff --git a/modules/home-manager/fish.nix b/modules/home-manager/fish.nix index 1ec1e34..8842343 100644 --- a/modules/home-manager/fish.nix +++ b/modules/home-manager/fish.nix @@ -1,8 +1,9 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ home.packages = with pkgs; [ fishPlugins.tide ]; - + programs.fish = { enable = true; interactiveShellInit = '' diff --git a/modules/home-manager/git.nix b/modules/home-manager/git.nix index 1d4288d..344bf1b 100644 --- a/modules/home-manager/git.nix +++ b/modules/home-manager/git.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ home.packages = with pkgs; [ git-credential-manager ]; diff --git a/modules/home-manager/nixvim/plugins/cmp.nix b/modules/home-manager/nixvim/plugins/cmp.nix index 6494b64..bff81db 100644 --- a/modules/home-manager/nixvim/plugins/cmp.nix +++ b/modules/home-manager/nixvim/plugins/cmp.nix @@ -1,6 +1,10 @@ { programs.nixvim = { - opts.completeopt = ["menu" "menuone" "noselect"]; + opts.completeopt = [ + "menu" + "menuone" + "noselect" + ]; plugins = { luasnip.enable = true; @@ -42,16 +46,18 @@ "" = "cmp.mapping.confirm({ select = true })"; "" = "cmp.mapping.confirm({ select = true })"; "" = "cmp.mapping.complete()"; - "" = ''cmp.mapping(function() - if luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - end - end, {'i', 's'})''; - "" = ''cmp.mapping(function() - if luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - end - end, {'i', 's'})''; + "" = '' + cmp.mapping(function() + if luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + end + end, {'i', 's'})''; + "" = '' + cmp.mapping(function() + if luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + end + end, {'i', 's'})''; }; sources = [ diff --git a/modules/home-manager/nixvim/plugins/default.nix b/modules/home-manager/nixvim/plugins/default.nix index 3c49641..4cc3db4 100644 --- a/modules/home-manager/nixvim/plugins/default.nix +++ b/modules/home-manager/nixvim/plugins/default.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ imports = [ ./cmp.nix ./lsp.nix diff --git a/modules/home-manager/nixvim/plugins/lualine.nix b/modules/home-manager/nixvim/plugins/lualine.nix index 799b4da..416ddf2 100644 --- a/modules/home-manager/nixvim/plugins/lualine.nix +++ b/modules/home-manager/nixvim/plugins/lualine.nix @@ -13,8 +13,8 @@ icon = ""; } ]; - lualine_c = ["filename"]; - lualine_x = ["filetype"]; + lualine_c = [ "filename" ]; + lualine_x = [ "filetype" ]; }; }; }; diff --git a/modules/home-manager/nixvim/plugins/treesitter.nix b/modules/home-manager/nixvim/plugins/treesitter.nix index 1a5fcce..7f714de 100644 --- a/modules/home-manager/nixvim/plugins/treesitter.nix +++ b/modules/home-manager/nixvim/plugins/treesitter.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ programs.nixvim = { plugins.treesitter = { enable = true; diff --git a/modules/nixos/fish.nix b/modules/nixos/fish.nix index 8607554..1093472 100644 --- a/modules/nixos/fish.nix +++ b/modules/nixos/fish.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ programs.fish.enable = true; users.defaultUserShell = pkgs.fish; } diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 7870098..1e148f0 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -7,7 +7,8 @@ config, pkgs, ... -}: { +}: +{ imports = [ ./hardware-configuration.nix outputs.nixosModules @@ -24,24 +25,26 @@ }; }; - nix = let - flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs; - in { - settings = { - # Enable flakes and new 'nix' command - experimental-features = "nix-command flakes"; - # Opinionated: disable global registry - flake-registry = ""; - # Workaround for https://github.com/NixOS/nix/issues/9574 - nix-path = config.nix.nixPath; - }; - # Opinionated: disable channels - channel.enable = false; + nix = + let + flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs; + in + { + settings = { + # Enable flakes and new 'nix' command + experimental-features = "nix-command flakes"; + # Opinionated: disable global registry + flake-registry = ""; + # Workaround for https://github.com/NixOS/nix/issues/9574 + nix-path = config.nix.nixPath; + }; + # Opinionated: disable channels + channel.enable = false; - # Opinionated: make flake registry and nix path match flake inputs - registry = lib.mapAttrs (_: flake: {inherit flake;}) flakeInputs; - nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs; - }; + # Opinionated: make flake registry and nix path match flake inputs + registry = lib.mapAttrs (_: flake: { inherit flake; }) flakeInputs; + nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs; + }; environment.systemPackages = with pkgs; [ vim @@ -103,7 +106,7 @@ # Be sure to change it (using passwd) after rebooting! initialPassword = "correcthorsebatterystaple"; isNormalUser = true; - extraGroups = ["wheel"]; + extraGroups = [ "wheel" ]; }; }; diff --git a/nixos/hardware-configuration.nix b/nixos/hardware-configuration.nix index 514ff16..55b7d48 100644 --- a/nixos/hardware-configuration.nix +++ b/nixos/hardware-configuration.nix @@ -1,23 +1,35 @@ -{ config, lib, pkgs, modulesPath, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { imports = [ ]; - boot.initrd.availableKernelModules = [ "sd_mod" "sr_mod" ]; + boot.initrd.availableKernelModules = [ + "sd_mod" + "sr_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/0eb29109-abd1-49af-859a-1c5009e2482f"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/0eb29109-abd1-49af-859a-1c5009e2482f"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/EE00-3849"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/EE00-3849"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" + ]; + }; swapDevices = [ ]; diff --git a/overlays/default.nix b/overlays/default.nix index 7bfcb4c..5e370cc 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,5 +1,6 @@ # This file defines overlays -{inputs, ...}: { +{ inputs, ... }: +{ # This one brings our custom packages from the 'pkgs' directory additions = final: _prev: import ../pkgs final.pkgs;