From d322a4f0a8e95dc8ccc164e0105d52d1a40aa2c4 Mon Sep 17 00:00:00 2001 From: jopejoe1 Date: Thu, 23 Feb 2023 20:34:35 +0100 Subject: [PATCH] Switch to snowfall flake configuration --- common.nix | 176 ------------- flake.lock | 236 ++++++++++++++++-- flake.nix | 203 ++++++++------- kami.nix | 62 ----- lib/module/default.nix | 16 ++ modules/desktop/plasma/default.nix | 36 +++ modules/hardware/audio/default.nix | 76 ++++++ modules/hardware/printing/default.nix | 39 +++ modules/nix/default.nix | 53 ++++ modules/system/boot/uboot/default.nix | 23 ++ modules/system/boot/uefi/default.nix | 22 ++ modules/system/fonts/default.nix | 30 +++ modules/system/locale/default.nix | 40 +++ modules/system/xdg/default.nix | 25 ++ modules/user/jopejoe1/default.nix | 31 +++ .../user/jopejoe1/home.nix | 2 +- modules/user/root/default.nix | 16 ++ home/root.nix => modules/user/root/home.nix | 2 +- oni.nix | 59 ----- systems/aarch64-linux/yokai/default.nix | 34 +++ systems/aarch64-linux/yokai/hardware.nix | 54 ++++ systems/x86_64-linux/kami/default.nix | 38 +++ systems/x86_64-linux/kami/hardware.nix | 68 +++++ systems/x86_64-linux/oni/default.nix | 35 +++ systems/x86_64-linux/oni/hardware.nix | 65 +++++ yokai.nix | 66 ----- 26 files changed, 1042 insertions(+), 465 deletions(-) delete mode 100644 common.nix delete mode 100644 kami.nix create mode 100644 lib/module/default.nix create mode 100644 modules/desktop/plasma/default.nix create mode 100644 modules/hardware/audio/default.nix create mode 100644 modules/hardware/printing/default.nix create mode 100644 modules/nix/default.nix create mode 100644 modules/system/boot/uboot/default.nix create mode 100644 modules/system/boot/uefi/default.nix create mode 100644 modules/system/fonts/default.nix create mode 100644 modules/system/locale/default.nix create mode 100644 modules/system/xdg/default.nix create mode 100644 modules/user/jopejoe1/default.nix rename home/jopejoe1.nix => modules/user/jopejoe1/home.nix (99%) create mode 100644 modules/user/root/default.nix rename home/root.nix => modules/user/root/home.nix (99%) delete mode 100644 oni.nix create mode 100644 systems/aarch64-linux/yokai/default.nix create mode 100644 systems/aarch64-linux/yokai/hardware.nix create mode 100644 systems/x86_64-linux/kami/default.nix create mode 100644 systems/x86_64-linux/kami/hardware.nix create mode 100644 systems/x86_64-linux/oni/default.nix create mode 100644 systems/x86_64-linux/oni/hardware.nix delete mode 100644 yokai.nix diff --git a/common.nix b/common.nix deleted file mode 100644 index 964b63a..0000000 --- a/common.nix +++ /dev/null @@ -1,176 +0,0 @@ -{ config, pkgs, lib, ... }: - -{ - # Configure networking - networking = { - networkmanager.enable = true; - firewall.enable = true; - }; - - qt = { - enable = true; - platformTheme = lib.mkForce "kde"; - }; - - virtualisation.waydroid.enable = true; - - nix.settings = { - substituters = [ - "https://cache.nixos.org/" - "https://nix-community.cachix.org" - "https://prismlauncher.cachix.org" - ]; - trusted-public-keys = [ - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - "prismlauncher.cachix.org-1:GhJfjdP1RFKtFSH3gXTIQCvZwsb2cioisOf91y/bK0w=" - ]; - trusted-users = [ "root" ]; - sandbox = true; - require-sigs = true; - max-jobs = "auto"; - auto-optimise-store = true; - allowed-users = [ "*" ]; - experimental-features = [ "nix-command" "flakes" ]; - }; - - # Enable services - services = { - # Configure X11 - xserver = { - enable = true; - displayManager = { - sddm = { - enable = true; - enableHidpi = true; - }; - lightdm.extraConfig = "user-authority-in-system-dir = true"; - }; - desktopManager = { - plasma5 = { - enable = true; - supportDDC = true; - useQtScaling = true; - }; - }; - }; - - # Enable CUPS to print documents. - printing = { - enable = true; - webInterface = true; - drivers = [ pkgs.hplipWithPlugin ]; - }; - - # Enable Network Printing and Scanning - avahi = { - enable = true; - nssmdns = true; - openFirewall = true; - }; - - # Enable pipewire - pipewire = { - enable = true; - media-session.enable = false; - wireplumber.enable = true; - audio.enable = true; - pulse.enable = true; - jack.enable = true; - alsa = { - enable = true; - support32Bit = true; - }; - }; - }; - - # Hardware configure - hardware = { - # Enable Scanning - sane = { - enable = true; - extraBackends = [ pkgs.sane-airscan pkgs.hplipWithPlugin ]; - }; - - # Disable pulseaudio - pulseaudio.enable = false; - }; - - # Enable ALSA - sound.enable = false; - - # Configure Users - users.users.jopejoe1 = { - isNormalUser = true; - description = "jopejoe1 🚫"; - initialPassword = "password"; - extraGroups = [ "wheel" "networkmanger" "scanner" "lp"]; - packages = with pkgs; [ - kate - carla - xdg-ninja - prismlauncher - nixpkgs-review - nurl - nix-init - ark - ]; - }; - - environment.systemPackages = with pkgs; [ - partition-manager - gparted - tela-icon-theme - dracula-theme - ]; - - programs = { - dconf.enable = true; - droidcam.enable = true; - sysdig.enable = true; - xwayland.enable = true; - }; - - #security.rtkit.enable = true; - - # Localization - i18n = { - defaultLocale = "en_NZ.UTF-8"; - extraLocaleSettings = { - LC_ADDRESS = "de_DE.UTF-8"; - LC_IDENTIFICATION = "de_DE.UTF-8"; - LC_MEASUREMENT = "de_DE.UTF-8"; - LC_MONETARY = "de_DE.UTF-8"; - LC_NAME = "de_DE.UTF-8"; - LC_NUMERIC = "de_DE.UTF-8"; - LC_PAPER = "de_DE.UTF-8"; - LC_TELEPHONE = "de_DE.UTF-8"; - LC_TIME = "de_DE.UTF-8"; - LC_CTYPE = "de_DE.UTF-8"; - LC_COLLATE = "de_DE.UTF-8"; - LC_MESSAGES = "en_NZ.UTF-8"; - }; - }; - - fonts.fontDir.enable = true; - - console = { - enable = true; - font = "Lat2-Terminus16"; - }; - - xdg = { - sounds.enable = true; - mime.enable = true; - menus.enable = true; - icons.enable = true; - autostart.enable = true; - portal = { - enable = true; - extraPortals = with pkgs; [ xdg-desktop-portal xdg-desktop-portal-gtk ]; - }; - }; - - # Do not change unless made sure evrything works with new version - system.stateVersion = "23.05"; -} diff --git a/flake.lock b/flake.lock index 0b77eb4..0e6f0f5 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,60 @@ { "nodes": { + "comma": { + "inputs": { + "flake-compat": [ + "flake-compat" + ], + "naersk": [ + "naersk" + ], + "nixpkgs": [ + "nixpkgs" + ], + "utils": [ + "flake-utils" + ] + }, + "locked": { + "lastModified": 1676319017, + "narHash": "sha256-gHyshpxoQAc/3sI3eChqmSCvsBimy+Z6EkzwA3aAYgA=", + "owner": "nix-community", + "repo": "comma", + "rev": "c4001264668c09d44d765e5ccb1182f291cd91a4", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "comma", + "type": "github" + } + }, + "deploy-rs": { + "inputs": { + "flake-compat": [ + "flake-compat" + ], + "nixpkgs": [ + "nixpkgs" + ], + "utils": [ + "flake-utils" + ] + }, + "locked": { + "lastModified": 1674127017, + "narHash": "sha256-QO1xF7stu5ZMDLbHN30LFolMAwY6TVlzYvQoUs1RD68=", + "owner": "serokell", + "repo": "deploy-rs", + "rev": "8c9ea9605eed20528bf60fae35a2b613b901fd77", + "type": "github" + }, + "original": { + "owner": "serokell", + "repo": "deploy-rs", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -31,6 +86,26 @@ "type": "github" } }, + "flake-utils-plus": { + "inputs": { + "flake-utils": [ + "flake-utils" + ] + }, + "locked": { + "lastModified": 1657226504, + "narHash": "sha256-GIYNjuq4mJlFgqKsZ+YrgzWm0IpA4axA3MCrdKYj7gs=", + "owner": "gytis-ivaskevicius", + "repo": "flake-utils-plus", + "rev": "2bf0f91643c2e5ae38c1b26893ac2927ac9bd82a", + "type": "github" + }, + "original": { + "owner": "gytis-ivaskevicius", + "repo": "flake-utils-plus", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -41,11 +116,11 @@ ] }, "locked": { - "lastModified": 1677013990, - "narHash": "sha256-HwAnE5MHsyLiRJp50KfDFPiiOZXI0Ts8hXpIh6yBilE=", + "lastModified": 1677104801, + "narHash": "sha256-2V5nKOYVFMYlseYdDKiEaww2xqcE0GtS1ax3SoUX99I=", "owner": "nix-community", "repo": "home-manager", - "rev": "564b82b3542026e7fb5d0da16c56ae3e40e5c9dd", + "rev": "4295fdfa6b0005c32f2e1f0b732faf5810c1bc7f", "type": "github" }, "original": { @@ -70,6 +145,24 @@ "type": "github" } }, + "naersk": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1671096816, + "narHash": "sha256-ezQCsNgmpUHdZANDCILm3RvtO1xH8uujk/+EqNvzIOg=", + "owner": "nix-community", + "repo": "naersk", + "rev": "d998160d6a076cfe8f9741e56aeec7e267e3e114", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "naersk", + "type": "github" + } + }, "nix-darwin": { "inputs": { "nixpkgs": [ @@ -103,11 +196,11 @@ ] }, "locked": { - "lastModified": 1677028621, - "narHash": "sha256-FemG3iPstPwz02j1tlt03XOtMQMnkd545fwFW67Yxb4=", + "lastModified": 1677137556, + "narHash": "sha256-LfgfbQIUpET69m1uOtATFciFriqSHBsxK50cYhyeXJA=", "owner": "nix-community", "repo": "nix-vscode-extensions", - "rev": "3b7b3c2d5672579df2a7a94f0bc2b85ecbce7a72", + "rev": "510cb7f147822f18d457b41a7228888662f1e241", "type": "github" }, "original": { @@ -116,6 +209,44 @@ "type": "github" } }, + "nixlib": { + "locked": { + "lastModified": 1676767889, + "narHash": "sha256-VjGXT6nZv8KrmrIUkAJr8MjDLJ/mRgWZqCC9mq5J6Gg=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "710d8816159a542ed0b1dcaf47748e2813af53f5", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixos-generators": { + "inputs": { + "nixlib": [ + "nixlib" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1676297861, + "narHash": "sha256-YECUmK34xzg0IERpnbCnaO6z6YgfecJlstMWX7dqOZ8=", + "owner": "nix-community", + "repo": "nixos-generators", + "rev": "1e0a05219f2a557d4622bc38f542abb360518795", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-generators", + "type": "github" + } + }, "nixos-hardware": { "locked": { "lastModified": 1676924492, @@ -133,11 +264,25 @@ }, "nixpkgs": { "locked": { - "lastModified": 1676973346, - "narHash": "sha256-rft8oGMocTAhUVqG3LW6I8K/Fo9ICGmNjRqaWTJwav0=", + "lastModified": 1677080879, + "narHash": "sha256-0SjW4/d3Rkw6C7hHZ5lxT4r6Pw9vzQb6Il6zYWwe2Bo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d0d55259081f0b97c828f38559cad899d351cad1", + "rev": "f5dad40450d272a1ea2413f4a67ac08760649e89", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1677063315, + "narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "988cc958c57ce4350ec248d2d53087777f9e1949", "type": "github" }, "original": { @@ -149,11 +294,11 @@ }, "nur": { "locked": { - "lastModified": 1677087980, - "narHash": "sha256-ILLukx8FztAg2dfFeOJADRf2B9DYkvsw4tcSr5kh9LI=", + "lastModified": 1677153098, + "narHash": "sha256-C5NsaJKeNe+Aa1REK6Ae1ywiybkKbtX92FP6OYZA0Lc=", "owner": "nix-community", "repo": "NUR", - "rev": "1eaba2b57f4a1fae970000ab4d74be12f5bdb432", + "rev": "12e6af8be38edb8358041e0ff3796919917c0d7b", "type": "github" }, "original": { @@ -190,16 +335,79 @@ }, "root": { "inputs": { + "comma": "comma", + "deploy-rs": "deploy-rs", "flake-compat": "flake-compat", "flake-utils": "flake-utils", + "flake-utils-plus": "flake-utils-plus", "home-manager": "home-manager", "libnbtplusplus": "libnbtplusplus", + "naersk": "naersk", "nix-darwin": "nix-darwin", "nix-vscode-extensions": "nix-vscode-extensions", + "nixlib": "nixlib", + "nixos-generators": "nixos-generators", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nur": "nur", - "prismlauncher": "prismlauncher" + "prismlauncher": "prismlauncher", + "snowfall-flake": "snowfall-flake", + "snowfall-lib": "snowfall-lib" + } + }, + "snowfall-flake": { + "inputs": { + "flake-compat": [ + "flake-compat" + ], + "nixpkgs": [ + "nixpkgs" + ], + "snowfall-lib": [ + "snowfall-lib" + ], + "unstable": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1676352981, + "narHash": "sha256-4Avwfq71dSpVYSuQwxe9b+jbBOSjdm4qVEZcfyGivts=", + "owner": "snowfallorg", + "repo": "flake", + "rev": "ca46f77b9e42224ede87634d2d4d4ef90281fe21", + "type": "github" + }, + "original": { + "owner": "snowfallorg", + "repo": "flake", + "type": "github" + } + }, + "snowfall-lib": { + "inputs": { + "flake-compat": [ + "flake-compat" + ], + "flake-utils-plus": [ + "flake-utils-plus" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1667153928, + "narHash": "sha256-SbXxxrxWzumig4ytez86B9FFkd9zH/qj+SSiMUwY8bI=", + "owner": "snowfallorg", + "repo": "lib", + "rev": "1ffe7109a0aade9df745432e1f5788cf67a05a3e", + "type": "github" + }, + "original": { + "owner": "snowfallorg", + "repo": "lib", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 95a3302..97452a3 100644 --- a/flake.nix +++ b/flake.nix @@ -1,109 +1,140 @@ { inputs = { + # nixpkgs (Packges and modules) nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable; + + # Nix Hardware (Hardware configs) nixos-hardware.url = github:NixOS/nixos-hardware; + + # NUR (User Packges) nur.url = github:nix-community/NUR; - flake-compat = { url = github:edolstra/flake-compat; flake = false; }; - libnbtplusplus = { url = github:PrismLauncher/libnbtplusplus; flake = false; }; - flake-utils.url = github:numtide/flake-utils; + + # Home Manger (Dot files) + home-manager = { + url = github:nix-community/home-manager; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.utils.follows = "flake-utils"; + }; + + # Nix Darwin (Mac OS support) + nix-darwin = { + url = github:LnL7/nix-darwin; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + # Image generators + nixos-generators = { + url = github:nix-community/nixos-generators; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.nixlib.follows = "nixlib"; + }; + + # PrismLauncher (git version of PrismLauncher) prismlauncher = { url = github:PrismLauncher/PrismLauncher; inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-compat.follows = "flake-compat"; inputs.libnbtplusplus.follows = "libnbtplusplus"; }; - home-manager = { - url = github:nix-community/home-manager; - inputs.nixpkgs.follows = "nixpkgs"; - inputs.utils.follows = "flake-utils"; - }; - nix-darwin = { - url = github:LnL7/nix-darwin; - inputs.nixpkgs.follows = "nixpkgs"; + libnbtplusplus = { + url = github:PrismLauncher/libnbtplusplus; + flake = false; }; + + # vscode extensions nix-vscode-extensions = { url = github:nix-community/nix-vscode-extensions; inputs.flake-compat.follows = "flake-compat"; inputs.flake-utils.follows = "flake-utils"; inputs.nixpkgs.follows = "nixpkgs"; }; + + snowfall-lib = { + url = github:snowfallorg/lib; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-compat.follows = "flake-compat"; + inputs.flake-utils-plus.follows = "flake-utils-plus"; + }; + + snowfall-flake = { + url = github:snowfallorg/flake; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.unstable.follows = "nixpkgs"; + inputs.flake-compat.follows = "flake-compat"; + inputs.snowfall-lib.follows = "snowfall-lib"; + }; + + comma = { + url = github:nix-community/comma; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-compat.follows = "flake-compat"; + inputs.utils.follows = "flake-utils"; + inputs.naersk.follows = "naersk"; + }; + + deploy-rs = { + url = github:serokell/deploy-rs; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-compat.follows = "flake-compat"; + inputs.utils.follows = "flake-utils"; + }; + + # Dependcies + flake-compat = { + url = github:edolstra/flake-compat; + flake = false; + }; + flake-utils.url = github:numtide/flake-utils; + nixlib.url = github:nix-community/nixpkgs.lib; + naersk.url = github:nix-community/naersk; + flake-utils-plus = { + url = github:gytis-ivaskevicius/flake-utils-plus; + inputs.flake-utils.follows = "flake-utils"; + }; + }; - outputs = { self, nixpkgs, nixos-hardware, prismlauncher, home-manager, nur, ... }@attrs: { - nixosConfigurations.yokai = nixpkgs.lib.nixosSystem { - system = "aarch64-linux"; - specialArgs = attrs; - modules = [ - ./yokai.nix - ./common.nix + + outputs = inputs: + let + lib = inputs.snowfall-lib.mkLib { + inherit inputs; + src = ./.; + }; + in + lib.mkFlake { + package-namespace = "custom"; + + channels-config.allowUnfree = true; + + overlays = with inputs; [ + nur.overlay + snowfall-flake.overlay + prismlauncher.overlay + ]; + + systems.modules = with inputs; [ + home-manager.nixosModules.home-manager + nur.nixosModules.nur + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + }; + system.stateVersion = "23.05"; + } + + ]; + + systems.hosts.yokai.modules = with inputs; [ nixos-hardware.nixosModules.pine64-pinebook-pro - home-manager.nixosModules.home-manager - nur.nixosModules.nur - { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - users.jopejoe1 = import ./home/jopejoe1.nix; - users.root = import ./home/root.nix; - }; - nixpkgs = { - config.allowUnfree = true; - overlays = [ - #prismlauncher.overlay - nur.overlay - ]; - }; - } ]; + + deploy = lib.mkDeploy { inherit (inputs) self; }; + + checks = + builtins.mapAttrs + (system: deploy-lib: + deploy-lib.deployChecks inputs.self.deploy) + inputs.deploy-rs.lib; }; - nixosConfigurations.oni = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = attrs; - modules = [ - ./oni.nix - ./common.nix - home-manager.nixosModules.home-manager - nur.nixosModules.nur - { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - users.jopejoe1 = import ./home/jopejoe1.nix; - users.root = import ./home/root.nix; - }; - nixpkgs = { - config.allowUnfree = true; - overlays = [ - prismlauncher.overlay - nur.overlay - ]; - }; - } - ]; - }; - nixosConfigurations.kami = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = attrs; - modules = [ - ./kami.nix - ./common.nix - home-manager.nixosModules.home-manager - nur.nixosModules.nur - { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - users.jopejoe1 = import ./home/jopejoe1.nix; - users.root = import ./home/root.nix; - }; - nixpkgs = { - config.allowUnfree = true; - overlays = [ - prismlauncher.overlay - nur.overlay - ]; - }; - } - ]; - }; - }; } diff --git a/kami.nix b/kami.nix deleted file mode 100644 index 7243a10..0000000 --- a/kami.nix +++ /dev/null @@ -1,62 +0,0 @@ -{ config, lib, pkgs, modulesPath, ... }: - -{ - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.loader.efi.efiSysMountPoint = "/boot/efi"; - - - boot.initrd.availableKernelModules = [ "vmd" "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" "sr_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - networking.hostName = "kami"; - time.timeZone = "Europe/Berlin"; - - services.xserver = { - layout = "de"; - xkbVariant = ""; - }; - - console.keyMap = "de"; - - services.xserver.videoDrivers = [ "nvidia" ]; - hardware.opengl.enable = true; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/99a47ace-7e69-4520-b914-d4fe5b31dc79"; - fsType = "btrfs"; - options = [ "subvol=@" ]; - }; - - fileSystems."/boot/efi" = - { device = "/dev/disk/by-uuid/1F26-8168"; - fsType = "vfat"; - }; - - fileSystems."/home" = - { device = "/dev/disk/by-uuid/78d6db21-b823-4ca4-b495-7782d3e56ddc"; - fsType = "ext4"; - }; - - swapDevices = [ ]; - - # 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.enp6s0.useDHCP = lib.mkDefault true; - # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.beta; - boot.kernelParams = [ "module_blacklist=i915" ]; -} diff --git a/lib/module/default.nix b/lib/module/default.nix new file mode 100644 index 0000000..705b039 --- /dev/null +++ b/lib/module/default.nix @@ -0,0 +1,16 @@ +{ lib, ... }: + +with lib; rec { + mkOpt = type: default: description: + mkOption { inherit type default description; }; + + mkOpt' = type: default: mkOpt type default null; + + mkBoolOpt = mkOpt types.bool; + + mkBoolOpt' = mkOpt' types.bool; + + enabled = { enable = true; }; + + disabled = { enable = false; }; +} diff --git a/modules/desktop/plasma/default.nix b/modules/desktop/plasma/default.nix new file mode 100644 index 0000000..047a28b --- /dev/null +++ b/modules/desktop/plasma/default.nix @@ -0,0 +1,36 @@ +{ options, config, lib, pkgs, ... }: + +with lib; +#with lib.internal; +let + cfg = config.custom.desktop.plasma; +in +{ + options.custom.desktop.plasma = with types; { + enable = mkBoolOpt false "Whether or not to use KDE plasma as the desktop environment."; + }; + + config = mkIf cfg.enable { + + services.xserver = { + enable = true; + + libinput.enable = true; + + displayManager.sddm = { + enable = true; + enableHidpi = true; + }; + desktopManager.plasma5 = { + enable = true; + useQtScaling = true; + supportDDC = true; + }; + }; + + programs.kdeconnect = { + enable = true; + package = pkgs.plasma5Packages.kdeconnect-kde; + }; + }; +} diff --git a/modules/hardware/audio/default.nix b/modules/hardware/audio/default.nix new file mode 100644 index 0000000..de06d61 --- /dev/null +++ b/modules/hardware/audio/default.nix @@ -0,0 +1,76 @@ +{ options, config, pkgs, lib, ... }: + +with lib; +#with lib.internal; +let cfg = config.custom.hardware.audio; +in +{ + options.custom.hardware.audio = with types; { + enable = mkBoolOpt false "Whether or not to enable audio support."; + alsa-monitor = mkOpt attrs { } "Alsa configuration."; + nodes = mkOpt (listOf attrs) [ ] + "Audio nodes to pass to Pipewire as `context.objects`."; + modules = mkOpt (listOf attrs) [ ] + "Audio modules to pass to Pipewire as `context.modules`."; + extra-packages = mkOpt (listOf package) [ + pkgs.qjackctl + pkgs.easyeffects + ] "Additional packages to install."; + }; + + config = mkIf cfg.enable { + security.rtkit.enable = true; + + services.pipewire = { + enable = true; + alsa = { + enable = true; + support32Bit = true; + }; + pulse.enable = true; + jack.enable = true; + + wireplumber.enable = false; + + media-session.enable = true; + media-session.config.alsa-monitor = + mkAliasDefinitions options.custom.hardware.audio.alsa-monitor; + + config.pipewire = { + "context.objects" = cfg.nodes ++ [ ]; + "context.modules" = [ + { + name = "libpipewire-module-rtkit"; + args = { }; + flags = [ "ifexists" "nofail" ]; + } + { name = "libpipewire-module-protocol-native"; } + { name = "libpipewire-module-profiler"; } + { name = "libpipewire-module-metadata"; } + { name = "libpipewire-module-spa-device-factory"; } + { name = "libpipewire-module-spa-node-factory"; } + { name = "libpipewire-module-client-node"; } + { name = "libpipewire-module-client-device"; } + { + name = "libpipewire-module-portal"; + flags = [ "ifexists" "nofail" ]; + } + { + name = "libpipewire-module-access"; + args = { }; + } + { name = "libpipewire-module-adapter"; } + { name = "libpipewire-module-link-factory"; } + { name = "libpipewire-module-session-manager"; } + ] ++ cfg.modules; + }; + }; + + hardware.pulseaudio.enable = mkForce false; + + environment.systemPackages = with pkgs; [ + pulsemixer + pavucontrol + ] ++ cfg.extra-packages; + }; +} diff --git a/modules/hardware/printing/default.nix b/modules/hardware/printing/default.nix new file mode 100644 index 0000000..42cdf46 --- /dev/null +++ b/modules/hardware/printing/default.nix @@ -0,0 +1,39 @@ +{ options, config, pkgs, lib, ... }: + +with lib; +#with lib.internal; +let cfg = config.custom.hardware.printing; +in +{ + options.custom.hardware.printing = with types; { + enable = mkBoolOpt false "Whether or not to enable printing and scaning"; + printers = mkOpt (listOf package) [ ] "Custom printing backend packages to install."; + }; + + config = mkIf cfg.enable { + + services.printing = { + enable = true; + webInterface = true; + drivers = with pkgs; [ + hplipWithPlugin + ] ++ cfg.printers; + }; + + hardware = { + sane = { + enable = true; + extraBackends = with pkgs; [ + sane-airscan + hplipWithPlugin + ] ++ cfg.printers; + }; + }; + + services.avahi = { + enable = true; + nssmdns = true; + openFirewall = true; + }; + }; +} diff --git a/modules/nix/default.nix b/modules/nix/default.nix new file mode 100644 index 0000000..a36158a --- /dev/null +++ b/modules/nix/default.nix @@ -0,0 +1,53 @@ +{ options, config, pkgs, lib, ... }: + +with lib; +#with lib.internal; +let cfg = config.custom.nix; +in +{ + options.custom.nix = with types; { + enable = mkBoolOpt true "Whether or not to manage nix configuration."; + package = mkOpt package pkgs.nix "Which nix package to use."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + deploy-rs + nixfmt + nix-index + nix-prefetch-git + nixpkgs-review + nurl + nix-init + ]; + + nix = { + package = cfg.package; + settings = { + substituters = [ + "https://cache.nixos.org/" + "https://nix-community.cachix.org" + "https://prismlauncher.cachix.org" + ]; + trusted-public-keys = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "prismlauncher.cachix.org-1:GhJfjdP1RFKtFSH3gXTIQCvZwsb2cioisOf91y/bK0w=" + ]; + trusted-users = [ "root" ]; + sandbox = true; + require-sigs = true; + max-jobs = "auto"; + auto-optimise-store = true; + allowed-users = [ "*" ]; + experimental-features = [ "nix-command" "flakes" ]; + warn-dirty = false; + }; + + # flake-utils-plus + generateRegistryFromInputs = true; + generateNixPathFromInputs = true; + linkInputs = true; + }; + }; +} diff --git a/modules/system/boot/uboot/default.nix b/modules/system/boot/uboot/default.nix new file mode 100644 index 0000000..126db25 --- /dev/null +++ b/modules/system/boot/uboot/default.nix @@ -0,0 +1,23 @@ +{ options, config, pkgs, lib, ... }: + +with lib; +#with lib.internal; +let cfg = config.custom.system.boot.uboot; +in +{ + options.custom.system.boot.uboot = with types; { + enable = mkBoolOpt false "Whether or not to enable booting on uboot system."; + }; + + config = mkIf cfg.enable { + boot = { + # Boot loader configutation + loader = { + # Use the extlinux boot loader. (NixOS wants to enable GRUB by default) + grub.enable = false; + # Enables the generation of /boot/extlinux/extlinux.conf + generic-extlinux-compatible.enable = true; + }; + }; + }; +} diff --git a/modules/system/boot/uefi/default.nix b/modules/system/boot/uefi/default.nix new file mode 100644 index 0000000..f0fc895 --- /dev/null +++ b/modules/system/boot/uefi/default.nix @@ -0,0 +1,22 @@ +{ options, config, pkgs, lib, ... }: + +with lib; +#with lib.internal; +let cfg = config.custom.system.boot.uefi; +in +{ + options.custom.system.boot.uefi = with types; { + enable = mkBoolOpt false "Whether or not to enable booting on a uefi system."; + }; + + config = mkIf cfg.enable { + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.efi.efiSysMountPoint = "/boot/efi"; + + boot.loader.systemd-boot.configurationLimit = 10; + + # https://github.com/NixOS/nixpkgs/blob/c32c39d6f3b1fe6514598fa40ad2cf9ce22c3fb7/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix#L66 + boot.loader.systemd-boot.editor = false; + }; +} diff --git a/modules/system/fonts/default.nix b/modules/system/fonts/default.nix new file mode 100644 index 0000000..b0b8a07 --- /dev/null +++ b/modules/system/fonts/default.nix @@ -0,0 +1,30 @@ +{ options, config, pkgs, lib, ... }: + +with lib; +#with lib.internal; +let cfg = config.custom.system.fonts; +in +{ + options.custom.system.fonts = with types; { + enable = mkBoolOpt false "Whether or not to manage fonts."; + fonts = mkOpt (listOf package) [ ] "Custom font packages to install."; + }; + + config = mkIf cfg.enable { + environment.variables = { + # Enable icons in tooling since we have nerdfonts. + LOG_ICONS = "true"; + }; + + fonts.fontDir.enable = true; + + fonts.fonts = with pkgs; + [ + noto-fonts + noto-fonts-cjk-sans + noto-fonts-cjk-serif + noto-fonts-emoji + (nerdfonts.override { fonts = [ "Hack" ]; }) + ] ++ cfg.fonts; + }; +} diff --git a/modules/system/locale/default.nix b/modules/system/locale/default.nix new file mode 100644 index 0000000..abc8eaa --- /dev/null +++ b/modules/system/locale/default.nix @@ -0,0 +1,40 @@ +{ options, config, pkgs, lib, ... }: + +with lib; +#with lib.internal; +let cfg = config.custom.system.locale; +in +{ + options.custom.system.locale = with types; { + enable = mkBoolOpt false "Whether or not to manage locale settings."; + layout = mkOpt str "de" "The Keyboard layout to use."; + }; + + config = mkIf cfg.enable { + i18n = { + defaultLocale = "en_NZ.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "de_DE.UTF-8"; + LC_IDENTIFICATION = "de_DE.UTF-8"; + LC_MEASUREMENT = "de_DE.UTF-8"; + LC_MONETARY = "de_DE.UTF-8"; + LC_NAME = "de_DE.UTF-8"; + LC_NUMERIC = "de_DE.UTF-8"; + LC_PAPER = "de_DE.UTF-8"; + LC_TELEPHONE = "de_DE.UTF-8"; + LC_TIME = "de_DE.UTF-8"; + LC_CTYPE = "de_DE.UTF-8"; + LC_COLLATE = "de_DE.UTF-8"; + LC_MESSAGES = "en_NZ.UTF-8"; + }; + }; + console = { + enable = true; + keyMap = mkForce cfg.layout; + }; + services.xserver = { + layout = cfg.layout; + }; + + }; +} diff --git a/modules/system/xdg/default.nix b/modules/system/xdg/default.nix new file mode 100644 index 0000000..97b78d1 --- /dev/null +++ b/modules/system/xdg/default.nix @@ -0,0 +1,25 @@ +{ options, config, pkgs, lib, ... }: + +with lib; +#with lib.internal; +let cfg = config.custom.system.xdg; +in +{ + options.custom.system.xdg = with types; { + enable = mkBoolOpt false "Whether or not to enable xdg."; + }; + + config = mkIf cfg.enable { + xdg = { + sounds.enable = true; + mime.enable = true; + menus.enable = true; + icons.enable = true; + autostart.enable = true; + portal = { + enable = true; + extraPortals = with pkgs; [ xdg-desktop-portal ]; + }; + }; + }; +} diff --git a/modules/user/jopejoe1/default.nix b/modules/user/jopejoe1/default.nix new file mode 100644 index 0000000..1374818 --- /dev/null +++ b/modules/user/jopejoe1/default.nix @@ -0,0 +1,31 @@ +{ options, config, pkgs, lib, ... }: + +with lib; +#with lib.internal; +let cfg = config.custom.user.jopejoe1; +in +{ + options.custom.user.jopejoe1 = with types; { + enable = mkBoolOpt false "Enable the user jopejoe1"; + }; + + config = mkIf cfg.enable { + users.users.jopejoe1 = { + isNormalUser = true; + description = "jopejoe1 🚫"; + initialPassword = "password"; + extraGroups = [ "wheel"] + ++ lib.optionals config.custom.hardware.printing.enable [ "scanner" "lp"] + ++ lib.optional config.networking.networkmanager.enable "networkmanger"; + packages = with pkgs; [ + kate + carla + xdg-ninja + prismlauncher + ark + ]; + }; + + home-manager.users.jopejoe1 = import ./home.nix; + }; +} diff --git a/home/jopejoe1.nix b/modules/user/jopejoe1/home.nix similarity index 99% rename from home/jopejoe1.nix rename to modules/user/jopejoe1/home.nix index ca847a7..c3eaad6 100644 --- a/home/jopejoe1.nix +++ b/modules/user/jopejoe1/home.nix @@ -5,7 +5,7 @@ # Basic information for home-manager username = "jopejoe1"; homeDirectory = "/home/${config.home.username}"; - + # Enviroment variables sessionVariables = { XCOMPOSECACHE = "${config.xdg.cacheHome}/X11/xcompos"; diff --git a/modules/user/root/default.nix b/modules/user/root/default.nix new file mode 100644 index 0000000..72562e8 --- /dev/null +++ b/modules/user/root/default.nix @@ -0,0 +1,16 @@ +{ options, config, pkgs, lib, ... }: + +with lib; +#with lib.internal; +let cfg = config.custom.user.root; +in +{ + options.custom.user.root = with types; { + enable = mkBoolOpt false "Enable the user root"; + }; + + config = mkIf cfg.enable { + + home-manager.users.root = import ./home.nix; + }; +} diff --git a/home/root.nix b/modules/user/root/home.nix similarity index 99% rename from home/root.nix rename to modules/user/root/home.nix index 99bea93..f37e1ff 100644 --- a/home/root.nix +++ b/modules/user/root/home.nix @@ -5,7 +5,7 @@ # Basic information for home-manager username = "root"; homeDirectory = "/${config.home.username}"; - + # Enviroment variables sessionVariables = { XCOMPOSECACHE = "${config.xdg.cacheHome}/X11/xcompos"; diff --git a/oni.nix b/oni.nix deleted file mode 100644 index ea85929..0000000 --- a/oni.nix +++ /dev/null @@ -1,59 +0,0 @@ -{ config, pkgs, lib, modulesPath, ... }: - -{ - boot = { - loader = { - systemd-boot.enable = true; - efi = { - canTouchEfiVariables = true; - efiSysMountPoint = "/boot/efi"; - }; - }; - initrd = { - availableKernelModules = [ "xhci_pci" "ahci" "ehci_pci" "usb_storage" "sd_mod" "sr_mod" ]; - kernelModules = [ ]; - }; - kernelPackages = pkgs.linuxKernel.packages.linux_zen; - kernelModules = [ "kvm-amd" ]; - extraModulePackages = [ ]; - }; - - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/c013c58e-540f-4547-b218-f7d34b07f7df"; - fsType = "ext4"; - }; - "/boot/efi" = { - device = "/dev/disk/by-uuid/F1C3-4668"; - fsType = "vfat"; - }; - }; - - swapDevices = [ { - device = "/dev/disk/by-uuid/8a721407-d8bc-4d2d-970a-7ff462107dc3"; - } ]; - - networking.hostName = "oni"; - - time.timeZone = "Europe/Berlin"; - - services.xserver = { - layout = "de"; - xkbVariant = ""; - }; - - console.keyMap = "de"; - - networking = { - useDHCP = lib.mkDefault true; - interfaces = { - enp2s0.useDHCP = lib.mkDefault true; - wlp3s0.useDHCP = lib.mkDefault true; - }; - }; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; -} diff --git a/systems/aarch64-linux/yokai/default.nix b/systems/aarch64-linux/yokai/default.nix new file mode 100644 index 0000000..aceb21e --- /dev/null +++ b/systems/aarch64-linux/yokai/default.nix @@ -0,0 +1,34 @@ +{ pkgs, config, lib, channel, ... }: + +with lib; +#with lib.internal; +{ + imports = [ ./hardware.nix ]; + + networking.networkmanager.enable = true; + + custom.system.boot.uboot.enable = true; + custom.system.xdg.enable = true; + custom.system.fonts.enable = true; + custom.system.locale.enable = true; + custom.system.locale.layout = "us"; + custom.nix.enable = true; + custom.hardware.audio.enable = true; + custom.hardware.printing.enable = true; + custom.desktop.plasma.enable = true; + + custom.user.jopejoe1.enable =true; + custom.user.root.enable =true; + + networking.hostName = "yokai"; + + time.timeZone = "Europe/Berlin"; + hardware.opengl.enable = true; + + programs = { + dconf.enable = true; + droidcam.enable = true; + xwayland.enable = true; + }; + +} diff --git a/systems/aarch64-linux/yokai/hardware.nix b/systems/aarch64-linux/yokai/hardware.nix new file mode 100644 index 0000000..25a871f --- /dev/null +++ b/systems/aarch64-linux/yokai/hardware.nix @@ -0,0 +1,54 @@ +{ config, lib, pkgs, modulesPath, inputs, ... }: + +{ + imports = with nixos-hardware.nixosModules; [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + hardware.nvidia.prime = { + offload.enable = false; + sync.enable = true; + + # Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA + intelBusId = "PCI:0:2:0"; + + # Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA + nvidiaBusId = "PCI:1:0:0"; + }; + + boot = { + kernelPackages = pkgs.linuxPackages_zen; + + initrd = { + # kernelModules = [ "amdgpu" ]; + availableKernelModules = [ "usbhid" ]; + }; + + extraModulePackages = [ ]; + }; + + fileSystems = { + "/" = { + device = "/dev/disk/by-label/NIXROOT"; + fsType = "ext4"; + }; + "/boot" = { + device = "/dev/disk/by-label/NIXBOOT"; + fsType = "vfat"; + }; + }; + + + swapDevices = [ ]; + + + # @NOTE(jakehamilton): NetworkManager will handle DHCP. + networking.interfaces.wlan0.useDHCP = false; + + hardware.enableRedistributableFirmware = true; + + # high-resolution display + hardware.video.hidpi.enable = lib.mkDefault true; + + hardware.bluetooth.enable = true; +} diff --git a/systems/x86_64-linux/kami/default.nix b/systems/x86_64-linux/kami/default.nix new file mode 100644 index 0000000..90d7d19 --- /dev/null +++ b/systems/x86_64-linux/kami/default.nix @@ -0,0 +1,38 @@ +{ pkgs, config, lib, channel, ... }: + +with lib; +#with lib.internal; +{ + imports = [ ./hardware.nix ]; + + networking.networkmanager.enable = true; + + custom.system.boot.uefi.enable = true; + custom.system.xdg.enable = true; + custom.system.fonts.enable = true; + custom.system.locale.enable = true; + custom.system.locale.layout = "de"; + custom.nix.enable = true; + custom.hardware.audio.enable = true; + custom.hardware.printing.enable = true; + custom.desktop.plasma.enable = true; + + custom.user.jopejoe1.enable =true; + custom.user.root.enable =true; + + networking.hostName = "kami"; + + time.timeZone = "Europe/Berlin"; + + hardware.opengl.enable = true; + hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.beta; + boot.kernelParams = [ "module_blacklist=i915" ]; + + programs = { + dconf.enable = true; + droidcam.enable = true; + sysdig.enable = true; + xwayland.enable = true; + }; + +} diff --git a/systems/x86_64-linux/kami/hardware.nix b/systems/x86_64-linux/kami/hardware.nix new file mode 100644 index 0000000..fa36ed9 --- /dev/null +++ b/systems/x86_64-linux/kami/hardware.nix @@ -0,0 +1,68 @@ +{ config, lib, pkgs, modulesPath, inputs, ... }: + +let + inherit (inputs) nixos-hardware; +in +{ + imports = with nixos-hardware.nixosModules; [ + (modulesPath + "/installer/scan/not-detected.nix") + common-cpu-intel + common-gpu-nvidia + common-pc + common-pc-ssd + ]; + + hardware.nvidia.prime = { + offload.enable = false; + sync.enable = true; + + # Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA + intelBusId = "PCI:0:2:0"; + + # Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA + nvidiaBusId = "PCI:1:0:0"; + }; + + boot = { + kernelPackages = pkgs.linuxPackages_zen; + + initrd = { + # kernelModules = [ "amdgpu" ]; + availableKernelModules = + [ "vmd" "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" "sr_mod" ]; + }; + + extraModulePackages = [ ]; + }; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/99a47ace-7e69-4520-b914-d4fe5b31dc79"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + fileSystems."/boot/efi" = + { device = "/dev/disk/by-uuid/1F26-8168"; + fsType = "vfat"; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/78d6db21-b823-4ca4-b495-7782d3e56ddc"; + fsType = "ext4"; + }; + + swapDevices = [ ]; + + # @NOTE(jakehamilton): NetworkManager will handle DHCP. + networking.interfaces.enp6s0.useDHCP = false; + networking.interfaces.wlo1.useDHCP = false; + + hardware.enableRedistributableFirmware = true; + + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + # high-resolution display + hardware.video.hidpi.enable = lib.mkDefault true; + + hardware.bluetooth.enable = true; +} diff --git a/systems/x86_64-linux/oni/default.nix b/systems/x86_64-linux/oni/default.nix new file mode 100644 index 0000000..e19833b --- /dev/null +++ b/systems/x86_64-linux/oni/default.nix @@ -0,0 +1,35 @@ +{ pkgs, config, lib, channel, ... }: + +with lib; +#with lib.internal; +{ + imports = [ ./hardware.nix ]; + + networking.networkmanager.enable = true; + + custom.system.boot.uefi.enable = true; + custom.system.xdg.enable = true; + custom.system.fonts.enable = true; + custom.system.locale.enable = true; + custom.system.locale.layout = "de"; + custom.nix.enable = true; + custom.hardware.audio.enable = true; + custom.hardware.printing.enable = true; + custom.desktop.plasma.enable = true; + + custom.user.jopejoe1.enable =true; + custom.user.root.enable =true; + + networking.hostName = "oni"; + + time.timeZone = "Europe/Berlin"; + hardware.opengl.enable = true; + + programs = { + dconf.enable = true; + droidcam.enable = true; + sysdig.enable = true; + xwayland.enable = true; + }; + +} diff --git a/systems/x86_64-linux/oni/hardware.nix b/systems/x86_64-linux/oni/hardware.nix new file mode 100644 index 0000000..dc1e0d0 --- /dev/null +++ b/systems/x86_64-linux/oni/hardware.nix @@ -0,0 +1,65 @@ +{ config, lib, pkgs, modulesPath, inputs, ... }: + +let + inherit (inputs) nixos-hardware; +in +{ + imports = with nixos-hardware.nixosModules; [ + (modulesPath + "/installer/scan/not-detected.nix") + common-cpu-amd + #common-gpu-nvidia + common-pc + #common-pc-ssd + ]; + + hardware.nvidia.prime = { + offload.enable = false; + sync.enable = false; + + # Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA + intelBusId = "PCI:0:2:0"; + + # Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA + nvidiaBusId = "PCI:1:0:0"; + }; + + boot = { + kernelPackages = pkgs.linuxPackages_zen; + + initrd = { + # kernelModules = [ "amdgpu" ]; + availableKernelModules = [ "xhci_pci" "ahci" "ehci_pci" "usb_storage" "sd_mod" "sr_mod" ]; + }; + + extraModulePackages = [ ]; + }; + + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/c013c58e-540f-4547-b218-f7d34b07f7df"; + fsType = "ext4"; + }; + "/boot/efi" = { + device = "/dev/disk/by-uuid/F1C3-4668"; + fsType = "vfat"; + }; + }; + + swapDevices = [ { + device = "/dev/disk/by-uuid/8a721407-d8bc-4d2d-970a-7ff462107dc3"; + } ]; + + + # @NOTE(jakehamilton): NetworkManager will handle DHCP. + networking.interfaces.enp2s0.useDHCP = false; + networking.interfaces.wlp3s0.useDHCP = false; + + hardware.enableRedistributableFirmware = true; + + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + # high-resolution display + hardware.video.hidpi.enable = lib.mkDefault true; + + hardware.bluetooth.enable = true; +} diff --git a/yokai.nix b/yokai.nix deleted file mode 100644 index bb5f0ac..0000000 --- a/yokai.nix +++ /dev/null @@ -1,66 +0,0 @@ -{ config, lib, pkgs, modulesPath, ... }: - -{ - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot = { - # Boot loader configutation - loader = { - # Use the extlinux boot loader. (NixOS wants to enable GRUB by default) - grub.enable = false; - # Enables the generation of /boot/extlinux/extlinux.conf - generic-extlinux-compatible.enable = true; - }; - - initrd = { - availableKernelModules = [ "usbhid" ]; - kernelModules = [ ]; - }; - - kernelModules = [ ]; - extraModulePackages = [ ]; - }; - - fileSystems = { - "/" = { - device = "/dev/disk/by-label/NIXROOT"; - fsType = "ext4"; - }; - "/boot" = { - device = "/dev/disk/by-label/NIXBOOT"; - fsType = "vfat"; - }; - }; - - swapDevices = [ ]; - nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; - powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; - - networking = { - hostName = "yokai"; - useDHCP = lib.mkDefault true; - interfaces.wlan0.useDHCP = lib.mkDefault true; - }; - - services = { - xserver = { - # Configure keymap in X11 - layout = "us"; - # services.xserver.xkbOptions = { - # "eurosign:e"; - # "caps:escape" # map caps to escape. - # }; - - # Enable touchpad support - libinput.enable = true; - }; - }; - - console = { - keyMap = "us"; - }; - - time.timeZone = "Europe/Berlin"; -}