diff --git a/core/default.nix b/core/default.nix index bf72111..6deccb5 100644 --- a/core/default.nix +++ b/core/default.nix @@ -20,18 +20,14 @@ in { environment = { etc."nixos/configuration.nix".source = dummyConfig; - pathsToLink = [ - "/share/zsh" - ]; systemPackages = with pkgs; [ neovim ]; + variables.EDITOR = "nvim"; }; # Disable unnecessary stuff from the nixos defaults. services.udisks2.enable = false; - networking.dhcpcd.enable = false; - networking.firewall.enable = false; security.sudo.enable = false; home-manager = { @@ -44,12 +40,11 @@ in { i18n.defaultLocale = "C.UTF-8"; networking = { - # 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..useDHCP`. useDHCP = lib.mkForce false; useNetworkd = true; wireguard.enable = true; + dhcpcd.enable = false; + firewall.enable = false; }; nix.nixPath = [ @@ -61,10 +56,17 @@ in { nixpkgs.config.allowUnfree = true; programs = { - zsh = { + git = { enable = true; - enableGlobalCompInit = false; + config = { + init.defaultBranch = "main"; + pull.rebase = true; + }; }; + neovim = { + enable = true; + viAlias = true; + }; }; system = { @@ -81,5 +83,9 @@ in { network.wait-online.anyInterface = true; }; + users.users.root = { + initialHashedPassword = "$6$EBo/CaxB.dQoq2W8$lo2b5vKgJlLPdGGhEqa08q3Irf1Zd1PcFBCwJOrG8lqjwbABkn1DEhrMh1P3ezwnww2HusUBuZGDSMa4nvSQg1"; + openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA5Uq+CDy5Pmt3If5M6d8K/Q7HArU6sZ7sgoj3T521Wm"]; + }; users.mutableUsers = false; } diff --git a/dev/default.nix b/dev/default.nix index 8abee11..232ddf4 100644 --- a/dev/default.nix +++ b/dev/default.nix @@ -1,7 +1,5 @@ { imports = [./documentation.nix]; - environment = { - enableDebugInfo = true; - }; + environment.enableDebugInfo = true; } diff --git a/dev/virt-manager.nix b/dev/virt-manager.nix new file mode 100644 index 0000000..cc25471 --- /dev/null +++ b/dev/virt-manager.nix @@ -0,0 +1,18 @@ +{pkgs, ...}: { + environment.systemPackages = with pkgs; [virt-manager spice-gtk swtpm]; + security.polkit.enable = true; + virtualisation = { + libvirtd = { + enable = true; + qemu = { + package = pkgs.qemu_kvm; + ovmf = { + enable = true; + packages = with pkgs; [OVMFFull.fd]; + }; + swtpm.enable = true; + }; + }; + spiceUSBRedirection.enable = true; + }; +} diff --git a/hardware/efi.nix b/hardware/efi.nix deleted file mode 100644 index 9357f9f..0000000 --- a/hardware/efi.nix +++ /dev/null @@ -1,11 +0,0 @@ -{lib, ...}: { - boot.loader = { - efi.canTouchEfiVariables = true; - systemd-boot = { - enable = true; - configurationLimit = 15; - }; - timeout = lib.mkDefault 2; - }; - console.earlySetup = true; -} diff --git a/hardware/yubikey.nix b/hardware/yubikey.nix deleted file mode 100644 index a500e34..0000000 --- a/hardware/yubikey.nix +++ /dev/null @@ -1,4 +0,0 @@ -{pkgs, ...}: { - services.udev.packages = with pkgs; [yubikey-personalization libu2f-host]; - services.pcscd.enable = true; -} diff --git a/hardware/zfs.nix b/hardware/zfs.nix deleted file mode 100644 index a693d45..0000000 --- a/hardware/zfs.nix +++ /dev/null @@ -1,16 +0,0 @@ -{pkgs, ...}: { - boot.supportedFilesystems = ["zfs"]; - - environment.systemPackages = with pkgs; [zfs]; - - services.zfs = { - autoScrub = { - enable = true; - interval = "weekly"; - }; - trim = { - enable = true; - interval = "weekly"; - }; - }; -} diff --git a/hosts/nom/default.nix b/hosts/nom/default.nix index 598c798..1b36aa1 100644 --- a/hosts/nom/default.nix +++ b/hosts/nom/default.nix @@ -10,18 +10,21 @@ nixos-hardware.common-pc-laptop nixos-hardware.common-pc-laptop-ssd ../../core + ../../dev - ../../hardware/efi.nix + ../../modules/efi.nix + ../../modules/laptop.nix + ../../modules/yubikey.nix + ../../modules/zfs.nix ../../users/oddlama - #./state.nix + ./fs.nix + ./net.nix ]; boot = { initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"]; kernelModules = []; - kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; - supportedFilesystems = ["zfs"]; tmpOnTmpfs = true; }; @@ -31,22 +34,7 @@ packages = with pkgs; [terminus_font]; }; - fileSystems = { - "/" = { - device = "rpool/root/nixos"; - fsType = "zfs"; - options = ["zfsutil" "X-mount.mkdir"]; - }; - - "/boot" = { - device = "/dev/disk/by-uuid/91ED-0E13"; - fsType = "vfat"; - }; - }; - - swapDevices = [ - {device = "/dev/disk/by-uuid/1122527a-71d3-4ec7-8d41-65d0c8494b04";} - ]; + environment.systemPackages = with pkgs; [wireguard-tools powertop]; hardware = { enableRedistributableFirmware = true; @@ -55,37 +43,10 @@ opengl.enable = true; }; - networking = { - hostId = "4313abca"; - hostName = "nom"; - wireless.iwd.enable = true; - }; - powerManagement.cpuFreqGovernor = "powersave"; services = { fwupd.enable = true; smartd.enable = true; }; - - systemd.network.networks = { - wired = { - DHCP = "yes"; - matchConfig.MACAddress = "00:00:00:00:00:00"; - dhcpV4Config.RouteMetric = 10; - dhcpV6Config.RouteMetric = 10; - }; - wireless = { - DHCP = "yes"; - matchConfig.MACAddress = "00:00:00:00:00:00"; - dhcpV4Config.RouteMetric = 40; - dhcpV6Config.RouteMetric = 40; - }; - }; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.root = { - initialHashedPassword = "$6$EBo/CaxB.dQoq2W8$lo2b5vKgJlLPdGGhEqa08q3Irf1Zd1PcFBCwJOrG8lqjwbABkn1DEhrMh1P3ezwnww2HusUBuZGDSMa4nvSQg1"; - openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA5Uq+CDy5Pmt3If5M6d8K/Q7HArU6sZ7sgoj3T521Wm"]; - }; } diff --git a/hosts/nom/fs.nix b/hosts/nom/fs.nix new file mode 100644 index 0000000..a7e1af6 --- /dev/null +++ b/hosts/nom/fs.nix @@ -0,0 +1,18 @@ +{config, ...}: { + fileSystems = { + "/" = { + device = "rpool/root/nixos"; + fsType = "zfs"; + options = ["zfsutil" "X-mount.mkdir"]; + }; + + "/boot" = { + device = "/dev/disk/by-uuid/91ED-0E13"; + fsType = "vfat"; + }; + }; + + swapDevices = [ + {device = "/dev/disk/by-uuid/1122527a-71d3-4ec7-8d41-65d0c8494b04";} + ]; +} diff --git a/hosts/nom/net.nix b/hosts/nom/net.nix new file mode 100644 index 0000000..225c142 --- /dev/null +++ b/hosts/nom/net.nix @@ -0,0 +1,22 @@ +{ + networking = { + hostId = "4313abca"; + hostName = "nom"; + wireless.iwd.enable = true; + }; + + systemd.network.networks = { + wired = { + DHCP = "yes"; + matchConfig.MACAddress = "00:00:00:00:00:00"; + dhcpV4Config.RouteMetric = 10; + dhcpV6Config.RouteMetric = 10; + }; + wireless = { + DHCP = "yes"; + matchConfig.MACAddress = "00:00:00:00:00:00"; + dhcpV4Config.RouteMetric = 40; + dhcpV6Config.RouteMetric = 40; + }; + }; +} diff --git a/nix/overlays/scripts/screenocr.nix b/nix/overlays/scripts/screenocr.nix new file mode 100644 index 0000000..3ae1241 --- /dev/null +++ b/nix/overlays/scripts/screenocr.nix @@ -0,0 +1,27 @@ +final: _: { + screenocr = + final.callPackage + ( + { + writeShellApplication, + coreutils, + grim, + slurp, + tesseract4, + wl-clipboard, + }: + writeShellApplication { + name = "screenocr"; + + runtimeInputs = [coreutils grim slurp tesseract4 wl-clipboard]; + + text = '' + grim -t png -g "$(slurp)" - \ + | tesseract stdin stdout -l "eng+equ" \ + | tr -d '\f' \ + | wl-copy + ''; + } + ) + {}; +} diff --git a/users/myuser/core/default.nix b/users/myuser/core/default.nix new file mode 100644 index 0000000..6df1486 --- /dev/null +++ b/users/myuser/core/default.nix @@ -0,0 +1,67 @@ +{ pkgs, ... }: { + imports = [ + ./atuin.nix + ./bash.nix + ./btop.nix + ./fish.nix + ./git.nix + ./htop.nix + ./neovim + ./ssh.nix + ./starship.nix + ./tmux.nix + ./xdg.nix + ./zsh.nix + ]; + + home = { + username = "myuser"; + stateVersion = "22.11"; + packages = with pkgs; [ + bandwhich + btop + colorcheck + fd + kalker + neofetch + rclone + ripgrep + rsync + ]; + shellAliases = { + l = "ls -lahF --group-directories-first --show-control-chars --quoting-style=escape --color=auto"; + t="tree -F --dirsfirst -L 2" + tt="tree -F --dirsfirst -L 3 --filelimit 16" + ttt="tree -F --dirsfirst -L 6 --filelimit 16" + cpr="rsync -axHAWXS --numeric-ids --info=progress2" + + md="mkdir" + rmd="rm --one-file-system -d" + cp="cp -vi" + mv="mv -vi" + rm="rm --one-file-system -I" + chmod="chmod -c --preserve-root" + chown="chown -c --preserve-root" + + vim="nvim" + ip="ip --color" + tmux="tmux -2" + rg="rg -S" + + p="cd ~/projects" + }; + }; + + programs = { + atuin = { + enable = true; + settings.auto_sync = false; + }; + bat.enable = true; + fzf.enable = true; + gpg.enable = true; + zoxide.enable = true; + }; + + xdg.configFile."nixpkgs/config.nix".text = "{ allowUnfree = true; }"; +} diff --git a/users/myuser/default.nix b/users/myuser/default.nix new file mode 100644 index 0000000..2edf2ae --- /dev/null +++ b/users/myuser/default.nix @@ -0,0 +1,32 @@ +{ config, lib, pkgs, ... }: +with lib; +{ + users.groups.myuser.gid = config.users.users.myuser.uid; + users.users.myuser = { + uid = 1000; + createHome = true; + group = "myuser"; + extraGroups = [ "wheel" "input" "video" ] + ++ optionals config.sound.enable [ "audio" ]; + isNormalUser = true; + shell = pkgs.zsh; + }; + + home-manager.users.myuser = { + imports = [ + #impermanence.home-manager.impermanence + ./core + ./dev + #] + #++ optionals config.programs.sway.enable [ + # ./graphical + # ./graphical/sway + #] ++ optionals config.services.xserver.windowManager.i3.enable [ + # ./graphical + # ./graphical/i3 + ]; + + home.username = config.users.users.myuser.name; + home.uid = config.users.users.myuser.uid; + }; +} diff --git a/users/myuser/dev/default.nix b/users/myuser/dev/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/users/oddlama/default.nix b/users/oddlama/default.nix deleted file mode 100644 index e36b4da..0000000 --- a/users/oddlama/default.nix +++ /dev/null @@ -1,3 +0,0 @@ -{lib, ...}: -with lib; { -}