initial config

This commit is contained in:
Mans Ziesel 2023-06-06 17:01:28 +02:00
commit 6c27bcc930
7 changed files with 361 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
nixos/hardware-configuration.nix

65
flake.lock Normal file
View File

@ -0,0 +1,65 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"utils": "utils"
},
"locked": {
"lastModified": 1681092193,
"narHash": "sha256-JerCqqOqbT2tBnXQW4EqwFl0hHnuZp21rIQ6lu/N4rI=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "f9edbedaf015013eb35f8caacbe0c9666bbc16af",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-22.11",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1684398685,
"narHash": "sha256-TRE62m91iZ5ArVMgA+uj22Yda8JoQuuhc9uwZ+NoX+0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "628d4bb6e9f4f0c30cfd9b23d3c1cdcec9d3cb5c",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-22.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
},
"utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

44
flake.nix Normal file
View File

@ -0,0 +1,44 @@
{
description = "Your new nix config";
inputs = {
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
# Home manager
home-manager.url = "github:nix-community/home-manager/release-22.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# TODO_: Add any other flake you might need
hardware.url = "github:nixos/nixos-hardware";
# Shameless plug: looking for a way to nixify your themes and make
# everything match nicely? Try nix-colors!
# nix-colors.url = "github:misterio77/nix-colors";
};
outputs = { nixpkgs, home-manager, ... }@inputs: {
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
# FIXME_ replace with your hostname
your-hostname = "nixos-mans" {
specialArgs = { inherit inputs; }; # Pass flake inputs to our config
# > Our main nixos configuration file <
modules = [ ./nixos/configuration.nix ];
};
};
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname'
# homeConfigurations = {
# # FIXME_ replace with your username@hostname
# "mans@nixos-mans" = home-manager.lib.homeManagerConfiguration {
# pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
# extraSpecialArgs = { inherit inputs; }; # Pass flake inputs to our config
# # > Our main home-manager configuration file <
# modules = [ ./home-manager/home.nix ];
# };
# };
};
}

55
home-manager/home.nix Normal file
View File

@ -0,0 +1,55 @@
# This is your home-manager configuration file
# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix)
{ inputs, lib, config, pkgs, ... }: {
# You can import other home-manager modules here
imports = [
# If you want to use home-manager modules from other flakes (such as nix-colors):
# inputs.nix-colors.homeManagerModule
# You can also split up your configuration and import pieces of it here:
# ./nvim.nix
];
nixpkgs = {
# You can add overlays here
overlays = [
# If you want to use overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
# Or define it inline, for example:
# (final: prev: {
# hi = final.hello.overrideAttrs (oldAttrs: {
# patches = [ ./change-hello-to-hi.patch ];
# });
# })
];
# Configure your nixpkgs instance
config = {
# Disable if you don't want unfree packages
allowUnfree = true;
# Workaround for https://github.com/nix-community/home-manager/issues/2942
allowUnfreePredicate = (_: true);
};
};
# TODO_: Set your username
home = {
username = "mans";
homeDirectory = "/home/mans";
};
# Add stuff for your user as you see fit:
programs.neovim.enable = true;
# home.packages = with pkgs; [ steam ];
# Enable home-manager and git
programs.home-manager.enable = true;
programs.git.enable = true;
# Nicely reload system units when changing configs
systemd.user.startServices = "sd-switch";
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
home.stateVersion = "23.05";
}

152
nixos/configuration.nix Normal file
View File

