mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-23 16:29:42 -04:00
WSL + more modularity
This commit is contained in:
parent
7b63b3b04f
commit
e513913099
57 changed files with 356 additions and 92 deletions
73
flake.lock
generated
73
flake.lock
generated
|
|
@ -1,5 +1,39 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1701680307,
|
||||
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
|
@ -21,6 +55,29 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-wsl": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1702823833,
|
||||
"narHash": "sha256-Sreo1VEMSwS/T83QxXeN1cDtgXWXPMibGYfQ8pLLSVc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NixOS-WSL",
|
||||
"rev": "34eda458bd3f6bad856a99860184d775bc1dd588",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "2311.5.3",
|
||||
"repo": "NixOS-WSL",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1705916986,
|
||||
|
|
@ -40,8 +97,24 @@
|
|||
"root": {
|
||||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
"nixos-wsl": "nixos-wsl",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
|
|||
38
flake.nix
38
flake.nix
|
|
@ -7,9 +7,13 @@
|
|||
url = "github:nix-community/home-manager/release-23.11";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nixos-wsl = {
|
||||
url = "github:nix-community/NixOS-WSL/2311.5.3";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, home-manager }:
|
||||
outputs = { self, nixpkgs, home-manager, nixos-wsl }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpkgs {
|
||||
|
|
@ -24,12 +28,40 @@
|
|||
nixosConfigurations.desktop = nixpkgs.lib.nixosSystem {
|
||||
inherit system pkgs;
|
||||
modules = [
|
||||
./sysConfig/desktop
|
||||
./src/systems/desktop
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.bryan = import ./homeConfig/home.nix;
|
||||
home-manager.users.bryan = import ./src/systems/desktop/home.nix;
|
||||
}
|
||||
];
|
||||
};
|
||||
nixosConfigurations.windows = nixpkgs.lib.nixosSystem {
|
||||
inherit system pkgs;
|
||||
modules = [
|
||||
./src/systems/wsl
|
||||
nixos-wsl.nixosModules.wsl
|
||||
{
|
||||
wsl = {
|
||||
enable = true;
|
||||
defaultUser = nixpkgs.lib.mkDefault "bryan";
|
||||
nativeSystemd = true;
|
||||
|
||||
wslConf = {
|
||||
boot.command = "cd";
|
||||
network = {
|
||||
hostname = "plato";
|
||||
generateHosts = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.bryan = import ./src/systems/wsl/home.nix;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
imports = [ ./modules ../user ];
|
||||
|
||||
home.stateVersion = "22.11";
|
||||
|
||||
home.username = "${config.user.name}";
|
||||
home.homeDirectory = "/home/${config.user.name}";
|
||||
|
||||
modules = {
|
||||
bash.enable = true;
|
||||
git.enable = true;
|
||||
gpg.enable = true;
|
||||
gui.enable = true;
|
||||
security.enable = true;
|
||||
utils.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
nixup = "sudo nixos-rebuild switch --flake /etc/nixos/.#desktop";
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.vim;
|
||||
|
||||
in
|
||||
{ options.modules.vim = { enable = mkEnableOption "vim"; };
|
||||
config = mkIf cfg.enable {
|
||||
programs.vim = {
|
||||
enable = true;
|
||||
package = pkgs.vim;
|
||||
extraConfig = import ./config/vimrc;
|
||||
};
|
||||
programs.bash.shellAliases = {
|
||||
vi = "${pkgs.vim}/bin/vim";
|
||||
};
|
||||
};
|
||||
}
|
||||
3
src/modules/bash/config/alias.nix
Normal file
3
src/modules/bash/config/alias.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
cd = "cd -L";
|
||||
}
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.alacritty;
|
||||
cfg = config.modules.gui.alacritty;
|
||||
|
||||
in
|
||||
{ options.modules.alacritty = { enable = mkEnableOption "alacritty"; };
|
||||
{ options.modules.gui.alacritty = { enable = mkEnableOption "gui.alacritty"; };
|
||||
config = mkIf cfg.enable {
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.browsers;
|
||||
cfg = config.modules.gui.browsers;
|
||||
|
||||
in
|
||||
{ options.modules.browsers = { enable = mkEnableOption "browsers"; };
|
||||
{ options.modules.gui.browsers = { enable = mkEnableOption "gui.browsers"; };
|
||||
config = mkIf cfg.enable {
|
||||
programs.firefox.enable = true;
|
||||
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.corn;
|
||||
cfg = config.modules.gui.corn;
|
||||
|
||||
in
|
||||
{ options.modules.corn = { enable = mkEnableOption "corn"; };
|
||||
{ options.modules.gui.corn = { enable = mkEnableOption "gui.corn"; };
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
trezor-suite
|
||||
|
|
@ -4,7 +4,8 @@
|
|||
./browsers
|
||||
./corn
|
||||
./fun
|
||||
./guiUtils
|
||||
./utils
|
||||
./neovim
|
||||
./writing
|
||||
];
|
||||
}
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.fun;
|
||||
cfg = config.modules.gui.fun;
|
||||
|
||||
in
|
||||
{ options.modules.fun = { enable = mkEnableOption "fun"; };
|
||||
{ options.modules.gui.fun = { enable = mkEnableOption "gui.fun"; };
|
||||
config = mkIf cfg.enable {
|
||||
programs.obs-studio = {
|
||||
enable = true;
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.neovim;
|
||||
cfg = config.modules.gui.neovim;
|
||||
|
||||
in
|
||||
{ options.modules.neovim = { enable = mkEnableOption "neovim"; };
|
||||
{ options.modules.gui.neovim = { enable = mkEnableOption "gui.neovim"; };
|
||||
config = mkIf cfg.enable {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.guiUtils;
|
||||
cfg = config.modules.gui.utils;
|
||||
|
||||
in
|
||||
{ options.modules.guiUtils = { enable = mkEnableOption "guiUtils"; };
|
||||
{ options.modules.gui.utils = { enable = mkEnableOption "gui.utils"; };
|
||||
config = mkIf cfg.enable {
|
||||
programs.btop.enable = true;
|
||||
home.packages = with pkgs; [
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.gui.writing;
|
||||
|
||||
in
|
||||
{ options.modules.gui.writing = { enable = mkEnableOption "gui.writing"; };
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
mdbook
|
||||
texlive.combined.scheme-tetex
|
||||
pandoc
|
||||
asciidoctor
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
@ -55,14 +55,5 @@ in
|
|||
};
|
||||
|
||||
fonts.fontconfig.enable = true;
|
||||
|
||||
modules = {
|
||||
alacritty.enable = true;
|
||||
browsers.enable = true;
|
||||
corn.enable = true;
|
||||
fun.enable = true;
|
||||
guiUtils.enable = true;
|
||||
neovim.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -8,19 +8,11 @@ in
|
|||
{ options.modules.utils = { enable = mkEnableOption "utils"; };
|
||||
imports = [ ./modules ];
|
||||
config = mkIf cfg.enable {
|
||||
modules = {
|
||||
vim.enable = false;
|
||||
email.enable = true;
|
||||
irc.enable = true;
|
||||
dev.enable = true;
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
wget curl tree neofetch
|
||||
unzip fping calc qrencode
|
||||
fd pkg-config pciutils
|
||||
mdbook rsync pandoc texlive.combined.scheme-tetex
|
||||
zip asciidoctor
|
||||
rsync zip
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.dev;
|
||||
cfg = config.modules.utils.dev;
|
||||
|
||||
in
|
||||
{ options.modules.dev = { enable = mkEnableOption "dev"; };
|
||||
{ options.modules.utils.dev = { enable = mkEnableOption "utils.dev"; };
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
nix-init
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.email;
|
||||
cfg = config.modules.utils.email;
|
||||
|
||||
in
|
||||
{ options.modules.email = { enable = mkEnableOption "email"; };
|
||||
{ options.modules.utils.email = { enable = mkEnableOption "utils.email"; };
|
||||
config = mkIf cfg.enable {
|
||||
programs.aerc = {
|
||||
enable = true;
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.irc;
|
||||
cfg = config.modules.utils.irc;
|
||||
|
||||
in
|
||||
{ options.modules.irc = { enable = mkEnableOption "irc"; };
|
||||
{ options.modules.utils.irc = { enable = mkEnableOption "utils.irc"; };
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
weechat
|
||||
|
|
@ -14,14 +14,14 @@ autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
|||
|
||||
call plug#begin('~/.vim/plugged')
|
||||
|
||||
Plug 'joshdick/onedark.vim'
|
||||
Plug 'tpope/vim-surround'
|
||||
Plug 'jiangmiao/auto-pairs'
|
||||
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
||||
Plug 'junegunn/fzf.vim'
|
||||
Plug 'mtdl9/vim-log-highlighting'
|
||||
Plug 'machakann/vim-highlightedyank'
|
||||
Plug 'itchyny/lightline.vim'
|
||||
Plug 'joshdick/onedark.vim'
|
||||
Plug 'tpope/vim-surround'
|
||||
Plug 'jiangmiao/auto-pairs'
|
||||
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
||||
Plug 'junegunn/fzf.vim'
|
||||
Plug 'mtdl9/vim-log-highlighting'
|
||||
Plug 'machakann/vim-highlightedyank'
|
||||
Plug 'itchyny/lightline.vim'
|
||||
|
||||
call plug#end()
|
||||
|
||||
|
|
@ -34,17 +34,23 @@ let g:highlightedyank_highlight_duration = 80
|
|||
let g:lightline = { 'colorscheme': 'one', }
|
||||
|
||||
set laststatus=2
|
||||
|
||||
set number
|
||||
set relativenumber
|
||||
set cursorline
|
||||
|
||||
set noincsearch
|
||||
set clipboard=unnamedplus
|
||||
set ignorecase
|
||||
|
||||
set clipboard=unnamedplus
|
||||
set noswapfile
|
||||
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set expandtab
|
||||
|
||||
highlight CursorLine ctermbg=NONE guibg=NONE
|
||||
highlight CursorLineNr ctermfg=magenta guifg=magenta
|
||||
highlight HighlightedyankRegion ctermfg=NONE guifg=NONE
|
||||
highlight Normal ctermbg=NONE guibg=NONE
|
||||
highlight NormalNC ctermbg=NONE guibg=NONE
|
||||
|
|
@ -56,6 +62,7 @@ vnoremap > >gv
|
|||
|
||||
nnoremap <C-U> <C-U>zz
|
||||
nnoremap <C-D> <C-D>zz
|
||||
nnoremap <leader>e :Explore<CR>
|
||||
nnoremap <leader><ESC> :noh<CR>
|
||||
nnoremap <leader>/ :Rg<Space>
|
||||
nnoremap <Leader>ts :execute "normal! a" . strftime('[%b %d %H:%M:%S - BR]')<CR>
|
||||
22
src/modules/utils/modules/vim/default.nix
Normal file
22
src/modules/utils/modules/vim/default.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.utils.vim;
|
||||
|
||||
in
|
||||
{ options.modules.utils.vim = { enable = mkEnableOption "utils.vim"; };
|
||||
config = mkIf cfg.enable {
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
vim
|
||||
];
|
||||
file.".config/.vimrc" = {
|
||||
source = ./config/vimrc;
|
||||
};
|
||||
};
|
||||
programs.bash.shellAliases = {
|
||||
vi = "${pkgs.vim}/bin/vim";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
{ lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../../user
|
||||
43
src/systems/desktop/home.nix
Normal file
43
src/systems/desktop/home.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
programs.home-manager.enable = true;
|
||||
programs.bash.shellAliases = {
|
||||
nixup = "sudo nixos-rebuild switch --flake /etc/nixos/.#desktop";
|
||||
};
|
||||
|
||||
imports = [
|
||||
../../modules
|
||||
../../user
|
||||
];
|
||||
|
||||
home.stateVersion = "22.11";
|
||||
|
||||
home.username = "${config.user.name}";
|
||||
home.homeDirectory = "/home/${config.user.name}";
|
||||
|
||||
modules = {
|
||||
bash.enable = true;
|
||||
git.enable = true;
|
||||
gpg.enable = true;
|
||||
security.enable = true;
|
||||
|
||||
utils = {
|
||||
enable = true;
|
||||
dev.enable = true;
|
||||
irc.enable = true;
|
||||
vim.enable = false;
|
||||
};
|
||||
|
||||
gui = {
|
||||
enable = true;
|
||||
alacritty.enable = true;
|
||||
browsers.enable = true;
|
||||
corn.enable = true;
|
||||
fun.enable = true;
|
||||
neovim.enable = true;
|
||||
utils.enable = true;
|
||||
writing.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
8
src/systems/wsl/default.nix
Normal file
8
src/systems/wsl/default.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{ lib, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../../user
|
||||
./system.nix
|
||||
];
|
||||
}
|
||||
33
src/systems/wsl/home.nix
Normal file
33
src/systems/wsl/home.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
programs.home-manager.enable = true;
|
||||
programs.bash.shellAliases = {
|
||||
nixup = "sudo nixos-rebuild switch --flake .#windows";
|
||||
};
|
||||
|
||||
imports = [
|
||||
../../modules
|
||||
../../user
|
||||
];
|
||||
|
||||
home.stateVersion = "23.11";
|
||||
|
||||
home.username = "${config.user.name}";
|
||||
home.homeDirectory = "/home/${config.user.name}";
|
||||
|
||||
modules = {
|
||||
bash.enable = true;
|
||||
git.enable = true;
|
||||
gpg.enable = true;
|
||||
gui.enable = false;
|
||||
security.enable = true;
|
||||
utils = {
|
||||
enable = true;
|
||||
dev.enable = true;
|
||||
email.enable = true;
|
||||
irc.enable = true;
|
||||
vim.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
83
src/systems/wsl/system.nix
Normal file
83
src/systems/wsl/system.nix
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
{ system.stateVersion = "23.11";
|
||||
|
||||
# Users
|
||||
users.users = {
|
||||
${config.user.name} = {
|
||||
isNormalUser = true;
|
||||
extraGroups = config.user.groups;
|
||||
openssh.authorizedKeys.keys = config.user.sshKeys;
|
||||
};
|
||||
};
|
||||
boot.isContainer = true;
|
||||
|
||||
# Nix
|
||||
nix = {
|
||||
channel.enable = false;
|
||||
package = pkgs.nixFlakes;
|
||||
extraOptions = "experimental-features = nix-command flakes";
|
||||
settings = {
|
||||
auto-optimise-store = true;
|
||||
trusted-users = [ "${config.user.name}" ];
|
||||
};
|
||||
gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 30d";
|
||||
};
|
||||
};
|
||||
# Sudo Options
|
||||
security.sudo = {
|
||||
wheelNeedsPassword = false;
|
||||
execWheelOnly = true;
|
||||
};
|
||||
|
||||
# System Services
|
||||
services = {
|
||||
cron = {
|
||||
enable = true;
|
||||
systemCronJobs = [];
|
||||
};
|
||||
};
|
||||
|
||||
# Locale
|
||||
time = {
|
||||
timeZone = "America/New_York";
|
||||
};
|
||||
|
||||
services.timesyncd = {
|
||||
enable = true;
|
||||
servers = [
|
||||
"0.pool.ntp.org"
|
||||
"1.pool.ntp.org"
|
||||
"2.pool.ntp.org"
|
||||
"3.pool.ntp.org"
|
||||
];
|
||||
};
|
||||
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
console = {
|
||||
font = "Lat2-Terminus16";
|
||||
useXkbConfig = true;
|
||||
};
|
||||
|
||||
# Networking
|
||||
networking = {
|
||||
useDHCP = lib.mkDefault true;
|
||||
firewall = {
|
||||
enable = true;
|
||||
allowedTCPPorts = [ 22 80 443 ];
|
||||
};
|
||||
};
|
||||
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
startWhenNeeded = true;
|
||||
settings = {
|
||||
X11Forwarding = false;
|
||||
PasswordAuthentication = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue