add adam site

This commit is contained in:
Kopatz
2024-05-24 16:04:38 +02:00
parent f929bbe487
commit d268730104
8 changed files with 226 additions and 27 deletions

21
flake.lock generated
View File

@@ -195,6 +195,26 @@
"type": "github" "type": "github"
} }
}, },
"disko": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1716431128,
"narHash": "sha256-t3T8HlX3udO6f4ilLcN+j5eC3m2gqsouzSGiriKK6vk=",
"owner": "nix-community",
"repo": "disko",
"rev": "7ffc4354dfeb37c8c725ae1465f04a9b45ec8606",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
@@ -774,6 +794,7 @@
"root": { "root": {
"inputs": { "inputs": {
"agenix": "agenix", "agenix": "agenix",
"disko": "disko",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"home-manager-unstable": "home-manager-unstable", "home-manager-unstable": "home-manager-unstable",
"nix-colors": "nix-colors", "nix-colors": "nix-colors",

View File

@@ -29,19 +29,22 @@
inputs.nixpkgs.follows = "nixpkgs-unstable"; inputs.nixpkgs.follows = "nixpkgs-unstable";
}; };
stylix.url = "github:danth/stylix"; stylix.url = "github:danth/stylix";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = { self, nur, nixpkgs, nixos-hardware, nixos-wsl, nixpkgs-unstable outputs = { self, nur, nixpkgs, nixos-hardware, nixos-wsl, nixpkgs-unstable
, agenix, home-manager, home-manager-unstable, nix-colors, nixos-cosmic , agenix, home-manager, home-manager-unstable, nix-colors, nixos-cosmic
, nixvim, stylix }@inputs: , nixvim, stylix, disko }@inputs:
let let
inherit (self) outputs; inherit (self) outputs;
system = "x86_64-linux"; system = "x86_64-linux";
# helper function to create a machine # helper function to create a machine
mkHost = { modules, specialArgs ? { pkgsVersion = nixpkgs-unstable; } }: mkHost = { modules, specialArgs ? { pkgsVersion = nixpkgs-unstable; }
, system ? "x86_64-linux", minimal ? false }:
nixpkgs-unstable.lib.nixosSystem { nixpkgs-unstable.lib.nixosSystem {
inherit system; inherit system;
modules = modules ++ [ modules = modules ++ [ ./modules agenix.nixosModules.default ]
./modules ++ (if !minimal then [
({ outputs, ... }: { ({ outputs, ... }: {
nixpkgs.overlays = with outputs.overlays; [ nixpkgs.overlays = with outputs.overlays; [
additions additions
@@ -50,14 +53,17 @@
nur.overlay nur.overlay
]; ];
# stylix compains if image is not set... # stylix compains if image is not set...
stylix.autoEnable = false; stylix.autoEnable = true;
stylix.image = ./yuyukowallpaper1809.png; stylix.image = ./yuyukowallpaper1809.png;
}) })
home-manager-unstable.nixosModules.home-manager home-manager-unstable.nixosModules.home-manager
agenix.nixosModules.default
nixos-cosmic.nixosModules.default nixos-cosmic.nixosModules.default
stylix.nixosModules.stylix stylix.nixosModules.stylix
]; #todo: check how to actually do this
./modules/graphical/stylix.nix
./modules/graphical/cosmic.nix
] else
[ ]);
specialArgs = specialArgs // { inherit inputs outputs; }; specialArgs = specialArgs // { inherit inputs outputs; };
}; };
in { in {
@@ -132,6 +138,12 @@
nixos-wsl.nixosModules.wsl nixos-wsl.nixosModules.wsl
]; ];
}; };
"adam-site" = mkHost {
minimal = true;
system = "aarch64-linux";
modules =
[ disko.nixosModules.disko ./systems/adam-site/configuration.nix ];
};
}; };
}; };
} }

View File

@@ -1,9 +1,9 @@
{ pkgs, config, ...}: { pkgs, config, lib, ...}:
{ {
imports = [ imports = [
./audio.nix ./audio.nix
./code.nix ./code.nix
./cosmic.nix
./emulators.nix ./emulators.nix
./gamemode.nix ./gamemode.nix
./games.nix ./games.nix
@@ -15,7 +15,8 @@
./obs.nix ./obs.nix
./openrgb.nix ./openrgb.nix
./plasma.nix ./plasma.nix
#./stylix.nix
#./cosmic.nix
./shared.nix ./shared.nix
./stylix.nix
]; ];
} }

View File

