Initial commit

This commit is contained in:
Knyffen 2024-08-24 12:54:21 +02:00
commit 179f22fe42
22 changed files with 620 additions and 0 deletions

0
README.md Normal file
View File

72
flake.lock Normal file
View File

@ -0,0 +1,72 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1724435763,
"narHash": "sha256-UNky3lJNGQtUEXT2OY8gMxejakSWPTfWKvpFkpFlAfM=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "c2cd2a52e02f1dfa1c88f95abeb89298d46023be",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1724224976,
"narHash": "sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh+aRKoCdaAv5fiO0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c374d94f1536013ca8e92341b540eba4c22f9c62",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"plasma-manager": {
"inputs": {
"home-manager": [
"home-manager"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1724364293,
"narHash": "sha256-R/Jsd29RtrPoxr+NivHWIi+Zm63+G/1R539KtSQSycw=",
"owner": "nix-community",
"repo": "plasma-manager",
"rev": "0b7f9b5eed2d221db4b6ed4dade0b4e9f50dfd6f",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "plasma-manager",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"plasma-manager": "plasma-manager"
}
}
},
"root": "root",
"version": 7
}

46
flake.nix Normal file
View File

@ -0,0 +1,46 @@
{
inputs = {
#nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
# url = "github:nix-community/home-manager/release-24.05";
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
plasma-manager = {
url = "github:nix-community/plasma-manager";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
};
outputs = inputs@{ self, nixpkgs, home-manager, plasma-manager, ... }: {
nixosConfigurations.jry-thinkpad = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
sharedModules = [
plasma-manager.homeManagerModules.plasma-manager
];
};
}
( { config, ... }:
let hostname = "jry-thinkpad";
in {
system.stateVersion = "24.05";
networking.hostName = hostname;
imports = [
./shared/configuration.nix
./${hostname}/configuration.nix
./${hostname}/hardware-configuration.nix
];
} )
];
};
};
}
# vim: tabstop=2 softtabstop=2

View File

@ -0,0 +1,47 @@
{ config, lib, pkgs, ... }:
{
imports = [
../shared/variables.nix
../shared/cli_packages.nix
../shared/desktop_environment/kde_plasma/plasma.nix
../shared/desktop_environment/packages.nix
../shared/keyboard.nix
../shared/sound.nix
../shared/networkmanager.nix
../shared/printing.nix
../shared/hibernation.nix
./home_manager.nix
];
swapDevices = [ {
device = "/swapfile";
size = 16*1024;
} ];
variables.username = "jry";
variables.homedir = "/home/${config.variables.username}/";
variables.flakedir = "${config.variables.homedir}/Nextcloud/configfiles/nix/PC/";
variables.swapsize = 16*1024;
variables.resumeOffset = 4685824; # Found using `sudo filefrag -v /swapfile | awk '{ if($1=="0:"){print $4} }'`
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# useXkbConfig = true; # use xkb.options in tty.
# };
users.users."${config.variables.username}" = {
uid = 1000;
isNormalUser = true;
extraGroups = [
"wheel"
"networkmanager"
];
packages = with pkgs; [];
};
}
# vim: tabstop=2 softtabstop=2

View File

@ -0,0 +1,42 @@
# 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" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/ea8ecb95-f34f-4b2d-b5c8-b7a002813cb1";
fsType = "ext4";
};
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/ae4cbc4c-9e00-4918-85a6-c5ebacda5975";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/CEBD-9286";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
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.enp2s0f0.useDHCP = lib.mkDefault true;
# networking.interfaces.enp5s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@ -0,0 +1,18 @@
{ home-manager, config, lib, ... }:
{
home-manager.users.${config.variables.username} = { ... }: {
imports = [
../shared/home_manager/plasma_manager.nix
../shared/variables.nix
];
variables = config.variables;
# The state version is required and should stay at the version you
# originally installed.
home.stateVersion = "24.05";
};
}
# vim: tabstop=2 softtabstop=2

View File

@ -0,0 +1 @@
"jry-thinkpad"

View File

@ -0,0 +1 @@
"jry"

22
shared/cli_packages.nix Normal file
View File

@ -0,0 +1,22 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
curl
git
htop
ripgrep
trash-cli
usbutils
wget
];
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
};
}
# vim: tabstop=2 softtabstop=2

32
shared/configuration.nix Normal file
View File

