Skip to content

Commit f8767dc

Browse files
committed
feat: add new system & configure users
Signed-off-by: Reputable2722 <153411261+Reputable2772@users.noreply.github.com>
1 parent f8da711 commit f8767dc

8 files changed

Lines changed: 214 additions & 1 deletion

File tree

Config/config.nix

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ rec {
5757
# };
5858
};
5959
};
60+
61+
hp-laptop = {
62+
secrets = {
63+
encryption = {
64+
pkeyfile = "${flake.dir.config}/SSH/Encryption/HP-Encryption";
65+
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO9rLYwb+3DofPSPGlif3FvrIb2V/ujfn3u7d/YmfU7s";
66+
};
67+
};
68+
};
69+
6070
rescue = { };
6171
};
6272

@@ -275,7 +285,6 @@ rec {
275285
"OLLAMA_NUM_GPU=0"
276286
"OLLAMA_INTEL_GPU=false"
277287
"OLLAMA_KEEP_ALIVE=10m"
278-
"OLLAMA_NUM_CTX=8192"
279288
"OLLAMA_LOAD_TIMEOUT=15m"
280289
];
281290
};
@@ -323,6 +332,7 @@ rec {
323332
"wickedwizardPassword.age".publicKeys = [ system.lenovo-laptop.secrets.encryption.key ];
324333
"rootPassword.age".publicKeys = [ system.lenovo-laptop.secrets.encryption.key ];
325334
"guestPassword.age".publicKeys = [ system.lenovo-laptop.secrets.encryption.key ];
335+
"selfhostedPassword.age".publicKeys = [ system.hp-laptop.secrets.encryption.key ];
326336

327337
# Bitlocker age files
328338
"windows.age".publicKeys = [ system.lenovo-laptop.secrets.encryption.key ];

Config/selfhostedPassword.age

229 Bytes
Binary file not shown.

System/HP-Laptop/default.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
imports = [
3+
./gnome.nix
4+
./hardware-configuration.nix
5+
./networking.nix
6+
./users.nix
7+
];
8+
}

System/HP-Laptop/gnome.nix

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
services.xserver.enable = true;
3+
4+
services.displayManager.gdm.enable = true;
5+
services.desktopManager.gnome.enable = true;
6+
7+
services.xserver.xkb = {
8+
layout = "us";
9+
variant = "";
10+
};
11+
12+
system.stateVersion = "26.05";
13+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Do not modify this file! It was generated by ‘nixos-generate-config’
2+
# and may be overwritten by future invocations. Please make changes
3+
# to /etc/nixos/configuration.nix instead.
4+
{
5+
config,
6+
lib,
7+
pkgs,
8+
modulesPath,
9+
...
10+
}:
11+
12+
{
13+
imports = [
14+
(modulesPath + "/installer/scan/not-detected.nix")
15+
];
16+
17+
# Bootloader.
18+
boot.loader.systemd-boot.enable = true;
19+
boot.loader.efi.canTouchEfiVariables = true;
20+
21+
boot.initrd.availableKernelModules = [
22+
"nvme"
23+
"xhci_pci"
24+
];
25+
boot.initrd.kernelModules = [ ];
26+
boot.kernelModules = [ "kvm-amd" ];
27+
boot.extraModulePackages = [ ];
28+
29+
fileSystems."/" = {
30+
device = "/dev/disk/by-uuid/e174c128-ca7b-4d85-bce2-ead8941fff07";
31+
fsType = "btrfs";
32+
};
33+
34+
fileSystems."/home" = {
35+
device = "/dev/disk/by-uuid/e174c128-ca7b-4d85-bce2-ead8941fff07";
36+
fsType = "btrfs";
37+
options = [ "subvol=home" ];
38+
};
39+
40+
fileSystems."/nix" = {
41+
device = "/dev/disk/by-uuid/e174c128-ca7b-4d85-bce2-ead8941fff07";
42+
fsType = "btrfs";
43+
options = [ "subvol=nix" ];
44+
};
45+
46+
fileSystems."/boot" = {
47+
device = "/dev/disk/by-uuid/A189-93C0";
48+
fsType = "vfat";
49+
options = [
50+
"fmask=0077"
51+
"dmask=0077"
52+
];
53+
};
54+
55+
swapDevices = [
56+
{ device = "/dev/disk/by-uuid/c1773568-45be-4f4e-85aa-35d0267b9e0e"; }
57+
];
58+
59+
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
60+
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
61+
}

