diff options
author | Jon Santmyer <jon@jonsantmyer.com> | 2023-09-29 14:22:24 -0400 |
---|---|---|
committer | Jon Santmyer <jon@jonsantmyer.com> | 2023-09-29 14:22:24 -0400 |
commit | f819e30b03dffcf9e74af4b8552e4a8ab8f54c58 (patch) | |
tree | c05f4f1db738d6cd9d2824b5000c6afc3b1d61d1 | |
parent | d3bb6cbb4724bc8f18f72fa3fea3e65f73ae8d09 (diff) | |
download | nix-config-f819e30b03dffcf9e74af4b8552e4a8ab8f54c58.tar.gz nix-config-f819e30b03dffcf9e74af4b8552e4a8ab8f54c58.tar.bz2 nix-config-f819e30b03dffcf9e74af4b8552e4a8ab8f54c58.zip |
major reorganizing to seperate modules
49 files changed, 654 insertions, 391 deletions
@@ -38,11 +38,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1695145219, - "narHash": "sha256-Eoe9IHbvmo5wEDeJXKFOpKUwxYJIOxKUesounVccNYk=", + "lastModified": 1695830400, + "narHash": "sha256-gToZXQVr0G/1WriO83olnqrLSHF2Jb8BPcmCt497ro0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5ba549eafcf3e33405e5f66decd1a72356632b96", + "rev": "8a86b98f0ba1c405358f1b71ff8b5e1d317f5db2", "type": "github" }, "original": { @@ -52,18 +52,18 @@ "type": "github" } }, - "nixpkgs-stable": { + "nixpkgs-unstable": { "locked": { - "lastModified": 1695346609, - "narHash": "sha256-jur+AjgRvablLA2oBvC4FD89zCXttVQDwi6OXk5x/14=", + "lastModified": 1695830400, + "narHash": "sha256-gToZXQVr0G/1WriO83olnqrLSHF2Jb8BPcmCt497ro0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e9b4b56e5a20ac322c0c01ccab7ec697ab076ea0", + "rev": "8a86b98f0ba1c405358f1b71ff8b5e1d317f5db2", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-23.05", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -88,7 +88,7 @@ "home-manager": "home-manager", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", - "nixpkgs-stable": "nixpkgs-stable", + "nixpkgs-unstable": "nixpkgs-unstable", "nurpkgs": "nurpkgs" } } @@ -1,45 +1,29 @@ { - description = "Jon's NixOS configuration"; - - inputs = { - nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.05"; - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + description = "Jon's NixOS configuration"; - nixos-hardware.url = "github:NixOS/nixos-hardware/master"; - - nurpkgs.url = "github:nix-community/NUR"; - }; - - outputs = { self, nixpkgs, nixos-hardware, home-manager, ... }@inputs: - let - inherit (self) outputs; - stateVersion = "23.05"; - - overlays = [ - inputs.nurpkgs.overlay - ]; - - housemaker = import ./housemaker.nix { inherit inputs outputs stateVersion overlays; }; - in { - nixosConfigurations = { - jontest = housemaker.newhost { nixpkgs = nixpkgs; overlays = overlays; hostname = "jontest"; username = "jon"; }; - }; - nixosConfigurations = { - jontop = housemaker.newhost { nixpkgs = nixpkgs; overlays = overlays; hostname = "jontop"; username = "jon"; }; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + nurpkgs.url = "github:nix-community/NUR"; + nixos-hardware.url = "github:NixOS/nixos-hardware/master"; }; - nixosConfigurations = { - jonbox = housemaker.newhost { nixpkgs = nixpkgs; overlays = overlays; hostname = "jonbox"; username = "jon"; }; - }; - - homeConfigurations = { - "jon@jontest" = housemaker.newhome { nixpkgs = nixpkgs; overlays = overlays; hostname = "jontest"; username = "jon"; platform = "x86_64-linux"; }; - "jon@jontop" = housemaker.newhome { nixpkgs = nixpkgs; overlays = overlays; hostname = "jontop"; username = "jon"; platform = "x86_64-linux"; }; - "jon@jonbox" = housemaker.newhome { nixpkgs = nixpkgs; overlays = overlays; hostname = "jonbox"; username = "jon"; platform = "x86_64-linux"; }; + + outputs = { self, nixpkgs, nixpkgs-unstable, nixos-hardware, nurpkgs, home-manager, ... }@inputs: + let + inherit (self) outputs; + stateVersion = "23.05"; + in { + nixosConfigurations = ( + import ./hosts { + inherit (nixpkgs) lib; + inherit inputs nixpkgs nixpkgs-unstable nurpkgs home-manager stateVersion; + } + ); }; - }; } diff --git a/home/jon/home.nix b/home/jon/home.nix deleted file mode 100644 index d418e34..0000000 --- a/home/jon/home.nix +++ /dev/null @@ -1,61 +0,0 @@ -{ inputs, config, lib, pkgs, ... }: -let - hm = inputs.home-manager.lib.hm; - username = "jon"; -in -{ - programs.home-manager.enable = true; - - home.username = username; - home.homeDirectory = "/home/${username}"; - - #Userspace programs - imports = [ - ../../programs/picom.nix - ../../programs/rofi.nix - - ../../programs/kitty.nix - ../../programs/zsh.nix - ../../programs/tmux.nix - ../../programs/neovim.nix - ../../programs/firefox.nix - ../../programs/newsboat.nix - - ../../programs/virt-manager.nix - ]; - - home.packages = with pkgs; [ - libreoffice - hunspell - hunspellDicts.en_US - - (pass.withExtensions (exts: [ exts.pass-otp ])) - thefuck - mpc-cli - pavucontrol - qbittorrent - ffmpeg - ]; - - programs.ncmpcpp.enable = true; - programs.zathura.enable = true; - programs.bashmount.enable = true; - programs.mpv.enable = true; - - #Awesome - home.activation.installAwesomeWMConfig = '' - if [ ! -d "$HOME/.config/awesome" ]; then - ln -s "/etc/nixos/programs/dotfiles/awesome" "$HOME/.config/awesome" - chmod -R +w "$HOME/.config/awesome" - fi - ''; - - #Git - programs.git = { - enable = true; - userName = "Jon Santmyer"; - userEmail = "jon@jonsantmyer.com"; - }; - - home.stateVersion = "23.05"; -} diff --git a/hosts/config.nix b/hosts/config.nix new file mode 100644 index 0000000..de49a45 --- /dev/null +++ b/hosts/config.nix @@ -0,0 +1,128 @@ +{ inputs, config, lib, pkgs, nurpkgs, user, stateVersion, ... }: +{ + imports = ( + import ../modules/desktop ++ + import ../modules/editor ++ + import ../modules/web ++ + import ../modules/shell ++ + import ../modules/terminal ++ + import ../modules/programs ++ + import ../modules/vpn + ); + + users.users.${user} = { + isNormalUser = true; + extraGroups = [ + "wheel" + "video" + "audio" + "camera" + "networkmanager" + "libvirtd" + ]; + }; + + #Timezone + time.timeZone = "America/New_York"; + + #Locale + 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"; + }; + + #Fonts + fonts.packages = with pkgs; [ + fira-code + fira-code-symbols + font-awesome + liberation_ttf + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + (nerdfonts.override { fonts = [ "FiraCode" ]; } ) + ]; + + #Security + security.rtkit.enable = true; + security.polkit.enable = true; + + #Default Packages + environment.systemPackages = with pkgs; [ + #Terminal utils + btop #Resource monitor + coreutils #GNU Utils + git #VC + pciutils #PCI + usbutils #USB + gnutar + unzip + zip + wget + + #Devtools + binutils + clang-tools + gcc + gnumake + gdb + ]; + + programs = { + dconf.enable = true; + neovim.enable = true; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + }; + + services = { + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + }; + + #SSH + services.openssh.enable = true; + environment.shellInit = '' +gpg-connect-agent /bye +export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) + ''; + + #Nix package manager configs. + nix = { + registry = lib.mapAttrs (_: value: {flake = value;}) inputs; + + nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; + + settings = { + experimental-features = "nix-command flakes"; + auto-optimise-store = true; + }; + + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + }; + + system.stateVersion = stateVersion; + home-manager.users.${user} = { + home.username = user; + home.homeDirectory = "/home/${user}"; + home.stateVersion = stateVersion; + }; +} diff --git a/hosts/default.nix b/hosts/default.nix new file mode 100644 index 0000000..a5aace9 --- /dev/null +++ b/hosts/default.nix @@ -0,0 +1,32 @@ +{ inputs, lib, nixpkgs, nixpkgs-unstable, nurpkgs, home-manager, stateVersion }: +let + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system; + }; + + pkgs-unstable = import nixpkgs-unstable { + inherit system; + }; + + lib = nixpkgs.lib; +in +{ + jonbox = lib.nixosSystem { + inherit system; + specialArgs = { + inherit inputs system pkgs-unstable nurpkgs stateVersion; + user = "jon"; + }; + modules = [ + { nixpkgs.overlays = [ nurpkgs.overlay ]; } + ./config.nix + ./jonbox + + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + } + ]; + }; +} diff --git a/hosts/jonbox/default.nix b/hosts/jonbox/default.nix new file mode 100644 index 0000000..ce5f4a3 --- /dev/null +++ b/hosts/jonbox/default.nix @@ -0,0 +1,43 @@ +{ config, lib, pkgs, stateVersion, ... }: + +{ + imports = [ + ./hardware.nix + ../../modules/hardware/bluetooth.nix + ../../modules/virt + ]; + + #Boot options + boot = { + loader = { + systemd-boot = { + enable = true; + configurationLimit = 8; + }; + efi.canTouchEfiVariables = true; + timeout = 5; + }; + kernelPackages = pkgs.linuxPackages_latest; + }; + + #Unfree-packages. + nixpkgs.config.allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) [ + "nvidia-x11" + "nvidia-settings" + "nvidia-persistenced" + ]; + + #OpenGL + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + + #X11 Server + services.xserver.videoDrivers = [ "nvidia" ]; + + awesome.enable = true; + mullvad-vpn.enable = true; +} diff --git a/hosts/jonbox/filesystem.nix b/hosts/jonbox/filesystem.nix new file mode 100644 index 0000000..5b8ec2b --- /dev/null +++ b/hosts/jonbox/filesystem.nix @@ -0,0 +1,4 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ +} diff --git a/hosts/jonbox/hardware.nix b/hosts/jonbox/hardware.nix new file mode 100644 index 0000000..ce734fe --- /dev/null +++ b/hosts/jonbox/hardware.nix @@ -0,0 +1,65 @@ +{ config, lib, pkgs, modulesPath, ... }: +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + #Filesystems + fileSystems."/" = + { device = "/dev/disk/by-uuid/83cafaff-8be3-477f-b13c-c47dafdf969d"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/40EA-5550"; + fsType = "vfat"; + }; + + fileSystems."/mnt/jonshare" = { + device = "homenas:/var/data/jon"; + fsType = "nfs"; + }; + + fileSystems."/mnt/plexshare" = { + device = "homenas:/var/data/plex"; + fsType = "nfs"; + }; + + fileSystems."/mnt/share" = { + device = "homenas:/var/data/shared"; + fsType = "nfs"; + }; + + swapDevices = + [ + { device = "/dev/disk/by-uuid/acfc7ea5-0787-4e05-bcf1-20b7adb0f35c"; } + ]; + + #SSD-optimization + services.fstrim.enable = true; + + #Hardware + hardware.nvidia = { + modesetting.enable = true; + powerManagement.enable = false; + powerManagement.finegrained = false; + open = true; + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + + #Firmware + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + #Networking + networking.hostName = "jonbox"; + networking.useDHCP = lib.mkDefault true; + networking.networkmanager.enable = true; +} diff --git a/modules/desktop/awesome/default.nix b/modules/desktop/awesome/default.nix new file mode 100644 index 0000000..1959770 --- /dev/null +++ b/modules/desktop/awesome/default.nix @@ -0,0 +1,51 @@ +{ config, lib, pkgs, user, ... }: +with lib; +let + awesomeLuaModules = with pkgs.luaPackages; [ + luarocks + luadbi-mysql + ]; +in +{ + options = { + awesome = { + enable = mkOption { + type = types.bool; + default = false; + }; + }; + }; + + config = mkIf (config.awesome.enable) + { + xserver.enable = true; + rofi.enable = true; + + services.xserver = { + displayManager = { + sddm.enable = true; + defaultSession = "none+awesome"; + }; + windowManager.awesome = { + enable = true; + luaModules = awesomeLuaModules; + }; + }; + + home-manager.users.${user} = { + xsession.windowManager = { + awesome = { + enable = true; + luaModules = awesomeLuaModules; + }; + }; + + home.activation.installAwesomeWMConfig = '' +if [ ! -d "$HOME/.config/awesome" ]; then + ln -s "/etc/nixos/modules/desktop/awesome" "$HOME/.config/awesome" + chmod -R +w "$HOME/.config/awesome" +fi + ''; + }; + }; +} diff --git a/programs/dotfiles/awesome/rc.lua b/modules/desktop/awesome/rc.lua index 3d2de6d..3d2de6d 100644 --- a/programs/dotfiles/awesome/rc.lua +++ b/modules/desktop/awesome/rc.lua diff --git a/programs/dotfiles/awesome/scratch.lua b/modules/desktop/awesome/scratch.lua index aa1fd1e..aa1fd1e 100644 --- a/programs/dotfiles/awesome/scratch.lua +++ b/modules/desktop/awesome/scratch.lua diff --git a/programs/dotfiles/awesome/theme.lua b/modules/desktop/awesome/theme.lua index 49fe840..49fe840 100644 --- a/programs/dotfiles/awesome/theme.lua +++ b/modules/desktop/awesome/theme.lua diff --git a/programs/dotfiles/awesome/widgets/calendar.lua b/modules/desktop/awesome/widgets/calendar.lua index 6e791b3..6e791b3 100644 --- a/programs/dotfiles/awesome/widgets/calendar.lua +++ b/modules/desktop/awesome/widgets/calendar.lua diff --git a/programs/dotfiles/awesome/widgets/volume.lua b/modules/desktop/awesome/widgets/volume.lua index 21c200b..21c200b 100644 --- a/programs/dotfiles/awesome/widgets/volume.lua +++ b/modules/desktop/awesome/widgets/volume.lua diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix new file mode 100644 index 0000000..18f184e --- /dev/null +++ b/modules/desktop/default.nix @@ -0,0 +1,6 @@ +[ + ./xserver + ./awesome + ./picom.nix + ./rofi.nix +] diff --git a/modules/desktop/picom.nix b/modules/desktop/picom.nix new file mode 100644 index 0000000..7afe2f0 --- /dev/null +++ b/modules/desktop/picom.nix @@ -0,0 +1,13 @@ +{ config, lib, pkgs, user, ... }: +with lib; +{ + config = mkIf (config.xserver.enable) { + services.picom = { + enable = true; + settings = { + backend = "glx"; + corner-radius = 10; + }; + }; + }; +} diff --git a/modules/desktop/rofi.nix b/modules/desktop/rofi.nix new file mode 100644 index 0000000..d5aba06 --- /dev/null +++ b/modules/desktop/rofi.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, user, ...}: +with lib; +{ + options = { + rofi = { + enable = mkOption { + type = types.bool; + default = false; + }; + }; + }; + + config.home-manager.users.${user} = mkIf (config.rofi.enable) { + programs.rofi = { + enable = true; + }; + }; +} diff --git a/modules/desktop/xserver/default.nix b/modules/desktop/xserver/default.nix new file mode 100644 index 0000000..471c9ce --- /dev/null +++ b/modules/desktop/xserver/default.nix @@ -0,0 +1,39 @@ +{ config, lib, pkgs, user, ... }: +with lib; +let + +in +{ + options = { + xserver = { + enable = mkOption { + type = types.bool; + default = false; + }; + }; + }; + + config = mkIf (config.xserver.enable) + { + services.xserver = { + enable = true; + layout = "us"; + xkbVariant = ""; + }; + + environment.systemPackages = with pkgs; [ + xclip + xorg.xev + xorg.xkill + xorg.xrandr + arandr + ]; + + home-manager.users.${user} = { + xsession = { + enable = true; + numlock.enable = true; + }; + }; + }; +} diff --git a/modules/editor/default.nix b/modules/editor/default.nix new file mode 100644 index 0000000..f8cdc22 --- /dev/null +++ b/modules/editor/default.nix @@ -0,0 +1,3 @@ +[ + ./neovim +] diff --git a/modules/editor/neovim/default.nix b/modules/editor/neovim/default.nix new file mode 100644 index 0000000..c5cf990 --- /dev/null +++ b/modules/editor/neovim/default.nix @@ -0,0 +1,14 @@ +{ config, lib, pkgs, user, ... }: +{ + config.home-manager.users.${user} = { + xdg.configFile."nvim/init.vim".source = ./init.vim; + xdg.configFile."nvim/lua/init.lua".source = ./init.lua; + xdg.configFile."nvim/lua/plugins.lua".source = ./plugins.lua; + + programs.neovim = { + enable = true; + defaultEditor = true; + withNodeJs = true; + }; + }; +} diff --git a/programs/dotfiles/neovim/init.lua b/modules/editor/neovim/init.lua index 4a80830..4a80830 100644 --- a/programs/dotfiles/neovim/init.lua +++ b/modules/editor/neovim/init.lua diff --git a/programs/dotfiles/neovim/init.vim b/modules/editor/neovim/init.vim index 993ea88..993ea88 100644 --- a/programs/dotfiles/neovim/init.vim +++ b/modules/editor/neovim/init.vim diff --git a/programs/dotfiles/neovim/plugins.lua b/modules/editor/neovim/plugins.lua index 83c74ad..83c74ad 100644 --- a/programs/dotfiles/neovim/plugins.lua +++ b/modules/editor/neovim/plugins.lua diff --git a/modules/hardware/bluetooth.nix b/modules/hardware/bluetooth.nix new file mode 100644 index 0000000..1465d68 --- /dev/null +++ b/modules/hardware/bluetooth.nix @@ -0,0 +1,16 @@ +{ config, lib, pkgs, ... }: +{ + hardware.bluetooth.enable = true; + services.blueman.enable = true; + + environment.etc = { + "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = '' +bluez_monitor.properties = { + ["bluez5.enable-sbc-xq"] = true, + ["bluez5.enable-msbc"] = true, + ["bluez5.enable-hw-volume"] = true, + ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]" +} + ''; + }; +} diff --git a/modules/programs/default.nix b/modules/programs/default.nix new file mode 100644 index 0000000..b90ff8f --- /dev/null +++ b/modules/programs/default.nix @@ -0,0 +1,5 @@ +[ + ./tmux + ./newsboat.nix + ./programs.nix +] diff --git a/modules/programs/newsboat.nix b/modules/programs/newsboat.nix new file mode 100644 index 0000000..b37d765 --- /dev/null +++ b/modules/programs/newsboat.nix @@ -0,0 +1,12 @@ +{ config, lib, pkgs, user, ... }: +with lib; +{ + config.home-manager.users.${user} = { + programs.newsboat = { + enable = true; + extraConfig = mkIf (config.xserver.enable) '' +macro y set browser "mpv %u" ; open-in-browser ; set browser "firefox %u" + ''; + }; + }; +} diff --git a/modules/programs/programs.nix b/modules/programs/programs.nix new file mode 100644 index 0000000..b9d46c1 --- /dev/null +++ b/modules/programs/programs.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, user, ... }: +with lib; +{ + config.home-manager.users.${user} = mkIf (config.xserver.enable) { + home.packages = with pkgs; [ + libreoffice + hunspell + hunspellDicts.en_US + + (pass.withExtensions (exts: [exts.pass-otp ])) + thefuck + mpc-cli + pavucontrol + qbittorrent + ffmpeg + ]; + }; +} diff --git a/programs/tmux.nix b/modules/programs/tmux/default.nix index 6673b5d..b141af6 100644 --- a/programs/tmux.nix +++ b/modules/programs/tmux/default.nix @@ -1,18 +1,20 @@ -{ pkgs, ... }: +{ config, lib, pkgs, user, ... }: +with lib; { - programs.tmux = { - enable = true; - terminal = "tmux-256color"; - historyLimit = 10000; - plugins = with pkgs.tmuxPlugins; - [ - catppuccin - vim-tmux-navigator - sensible - yank - ]; - shell = "${pkgs.zsh}/bin/zsh"; - extraConfig = '' + config.home-manager.users.${user} = { + programs.tmux = { + enable = true; + terminal = "tmux-256color"; + historyLimit = 10000; + plugins = with pkgs.tmuxPlugins; + [ + catppuccin + vim-tmux-navigator + sensible + yank + ]; + shell = "${pkgs.zsh}/bin/zsh"; + extraConfig = '' set-option -sa terminal-overrides ",xterm*:Tc" set -g mouse on @@ -34,6 +36,7 @@ bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel bind '"' split-window -v -c ''${pane_current_path}" bind % split-window -h -c ''${pane_current_path}" - ''; + ''; + }; }; } diff --git a/modules/shell/default.nix b/modules/shell/default.nix new file mode 100644 index 0000000..03028ee --- /dev/null +++ b/modules/shell/default.nix @@ -0,0 +1,3 @@ +[ + ./zsh +] diff --git a/modules/shell/zsh/default.nix b/modules/shell/zsh/default.nix new file mode 100644 index 0000000..471bc57 --- /dev/null +++ b/modules/shell/zsh/default.nix @@ -0,0 +1,32 @@ +{ config, pkgs, user, ... }: +{ + config = { + programs.zsh.enable = true; + users.defaultUserShell = pkgs.zsh; + }; + + config.home-manager.users.${user} = { + home.packages = with pkgs; [ + inotify-tools + ]; + + programs.zsh = { + enable = true; + shellAliases = { + ll = "ls -l"; + unixos = "sudo nixos-rebuild switch --flake /etc/nixos"; + }; + history = { + size = 10000; + ignoreDups = true; + }; + + oh-my-zsh = { + enable = true; + plugins = [ "git" "thefuck" "pass" ]; + theme = "dst"; + }; + syntaxHighlighting.enable = true; + }; + }; +} diff --git a/modules/terminal/default.nix b/modules/terminal/default.nix new file mode 100644 index 0000000..dff50b7 --- /dev/null +++ b/modules/terminal/default.nix @@ -0,0 +1,3 @@ +[ + ./kitty +] diff --git a/modules/terminal/kitty/default.nix b/modules/terminal/kitty/default.nix new file mode 100644 index 0000000..1ff0b78 --- /dev/null +++ b/modules/terminal/kitty/default.nix @@ -0,0 +1,35 @@ +{ config, lib, pkgs, user, ... }: +with lib; +{ + config.home-manager.users.${user} = mkIf (config.xserver.enable) + { + xdg.configFile."kitty/theme.conf".source = ./themes/mocha.conf; + + programs.kitty = { + enable = true; + font = { + name = "FiraCode Nerd Font"; + size = 12; + }; + settings = { + repaint_delay = 10; + input_delay = 3; + sync_to_monitor = true; + + remember_window_size = false; + initial_window_width = 640; + initial_window_height = 480; + enabled_layouts = "*"; + + tab_bar_min_tabs = 2; + tab_bar_edge = "bottom"; + tab_bar_style = "powerline"; + tab_powerline_style = "slanted"; + tab_title_template = "{title}{' :{}'.format(num_windows) if num_windows > 1 else ''}"; + }; + extraConfig = '' + include ./theme.conf + ''; + }; + }; +} diff --git a/programs/dotfiles/kitty/themes/mocha.conf b/modules/terminal/kitty/themes/mocha.conf index 3ebc78f..3ebc78f 100644 --- a/programs/dotfiles/kitty/themes/mocha.conf +++ b/modules/terminal/kitty/themes/mocha.conf diff --git a/modules/virt/default.nix b/modules/virt/default.nix new file mode 100644 index 0000000..2b6e8f7 --- /dev/null +++ b/modules/virt/default.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, user, ... }: +{ + config = { + virtualisation.libvirtd.enable = true; + environment.systemPackages = with pkgs; [ + virt-manager + libguestfs + guestfs-tools + ]; + }; + + config.home-manager.users.${user} = { + dconf.settings = { + "org/virt-manager/virt-manager/connections" = { + autoconnect = ["qemu:///system"]; + uris = ["qemu:///system"]; + }; + }; + + xdg.configFile."libvirt/qemu.conf".text = '' +nvram = [ + "/run/libvirt/nix-ovmf/AAVMF_CODE.fd:/run/libvirt/nix-ovmf/AAVMF_VARS.fd", + "/run/libvirt/nix-ovmf/OVMF_CODE.fd:/run/libvirt/nix-ovmf/OVMF_VARS.fd" +] + ''; + }; +} diff --git a/modules/vpn/default.nix b/modules/vpn/default.nix new file mode 100644 index 0000000..6640ba6 --- /dev/null +++ b/modules/vpn/default.nix @@ -0,0 +1,3 @@ +[ + ./mullvad +] diff --git a/programs/openvpn.nix b/modules/vpn/mullvad/default.nix index 7bb8f9b..c6c9038 100644 --- a/programs/openvpn.nix +++ b/modules/vpn/mullvad/default.nix @@ -1,9 +1,21 @@ -{ pkgs, ... }: +{ config, lib, pkgs, user, ... }: +with lib; { - services.openvpn = { - servers = { - MullvadVPN-US-Miami = { - config = '' + options = { + mullvad-vpn = { + enable = mkOption { + type = types.bool; + default = false; + }; + }; + }; + + config = mkIf (config.mullvad-vpn.enable) + { + services.openvpn = { + servers = { + MullvadVPN-US-Miami = { + config = '' client dev tun resolv-retry infinite @@ -29,7 +41,8 @@ fast-io remote-random remote 146.70.187.194 1302 # us-mia-ovpn-101 remote 146.70.183.66 1302 # us-mia-ovpn-102 - ''; + ''; + }; }; }; }; diff --git a/modules/web/default.nix b/modules/web/default.nix new file mode 100644 index 0000000..04b267a --- /dev/null +++ b/modules/web/default.nix @@ -0,0 +1,3 @@ +[ + ./firefox +] diff --git a/programs/firefox.nix b/modules/web/firefox/default.nix index 79ca696..0a01090 100644 --- a/programs/firefox.nix +++ b/modules/web/firefox/default.nix @@ -1,10 +1,14 @@ -{ inputs, config, pkgs, username, ... }: +{ config, lib, pkgs, user, ... }: +with lib; let - owner = "arkenfox"; - repo = "user.js"; - version = "117.0"; + arkenfox = { + owner = "arkenfox"; + repo = "user.js"; + version = "117.0"; + }; in { + config.home-manager.users.${user} = mkIf (config.xserver.enable) { programs.firefox = { enable = true; @@ -15,7 +19,7 @@ in ]; extraConfig = builtins.readFile ( builtins.fetchTarball { - url = "https://github.com/${owner}/${repo}/archive/refs/tags/${version}.tar.gz"; + url = "https://github.com/${arkenfox.owner}/${arkenfox.repo}/archive/refs/tags/${arkenfox.version}.tar.gz"; sha256="1pll4fbdn2390n05902l3pkg4rizxghkakpzi1r9z1b7blmk1x4s"; } + "/user.js"); search = { @@ -41,8 +45,8 @@ in }; }; settings = { -"browser.download.dir" = "/home/${username}/dwn"; +"browser.download.dir" = "/home/${user}/dwn"; }; }; - }; + };}; } diff --git a/programs/dotfiles/kitty/kitty.conf b/programs/dotfiles/kitty/kitty.conf deleted file mode 100644 index 006956a..0000000 --- a/programs/dotfiles/kitty/kitty.conf +++ /dev/null @@ -1,47 +0,0 @@ -font_family FiraCode Nerd Font -bold_font auto -italic_font auto -bold_italic_font auto - -include ./theme.conf - -scrollback_lines 1000 -scrollback_pager less --chop-long-lines --RAW-CONTROL-CHARS +INPUT_LINE_NUMBER -scrollback_pager_history_size 0 -scrollback_fill_enlarged_window no -wheel_scroll_multiplier 5.0 - -mouse_hide_wait -1 -detect_urls no -copy_on_select no -strip_trailing_spaces never -select_by_word_characters @-./_~?&=%+# -click_interval -1 -focus_follows_mouse yes -default_pointer_shape beam -pointer_shape_when_dragging beam - -repaint_delay 10 -input_delay 3 -sync_to_monitor yes - -remember_window_size no -initial_window_width 640 -initial_window_height 480 -enabled_layouts * - -tab_bar_min_tabs 2 -tab_bar_edge bottom -tab_bar_style powerline -tab_powerline_style slanted -tab_title_template {title}{' :{}'.format(num_windows) if num_windows > 1 else ''} - -close_on_child_death no -allow_remote_control no -listen_on none -update_check_interval 24 -startup_session none -clipboard_control write-clipboard write-primary -allow_hyperlinks yes - - diff --git a/programs/kitty.nix b/programs/kitty.nix deleted file mode 100644 index ca535a7..0000000 --- a/programs/kitty.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ pkgs, ... }: -{ - xdg.configFile."kitty/theme.conf".source = ./dotfiles/kitty/themes/mocha.conf; - - programs.kitty = { - enable = true; - font = { - name = "FiraCode Nerd Font"; - size = 12; - }; - settings = { - repaint_delay = 10; - input_delay = 3; - sync_to_monitor = true; - - remember_window_size = false; - initial_window_width = 640; - initial_window_height = 480; - enabled_layouts = "*"; - - tab_bar_min_tabs = 2; - tab_bar_edge = "bottom"; - tab_bar_style = "powerline"; - tab_powerline_style = "slanted"; - tab_title_template = "{title}{' :{}'.format(num_windows) if num_windows > 1 else ''}"; - }; - extraConfig = '' - include ./theme.conf - ''; - }; - -} diff --git a/programs/neovim.nix b/programs/neovim.nix deleted file mode 100644 index fb32743..0000000 --- a/programs/neovim.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ pkgs, ... }: -{ - xdg.configFile."nvim/init.vim".source = ./dotfiles/neovim/init.vim; - xdg.configFile."nvim/lua/init.lua".source = ./dotfiles/neovim/init.lua; - xdg.configFile."nvim/lua/plugins.lua".source = ./dotfiles/neovim/plugins.lua; - - programs.neovim = { - enable = true; - defaultEditor = true; - withNodeJs = true; - }; -} diff --git a/programs/newsboat.nix b/programs/newsboat.nix deleted file mode 100644 index 036f383..0000000 --- a/programs/newsboat.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ pkgs, ... }: -{ - programs.newsboat = { - enable = true; - extraConfig = '' -macro y set browser "mpv %u" ; open-in-browser ; set browser "firefox %u" - ''; - }; -} diff --git a/programs/picom.nix b/programs/picom.nix deleted file mode 100644 index 87a43ed..0000000 --- a/programs/picom.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ pkgs, ... }: -{ - services.picom = { - enable = true; -# package = pkgs.picom.overrideAttrs(o: { -# src = pkgs.fetchFromGitHub { -# repo = "picom"; -# owner = "ibhagwan"; -# rev = "vNext"; -# hash = "sha256-JNbP8NZkHjlcQjSRfPbHdpTFrPO6GSZQ5qzDb0yi+pI="; -# }; -# }); - settings = { - backend = "glx"; - corner-radius = 10; - }; - }; -} diff --git a/programs/rofi.nix b/programs/rofi.nix deleted file mode 100644 index 72a40d5..0000000 --- a/programs/rofi.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ...}: -{ - programs.rofi = { - enable = true; - }; -} diff --git a/programs/scripts/watchfile.sh b/programs/scripts/watchfile.sh deleted file mode 100755 index 064a226..0000000 --- a/programs/scripts/watchfile.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -while inotifywait -e close_write $1; do $2; done diff --git a/programs/virt-manager.nix b/programs/virt-manager.nix deleted file mode 100644 index b2f3de5..0000000 --- a/programs/virt-manager.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ pkgs, username, ... }: -{ - dconf.settings = { - "org/virt-manager/virt-manager/connections" = { - autoconnect = ["qemu:///system"]; - uris = ["qemu:///system"]; - }; - }; - - xdg.configFile."libvirt/qemu.conf".text = '' -nvram = [ - "/run/libvirt/nix-ovmf/AAVMF_CODE.fd:/run/libvirt/nix-ovmf/AAVMF_VARS.fd", - "/run/libvirt/nix-ovmf/OVMF_CODE.fd:/run/libvirt/nix-ovmf/OVMF_VARS.fd" -] - ''; -} diff --git a/programs/zsh.nix b/programs/zsh.nix deleted file mode 100644 index 03a096f..0000000 --- a/programs/zsh.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ config, pkgs, ... }: -{ - home.packages = with pkgs; [ - inotify-tools - ]; - - programs.zsh = { - enable = true; - shellAliases = { - ll = "ls -l"; - unixos = "sudo nixos-rebuild switch --flake /etc/nixos"; - uhome = "home-manager switch --flake /etc/nixos"; - watchfile = "/etc/nixos/programs/scripts/watchfile.sh "; - }; - history = { - size = 10000; - path = "${config.xdg.dataHome}/zsh/history"; - ignoreDups = true; - }; - - oh-my-zsh = { - enable = true; - plugins = [ "git" "thefuck" "pass" ]; - theme = "dst"; - }; - syntaxHighlighting.enable = true; - }; -} diff --git a/systems/default.nix b/systems/default.nix index 94bb592..4f796dd 100644 --- a/systems/default.nix +++ b/systems/default.nix @@ -11,62 +11,6 @@ ../users/jon.nix ../programs/openvpn.nix ]; - - #Default boot parameters. - boot = { - tmp.cleanOnBoot = true; - initrd.verbose = false; - }; - - #Nix package manager configs. - nix = { - registry = lib.mapAttrs (_: value: {flake = value;}) inputs; - - nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; - - settings = { - experimental-features = "nix-command flakes"; - auto-optimise-store = true; - }; - - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 7d"; - }; - }; - - #Networking - networking.hostName = hostname; # Define your hostname. - networking.useDHCP = lib.mkDefault true; - networking.networkmanager.enable = true; - - #Timezone - time.timeZone = "America/New_York"; - - #Locale & Fonts - 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"; - }; - fonts.packages = with pkgs; [ - fira-code - fira-code-symbols - font-awesome - liberation_ttf - noto-fonts - noto-fonts-cjk - noto-fonts-emoji - (nerdfonts.override { fonts = [ "FiraCode" ]; } ) - ]; services.pipewire = { enable = true; @@ -75,10 +19,6 @@ pulse.enable = true; }; - #Security - security.rtkit.enable = true; - security.polkit.enable = true; - #Default packages for QOL environment.systemPackages = with pkgs; [ binutils @@ -119,13 +59,6 @@ audio_output { enableSSHSupport = true; }; - #SSH - services.openssh.enable = true; - environment.shellInit = '' -gpg-connect-agent /bye -export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) - ''; - # Open ports in the firewall. # networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ]; @@ -138,6 +71,5 @@ export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) # this value at the release version of the first install of this system. # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = stateVersion; # Did you read the comment? } diff --git a/users/jon.nix b/users/jon.nix deleted file mode 100644 index 92c4bd1..0000000 --- a/users/jon.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ inputs, pkgs, ... }: -{ - users.users.jon = { - isNormalUser = true; - description = "jon"; - extraGroups = [ - "networkmanager" - "wheel" - "video" - "libvirtd" - ]; - packages = with pkgs; []; - }; - -} |