init: initial setup
This commit is contained in:
commit
69a92fdd5e
10 changed files with 444 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
/result
|
||||
*.qcow2
|
||||
6
common/default.nix
Normal file
6
common/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./users.nix
|
||||
];
|
||||
}
|
||||
47
common/home.nix
Normal file
47
common/home.nix
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
pkgs,
|
||||
filter,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
home.username = "strix";
|
||||
home.homeDirectory = "/home/strix";
|
||||
|
||||
home.packages = with pkgs; [
|
||||
ghostty
|
||||
thunderbird
|
||||
vscode
|
||||
steam
|
||||
bitwarden-desktop
|
||||
nixd
|
||||
treefmt
|
||||
tealdeer
|
||||
];
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
settings = {
|
||||
user.name = "strix";
|
||||
user.email = "strix@saluco.nl";
|
||||
init = { defaultBranch = "main"; };
|
||||
};
|
||||
};
|
||||
|
||||
dconf.settings = {
|
||||
"org/gnome/settings-daemon/plugins/media-keys" = {
|
||||
custom-keybindings = [
|
||||
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"
|
||||
];
|
||||
};
|
||||
|
||||
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
|
||||
name = "terminal";
|
||||
command = "ghostty";
|
||||
binding = "<Super>Return";
|
||||
};
|
||||
};
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
home.stateVersion = "26.11";
|
||||
}
|
||||
26
common/users.nix
Normal file
26
common/users.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{ home-manager, inputs, filter, ... }:
|
||||
{
|
||||
users.users."strix" = {
|
||||
isNormalUser = true;
|
||||
description = "Strix";
|
||||
initialPassword = "changeme";
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"networkmanager"
|
||||
"libvirtd"
|
||||
];
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMjsxlXIgj0sPuzjgfeqAfe1gTNAeFpAext2wbfjOLPE"
|
||||
];
|
||||
};
|
||||
|
||||
imports = [
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.extraSpecialArgs = { inherit inputs filter; };
|
||||
home-manager.users.strix = ./home.nix;
|
||||
}
|
||||
];
|
||||
}
|
||||
27
devices/p14s/default.nix
Normal file
27
devices/p14s/default.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
../../common
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
networking.hostName = "p14s";
|
||||
|
||||
boot.initrd.luks.devices."luks-d51bdb99-5966-40d3-a920-83ea78a73699".device = "/dev/disk/by-uuid/d51bdb99-5966-40d3-a920-83ea78a73699";
|
||||
|
||||
virtualisation.vmVariant = {
|
||||
virtualisation = {
|
||||
memorySize = 8192;
|
||||
cores = 6;
|
||||
};
|
||||
};
|
||||
|
||||
users.users."guest" = {
|
||||
isNormalUser = true;
|
||||
name = "Guest";
|
||||
initialPassword = "guest";
|
||||
createHome = true;
|
||||
};
|
||||
|
||||
system.stateVersion = "26.05"; # yes
|
||||
}
|
||||
35
devices/p14s/hardware-configuration.nix
Normal file
35
devices/p14s/hardware-configuration.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/mapper/luks-21284f67-5a63-41be-9354-07a0240cac50";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
boot.initrd.luks.devices."luks-21284f67-5a63-41be-9354-07a0240cac50".device = "/dev/disk/by-uuid/21284f67-5a63-41be-9354-07a0240cac50";
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/FE19-D3F1";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0077" "dmask=0077" ];
|
||||
};
|
||||
|
||||
swapDevices =
|
||||
[ { device = "/dev/mapper/luks-d51bdb99-5966-40d3-a920-83ea78a73699"; }
|
||||
];
|
||||
|
||||
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
|
||||
}
|
||||
48
flake.lock
generated
Normal file
48
flake.lock
generated
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"nodes": {
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1787379775,
|
||||
"narHash": "sha256-XL2qfqmocfsvuEGyomZg4nOZfkuSe8vZtrOX99I+b6I=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "ec1a8fdf74ed3f276148ee106299a2ba0e65d51f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1787360063,
|
||||
"narHash": "sha256-dt4WdcvsA8/RCe+VZZwqU0X+XMM3wBbGCWA0/sFWzGo=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2c423e03bbafcff28bfadc6781a4a8257f205cb5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
70
flake.nix
Normal file
70
flake.nix
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
{
|
||||
description = "S41UC0 Nix Configurations";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = inputs@{ self, nixpkgs, home-manager, ... }:
|
||||
let
|
||||
filter = with nixpkgs.lib;
|
||||
folder: fileset.toList (fileset.fileFilter
|
||||
(file:
|
||||
hasSuffix "nix"
|
||||
file.name)
|
||||
folder);
|
||||
nixosConfig = {modules ? []}: nixpkgs.lib.nixosSystem {
|
||||
modules = modules;
|
||||
specialArgs = { inherit inputs filter home-manager; };
|
||||
};
|
||||
in
|
||||
{
|
||||
nixosConfigurations.p14s = nixosConfig {
|
||||
modules = [
|
||||
./devices/p14s
|
||||
./styles/desktop.nix
|
||||
];
|
||||
};
|
||||
|
||||
apps.x86_64-linux.default = {
|
||||
type = "app";
|
||||
program = toString (nixpkgs.legacyPackages.x86_64-linux.writeShellScript "rebuild" ''
|
||||
exec sudo nixos-rebuild switch --flake . "$@"
|
||||
'');
|
||||
};
|
||||
|
||||
apps.x86_64-linux.registerDevice = {
|
||||
type = "app";
|
||||
program = toString (nixpkgs.legacyPackages.x86_64-linux.writeShellScript "rebuild" ''
|
||||
[ -d ./devices/$HOST ] && exit 1
|
||||
mkdir -p ./devices/$HOST
|
||||
nixos-generate-config --show-hardware-config > ./devices/$HOST/hardware-config.nix
|
||||
cat>./devices/$HOST/default.nix<<EOF
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
../../common
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
networking.hostName = "$HOST";
|
||||
system.stateVersion = "${nixpkgs.lib.trivial.release}"; # yes
|
||||
}
|
||||
EOF
|
||||
'');
|
||||
};
|
||||
|
||||
devShells.x86_64-linux.default =
|
||||
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
in pkgs.mkShell {
|
||||
shellHook = ''
|
||||
echo "Building VM..."
|
||||
rm -rf *.qcow2
|
||||
nixos-rebuild build-vm --flake . && ./result/bin/run-*-vm
|
||||
exit
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
108
styles/desktop.nix
Normal file
108
styles/desktop.nix
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
|
||||
boot.consoleLogLevel = 3;
|
||||
boot.initrd.verbose = false;
|
||||
boot.kernelParams = [
|
||||
"quiet"
|
||||
"rd.udev.log_level=3"
|
||||
"rd.systemd.show_status=auto"
|
||||
];
|
||||
|
||||
boot.plymouth = {
|
||||
enable = true;
|
||||
theme = "bgrt";
|
||||
};
|
||||
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
time.timeZone = "Europe/Amsterdam";
|
||||
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
i18n.extraLocaleSettings = {
|
||||
LC_ADDRESS = "nl_NL.UTF-8";
|
||||
LC_IDENTIFICATION = "nl_NL.UTF-8";
|
||||
LC_MEASUREMENT = "nl_NL.UTF-8";
|
||||
LC_MONETARY = "nl_NL.UTF-8";
|
||||
LC_NAME = "nl_NL.UTF-8";
|
||||
LC_NUMERIC = "nl_NL.UTF-8";
|
||||
LC_PAPER = "nl_NL.UTF-8";
|
||||
LC_TELEPHONE = "nl_NL.UTF-8";
|
||||
LC_TIME = "nl_NL.UTF-8";
|
||||
};
|
||||
|
||||
services.xserver.enable = true;
|
||||
|
||||
services.displayManager.gdm.enable = true;
|
||||
services.desktopManager.gnome.enable = true;
|
||||
|
||||
services.xserver.xkb = {
|
||||
layout = "us";
|
||||
variant = "";
|
||||
};
|
||||
|
||||
services.printing.enable = true;
|
||||
|
||||
services.pulseaudio.enable = false;
|
||||
security.rtkit.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
pulse.enable = true;
|
||||
};
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
programs.firefox.enable = true;
|
||||
|
||||
programs.virt-manager.enable = true;
|
||||
virtualisation.libvirtd.enable = true;
|
||||
|
||||
programs.command-not-found.enable = true;
|
||||
|
||||
nix = {
|
||||
settings = {
|
||||
auto-optimise-store = true;
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
neovim
|
||||
dnsmasq
|
||||
];
|
||||
|
||||
environment.shellAliases = {
|
||||
vim = "nvim";
|
||||
};
|
||||
|
||||
environment.variables.NIX_AUTO_RUN = "1";
|
||||
|
||||
services.openssh.enable = true;
|
||||
services.fprintd.enable = true;
|
||||
services.mullvad-vpn.enable = true;
|
||||
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
22
|
||||
8080
|
||||
];
|
||||
networking.firewall.allowedUDPPorts = [ 8080 ];
|
||||
networking.firewall.trustedInterfaces = [ "virbr0" ];
|
||||
|
||||
system.stateVersion = "26.05"; # yes
|
||||
|
||||
# services.qemuGuest.enable = false;
|
||||
# services.spice-vdagentd.enable = false;
|
||||
|
||||
}
|
||||
75
styles/server.nix
Normal file
75
styles/server.nix
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
virtualisation.vmVariant = {
|
||||
virtualisation = {
|
||||
memorySize = 8192;
|
||||
cores = 6;
|
||||
};
|
||||
};
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
|
||||
boot.consoleLogLevel = 3;
|
||||
boot.initrd.verbose = false;
|
||||
boot.kernelParams = [
|
||||
"quiet"
|
||||
"rd.udev.log_level=3"
|
||||
"rd.systemd.show_status=auto"
|
||||
];
|
||||
|
||||
time.timeZone = "Europe/Amsterdam";
|
||||
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
i18n.extraLocaleSettings = {
|
||||
LC_ADDRESS = "nl_NL.UTF-8";
|
||||
LC_IDENTIFICATION = "nl_NL.UTF-8";
|
||||
LC_MEASUREMENT = "nl_NL.UTF-8";
|
||||
LC_MONETARY = "nl_NL.UTF-8";
|
||||
LC_NAME = "nl_NL.UTF-8";
|
||||
LC_NUMERIC = "nl_NL.UTF-8";
|
||||
LC_PAPER = "nl_NL.UTF-8";
|
||||
LC_TELEPHONE = "nl_NL.UTF-8";
|
||||
LC_TIME = "nl_NL.UTF-8";
|
||||
};
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
programs.command-not-found.enable = true;
|
||||
|
||||
nix = {
|
||||
settings = {
|
||||
auto-optimise-store = true;
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
neovim
|
||||
];
|
||||
|
||||
environment.shellAliases = {
|
||||
vim = "nvim";
|
||||
};
|
||||
|
||||
environment.variables.NIX_AUTO_RUN = "1";
|
||||
|
||||
services.openssh.enable = true;
|
||||
services.fprintd.enable = true;
|
||||
services.mullvad-vpn.enable = true;
|
||||
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
# open ports tcp
|
||||
];
|
||||
networking.firewall.allowedUDPPorts = [
|
||||
# open ports udp
|
||||
];
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue