no more linting errors, setup is mostly complete but still pending consolidation of hosts directory and users/user/host directories

This commit is contained in:
jeirmeister 2024-11-06 14:32:55 -08:00
parent a115537e6e
commit 2a5e8b4711
Signed by: jeirmeister
GPG Key ID: 33A40DF62D35C4A7
80 changed files with 899 additions and 459 deletions

41
.envrc.example Normal file
View File

@ -0,0 +1,41 @@
# Development environment configuration
export FLAKE_ROOT="$PWD"
# Installation target configuration
export TARGET_HOST="${TARGET_HOST:-""}" # e.g., "steamdeck" or "surface"
export TARGET_USER="${TARGET_USER:-""}" # e.g., "jeirmeister"
# Enable flakes and unfree packages for development shell
export NIX_CONFIG="
experimental-features = nix-command flakes
allow-unfree = true
accept-flake-config = true
"
# Development shell helper functions
build_system() {
if [ -z "$TARGET_HOST" ]; then
echo "ERROR: TARGET_HOST not set"
return 1
fi
nixos-rebuild build --flake ".#${TARGET_HOST}"
}
switch_system() {
if [ -z "$TARGET_HOST" ]; then
echo "ERROR: TARGET_HOST not set"
return 1
fi
sudo nixos-rebuild switch --flake ".#${TARGET_HOST}"
}
update_home() {
if [ -z "$TARGET_HOST" ] || [ -z "$TARGET_USER" ]; then
echo "ERROR: TARGET_HOST and TARGET_USER must be set"
return 1
fi
home-manager switch --flake ".#${TARGET_USER}@${TARGET_HOST}"
}
# Load the development shell
use flake

54
flake.nix Normal file
View File

@ -0,0 +1,54 @@
{
description = "Jeirmeister's NixOS Configuration";
inputs = {
# Core dependencies
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
systems.url = "github:nix-systems/default-linux";
# Add other inputs as needed, e.g.:
# hardware.url = "github:nixos/nixos-hardware"; # If you need specific hardware support
};
outputs = { self, nixpkgs, home-manager, ... } @ inputs: let
lib = nixpkgs.lib.extend (
final: prev: import ./lib {
inherit inputs self;
lib = final;
}
) // home-manager.lib;
in {
nixosConfigurations = {
# Your systems
steamdeck = lib.mkHost "steamdeck" {
username = "jeirmeister";
system = "x86_64-linux";
stateVersion = "23.11"; # Adjust as needed
};
surface4 = lib.mkHost "surface4" {
username = "jeirmeister";
system = "x86_64-linux";
stateVersion = "23.11"; # Adjust as needed
};
};
# Standalone home-manager configurations
homeConfigurations = {
"jeirmeister@steamdeck" = lib.mkHome {
inherit nixosConfigurations;
};
"jeirmeister@surface4" = lib.mkHome {
inherit nixosConfigurations;
};
};
# Add basic overlays and packages outputs
overlays = import ./overlays { inherit self; };
packages = lib.forEachSystem (pkgs: import ./pkgs { inherit pkgs; });
};
}

View File

@ -1,31 +0,0 @@
{ config, pkgs, ... }:
let
customPackages = import ./users/jeirmeister/packages { inherit pkgs; };
in
{
imports = [
./users/jeirmeister/programs
];
home = {
username = "jeirmeister";
homeDirectory = "/home/jeirmeister";
stateVersion = "24.05";
packages = with pkgs; [
fortune
];
};
programs.home-manager.enable = true;
nixpkgs = {
config = {
allowUnfree = true;
permittedInsecurePackages = [
"openssl-1.1.1w"
];
};
};
}

29
lib/default.nix Normal file
View File

