added flake

nixos
Moritz Böhme 2021-09-08 19:43:08 +02:00
parent 1f9e9ba952
commit a535553cbe
5 changed files with 474 additions and 0 deletions

100
flake.lock Normal file
View File

@ -0,0 +1,100 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1629481132,
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "997f7efcb746a9c140ce1f13c72263189225f482",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1631051269,
"narHash": "sha256-ZL5TgMYPpRUWN/GGdJ7gIiYjxaWI+EP8HdFT1GZ+wd0=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "275f39611dc32243842d5818141278b5676653f2",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1631117094,
"narHash": "sha256-FMdGgsJq1wGmMo98KjyUPN5ofqxuEru4ZmAn80LXa/8=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "b5c0ce5bef110c66d4cff87289c1b462ea7031ec",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "release-21.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"unstable": "unstable",
"utils": "utils"
}
},
"unstable": {
"locked": {
"lastModified": 1631015389,
"narHash": "sha256-9SKTwRbp7OQGa4wKTo1wB6ctC2VlaIeKFZ+flqzPuoI=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "bc06c93905f60a82d6ebbb78f78cf289257860cc",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"utils": {
"inputs": {
"flake-utils": "flake-utils"
},
"locked": {
"lastModified": 1631019843,
"narHash": "sha256-DUcnmOHK35JGfseRT/hhf5jSaN0+pSi9zoI9vLstlZk=",
"owner": "gytis-ivaskevicius",
"repo": "flake-utils-plus",
"rev": "8cd9fd963f7ff2fa5c11177cd9d8f9199b60e54b",
"type": "github"
},
"original": {
"owner": "gytis-ivaskevicius",
"ref": "release-1.2.0-without-deprecated-code",
"repo": "flake-utils-plus",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

34
flake.nix Normal file
View File

@ -0,0 +1,34 @@
{
description = "My awesome system config";
inputs = {
nixpkgs.url = github:nixos/nixpkgs/release-21.05;
unstable.url = github:nixos/nixpkgs/nixos-unstable;
utils.url = github:gytis-ivaskevicius/flake-utils-plus/release-1.2.0-without-deprecated-code;
home-manager = {
url = github:nix-community/home-manager;
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ self, utils, home-manager, ...}: {
utils.lib.mkFlake = {
inherit self inputs;
# Channel definitions.
# Channels are automatically generated from nixpkgs inputs
# e.g the inputs which contain `legacyPackages` attribute are used.
channelsConfig.allowUnfree = true;
hostDefaults.modules = [
home-manager.nixos.Modules.home-manager
./modules
];
hosts.nixos-laptop.modules = [
./hosts/nixos-laptop
];
};
};
}

View File

@ -0,0 +1,109 @@
# 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.
./hardware-configuration.nix
];
nix.package = pkgs.nixFlakes;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
# BOOT
boot = {
supportedFilesystems = [ "btrfs" ];
loader = {
grub = {
enable = true;
version = 2;
device = "nodev";
efiSupport = true;
};
efi.canTouchEfiVariables = true;
};
kernelPackages = pkgs.linuxPackages_zen;
};
# NETWORKING
networking = {
hostName = "nixos-laptop";
networkmanager.enable = true;
useDHCP = false;
interfaces.wlp1s0.useDHCP = true;
};
# LOCALS
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "firacode-14";
keyMap = "de";
};
time.timeZone = "Europe/Berlin";
# SERVICES
services = {
xserver = {
enable = true;
layout = "de";
displayManager = {
defaultSession = "none+bspwm";
autoLogin = {
enable = true;
user = "moritz";
};
lightdm = {
enable = true;
};
};
libinput.enable = true;
windowManager.bspwm.enable = true;
};
printing.enable = true;
};
# Enable sound.
services.pipewire.enable = true;
# Powersaving
services.tlp.enable = true;
# USERS
users.users.moritz = {
shell = pkgs.zsh;
isNormalUser = true;
home = "/home/moritz";
extraGroups = [ "wheel" "networkmanager" "video" ]; # Enable sudo for the user.
};
fonts.fonts = with pkgs; [
(nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" "JetBrainsMono"];})
];
# PACKAGES
environment.systemPackages = with pkgs; [
vim
wget
firefox
];
# 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 = "21.05"; # Did you read the comment?
}

View 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 = [ "nvme" "xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/4a91d3eb-1633-42d9-8304-c10e49a61154";
fsType = "btrfs";
options = [ "subvol=root" ];
};
boot.initrd.luks.devices."enc".device = "/dev/disk/by-uuid/078b81ba-238e-471d-9951-b743588532b8";
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/4a91d3eb-1633-42d9-8304-c10e49a61154";
fsType = "btrfs";
options = [ "subvol=home" ];
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/4a91d3eb-1633-42d9-8304-c10e49a61154";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/persist" =
{ device = "/dev/disk/by-uuid/4a91d3eb-1633-42d9-8304-c10e49a61154";
fsType = "btrfs";
options = [ "subvol=persist" ];
};
fileSystems."/log" =
{ device = "/dev/disk/by-uuid/4a91d3eb-1633-42d9-8304-c10e49a61154";
fsType = "btrfs";
options = [ "subvol=log" ];
neededForBoot = true;
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/938D-F813";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/29ebf65f-e6ca-4625-9f72-a9321152be1b"; }
];
}

