mirror of
https://github.com/nickolaj-jepsen/nixos.git
synced 2026-01-22 16:16:50 +01:00
update
This commit is contained in:
parent
2b7b63a18c
commit
638ef7093e
140 changed files with 307 additions and 121 deletions
5
hosts/bootstrap/configuration.nix
Normal file
5
hosts/bootstrap/configuration.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{username, ...}: {
|
||||
networking.wireless.enable = false;
|
||||
networking.networkmanager.enable = true;
|
||||
users.users.${username}.extraGroups = [ "networkmanager" ];
|
||||
}
|
||||
98
hosts/default.nix
Normal file
98
hosts/default.nix
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
{
|
||||
inputs,
|
||||
withSystem,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
mkSystemImports = hostname: let
|
||||
hostDirectory = ./. + ("/" + hostname);
|
||||
nixFiles = filter (file: hasSuffix ".nix" file) (attrNames (builtins.readDir hostDirectory));
|
||||
imports = map (file: ./. + ("/" + hostname + "/" + file)) nixFiles;
|
||||
in {
|
||||
inherit imports;
|
||||
};
|
||||
|
||||
mkSystem = {
|
||||
hostname,
|
||||
username,
|
||||
modules ? [],
|
||||
system ? "x86_64-linux",
|
||||
}:
|
||||
withSystem system (
|
||||
{system, ...}: let
|
||||
pkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
|
||||
pkgsUnstable = import inputs.nixpkgs-unstable {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
in
|
||||
inputs.nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = {inherit inputs hostname username pkgs pkgsUnstable;};
|
||||
modules =
|
||||
[
|
||||
inputs.disko.nixosModules.disko
|
||||
inputs.nixos-generators.nixosModules.all-formats
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
inputs.agenix.nixosModules.default
|
||||
inputs.agenix-rekey.nixosModules.default
|
||||
inputs.nix-index-database.nixosModules.nix-index
|
||||
inputs.nixos-facter-modules.nixosModules.facter
|
||||
../modules/base/user.nix
|
||||
(mkSystemImports hostname)
|
||||
]
|
||||
++ modules
|
||||
++ (
|
||||
lib.optional (builtins.pathExists ./${hostname}/facter.json)
|
||||
{config.facter.reportPath = ./${hostname}/facter.json;}
|
||||
);
|
||||
}
|
||||
);
|
||||
in {
|
||||
config.flake.nixosConfigurations = {
|
||||
bootstrap = mkSystem {
|
||||
hostname = "bootstrap";
|
||||
username = "nixos";
|
||||
modules = [
|
||||
../modules/required.nix
|
||||
../modules/shell.nix
|
||||
];
|
||||
};
|
||||
|
||||
laptop = mkSystem {
|
||||
hostname = "laptop";
|
||||
username = "nickolaj";
|
||||
modules = [
|
||||
../modules/required.nix
|
||||
../modules/shell.nix
|
||||
../modules/graphical.nix
|
||||
../modules/devenv.nix
|
||||
];
|
||||
};
|
||||
desktop = mkSystem {
|
||||
hostname = "desktop";
|
||||
username = "nickolaj";
|
||||
modules = [
|
||||
../modules/required.nix
|
||||
../modules/shell.nix
|
||||
../modules/graphical.nix
|
||||
../modules/devenv.nix
|
||||
];
|
||||
};
|
||||
work = mkSystem {
|
||||
hostname = "work";
|
||||
username = "nickolaj";
|
||||
modules = [
|
||||
../modules/required.nix
|
||||
../modules/shell.nix
|
||||
../modules/graphical.nix
|
||||
../modules/devenv.nix
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
62
hosts/desktop/disk-configuration.nix
Normal file
62
hosts/desktop/disk-configuration.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
_: {
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
device = "/dev/disk/by-id/ata-SanDisk_SDSSDXPS240G_153251401377";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
name = "boot";
|
||||
size = "1M";
|
||||
type = "EF02";
|
||||
};
|
||||
|
||||
ESP = {
|
||||
size = "512M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = ["defaults"];
|
||||
};
|
||||
};
|
||||
luks = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "luks";
|
||||
name = "crypted";
|
||||
# Copied by deploy script, otherwise it will prompt for password
|
||||
passwordFile = "/luks-password";
|
||||
settings = {
|
||||
allowDiscards = true;
|
||||
bypassWorkqueues = true;
|
||||
};
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = ["-f"];
|
||||
subvolumes = {
|
||||
"@" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = ["compress=zstd" "noatime"];
|
||||
};
|
||||
"@nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = ["compress=zstd" "noatime"];
|
||||
};
|
||||
"@home" = {
|
||||
mountpoint = "/home";
|
||||
mountOptions = ["compress=zstd" "noatime"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
7786
hosts/desktop/facter.json
Normal file
7786
hosts/desktop/facter.json
Normal file
File diff suppressed because it is too large
Load diff
28
hosts/desktop/monitors.nix
Normal file
28
hosts/desktop/monitors.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
_: {
|
||||
monitors = [
|
||||
{
|
||||
name = "DP-2";
|
||||
resolution = "2560x1440";
|
||||
refreshRate = 144;
|
||||
position = "2560x1080";
|
||||
}
|
||||
{
|
||||
name = "HDMI-A-1";
|
||||
resolution = "2560x1440";
|
||||
refreshRate = 60;
|
||||
position = "0x1080";
|
||||
}
|
||||
{
|
||||
name = "DP-3";
|
||||
resolution = "2560x1440";
|
||||
refreshRate = 144;
|
||||
position = "5120x1080";
|
||||
}
|
||||
{
|
||||
name = "DP-1";
|
||||
resolution = "1920x1080";
|
||||
refreshRate = 60;
|
||||
position = "2880x0";
|
||||
}
|
||||
];
|
||||
}
|
||||
15
hosts/desktop/nvidia.nix
Normal file
15
hosts/desktop/nvidia.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
_: {
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
};
|
||||
services.xserver.videoDrivers = ["nvidia"];
|
||||
hardware.nvidia = {
|
||||
open = true;
|
||||
modesetting.enable = true;
|
||||
powerManagement.enable = true;
|
||||
nvidiaSettings = true;
|
||||
};
|
||||
|
||||
# Avoid nvidia driver from crashing the system
|
||||
boot.kernelParams = ["pcie_aspm=off"];
|
||||
}
|
||||
29
hosts/laptop/configuration.nix
Normal file
29
hosts/laptop/configuration.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{pkgs, ...}: {
|
||||
# Enable OpenGL
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# Load nvidia driver for Xorg and Wayland
|
||||
services.xserver.videoDrivers = ["nvidia"];
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.glxinfo
|
||||
];
|
||||
|
||||
hardware.nvidia = {
|
||||
open = true;
|
||||
modesetting.enable = true;
|
||||
powerManagement.enable = true;
|
||||
powerManagement.finegrained = true;
|
||||
nvidiaSettings = true;
|
||||
prime = {
|
||||
offload = {
|
||||
enable = true;
|
||||
enableOffloadCmd = true;
|
||||
};
|
||||
intelBusId = "PCI:0:2:0";
|
||||
nvidiaBusId = "PCI:1:0:0";
|
||||
};
|
||||
};
|
||||
}
|
||||
62
hosts/laptop/disk-configuration.nix
Normal file
62
hosts/laptop/disk-configuration.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
_: {
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
device = "/dev/disk/by-id/nvme-SAMSUNG_MZVLB512HBJQ-000L2_S4DYNF0M893481";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
name = "boot";
|
||||
size = "1M";
|
||||
type = "EF02";
|
||||
};
|
||||
|
||||
ESP = {
|
||||
size = "512M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = ["defaults"];
|
||||
};
|
||||
};
|
||||
luks = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "luks";
|
||||
name = "crypted";
|
||||
# Copied by deploy script, otherwise it will prompt for password
|
||||
passwordFile = "/luks-password";
|
||||
settings = {
|
||||
allowDiscards = true;
|
||||
bypassWorkqueues = true;
|
||||
};
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = ["-f"];
|
||||
subvolumes = {
|
||||
"@" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = ["compress=zstd" "noatime"];
|
||||
};
|
||||
"@nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = ["compress=zstd" "noatime"];
|
||||
};
|
||||
"@home" = {
|
||||
mountpoint = "/home";
|
||||
mountOptions = ["compress=zstd" "noatime"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
4394
hosts/laptop/facter.json
Normal file
4394
hosts/laptop/facter.json
Normal file
File diff suppressed because it is too large
Load diff
62
hosts/work/disk-configuration.nix
Normal file
62
hosts/work/disk-configuration.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
_: {
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
device = "/dev/sda";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
name = "boot";
|
||||
size = "1M";
|
||||
type = "EF02";
|
||||
};
|
||||
|
||||
ESP = {
|
||||
size = "512M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = ["defaults"];
|
||||
};
|
||||
};
|
||||
luks = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "luks";
|
||||
name = "crypted";
|
||||
# Copied by deploy script, otherwise it will prompt for password
|
||||
passwordFile = "/luks-password";
|
||||
settings = {
|
||||
allowDiscards = true;
|
||||
bypassWorkqueues = true;
|
||||
};
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = ["-f"];
|
||||
subvolumes = {
|
||||
"@" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = ["compress=zstd" "noatime"];
|
||||
};
|
||||
"@nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = ["compress=zstd" "noatime"];
|
||||
};
|
||||
"@home" = {
|
||||
mountpoint = "/home";
|
||||
mountOptions = ["compress=zstd" "noatime"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
12
hosts/work/nvidia.nix
Normal file
12
hosts/work/nvidia.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
_: {
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
};
|
||||
services.xserver.videoDrivers = ["nvidia"];
|
||||
hardware.nvidia = {
|
||||
open = true;
|
||||
modesetting.enable = true;
|
||||
powerManagement.enable = true;
|
||||
nvidiaSettings = true;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue