initial commit

Change-Id: Icdf87c6c68d88c917468ad949f90af5bcb690831
diff --git a/modules/audio.nix b/modules/audio.nix
new file mode 100644
index 0000000..14f2167
--- /dev/null
+++ b/modules/audio.nix
@@ -0,0 +1,17 @@
+{ config, pkgs, ... }: {
+  sound.enable = true;
+  hardware.pulseaudio.enable = false;
+  security.rtkit.enable = true;
+  services.pipewire = {
+    enable = true;
+    alsa.enable = true;
+    alsa.support32Bit = true;
+    pulse.enable = true;
+  };
+
+  home-manager.users.coded.home.packages =
+    with pkgs; [
+      helvum
+      lmms
+    ];
+}
diff --git a/modules/basicServices.nix b/modules/basicServices.nix
new file mode 100644
index 0000000..81eea42
--- /dev/null
+++ b/modules/basicServices.nix
@@ -0,0 +1 @@
+{ config, pkgs, ... }: { services.printing.enable = true; }
diff --git a/modules/boot.nix b/modules/boot.nix
new file mode 100644
index 0000000..1948e91
--- /dev/null
+++ b/modules/boot.nix
@@ -0,0 +1,23 @@
+{ lib, ... }: {
+  boot = {
+    supportedFilesystems = [ "ntfs" ];
+    bootspec.enable = true;
+    loader.systemd-boot = {
+      enable = lib.mkForce false;
+    };
+    lanzaboote = {
+      enable = true;
+      pkiBundle = "/etc/secureboot";
+
+      settings = {
+        auto-entries = true;
+      };
+
+    };
+    loader.efi.canTouchEfiVariables = true;
+    initrd.luks.devices."luks-bf23eee1-7cb7-43b9-822f-a9f49ea0a768".device =
+      "/dev/disk/by-uuid/bf23eee1-7cb7-43b9-822f-a9f49ea0a768";
+    
+    initrd.kernelModules = [ "amdgpu" ];
+  };
+}
diff --git a/modules/browser.nix b/modules/browser.nix
new file mode 100644
index 0000000..f82cfc4
--- /dev/null
+++ b/modules/browser.nix
@@ -0,0 +1,17 @@
+{ pkgs, ... }: {
+  home-manager.users.coded.programs.chromium = {
+    enable = true;
+    extensions = [
+      { id = "nngceckbapebfimnlniiiahkandclblb"; } # bitwarden
+      {
+        id = "dkoaabhijcomjinndlgbmfnmnjnmdeeb";
+        crxPath =
+          ../extensions/chromium/adnauseam/adnauseam-3.18.0.chromium.crx;
+        version = "3.18.0";
+      }
+      { id = "kekjfbackdeiabghhcdklcdoekaanoel"; } #MAL Sync
+      { id = "mnjggcdmjocbbbhaepdhchncahnbgone"; } #Sponsor Block
+      { id = "gebbhagfogifgggkldgodflihgfeippi"; } #return youtube dislike
+    ];
+  };
+}
diff --git a/modules/direnv.nix b/modules/direnv.nix
new file mode 100644
index 0000000..ac6fc9b
--- /dev/null
+++ b/modules/direnv.nix
@@ -0,0 +1,6 @@
+{ 
+  home-manager.users.coded.programs.direnv = {
+    enable = true;
+    nix-direnv.enable = true;
+  };
+}
diff --git a/modules/docker.nix b/modules/docker.nix
new file mode 100644
index 0000000..c4cb81e
--- /dev/null
+++ b/modules/docker.nix
@@ -0,0 +1,6 @@
+{ pkgs, ... }: {
+  home-manager.users.coded.home.packages = [
+    pkgs.docker
+  ];
+  virtualisation.docker.enable = true;
+}
diff --git a/modules/games.nix b/modules/games.nix
new file mode 100644
index 0000000..84da9b2
--- /dev/null
+++ b/modules/games.nix
@@ -0,0 +1,8 @@
+{ pkgs, ... }: {
+  home-manager.users.coded.home.packages = with pkgs; [ minecraft ];
+  programs.steam = {
+    enable = true;
+    remotePlay.openFirewall = true;
+    dedicatedServer.openFirewall = true;
+  };
+}
diff --git a/modules/git.nix b/modules/git.nix
new file mode 100644
index 0000000..b17afe4
--- /dev/null
+++ b/modules/git.nix
@@ -0,0 +1,28 @@
+{ pkgs, ... }: {
+
+  home-manager.users.coded.programs.gpg.enable = true;
+  home-manager.users.coded.home.packages = [
+    pkgs.git-review
+    pkgs.gh
+  ];
+
+  home-manager.users.coded.programs.git = {
+    enable = true;
+    extraConfig = {
+      init.defaultbranch = "main";
+      user = {
+        email = "coded@clicks.codes";
+        name = "Samuel Shuert";
+      };
+      pull.rebase = true;
+      advice.skippedcherrypicks = false;
+      gpg.sign = true;
+      core = {
+        repositoryformatversion = 0;
+        filemode = true;
+        bare = false;
+        logallrefupdates = true;
+      };
+    };
+  };
+}
diff --git a/modules/hardware-configuration.nix b/modules/hardware-configuration.nix
new file mode 100755
index 0000000..ae6ebae
--- /dev/null
+++ b/modules/hardware-configuration.nix
@@ -0,0 +1,42 @@
+# Do not modify this file!  It was generated by ‘nixos-generate-config’
+# and may be overwritten by future invocations.  Please make changes
+# to /etc/nixos/configuration.nix instead.
+{ config, lib, pkgs, modulesPath, ... }:
+
+{
+  imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
+
+  boot.initrd.availableKernelModules =
+    [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "sr_mod" ];
+  boot.initrd.kernelModules = [ ];
+  boot.kernelModules = [ "kvm-amd" ];
+  boot.extraModulePackages = [ ];
+
+  fileSystems."/" = {
+    device = "/dev/disk/by-uuid/63caf2b5-90d4-49a7-99e9-98dcdd797859";
+    fsType = "ext4";
+  };
+
+  boot.initrd.luks.devices."luks-c38bc921-8979-4a25-9520-f3354dee3557".device =
+    "/dev/disk/by-uuid/c38bc921-8979-4a25-9520-f3354dee3557";
+
+  fileSystems."/boot" = {
+    device = "/dev/disk/by-uuid/5B78-4B2D";
+    fsType = "vfat";
+  };
+
+  swapDevices =
+    [{ device = "/dev/disk/by-uuid/3a9212d4-6c39-4d5b-abf0-49294bd991c9"; }];
+
+  # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
+  # (the default) this is the recommended approach. When using systemd-networkd it's
+  # still possible to use this option, but it's recommended to use it in conjunction
+  # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
+  networking.useDHCP = lib.mkDefault true;
+  # networking.interfaces.enp42s0.useDHCP = lib.mkDefault true;
+  # networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
+
+  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
+  hardware.cpu.amd.updateMicrocode =
+    lib.mkDefault config.hardware.enableRedistributableFirmware;
+}
diff --git a/modules/home-manager.nix b/modules/home-manager.nix
new file mode 100644
index 0000000..d7fe38c
--- /dev/null
+++ b/modules/home-manager.nix
@@ -0,0 +1,19 @@
+{ lib, config, options, ... }: {
+
+  # options = {
+  #   home = lib.mkOption {
+  #     type = options.home-manager.users.type.nestedTypes.elemType;
+  #   };
+  # };
+
+  config = {
+    home-manager = {
+      useGlobalPkgs = true;
+      useUserPackages = true;
+
+      # users.coded = config.home;
+    };
+
+    home-manager.users.coded.home.stateVersion = config.system.stateVersion;
+  };
+}
diff --git a/modules/locale.nix b/modules/locale.nix
new file mode 100644
index 0000000..e4e95a4
--- /dev/null
+++ b/modules/locale.nix
@@ -0,0 +1,17 @@
+{
+  time.timeZone = "America/New_York";
+  i18n.defaultLocale = "en_US.UTF-8";
+
+  i18n.extraLocaleSettings = {
+    LC_ADDRESS = "en_US.UTF-8";
+    LC_IDENTIFICATION = "en_US.UTF-8";
+    LC_MEASUREMENT = "en_US.UTF-8";
+    LC_MONETARY = "en_US.UTF-8";
+    LC_NAME = "en_US.UTF-8";
+    LC_NUMERIC = "en_US.UTF-8";
+    LC_PAPER = "en_US.UTF-8";
+    LC_TELEPHONE = "en_US.UTF-8";
+    LC_TIME = "en_US.UTF-8";
+  };
+
+}
diff --git a/modules/mongo.nix b/modules/mongo.nix
new file mode 100644
index 0000000..bb17552
--- /dev/null
+++ b/modules/mongo.nix
@@ -0,0 +1,5 @@
+{ config, pkgs, ... }: {
+  environment.systemPackages = [ pkgs.mongosh pkgs.mongodb-tools ];
+  services.mongodb.enable = true;
+  services.mongodb.package = pkgs.mongodb-6_0;
+}
diff --git a/modules/networking.nix b/modules/networking.nix
new file mode 100644
index 0000000..ef432e7
--- /dev/null
+++ b/modules/networking.nix
@@ -0,0 +1,11 @@
+{
+  networking.hostName = "codedPC";
+  networking.networkmanager.enable = true;
+
+  networking.hosts = {
+    "192.168.0.4" = [ "CodedPi" ];
+    "192.168.0.5" = [ "SamuelDesktop" ];
+    "192.168.0.6" = [ "a1d2" ];
+    "localhost:5000" = [ "ollama" ];
+  };
+}
diff --git a/modules/node.nix b/modules/node.nix
new file mode 100644
index 0000000..24c3e32
--- /dev/null
+++ b/modules/node.nix
@@ -0,0 +1,8 @@
+{ pkgs, ... }: {
+    home-manager.users.coded.home.packages = with pkgs; [
+      nodejs_20
+      bun
+      nodePackages.pnpm
+      nodePackages.typescript
+    ];
+}
diff --git a/modules/packages.nix b/modules/packages.nix
new file mode 100644
index 0000000..fac3c63
--- /dev/null
+++ b/modules/packages.nix
@@ -0,0 +1,16 @@
+{ pkgs, ... }: {
+  hardware.enableRedistributableFirmware = true;
+  nixpkgs.config.allowUnfree = true;
+  nixpkgs.config.permittedInsecurePackages = with pkgs; [
+    "mailspring-1.11.0"
+  ];
+  home-manager.users.coded.home.packages = with pkgs; [
+    bitwarden
+    sops
+    nixfmt
+    nextcloud-client
+    email
+    mailspring
+    ollama
+  ];
+}
diff --git a/modules/security.nix b/modules/security.nix
new file mode 100644
index 0000000..2ed9cc3
--- /dev/null
+++ b/modules/security.nix
@@ -0,0 +1,8 @@
+{
+  security.pam.services = {
+    login.u2fAuth = true;
+    sudo.u2fAuth = true;
+  };
+
+  security.pam.u2f.authFile = ../keys/u2f_mappings;
+}
diff --git a/modules/shell.nix b/modules/shell.nix
new file mode 100644
index 0000000..6d66e7b
--- /dev/null
+++ b/modules/shell.nix
@@ -0,0 +1,96 @@
+{ pkgs, config, inputs, ... }: {
+  programs.zsh.enable = true;
+  users.users.coded.shell = pkgs.zsh;
+
+  home-manager.users.coded.programs = {
+    # ZSH
+    zsh = {
+      enable = true;
+      enableAutosuggestions = true;
+      enableCompletion = true;
+      autocd = true;
+      defaultKeymap = "emacs";
+
+      shellAliases = {
+        rebuild = "sudo nixos-rebuild switch --flake /home/coded/nixConfig/";
+        "gr!" = "git review";
+        clr = "clear";
+        pnpx = "pnpm dlx";
+      };
+
+      dirHashes = { code = "$HOME/Documents/programming"; };
+
+      history = { extended = true; };
+      historySubstringSearch.enable = true;
+
+      oh-my-zsh = {
+        enable = true;
+        plugins = [ "git" ];
+      };
+    };
+
+    # Starship
+    starship = {
+      enable = true;
+      settings = { format = "$all"; };
+    };
+    
+    # Alacritty
+    alacritty = {
+      enable = true;
+      settings = {
+        window.dimensions = {
+          lines = 40;
+          columns = 150;
+        };
+        import = [
+          "${inputs.alacritty-themes}/themes/Catppuccin-Mocha.yml"
+        ];
+      };
+    };
+
+    # htop
+    # htop = {
+    #   enable = true;
+    #   settings = {
+    #     color_scheme = 6;
+    #     cpu_count_from_one = 0;
+    #     delay = 15;
+    #     fields = with home-manager.config.lib.htop.fields; [
+    #       PID
+    #       USER
+    #       PERCENT_CPU
+    #       PERCENT_MEM
+    #       M_SIZE
+    #       M_RESIDENT
+    #       M_SHARE
+    #       STATE
+    #       TIME
+    #       COMM
+    #     ];
+    #   } // (with home-manager.config.lib.htop; leftMeters [
+    #     (bar "AllCPUs2")
+    #     (bar "Memory")
+    #     (bar "Swap")
+    #     (text "Zram")
+    #   ]) // (with home-manager.config.lib.htop; rightMeters [
+    #     (text "Tasks")
+    #     (text "LoadAverage")
+    #     (text "Uptime")
+    #     (text "Systemd")
+    #   ]);
+    # };
+
+    # Nix-index
+    nix-index.enable = true;
+
+    # thefuck
+    thefuck = {
+      enable = true;
+      enableInstantMode = true;
+    };
+  };
+
+  environment.pathsToLink =
+    [ "/share/zsh" ]; # needed for completing system packages
+}
diff --git a/modules/social.nix b/modules/social.nix
new file mode 100644
index 0000000..bee39ce
--- /dev/null
+++ b/modules/social.nix
@@ -0,0 +1,3 @@
+{ pkgs, ... }: {
+  home-manager.users.coded.home.packages = with pkgs; [ discord ];
+}
diff --git a/modules/video.nix b/modules/video.nix
new file mode 100644
index 0000000..6ba96d0
--- /dev/null
+++ b/modules/video.nix
@@ -0,0 +1,16 @@
+{
+  services.xserver.enable = true;
+  services.xserver.videoDrivers = [ "amdgpu" ];
+
+  services.xserver.displayManager.sddm.enable = true;
+  services.xserver.desktopManager.plasma5.enable = true;
+
+  hardware.opengl.driSupport = true;
+  # For 32 bit applications
+  hardware.opengl.driSupport32Bit = true;
+
+  services.xserver = {
+    layout = "us";
+    xkbVariant = "";
+  };
+}
diff --git a/modules/vscode.nix b/modules/vscode.nix
new file mode 100644
index 0000000..2cb2d3d
--- /dev/null
+++ b/modules/vscode.nix
@@ -0,0 +1,18 @@
+{ pkgs, nix-vscode-extensions, ... }: {
+  home-manager.users.coded.programs.vscode = {
+    enable = true;
+    extensions = with pkgs.vscode-extensions;
+      [
+        ms-vsliveshare.vsliveshare
+        codezombiech.gitignore
+        editorconfig.editorconfig
+        zhuangtongfa.material-theme
+        bbenoist.nix
+      ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [{
+        name = "helium-icon-theme";
+        publisher = "helgardrichard";
+        version = "1.0.0";
+        sha256 = "sha256-uSApuTXQgvPiJpBL91d3mX35Sa2l2vLIAFpBo+cZ4h4=";
+      }];
+  };
+}
diff --git a/modules/yubikey.nix b/modules/yubikey.nix
new file mode 100644
index 0000000..752b77b
--- /dev/null
+++ b/modules/yubikey.nix
@@ -0,0 +1,3 @@
+{ pkgs, ... }: {
+  home-manager.users.coded.home.packages = with pkgs; [ yubikey-manager ];
+}