@ -0,0 +1,29 @@
flake @ { inputs
, self
, lib
, ...
}:
let
# Re-export inputs to make them available to all lib functions
exports = {
# Import functions for library with inherited inputs
utilMods = import ./utilMods.nix { inherit lib; };
utils = import ./utils.nix { inherit lib; };
mkHost = import ./mkHost.nix (flake // { inherit lib; });
mkHome = import ./mkHome.nix (flake // { inherit lib; });
mkUnfreeNixpkgs = import ./mkUnfreeNixpkgs.nix;
# Helper function to enable modules based on host config
mkHostModules = hostname: username: enabledModules:
let
# Convert the list of enabled module paths to actual imports
moduleImports = map
(modulePath:
../modules + "/${modulePath}"
)
enabledModules;
in
moduleImports;
};
in
exports

39
lib/mkHome.nix Normal file
View File

@ -0,0 +1,39 @@
flake @ {
inputs,
self,
lib,
...
}: let
# Helper functions we don't plan on exporting past this file
internals = {
atSignSplit = string:
lib.splitString "@" string;
# Grab everything before the @ in "username@hostname", from llakala
guessUsername = userhost:
if lib.length (internals.atSignSplit userhost) == 2
then lib.elemAt (internals.atSignSplit userhost) 0 # First value in list
else throw "Invalid userhost format: ${userhost}. Expected format: username@hostname";
# Grab everything after the @ in "username@hostname", from llakala
guessHostname = userhost:
if lib.length (internals.atSignSplit userhost) == 2
then lib.elemAt (internals.atSignSplit userhost) 1 # Second value in list
else throw "Invalid userhost format: ${userhost}. Expected format: username@hostname";
};
# Helper function for creating the system config for Home-Manager
mkHome = userhost: {
nixosConfigurations,
username ? internals.guessUsername userhost,
hostname ? internals.guessHostname userhost,
#stateVersion ? lib.conds.defaultStateVersion,
}:
/*
lib.homeManagerConfiguration {
extraSpecialArgs = flake // {inherit username hostname stateVersion;};
};
*/
nixosConfigurations.${hostname}.config.home-manager.users.${username}.home; # allows me to independently switch my home environment without rebuilding my entire system
in
mkHome

33
lib/mkHost.nix Normal file
View File

@ -0,0 +1,33 @@
flake @ { inputs
, self
, lib
, ...
}:
let
# Simplified helper function for creating the system config
mkHost = hostname: { username
, system
, stateVersion ? "24.05"
,
}:
lib.nixosSystem {
inherit system;
specialArgs = flake // { inherit hostname username system stateVersion; };
modules = [
# Core system configuration
inputs.home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${username} = import ../users/${username}/home.nix;
};
}
# Host-specific configurations
../hosts/${hostname}/configuration.nix
../hosts/${hostname}/hardware-configuration.nix
];
};
in
mkHost

16
lib/mkUnfreeNixpkgs.nix Normal file
View File

