diff --git a/flake.nix b/flake.nix index 93c91be..4d351ae 100644 --- a/flake.nix +++ b/flake.nix @@ -53,107 +53,84 @@ nix-secrets = { url = "git+ssh://git@git.bitlab21.com/sam/nix-secrets.git"; - inputs = { }; + inputs = {}; }; }; - outputs = - { self - , nixpkgs - , home-manager - , ... - } @ inputs: - let - inherit (self) outputs; - systems = [ - "x86_64-linux" - ]; - forAllSystems = nixpkgs.lib.genAttrs systems; - inherit (nixpkgs) lib; - configVars = import ./vars { inherit inputs lib; }; - specialArgs = { - inherit - inputs - outputs - configVars - ; }; - in - { - packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); -#formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); - overlays = import ./overlays { inherit inputs; }; - nixosModules = import ./modules/nixos; - homeManagerModules = import ./modules/home-manager; + outputs = { + self, + nixpkgs, + home-manager, + ... + } @ inputs: let + inherit (self) outputs; + systems = [ + "x86_64-linux" + ]; + forAllSystems = nixpkgs.lib.genAttrs systems; + inherit (nixpkgs) lib; + configVars = import ./vars {inherit inputs lib;}; + specialArgs = { + inherit + inputs + outputs + configVars + ; + }; + in { + packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); + overlays = import ./overlays {inherit inputs;}; + nixosModules = import ./modules/nixos; + homeManagerModules = import ./modules/home-manager; - - # System level configs - nixosConfigurations = { - nixdev = nixpkgs.lib.nixosSystem { - inherit specialArgs; - modules = [ - ./hosts/nixdev - home-manager.nixosModules.home-manager - { - home-manager.extraSpecialArgs = specialArgs; - } - ]; - }; - fileserver = nixpkgs.lib.nixosSystem { - inherit specialArgs; - modules = [ - ./hosts/fileserver - home-manager.nixosModules.home-manager - { - home-manager.extraSpecialArgs = specialArgs; - } - ]; - }; - bootstrap = nixpkgs.lib.nixosSystem { - inherit specialArgs; - modules = [ - ./hosts/bootstrap - ]; - }; - sparky = nixpkgs.lib.nixosSystem { - inherit specialArgs; - modules = [ - ./hosts/sparky - home-manager.nixosModules.home-manager - { - home-manager.extraSpecialArgs = specialArgs; - } - ]; - }; - semita = nixpkgs.lib.nixosSystem { - inherit specialArgs; - modules = [ - ./hosts/semita - home-manager.nixosModules.home-manager - { - home-manager.extraSpecialArgs = specialArgs; - } - ]; - }; - merlin = nixpkgs.lib.nixosSystem { - inherit specialArgs; - modules = [ - ./hosts/nebula - home-manager.nixosModules.home-manager - { - home-manager.extraSpecialArgs = specialArgs; - } - ]; - }; - citadel = nixpkgs.lib.nixosSystem { - inherit specialArgs; - modules = [ - ./hosts/citadel - home-manager.nixosModules.home-manager - { - home-manager.extraSpecialArgs = specialArgs; - } - ]; - }; + # System level configs + nixosConfigurations = { + bootstrap = nixpkgs.lib.nixosSystem { + inherit specialArgs; + modules = [ + ./hosts/bootstrap + ]; + }; + sparky = nixpkgs.lib.nixosSystem { + inherit specialArgs; + modules = [ + ./hosts/sparky + home-manager.nixosModules.home-manager + { + home-manager.extraSpecialArgs = specialArgs; + } + ]; + }; + semita = nixpkgs.lib.nixosSystem { + inherit specialArgs; + modules = [ + ./hosts/semita + home-manager.nixosModules.home-manager + { + home-manager.extraSpecialArgs = specialArgs; + } + ]; + }; + merlin = nixpkgs.lib.nixosSystem { + inherit specialArgs; + modules = [ + ./hosts/nebula + home-manager.nixosModules.home-manager + { + home-manager.extraSpecialArgs = specialArgs; + } + ]; + }; + citadel = nixpkgs.lib.nixosSystem { + inherit specialArgs; + modules = [ + ./hosts/citadel + home-manager.nixosModules.home-manager + { + home-manager.extraSpecialArgs = specialArgs; + } + ]; }; }; + }; } diff --git a/home/common/core/nixvim/plugins/lsp.nix b/home/common/core/nixvim/plugins/lsp.nix index 702b482..840f01c 100644 --- a/home/common/core/nixvim/plugins/lsp.nix +++ b/home/common/core/nixvim/plugins/lsp.nix @@ -1,3 +1,7 @@ +{ osConfig , ... }: +let + hostname = osConfig.networking.hostName; +in { programs.nixvim.plugins = { lsp = { @@ -10,8 +14,9 @@ settings = { nixpkgs.expr = "import { }"; options = { - nixos.expr = "(builtins.getFlake ('git+file://' + toString ./.)).nixosConfigurations.k-on.options"; - home_manager.expr = "(builtins.getFlake ('git+file://' + toString ./.)).homeConfigurations.'ruixi@k-on'.options"; + nixos.expr = "(builtins.getFlake \"/etc/nixos\").nixosConfigurations.${hostname}.options"; + # TODO get home-manager options working when hm imported as submodule + # home_manager.expr = "(builtins.getFlake \"github:nix-community/home-manager\").homeConfigurations.${hostname}.options"; }; }; }; diff --git a/home/common/optional/desktop/dwm/default.nix b/home/common/optional/desktop/dwm/default.nix index cca4af7..3142da2 100644 --- a/home/common/optional/desktop/dwm/default.nix +++ b/home/common/optional/desktop/dwm/default.nix @@ -32,6 +32,7 @@ ./scripts/dmenu-wifi.nix ./scripts/battery-status.nix ./scripts/dmenu-set-wm-class.nix + ./scripts/key-remaps.nix ]; home.packages = [ diff --git a/home/common/optional/desktop/dwm/scripts/key-remaps.nix b/home/common/optional/desktop/dwm/scripts/key-remaps.nix new file mode 100644 index 0000000..b0493bb --- /dev/null +++ b/home/common/optional/desktop/dwm/scripts/key-remaps.nix @@ -0,0 +1,11 @@ +{pkgs, ...}: { + home.packages = with pkgs; [ + (writeShellScriptBin "key-remaps" '' + ${xorg.xmodmap}/bin/xmodmap -e "keycode 64 = Mode_switch" + ${xorg.xmodmap}/bin/xmodmap -e "keycode 43 = h H Left H" + ${xorg.xmodmap}/bin/xmodmap -e "keycode 44 = j J Down J" + ${xorg.xmodmap}/bin/xmodmap -e "keycode 45 = k K Up K" + ${xorg.xmodmap}/bin/xmodmap -e "keycode 46 = l L Right L" + '') + ]; +} diff --git a/home/common/optional/desktop/dwm/xinitrc.nix b/home/common/optional/desktop/dwm/xinitrc.nix index 1c5adb4..07bd586 100644 --- a/home/common/optional/desktop/dwm/xinitrc.nix +++ b/home/common/optional/desktop/dwm/xinitrc.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{...}: { # TODO: configure x11 to look in .config/x11 home.file.".xinitrc" = { recursive = true; @@ -7,7 +7,7 @@ picom -b --config ~/.config/picom/picom.conf xrdb -merge ~/.Xresources - autostart="clipboard-save dwmblocks feh-wallpaper-changer sxhkd" + autostart="clipboard-save dwmblocks feh-wallpaper-changer sxhkd key-remaps" for program in $autostart; do pidof -sx "$program" || "$program" & diff --git a/hosts/citadel/default.nix b/hosts/citadel/default.nix index acc9b77..972fa3e 100644 --- a/hosts/citadel/default.nix +++ b/hosts/citadel/default.nix @@ -77,13 +77,14 @@ in { xkb.options = "caps:swapescape"; dpi = 196; upscaleDefaultCursor = true; - displayManager.sessionCommands = pkgs.writeShellScriptBin "key-remaps" '' - ${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 64 = Mode_switch" - ${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 43 = h H Left H" - ${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 44 = j J Down J" - ${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 45 = k K Up K" - ${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 46 = l L Right L" - ''; + # FIXME this doesnt work for some reason + # displayManager.sessionCommands = pkgs.writeShellScriptBin "key-remaps" '' + # ${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 64 = Mode_switch" + # ${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 43 = h H Left H" + # ${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 44 = j J Down J" + # ${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 45 = k K Up K" + # ${pkgs.xorg.xmodmap}/bin/xmodmap -e "keycode 46 = l L Right L" + # ''; }; };