@@ -14,9 +14,9 @@ in
nix.registry.nixpkgs.flake = pkgsVersion; nix.registry.nixpkgs.flake = pkgsVersion;
nix.nixPath = ["nixpkgs=flake:nixpkgs"]; nix.nixPath = ["nixpkgs=flake:nixpkgs"];
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
home-manager.users.${config.mainUser.name}.home.sessionVariables = { ##home-manager.users.${config.mainUser.name}.home.sessionVariables = {
NIX_PATH = "nixpkgs=flake:nixpkgs$\{NIX_PATH:+:$NIX_PATH}"; ## NIX_PATH = "nixpkgs=flake:nixpkgs$\{NIX_PATH:+:$NIX_PATH}";
NIXPKGS_ALLOW_UNFREE = "1"; ## NIXPKGS_ALLOW_UNFREE = "1";
}; ##};
}; };
} }

View File

@@ -0,0 +1,35 @@
{ modulesPath, config, lib, pkgs, ... }: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
(modulesPath + "/profiles/qemu-guest.nix")
./disk-config.nix
];
boot.loader.grub = {
# no need to set devices, disko will add all devices that have a EF02 partition to the list already
# devices = [ ];
efiSupport = true;
efiInstallAsRemovable = true;
};
services.openssh.enable = true;
services.nginx.enable = true;
networking.firewall.allowedTCPPorts = [ 22 80 443 ];
custom = {
nftables.enable = true;
nix = {
settings.enable = true;
};
};
environment.systemPackages = map lib.lowPrio [
pkgs.curl
pkgs.gitMinimal
];
users.users.root.openssh.authorizedKeys.keys = [
# change this to your ssh key
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFeP6qtVqE/gu72ZUZE8cdRi3INiUW9NqDR7SjXIzTw2"
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDMypKJQvn68s8iNk9J9zghFlW4nrd03FwqfvGQ9sAmWojXe6pKrkat++8grIfB60aiIwNjHeXigVdZrpIb0QiR7+maPLPtxySTmgD7GeyAbwJrAymgKAzJcQvq5tKHtjH60KhLe4QzGXXpjoGIhl/8FhepRT6306JE8OfMwBUwOa3wcEdeJ7eK4JZdELCne3Gj16eWHy8iNIQswNtvJ70M7RACyDJARuazde3zFqkRYCP9Rqinegg/DVd+ykC2qHqM/yCersCOGn+I3hPCS1tz/AhDTQ7T9A7j5CLjv6ZbRS+B7a7u7z5qOAla468sELaiAEo2+fovlh8kib5zzWM2pK3rSEfUzFVGAAfHtrdR8pYynl3DBNC5XGzDT8xqa4B/qJIRoPmr8CMroLBOGGZQm9TJbmhfl8vT96RUwOA6qUmLQl6b0qJRRMkvlgCvKZyZ3d6pPfizQigTn1evBveqO9dgGcCAyAi0Ob6JZisTWUn5nAqe7CR1h2EKC0lqdCc="
];
system.stateVersion = "23.11";
}

View File

@@ -0,0 +1,56 @@
# Example to create a bios compatible gpt partition
{ lib, ... }:
{
disko.devices = {
disk.disk1 = {
device = lib.mkDefault "/dev/sda";
type = "disk";
content = {
type = "gpt";
partitions = {
boot = {
name = "boot";
size = "1M";
type = "EF02";
};
esp = {
name = "ESP";
size = "500M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
name = "root";
size = "100%";
content = {
type = "lvm_pv";
vg = "pool";
};
};
};
};
};
lvm_vg = {
pool = {
type = "lvm_vg";
lvs = {
root = {
size = "100%FREE";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
mountOptions = [
"defaults"
];
};
};
};
};
};
};
}

48
systems/adam-site/flake.lock generated Normal file
View File

@@ -0,0 +1,48 @@
{
"nodes": {
"disko": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1716431128,
"narHash": "sha256-t3T8HlX3udO6f4ilLcN+j5eC3m2gqsouzSGiriKK6vk=",
"owner": "nix-community",
"repo": "disko",
"rev": "7ffc4354dfeb37c8c725ae1465f04a9b45ec8606",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1716451822,
"narHash": "sha256-0lT5RVelqN+dgXWWneXvV5ufSksW0r0TDQi8O6U2+o8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3305b2b25e4ae4baee872346eae133cf6f611783",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"disko": "disko",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View File

@@ -0,0 +1,26 @@
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.disko.url = "github:nix-community/disko";
inputs.disko.inputs.nixpkgs.follows = "nixpkgs";
outputs = { nixpkgs, disko, ... }:
{
nixosConfigurations.hetzner-cloud = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
disko.nixosModules.disko
./configuration.nix
];
};
# tested with 2GB/2CPU droplet, 1GB droplets do not have enough RAM for kexec
nixosConfigurations.digitalocean = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
disko.nixosModules.disko
{ disko.devices.disk.disk1.device = "/dev/vda"; }
./configuration.nix
];
};
};
}