add flake/home-manager and standard cli programs

This commit is contained in:
crurak 2023-08-02 21:37:21 +02:00
parent 1d385aa703
commit 7536cd5097
13 changed files with 307 additions and 0 deletions

49
flake.lock generated Normal file
View File

@ -0,0 +1,49 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1687871164,
"narHash": "sha256-bBFlPthuYX322xOlpJvkjUBz0C+MOBjZdDOOJJ+G2jU=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "07c347bb50994691d7b0095f45ebd8838cf6bc38",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-23.05",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1690927903,
"narHash": "sha256-D5gCaCROnjEKDOel//8TO/pOP87pAEtT0uT8X+0Bj/U=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "bd836ac5e5a7358dea73cb74a013ca32864ccb86",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

24
flake.nix Normal file
View File

@ -0,0 +1,24 @@
{
description = "NixOS configuration";
inputs = { # All flake references
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; # Default stable nix packages
# Home manager
home-manager = { # User package management
url = "github:nix-community/home-manager/release-23.05";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = attrs @ { self, nixpkgs, home-manager, ... }: {
nixosConfigurations = { # NixOS Configuration
merkur = nixpkgs.lib.nixosSystem { # Flake "merkur" (Notebook)
system = "x85_64-linux";
specialArgs = attrs; # Pass flake attrs to our config
modules = [ ./hosts/merkur.nix ];
};
};
};
}

14
home/bash.nix Normal file
View File

@ -0,0 +1,14 @@
{ config, lib, pkgs, ...}: let
inherit (lib) mkIf;
hasNeovim = config.programs.neovim.enable;
in {
programs.bash = {
enable = true;
shellAliases = {
ll = "ls -lisah --color=auto";
".." = "cd ..";
vim = mkIf hasNeovim "nvim";
vi = mkIf hasNeovim "nvim";
};
};
}

6
home/bat.nix Normal file
View File

@ -0,0 +1,6 @@
{
programs.bat = {
enable = true;
config.theme = "base16";
};
}

8
home/default.nix Normal file
View File

@ -0,0 +1,8 @@
{
home-manager.sharedModules = [
./bash.nix
./bat.nix
./git.nix
./neovim.nix
];
}

8
home/git.nix Normal file
View File

@ -0,0 +1,8 @@
{
programs.git = {
enable = true;
userName = "crurak";
userEmail = "s.spangenberg@posteo.de";
ignores = [ ".direnv" "result"];
};
}

23
home/neovim.nix Normal file
View File

@ -0,0 +1,23 @@
{ config, pkgs, ...}:
{
home.sessionVariables.Editor = "nvim";
programs = {
neovim = {
enable = true;
extraConfig = ''
syntax enable
colorscheme gruvbox
set number relativenumber
highlight Comment cterm=italic gui=italic
hi Normal guibg=NONE ctermbg=NONE
'';
plugins = with pkgs.vimPlugins; [
vim-nix
gruvbox
];
};
};
}

39
hosts/hardware/merkur.nix Normal file
View File

@ -0,0 +1,39 @@
# 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" "usb_storage" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/031ddff1-f0c3-484d-8d71-3d1a311b89ec";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/EB25-2F4D";
fsType = "vfat";
};
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.enp0s31f6.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

8
hosts/merkur.nix Normal file
View File

@ -0,0 +1,8 @@
{ home-manager, ... }: {
imports = [
home-manager.nixosModules.home-manager
./hardware/merkur.nix
../home
../modules
];
}

8
modules/boot.nix Normal file
View File

@ -0,0 +1,8 @@
{
boot.loader = {
systemd-boot = {
enable = true;
};
efi.canTouchEfiVariables = true;
};
}

96
modules/configuration.nix Normal file
View File

@ -0,0 +1,96 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
];
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/Berlin";
nix.settings = {
experimental-features = "nix-command flakes";
};
# Select internationalisation properties.
i18n.defaultLocale = "de_DE.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "de_DE.UTF-8";
LC_IDENTIFICATION = "de_DE.UTF-8";
LC_MEASUREMENT = "de_DE.UTF-8";
LC_MONETARY = "de_DE.UTF-8";
LC_NAME = "de_DE.UTF-8";
LC_NUMERIC = "de_DE.UTF-8";
LC_PAPER = "de_DE.UTF-8";
LC_TELEPHONE = "de_DE.UTF-8";
LC_TIME = "de_DE.UTF-8";
};
# Configure keymap in X11
services.xserver = {
layout = "de";
xkbVariant = "";
};
# Configure console keymap
console.keyMap = "de";
# Define a user account. Don't forget to set a password with passwd.
users.users.stefan = {
isNormalUser = true;
description = "stefan";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [];
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
git
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # Did you read the comment?
}

7
modules/default.nix Normal file
View File

@ -0,0 +1,7 @@
{
imports = [
./boot.nix
./configuration.nix
./home-manager.nix
];
}

17
modules/home-manager.nix Normal file
View File

@ -0,0 +1,17 @@
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
sharedModules = [{
home.stateVersion = "23.05";
}];
users = {
stefan = {
home.username = "stefan";
home.homeDirectory = "/home/stefan";
};
};
};
}