@ -0,0 +1,32 @@
{ config, lib, pkgs, ... }:
{
environment.etc.configuration = {
target = "nixos/flake.nix";
source = "${config.variables.flakedir}/flake.nix";
};
fileSystems."/boot" = lib.mkForce {
device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
};
fileSystems."/" = lib.mkForce {
device = "/dev/disk/by-label/NIXROOT";
fsType = "ext4";
};
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
nixpkgs.config = {
allowUnfree = true;
};
time.timeZone = "Europe/Copenhagen";
}
# vim: tabstop=2 softtabstop=2

View File

@ -0,0 +1,11 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
aha
];
services.fwupd.enable = true;
}
# vim: tabstop=2 softtabstop=2

View File

@ -0,0 +1,17 @@
{ pkgs, ... }:
{
services.xserver.enable = true;
services.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true;
environment.plasma6.excludePackages = with pkgs.kdePackages; [
elisa
gwenview
kate
khelpcenter
okular
plasma-browser-integration
];
}
# vim: tabstop=2 softtabstop=2

View File

@ -0,0 +1,10 @@
{ ... }:
{
imports = [
./parts/plasma6.nix
./parts/kinfocenter/dependencies.nix
];
}
# vim: tabstop=2 softtabstop=2

View File

@ -0,0 +1,11 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
firefox
keepassxc
nextcloud-client
];
}
# vim: tabstop=2 softtabstop=2

17
shared/hibernation.nix Normal file
View File

@ -0,0 +1,17 @@
{ config, ... }:
{
swapDevices = [ {
device = "/swapfile";
size = config.variables.swapsize;
} ];
boot.resumeDevice = "/dev/disk/by-label/NIXROOT";
boot.kernelParams = [ "resume_offset=${toString config.variables.resumeOffset}" ];
systemd.sleep.extraConfig = ''
HibernateDelaySec=1h
'';
}
# vim: tabstop=2 softtabstop=2

View File

@ -0,0 +1,119 @@
[ColorEffects:Disabled]
Color=56,56,56
ColorAmount=0
ColorEffect=0
ContrastAmount=0.65
ContrastEffect=1
IntensityAmount=0.1
IntensityEffect=2
[ColorEffects:Inactive]
ChangeSelectionColor=false
Color=112,111,110
ColorAmount=0.025
ColorEffect=2
ContrastAmount=0.1
ContrastEffect=2
Enable=false
IntensityAmount=0
IntensityEffect=0
[Colors:Button]
BackgroundAlternate=77,77,77
BackgroundNormal=31,31,31
DecorationFocus=180,113,31
DecorationHover=180,113,31
ForegroundActive=180,113,31
ForegroundInactive=189,195,199
ForegroundLink=180,113,31
ForegroundNegative=218,68,83
ForegroundNeutral=246,116,0
ForegroundNormal=247,247,247
ForegroundPositive=255,162,0
ForegroundVisited=132,67,101
[Colors:Complementary]
BackgroundAlternate=36,36,36
BackgroundNormal=31,31,31
DecorationFocus=255,162,0
DecorationHover=255,162,0
ForegroundActive=255,162,0
ForegroundInactive=180,113,31
ForegroundLink=180,113,31
ForegroundNegative=83,62,37
ForegroundNeutral=83,62,37
ForegroundNormal=239,240,241
ForegroundPositive=255,162,0
ForegroundVisited=110,65,40
[Colors:Selection]
BackgroundAlternate=180,113,31
BackgroundNormal=255,162,0
DecorationFocus=180,113,31
DecorationHover=180,113,31
ForegroundActive=132,67,101
ForegroundInactive=255,232,115
ForegroundLink=44,27,0
ForegroundNegative=200,62,76
ForegroundNeutral=200,93,0
ForegroundNormal=44,27,0
ForegroundPositive=255,162,0
ForegroundVisited=144,112,140
[Colors:Tooltip]
BackgroundAlternate=31,31,31
BackgroundNormal=31,31,31
DecorationFocus=180,113,31
DecorationHover=180,113,31
ForegroundActive=180,113,31
ForegroundInactive=189,195,199
ForegroundLink=180,113,31
ForegroundNegative=218,68,83
ForegroundNeutral=246,116,0
ForegroundNormal=239,240,241
ForegroundPositive=255,162,0
ForegroundVisited=127,140,141
[Colors:View]
BackgroundAlternate=32,32,32
BackgroundNormal=36,36,36
DecorationFocus=255,162,0
DecorationHover=255,162,0
ForegroundActive=255,162,0
ForegroundInactive=199,199,199
ForegroundLink=255,162,0
ForegroundNegative=218,68,83
ForegroundNeutral=246,116,0
ForegroundNormal=255,255,255
ForegroundPositive=255,162,0
ForegroundVisited=141,141,141
[Colors:Window]
BackgroundAlternate=42,42,42
BackgroundNormal=31,31,31
DecorationFocus=255,162,0
DecorationHover=255,162,0
ForegroundActive=83,62,37
ForegroundInactive=189,195,199
ForegroundLink=180,113,31
ForegroundNegative=218,68,83
ForegroundNeutral=246,116,0
ForegroundNormal=255,255,255
ForegroundPositive=255,162,0
ForegroundVisited=110,65,40
[General]
ColorScheme=Krita dark orange
Name=Krita dark orange
shadeSortColumn=true
[KDE]
contrast=4
[WM]
activeBackground=25,25,25
activeBlend=255,255,255
activeForeground=239,240,241
inactiveBackground=25,25,25
inactiveBlend=65,65,65
inactiveForeground=131,131,131

