···11-# This is your system's configuration file.
22-# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
33-44-{ inputs, outputs, lib, config, pkgs, ... }: {
55- # You can import other NixOS modules here
66- imports = [
77- # If you want to use modules your own flake exports (from modules/nixos):
88- # outputs.nixosModules.example
99-1010- # Or modules from other flakes (such as nixos-hardware):
1111- # inputs.hardware.nixosModules.common-cpu-amd
1212- # inputs.hardware.nixosModules.common-ssd
1313-1414- # You can also split up your configuration and import pieces of it here:
1515- # ./users.nix
1616-1717- # Import your generated (nixos-generate-config) hardware configuration
1818- ./hardware-configuration.nix
1919- ];
2020-2121- nixpkgs = {
2222- # You can add overlays here
2323- overlays = [
2424- # If you want to use overlays your own flake exports (from overlays dir):
2525- # outputs.overlays.modifications
2626- # outputs.overlays.additions
2727-2828- # Or overlays exported from other flakes:
2929- # neovim-nightly-overlay.overlays.default
3030-3131- # Or define it inline, for example:
3232- # (final: prev: {
3333- # hi = final.hello.overrideAttrs (oldAttrs: {
3434- # patches = [ ./change-hello-to-hi.patch ];
3535- # });
3636- # })
3737- ];
3838- # Configure your nixpkgs instance
3939- config = {
4040- # Disable if you don't want unfree packages
4141- allowUnfree = true;
4242- };
4343- };
4444-4545- nix = {
4646- # This will add each flake input as a registry
4747- # To make nix3 commands consistent with your flake
4848- registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
4949-5050- # This will additionally add your inputs to the system's legacy channels
5151- # Making legacy nix commands consistent as well, awesome!
5252- nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry;
5353-5454- settings = {
5555- # Enable flakes and new 'nix' command
5656- experimental-features = "nix-command flakes";
5757- # Deduplicate and optimize nix store
5858- auto-optimise-store = true;
5959- };
6060- };
6161-6262- # FIXME: Add the rest of your current configuration
6363-6464- # TODO: Set your hostname
6565- networking.hostName = "your-hostname";
6666-6767- # TODO: This is just an example, be sure to use whatever bootloader you prefer
6868- boot.loader.systemd-boot.enable = true;
6969-7070- # TODO: Configure your system-wide user settings (groups, etc), add more users as needed.
7171- users.users = {
7272- # FIXME: Replace with your username
7373- your-username = {
7474- # TODO: You can set an initial password for your user.
7575- # If you do, you can skip setting a root password by passing '--no-root-passwd' to nixos-install.
7676- # Be sure to change it (using passwd) after rebooting!
7777- initialPassword = "correcthorsebatterystaple";
7878- isNormalUser = true;
7979- openssh.authorizedKeys.keys = [
8080- # TODO: Add your SSH public key(s) here, if you plan on using SSH to connect
8181- ];
8282- # TODO: Be sure to add any other groups you need (such as networkmanager, audio, docker, etc)
8383- extraGroups = [ "wheel" ];
8484- };
8585- };
8686-8787- # This setups a SSH server. Very important if you're setting up a headless system.
8888- # Feel free to remove if you don't need it.
8989- services.openssh = {
9090- enable = true;
9191- # Forbid root login through SSH.
9292- permitRootLogin = "no";
9393- # Use keys only. Remove if you want to SSH using password (not recommended)
9494- passwordAuthentication = false;
9595- };
9696-9797- # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
9898- system.stateVersion = "22.11";
9999-}
-10
nixos/hardware-configuration.nix
···11-# This is just an example, you should generate yours with nixos-generate-config and put it in here.
22-{
33- fileSystems."/" = {
44- device = "/dev/sda1";
55- fsType = "ext4";
66- };
77-88- # Set your system kind (needed for flakes)
99- nixpkgs.hostPlatform = "x86_64-linux";
1010-}