First try of a slightly cleaner version.

This commit is contained in:
Whovian NTSN 2024-05-13 23:18:54 -04:00
parent 8f076a0ded
commit d0c059e25e
11 changed files with 361 additions and 220 deletions

View File

@ -83,23 +83,6 @@
"type": "github"
}
},
"my_packages": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1715061149,
"narHash": "sha256-ZM13/Z/7W9POKVIoMIJzRRzKY8v9oMD1nhLdXej0pFY=",
"path": "/home/whovian/.flakes",
"type": "path"
},
"original": {
"path": "/home/whovian/.flakes",
"type": "path"
}
},
"nix-index-database": {
"inputs": {
"nixpkgs": [
@ -181,7 +164,6 @@
"agenix": "agenix",
"flake-utils": "flake-utils",
"home-manager": "home-manager",
"my_packages": "my_packages",
"nix-index-database": "nix-index-database",
"nix-systems_default": "nix-systems_default",
"nixos-wsl": "nixos-wsl",

View File

@ -31,11 +31,6 @@
inputs.nixpkgs.follows = "nixpkgs";
};
my_packages = {
url = "/home/whovian/.flakes";
inputs.nixpkgs.follows = "nixpkgs";
};
xil = {
url = "github:Qyriad/Xil";
inputs.nixpkgs.follows = "nixpkgs";
@ -71,13 +66,13 @@
# Needed
self, nixpkgs, nixos-wsl,
# Added by me
agenix, home-manager, my_packages, nix-index-database, xil, ... }:
agenix, home-manager, nix-index-database, xil, ... }:
{
nixosConfigurations = {
nixos-wsl = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./system/configuration.nix
./system/nixos-wsl/configuration.nix
nixos-wsl.nixosModules.wsl
home-manager.nixosModules.home-manager
{
@ -87,21 +82,23 @@
useGlobalPkgs = true;
useUserPackages = true;
sharedModules = [
./home/home.nix
agenix.homeManagerModules.default
nix-index-database.hmModules.nix-index
];
users.whovian.home.packages = [
agenix.packages.x86_64-linux.default
];
users.whovian = ./home/home.nix;
# Optionally, use home-manager.extraSpecialArgs to pass arguments to home.nix
extraSpecialArgs = {
system = "x86_64-linux";
inherit my_packages;
inherit xil;
my_pkgs = my_packages.packages.x86_64-linux;
inherit nixpkgs;
pkgs = import nixpkgs {
system = "x86_64-linux";
};
inherit agenix;
# inherit my_packages;
# my_pkgs = my_packages.packages.x86_64-linux;
};
};
}

16
home/aliases.nix Normal file
View File

@ -0,0 +1,16 @@
{
home.shellAliases = {
# From Windows "%PATH%"
"adb" = "adb.exe";
"caja" = "explorer.exe";
"hactoolnet" = "hactoolnet.exe";
"mpv" = "mpv.com";
"tailscale" = "tailscale.exe";
"yt-dlp" = "yt-dlp.exe";
"7zexe" = "/mnt/c/Program\\ Files/7-Zip/7z.exe";
# From Nix environment
"7z" = "7zz";
# "7zz" is from "nixpkgs#_7zz"
};
}

37
home/dotfiles.nix Normal file
View File

@ -0,0 +1,37 @@
{
home.file = {
/*
# Building this configuration will create a copy of 'dotfiles/screenrc' in
# the Nix store. Activating the configuration will then make '~/.screenrc' a
# symlink to the Nix store copy.
".screenrc".source = dotfiles/screenrc;
# You can also set the file content immediately.
".gradle/gradle.properties".text = ''
org.gradle.console=verbose
org.gradle.daemon.idletimeout=3600000
'';
*/
".zshrc".text = ''
eval "$(direnv hook zsh)"
download_nixpkgs_cache_index () {
filename="index-$(uname -m | sed 's/^arm64$/aarch64/')-$(uname | tr A-Z a-z)"
mkdir -p ~/.cache/nix-index && cd ~/.cache/nix-index
# -N will only download a new version if there is an update.
wget -q -N https://github.com/Mic92/nix-index-database/releases/latest/download/$filename
ln -f $filename files
}
'';
".lftp/rc".text = ''
alias s32 "mirror -c --use-pget-n=32"
alias p32 "pget -n 32 -c"
alias p16 "pget -n 16 -c"
alias s16 "mirror -c --use-pget-n=16"
alias p8 "pget -n 8 -c"
alias ssl "set ssl:verify-certificate false"
'';
};
}

View File

@ -1,94 +1,55 @@
{
lib,
agenix,
config,
modulesPath,
nixosConfig,
nixpkgs,
options,
osConfig,
pkgs,
my_pkgs,
xil,
specialArgs,
system,
...
xil
}:
{
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "whovian";
home.homeDirectory = "/home/whovian";
imports = [
./pkgs_and_programs.nix # home.packages and programs
./dotfiles.nix # home.file
./variables.nix # home.sessionVariables
./aliases.nix # home.shellAliases
];
/*
This value determines the Home Manager release that your configuration is
compatible with. This helps avoid breakage when a new Home Manager release
introduces backwards incompatible changes.
You should not change this value, even if you update Home Manager. If you do
want to update the value, then make sure to first check the Home Manager
release notes.
*/
home.stateVersion = "23.05"; # Please read the comment before changing.
home = {
# Home Manager needs a bit of information about you and the paths it should
# manage.
username = "whovian";
homeDirectory = "/home/whovian";
# The home.packages option allows you to install Nix packages into your
# environment.
nixpkgs = {
config = {
allowUnfree = true;
};
/*
This value determines the Home Manager release that your configuration is
compatible with. This helps avoid breakage when a new Home Manager release
introduces backwards incompatible changes.
You should not change this value, even if you update Home Manager. If you do
want to update the value, then make sure to first check the Home Manager
release notes.
*/
stateVersion = "23.05"; # Please read the comment before changing.
# The home.packages option allows you to install Nix packages into your
# environment.
# Let Home Manager install and manage itself.
# Probably not needed for a module?
# programs.home-manager.enable = true;
};
home.packages = [
pkgs._7zz
pkgs.bat
pkgs.binwalk
pkgs.cdecrypt
pkgs.colorized-logs
pkgs.croc
pkgs.dhex
pkgs.fd
pkgs.file
pkgs.gdrive3
pkgs.git
pkgs.hactool
pkgs.instaloader
pkgs.internetarchive
pkgs.lynx
pkgs.megatools
pkgs.ncdu
pkgs.nixfmt-classic
pkgs.progress
pkgs.pyrosimple
pkgs.python3
pkgs.quickbms
pkgs.rclone
pkgs.screen
pkgs.sshfs
pkgs.unrar-wrapper
pkgs.wget
pkgs.xxd
pkgs.yq
# my_pkgs.irdkit
my_pkgs.ird_tools
my_pkgs.rom-properties
xil.packages.${system}.xil
];
/*
Disabled
pkgs.binutils
# Instead just do `nix shell nixpkgs#binutils -c strings -- INPUT.ext > INPUT.ext.strings
pkgs.mpv
pkgs.terminator
pkgs.yt-dlp
pkgs.p7zip
# Replaced in favour of nixpkgs#_7zz
Disabled
*/
/*
# It is sometimes useful to fine-tune packages, for example, by applying
# overrides. You can do that directly here, just don't forget the
# parentheses. Maybe you want to install Nerd Fonts with a limited number of
# fonts?
(pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
*/
# nixpkgs = {
# config = {
# allowUnfree = true;
# };
# };
age = {
identityPaths = [
@ -106,112 +67,4 @@
};
};
};
programs = {
bat = {
enable = true;
};
direnv = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
git = {
enable = true;
userName = "Whovian9369";
userEmail = "Whovian9369@gmail.com";
extraConfig = {
init = {
defaultBranch = "main";
};
};
};
jq = {
enable = true;
};
nix-index = {
enable = true;
enableZshIntegration = false;
};
ripgrep = {
enable = true;
};
zsh = {
enable = true;
# Honestly unsure if I should be using `programs.zsh.envExtra` or
# `programs.zsh.localVariables` here.
localVariables = {
DISABLE_MAGIC_FUNCTIONS = true;
};
# enableAutosuggestions = true;
# enableCompletion = true;
oh-my-zsh = {
enable = true;
plugins = [
"git"
"sudo"
];
theme = "bira";
};
};
};
home.file = {
/*
# Building this configuration will create a copy of 'dotfiles/screenrc' in
# the Nix store. Activating the configuration will then make '~/.screenrc' a
# symlink to the Nix store copy.
".screenrc".source = dotfiles/screenrc;
# You can also set the file content immediately.
".gradle/gradle.properties".text = ''
org.gradle.console=verbose
org.gradle.daemon.idletimeout=3600000
'';
*/
".zshrc".text = ''
eval "$(direnv hook zsh)"
download_nixpkgs_cache_index () {
filename="index-$(uname -m | sed 's/^arm64$/aarch64/')-$(uname | tr A-Z a-z)"
mkdir -p ~/.cache/nix-index && cd ~/.cache/nix-index
# -N will only download a new version if there is an update.
wget -q -N https://github.com/Mic92/nix-index-database/releases/latest/download/$filename
ln -f $filename files
}
'';
".lftp/rc".text = ''
alias s32 "mirror -c --use-pget-n=32"
alias p32 "pget -n 32 -c"
alias p16 "pget -n 16 -c"
alias s16 "mirror -c --use-pget-n=16"
alias p8 "pget -n 8 -c"
alias ssl "set ssl:verify-certificate false"
'';
};
home.sessionVariables = {
EDITOR = "nano";
DOTNET_CLI_TELEMETRY_OPTOUT = "1";
OPENAI_API_KEY = "\$(cat ${config.age.secrets."openai".path})";
CURSEFORGE_API_KEY = "\$(cat ${config.age.secrets."cursed".path})";
ITCHIO_API_KEY = "\$(cat ${config.age.secrets."itchy".path})";
};
home.shellAliases = {
"adb" = "adb.exe";
"caja" = "explorer.exe";
"hactoolnet" = "hactoolnet.exe";
"mpv" = "mpv.com";
"tailscale" = "tailscale.exe";
"yt-dlp" = "yt-dlp.exe";
"7zexe" = "/mnt/c/Program\\ Files/7-Zip/7z.exe";
"7z" = "7zz";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}

117
home/pkgs_and_programs.nix Normal file
View File

@ -0,0 +1,117 @@
{
agenix,
pkgs,
system,
xil,
...
}:
{
programs = {
bat = {
enable = true;
};
direnv = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
git = {
enable = true;
userName = "Whovian9369";
userEmail = "Whovian9369@gmail.com";
extraConfig = {
init = {
defaultBranch = "main";
};
};
};
jq = {
enable = true;
};
nix-index = {
enable = false;
};
ripgrep = {
enable = true;
};
zsh = {
enable = true;
# Honestly unsure if I should be using `programs.zsh.envExtra` or
# `programs.zsh.localVariables` here.
localVariables = {
DISABLE_MAGIC_FUNCTIONS = true;
};
# enableAutosuggestions = true;
# enableCompletion = true;
oh-my-zsh = {
enable = true;
plugins = [
"git"
"sudo"
];
theme = "bira";
};
};
};
home.packages = [
pkgs._7zz
pkgs.bat
pkgs.binwalk
pkgs.cdecrypt
pkgs.colorized-logs
pkgs.croc
pkgs.dhex
pkgs.fd
pkgs.file
pkgs.gdrive3
pkgs.git
pkgs.hactool
pkgs.instaloader
pkgs.internetarchive
pkgs.lynx
pkgs.megatools
pkgs.ncdu
pkgs.nixfmt-classic
pkgs.progress
pkgs.pyrosimple
pkgs.python3
pkgs.quickbms
pkgs.rclone
pkgs.screen
pkgs.sshfs
pkgs.unrar-wrapper
pkgs.wget
pkgs.xxd
pkgs.yq
# my_pkgs.irdkit
# my_pkgs.ird_tools
# my_pkgs.rom-properties
agenix.packages.${system}.default
xil.packages.${system}.xil
];
/*
Disabled
pkgs.binutils
# Instead just do `nix shell nixpkgs#binutils -c strings -- INPUT.ext > INPUT.ext.strings
pkgs.mpv
pkgs.terminator
pkgs.yt-dlp
pkgs.p7zip
# Replaced in favour of nixpkgs#_7zz
Disabled
*/
/*
# It is sometimes useful to fine-tune packages, for example, by applying
# overrides. You can do that directly here, just don't forget the
# parentheses. Maybe you want to install Nerd Fonts with a limited number of
# fonts?
(pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
*/
}

14
home/variables.nix Normal file
View File

@ -0,0 +1,14 @@
{
agenix,
config,
...
}:
{
home.sessionVariables = {
EDITOR = "nano";
DOTNET_CLI_TELEMETRY_OPTOUT = "1";
OPENAI_API_KEY = "\$(cat ${config.age.secrets."openai".path})";
CURSEFORGE_API_KEY = "\$(cat ${config.age.secrets."cursed".path})";
ITCHIO_API_KEY = "\$(cat ${config.age.secrets."itchy".path})";
};
}

View File

@ -0,0 +1,39 @@
{ lib,
pkgs,
config,
modulesPath,
nixos-wsl,
...
}:
{
imports = [
./packages.nix
./users.nix
./wsl.nix
];
networking.hostName = "nixos-wsl";
# Enable nix flakes
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
time.timeZone = "America/New_York";
/*
Add environment.pathsToLink for auto-completion for system packages (e.g. systemd).
Appears to be required due to [GitHub - nix-community/home-manager]:
https://github.com/nix-community/home-manager/blob/c781b28add41b74423ab2e64496d4fc91192e13a/modules/programs/zsh.nix#L348-L358
[/modules/programs/zsh.nix]
https://github.com/nix-community/home-manager/issues/3521#issuecomment-1367197995
[Issue #3521]
*/
environment.pathsToLink = [
"/share/zsh"
];
system.stateVersion = "22.05";
}

View File

@ -0,0 +1,52 @@
{ lib, agenix, pkgs, config, modulesPath, ... }:
{
environment.systemPackages = [
pkgs.file
pkgs.xterm
# `agenix` is currently added via
# "<config>.nixos-wsl.modules.environment.systemPackages"
];
nixpkgs = {
config = {
allowUnfree = true;
};
};
programs = {
zsh = {
enable = true;
};
nano = {
enable = true;
};
# I haven't figured out how to get `cdemu` properly working (in WSL), so
# I'm just going to leave it as `programs.cdemu.enable = false;` for now.
cdemu = {
enable = false;
group = "cdrom";
gui = false;
image-analyzer = false;
};
};
# `documentation.man.generateCaches` seems to be mainly useful for `whatis`,
# but I couldn't really get it working well.
# From what I can tell, it depends on a package being installed via
# `environment.systemPackages`, *and* for that package to have a manpage.
# That's kinda useless for me since I've been mostly installing stuff via
# `home-manager`, sooooooooo...
/*
documentation = {
nixos = {
includeAllModules = true;
};
man = {
generateCaches = true;
};
};
*/
}

View File

@ -0,0 +1,22 @@
{ lib,
pkgs,
config,
modulesPath,
...
}:
{
users = {
users = {
whovian = {
name = "whovian";
description = "Whovian9369";
extraGroups = [
"wheel"
"cdrom"
];
shell = pkgs.zsh;
initialPassword = "abcde"; # I need to log in somehow
};
};
};
}

12
system/nixos-wsl/wsl.nix Normal file
View File

@ -0,0 +1,12 @@
{
wsl = {
enable = true;
defaultUser = "whovian";
startMenuLaunchers = false;
wslConf = {
automount = {
root = "/mnt";
};
};
};
}