init: initalised new nixos config

This commit is contained in:
2025-08-20 12:30:07 +02:00
commit 0a164f0a49
11 changed files with 862 additions and 0 deletions

320
flake.lock generated Normal file
View File

@@ -0,0 +1,320 @@
{
"nodes": {
"base16-schemes": {
"flake": false,
"locked": {
"lastModified": 1696158499,
"narHash": "sha256-5yIHgDTPjoX/3oDEfLSQ0eJZdFL1SaCfb9d6M0RmOTM=",
"owner": "tinted-theming",
"repo": "base16-schemes",
"rev": "a9112eaae86d9dd8ee6bb9445b664fba2f94037a",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "base16-schemes",
"type": "github"
}
},
"crane": {
"locked": {
"lastModified": 1731098351,
"narHash": "sha256-HQkYvKvaLQqNa10KEFGgWHfMAbWBfFp+4cAgkut+NNE=",
"owner": "ipetkov",
"repo": "crane",
"rev": "ef80ead953c1b28316cc3f8613904edc2eb90c28",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"lanzaboote",
"nixpkgs"
]
},
"locked": {
"lastModified": 1730504689,
"narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "506278e768c2a08bec68eb62932193e341f55c90",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"lanzaboote",
"pre-commit-hooks-nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1753592768,
"narHash": "sha256-oV695RvbAE4+R9pcsT9shmp6zE/+IZe6evHWX63f2Qg=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "fc3add429f21450359369af74c2375cb34a2d204",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-25.05",
"repo": "home-manager",
"type": "github"
}
},
"lanzaboote": {
"inputs": {
"crane": "crane",
"flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"nixpkgs": [
"nixpkgs"
],
"pre-commit-hooks-nix": "pre-commit-hooks-nix",
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1737639419,
"narHash": "sha256-AEEDktApTEZ5PZXNDkry2YV2k6t0dTgLPEmAZbnigXU=",
"owner": "nix-community",
"repo": "lanzaboote",
"rev": "a65905a09e2c43ff63be8c0e86a93712361f871e",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "v0.4.2",
"repo": "lanzaboote",
"type": "github"
}
},
"nix-colors": {
"inputs": {
"base16-schemes": "base16-schemes",
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1707825078,
"narHash": "sha256-hTfge2J2W+42SZ7VHXkf4kjU+qzFqPeC9k66jAUBMHk=",
"owner": "misterio77",
"repo": "nix-colors",
"rev": "b01f024090d2c4fc3152cd0cf12027a7b8453ba1",
"type": "github"
},
"original": {
"owner": "misterio77",
"repo": "nix-colors",
"type": "github"
}
},
"nixos-hardware": {
"locked": {
"lastModified": 1755330281,
"narHash": "sha256-aJHFJWP9AuI8jUGzI77LYcSlkA9wJnOIg4ZqftwNGXA=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "3dac8a872557e0ca8c083cdcfc2f218d18e113b0",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "master",
"repo": "nixos-hardware",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1755593991,
"narHash": "sha256-BA9MuPjBDx/WnpTJ0EGhStyfE7hug8g85Y3Ju9oTsM4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a58390ab6f1aa810eb8e0f0fc74230e7cc06de03",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-25.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1697935651,
"narHash": "sha256-qOfWjQ2JQSQL15KLh6D7xQhx0qgZlYZTYlcEiRuAMMw=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "e1e11fdbb01113d85c7f41cada9d2847660e3902",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1730741070,
"narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d063c1dd113c91ab27959ba540c0d9753409edf3",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks-nix": {
"inputs": {
"flake-compat": [
"lanzaboote",
"flake-compat"
],
"gitignore": "gitignore",
"nixpkgs": [
"lanzaboote",
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1731363552,
"narHash": "sha256-vFta1uHnD29VUY4HJOO/D6p6rxyObnf+InnSMT4jlMU=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "cd1af27aa85026ac759d5d3fccf650abe7e1bbf0",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"lanzaboote": "lanzaboote",
"nix-colors": "nix-colors",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs",
"sops-nix": "sops-nix",
"unstable": "unstable"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"lanzaboote",
"nixpkgs"
]
},
"locked": {
"lastModified": 1731897198,
"narHash": "sha256-Ou7vLETSKwmE/HRQz4cImXXJBr/k9gp4J4z/PF8LzTE=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "0be641045af6d8666c11c2c40e45ffc9667839b5",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"sops-nix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1754988908,
"narHash": "sha256-t+voe2961vCgrzPFtZxha0/kmFSHFobzF00sT8p9h0U=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "3223c7a92724b5d804e9988c6b447a0d09017d48",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "sops-nix",
"type": "github"
}
},
"unstable": {
"locked": {
"lastModified": 1755615617,
"narHash": "sha256-HMwfAJBdrr8wXAkbGhtcby1zGFvs+StOp19xNsbqdOg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "20075955deac2583bb12f07151c2df830ef346b4",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

60
flake.nix Normal file
View File

@@ -0,0 +1,60 @@
{
description = "NixOS configuration for legolas (laptop)";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager/release-25.05";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-colors.url = "github:misterio77/nix-colors";
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
lanzaboote = {
url = "github:nix-community/lanzaboote/v0.4.2";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
};
outputs = { self, nixpkgs, unstable, home-manager, nix-colors, sops-nix, lanzaboote, nixos-hardware, ... }@inputs:
let
system = "x86_64-linux";
in {
# legolas
nixosConfigurations.legolas = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs; };
modules = [
./hosts/legolas/configuration.nix
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.gunalx = import ./home/gunalx.nix;
home-manager.backupFileExtension = "bac";
home-manager.extraSpecialArgs = {inherit nix-colors inputs;};
}
sops-nix.nixosModules.sops
lanzaboote.nixosModules.lanzaboote
nixos-hardware.nixosModules.dell-xps-13-9370
];
};
};
}