System/HP-Laptop/networking.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
networking.hostName = "hp-laptop";
3+
}

System/HP-Laptop/users.nix

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
{
2+
config,
3+
config',
4+
inputs,
5+
lib,
6+
lib',
7+
sources,
8+
...
9+
}:
10+
{
11+
age.secrets.selfhostedPassword.file = ../../Config/selfhostedPassword.age;
12+
age.secrets.rootPassword.file = ../../Config/rootPassword.age;
13+
age.secrets.guestPassword.file = ../../Config/guestPassword.age;
14+
15+
users.mutableUsers = false;
16+
users.users.root.hashedPasswordFile = config.age.secrets.rootPassword.path;
17+
users.users.selfhosted = {
18+
isNormalUser = true;
19+
home = "/home/selfhosted";
20+
# Description of all users should container their folder name.
21+
description = "selfhosted";
22+
# Fixes https://github.com/GPUOpen-Drivers/AMDVLK/issues/310
23+
extraGroups = [
24+
"wheel"
25+
"networkmanager"
26+
"input"
27+
"video"
28+
"render"
29+
30+
# Needed for virtualisation, Misc/virtualisation.nix
31+
"kvm"
32+
"libvirtd"
33+
];
34+
# shell = pkgs.zsh;
35+
hashedPasswordFile = config.age.secrets.selfhostedPassword.path;
36+
linger = true;
37+
};
38+
39+
users.users.guest = {
40+
isNormalUser = true;
41+
home = "/home/guest";
42+
description = "Guest";
43+
extraGroups = [
44+
"input"
45+
"video"
46+
"render"
47+
"networkmanager"
48+
];
49+
hashedPasswordFile = config.age.secrets.guestPassword.path;
50+
};
51+
52+
home-manager = {
53+
useGlobalPkgs = true;
54+
useUserPackages = lib.mkForce false;
55+
startAsUserService = true;
56+
backupFileExtension = "backup.backup.backup";
57+
verbose = true;
58+
sharedModules = [ ../../Modules/Home-Manager ];
59+
users = {
60+
selfhosted = {
61+
imports = [
62+
# ../../Users/Selfhosted/home.nix
63+
{
64+
home.stateVersion = "26.05";
65+
_module.args.config' = config'.users.selfhosted;
66+
}
67+
];
68+
};
69+
70+
guest = {
71+
imports = [
72+
../../Users/Guest/home.nix
73+
{
74+
home.stateVersion = "26.05";
75+
_module.args.config' = config'.users.guest;
76+
}
77+
];
78+
};
79+
};
80+
81+
extraSpecialArgs = {
82+
inherit inputs lib' sources;
83+
};
84+
};
85+
86+
imports = [
87+
inputs.home-manager.nixosModules.home-manager
88+
];
89+
}

flake.nix

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,35 @@
110110
];
111111
};
112112

113+
"hp-laptop" = nixpkgs.lib.nixosSystem {
114+
inherit system;
115+
specialArgs = {
116+
inherit inputs;
117+
lib' = import ./lib { inherit pkgs; };
118+
sources = import ./_sources/generated.nix {
119+
inherit (pkgs)
120+
fetchurl
121+
fetchgit
122+
fetchFromGitHub
123+
dockerTools
124+
;
125+
};
126+
};
127+
modules = [
128+
./Modules/System
129+
./System/Common
130+
./System/HP-Laptop
131+
(
132+
{ config, ... }:
133+
{
134+
_module.args.config' = import ./Config/config.nix {
135+
_home = pkgs.lib.attrsets.mapAttrs (n: v: v.home.homeDirectory) config.home-manager.users;
136+
};
137+
}
138+
)
139+
];
140+
};
141+
113142
"rescue" = nixpkgs.lib.nixosSystem {
114143
system = "x86_64-linux";
115144
specialArgs = {

0 commit comments

Comments
 (0)