split neovim config

This commit is contained in:
iofq 2023-05-14 13:06:56 -05:00
parent 8fb6118bcd
commit 5df8317a4a
19 changed files with 239 additions and 195 deletions

97
flake.lock generated
View file

@ -1,5 +1,23 @@
{ {
"nodes": { "nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -7,11 +25,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1682203081, "lastModified": 1683651229,
"narHash": "sha256-kRL4ejWDhi0zph/FpebFYhzqlOBrk0Pl3dzGEKSAlEw=", "narHash": "sha256-HN0Mw8g1XQIrcdyzqT00YW0Uqi/V/BUUUAgvcK1pcSM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "32d3e39c491e2f91152c84f8ad8b003420eab0a1", "rev": "983f8a1bb965b261492123cd8e2d07da46d4d50a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -22,11 +40,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1680876084, "lastModified": 1683269598,
"narHash": "sha256-eP9yxP0wc7XuVaODugh+ajgbFGaile2O1ihxiLxOuvU=", "narHash": "sha256-KNsb+nBbB1Fmxd07dt4E0KXMT4YeKJB7gQaA6Xfk+mo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "3006d2860a6ed5e01b0c3e7ffb730e9b293116e2", "rev": "51559e691f1493a26f94f1df1aaf516bb507e78b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -38,11 +56,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1682453498, "lastModified": 1683408522,
"narHash": "sha256-WoWiAd7KZt5Eh6n+qojcivaVpnXKqBsVgpixpV2L9CE=", "narHash": "sha256-9kcPh6Uxo17a3kK3XCHhcWiV1Yu1kYj22RHiymUhMkU=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c8018361fa1d1650ee8d4b96294783cf564e8a7f", "rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -52,35 +70,24 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-stable": { "nvim": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": { "locked": {
"lastModified": 1682817260, "lastModified": 1683960683,
"narHash": "sha256-kFMXzKNj4d/0Iqbm5l57rHSLyUeyCLMuvlROZIuuhvk=", "narHash": "sha256-hCKwb272GS5uM2eHGs1O9EMZHQIdhh51yIKYPY7Mc/E=",
"owner": "NixOS", "owner": "iofq",
"repo": "nixpkgs", "repo": "nvim.nix",
"rev": "db1e4eeb0f9a9028bcb920e00abbc1409dd3ef36", "rev": "bfc15eb6cb362845375e92df2298b0d776bbbbe1",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "iofq",
"ref": "release-22.11", "repo": "nvim.nix",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1682779028,
"narHash": "sha256-tFfSbwSLobpHRznAa35KEU3R+fsFWTlmpFhTUdXq8RE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "54abe781c482f51ff4ff534ebaba77db5bd97442",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
@ -89,25 +96,21 @@
"home-manager": "home-manager", "home-manager": "home-manager",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"sops-nix": "sops-nix" "nvim": "nvim"
} }
}, },
"sops-nix": { "systems": {
"inputs": {
"nixpkgs": "nixpkgs_2",
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": { "locked": {
"lastModified": 1682823324, "lastModified": 1681028828,
"narHash": "sha256-KNu3OAqVyoKwnDP+gqptjQYCnZXxEwXccR89c0r1/8k=", "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "Mic92", "owner": "nix-systems",
"repo": "sops-nix", "repo": "default",
"rev": "4f308f76633f81253a12b80e7b05b80d325005b2", "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "Mic92", "owner": "nix-systems",
"repo": "sops-nix", "repo": "default",
"type": "github" "type": "github"
} }
} }

View file

@ -1,5 +1,5 @@
{ {
description = "Home Manager configuration"; description = "Home Manager && NixOS configuration";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
@ -8,17 +8,18 @@
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
sops-nix.url = "github:Mic92/sops-nix"; nvim = {
url = "github:iofq/nvim.nix";
inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = { self, nixpkgs, home-manager, nixos-hardware, sops-nix, ... }: };
outputs = { self, nixpkgs, home-manager, nixos-hardware, ... } @inputs:
let let
username = "e"; username = "e";
in { in {
nixosConfigurations = ( nixosConfigurations = ( import ./nixos { inherit inputs; } );
import ./hosts { homeConfigurations = (
inherit (nixpkgs) lib; import ./home { inherit inputs; }
inherit nixpkgs home-manager nixos-hardware sops-nix username;
}
); );
}; };
} }

31
home/common.nix Executable file
View file