173
modules/default.nix Normal file
View File

@ -0,0 +1,173 @@
{ config, pkgs, ... }:
{
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# paths it should manage.
home.username = "moritz";
home.homeDirectory = "/home/moritz";
programs = {
git = {
enable = true;
userName = "MoritzBoehme";
userEmail = "mr.x@moritzboeh.me";
};
zathura = {
enable = true;
options = {
recolor = true;
completion-bg = "#282a36";
completion-fg = "#ff79c6";
default-bg = "#44475a";
default-fg = "#bd93f9";
inputbar-bg = "#282a36";
inputbar-fg = "#8be9fd";
statusbar-bg = "#282a36";
statusbar-fg = "#bd93f9";
font = "Jetbrains Mono 9";
recolor-lightcolor = "#282a36";
recolor-darkcolor = "#f8f8f2";
};
};
zsh = {
enable = true;
shellGlobalAliases = {
ls = "exa -lh";
cat = "bat";
};
plugins = [
{
name = "zsh-autosuggestions";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-autosuggestions";
rev = "v0.4.0";
sha256 = "0z6i9wjjklb4lvr7zjhbphibsyx51psv50gm07mbb0kj9058j6kc";
};
}
{
name = "zsh-syntax-highlighting";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-syntax-highlighting";
rev = "0e1bb14452e3fc66dcc81531212e1061e02c1a61";
sha256 = "09ncmyqlk9a3h470z0wgbkrznb5zyc9dj96011wm89rdxc1irxk2";
};
}
];
};
kitty = {
enable = true;
settings = {
scrollback_lines = 10000;
enable_audio_bell = false;
cursor_shape = "underline";
};
extraConfig = builtins.readFile ~/.dotfiles/config/kitty/dracula.conf;
font = {
name = "FiraCode Nerd Font";
size = 10;
};
};
exa.enable = true;
bat.enable = true;
starship = {
enable = true;
enableZshIntegration = true;
};
rofi = {
enable = true;
theme = ~/.dotfiles/config/rofi/dracula_old.rasi;
};
emacs.enable = true;
};
xdg = {
enable = true;
configFile = {
"sxhkd/sxhkdrc" = {
source = ~/.dotfiles/config/sxhkd/sxhkdrc;
onChange = "pkill -USR1 -x sxhkd";
};
"bspwm/bspwmrc" = {
source = ~/.dotfiles/config/bspwm/bspwmrc;
onChange = "bspc wm -r";
};
"doom" = {
source = ~/.dotfiles/config/doom;
recursive = true;
onChange = builtins.readFile ~/.dotfiles/config/doom/reload.sh;
};
"dunst/dunstrc" = {
source = ~/.dotfiles/config/dunst/dunstrc;
};
};
};
services = {
polybar = {
enable = true;
script = ''for m in $(polybar --list-monitors | ${pkgs.coreutils}/bin/cut -d":" -f1); do
MONITOR=$m polybar --reload bottom &
done
'';
config = ~/.dotfiles/config/polybar/config.ini;
extraConfig = builtins.readFile ~/.dotfiles/config/polybar/modules.ini +
builtins.readFile ~/.dotfiles/config/polybar/colors.ini;
};
picom = {
enable = true;
inactiveOpacity = "0.95";
opacityRule = [
"100:fullscreen"
"80 :class_g = 'Polybar'"
];
blur = true;
inactiveDim = "0.1";
};
emacs = {
enable = true;
package = pkgs.emacsUnstable;
};
dunst.enable = true;
kdeconnect.enable = true;
};
home.packages = with pkgs; [
neofetch
feh
keepassxc
];
nixpkgs.overlays = [
(import (builtins.fetchTarball {
url = https://github.com/nix-community/emacs-overlay/archive/master.tar.gz;
}))
];
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "21.05";
}