diff --git a/flake.nix b/flake.nix index bfe30d0..0840b58 100644 --- a/flake.nix +++ b/flake.nix @@ -94,6 +94,101 @@ }; nixosConfigurations = { + # work VM + garchomp = nixpkgs.lib.nixosSystem rec { + system = "aarch64-linux"; + modules = [ + home-manager.nixosModules.home-manager + + ({ ... } :{ + imports = [./hosts/garchomp]; + }) + + ({ config, ... }: { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + + nixpkgs.overlays = [ emacs-overlay.overlay ]; + + networking.hostName = "garchomp"; + networking.nameservers = [ "100.100.100.100" ]; + networking.search = [ "shark-harmonic.ts.net" ]; + + nix.package = pkgs.nixVersions.stable; + nix.extraOptions = '' + experimental-features = nix-command flakes + ''; + + users.users.xe = { + extraGroups = [ + "wheel" + "docker" + "audio" + "plugdev" + "libvirtd" + "adbusers" + "dialout" + "within" + ]; + shell = pkgs.fish; + isNormalUser = true; + group = "xe"; + }; + + environment.systemPackages = with pkgs; [ mosh flyctl ]; + virtualisation.docker.enable = true; + + services.tailscale.enable = true; + + home-manager.users.xe = { lib, ... }: + let + name = "Xe Iaso"; + email = "xe@tailscale.com"; + commitTemplate = pkgs.writeTextFile { + name = "xe-commit-template"; + text = '' + Signed-off-by: ${name} <${email}> + ''; + }; + in { + imports = [ ./common/home-manager ]; + + within = { + emacs.enable = true; + fish.enable = true; + neofetch.enable = true; + vim.enable = true; + tmux.enable = true; + }; + + services.emacs.enable = lib.mkForce false; + programs.direnv.enable = true; + programs.direnv.nix-direnv.enable = true; + + programs.git = { + package = pkgs.gitAndTools.gitFull; + enable = true; + userName = name; + userEmail = email; + ignores = [ "*~" "*.swp" "*.#" ]; + delta.enable = true; + extraConfig = { + commit.template = "${commitTemplate}"; + core.editor = "vim"; + color.ui = "auto"; + credential.helper = "store --file ~/.git-credentials"; + format.signoff = true; + init.defaultBranch = "main"; + protocol.keybase.allow = "always"; + pull.rebase = "true"; + push.default = "current"; + }; + }; + }; + }) + ]; + }; + # wsl xatci = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; diff --git a/hosts/garchomp/default.nix b/hosts/garchomp/default.nix new file mode 100644 index 0000000..0678cf7 --- /dev/null +++ b/hosts/garchomp/default.nix @@ -0,0 +1,20 @@ +{ config, pkgs, ... }: + +{ + imports = + [ + ./hardware-configuration.nix + ./rosetta.nix + ]; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "garchomp"; # Define your hostname. + services.openssh.enable = true; + networking.firewall.enable = false; + system.copySystemConfiguration = true; + system.stateVersion = "22.05"; +} + + diff --git a/hosts/garchomp/hardware-configuration.nix b/hosts/garchomp/hardware-configuration.nix new file mode 100644 index 0000000..9495703 --- /dev/null +++ b/hosts/garchomp/hardware-configuration.nix @@ -0,0 +1,32 @@ +# 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 = [ "virtio_pci" "xhci_pci" "usb_storage" "usbhid" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/24ef4b7f-5110-4834-9c46-3fb69eb5b0bb"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/cc5d7426-0370-4bcd-ac86-0f6de1596dec"; } + ]; + + # 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s1.useDHCP = lib.mkDefault true; + +} diff --git a/hosts/garchomp/rosetta.nix b/hosts/garchomp/rosetta.nix new file mode 100644 index 0000000..d7833f0 --- /dev/null +++ b/hosts/garchomp/rosetta.nix @@ -0,0 +1,17 @@ +{ config, lib, ...}: { + boot.initrd.availableKernelModules = [ "virtiofs" ]; + fileSystems."/run/rosetta" = { + device = "rosetta"; + fsType = "virtiofs"; + }; + nix.settings.extra-platforms = [ "x86_64-linux" ]; + nix.settings.extra-sandbox-paths = [ "/run/rosetta" "/run/binfmt" ]; + boot.binfmt.registrations."rosetta" = { # based on https://developer.apple.com/documentation/virtualization/running_intel_binaries_in_linux_vms_with_rosetta#3978495 + interpreter = "/run/rosetta/rosetta"; + fixBinary = true; + wrapInterpreterInShell = false; + matchCredentials = true; + magicOrExtension = ''\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00''; + mask = ''\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff''; + }; +}