diff --git a/.gitignore b/.gitignore index 3ff237f..e69de29 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +0,0 @@ -hosts/hakase/hardware-configuration.nix diff --git a/flake.nix b/flake.nix index 4579153..9381932 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,6 @@ { description = "A rewrite of the original Sakamoto NixOS config."; + inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; @@ -18,6 +19,7 @@ url = "github:lnl7/nix-darwin"; inputs.nixpkgs.follows = "nixpkgs"; }; + nixovim = { url = "git+https://git.sakamoto.dev/kenji/nixovim.git"; inputs.nixpkgs.follows = "nixpkgs"; @@ -32,47 +34,54 @@ darwin, ... } @ inputs: let - # Define common arguments or functions here if needed config = import ./config.nix; - # A helper function to create arguments for modules + mkArgs = system: { inherit inputs system; } // config; + + systems = ["x86_64-linux" "aarch64-linux"]; in - flake-utils.lib.eachDefaultSystem ( - system: let - lib = nixpkgs.lib; - pkgs = nixpkgs.legacyPackages.${system}; - args = mkArgs system; # Use the helper for common args - in { - nixosConfigurations = { - hakase = lib.nixosSystem { - inherit system; - specialArgs = args; - modules = [./hosts/hakase/configuration.nix]; # Add your NixOS modules here - }; - }; - homeConfigurations = { - # Assuming you want home-manager configurations for all default systems - hakase = home-manager.lib.homeManagerConfiguration { - pkgs = import nixpkgs { - inherit system; - extraSpecialArgs = args; - }; - modules = [ - ./home/hakase.nix - ]; # Add your Home Manager modules here - }; - }; - } - ) + flake-utils.lib.eachSystem systems (system: let + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + }; + args = mkArgs system; + in { + # This is optional if you want per-system packages or apps + packages.default = pkgs.hello; + }) // { + nixosConfigurations = { + hakase = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = mkArgs "x86_64-linux"; + modules = [ + ./hosts/hakase/configuration.nix + ]; + }; + }; + + homeConfigurations = { + hakase = home-manager.lib.homeManagerConfiguration { + pkgs = import nixpkgs { + system = "x86_64-linux"; + config.allowUnfree = true; + extraSpecialArgs = mkArgs "x86_64-linux"; + }; + modules = [ + ./home/hakase.nix + ]; + }; + }; + darwinConfigurations = { macos = darwin.lib.darwinSystem { system = "aarch64-darwin"; - specialArgs = (mkArgs "aarch64-darwin") // {inherit mkArgs;}; + specialArgs = mkArgs "aarch64-darwin"; modules = [ ./hosts/macos/darwin.nix ]; diff --git a/hosts/hakase/hardware-configuration.nix b/hosts/hakase/hardware-configuration.nix new file mode 100644 index 0000000..40341fe --- /dev/null +++ b/hosts/hakase/hardware-configuration.nix @@ -0,0 +1,53 @@ +# 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 = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/532ac73e-1370-4e4d-9d5a-15033de0b96d"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + fileSystems."/nix/store" = + { device = "/@/nix/store"; + fsType = "none"; + options = [ "bind" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/1368-D3F3"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/780aa81f-c4d6-478b-9c51-2d60362fdb07"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/b02ef55c-4caf-4a24-a6a2-fb8001eafe22"; } + ]; + + # 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.enp11s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp10s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}