54
home/atuin.nix Normal file
View File

@@ -0,0 +1,54 @@
{ pkgs, ... }:
{
programs.atuin = {
enable = true;
settings = {
# Data files
db_path = "~/.history.db";
# Filtering
filter_mode = "host";
filter_mode_shell_up_key_binding = "directory";
# UI
max_preview_height = 2;
show_help = true;
prefers_reduced_motion = true;
# History storage
secrets_filter = true;
enter_accept = true;
# Sync v2
sync = {
records = true;
};
# Stats
stats = {
common_subcommands = [
"apt" "cargo" "composer" "dnf" "docker" "git" "go" "ip"
"kubectl" "nix" "nmcli" "npm" "pecl" "pnpm" "podman"
"port" "systemctl" "tmux" "yarn"
];
common_prefix = [ "sudo" ];
};
# Keys
keys = {
scroll_exits = true;
};
# Theme
theme = {
name = "marine";
};
# Search
search = {
filters = [ "directory" "host" "session" ];
};
};
};
}

27
home/bash.nix Normal file
View File

@@ -0,0 +1,27 @@
{ pkgs, lib, config, ... }:
{
programs.bash = {
enable = true;
shellAliases = {
"rebuild" = "sudo nixos-rebuild switch --no-write-lock-file --flake git+https://github.com/adrlau/nix-dotfiles.git -L --impure";
"," = "comma ";
"gst" = "git status";
"gsw" = "git switch";
"gcm" = "git commit -m ";
"gca" = "git commit --amend";
"gaa" = "git add -A";
"gb" = "git branch";
"sl" = "eza";
"ls" = "eza";
"lls" = "ls";
"la" = "eza -la";
"tree" = "eza -T";
"neofetch" = "fastfetch";
};
historyControl = ["ignoredups" "ignorespace" "erasedups"];
historyIgnore = [ "ls" "cd" "exit" "cd .." ".." "la"];
};
}

27
home/git.nix Normal file
View File

@@ -0,0 +1,27 @@
{ pkgs, lib, config, ... }:
{
programs.git = {
enable = true;
extraConfig = {
pull.rebase = true;
push.autoSetupRemote = true;
color.ui = "auto";
init.defaultBranch = "main";
lfs.enable = true;
user = {
name = "Adrian G L";
email = "adrian@lauterer.it";
};
};
ignores = [
"*~"
"*.swp"
".DS_Store"
".vscode"
".aider*"
".continue*"
"*__PYCACHE__*"
"*__pycache__*"
];
};
}

27
home/gunalx.nix Normal file
View File

@@ -0,0 +1,27 @@
{ pkgs, lib, ... }:
{
imports = [
./sshconfig.nix
./atuin.nix
./git.nix
./bash.nix
];
programs.nix-index = {
enableBashIntegration = true;
enable = true;
};
home.packages = with pkgs; [
bottom
htop
fastfetch
eza
ripgrep
foot.terminfo
comma
];
home.stateVersion = "25.05";
}

100
home/sshconfig.nix Normal file
View File

