[fix] fmt: change formatter to nixfmt-rfc-style
Alejandra has ads and splits files into too many new lines.
This commit is contained in:
parent
711c1aa81d
commit
91284a73ca
28 changed files with 800 additions and 742 deletions
|
@ -1,41 +1,38 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
}: let
|
||||
{ pkgs, lib }:
|
||||
let
|
||||
# can be removed once https://github.com/rust-lang/mdBook/pull/2262 lands
|
||||
highlight = pkgs.fetchurl {
|
||||
url = "https://raw.githubusercontent.com/rust-lang/mdBook/7b9bd5049ce15ae5f301d5a40c50ce8359d9e9a8/src/theme/highlight.js";
|
||||
hash = "sha256-pLP73zlmGkbC/zV6bwnB6ijRf9gVkj5/VYMGLhiQ1/Q=";
|
||||
};
|
||||
filterVisible = toplevelOption: option:
|
||||
option // {visible = option.visible && builtins.elemAt option.loc 0 == toplevelOption;};
|
||||
filterVisible =
|
||||
toplevelOption: option:
|
||||
option // { visible = option.visible && builtins.elemAt option.loc 0 == toplevelOption; };
|
||||
home-eval = lib.evalModules {
|
||||
modules = [../home/options.nix];
|
||||
modules = [ ../home/options.nix ];
|
||||
specialArgs = {
|
||||
inherit pkgs;
|
||||
};
|
||||
};
|
||||
nvim-eval = lib.evalModules {modules = [../nvim/options.nix];};
|
||||
nixos-eval = lib.evalModules {modules = [../system/options.nix];};
|
||||
nvim-eval = lib.evalModules { modules = [ ../nvim/options.nix ]; };
|
||||
nixos-eval = lib.evalModules { modules = [ ../system/options.nix ]; };
|
||||
home-markdown =
|
||||
(pkgs.nixosOptionsDoc {
|
||||
inherit (home-eval) options;
|
||||
transformOptions = filterVisible "jhome";
|
||||
})
|
||||
.optionsCommonMark;
|
||||
}).optionsCommonMark;
|
||||
nvim-markdown =
|
||||
(pkgs.nixosOptionsDoc {
|
||||
inherit (nvim-eval) options;
|
||||
transformOptions = filterVisible "jhome";
|
||||
})
|
||||
.optionsCommonMark;
|
||||
}).optionsCommonMark;
|
||||
nixos-markdown =
|
||||
(pkgs.nixosOptionsDoc {
|
||||
inherit (nixos-eval) options;
|
||||
transformOptions = filterVisible "jconfig";
|
||||
})
|
||||
.optionsCommonMark;
|
||||
in {
|
||||
}).optionsCommonMark;
|
||||
in
|
||||
{
|
||||
inherit nixos-markdown nvim-markdown home-markdown;
|
||||
docs = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "nixos-configuration-book";
|
||||
|
@ -57,7 +54,7 @@ in {
|
|||
sed -f sed-cmds <${nixos-markdown} >> ./src/nixos-options.md
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [pkgs.mdbook-toc];
|
||||
nativeBuildInputs = [ pkgs.mdbook-toc ];
|
||||
buildPhase = "${pkgs.mdbook}/bin/mdbook build --dest-dir $out";
|
||||
};
|
||||
}
|
||||
|
|
381
flake.nix
381
flake.nix
|
@ -63,206 +63,207 @@
|
|||
};
|
||||
|
||||
# Flake outputs that other flakes can use
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
unstable,
|
||||
stylix,
|
||||
home-manager,
|
||||
nixos-hardware,
|
||||
jpassmenu,
|
||||
audiomenu,
|
||||
nixvim,
|
||||
lix-module,
|
||||
...
|
||||
}: let
|
||||
inherit (nixpkgs) lib;
|
||||
# Helpers for producing system-specific outputs
|
||||
supportedSystems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
forEachSupportedSystem = f:
|
||||
nixpkgs.lib.genAttrs supportedSystems (
|
||||
system:
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
unstable,
|
||||
stylix,
|
||||
home-manager,
|
||||
nixos-hardware,
|
||||
jpassmenu,
|
||||
audiomenu,
|
||||
nixvim,
|
||||
lix-module,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
# Helpers for producing system-specific outputs
|
||||
supportedSystems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
forEachSupportedSystem =
|
||||
f:
|
||||
nixpkgs.lib.genAttrs supportedSystems (
|
||||
system:
|
||||
f {
|
||||
inherit system;
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
}
|
||||
);
|
||||
overlays = builtins.attrValues self.overlays;
|
||||
in {
|
||||
checks = forEachSupportedSystem (
|
||||
{
|
||||
pkgs,
|
||||
system,
|
||||
}: let
|
||||
src = builtins.path {
|
||||
path = ./.;
|
||||
name = "configuration.nix";
|
||||
};
|
||||
runCmdInSrc = name: cmd:
|
||||
pkgs.runCommandNoCC name {} ''
|
||||
cd ${src}
|
||||
${cmd}
|
||||
mkdir $out
|
||||
'';
|
||||
in {
|
||||
nvim = nixvim.lib.${system}.check.mkTestDerivationFromNixvimModule {
|
||||
pkgs = import nixpkgs {inherit system overlays;};
|
||||
module = ./nvim/standalone.nix;
|
||||
};
|
||||
fmt = runCmdInSrc "fmt-src" "${lib.getExe self.formatter.${system}} --check .";
|
||||
lint = runCmdInSrc "lint-src" "${lib.getExe pkgs.statix} check .";
|
||||
typos = runCmdInSrc "typos-src" "${lib.getExe pkgs.typos} .";
|
||||
}
|
||||
);
|
||||
|
||||
packages = forEachSupportedSystem (
|
||||
{
|
||||
pkgs,
|
||||
system,
|
||||
}: {
|
||||
inherit
|
||||
(import ./docs {inherit pkgs lib;})
|
||||
docs
|
||||
nixos-markdown
|
||||
nvim-markdown
|
||||
home-markdown
|
||||
;
|
||||
# Nvim standalone module
|
||||
nvim = nixvim.legacyPackages.${system}.makeNixvimWithModule {
|
||||
pkgs = import nixpkgs {inherit system overlays;};
|
||||
module = ./nvim/standalone.nix;
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
# Provide necessary overlays
|
||||
overlays = {
|
||||
nixvim = nixvim.overlays.default;
|
||||
jpassmenu = jpassmenu.overlays.default;
|
||||
audiomenu = audiomenu.overlays.default;
|
||||
unstable = final: prev: let
|
||||
unstablePkgs = unstable.legacyPackages.${prev.system};
|
||||
in {
|
||||
# Get unstable packages
|
||||
unstable = unstablePkgs;
|
||||
# Update vim plugins with the versions from unstable
|
||||
vimPlugins = prev.vimPlugins // unstablePkgs.vimPlugins;
|
||||
# Get specific packages from unstable
|
||||
inherit
|
||||
(unstablePkgs)
|
||||
gitoxide
|
||||
jujutsu
|
||||
wezterm
|
||||
neovim-unwrapped
|
||||
;
|
||||
};
|
||||
};
|
||||
|
||||
# Nix files formatter (run `nix fmt`)
|
||||
formatter = forEachSupportedSystem ({pkgs, ...}: pkgs.alejandra);
|
||||
|
||||
# Example vm configuration
|
||||
nixosConfigurations.vm = let
|
||||
system = "x86_64-linux";
|
||||
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) ["steam-original"];
|
||||
pkgs = import nixpkgs {inherit system overlays config;};
|
||||
);
|
||||
overlays = builtins.attrValues self.overlays;
|
||||
in
|
||||
lib.nixosSystem {
|
||||
inherit system pkgs;
|
||||
modules = [
|
||||
self.nixosModules.vm # import vm module
|
||||
{
|
||||
checks = forEachSupportedSystem (
|
||||
{ pkgs, system }:
|
||||
let
|
||||
src = builtins.path {
|
||||
path = ./.;
|
||||
name = "configuration.nix";
|
||||
};
|
||||
runCmdInSrc =
|
||||
name: cmd:
|
||||
pkgs.runCommandNoCC name { } ''
|
||||
cd ${src}
|
||||
${cmd}
|
||||
mkdir $out
|
||||
'';
|
||||
in
|
||||
{
|
||||
nvim = nixvim.lib.${system}.check.mkTestDerivationFromNixvimModule {
|
||||
pkgs = import nixpkgs { inherit system overlays; };
|
||||
module = ./nvim/standalone.nix;
|
||||
};
|
||||
fmt = runCmdInSrc "fmt-src" "${lib.getExe self.formatter.${system}} --check .";
|
||||
lint = runCmdInSrc "lint-src" "${lib.getExe pkgs.statix} check .";
|
||||
typos = runCmdInSrc "typos-src" "${lib.getExe pkgs.typos} .";
|
||||
}
|
||||
);
|
||||
|
||||
packages = forEachSupportedSystem (
|
||||
{ pkgs, system }:
|
||||
{
|
||||
inherit (import ./docs { inherit pkgs lib; })
|
||||
docs
|
||||
nixos-markdown
|
||||
nvim-markdown
|
||||
home-markdown
|
||||
;
|
||||
# Nvim standalone module
|
||||
nvim = nixvim.legacyPackages.${system}.makeNixvimWithModule {
|
||||
pkgs = import nixpkgs { inherit system overlays; };
|
||||
module = ./nvim/standalone.nix;
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
# Provide necessary overlays
|
||||
overlays = {
|
||||
nixvim = nixvim.overlays.default;
|
||||
jpassmenu = jpassmenu.overlays.default;
|
||||
audiomenu = audiomenu.overlays.default;
|
||||
unstable =
|
||||
final: prev:
|
||||
let
|
||||
unstablePkgs = unstable.legacyPackages.${prev.system};
|
||||
in
|
||||
{
|
||||
time.timeZone = "Europe/Berlin";
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
users.users.jdoe = {
|
||||
password = "example";
|
||||
isNormalUser = true;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"video"
|
||||
"networkmanager"
|
||||
];
|
||||
};
|
||||
home-manager.users.jdoe = {
|
||||
home = {
|
||||
username = "jdoe";
|
||||
homeDirectory = "/home/jdoe";
|
||||
# Get unstable packages
|
||||
unstable = unstablePkgs;
|
||||
# Update vim plugins with the versions from unstable
|
||||
vimPlugins = prev.vimPlugins // unstablePkgs.vimPlugins;
|
||||
# Get specific packages from unstable
|
||||
inherit (unstablePkgs)
|
||||
gitoxide
|
||||
jujutsu
|
||||
wezterm
|
||||
neovim-unwrapped
|
||||
;
|
||||
};
|
||||
};
|
||||
|
||||
# Nix files formatter (run `nix fmt`)
|
||||
formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixfmt-rfc-style);
|
||||
|
||||
# Example vm configuration
|
||||
nixosConfigurations.vm =
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "steam-original" ];
|
||||
pkgs = import nixpkgs { inherit system overlays config; };
|
||||
in
|
||||
lib.nixosSystem {
|
||||
inherit system pkgs;
|
||||
modules = [
|
||||
self.nixosModules.vm # import vm module
|
||||
{
|
||||
time.timeZone = "Europe/Berlin";
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
users.users.jdoe = {
|
||||
password = "example";
|
||||
isNormalUser = true;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"video"
|
||||
"networkmanager"
|
||||
];
|
||||
};
|
||||
jhome = {
|
||||
home-manager.users.jdoe = {
|
||||
home = {
|
||||
username = "jdoe";
|
||||
homeDirectory = "/home/jdoe";
|
||||
};
|
||||
jhome = {
|
||||
enable = true;
|
||||
gui.enable = true;
|
||||
dev.rust.enable = true;
|
||||
};
|
||||
};
|
||||
nix.registry.nixpkgs.flake = nixpkgs;
|
||||
jconfig = {
|
||||
enable = true;
|
||||
gui.enable = true;
|
||||
dev.rust.enable = true;
|
||||
};
|
||||
};
|
||||
nix.registry.nixpkgs.flake = nixpkgs;
|
||||
jconfig = {
|
||||
enable = true;
|
||||
gui.enable = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
nixosModules = let
|
||||
nvim-config.imports = [
|
||||
nixvim.homeManagerModules.nixvim
|
||||
./nvim
|
||||
];
|
||||
homeManagerModuleSandalone = import ./home {inherit nvim-config stylix;};
|
||||
homeManagerModuleNixOS = import ./home {inherit nvim-config;};
|
||||
nixosModule = {
|
||||
imports =
|
||||
[
|
||||
(import ./system {inherit stylix;})
|
||||
home-manager.nixosModules.home-manager
|
||||
]
|
||||
++ nixpkgs.lib.optional (lix-module != null) lix-module.nixosModules.default;
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
sharedModules = [homeManagerModuleNixOS];
|
||||
};
|
||||
# Pin nixpkgs
|
||||
nix.registry.nixpkgs.flake = nixpkgs;
|
||||
};
|
||||
|
||||
machines = [
|
||||
"capricorn"
|
||||
"gemini"
|
||||
"libra"
|
||||
"vm"
|
||||
];
|
||||
mkMachine = hostname: {
|
||||
imports = [
|
||||
nixosModule
|
||||
(import (./machines + "/${hostname}") {inherit nixos-hardware;})
|
||||
];
|
||||
home-manager.sharedModules = [{jhome.hostName = hostname;}];
|
||||
};
|
||||
machineModules = lib.genAttrs machines mkMachine;
|
||||
in
|
||||
{
|
||||
default = nixosModule;
|
||||
inherit nixosModule homeManagerModuleNixOS homeManagerModuleSandalone;
|
||||
}
|
||||
// machineModules;
|
||||
|
||||
devShells = forEachSupportedSystem (
|
||||
{
|
||||
pkgs,
|
||||
system,
|
||||
}: {
|
||||
default = pkgs.mkShell {
|
||||
buildInputs = [
|
||||
pkgs.just
|
||||
self.packages.${system}.nvim
|
||||
}
|
||||
];
|
||||
QEMU_OPTS_WL = "--enable-kvm -smp 4 -device virtio-gpu-rutabaga,gfxstream-vulkan=on,cross-domain=on,hostmem=2G,wsi=headless";
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
nixosModules =
|
||||
let
|
||||
nvim-config.imports = [
|
||||
nixvim.homeManagerModules.nixvim
|
||||
./nvim
|
||||
];
|
||||
homeManagerModuleSandalone = import ./home { inherit nvim-config stylix; };
|
||||
homeManagerModuleNixOS = import ./home { inherit nvim-config; };
|
||||
nixosModule = {
|
||||
imports = [
|
||||
(import ./system { inherit stylix; })
|
||||
home-manager.nixosModules.home-manager
|
||||
] ++ nixpkgs.lib.optional (lix-module != null) lix-module.nixosModules.default;
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
sharedModules = [ homeManagerModuleNixOS ];
|
||||
};
|
||||
# Pin nixpkgs
|
||||
nix.registry.nixpkgs.flake = nixpkgs;
|
||||
};
|
||||
|
||||
machines = [
|
||||
"capricorn"
|
||||
"gemini"
|
||||
"libra"
|
||||
"vm"
|
||||
];
|
||||
mkMachine = hostname: {
|
||||
imports = [
|
||||
nixosModule
|
||||
(import (./machines + "/${hostname}") { inherit nixos-hardware; })
|
||||
];
|
||||
home-manager.sharedModules = [ { jhome.hostName = hostname; } ];
|
||||
};
|
||||
machineModules = lib.genAttrs machines mkMachine;
|
||||
in
|
||||
{
|
||||
default = nixosModule;
|
||||
inherit nixosModule homeManagerModuleNixOS homeManagerModuleSandalone;
|
||||
}
|
||||
// machineModules;
|
||||
|
||||
devShells = forEachSupportedSystem (
|
||||
{ pkgs, system }:
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
buildInputs = [
|
||||
pkgs.just
|
||||
self.packages.${system}.nvim
|
||||
];
|
||||
QEMU_OPTS_WL = "--enable-kvm -smp 4 -device virtio-gpu-rutabaga,gfxstream-vulkan=on,cross-domain=on,hostmem=2G,wsi=headless";
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
{
|
||||
nvim-config,
|
||||
stylix ? null,
|
||||
}: {
|
||||
}:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
cfg = config.jhome;
|
||||
devcfg = cfg.dev;
|
||||
in {
|
||||
in
|
||||
{
|
||||
imports =
|
||||
[
|
||||
nvim-config
|
||||
|
@ -19,11 +22,11 @@ in {
|
|||
]
|
||||
++ lib.optionals (stylix != null) [
|
||||
stylix.homeManagerModules.stylix
|
||||
{stylix.image = cfg.sway.background;}
|
||||
{ stylix.image = cfg.sway.background; }
|
||||
];
|
||||
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf (cfg.enable && cfg.styling.enable) {stylix.enable = true;})
|
||||
(lib.mkIf (cfg.enable && cfg.styling.enable) { stylix.enable = true; })
|
||||
(lib.mkIf cfg.enable {
|
||||
programs = {
|
||||
# Better cat (bat)
|
||||
|
@ -81,10 +84,7 @@ in {
|
|||
gpg-agent = {
|
||||
enable = true;
|
||||
maxCacheTtl = 86400;
|
||||
pinentryPackage =
|
||||
if config.jhome.gui.enable
|
||||
then pkgs.pinentry-qt
|
||||
else pkgs.pinentry-curses;
|
||||
pinentryPackage = if config.jhome.gui.enable then pkgs.pinentry-qt else pkgs.pinentry-curses;
|
||||
extraConfig = "allow-preset-passphrase";
|
||||
};
|
||||
# Spotifyd
|
||||
|
@ -189,7 +189,7 @@ in {
|
|||
};
|
||||
})
|
||||
(lib.mkIf (cfg.enable && devcfg.enable && devcfg.rust.enable) {
|
||||
home.packages = [pkgs.rustup] ++ devcfg.rust.extraPackages;
|
||||
home.packages = [ pkgs.rustup ] ++ devcfg.rust.extraPackages;
|
||||
# Background code checker (for Rust)
|
||||
programs.bacon = {
|
||||
enable = true;
|
||||
|
|
|
@ -4,17 +4,12 @@
|
|||
pkgs,
|
||||
osConfig ? null,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
inherit (config) jhome;
|
||||
flatpakEnabled =
|
||||
if osConfig != null
|
||||
then osConfig.services.flatpak.enable
|
||||
else false;
|
||||
flatpakEnabled = if osConfig != null then osConfig.services.flatpak.enable else false;
|
||||
osSway = osConfig == null && !osConfig.programs.sway.enable;
|
||||
swayPkg =
|
||||
if osSway
|
||||
then pkgs.sway
|
||||
else null;
|
||||
swayPkg = if osSway then pkgs.sway else null;
|
||||
cfg = jhome.gui;
|
||||
cursor = {
|
||||
package = pkgs.nordzy-cursor-theme;
|
||||
|
@ -24,9 +19,11 @@
|
|||
name = "Papirus-Dark";
|
||||
package = pkgs.papirus-icon-theme;
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
config = lib.mkIf (jhome.enable && cfg.enable) {
|
||||
home.packages = with pkgs;
|
||||
home.packages =
|
||||
with pkgs;
|
||||
[
|
||||
webcord
|
||||
ferdium
|
||||
|
@ -36,16 +33,25 @@ in {
|
|||
wl-clipboard
|
||||
# Extra fonts
|
||||
noto-fonts-cjk # Chinese, Japanese and Korean characters
|
||||
(pkgs.nerdfonts.override {fonts = ["NerdFontsSymbolsOnly"];})
|
||||
(pkgs.nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; })
|
||||
]
|
||||
++ lib.optional flatpakEnabled flatpak;
|
||||
fonts.fontconfig = {
|
||||
enable = true;
|
||||
defaultFonts = lib.mkIf config.jhome.styling.enable {
|
||||
emoji = ["Noto Color Emoji"];
|
||||
monospace = ["JetBrains Mono" "Symbols Nerd Font"];
|
||||
serif = ["Noto Serif" "Symbols Nerd Font"];
|
||||
sansSerif = ["Noto Sans" "Symbols Nerd Font"];
|
||||
emoji = [ "Noto Color Emoji" ];
|
||||
monospace = [
|
||||
"JetBrains Mono"
|
||||
"Symbols Nerd Font"
|
||||
];
|
||||
serif = [
|
||||
"Noto Serif"
|
||||
"Symbols Nerd Font"
|
||||
];
|
||||
sansSerif = [
|
||||
"Noto Sans"
|
||||
"Symbols Nerd Font"
|
||||
];
|
||||
};
|
||||
};
|
||||
# Browser
|
||||
|
@ -63,13 +69,15 @@ in {
|
|||
# Video player
|
||||
mpv = {
|
||||
enable = true;
|
||||
scripts = builtins.attrValues {inherit (pkgs.mpvScripts) uosc thumbfast;};
|
||||
scripts = builtins.attrValues { inherit (pkgs.mpvScripts) uosc thumbfast; };
|
||||
};
|
||||
# Status bar
|
||||
waybar = {
|
||||
enable = true;
|
||||
systemd.enable = true;
|
||||
settings = lib.mkIf config.jhome.styling.enable (import ./waybar-settings.nix {inherit config lib;});
|
||||
settings = lib.mkIf config.jhome.styling.enable (
|
||||
import ./waybar-settings.nix { inherit config lib; }
|
||||
);
|
||||
style = lib.optionalString config.jhome.styling.enable ''
|
||||
.modules-left #workspaces button {
|
||||
border-bottom: 3px solid @base01;
|
||||
|
@ -130,15 +138,17 @@ in {
|
|||
wayland.windowManager.sway = {
|
||||
inherit (cfg.sway) enable;
|
||||
package = swayPkg; # no sway package if it comes from the OS
|
||||
config = import ./sway-config.nix {inherit config pkgs;};
|
||||
config = import ./sway-config.nix { inherit config pkgs; };
|
||||
};
|
||||
|
||||
# Set cursor style
|
||||
stylix = lib.mkIf config.jhome.styling.enable {inherit cursor;};
|
||||
home.pointerCursor = lib.mkIf config.jhome.styling.enable (lib.mkDefault {
|
||||
gtk.enable = true;
|
||||
inherit (cursor) name package;
|
||||
});
|
||||
stylix = lib.mkIf config.jhome.styling.enable { inherit cursor; };
|
||||
home.pointerCursor = lib.mkIf config.jhome.styling.enable (
|
||||
lib.mkDefault {
|
||||
gtk.enable = true;
|
||||
inherit (cursor) name package;
|
||||
}
|
||||
);
|
||||
# Set Gtk theme
|
||||
gtk = lib.mkIf config.jhome.styling.enable {
|
||||
enable = true;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
}: let
|
||||
{ pkgs, config }:
|
||||
let
|
||||
cfg = config.jhome.gui.sway;
|
||||
passmenu = "${pkgs.jpassmenu}/bin/jpassmenu";
|
||||
selectAudio = "${pkgs.audiomenu}/bin/audiomenu --menu 'fuzzel --dmenu'";
|
||||
|
@ -20,21 +18,21 @@
|
|||
];
|
||||
dirs =
|
||||
map
|
||||
(dir: {
|
||||
key = swayconf.${dir};
|
||||
arrow = dir;
|
||||
direction = dir;
|
||||
})
|
||||
[
|
||||
"up"
|
||||
"down"
|
||||
"left"
|
||||
"right"
|
||||
];
|
||||
(dir: {
|
||||
key = swayconf.${dir};
|
||||
arrow = dir;
|
||||
direction = dir;
|
||||
})
|
||||
[
|
||||
"up"
|
||||
"down"
|
||||
"left"
|
||||
"right"
|
||||
];
|
||||
joinKeys = builtins.concatStringsSep "+";
|
||||
# Generate a keybind from a modifier prefix and a key
|
||||
keycombo = prefix: key: joinKeys (prefix ++ [key]);
|
||||
modKeybind = keycombo [mod];
|
||||
keycombo = prefix: key: joinKeys (prefix ++ [ key ]);
|
||||
modKeybind = keycombo [ mod ];
|
||||
modCtrlKeybind = keycombo [
|
||||
mod
|
||||
"Ctrl"
|
||||
|
@ -53,10 +51,13 @@
|
|||
dir2resize.right = "resize grow width";
|
||||
dir2resize.left = "resize shrink width";
|
||||
# Bind a key combo to an action
|
||||
genKeybind = prefix: action: key: {"${prefix key}" = "${action key}";};
|
||||
genKey = prefix: action: genKeybind ({key, ...}: prefix key) ({direction, ...}: action direction);
|
||||
genArrow = prefix: action: genKeybind ({arrow, ...}: prefix arrow) ({direction, ...}: action direction);
|
||||
genArrowAndKey = prefix: action: key:
|
||||
genKeybind = prefix: action: key: { "${prefix key}" = "${action key}"; };
|
||||
genKey =
|
||||
prefix: action: genKeybind ({ key, ... }: prefix key) ({ direction, ... }: action direction);
|
||||
genArrow =
|
||||
prefix: action: genKeybind ({ arrow, ... }: prefix arrow) ({ direction, ... }: action direction);
|
||||
genArrowAndKey =
|
||||
prefix: action: key:
|
||||
(genKey prefix action key) // (genArrow prefix action key);
|
||||
# Move window
|
||||
moveWindowKeybinds = map (genArrowAndKey modShiftKeybind (dir: "move ${dir}")) dirs;
|
||||
|
@ -65,25 +66,19 @@
|
|||
# Resize window
|
||||
resizeWindowKeybinds = map (genArrowAndKey modCtrlKeybind (dir: dir2resize.${dir})) dirs;
|
||||
# Move container to workspace
|
||||
moveWorkspaceKeybindings =
|
||||
map (genKeybind modShiftKeybind (
|
||||
number: "move container to workspace number ${number}"
|
||||
))
|
||||
workspaces;
|
||||
moveWorkspaceKeybindings = map (genKeybind modShiftKeybind (
|
||||
number: "move container to workspace number ${number}"
|
||||
)) workspaces;
|
||||
# Focus workspace
|
||||
focusWorkspaceKeybindings =
|
||||
map (genKeybind modKeybind (
|
||||
number: "workspace number ${number}"
|
||||
))
|
||||
workspaces;
|
||||
focusWorkspaceKeybindings = map (genKeybind modKeybind (
|
||||
number: "workspace number ${number}"
|
||||
)) workspaces;
|
||||
# Move container to Workspace and focus on it
|
||||
moveFocusWorkspaceKeybindings =
|
||||
map (genKeybind modCtrlShiftKeybind (
|
||||
number: "move container to workspace number ${number}; workspace number ${number}"
|
||||
))
|
||||
workspaces;
|
||||
moveFocusWorkspaceKeybindings = map (genKeybind modCtrlShiftKeybind (
|
||||
number: "move container to workspace number ${number}; workspace number ${number}"
|
||||
)) workspaces;
|
||||
in
|
||||
builtins.foldl' (l: r: l // r)
|
||||
builtins.foldl' (l: r: l // r)
|
||||
{
|
||||
"${mod}+Return" = "exec ${swayconf.terminal}";
|
||||
"${mod}+D" = "exec ${swayconf.menu}";
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
}: let
|
||||
{ config, pkgs }:
|
||||
let
|
||||
cfg = config.jhome.gui.sway;
|
||||
modifier = "Mod4";
|
||||
inherit (config.jhome.gui) terminal;
|
||||
termCmd =
|
||||
if terminal == "wezterm"
|
||||
then "wezterm start"
|
||||
else if terminal == "alacritty"
|
||||
then "alacritty -e"
|
||||
else builtins.abort "no command configured for ${terminal}";
|
||||
if terminal == "wezterm" then
|
||||
"wezterm start"
|
||||
else if terminal == "alacritty" then
|
||||
"alacritty -e"
|
||||
else
|
||||
builtins.abort "no command configured for ${terminal}";
|
||||
menu = "${pkgs.fuzzel}/bin/fuzzel --terminal '${termCmd}'";
|
||||
# currently, there is some friction between sway and gtk:
|
||||
# https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
|
||||
|
@ -18,10 +17,11 @@
|
|||
# for gsettings to work, we need to tell it where the schemas are
|
||||
# using the XDG_DATA_DIR environment variable
|
||||
# run at the end of sway config
|
||||
configure-gtk = let
|
||||
schema = pkgs.gsettings-desktop-schemas;
|
||||
datadir = "${schema}/share/gsettings-schemas/${schema.name}";
|
||||
in
|
||||
configure-gtk =
|
||||
let
|
||||
schema = pkgs.gsettings-desktop-schemas;
|
||||
datadir = "${schema}/share/gsettings-schemas/${schema.name}";
|
||||
in
|
||||
pkgs.writers.writeDashBin "configure-gtk" ''
|
||||
export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS
|
||||
gnome_schema=org.gnome.desktop.interface
|
||||
|
@ -38,16 +38,17 @@
|
|||
${pkgs.glib}/bin/gsettings set "$gnome_schema" font-name "$font_name"
|
||||
${pkgs.glib}/bin/gsettings set "$gnome_schema" color-scheme prefer-dark
|
||||
'';
|
||||
cmdOnce = command: {inherit command;};
|
||||
cmdOnce = command: { inherit command; };
|
||||
cmdAlways = command: {
|
||||
inherit command;
|
||||
always = true;
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
inherit modifier terminal menu;
|
||||
keybindings = import ./keybindings.nix {inherit config pkgs;};
|
||||
keybindings = import ./keybindings.nix { inherit config pkgs; };
|
||||
# Appearance
|
||||
bars = []; # Waybar is started as a systemd service
|
||||
bars = [ ]; # Waybar is started as a systemd service
|
||||
gaps = {
|
||||
smartGaps = true;
|
||||
smartBorders = "on";
|
||||
|
@ -72,12 +73,9 @@ in {
|
|||
}
|
||||
];
|
||||
# Startup scripts
|
||||
startup =
|
||||
[
|
||||
(cmdAlways "${configure-gtk}/bin/configure-gtk")
|
||||
]
|
||||
++ (builtins.map cmdAlways cfg.exec.always)
|
||||
++ (builtins.map cmdOnce cfg.exec.once);
|
||||
startup = [
|
||||
(cmdAlways "${configure-gtk}/bin/configure-gtk")
|
||||
] ++ (builtins.map cmdAlways cfg.exec.always) ++ (builtins.map cmdOnce cfg.exec.once);
|
||||
# Keyboard configuration
|
||||
input."type:keyboard" = {
|
||||
repeat_delay = "300";
|
||||
|
|
|
@ -1,38 +1,34 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
}: let
|
||||
{ config, lib }:
|
||||
let
|
||||
cfg = config.jhome.gui;
|
||||
in {
|
||||
in
|
||||
{
|
||||
mainBar = {
|
||||
layer = "top";
|
||||
position = "top";
|
||||
margin = "2 2 2 2";
|
||||
# Choose the order of the modules
|
||||
modules-left = ["sway/workspaces"];
|
||||
modules-center = ["clock"];
|
||||
modules-right =
|
||||
[
|
||||
"pulseaudio"
|
||||
"backlight"
|
||||
"battery"
|
||||
"sway/language"
|
||||
"memory"
|
||||
]
|
||||
++ lib.optional (cfg.tempInfo != null) "temperature"
|
||||
++ ["tray"];
|
||||
modules-left = [ "sway/workspaces" ];
|
||||
modules-center = [ "clock" ];
|
||||
modules-right = [
|
||||
"pulseaudio"
|
||||
"backlight"
|
||||
"battery"
|
||||
"sway/language"
|
||||
"memory"
|
||||
] ++ lib.optional (cfg.tempInfo != null) "temperature" ++ [ "tray" ];
|
||||
"sway/workspaces" = {
|
||||
disable-scroll = true;
|
||||
persistent-workspaces = {
|
||||
"1" = [];
|
||||
"2" = [];
|
||||
"3" = [];
|
||||
"4" = [];
|
||||
"5" = [];
|
||||
"6" = [];
|
||||
"7" = [];
|
||||
"8" = [];
|
||||
"9" = [];
|
||||
"1" = [ ];
|
||||
"2" = [ ];
|
||||
"3" = [ ];
|
||||
"4" = [ ];
|
||||
"5" = [ ];
|
||||
"6" = [ ];
|
||||
"7" = [ ];
|
||||
"8" = [ ];
|
||||
"9" = [ ];
|
||||
};
|
||||
};
|
||||
"sway/language" = {
|
||||
|
@ -64,7 +60,11 @@ in {
|
|||
phone = "";
|
||||
portable = "";
|
||||
car = "";
|
||||
default = ["" "" ""];
|
||||
default = [
|
||||
""
|
||||
""
|
||||
""
|
||||
];
|
||||
};
|
||||
on-click = "pavucontrol";
|
||||
min-length = 13;
|
||||
|
@ -73,13 +73,27 @@ in {
|
|||
inherit (cfg.tempInfo) hwmon-path;
|
||||
critical-threshold = 80;
|
||||
format = "{temperatureC}°C {icon}";
|
||||
format-icons = ["" "" "" "" ""];
|
||||
format-icons = [
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
];
|
||||
tooltip = false;
|
||||
};
|
||||
backlight = {
|
||||
device = "intel_backlight";
|
||||
format = "{percent}% {icon}";
|
||||
format-icons = ["" "" "" "" "" "" ""];
|
||||
format-icons = [
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
];
|
||||
min-length = 7;
|
||||
};
|
||||
battery = {
|
||||
|
@ -89,7 +103,18 @@ in {
|
|||
format-charging = "{capacity}% ";
|
||||
format-plugged = "{capacity}% ";
|
||||
format-alt = "{time} {icon}";
|
||||
format-icons = ["" "" "" "" "" "" "" "" "" ""];
|
||||
format-icons = [
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
""
|
||||
];
|
||||
};
|
||||
tray = {
|
||||
icon-size = 16;
|
||||
|
|
152
home/options.nix
152
home/options.nix
|
@ -1,36 +1,30 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ attrs: let
|
||||
{ lib, pkgs, ... }@attrs:
|
||||
let
|
||||
osConfig = attrs.osConfig or null;
|
||||
inherit (lib) types;
|
||||
fromOs = let
|
||||
get = path: set:
|
||||
if path == []
|
||||
then set
|
||||
else get (builtins.tail path) (builtins.getAttr (builtins.head path) set);
|
||||
in
|
||||
path: default:
|
||||
if osConfig == null
|
||||
then default
|
||||
else get path osConfig;
|
||||
fromConfig = path: default: fromOs (["jconfig"] ++ path) default;
|
||||
fromOs =
|
||||
let
|
||||
get =
|
||||
path: set:
|
||||
if path == [ ] then set else get (builtins.tail path) (builtins.getAttr (builtins.head path) set);
|
||||
in
|
||||
path: default: if osConfig == null then default else get path osConfig;
|
||||
fromConfig = path: default: fromOs ([ "jconfig" ] ++ path) default;
|
||||
|
||||
mkExtraPackagesOption = name: defaultPkgsPath: let
|
||||
text =
|
||||
lib.strings.concatMapStringsSep " " (
|
||||
mkExtraPackagesOption =
|
||||
name: defaultPkgsPath:
|
||||
let
|
||||
text = lib.strings.concatMapStringsSep " " (
|
||||
pkgPath: "pkgs." + (lib.strings.concatStringsSep "." pkgPath)
|
||||
)
|
||||
defaultPkgsPath;
|
||||
defaultText = lib.literalExpression "[ ${text} ]";
|
||||
default = builtins.map (pkgPath: lib.attrsets.getAttrFromPath pkgPath pkgs) defaultPkgsPath;
|
||||
in
|
||||
) defaultPkgsPath;
|
||||
defaultText = lib.literalExpression "[ ${text} ]";
|
||||
default = builtins.map (pkgPath: lib.attrsets.getAttrFromPath pkgPath pkgs) defaultPkgsPath;
|
||||
in
|
||||
lib.mkOption {
|
||||
description = "Extra ${name} Packages.";
|
||||
type = types.listOf types.package;
|
||||
inherit default defaultText;
|
||||
example = [];
|
||||
example = [ ];
|
||||
};
|
||||
|
||||
identity.options = {
|
||||
|
@ -62,12 +56,12 @@
|
|||
enable = lib.mkEnableOption "Jalil's default user configuration";
|
||||
gpg = lib.mkOption {
|
||||
description = "GnuPG Configuration.";
|
||||
default = {};
|
||||
default = { };
|
||||
type = types.submodule {
|
||||
options.unlockKeys = lib.mkOption {
|
||||
description = "Keygrips of keys to unlock through `pam-gnupg` when logging in.";
|
||||
default = [];
|
||||
example = ["6F4ABB77A88E922406BCE6627AFEEE2363914B76"];
|
||||
default = [ ];
|
||||
example = [ "6F4ABB77A88E922406BCE6627AFEEE2363914B76" ];
|
||||
type = types.listOf types.str;
|
||||
};
|
||||
};
|
||||
|
@ -85,14 +79,27 @@
|
|||
};
|
||||
|
||||
sway.options = {
|
||||
enable = lib.mkEnableOption "sway" // {default = fromConfig ["gui" "sway"] true;};
|
||||
enable = lib.mkEnableOption "sway" // {
|
||||
default = fromConfig [
|
||||
"gui"
|
||||
"sway"
|
||||
] true;
|
||||
};
|
||||
background = lib.mkOption {
|
||||
description = "The wallpaper to use.";
|
||||
type = types.path;
|
||||
default = fromConfig ["styling" "wallpaper"] (builtins.fetchurl {
|
||||
url = "https://raw.githubusercontent.com/lunik1/nixos-logo-gruvbox-wallpaper/d4937c424fad79c1136a904599ba689fcf8d0fad/png/gruvbox-dark-rainbow.png";
|
||||
sha256 = "036gqhbf6s5ddgvfbgn6iqbzgizssyf7820m5815b2gd748jw8zc";
|
||||
});
|
||||
default =
|
||||
fromConfig
|
||||
[
|
||||
"styling"
|
||||
"wallpaper"
|
||||
]
|
||||
(
|
||||
builtins.fetchurl {
|
||||
url = "https://raw.githubusercontent.com/lunik1/nixos-logo-gruvbox-wallpaper/d4937c424fad79c1136a904599ba689fcf8d0fad/png/gruvbox-dark-rainbow.png";
|
||||
sha256 = "036gqhbf6s5ddgvfbgn6iqbzgizssyf7820m5815b2gd748jw8zc";
|
||||
}
|
||||
);
|
||||
};
|
||||
autostart = lib.mkOption {
|
||||
description = ''
|
||||
|
@ -109,20 +116,20 @@
|
|||
};
|
||||
exec = lib.mkOption {
|
||||
description = "Run commands when starting sway.";
|
||||
default = {};
|
||||
default = { };
|
||||
type = types.submodule {
|
||||
options = {
|
||||
once = lib.mkOption {
|
||||
description = "Programs to start only once (`exec`).";
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
example = ["signal-desktop --start-in-tray"];
|
||||
default = [ ];
|
||||
example = [ "signal-desktop --start-in-tray" ];
|
||||
};
|
||||
always = lib.mkOption {
|
||||
description = "Programs to start whenever the config is sourced (`exec_always`).";
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
example = ["signal-desktop --start-in-tray"];
|
||||
default = [ ];
|
||||
example = [ "signal-desktop --start-in-tray" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -130,7 +137,12 @@
|
|||
};
|
||||
|
||||
gui.options = {
|
||||
enable = lib.mkEnableOption "GUI applications" // {default = fromConfig ["gui" "enable"] false;};
|
||||
enable = lib.mkEnableOption "GUI applications" // {
|
||||
default = fromConfig [
|
||||
"gui"
|
||||
"enable"
|
||||
] false;
|
||||
};
|
||||
tempInfo = lib.mkOption {
|
||||
description = "Temperature info to display in the statusbar.";
|
||||
default = null;
|
||||
|
@ -138,7 +150,7 @@
|
|||
};
|
||||
sway = lib.mkOption {
|
||||
description = "Sway window manager configuration.";
|
||||
default = {};
|
||||
default = { };
|
||||
type = types.submodule sway;
|
||||
};
|
||||
terminal = lib.mkOption {
|
||||
|
@ -151,48 +163,57 @@
|
|||
];
|
||||
};
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.jhome = lib.mkOption {
|
||||
description = "Jalil's default home-manager configuration.";
|
||||
default = {};
|
||||
default = { };
|
||||
type = types.submodule {
|
||||
options = {
|
||||
enable = lib.mkEnableOption "jalil's home defaults";
|
||||
hostName = lib.mkOption {
|
||||
description = "The hostname of this system.";
|
||||
type = types.str;
|
||||
default = fromOs ["networking" "hostName"] "nixos";
|
||||
default = fromOs [
|
||||
"networking"
|
||||
"hostName"
|
||||
] "nixos";
|
||||
example = "my pc";
|
||||
};
|
||||
dev = lib.mkOption {
|
||||
description = "Setup development environment for programming languages.";
|
||||
default = {};
|
||||
default = { };
|
||||
type = types.submodule {
|
||||
options = {
|
||||
enable = lib.mkEnableOption "development settings" // {default = fromConfig ["dev" "enable"] false;};
|
||||
enable = lib.mkEnableOption "development settings" // {
|
||||
default = fromConfig [
|
||||
"dev"
|
||||
"enable"
|
||||
] false;
|
||||
};
|
||||
neovimAsManPager = lib.mkEnableOption "neovim as the man pager";
|
||||
extraPackages = mkExtraPackagesOption "dev" [
|
||||
["jq"] # json parser
|
||||
["just"] # just a command runner
|
||||
["typos"] # low false positive rate typo checker
|
||||
["gcc"] # GNU Compiler Collection
|
||||
["git-absorb"] # fixup! but automatic
|
||||
["man-pages"] # gimme the man pages
|
||||
["man-pages-posix"] # I said gimme the man pages!!!
|
||||
[ "jq" ] # json parser
|
||||
[ "just" ] # just a command runner
|
||||
[ "typos" ] # low false positive rate typo checker
|
||||
[ "gcc" ] # GNU Compiler Collection
|
||||
[ "git-absorb" ] # fixup! but automatic
|
||||
[ "man-pages" ] # gimme the man pages
|
||||
[ "man-pages-posix" ] # I said gimme the man pages!!!
|
||||
];
|
||||
rust = lib.mkOption {
|
||||
description = "Jalil's default rust configuration.";
|
||||
default = {};
|
||||
default = { };
|
||||
type = types.submodule {
|
||||
options.enable = lib.mkEnableOption "rust development settings";
|
||||
options.extraPackages = mkExtraPackagesOption "Rust" [
|
||||
["cargo-insta"] # snapshot testing
|
||||
["cargo-llvm-cov"] # code coverage
|
||||
["cargo-msrv"] # minimum supported version
|
||||
["cargo-nextest"] # better testing harness
|
||||
["cargo-sort"] # sort deps and imports
|
||||
["cargo-udeps"] # check for unused dependencies (requires nightly)
|
||||
["cargo-watch"] # watch for file changes and run commands
|
||||
[ "cargo-insta" ] # snapshot testing
|
||||
[ "cargo-llvm-cov" ] # code coverage
|
||||
[ "cargo-msrv" ] # minimum supported version
|
||||
[ "cargo-nextest" ] # better testing harness
|
||||
[ "cargo-sort" ] # sort deps and imports
|
||||
[ "cargo-udeps" ] # check for unused dependencies (requires nightly)
|
||||
[ "cargo-watch" ] # watch for file changes and run commands
|
||||
];
|
||||
};
|
||||
};
|
||||
|
@ -206,15 +227,20 @@ in {
|
|||
};
|
||||
gui = lib.mkOption {
|
||||
description = "Jalil's default GUI configuration.";
|
||||
default = {};
|
||||
default = { };
|
||||
type = types.submodule gui;
|
||||
};
|
||||
styling = lib.mkOption {
|
||||
description = "My custom styling (uses stylix)";
|
||||
default = {};
|
||||
default = { };
|
||||
type = types.submodule {
|
||||
options = {
|
||||
enable = lib.mkEnableOption "styling" // {default = fromConfig ["styling" "enable"] true;};
|
||||
enable = lib.mkEnableOption "styling" // {
|
||||
default = fromConfig [
|
||||
"styling"
|
||||
"enable"
|
||||
] true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
inherit (config) jhome;
|
||||
inherit (cfg.defaultIdentity) signingKey;
|
||||
|
||||
|
@ -10,8 +7,9 @@
|
|||
hasConfig = jhome.enable && cfg != null;
|
||||
hasKey = signingKey != null;
|
||||
gpgHome = config.programs.gpg.homedir;
|
||||
unlockKey = hasConfig && cfg.gpg.unlockKeys != [];
|
||||
in {
|
||||
unlockKey = hasConfig && cfg.gpg.unlockKeys != [ ];
|
||||
in
|
||||
{
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf hasConfig {
|
||||
programs.git = {
|
||||
|
@ -23,7 +21,7 @@ in {
|
|||
};
|
||||
};
|
||||
programs.jujutsu.settings = {
|
||||
user = lib.mkIf (cfg.defaultIdentity != null) {inherit (cfg.defaultIdentity) name email;};
|
||||
user = lib.mkIf (cfg.defaultIdentity != null) { inherit (cfg.defaultIdentity) name email; };
|
||||
signing = lib.mkIf hasKey {
|
||||
sign-all = true;
|
||||
backend = "gpg";
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{nixos-hardware}: {
|
||||
{ nixos-hardware }:
|
||||
{
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
|
@ -9,8 +10,8 @@
|
|||
];
|
||||
fileSystems = {
|
||||
# Setup extra filesystem options
|
||||
"/".options = ["compress=zstd"];
|
||||
"/home".options = ["compress=zstd"];
|
||||
"/".options = [ "compress=zstd" ];
|
||||
"/home".options = [ "compress=zstd" ];
|
||||
"/nix".options = [
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
lib,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [(modulesPath + "/installer/scan/not-detected.nix")];
|
||||
}:
|
||||
{
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
boot = {
|
||||
initrd = {
|
||||
availableKernelModules = [
|
||||
|
@ -16,22 +17,22 @@
|
|||
"usb_storage"
|
||||
"sd_mod"
|
||||
];
|
||||
kernelModules = [];
|
||||
kernelModules = [ ];
|
||||
};
|
||||
kernelModules = ["kvm-intel"];
|
||||
extraModulePackages = [];
|
||||
kernelModules = [ "kvm-intel" ];
|
||||
extraModulePackages = [ ];
|
||||
};
|
||||
fileSystems = {
|
||||
"/" = {
|
||||
device = "/dev/disk/by-label/NIXROOT";
|
||||
fsType = "btrfs";
|
||||
options = ["subvol=root"];
|
||||
options = [ "subvol=root" ];
|
||||
};
|
||||
|
||||
"/nix" = {
|
||||
device = "/dev/disk/by-label/NIXROOT";
|
||||
fsType = "btrfs";
|
||||
options = ["subvol=nix"];
|
||||
options = [ "subvol=nix" ];
|
||||
};
|
||||
|
||||
"/home" = {
|
||||
|
@ -45,7 +46,7 @@
|
|||
};
|
||||
};
|
||||
|
||||
swapDevices = [{device = "/dev/disk/by-label/NIXSWAP";}];
|
||||
swapDevices = [ { device = "/dev/disk/by-label/NIXSWAP"; } ];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# Edit this configuration file to define what should be installed on
|
||||
# your system. Help is available in the configuration.nix(5) man page
|
||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||
{nixos-hardware}: {pkgs, ...}: {
|
||||
{ nixos-hardware }:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
|
@ -11,9 +13,9 @@
|
|||
nixos-hardware.nixosModules.common-gpu-amd
|
||||
];
|
||||
fileSystems = {
|
||||
"/".options = ["compress=zstd"];
|
||||
"/steam".options = ["compress=zstd"];
|
||||
"/home".options = ["compress=zstd"];
|
||||
"/".options = [ "compress=zstd" ];
|
||||
"/steam".options = [ "compress=zstd" ];
|
||||
"/home".options = [ "compress=zstd" ];
|
||||
"/nix".options = [
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
|
@ -48,7 +50,7 @@
|
|||
# };
|
||||
enable = true;
|
||||
startWhenNeeded = true;
|
||||
settings.AllowUsers = ["jalil"];
|
||||
settings.AllowUsers = [ "jalil" ];
|
||||
};
|
||||
|
||||
# Enable CUPS to print documents.
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
lib,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [(modulesPath + "/installer/scan/not-detected.nix")];
|
||||
}:
|
||||
{
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
boot = {
|
||||
initrd = {
|
||||
availableKernelModules = [
|
||||
|
@ -18,17 +19,17 @@
|
|||
"usb_storage"
|
||||
"sd_mod"
|
||||
];
|
||||
kernelModules = [];
|
||||
kernelModules = [ ];
|
||||
};
|
||||
kernelModules = ["kvm-amd"];
|
||||
extraModulePackages = [];
|
||||
kernelModules = [ "kvm-amd" ];
|
||||
extraModulePackages = [ ];
|
||||
};
|
||||
fileSystems = {
|
||||
"/" = {
|
||||
# device = "/dev/disk/by-label/NIXOSROOT";
|
||||
device = "/dev/disk/by-label/NIXOSHOME";
|
||||
fsType = "btrfs";
|
||||
options = ["subvol=root"];
|
||||
options = [ "subvol=root" ];
|
||||
};
|
||||
|
||||
"/steam" = {
|
||||
|
@ -39,13 +40,13 @@
|
|||
"/home" = {
|
||||
device = "/dev/disk/by-label/NIXOSHOME";
|
||||
fsType = "btrfs";
|
||||
options = ["subvol=home"];
|
||||
options = [ "subvol=home" ];
|
||||
};
|
||||
|
||||
"/nix" = {
|
||||
device = "/dev/disk/by-label/NIXOSROOT";
|
||||
fsType = "btrfs";
|
||||
options = ["subvol=nix"];
|
||||
options = [ "subvol=nix" ];
|
||||
};
|
||||
|
||||
"/boot" = {
|
||||
|
@ -54,7 +55,7 @@
|
|||
};
|
||||
};
|
||||
|
||||
swapDevices = [{device = "/dev/disk/by-label/SWAP";}];
|
||||
swapDevices = [ { device = "/dev/disk/by-label/SWAP"; } ];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# Edit this configuration file to define what should be installed on
|
||||
# your system. Help is available in the configuration.nix(5) man page, on
|
||||
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
||||
{nixos-hardware}: {pkgs, ...}: {
|
||||
{ nixos-hardware }:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
|
@ -13,8 +15,8 @@
|
|||
];
|
||||
|
||||
fileSystems = {
|
||||
"/".options = ["compress=zstd"];
|
||||
"/home".options = ["compress=zstd"];
|
||||
"/".options = [ "compress=zstd" ];
|
||||
"/home".options = [ "compress=zstd" ];
|
||||
"/nix".options = [
|
||||
"compress=zstd"
|
||||
"noatime"
|
||||
|
@ -22,7 +24,7 @@
|
|||
};
|
||||
boot = {
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
kernelParams = ["amdgpu.dcdebugmask=0x10"];
|
||||
kernelParams = [ "amdgpu.dcdebugmask=0x10" ];
|
||||
loader = {
|
||||
# Use the systemd-boot EFI boot loader.
|
||||
timeout = 0; # Press Space to show the menu
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [(modulesPath + "/installer/scan/not-detected.nix")];
|
||||
}:
|
||||
{
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
boot = {
|
||||
initrd = {
|
||||
availableKernelModules = [
|
||||
|
@ -17,28 +18,28 @@
|
|||
"usb_storage"
|
||||
"sd_mod"
|
||||
];
|
||||
kernelModules = [];
|
||||
kernelModules = [ ];
|
||||
};
|
||||
kernelModules = ["kvm-amd"];
|
||||
extraModulePackages = [];
|
||||
kernelModules = [ "kvm-amd" ];
|
||||
extraModulePackages = [ ];
|
||||
};
|
||||
fileSystems = {
|
||||
"/" = {
|
||||
device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e";
|
||||
fsType = "btrfs";
|
||||
options = ["subvol=root"];
|
||||
options = [ "subvol=root" ];
|
||||
};
|
||||
|
||||
"/home" = {
|
||||
device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e";
|
||||
fsType = "btrfs";
|
||||
options = ["subvol=home"];
|
||||
options = [ "subvol=home" ];
|
||||
};
|
||||
|
||||
"/nix" = {
|
||||
device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e";
|
||||
fsType = "btrfs";
|
||||
options = ["subvol=nix"];
|
||||
options = [ "subvol=nix" ];
|
||||
};
|
||||
|
||||
"/boot" = {
|
||||
|
@ -47,7 +48,7 @@
|
|||
};
|
||||
};
|
||||
|
||||
swapDevices = [];
|
||||
swapDevices = [ ];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
{helpers, ...}: let
|
||||
{ helpers, ... }:
|
||||
let
|
||||
inherit (helpers) mkRaw;
|
||||
in {
|
||||
in
|
||||
{
|
||||
config = {
|
||||
autoGroups = {
|
||||
"highlightOnYank" = {};
|
||||
"lspConfig" = {};
|
||||
"restoreCursorPosition" = {};
|
||||
"highlightOnYank" = { };
|
||||
"lspConfig" = { };
|
||||
"restoreCursorPosition" = { };
|
||||
};
|
||||
autoCmd = [
|
||||
{
|
||||
|
@ -14,19 +16,17 @@ in {
|
|||
pattern = "*";
|
||||
callback =
|
||||
mkRaw
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
function()
|
||||
vim.highlight.on_yank {
|
||||
higroup = (
|
||||
vim.fn['hlexists'] 'HighlightedyankRegion' > 0 and 'HighlightedyankRegion' or 'IncSearch'
|
||||
),
|
||||
timeout = 200,
|
||||
}
|
||||
end
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
function()
|
||||
vim.highlight.on_yank {
|
||||
higroup = (
|
||||
vim.fn['hlexists'] 'HighlightedyankRegion' > 0 and 'HighlightedyankRegion' or 'IncSearch'
|
||||
),
|
||||
timeout = 200,
|
||||
}
|
||||
end
|
||||
'';
|
||||
}
|
||||
{
|
||||
group = "restoreCursorPosition";
|
||||
|
@ -34,69 +34,66 @@ in {
|
|||
pattern = "*";
|
||||
callback =
|
||||
mkRaw
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
function()
|
||||
if vim.fn.line '\'"' > 0 and vim.fn.line '\'"' <= vim.fn.line '$' then
|
||||
vim.cmd [[execute "normal! g'\""]]
|
||||
# lua
|
||||
''
|
||||
function()
|
||||
if vim.fn.line '\'"' > 0 and vim.fn.line '\'"' <= vim.fn.line '$' then
|
||||
vim.cmd [[execute "normal! g'\""]]
|
||||
end
|
||||
end
|
||||
end
|
||||
'';
|
||||
'';
|
||||
}
|
||||
{
|
||||
group = "lspConfig";
|
||||
event = "LspAttach";
|
||||
pattern = "*";
|
||||
callback = let
|
||||
opts = "noremap = true, buffer = bufnr";
|
||||
in
|
||||
callback =
|
||||
let
|
||||
opts = "noremap = true, buffer = bufnr";
|
||||
in
|
||||
mkRaw
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
function(opts)
|
||||
local bufnr = opts.buf
|
||||
local client = vim.lsp.get_client_by_id(opts.data.client_id)
|
||||
local capabilities = client.server_capabilities
|
||||
-- Set Omnifunc if supported
|
||||
if capabilities.completionProvider then
|
||||
vim.bo[bufnr].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||
# lua
|
||||
''
|
||||
function(opts)
|
||||
local bufnr = opts.buf
|
||||
local client = vim.lsp.get_client_by_id(opts.data.client_id)
|
||||
local capabilities = client.server_capabilities
|
||||
-- Set Omnifunc if supported
|
||||
if capabilities.completionProvider then
|
||||
vim.bo[bufnr].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||
end
|
||||
-- Enable inlay hints if supported
|
||||
if capabilities.inlayHintProvider then
|
||||
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
|
||||
end
|
||||
-- Some Lsp servers do not advertise inlay hints properly so enable this keybinding regardless
|
||||
vim.keymap.set('n', '<space>ht', function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({bufnr = 0}), { bufnr = 0 })
|
||||
end,
|
||||
{ desc = '[H]ints [T]oggle', ${opts} }
|
||||
)
|
||||
-- Enable hover if supported
|
||||
if capabilities.hoverProvider then
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, { desc = 'Hover Documentation', ${opts} })
|
||||
end
|
||||
-- Enable rename if supported
|
||||
if capabilities.renameProvider then
|
||||
vim.keymap.set('n', '<leader>r', vim.lsp.buf.rename, { desc = '[R]ename', ${opts} })
|
||||
end
|
||||
-- Enable code actions if supported
|
||||
if capabilities.codeActionProvider then
|
||||
vim.keymap.set({ 'n', 'v' }, '<leader>fa', vim.lsp.buf.code_action, { desc = '[F]ind Code [A]ctions', ${opts} })
|
||||
end
|
||||
-- Enable formatting if supported
|
||||
if capabilities.documentFormattingProvider then
|
||||
vim.keymap.set('n', '<leader>w', function() require("conform").format({ lsp_fallback = true }) end, { desc = 'Format Buffer', ${opts} })
|
||||
end
|
||||
-- Other keybinds
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, { desc = '[G]o to [D]efinition', ${opts} })
|
||||
vim.keymap.set('n', 'gt', vim.lsp.buf.type_definition, { desc = '[G]o to [T]ype Definition', ${opts} })
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, { desc = '[G]o to [I]mplementation', ${opts} })
|
||||
end
|
||||
-- Enable inlay hints if supported
|
||||
if capabilities.inlayHintProvider then
|
||||
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
|
||||
end
|
||||
-- Some Lsp servers do not advertise inlay hints properly so enable this keybinding regardless
|
||||
vim.keymap.set('n', '<space>ht', function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({bufnr = 0}), { bufnr = 0 })
|
||||
end,
|
||||
{ desc = '[H]ints [T]oggle', ${opts} }
|
||||
)
|
||||
-- Enable hover if supported
|
||||
if capabilities.hoverProvider then
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, { desc = 'Hover Documentation', ${opts} })
|
||||
end
|
||||
-- Enable rename if supported
|
||||
if capabilities.renameProvider then
|
||||
vim.keymap.set('n', '<leader>r', vim.lsp.buf.rename, { desc = '[R]ename', ${opts} })
|
||||
end
|
||||
-- Enable code actions if supported
|
||||
if capabilities.codeActionProvider then
|
||||
vim.keymap.set({ 'n', 'v' }, '<leader>fa', vim.lsp.buf.code_action, { desc = '[F]ind Code [A]ctions', ${opts} })
|
||||
end
|
||||
-- Enable formatting if supported
|
||||
if capabilities.documentFormattingProvider then
|
||||
vim.keymap.set('n', '<leader>w', function() require("conform").format({ lsp_fallback = true }) end, { desc = 'Format Buffer', ${opts} })
|
||||
end
|
||||
-- Other keybinds
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, { desc = '[G]o to [D]efinition', ${opts} })
|
||||
vim.keymap.set('n', 'gt', vim.lsp.buf.type_definition, { desc = '[G]o to [T]ype Definition', ${opts} })
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, { desc = '[G]o to [I]mplementation', ${opts} })
|
||||
end
|
||||
'';
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
{ lib, config, ... }:
|
||||
let
|
||||
cfg = config.jhome.nvim;
|
||||
in {
|
||||
imports = [./options.nix];
|
||||
in
|
||||
{
|
||||
imports = [ ./options.nix ];
|
||||
|
||||
config.programs.nixvim = lib.mkMerge [
|
||||
./standalone.nix
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{pkgs}: {
|
||||
vim-jjdescription = pkgs.callPackage ./vim-jjdescription.nix {};
|
||||
nvim-silicon = pkgs.callPackage ./nvim-silicon.nix {};
|
||||
{ pkgs }:
|
||||
{
|
||||
vim-jjdescription = pkgs.callPackage ./vim-jjdescription.nix { };
|
||||
nvim-silicon = pkgs.callPackage ./nvim-silicon.nix { };
|
||||
}
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
{
|
||||
vimUtils,
|
||||
fetchFromGitHub,
|
||||
}:
|
||||
{ vimUtils, fetchFromGitHub }:
|
||||
vimUtils.buildVimPlugin {
|
||||
name = "nvim-silicon";
|
||||
src = fetchFromGitHub {
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
{
|
||||
vimUtils,
|
||||
fetchFromGitHub,
|
||||
}:
|
||||
{ vimUtils, fetchFromGitHub }:
|
||||
vimUtils.buildVimPlugin {
|
||||
name = "jjdescription";
|
||||
src = fetchFromGitHub {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{helpers, ...}: let
|
||||
{ helpers, ... }:
|
||||
let
|
||||
inherit (helpers) mkRaw;
|
||||
in {
|
||||
in
|
||||
{
|
||||
config.keymaps = [
|
||||
# Quickfix
|
||||
{
|
||||
|
@ -53,10 +55,10 @@ in {
|
|||
key = "<leader>dj";
|
||||
action =
|
||||
mkRaw
|
||||
# lua
|
||||
''
|
||||
vim.diagnostic.goto_next
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
vim.diagnostic.goto_next
|
||||
'';
|
||||
options.desc = "Diagnostics next [J]";
|
||||
}
|
||||
{
|
||||
|
@ -64,10 +66,10 @@ in {
|
|||
key = "<leader>dk";
|
||||
action =
|
||||
mkRaw
|
||||
# lua
|
||||
''
|
||||
vim.diagnostic.goto_prev
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
vim.diagnostic.goto_prev
|
||||
'';
|
||||
options.desc = "Diagnostics previous [K]";
|
||||
}
|
||||
{
|
||||
|
@ -75,10 +77,10 @@ in {
|
|||
key = "<leader>xx";
|
||||
action =
|
||||
mkRaw
|
||||
# lua
|
||||
''
|
||||
require('trouble').toggle
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
require('trouble').toggle
|
||||
'';
|
||||
options.desc = "Toggle trouble";
|
||||
}
|
||||
{
|
||||
|
@ -86,10 +88,10 @@ in {
|
|||
key = "<leader>xw";
|
||||
action =
|
||||
mkRaw
|
||||
# lua
|
||||
''
|
||||
function() require('trouble').toggle('workspace_diagnostics') end
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
function() require('trouble').toggle('workspace_diagnostics') end
|
||||
'';
|
||||
options.desc = "Toggle Workspace trouble";
|
||||
}
|
||||
{
|
||||
|
@ -97,10 +99,10 @@ in {
|
|||
key = "<leader>xd";
|
||||
action =
|
||||
mkRaw
|
||||
# lua
|
||||
''
|
||||
function() require('trouble').toggle('document_diagnostics') end
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
function() require('trouble').toggle('document_diagnostics') end
|
||||
'';
|
||||
options.desc = "Toggle Document trouble";
|
||||
}
|
||||
{
|
||||
|
@ -108,10 +110,10 @@ in {
|
|||
key = "<leader>xq";
|
||||
action =
|
||||
mkRaw
|
||||
# lua
|
||||
''
|
||||
function() require('trouble').toggle('quickfix') end
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
function() require('trouble').toggle('quickfix') end
|
||||
'';
|
||||
options.desc = "Toggle Quickfix trouble";
|
||||
}
|
||||
{
|
||||
|
@ -119,10 +121,10 @@ in {
|
|||
key = "<leader>xl";
|
||||
action =
|
||||
mkRaw
|
||||
# lua
|
||||
''
|
||||
function() require('trouble').toggle('loclist') end
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
function() require('trouble').toggle('loclist') end
|
||||
'';
|
||||
options.desc = "Toggle Loclist trouble";
|
||||
}
|
||||
{
|
||||
|
@ -130,10 +132,10 @@ in {
|
|||
key = "gR";
|
||||
action =
|
||||
mkRaw
|
||||
# lua
|
||||
''
|
||||
function() require('trouble').toggle('lsp_references') end
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
function() require('trouble').toggle('lsp_references') end
|
||||
'';
|
||||
options.desc = "Toggle lsp References trouble";
|
||||
}
|
||||
# Telescope
|
||||
|
@ -142,10 +144,10 @@ in {
|
|||
key = "<leader>ff";
|
||||
action =
|
||||
mkRaw
|
||||
# lua
|
||||
''
|
||||
require('telescope.builtin').find_files
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
require('telescope.builtin').find_files
|
||||
'';
|
||||
options.desc = "Find Files";
|
||||
}
|
||||
{
|
||||
|
@ -153,10 +155,10 @@ in {
|
|||
key = "<leader>fg";
|
||||
action =
|
||||
mkRaw
|
||||
# lua
|
||||
''
|
||||
require('telescope.builtin').live_grep
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
require('telescope.builtin').live_grep
|
||||
'';
|
||||
options.desc = "Find Grep";
|
||||
}
|
||||
{
|
||||
|
@ -164,10 +166,10 @@ in {
|
|||
key = "<leader>fh";
|
||||
action =
|
||||
mkRaw
|
||||
# lua
|
||||
''
|
||||
require('telescope.builtin').help_tags
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
require('telescope.builtin').help_tags
|
||||
'';
|
||||
options.desc = "Find Help";
|
||||
}
|
||||
{
|
||||
|
@ -175,10 +177,10 @@ in {
|
|||
key = "<leader>fb";
|
||||
action =
|
||||
mkRaw
|
||||
# lua
|
||||
''
|
||||
require('telescope.builtin').buffers
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
require('telescope.builtin').buffers
|
||||
'';
|
||||
options.desc = "Find Buffer";
|
||||
}
|
||||
{
|
||||
|
@ -186,10 +188,10 @@ in {
|
|||
key = "<leader>fd";
|
||||
action =
|
||||
mkRaw
|
||||
# lua
|
||||
''
|
||||
require('telescope.builtin').diagnostics
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
require('telescope.builtin').diagnostics
|
||||
'';
|
||||
options.desc = "Find Diagnostics";
|
||||
}
|
||||
{
|
||||
|
@ -197,10 +199,10 @@ in {
|
|||
key = "<leader>fq";
|
||||
action =
|
||||
mkRaw
|
||||
# lua
|
||||
''
|
||||
require('telescope.builtin').quickfix
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
require('telescope.builtin').quickfix
|
||||
'';
|
||||
options.desc = "Find Quickfix";
|
||||
}
|
||||
{
|
||||
|
@ -208,10 +210,10 @@ in {
|
|||
key = "<leader>w";
|
||||
action =
|
||||
mkRaw
|
||||
# lua
|
||||
''
|
||||
require('conform').format
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
require('conform').format
|
||||
'';
|
||||
options.desc = "Format buffer";
|
||||
}
|
||||
# Nvim Silicon
|
||||
|
@ -220,11 +222,11 @@ in {
|
|||
key = "<leader>sc";
|
||||
action =
|
||||
mkRaw
|
||||
# lua
|
||||
''
|
||||
require('nvim-silicon').clip
|
||||
# lua
|
||||
''
|
||||
require('nvim-silicon').clip
|
||||
|
||||
'';
|
||||
'';
|
||||
options.desc = "Snap Code (to clipboard)";
|
||||
}
|
||||
];
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
{lib, ...}: {
|
||||
options.jhome.nvim.enable =
|
||||
lib.mkEnableOption "jalil's neovim configuration"
|
||||
// {
|
||||
default = true;
|
||||
example = false;
|
||||
};
|
||||
{ lib, ... }:
|
||||
{
|
||||
options.jhome.nvim.enable = lib.mkEnableOption "jalil's neovim configuration" // {
|
||||
default = true;
|
||||
example = false;
|
||||
};
|
||||
}
|
||||
|
|
149
nvim/plugins.nix
149
nvim/plugins.nix
|
@ -3,9 +3,11 @@
|
|||
pkgs,
|
||||
helpers,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
inherit (helpers) mkRaw;
|
||||
in {
|
||||
in
|
||||
{
|
||||
config.plugins = {
|
||||
bacon = {
|
||||
enable = true;
|
||||
|
@ -17,38 +19,32 @@ in {
|
|||
"/" = {
|
||||
mapping =
|
||||
mkRaw
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
cmp.mapping.preset.cmdline()
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
cmp.mapping.preset.cmdline()
|
||||
'';
|
||||
sources = [
|
||||
{name = "rg";}
|
||||
{name = "buffer";}
|
||||
{ name = "rg"; }
|
||||
{ name = "buffer"; }
|
||||
];
|
||||
};
|
||||
":" = {
|
||||
mapping =
|
||||
mkRaw
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
cmp.mapping.preset.cmdline()
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
cmp.mapping.preset.cmdline()
|
||||
'';
|
||||
sources = [
|
||||
{name = "path";}
|
||||
{name = "cmdline";}
|
||||
{ name = "path"; }
|
||||
{ name = "cmdline"; }
|
||||
];
|
||||
};
|
||||
};
|
||||
settings = {
|
||||
# Snippets
|
||||
snippet.expand =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
# lua
|
||||
''
|
||||
function(args) require('luasnip').lsp_expand(args.body) end
|
||||
'';
|
||||
|
@ -105,73 +101,74 @@ in {
|
|||
];
|
||||
mapping =
|
||||
mkRaw
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
cmp.mapping.preset.insert({
|
||||
["<C-n>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require("luasnip").expand_or_jumpable() then
|
||||
require("luasnip").expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<C-p>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif require("luasnip").jumpable(-1) then
|
||||
require("luasnip").jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<C-u>"] = cmp.mapping(function(fallback)
|
||||
if require("luasnip").choice_active() then
|
||||
require("luasnip").next_choice()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete { },
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm { select = true },
|
||||
})
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
cmp.mapping.preset.insert({
|
||||
["<C-n>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require("luasnip").expand_or_jumpable() then
|
||||
require("luasnip").expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<C-p>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif require("luasnip").jumpable(-1) then
|
||||
require("luasnip").jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<C-u>"] = cmp.mapping(function(fallback)
|
||||
if require("luasnip").choice_active() then
|
||||
require("luasnip").next_choice()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete { },
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm { select = true },
|
||||
})
|
||||
'';
|
||||
};
|
||||
};
|
||||
# FIXME: doesn't include formatters
|
||||
conform-nvim = {
|
||||
enable = true;
|
||||
formattersByFt = {
|
||||
"_" = ["trim_whitespace"];
|
||||
c = ["clang_format"];
|
||||
cpp = ["clang_format"];
|
||||
lua = ["stylua"];
|
||||
nix = ["alejandra"];
|
||||
rust = ["rustfmt"];
|
||||
sh = ["shfmt"];
|
||||
toml = ["taplo"];
|
||||
yaml = ["yamlfmt"];
|
||||
zig = ["zigfmt"];
|
||||
"_" = [ "trim_whitespace" ];
|
||||
c = [ "clang_format" ];
|
||||
cpp = [ "clang_format" ];
|
||||
lua = [ "stylua" ];
|
||||
nix = [ "alejandra" ];
|
||||
rust = [ "rustfmt" ];
|
||||
sh = [ "shfmt" ];
|
||||
toml = [ "taplo" ];
|
||||
yaml = [ "yamlfmt" ];
|
||||
zig = [ "zigfmt" ];
|
||||
};
|
||||
};
|
||||
gitsigns.enable = true;
|
||||
lint = {
|
||||
enable = true;
|
||||
lintersByFt = {
|
||||
rust = ["typos"];
|
||||
latex = ["chktex" "typos"];
|
||||
markdown = ["typos"];
|
||||
nix = ["statix"];
|
||||
sh = ["dash"];
|
||||
zsh = ["zsh"];
|
||||
rust = [ "typos" ];
|
||||
latex = [
|
||||
"chktex"
|
||||
"typos"
|
||||
];
|
||||
markdown = [ "typos" ];
|
||||
nix = [ "statix" ];
|
||||
sh = [ "dash" ];
|
||||
zsh = [ "zsh" ];
|
||||
};
|
||||
};
|
||||
lsp = {
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
{pkgs, ...}: {
|
||||
imports = [./options.nix ./plugins.nix ./mappings.nix ./augroups.nix];
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
./options.nix
|
||||
./plugins.nix
|
||||
./mappings.nix
|
||||
./augroups.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
globals.mapleader = " ";
|
||||
|
@ -34,15 +40,17 @@
|
|||
# Enable local configuration :h 'exrc'
|
||||
exrc = true; # safe since nvim 0.9
|
||||
};
|
||||
extraPlugins = let
|
||||
plugins = pkgs.unstable.vimPlugins;
|
||||
extraPlugins = import ./extraPlugins {pkgs = pkgs.unstable;};
|
||||
in [
|
||||
plugins.nui-nvim
|
||||
plugins.nvim-web-devicons
|
||||
extraPlugins.vim-jjdescription
|
||||
extraPlugins.nvim-silicon
|
||||
];
|
||||
extraPlugins =
|
||||
let
|
||||
plugins = pkgs.unstable.vimPlugins;
|
||||
extraPlugins = import ./extraPlugins { pkgs = pkgs.unstable; };
|
||||
in
|
||||
[
|
||||
plugins.nui-nvim
|
||||
plugins.nvim-web-devicons
|
||||
extraPlugins.vim-jjdescription
|
||||
extraPlugins.nvim-silicon
|
||||
];
|
||||
# Formatting & linters
|
||||
extraPackages = [
|
||||
pkgs.unstable.silicon
|
||||
|
|
|
@ -1,28 +1,29 @@
|
|||
{stylix}: {
|
||||
{ stylix }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
cfg = config.jconfig;
|
||||
keysFromGithub =
|
||||
lib.attrsets.mapAttrs' (username: sha256: {
|
||||
name = "pubkeys/${username}";
|
||||
value = {
|
||||
mode = "0755";
|
||||
source = builtins.fetchurl {
|
||||
inherit sha256;
|
||||
url = "https://github.com/${username}.keys";
|
||||
};
|
||||
keysFromGithub = lib.attrsets.mapAttrs' (username: sha256: {
|
||||
name = "pubkeys/${username}";
|
||||
value = {
|
||||
mode = "0755";
|
||||
source = builtins.fetchurl {
|
||||
inherit sha256;
|
||||
url = "https://github.com/${username}.keys";
|
||||
};
|
||||
})
|
||||
cfg.importSSHKeysFromGithub;
|
||||
in {
|
||||
};
|
||||
}) cfg.importSSHKeysFromGithub;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./options.nix
|
||||
./gui
|
||||
stylix.nixosModules.stylix
|
||||
{stylix = import ./stylix-config.nix {inherit config pkgs;};}
|
||||
{ stylix = import ./stylix-config.nix { inherit config pkgs; }; }
|
||||
];
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
@ -86,8 +87,8 @@ in {
|
|||
users.defaultUserShell = pkgs.zsh;
|
||||
# Open ports for spotifyd
|
||||
networking.firewall = {
|
||||
allowedUDPPorts = [5353];
|
||||
allowedTCPPorts = [2020];
|
||||
allowedUDPPorts = [ 5353 ];
|
||||
allowedTCPPorts = [ 2020 ];
|
||||
};
|
||||
# Nix Settings
|
||||
nix = {
|
||||
|
|
|
@ -3,24 +3,24 @@
|
|||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
cfg = config.jconfig.gui;
|
||||
enable = config.jconfig.enable && cfg.enable;
|
||||
in {
|
||||
in
|
||||
{
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf enable {
|
||||
environment.systemPackages =
|
||||
[
|
||||
pkgs.gnome.adwaita-icon-theme
|
||||
pkgs.adwaita-qt
|
||||
pkgs.nordzy-cursor-theme
|
||||
pkgs.pinentry-qt
|
||||
]
|
||||
++ lib.optional cfg.ydotool.enable pkgs.ydotool;
|
||||
environment.systemPackages = [
|
||||
pkgs.gnome.adwaita-icon-theme
|
||||
pkgs.adwaita-qt
|
||||
pkgs.nordzy-cursor-theme
|
||||
pkgs.pinentry-qt
|
||||
] ++ lib.optional cfg.ydotool.enable pkgs.ydotool;
|
||||
systemd = {
|
||||
user.services.ydotool = lib.mkIf cfg.ydotool.enable {
|
||||
enable = cfg.ydotool.autoStart;
|
||||
wantedBy = ["default.target"];
|
||||
wantedBy = [ "default.target" ];
|
||||
description = "Generic command-line automation tool";
|
||||
documentation = [
|
||||
"man:ydotool(1)"
|
||||
|
@ -47,7 +47,7 @@ in {
|
|||
sway = {
|
||||
enable = cfg.sway;
|
||||
# No extra packages (by default it adds foot, dmenu, and other stuff)
|
||||
extraPackages = [];
|
||||
extraPackages = [ ];
|
||||
wrapperFeatures = {
|
||||
base = true;
|
||||
gtk = true;
|
||||
|
@ -77,7 +77,7 @@ in {
|
|||
# XDG portals
|
||||
enable = true;
|
||||
wlr.enable = true;
|
||||
extraPortals = [pkgs.xdg-desktop-portal-gtk];
|
||||
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
|
||||
config.preferred = {
|
||||
# Default to the gtk portal
|
||||
default = "gtk";
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
{lib, ...}: let
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib) types;
|
||||
# Like mkEnableOption but defaults to true
|
||||
mkDisableOption = option:
|
||||
mkDisableOption =
|
||||
option:
|
||||
(lib.mkEnableOption option)
|
||||
// {
|
||||
default = true;
|
||||
example = false;
|
||||
};
|
||||
mkImageOption = {
|
||||
description,
|
||||
url,
|
||||
sha256 ? "",
|
||||
}:
|
||||
mkImageOption =
|
||||
{
|
||||
description,
|
||||
url,
|
||||
sha256 ? "",
|
||||
}:
|
||||
lib.mkOption {
|
||||
inherit description;
|
||||
type = types.path;
|
||||
default = builtins.fetchurl {inherit url sha256;};
|
||||
default = builtins.fetchurl { inherit url sha256; };
|
||||
defaultText = lib.literalMD "![${description}](${url})";
|
||||
};
|
||||
|
||||
|
@ -28,7 +31,7 @@
|
|||
steamHardwareSupport = mkDisableOption "steam hardware support";
|
||||
ydotool = lib.mkOption {
|
||||
description = "Jalil's default ydotool configuration.";
|
||||
default = {};
|
||||
default = { };
|
||||
type = types.submodule {
|
||||
options.enable = mkDisableOption "ydotool";
|
||||
options.autoStart = mkDisableOption "autostarting ydotool at login";
|
||||
|
@ -56,17 +59,17 @@
|
|||
enable = lib.mkEnableOption "jalil's default configuration.";
|
||||
dev = lib.mkOption {
|
||||
description = "Options for setting up a dev environment";
|
||||
default = {};
|
||||
type = types.submodule {options.enable = lib.mkEnableOption "dev configuration";};
|
||||
default = { };
|
||||
type = types.submodule { options.enable = lib.mkEnableOption "dev configuration"; };
|
||||
};
|
||||
gui = lib.mkOption {
|
||||
description = "Jalil's default configuration for a NixOS gui.";
|
||||
default = {};
|
||||
default = { };
|
||||
type = types.submodule gui;
|
||||
};
|
||||
styling = lib.mkOption {
|
||||
description = "Jalil's styling options";
|
||||
default = {};
|
||||
default = { };
|
||||
type = types.submodule styling;
|
||||
};
|
||||
importSSHKeysFromGithub = lib.mkOption {
|
||||
|
@ -83,17 +86,18 @@
|
|||
`users.users.<name>.openssh.authorizedKeys.keyFiles` on the users you
|
||||
want to allow ssh logins.
|
||||
'';
|
||||
default = {};
|
||||
default = { };
|
||||
example = {
|
||||
"jalil-salame" = "sha256:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
|
||||
};
|
||||
type = types.attrsOf types.str;
|
||||
};
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.jconfig = lib.mkOption {
|
||||
description = "Jalil's default NixOS configuration.";
|
||||
default = {};
|
||||
default = { };
|
||||
type = types.submodule config;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
}: let
|
||||
{ config, pkgs }:
|
||||
let
|
||||
cfg = config.jconfig.styling;
|
||||
in {
|
||||
in
|
||||
{
|
||||
inherit (cfg) enable;
|
||||
image = cfg.wallpaper;
|
||||
base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml";
|
||||
|
|
Loading…
Reference in a new issue