diff --git a/flake.lock b/flake.lock index 13c3faa..401b301 100644 --- a/flake.lock +++ b/flake.lock @@ -229,6 +229,22 @@ "type": "github" } }, + "nixos-hardware": { + "locked": { + "lastModified": 1729455275, + "narHash": "sha256-THqzn/7um3oMHUEGXyq+1CJQE7EogwR3HjLMNOlhFBE=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "9fcf30fccf8435f6390efec4a4d38e69c2268a36", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixos-hardware", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1729181673, @@ -297,6 +313,7 @@ "greg-clients": "greg-clients", "home-manager": "home-manager", "nixgl": "nixgl", + "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "nur": "nur", "unstable": "unstable", diff --git a/flake.nix b/flake.nix index cd79784..f3b611a 100644 --- a/flake.nix +++ b/flake.nix @@ -12,6 +12,8 @@ unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + nur.url = "github:nix-community/NUR"; dan.url = "git+https://git.dodsorf.as/Dandellion/NUR.git"; #"git+https://git.dodsorf.as/Dandellion/NUR"; @@ -30,10 +32,24 @@ nixgl.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = {self, nixpkgs, home-manager, unstable, nur, dan, nixgl, ... }@inputs: + outputs = {self, nixpkgs, home-manager, unstable, nixos-hardware, nur, dan, nixgl, ... }@inputs: let nixlib = unstable.lib; + defaultOverlays = [ + (final: prev: { + unstable = import unstable { + inherit (prev) system config; + }; + dan = dan.packages.${prev.system}; + grzegorz-clients = inputs.greg-clients.packages.${prev.system}.grzegorz-clients; + gregctl = inputs.greg-clients.packages.${prev.system}.grzegorzctl; + # helix = inputs.helix.packages.${prev.system}.helix; + }) + nur.overlay + nixgl.overlay + ]; + mkHome = { machine , configuration ? self.nixosModules.home-manager.${machine} @@ -41,7 +57,7 @@ , username ? "daniel" , homeDirectory ? "/home/${username}" , stateVersion ? "22.05" - , extraSpecialArgs ? { inherit (self) overlays; } + , extraSpecialArgs ? { inherit (self) defaultOverlays; } }: home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.${system}; @@ -67,6 +83,17 @@ // mkHomes [ "pvv-terminal" ] { username = "danio"; homeDirectory = "/home/pvv/d/danio"; }; nixosConfigurations = { + ayanami = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs; + }; + modules = [ + ./hosts/ayanami/configuration.nix + nixos-hardware.nixosModules.lenovo-thinkpad-l480 + ]; + }; + soryu = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { @@ -82,20 +109,6 @@ home-manager = nixlib.genAttrs allMachines (machine: import ./home/machines/${machine}.nix); }; - overlays = [ - (final: prev: { - unstable = import unstable { - inherit (prev) system config; - }; - dan = dan.packages.${prev.system}; - grzegorz-clients = inputs.greg-clients.packages.${prev.system}.grzegorz-clients; - gregctl = inputs.greg-clients.packages.${prev.system}.grzegorzctl; - # helix = inputs.helix.packages.${prev.system}.helix; - }) - nur.overlay - nixgl.overlay - ]; - homeActivations = nixlib.genAttrs allMachines (machine: self.homeConfigurations.${machine}.activationPackage); apps.x86_64-linux = nixlib.genAttrs allMachines (machine: { @@ -103,9 +116,9 @@ program = "${self.homeActivations.${machine}}/activate"; }); - hydraJobs = { - laptop.x86_64-linux = self.homeActivations.laptop; - desktop.x86_64-linux = self.homeActivations.desktop; - }; + # hydraJobs = { + # laptop.x86_64-linux = self.homeActivations.laptop; + # desktop.x86_64-linux = self.homeActivations.desktop; + # }; }; } diff --git a/hosts/ayanami/2024-10-21-033702_838x698_scrot.png b/hosts/ayanami/2024-10-21-033702_838x698_scrot.png new file mode 100644 index 0000000..4bc6ca5 Binary files /dev/null and b/hosts/ayanami/2024-10-21-033702_838x698_scrot.png differ diff --git a/hosts/ayanami/configuration.nix b/hosts/ayanami/configuration.nix new file mode 100644 index 0000000..3ab8402 --- /dev/null +++ b/hosts/ayanami/configuration.nix @@ -0,0 +1,241 @@ +#n Edit this configuration file to define what should be installed on your system. +# Help is available in the configuration.nix(5) man page and in the NixOS manual +# (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + imports = + [ + ./hardware-configuration.nix + ]; + + networking.hosts = { + # "10.10.111.103" = [ "snowbell.htb" "legacy.snowbell.htb" "management.snowbell.htb" ]; + }; + + boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; + + virtualisation.podman.enable = true; + virtualisation.libvirtd.enable = true; + programs.dconf.enable = true; + + programs.wireshark.enable = true; + programs.wireshark.package = pkgs.wireshark; + + # services.mysql.enable = true; + # services.mysql.package = pkgs.mariadb; + # services.mysql.settings.mysqld = { + # bind-address = "127.0.0.1"; + # port = 3306; + # }; + # services.mysql.ensureUsers = [ + # { + # name = "daniel"; + # ensurePermissions = { + # "lab1.*" = "ALL PRIVILEGES"; + # "lab2.*" = "ALL PRIVILEGES"; + # "lab3.*" = "ALL PRIVILEGES"; + # "lab4.*" = "ALL PRIVILEGES"; + # "lab5.*" = "ALL PRIVILEGES"; + # }; + # } + # ]; + + # services.create_ap.enable = false; + # services.create_ap.settings = { + # INTERNET_IFACE = "enp0s31f6"; + # PASSPHRASE = "12345678"; + # SSID = "DOTA2ERBEST"; + # WIFI_IFACE = "wlp5s0"; + # MAC_FILTER = 0; + # HIDDEN = 0; + # }; + + boot.kernelModules = [ "v4l2loopback" ]; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "ayanami"; # Define your hostname. + networking.networkmanager.enable = true; + + hardware.bluetooth.enable = true; + services.blueman.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Oslo"; + + services.tailscale.enable = true; + + # The global useDHCP flag is deprecated, therefore explicitly set to false here. + # Per-interface useDHCP will be mandatory in the future, so this generated config + # replicates the default behaviour. + networking.useDHCP = false; + networking.interfaces.enp0s31f6.useDHCP = false; + networking.interfaces.wlp5s0.useDHCP = false; + + services.avahi.enable = false; + + # services.atftpd = { + # enable = false; + # }; + + # Select internationalisation properties. + i18n.supportedLocales = [ "en_US.UTF-8/UTF-8" "nb_NO.UTF-8/UTF-8" ]; + i18n.defaultLocale = "en_US.UTF-8"; + i18n.extraLocaleSettings = { + LC_TIME = "nb_NO.UTF-8"; + LC_PAPER = "nb_NO.UTF-8"; + LC_NAME = "nb_NO.UTF-8"; + LC_ADDRESS = "nb_NO.UTF-8"; + LC_TELEPHONE = "nb_NO.UTF-8"; + LC_MEASUREMENT = "nb_NO.UTF-8"; + LC_IDENTIFICATION = "nb_NO.UTF-8"; +}; + console = { + font = "Lat2-Terminus16"; + keyMap = "no-latin1"; + }; + + services.xserver.displayManager.lightdm.enable = true; + services.displayManager.defaultSession = "xsession"; + # Enable the X11 windowing system. + services.xserver.enable = true; + services.xserver.displayManager = { + session = [ + { + manage = "desktop"; + name = "xsession"; + start = "exec $HOME/.xsession"; + } + ]; + }; + + # Disable cups we will just not print anything :)) + services.printing.enable = false; + + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + + hardware.opengl.driSupport32Bit = true; + hardware.opengl.extraPackages = with pkgs; [ libva ]; + + # Enable touchpad support (enabled default in most desktopManager). + services.libinput.enable = true; + services.xserver.xkb.layout = "no"; + + + programs.zsh.enable = true; + + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.daniel = { + isNormalUser = true; + shell = pkgs.zsh; + extraGroups = [ "wheel" "networkmanager" "wireshark" "libvirtd" ]; + }; + + environment.systemPackages = with pkgs; [ + vim + git + wget + virt-manager + podman-compose + ]; + + + services.dbus.packages = with pkgs; [ pkgs.dconf ]; + + services.openssh.enable = true; + services.openssh.openFirewall = false; + + networking.firewall.interfaces."tailscale0" = let + all = { from = 0; to = 65535; }; + in { + allowedUDPPortRanges = [ all ]; + allowedTCPPortRanges = [ all ]; + }; + + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [ 69 8010 9090 ]; + networking.firewall.allowedUDPPorts = [ 69 8010 9090 ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + nix.settings.trusted-users = [ "daniel" ]; + + nix.buildMachines = [ +# { hostName = "bob.pvv.ntnu.no"; +# system = "x86_64-linux"; +# maxJobs = 12; +# supportedFeatures = [ "big-parallel" ]; +# speedFactor = 129270; +# } + { hostName = "bolle.pbsds.net"; + system = "x86_64-linux"; + maxJobs = 6; + speedFactor = 12857; + } + { hostName = "garp.pbsds.net"; + system = "x86_64-linux"; + maxJobs = 4; + # i7-6700 + speedFactor = 8088; + } + { hostName = "lilith"; + system = "x86_64-linux"; + # if the builder supports building for multiple architectures, + # replace the previous line by, e.g., + # systems = ["x86_64-linux" "aarch64-linux"]; + maxJobs = 6; + #speedFactor = 13199; + speedFactor = 6000; + supportedFeatures = [ ]; + mandatoryFeatures = [ ]; + } + { hostName = "desktop"; + system = "x86_64-linux"; + maxJobs = 4; + #speedFactor = 8066; + speedFactor = 4000; + supportedFeatures = [ ]; + mandatoryFeatures = [ ]; + } + # { hostName = "sachiel"; + # system = "x86_64-linux"; + # maxJobs = 1; + # #speedfactor = + # } + # { + # hostName = "isvegg.pvv.ntnu.no"; + # system = "x86_64-linux"; + # maxJobs = 4; + # speedFactor = 4961; + # supportedFeatures = [ "big-parallel" ]; + # mandatoryFeatures = [ ]; + # } + ]; + nix.distributedBuilds = true; + nix.extraOptions = '' + builders-use-substitutes = true + experimental-features = nix-command flakes impure-derivations ca-derivations + ''; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # 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 = "23.11"; # Did you read the comment? + +} + diff --git a/hosts/ayanami/hardware-configuration.nix b/hosts/ayanami/hardware-configuration.nix new file mode 100644 index 0000000..7b2d580 --- /dev/null +++ b/hosts/ayanami/hardware-configuration.nix @@ -0,0 +1,59 @@ +# 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 = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/276d0801-34f7-4d40-aa24-bfc43ea4ff51"; + fsType = "btrfs"; + options = [ "subvol=root" ]; + }; + + boot.initrd.luks.devices."enc".device = "/dev/disk/by-uuid/27c2e6ae-d9ec-4bbd-9ebe-6ec2e63dd139"; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/276d0801-34f7-4d40-aa24-bfc43ea4ff51"; + fsType = "btrfs"; + options = [ "subvol=home" ]; + }; + + fileSystems."/nix" = + { device = "/dev/disk/by-uuid/276d0801-34f7-4d40-aa24-bfc43ea4ff51"; + fsType = "btrfs"; + options = [ "subvol=nix" ]; + }; + + fileSystems."/persist" = + { device = "/dev/disk/by-uuid/276d0801-34f7-4d40-aa24-bfc43ea4ff51"; + fsType = "btrfs"; + options = [ "subvol=persist" ]; + }; + + fileSystems."/var/log" = + { device = "/dev/disk/by-uuid/276d0801-34f7-4d40-aa24-bfc43ea4ff51"; + fsType = "btrfs"; + options = [ "subvol=log" ]; + neededForBoot = true; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/503B-1BC9"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/28c04c57-b026-471f-a7bf-366cbc102b78"; } + ]; + + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}