@@ -0,0 +1,100 @@
{ pkgs, lib, config, ... }:
{
imports = [
];
home.packages = with pkgs; [
openssh
ssh-askpass-fullscreen
sshfs
];
services.ssh-agent.enable = true;
programs.ssh = {
enable = true;
compression = true;
matchBlocks = {
"*" = {
identityFile = [
"~/.ssh/nixos"
"~/.ssh/id_ed25519"
];
};
"*.pvv.ntnu.no" = {
user="adriangl";
};
"*.ntnu.no !login.pvv.ntnu.no" = {
user="adriangl";
proxyJump="login.pvv.ntnu.no";
};
"snotra" = {
user="adriangl";
proxyJump="adriangl@login.pvv.ntnu.no";
hostname="snotra.idi.ntnu.no";
};
#pbsds
"garp.pbsds.net" = {
user="adrlau";
proxyJump = "login.pvv.ntnu.no";
extraOptions = {
StrictHostKeyChecking = "no";
UserKnownHostsFile = "/dev/null";
};
};
"bolle.pbsds.net" = {
user="adrlau";
proxyJump = "login.pvv.ntnu.no";
extraOptions = {
StrictHostKeyChecking = "no";
UserKnownHostsFile = "/dev/null";
};
};
#pvv
"pvv" = {
user="adriangl";
hostname="login.pvv.ntnu.no";
};
"pvv2" = {
user="adriangl";
hostname="login2.pvv.ntnu.no";
};
#home
"aragon" = {
port = 6969;
hostname="100.74.34.149";
};
"galadriel" = {
port = 6969;
hostname="100.84.215.84";
};
"gandalf" = {
port = 6969;
hostname="100.124.183.16";
};
"elrond" = {
port = 6969;
hostname="100.101.17.39 ";
};
};
extraConfig = "";
};
}

View File

@@ -0,0 +1,121 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
../../modules/boot.nix
../../modules/displaymanager.nix
];
networking.hostName = "legolas"; # Define your hostname.
# Configure network connections interactively with nmcli or nmtui.
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/Amsterdam";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# Enable the X11 windowing system.
services.xserver.enable = true;
services.xserver.videoDrivers = ["modesetting"];
programs.niri.enable = true;
# Configure keymap in X11
# services.xserver.xkb.layout = "us";
# services.xserver.xkb.options = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# services.pulseaudio.enable = true;
# OR
services.pipewire = {
enable = true;
pulse.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
services.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.gunalx = {
isNormalUser = true;
extraGroups = [ "wheel" "tss" "networking" ]; # Enable sudo for the user.
packages = with pkgs; [
tree
];
};
programs.firefox.enable = true;
# List packages installed in system profile.
# You can use https://search.nixos.org/ to find more packages (and options).
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
alacritty
foot
firefox
fuzzel
];
# 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;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
# to actually do that.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "25.05"; # Did you read the comment?
}

View File

@@ -0,0 +1,51 @@
# 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" "nvme" "uas" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-label/NIXROOT";
fsType = "ext4";
};
boot.initrd.luks.devices = {
"luks_secure" = {
device = "/dev/disk/by-uuid/c21c8089-29a7-4266-a8a6-6e80ccca167c";
preLVM = true;
allowDiscards = true;
crypttabExtraOpts = [
"tpm2-device=auto"
"tpm2-measure-pcr=yes"
];
};
};
fileSystems."/boot" =
{ device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
swapDevices = [ ];
hardware.graphics = {
enable = true;
extraPackages = with pkgs; [ vpl-gpu-rt intel-media-sdk vaapiIntel intel-media-driver];
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

57
modules/boot.nix Normal file
View File

@@ -0,0 +1,57 @@
{ config, pkgs, lib, ... }:
{
imports = [ ];
boot = {
consoleLogLevel = 0;
kernelParams = [
"quiet" "splash" "loglevel=0"
"udev.log_priority=3" "vt.global_cursor_default=0"
"rd.systemd.show_status=auto" "rd.udev.log_level=3"
"boot.shell_on_fail" "console=tty1"
];
initrd = {
verbose = false;
systemd.enable = true;
};
plymouth = {
enable = true;
theme = "bgrt";
logo = "${pkgs.nixos-icons}/share/icons/hicolor/128x128/apps/nix-snowflake.png";
font = "${pkgs.dejavu_fonts}/share/fonts/truetype/DejaVuSansMono.ttf";
};
};
fonts.packages = with pkgs; [ dejavu_fonts hack-font ];
# Integrate with Lanzaboote
boot.loader.systemd-boot.enable = lib.mkForce false;
boot.lanzaboote = {
enable = true;
#pkiBundle = "/etc/secureboot"; # old way. use sbctl setup --migrate
pkiBundle = "/var/lib/sbctl"; # sudo sbctl create-keys
};
# TPM-based LUKS unlock put in hardware configuration.nix.
# boot.initrd.luks.devices = {
# cryptroot = {
# device = "/dev/sda2";
# crypttabExtraOpts = [
# "tpm2-device=auto"
# "tpm2-measure-pcr=yes"
# ];
# };
# };
security.tpm2 = {
enable = true;
pkcs11.enable = true;
tctiEnvironment.enable = true;
};
environment.systemPackages = with pkgs; [ sbctl tpm2-tools ];
}

View File

@@ -0,0 +1,18 @@
{ config, pkgs, lib, ... }:
{
imports = [ ];
services.displayManager = {
enable = true;
sessionPackages = with pkgs; [ niri ];
defaultSession = "niri";
sddm = {
enable = true;
autoNumlock = true;
enableHidpi = true;
};
};
}