added some modularity; environment variables

This commit is contained in:
Victor Isan 2025-03-16 22:25:13 +01:00
parent 0962953fb4
commit 9bf8108a3b
5 changed files with 108 additions and 122 deletions

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, localEnv, ... }:
{
imports =
@ -9,10 +9,10 @@
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
networking.hostName = "galleon";
networking.hostName = localEnv.hostname;
networking.networkmanager.enable = true;
time.timeZone = "Europe/Vienna";
time.timeZone = localEnv.timezone;
services.xserver.enable = true;
services.xserver.windowManager.dwm.enable = true;

View File

@ -10,16 +10,27 @@
};
};
outputs = { self, nixpkgs, home-manager, ... }@inputs: {
nixosConfigurations.galleon = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
outputs = { self, nixpkgs, home-manager, ... }@inputs:
let
localEnv = {
system = "x86_64-linux";
username = "victor";
hostname = "galleon";
timezone = "Europe/Vienna";
};
in {
nixosConfigurations.${localEnv.hostname} = nixpkgs.lib.nixosSystem {
specialArgs = { inherit localEnv; };
modules = [
./configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.victor = import ./home.nix;
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit localEnv; };
users.${localEnv.username} = import ./home.nix;
};
}
];
};

120
home.nix
View File

@ -1,103 +1,12 @@
{ config, pkgs, ... }:
{ config, pkgs, localEnv, ... }:
{
home.username = "victor";
home.homeDirectory = "/home/victor";
# link the configuration file in current directory to the specified location in home directory
# home.file.".config/i3/wallpaper.jpg".source = ./wallpaper.jpg;
# link all files in `./scripts` to `~/.config/i3/scripts`
# home.file.".config/i3/scripts" = {
# source = ./scripts;
# recursive = true; # link recursively
# executable = true; # make all files executable
# };
# encode the file content in nix configuration file directly
# home.file.".xxx".text = ''
# xxx
# '';
home.file.".Xresources".text = ''
!! Transparency (0-1):
*.alpha: 0.8
!! Set a default font and font size as below:
*.font: IntoneMonoNerdFontMono:size=16
*.background: #1d2021
*.foreground: #458588
*.selbackground: #458588
*.selforeground: #1d2021
/* !! gruvbox: */
*.color0: #1d2021
*.color1: #cc241d
*.color2: #98971a
*.color3: #d79921
*.color4: #458588
*.color5: #b16286
*.color6: #689d6a
*.color7: #a89984
*.color8: #928374
*.color9: #fb4934
*.color10: #b8bb26
*.color11: #fabd2f
*.color12: #83a598
*.color13: #d3869b
*.color14: #8ec07c
*.color15: #ebdbb2
*.color256: #1d2021
*.color257: #ebdbb2
'';
home.packages = with pkgs; [
neofetch
# archives
zip
xz
unzip
# big stuff
librewolf
# navigation
ripgrep # recursively searches directories for a regex pattern
lf # ranger written in C
fzf # A command-line fuzzy finder
bat # better cat
# networking tools
mtr # A network diagnostic tool
iperf3
dnsutils # `dig` + `nslookup`
ldns # replacement of `dig`, it provide the command `drill`
aria2 # A lightweight multi-protocol & multi-source command-line download utility
socat # replacement of openbsd-netcat
nmap # A utility for network discovery and security auditing
ipcalc # it is a calculator for the IPv4/v6 addresses
# misc
file
gnupg
# productivity
hugo # static site generator
glow # markdown previewer in terminal (insanely cool)
btop # replacement of htop/nmon
iotop # io monitoring
iftop # network monitoring
# system call monitoring
strace # system call monitoring
ltrace # library call monitoring
lsof # list open files
# system tools
pciutils # lspci
usbutils # lsusb
home.username = localEnv.username;
home.homeDirectory = "/home/" + localEnv.username;
imports = [
./modules/xresources.nix
./modules/packages.nix
];
# basic configuration of git, please change to your own
@ -119,21 +28,6 @@
};
};
# alacritty - a cross-platform, GPU-accelerated terminal emulator
programs.alacritty = {
enable = true;
# custom settings
settings = {
env.TERM = "xterm-256color";
font = {
size = 12;
draw_bold_text_with_bright_colors = true;
};
scrolling.multiplier = 5;
selection.save_to_clipboard = true;
};
};
programs.zsh = {
enable = true;
autosuggestion.enable = true;

48
modules/packages.nix Normal file
View File

@ -0,0 +1,48 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
neofetch
# archives
zip
xz
unzip
# navigation
ripgrep # recursively searches directories for a regex pattern
lf # ranger written in C
fzf # A command-line fuzzy finder
bat # better cat
# networking tools
mtr # A network diagnostic tool
iperf3
dnsutils # `dig` + `nslookup`
ldns # replacement of `dig`, it provide the command `drill`
aria2 # A lightweight multi-protocol & multi-source command-line download utility
socat # replacement of openbsd-netcat
nmap # A utility for network discovery and security auditing
ipcalc # it is a calculator for the IPv4/v6 addresses
# misc
file
gnupg
# productivity
hugo # static site generator
glow # markdown previewer in terminal (insanely cool)
btop # replacement of htop/nmon
iotop # io monitoring
iftop # network monitoring
# system call monitoring
strace # system call monitoring
ltrace # library call monitoring
lsof # list open files
# system tools
pciutils # lspci
usbutils # lsusb
];
}

33
modules/xresources.nix Normal file
View File

@ -0,0 +1,33 @@
{
home.file.".Xresources".text = ''
!! Transparency (0-1):
*.alpha: 0.8
!! Set a default font and font size as below:
*.font: IntoneMonoNerdFontMono:size=16
*.background: #1d2021
*.foreground: #458588
*.selbackground: #458588
*.selforeground: #1d2021
/* !! gruvbox: */
*.color0: #1d2021
*.color1: #cc241d
*.color2: #98971a
*.color3: #d79921
*.color4: #458588
*.color5: #b16286
*.color6: #689d6a
*.color7: #a89984
*.color8: #928374
*.color9: #fb4934
*.color10: #b8bb26
*.color11: #fabd2f
*.color12: #83a598
*.color13: #d3869b
*.color14: #8ec07c
*.color15: #ebdbb2
*.color256: #1d2021
*.color257: #ebdbb2
'';
}