View File

@ -0,0 +1,67 @@
{ plasma-manager, config, ... }:
# https://nix-community.github.io/plasma-manager/options.xhtml
# https://github.com/nix-community/plasma-manager/blob/trunk/examples/home.nix
{
programs.plasma = {
enable = true;
panels = [{
height = 44;
location = "left";
widgets = [
"org.kde.plasma.kickoff"
"org.kde.plasma.pager"
{
iconTasks.launchers = [];
}
"org.kde.plasma.marginsseparator"
{
systemTray.items = {
# shown = [];
# hidden = [];
};
}
{
digitalClock = {
calendar = {
firstDayOfWeek = "monday";
showWeekNumbers = true;
};
time.format = "24h";
settings.Appearance.showDate = false;
};
}
];
}];
workspace = {
theme = "breeze-dark";
colorScheme = "KritaDarkOrange";
};
kwin = {
edgeBarrier = 0;
cornerBarrier = false;
virtualDesktops = {
number = 8;
rows = 4;
};
};
# Find attributes at /proc/bus/input/devices
# converting vendorId and productId from hex to base10 is broken currently
# https://github.com/nix-community/plasma-manager/issues/306
# input.mice = [{
# vendorId = "0002";
# productId = "0007";
# naturalScroll = true;
# }];
configFile.kcminputrc."Libinput/2/10/SynPS/2 Synaptics TouchPad"."NaturalScroll" = true;
};
systemd.user.tmpfiles.rules = [
"L ${config.variables.homedir}/.local/share/color-schemes/KritaDarkOrange.colors - - - - ${config.variables.flakedir}/shared/home_manager/assets/KritaDarkOrange.colors"
];
}
# vim: tabstop=2 softtabstop=2

8
shared/keyboard.nix Normal file
View File

@ -0,0 +1,8 @@
{ ... }:
{
console.keyMap = "us";
services.xserver.xkb.layout = "us";
}
# vim: tabstop=2 softtabstop=2

39
shared/networkmanager.nix Normal file
View File

@ -0,0 +1,39 @@
{ lib, ... }:
let network-config-default = {
connection = {
type = "wifi";
permissions = "";
};
wifi = {
mac-address-blacklist = "";
mode = "infrastructure";
};
wifi-security = {
auth-alg = "open";
key-mgmt = "wpa-psk";
};
ipv4 = {
dns-search = "";
method = "auto";
};
ipv6 = {
addr-gen-mode = "stable-privacy";
dns-search = "";
method = "auto";
};
};
in {
networking.networkmanager.enable = true;
networking.networkmanager.wifi.powersave = true; # We assume only laptops use wifi
networking.networkmanager.ensureProfiles.profiles = {
KnyfNet = lib.recursiveUpdate network-config-default {
connection.id = "KnyfNet";
wifi.ssid = "KnyfNet";
wifi-security.psk = "ltzlhznhzd";
};
};
}
# vim: tabstop=2 softtabstop=2

7
shared/printing.nix Normal file
View File

@ -0,0 +1,7 @@
{ ... }:
{
services.printing.enable = true;
}
# vim: tabstop=2 softtabstop=2

10
shared/sound.nix Normal file
View File

@ -0,0 +1,10 @@
{ ... }:
{
services.pipewire = {
enable = true;
pulse.enable = true;
};
}
# vim: tabstop=2 softtabstop=2

23
shared/variables.nix Normal file
View File

@ -0,0 +1,23 @@
{ lib, ... }:
{
options.variables = {
username = lib.mkOption {
type = lib.types.str;
};
homedir = lib.mkOption {
type = lib.types.str;
};
flakedir = lib.mkOption {
type = lib.types.str;
};
swapsize = lib.mkOption {
type = lib.types.int;
};
resumeOffset = lib.mkOption {
type = lib.types.int;
};
};
}
# vim: tabstop=2 softtabstop=2