From 039282ba9412668436f766e0e1f001e173dcf3b2 Mon Sep 17 00:00:00 2001 From: moons-14 Date: Thu, 28 May 2026 12:54:12 +0900 Subject: [PATCH] feat: add nix-example host and base profile --- .gitignore | 1 + hosts/default.nix | 9 ++-- hosts/nix-example/default.nix | 6 +++ hosts/nix-example/hardware-configuration.nix | 43 ++++++++++++++++++++ profiles/base.nix | 1 + 5 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 hosts/nix-example/default.nix create mode 100644 hosts/nix-example/hardware-configuration.nix create mode 100644 profiles/base.nix diff --git a/.gitignore b/.gitignore index a9f0508..06b6a15 100644 --- a/.gitignore +++ b/.gitignore @@ -13,5 +13,6 @@ !shells/ !hosts/ !overlays/ +!profiles/ !/flake/ diff --git a/hosts/default.nix b/hosts/default.nix index f2bcbc0..83fe160 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -11,17 +11,16 @@ let { host, system, + profile ? null, extraModules ? [ ], - ... }: assert lib.assertMsg (lib.elem system config.systems) "mkSystem: system '${system}' not in valid systems: ${lib.generators.toPretty { } config.systems}"; nixosSystem { inherit system; modules = [ - { - networking.hostName = lib.mkDefault host; - } + ../profiles/${profile}.nix + ../hosts/${host}/default.nix ] ++ extraModules; specialArgs = { inherit inputs; }; @@ -32,7 +31,7 @@ in nix-example = mkSystem { host = "nix-example"; system = "x86_64-linux"; - profile = "laptop"; + profile = "base"; extraModules = [ ]; }; }; diff --git a/hosts/nix-example/default.nix b/hosts/nix-example/default.nix new file mode 100644 index 0000000..2db9801 --- /dev/null +++ b/hosts/nix-example/default.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + imports = [ + ./hardware-configuration.nix + ]; +} diff --git a/hosts/nix-example/hardware-configuration.nix b/hosts/nix-example/hardware-configuration.nix new file mode 100644 index 0000000..9eab558 --- /dev/null +++ b/hosts/nix-example/hardware-configuration.nix @@ -0,0 +1,43 @@ +# 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. +{ + lib, + modulesPath, + ... +}: +{ + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ + "ata_piix" + "uhci_hcd" + "virtio_pci" + "virtio_scsi" + "sd_mod" + "sr_mod" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/8f0eaec6-5dc9-4821-aa8d-fb6809b5a5bf"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/201C-961B"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" + ]; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/profiles/base.nix b/profiles/base.nix new file mode 100644 index 0000000..958608a --- /dev/null +++ b/profiles/base.nix @@ -0,0 +1 @@ +_: { }