@ -0,0 +1,31 @@
{ inputs, pkgs, ... }:
{
imports = ( import ../modules/programs );
programs.home-manager.enable = true;
nixpkgs.config.allowUnfree = true;
nix = {
settings = {
auto-optimise-store = true;
};
package = pkgs.nixFlakes;
registry.nixpkgs.flake = inputs.nixpkgs;
extraOptions = ''
experimental-features = nix-command flakes
'';
};
home = {
stateVersion = "22.11";
packages = with pkgs; [
pulseaudio
pulsemixer
alsa-utils
appimage-run
wireguard-tools
spleen
];
};
xdg.enable = true;
fonts.fontconfig.enable = true;
systemd.user.startServices = "sd-switch";
}

25
home/default.nix Normal file
View file

@ -0,0 +1,25 @@
{ inputs, ...}:
{
"e" = inputs.home-manager.lib.homeManagerConfiguration {
pkgs = import inputs.nixpkgs {
system = "x86_64-linux";
config.allowUnfree = true;
overlays = [
(final: prev: {
inherit (inputs.nvim.packages.${final.system}) iofqvim;
})
];
};
extraSpecialArgs = {
inherit inputs;
host = {
hostName = "t14";
username = "e";
};
};
modules = [
./t14/home.nix
];
};
}

View file

@ -1,19 +1,19 @@
{ username, pkgs, ... }: { pkgs, ... }:
{ {
imports = [ imports = [
../../modules/wayland ../../modules/wayland
../../modules/librewolf ../../modules/librewolf
../home.nix ../common.nix
]; ];
home = { home = {
username = "e";
homeDirectory = "/home/e";
packages = with pkgs; [ packages = with pkgs; [
pulseaudio
pulsemixer
alsa-utils
discord discord
signal-desktop signal-desktop
runelite runelite
framesh framesh
iofqvim
]; ];
}; };
} }

View file

@ -1,47 +0,0 @@
{ lib, nixpkgs, username, home-manager, nixos-hardware, sops-nix, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
lib = nixpkgs.lib;
in
{
t14 = lib.nixosSystem {
inherit system;
specialArgs = {
inherit username;
host = {
hostName = "t14";
};
};
modules = [
sops-nix.nixosModules.sops
./configuration.nix
./t14/configuration.nix
nixos-hardware.nixosModules.lenovo-thinkpad-t14-amd-gen1
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = {
inherit username;
};
home-manager.sharedModules = [
sops-nix.homeManagerModule
];
home-manager.users.${username} = {
programs.home-manager.enable = true;
imports = [
./t14/home.nix
];
};
}
];
};
}

View file

@ -1,17 +0,0 @@
{ username, pkgs, ... }:
{
imports = ( import ../modules/programs );
home = {
inherit username;
stateVersion = "22.11";
packages = with pkgs; [
htop
appimage-run
ripgrep
fluxcd
k9s
];
};
systemd.user.startServices = "sd-switch";
xdg.enable = true;
}

View file

@ -28,7 +28,4 @@
enable = true; enable = true;
pinentryFlavor = "curses"; pinentryFlavor = "curses";
}; };
home.packages = with pkgs; [
oath-toolkit
];
} }

View file

@ -1,6 +1,7 @@
[ [
./dev.nix
./alacritty ./alacritty
./nvim #./nvim
./shell ./shell
./git ./git
./2fa ./2fa

10
modules/programs/dev.nix Normal file
View file

@ -0,0 +1,10 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
ripgrep
fluxcd
k9s
kubectl
python3
];
}

View file

@ -41,4 +41,4 @@
telescope-nvim telescope-nvim
]; ];
}; };
} }

View file