@ -0,0 +1,16 @@
# Credit goes to Frontear and llakala for this solution!
{
path,
runCommandLocal,
...
}:
# Configure the given nixpkgs input to use unfree, so `nix run` commands using the flake registry can use unfree packages
runCommandLocal "nixpkgs-configured" {src = path;}
''
mkdir -p $out
substitute $src/flake.nix $out/flake.nix \
--replace-fail "{ inherit system; }" "{ inherit system; config.allowUnfree = true; config.joypixels.acceptLicense = true; }"
cp --update=none -Rt $out $src/*
''

56
lib/utilMods.nix Normal file
View File

@ -0,0 +1,56 @@
{lib, ...}: let
internals = {
# Helper for creating modules
mkModuleWithOptions = {
config,
name,
moduleConfig,
default ? false,
extraOptions ? {},
extraCondition ? true,
}: let
namePathList = lib.splitString "." name;
modulePath = ["modules"] ++ namePathList;
enableOptionPath = modulePath ++ ["enable"];
moduleOptions =
{
enable = lib.mkOption {
inherit default;
type = lib.types.bool;
description = "Enable [${name}] module";
};
}
// extraOptions;
in {
options = lib.setAttrByPath modulePath moduleOptions;
config =
lib.mkIf
(lib.getAttrFromPath enableOptionPath config && extraCondition)
moduleConfig;
};
};
exports = {
# Function for creating modules.NAME modules, with extra options
mkModule' = config: name: extraOptions: moduleConfig:
internals.mkModuleWithOptions {inherit config name extraOptions moduleConfig;};
# Function for creating modules.NAME modules, without extra options
mkModule = config: name: moduleConfig: exports.mkModule' config name {} moduleConfig;
# Function for creating modules.NAME modules that are enabled by default, with extra options
mkEnabledModule' = config: name: extraOptions: moduleConfig:
internals.mkModuleWithOptions {
inherit config name extraOptions moduleConfig;
default = true;
};
# Function for creating modules.NAME modules that are enabled by default, without extra options
mkEnabledModule = config: name: moduleConfig:
exports.mkEnabledModule' config name {} moduleConfig;
};
in
exports

94
lib/utils.nix Normal file
View File

@ -0,0 +1,94 @@
{lib, ...}: let
exports = {
# Enable all modules in the list elems
enable = elems:
builtins.listToAttrs (map (name: {
inherit name;
value.enable = true;
})
elems);
# Disable all modules in the list elems
disable = elems:
builtins.listToAttrs (map (name: {
inherit name;
value.enable = false;
})
elems);
# Conditionally enable/disable all modules in the list elems
enableIf = cond: elems:
if cond
then (exports.enable elems)
else (exports.disable elems);
# GPG command for checking if there is a hardware key present
isGpgUnlocked = pkgs: "${pkgs.procps}/bin/pgrep 'gpg-agent' &> /dev/null && ${pkgs.gnupg}/bin/gpg-connect-agent 'scd getinfo card_list' /bye | ${pkgs.gnugrep}/bin/grep SERIALNO -q";
# Concatinatinates all file paths in a given directory into one list.
# It recurses through subdirectories. If it detects a default.nix, only that
# file will be considered.
concatImports = {
path ? null,
paths ? [],
include ? [],
exclude ? [],
recursive ? true,
filterDefault ? true,
}:
with lib;
with fileset; let
excludedFiles = filter pathIsRegularFile exclude;
excludedDirs = filter pathIsDirectory exclude;
isExcluded = path:
if elem path excludedFiles
then true
else
(filter (excludedDir: outputs.lib.path.hasPrefix excludedDir path)
excludedDirs)
!= [];
myFiles = unique ((filter (file:
pathIsRegularFile file
&& hasSuffix ".nix" (builtins.toString file)
&& !isExcluded file) (concatMap (_path:
if recursive
then toList _path
else
mapAttrsToList (name: type:
_path
+ (
if type == "directory"
then "/${name}/default.nix"
else "/${name}"
)) (builtins.readDir _path))
(unique (
if path == null
then paths
else [path] ++ paths
))))
++ (
if recursive
then concatMap toList (unique include)
else unique include
));
dirOfFile = builtins.map (file: builtins.dirOf file) myFiles;
dirsWithDefaultNix =
builtins.filter (dir: builtins.elem dir dirOfFile)
(builtins.map (file: builtins.dirOf file) (builtins.filter (file:
builtins.match "default.nix" (builtins.baseNameOf file) != null)
myFiles));
filteredFiles = builtins.filter (file:
! builtins.elem (builtins.dirOf file) dirsWithDefaultNix
|| builtins.match "default.nix" (builtins.baseNameOf file) != null)
myFiles;
in
if filterDefault
then filteredFiles
else myFiles;
};
in
exports

View File

@ -1,6 +1,12 @@
{ config, pkgs, ... }:
{
imports = [
./git.nix
./gpg.nix
./ssh.nix
./zsh.nix
];
home.packages = with pkgs; [
htop
btop

View File

@ -6,4 +6,4 @@
nix-direnv.enable = true;
enableZshIntegration = true;
};
}
}

18
modules/core/git.nix Normal file
View File

@ -0,0 +1,18 @@
{ config, pkgs, lib, ... }:
{
programs.git = {
enable = true;
package = pkgs.git; # Explicitly specify git package
lfs.enable = true;
# More explicit credential configuration
credential = {
helper = lib.mkForce "${pkgs.git-credential-manager}/bin/git-credential-manager";
credentialStore = "plaintext";
interactive = false;
};
safe.directory = "*";
};
xdg.enable = true;
}

View File

@ -4,7 +4,6 @@
programs.gpg = {
enable = true;
settings = {
keyserver = "hkps://keys.openpgp.org";
# Trust model settings
trust-model = "tofu+pgp";
tofu-default-policy = "auto";
@ -17,14 +16,6 @@
# Default key preferences
default-preference-list = "SHA512 SHA384 SHA256 AES256 AES192 AES ZLIB BZIP2 ZIP Uncompressed";
};
# If you have specific public keys to trust, add them here
publicKeys = [
# Example:
# {
# source = ./path/to/key.pub;
# trust = "ultimate";
# }
];
};
services.gpg-agent = {
@ -44,7 +35,7 @@
home.packages = with pkgs; [
gnupg
pinentry-qt
paperkey # Backup GPG keys on paper
pgpdump # Analyze PGP/GPG keys and packets
paperkey # Backup GPG keys on paper
pgpdump # Analyze PGP/GPG keys and packets
];
}
}

20
modules/core/ssh.nix Normal file
View File

@ -0,0 +1,20 @@
{ config, pkgs, ... }:
{
programs.ssh = {
enable = true;
extraConfig = ''
AddKeysToAgent yes
UseKeychain yes
IdentitiesOnly yes
HashKnownHosts yes
'';
# For better security
serverAliveInterval = 60;
serverAliveCountMax = 2;
};
home.file."${config.home.sessionVariables.XDG_DATA_HOME}/ssh/.keep".text = "";
}

17
modules/core/zsh.nix Normal file
View File

@ -0,0 +1,17 @@
{ config, pkgs, ... }:
{
programs.zsh = {
enable = true;
# Add this section to ensure home-manager paths are properly sourced
initExtra = ''
# Add home-manager applications to PATH
export PATH=$HOME/.nix-profile/bin:$PATH
'';
};
# Make zsh the default shell
home.sessionVariables = {
SHELL = "${pkgs.zsh}/bin/zsh";
};
}

View File

@ -1,14 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./browsers
./communication
./development
./gaming
./productivity
./shell
./system
];
}

View File

@ -1,8 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./floorp.nix
./ungoogled-chromium.nix
];
}

View File

@ -1,10 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./terminals
./multiplexers
./shells
./utilities
];
}

View File

@ -1,17 +0,0 @@
# Add to common/default.nix
{ config, pkgs, lib, ... }:
{
imports = [ ./paths.nix ./versions.nix ];
# Helper function for path concatenation
_module.args.pathJoin = fragments:
lib.concatStringsSep "/" fragments;
programs.zsh.initExtra = lib.concatStrings [
''
# Environment Setup
${builtins.concatStringsSep "\n" (map (path: "export PATH=\"${path}:$PATH\"") config.home.sessionPath)}
''
];
}

View File

@ -1,10 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./direnv.nix
./common
./languages
];
}

View File

@ -1,10 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./go
./javascript
./python
./rust
];
}

View File

@ -1,7 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./tools.nix
];
}

View File

@ -1,8 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./node.nix
./package-managers
];
}

View File

@ -1,16 +0,0 @@
{ config, pkgs, ... }:
let
nodeVersion = if builtins.getEnv "NODE_VERSION" != ""
then builtins.getEnv "NODE_VERSION"
else "20";
in
{
home.packages = [
pkgs."nodejs_${nodeVersion}"
];
home.sessionVariables = {
NODE_PATH = "${config.home.sessionVariables.NODE_PACKAGES_DIR}/lib/node_modules";
};
}

View File

@ -1,9 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./npm.nix
./pnpm.nix
./yarn.nix
];
}

View File

@ -1,13 +0,0 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
nodePackages.npm
nodePackages.node-gyp
nodePackages.node-pre-gyp
];
home.file.".npmrc".text = ''
prefix=${config.home.sessionVariables.NODE_PACKAGES_DIR}
'';
}

View File

@ -1,10 +0,0 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [ nodePackages.pnpm ];
home.file.".pnpmrc".text = ''
pnpm-version=8.9.0
store-dir=${config.home.sessionVariables.XDG_DATA_HOME}/pnpm
'';
}

View File

@ -1,9 +0,0 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [ yarn ];
home.file.".yarnrc".text = ''
cache-folder "${config.home.sessionVariables.XDG_CACHE_HOME}/yarn"
'';
}

View File

@ -1,8 +0,0 @@
{ pkgs, ... }:
{
imports = [
./base.nix
./package-managers
];
}

View File

@ -1,10 +0,0 @@
# Add to env/languages/python/package-managers/default.nix
{ config, pkgs, ... }:
{
imports = [
./pipenv.nix
./poetry
];
}

View File

@ -1,14 +0,0 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [ pipenv ];
home.sessionVariables = {
PIPENV_VENV_IN_PROJECT = "1";
WORKON_HOME = "${config.home.sessionVariables.VIRTUALENV_HOME}";
PIP_NO_CACHE_DIR = "off";
PIPENV_SKIP_LOCK = "1";
PIPENV_IGNORE_VIRTUALENVS = "1";
PIPENV_MAX_DEPTH = "5";
};
}

View File

@ -1,32 +0,0 @@
{ config, pkgs, ... }:
let
poetry2nix = import (pkgs.fetchFromGitHub {
owner = "nix-community";
repo = "poetry2nix";
rev = "1.0.0";
sha256 = "15mdb0lr7027qpm9s1v1d9sdb8abmcdrpqsv4zvinif8a8liqxkq";
}) { inherit pkgs; };
in
{
home.packages = with pkgs; [
poetry
];
imports = [
./packages
];
home.sessionVariables = {
POETRY_VIRTUALENVS_IN_PROJECT = "true";
POETRY_CACHE_DIR = "${config.home.sessionVariables.XDG_CACHE_HOME}/pypoetry";
};
home.file.".config/pypoetry/config.toml".text = ''
[virtualenvs]
in-project = true
path = "${config.home.sessionVariables.VIRTUALENV_HOME}/poetry"
create = true
clear = false
'';
}

View File

@ -1,10 +0,0 @@
{ config, pkgs, ... }:
let
repo-to-text = pkgs.callPackage ./repo-to-text.nix {};
in
{
home.packages = [
repo-to-text
];
}

View File

@ -1,18 +0,0 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
cargo-edit
cargo-watch
cargo-audit
cargo-tarpaulin
];
home.file.".cargo/config.toml".text = ''
[build]
target-dir = "target"
[cargo-new]
vcs = "git"
'';
}

View File

@ -1,8 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./cargo.nix
./toolchain.nix
];
}

View File

@ -1,8 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./aliases
./zsh.nix
];
}

View File

@ -1,13 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./security
./version-control
./navigation
./process
./tools.nix
./network
./files
];
}

View File

@ -1,7 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./tools.nix
];
}

View File

@ -1,9 +0,0 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
unzip
p7zip
file
];
}

View File

@ -1,7 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./fzf.nix
];
}

View File

@ -1,10 +0,0 @@
{ config, pkgs, ... }:
{
programs.fzf = {
enable = true;
enableZshIntegration = true;
defaultCommand = "rg --files --hidden --follow";
defaultOptions = [ "--height 40%" "--layout=reverse" "--border" ];
};
}

View File

@ -1,7 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./tools.nix
];
}

View File

@ -1,9 +0,0 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
mtr
iperf3
nmap
];
}

View File

@ -1,7 +0,0 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
btop
];
}

View File

@ -1,8 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./htop.nix
./btop.nix
];
}

View File

@ -1,16 +0,0 @@
{ config, pkgs, ... }:
{
programs.htop = {
enable = true;
settings = {
color_scheme = 6;
cpu_count_from_one = 0;
delay = 15;
highlight_base_name = 1;
highlight_threads = 1;
show_program_path = 0;
tree_view = 1;
};
};
}

View File

@ -1,8 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./gpg.nix
./ssh.nix
];
}

View File

@ -1,7 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./git.nix
];
}

View File

@ -1,32 +0,0 @@
{ config, pkgs, lib, ... }:
{
programs.git = {
enable = true;
package = pkgs.git; # Explicitly specify git package
lfs.enable = true;
userName = "jeirmeister";
userEmail = "jeir@jeirslab.xyz";
extraConfig = {
init.defaultBranch = "main";
pull.rebase = false;
# More explicit credential configuration
credential = {
helper = lib.mkForce "${pkgs.git-credential-manager}/bin/git-credential-manager";
credentialStore = "plaintext";
interactive = false;
};
safe.directory = "*";
};
};
# Ensure required packages are installed
home.packages = with pkgs; [
git-credential-manager
];
xdg.enable = true;
}

View File

@ -1,8 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
./appimage.nix
./tailscale.nix
];
}

View File

@ -1,7 +0,0 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
tailscale
];
}

14
pkgs/common/default.nix Normal file
View File

@ -0,0 +1,14 @@
{ config, pkgs, lib, ... }:
let
# Helper function to conditionally import language support
importIf = cond: path: if cond then [ path ] else [ ];
in
{
imports =
(importIf config.languages.python.enable ../languages/python) ++
(importIf config.languages.rust.enable ../languages/rust) ++
(importIf config.languages.go.enable ../languages/go) ++
(importIf config.languages.javascript.enable ../languages/javascript) ++
[ ./paths.nix ./versions.nix ];
}

View File

@ -1,6 +1,9 @@
{ config, pkgs, ... }:
{
imports = [
./tools.nix
];
home.packages = with pkgs; [
go
gopls
@ -12,4 +15,4 @@
GOPATH = "${config.home.sessionVariables.GO_PATH}";
GOBIN = "${config.home.sessionVariables.GO_PATH}/bin";
};
}
}

View File

@ -0,0 +1,38 @@
{ config, pkgs, ... }:
let
nodeVersion =
if builtins.getEnv "NODE_VERSION" != ""
then builtins.getEnv "NODE_VERSION"
else "20";
in
{
home.packages = with pkgs; [
# Node.js
pkgs."nodejs_${nodeVersion}"
# Package managers and tools
nodePackages.npm
nodePackages.node-gyp
nodePackages.node-pre-gyp
nodePackages.pnpm
yarn
];
home.sessionVariables = {
NODE_PATH = "${config.home.sessionVariables.NODE_PACKAGES_DIR}/lib/node_modules";
};
home.file.".npmrc".text = ''
prefix=${config.home.sessionVariables.NODE_PACKAGES_DIR}
'';
home.file.".pnpmrc".text = ''
pnpm-version=8.9.0
store-dir=${config.home.sessionVariables.XDG_DATA_HOME}/pnpm
'';
home.file.".yarnrc".text = ''
cache-folder "${config.home.sessionVariables.XDG_CACHE_HOME}/yarn"
'';
}

View File

@ -1,10 +1,10 @@
{ pkgs, ... }:
let
pythonVersion = builtins.replaceStrings ["."] [""]
pythonVersion = builtins.replaceStrings [ "." ] [ "" ]
(if builtins.getEnv "PYTHON_VERSION" != ""
then builtins.getEnv "PYTHON_VERSION"
else "311");
then builtins.getEnv "PYTHON_VERSION"
else "311");
in
{
home.packages = [
@ -19,4 +19,4 @@ in
PYTHONIOENCODING = "UTF-8";
VIRTUAL_ENV_DISABLE_PROMPT = 1;
};
}
}

View File

@ -0,0 +1,3 @@
{ config, pkgs, ... }:
{ }

View File

@ -3,6 +3,10 @@
{
home.packages = with pkgs; [
rustup
cargo-edit
cargo-watch
cargo-audit
cargo-tarpaulin
];
home.sessionVariables = {
@ -13,4 +17,13 @@
default_toolchain = "${config.home.sessionVariables.RUST_VERSION}"
profile = "default"
'';
}
home.file.".cargo/config.toml".text = ''
[build]
target-dir = "target"
[cargo-new]
vcs = "git"
'';
}

View File

@ -0,0 +1,3 @@
{ config, pkgs, ... }:
{ }

11
pkgs/packages/default.nix Normal file
View File

@ -0,0 +1,11 @@
# NOTE TO CLAUDE: I think that here we want to impliment the ability to declare in our users/[user]/[host].nix file which custom packages we want to install
{ config, pkgs, ... }:
let
repo-to-text = pkgs.callPackage ./repo-to-text.nix { };
in
{
home.packages = [
repo-to-text
];
}

72
shell.nix Normal file
View File

@ -0,0 +1,72 @@
{ pkgs ? import <nixpkgs> { } }:
let
# Import core module configurations
coreModule = import ./modules/core {
inherit pkgs;
config = { };
lib = pkgs.lib;
};
# Development shell tools on top of core tools
extraPackages = with pkgs; [
# Nix tools
nixos-install-tools
nixos-generate-config
nix-prefetch-git
nixpkgs-fmt
nil # Nix LSP
# System tools
gparted
parted
cryptsetup
# Installation tools
git
curl
wget
rsync
# Hardware info
lshw
dmidecode
pciutils
usbutils
# Disk utilities
gptfdisk
hdparm
# Network tools
iw
wirelesstools
ethtool
# Debugging tools
htop
btop
];
in
pkgs.mkShell {
# Combine core packages with extra development tools
packages = coreModule.home.packages ++ extraPackages;
# Shell environment setup
shellHook = ''
# Source environment variables if .envrc exists
if [ -f .envrc ]; then
source .envrc
else
echo "Warning: .envrc file not found. Copy .envrc.example to .envrc and modify as needed."
fi
# Print available tools
echo "NixOS configuration development shell loaded with the following tools:"
echo "- Core tools from modules/core"
echo "- Installation and development tools"
echo ""
echo "Use 'nix develop' or 'nix-shell' to enter this environment"
'';
}

View File

@ -0,0 +1,11 @@
{ config, pkgs, ... }:
{
imports = [
./git.nix
./gpg.nix
./ssh.nix
./tailscale.nix
./zsh.nix
];
}

View File

@ -0,0 +1,13 @@
{ config, pkgs, lib, ... }:
{
programs.git = {
userName = "jeirmeister";
userEmail = "jeir@jeirslab.xyz";
extraConfig = {
init.defaultBranch = "main";
pull.rebase = false;
};
};
}

View File

@ -0,0 +1,18 @@
{ config, pkgs, ... }:
{
programs.gpg = {
settings = {
keyserver = "hkps://keys.openpgp.org";
};
# If you have specific public keys to trust, add them here
publicKeys = [
{
# source = ./path/to/key.pub;
# trust = "ultimate";
}
];
};
}

View File

@ -2,8 +2,6 @@
{
programs.ssh = {
enable = true;
extraConfig = ''
AddKeysToAgent yes
UseKeychain yes
@ -35,4 +33,4 @@
};
};
home.file."${config.home.sessionVariables.XDG_DATA_HOME}/ssh/.keep".text = "";
}
}

View File

@ -0,0 +1,93 @@
{ config
, pkgs
, lib
, ...
}: {
# Enable the Tailscale service
services.tailscale = {
enable = true;
# Package to use (optional, defaults to pkgs.tailscale)
package = pkgs.tailscale;
# Authentication key for automated setup (optional)
# authKeyFile = "/path/to/tailscale/authkey";
# Interface name (optional, defaults to "tailscale0")
# interfaceName = "tailscale0";
# Port for the tailscale daemon (optional, defaults to 41641)
# port = 41641;
# Additional daemon arguments (optional)
extraUpFlags = [
"--hostname=steamnix"
"--advertise-tags=tag:nixos"
# "--advertise-exit-node"
# "--accept-dns=true"
# "--accept-routes=true"
# "--shields-up"
];
# systemd service configuration (optional)
serviceConfig = {
# Restart policy
Restart = "always";
RestartSec = "5";
# Security settings
ProtectSystem = "strict";
ProtectHome = true;
PrivateTmp = true;
# Resource limits
MemoryMax = "512M";
TasksMax = 4096;
# Network settings
NetworkNamespacePath = "";
# Additional environment variables
# Environment = [
# "TS_DEBUG_LOG_PATH=/var/log/tailscale/debug.log"
# "TS_NO_LOGS_NO_SUPPORT=true"
# ];
};
# Tailscale configuration files location (optional)
stateDir = "/var/lib/tailscale";
# Routes configuration (optional)
routes = {
# Enable exit node functionality
exitNode = false;
# Enable subnet routing
# advertiseRoutes = [
# "10.0.0.0/24"
# "192.168.1.0/24"
# ];
};
};
# Additional recommended networking settings
networking = {
# Enable IP forwarding for Tailscale subnet routing
firewall = {
enable = true;
allowedTCPPorts = [ 41641 ]; # Tailscale port
checkReversePath = "loose"; # Important for Tailscale
trustedInterfaces = [ "tailscale0" ];
};
# Enable IPv4 forwarding
nat = {
enable = true;
enableIPv6 = true;
externalInterface = "eth0";
internalInterfaces = [ "tailscale0" ];
};
};
environment.systemPackages = [ pkgs.tailscale ];
}

View File

@ -2,7 +2,6 @@
{
programs.zsh = {
enable = true;
autosuggestion.enable = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
@ -24,4 +23,4 @@
home.sessionVariables = {
SHELL = "${pkgs.zsh}/bin/zsh";
};
}
}

View File

@ -0,0 +1,108 @@
{ config, pkgs, lib, ... }:
{
imports = [
./config # User-specific configurations
];
# Language support configuration
languages = {
enable = true;
python.enable = true;
rust.enable = false;
go.enable = false;
javascript = {
enable = false;
nodejs = false;
pnpm = false;
yarn = false;
};
};
# Module configuration
modules = {
core = {
enable = true;
git.enable = true;
zsh.enable = true;
gpg.enable = true;
ssh.enable = true;
direnv.enable = true;
};
desktop = {
enable = true;
browsers = {
enable = true;
floorp.enable = true;
chromium.enable = true;
};
terminals = {
enable = true;
kitty.enable = true;
};
multiplexers = {
enable = true;
tmux.enable = true;
};
development = {
enable = true;
vscode.enable = true;
sublime.enable = false;
};
gaming = {
enable = true;
vr.enable = true;
};
};
};
# Host-specific overrides or configurations
hostConfig = {
steamdeck = {
enable = true;
jovian = {
enable = true;
hardware.has.amd.gpu = true;
devices.steamdeck = {
enable = true;
enableControllerUdevRules = true;
enableDefaultStage1Modules = true;
enablePerfControlUdevRules = true;
enableOsFanControl = true;
enableSoundSupport = true;
enableXorgRotation = true;
enableKernelPatches = true;
enableFwupdBiosUpdates = false;
autoUpdate = false;
};
steam.enable = false;
workarounds.ignoreMissingKernelModules = true;
};
plasma6 = {
enable = true;
extraSessionCommands = ''
${pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource 2 0;
'';
};
};
};
# Steam Deck specific home-manager settings
home = {
# Steam Deck specific packages
packages = with pkgs; [
# System Tools
jupiter-fan-control
pciutils
usbutils
lm_sensors
dmidecode
binutils
# Virtual Display
linuxPackages.v4l2loopback
v4l-utils
];
};
}

View File

@ -0,0 +1,64 @@
{ config
, lib
, pkgs
, username
, inputs
, ...
}: {
# User account configuration
users.users.${username} = {
isNormalUser = true;
shell = pkgs.zsh;
description = "Jeremiah Coenen";
extraGroups = [
"networkmanager"
"wheel"
"video"
"audio"
"input"
"render"
"gamepad"
];
};
# System-wide configuration
time.timeZone = "America/Los_Angeles";
i18n.defaultLocale = "en_US.UTF-8";
# System-wide packages
environment.systemPackages = with pkgs; [
git
curl
wget
tree
];
# System-wide services
services = {
# Network services
openssh.enable = true;
tailscale.enable = true;
# Audio
pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
};
# Global settings for X/Wayland
services.xserver = {
enable = true;
xkb.layout = "us";
};
# System-level Nix settings
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
allowed-users = [ "@wheel" username ];
auto-optimise-store = true;
};
nixpkgs.config.allowUnfree = true;
}