init
This commit is contained in:
42
profiles/luna/configuration.nix
Normal file
42
profiles/luna/configuration.nix
Normal file
@@ -0,0 +1,42 @@
|
||||
args@{ inputs, outputs, lib, pkgs, home-manager, self, username, useremail, hostname, sysversion, ... }: {
|
||||
|
||||
# You can import other NixOS modules here
|
||||
imports = [
|
||||
# If you want to use modules your own flake exports (from modules/nixos):
|
||||
# outputs.nixosModules.example
|
||||
|
||||
# Or modules from other flakes (such as nixos-hardware):
|
||||
# inputs.hardware.nixosModules.common-cpu-amd
|
||||
# inputs.hardware.nixosModules.common-ssd
|
||||
|
||||
# You can also split up your configuration and import pieces of it here:
|
||||
# ./users.nix
|
||||
|
||||
# Import your generated (nixos-generate-config) hardware configuration
|
||||
./network.nix
|
||||
./hardware-configuration.nix
|
||||
|
||||
"${self}/modules/nixos/core"
|
||||
"${self}/modules/nixos/user.nix"
|
||||
"${self}/modules/nixos/sysatomic.nix"
|
||||
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
# home-manager.useGlobalPkgs = true;
|
||||
# home-manager.useUserPackages = true;
|
||||
home-manager = {
|
||||
extraSpecialArgs = {
|
||||
inherit inputs outputs hostname username useremail sysversion;
|
||||
};
|
||||
users."${username}" = { ... }: {
|
||||
imports = [
|
||||
"${self}/home/desktop.nix"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
|
||||
system.stateVersion = sysversion;
|
||||
}
|
||||
14
profiles/luna/default.nix
Normal file
14
profiles/luna/default.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
args@{ libs, inputs, ... }:
|
||||
let
|
||||
# 这里可以选择使用稳定版或不稳定版的nixpkgs
|
||||
# nixpkgs = inputs.nixpkgs;
|
||||
nixpkgs = inputs.nixpkgs-unstable; # 如果需要使用unstable版本,取消这行注释并注释上一行
|
||||
home-manager = inputs.home-manager-unstable;
|
||||
sysArgs = args // { inherit home-manager; };
|
||||
in
|
||||
# 使用libs.mkNixosSystem创建nixosSystem
|
||||
libs.mkNixosSystem {
|
||||
inherit nixpkgs;
|
||||
args = sysArgs;
|
||||
path = ./.;
|
||||
}
|
||||
58
profiles/luna/hardware-configuration.nix
Normal file
58
profiles/luna/hardware-configuration.nix
Normal file
@@ -0,0 +1,58 @@
|
||||
# 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" "nvme" "usb_storage" "usbhid" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ "dm-snapshot" ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/9d79b1dc-da5a-456c-a691-9bda5aebcea3";
|
||||
fsType = "btrfs";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/FE53-DFFA";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0022" "dmask=0022" ];
|
||||
};
|
||||
|
||||
fileSystems."/nix" =
|
||||
{ device = "/dev/disk/by-uuid/9d79b1dc-da5a-456c-a691-9bda5aebcea3";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=nix" ];
|
||||
};
|
||||
|
||||
fileSystems."/swap" =
|
||||
{ device = "/dev/disk/by-uuid/9d79b1dc-da5a-456c-a691-9bda5aebcea3";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=swap" ];
|
||||
};
|
||||
|
||||
fileSystems."/home" =
|
||||
{ device = "/dev/disk/by-uuid/9d79b1dc-da5a-456c-a691-9bda5aebcea3";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=home" ];
|
||||
};
|
||||
|
||||
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.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.enp2s0.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
30
profiles/luna/network.nix
Normal file
30
profiles/luna/network.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
# 网络配置
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
networking = {
|
||||
wireless.enable = false; # Enables wireless support via wpa_supplicant.
|
||||
|
||||
# Configure network proxy if necessary
|
||||
# proxy.default = "http://user:password@proxy:port/";
|
||||
# proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
||||
|
||||
networkmanager.enable = true;
|
||||
|
||||
enableIPv6 = false; # disable ipv6
|
||||
interfaces.enp0s3 = {
|
||||
useDHCP = false;
|
||||
ipv4.addresses = [
|
||||
{
|
||||
address = "10.7.45.130";
|
||||
prefixLength = 24;
|
||||
}
|
||||
];
|
||||
};
|
||||
defaultGateway = "10.7.45.1";
|
||||
nameservers = [
|
||||
"119.29.29.29" # DNSPod
|
||||
"223.5.5.5" # AliDNS
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user