@ -1,4 +1,4 @@
{ homeDirectory, pkgs, ...}: { pkgs, host, ...}:
{ {
imports = [ imports = [
(import ./tmux.nix) (import ./tmux.nix)
@ -19,9 +19,8 @@
":q" = "exit"; ":q" = "exit";
mpv = "mpv --no-keepaspect-window"; mpv = "mpv --no-keepaspect-window";
sus = "systemctl suspend"; sus = "systemctl suspend";
gitu = "git add . && git commit && git push"; hms = "home-manager switch --flake $NIX_FLAKE#${host.username}";
rcp = "rsync -avh --progress"; rbs = "sudo nixos-rebuild switch --flake $NIX_FLAKE#${host.hostName}";
}; };
shellOptions = [ shellOptions = [
"cmdhist" "cmdhist"
@ -39,6 +38,7 @@
export MANPAGER="nvim +Man!" export MANPAGER="nvim +Man!"
export EDITOR="nvim" export EDITOR="nvim"
export _JAVA_AWT_WM_NONREPARENTING=1 export _JAVA_AWT_WM_NONREPARENTING=1
export NIX_FLAKE="/home/e/dev/nix"
[[ $- != *i* ]] && return [[ $- != *i* ]] && return
function exists { function exists {
type $1 >/dev/null 2>&1 type $1 >/dev/null 2>&1

View file

@ -130,10 +130,6 @@
}; };
}; };
}; };
extraConfig=''
bindswitch lid:on output eDP-1 disable
bindswitch lid:off output eDP-1 enable
'';
}; };
programs.i3status = { programs.i3status = {
enable = true; enable = true;
@ -202,11 +198,11 @@
events = [ events = [
{ event = "lock"; command = "${pkgs.swaylock}/bin/swaylock";} { event = "lock"; command = "${pkgs.swaylock}/bin/swaylock";}
{ event = "before-sleep"; command = "${pkgs.swaylock}/bin/swaylock";} { event = "before-sleep"; command = "${pkgs.swaylock}/bin/swaylock";}
{ event = "after-resume"; command = "${pkgs.sway}/bin/swaymsg \"output * power on\"";} { event = "after-resume"; command = "${pkgs.sway}/bin/swaymsg \"output * toggle\"";}
]; ];
timeouts = [ timeouts = [
{ timeout = 600; command = "${pkgs.swaylock}/bin/swaylock";} { timeout = 600; command = "${pkgs.swaylock}/bin/swaylock";}
{ timeout = 1200; command = "${pkgs.sway}/bin/swaymsg \"output * power off\"";} { timeout = 1200; command = "${pkgs.sway}/bin/swaymsg \"output * toggle\"";}
]; ];
}; };
services.kanshi = { services.kanshi = {

View file

@ -1,10 +1,13 @@
{ config, pkgs, username, ... }: { packages, host, ... }:
{ {
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
time.timeZone = "America/Chicago";
users.users.${username} = { users.groups.plugdev = {}; # Create plugdev group
users.users.${host.username} = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ extraGroups = [
"wheel" "wheel"
@ -12,8 +15,17 @@
"video" "video"
]; ];
}; };
users.groups.plugdev = {};
security.pam.services.swaylock = {}; security.pam.services.swaylock = {};
time.timeZone = "America/Chicago";
# Enable flakes and unfree packages
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.gc = {
automatic = true;
dates = "00:00";
options = "--delete-older-than 14d";
};
nixpkgs.config.allowUnfree = true;
system.stateVersion = "22.11"; system.stateVersion = "22.11";
} }

21
nixos/default.nix Normal file
View file

@ -0,0 +1,21 @@
{ inputs, ... }:
let
in
{ t14 = inputs.nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs;
system = "x86_64-linux";
host = {
hostName = "t14";
username = "e";
};
};
modules = [
./configuration.nix
./t14/configuration.nix
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t14-amd-gen1
];
};
}

View file

@ -1,28 +1,24 @@
{ config, pkgs, nixos-hardware, sops-nix, ... }: { pkgs, nixos-hardware, host, ... }:
{ {
imports = imports =
[ [
./hardware-configuration.nix ./hardware-configuration.nix
./nano.nix ./nano.nix
]; ];
networking.hostName = "t14"; networking.hostName = host.hostName;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
cryptsetup cryptsetup
]; ];
fonts = {
fonts = with pkgs; [
spleen
roboto
];
};
programs.light.enable = true; programs.light.enable = true;
services.pipewire = { services.pipewire = {
enable = true; enable = true;
alsa.enable = true; alsa.enable = true;
pulse.enable = true; pulse.enable = true;
}; };
nixpkgs.config.allowUnfree = true;
boot.kernelPackages = pkgs.linuxPackages_latest;
hardware.opengl.enable = true; hardware.opengl.enable = true;
boot.kernelPackages = pkgs.linuxPackages_latest;
system.stateVersion = "22.11"; system.stateVersion = "22.11";
} }

15
shell.nix Normal file
View file

@ -0,0 +1,15 @@
# devshell for bootstrapping nixos and home-manager
# nix develop
{ pkgs }: {
default = pkgs.mkShell {
NIX_CONFIG = "experimental-features = nix-command flakes";
nativeBuildInputs = with pkgs; [
nix
home-manager
git
vim
];
};
}