@ -0,0 +1,152 @@
# This is your system's configuration file.
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
# https://github.com/Misterio77/nix-starter-configs
{ inputs, lib, config, pkgs, ... }: {
# You can import other NixOS modules here
imports = [
# If you want to use modules from other flakes (such as nixos-hardware):
inputs.hardware.nixosModules.common-cpu-amd
inputs.hardware.nixosModules.common-ssd
inputs.hardware.nixosModules.common-gpu-nvidia
# You can also split up your configuration and import pieces of it here:
# ./users.nix
./network.nix
./i3.nix
# Import home-manager's NixOS module
inputs.home-manager.nixosModules.home-manager
# Import your generated (nixos-generate-config) hardware configuration
./hardware-configuration.nix
];
nixpkgs = {
# You can add overlays here
overlays = [
# If you want to use overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
# Or define it inline, for example:
# (final: prev: {
# hi = final.hello.overrideAttrs (oldAttrs: {
# patches = [ ./change-hello-to-hi.patch ];
# });
# })
];
# Configure your nixpkgs instance
config = {
# Disable if you don't want unfree packages
allowUnfree = true;
};
};
nix = {
# This will add each flake input as a registry
# To make nix3 commands consistent with your flake
registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
# This will additionally add your inputs to the system's legacy channels
# Making legacy nix commands consistent as well, awesome!
nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry;
settings = {
# Enable flakes and new 'nix' command
experimental-features = "nix-command flakes";
# Deduplicate and optimize nix store
auto-optimise-store = true;
};
};
# TODO_: This is just an example, be sure to use whatever bootloader you prefer
boot.loader.systemd-boot = {
enable = true;
efi.canTouchEfiVariables = true;
};
# Setup keyfile
boot.initrd.secrets = {
"/crypto_keyfile.bin" = null;
};
# FIXME_: Add the rest of your current configuration
# Set your time zone.
time.timeZone = "Europe/Amsterdam";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "nl_NL.UTF-8";
LC_IDENTIFICATION = "nl_NL.UTF-8";
LC_MEASUREMENT = "nl_NL.UTF-8";
LC_MONETARY = "nl_NL.UTF-8";
LC_NAME = "nl_NL.UTF-8";
LC_NUMERIC = "nl_NL.UTF-8";
LC_PAPER = "nl_NL.UTF-8";
LC_TELEPHONE = "nl_NL.UTF-8";
LC_TIME = "nl_NL.UTF-8";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# TODO_: Configure your system-wide user settings (groups, etc), add more users as needed.
users.users = {
# FIXME_: Replace with your username
mans = {
# TODO_: You can set an initial password for your user.
# If you do, you can skip setting a root password by passing '--no-root-passwd' to nixos-install.
# Be sure to change it (using passwd) after rebooting!
isNormalUser = true;
openssh.authorizedKeys.keys = [
# TODO: Add your SSH public key(s) here, if you plan on using SSH to connect
];
# TODO_: Be sure to add any other groups you need (such as networkmanager, audio, docker, etc)
extraGroups = [ "wheel" "networkmanager" ];
};
};
# This setups a SSH server. Very important if you're setting up a headless system.
# Feel free to remove if you don't need it.
services.openssh = {
enable = true;
# Forbid root login through SSH.
permitRootLogin = "yes";
# Use keys only. Remove if you want to SSH using password (not recommended)
passwordAuthentication = false;
};
home-manager = {
extraSpecialArgs = { inherit inputs; };
users = {
# Import your home-manager configuration
mans = import ../home-manager;
};
};
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
system.stateVersion = "23.05";
}

23
nixos/i3.nix Normal file
View File

@ -0,0 +1,23 @@
{ config, lib, pkgs, ... }:
{
# Define the i3 window manager configuration
services.xserver.windowManager.i3 = {
enable = true;
extraPackages = with pkgs; [ i3status dmenu ];
config = ''
# i3 configuration options go here
# For example:
# set $mod Mod4
# exec_always --no-startup-id feh --bg-fill /path/to/wallpaper.jpg
'';
};
# Set the default session to i3
services.xserver = {
displayManager.session = "none";
windowManager.default = "i3";
layout = "us";
xkbVariant = "";
};
}

21
nixos/network.nix Normal file
View File

@ -0,0 +1,21 @@
# networking.nix
# Import the necessary modules
{ config, pkgs, ... }:
{
# Set the network interface configuration
# networking.interfaces.eth0.useDHCP = true;
networking.networkmanager.enable = true;
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [ 22 ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Set the hostname
networking.hostName = "nixos-mans";
}