first attempt at ship

This commit is contained in:
Alisceon 2025-07-20 19:24:36 +02:00
parent 333ecafb68
commit 76ac9b9ee3
3 changed files with 87 additions and 16 deletions

View file

@ -5,30 +5,38 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05"; nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs.follows = "nixpkgs"; nixpkgs.follows = "nixpkgs";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
home-manager.url = "github:nix-community/home-manager"; home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
disko.url = "github:nix-community/disko";
}; };
outputs = { self, nixpkgs, flake-utils, home-manager, ... }: outputs = { self, nixpkgs, nixpkgs-stable, flake-utils, home-manager, disko, ... }:
flake-utils.lib.eachDefaultSystem (system: flake-utils.lib.eachDefaultSystem (system:
let let
pkgs = import nixpkgs { mkHost = { hostname, isInstall ? false }: nixpkgs.lib.nixosSystem {
inherit system; inherit system;
config.allowUnfree = true; specialArgs = {
inherit system;
pkgs = import nixpkgs { inherit system; config.allowUnfree = true; };
isInstall = isInstall;
};
modules =
[
./hosts/${hostname}/configuration.nix
./modules/common.nix
./modules/users/alisceon.nix
home-manager.nixosModules.home-manager
]
++ nixpkgs.lib.optional isInstall disko.nixosModules.disko
++ nixpkgs.lib.optional isInstall ./hosts/${hostname}/disko.nix;
}; };
in { in {
nixosConfigurations.laptop = nixpkgs.lib.nixosSystem { nixosConfigurations = {
system = "x86_64-linux"; laptop = mkHost { hostname = "electra"; };
specialArgs = { laptop-install = mkHost { hostname = "electra"; isInstall = true; };
inherit system pkgs;
};
modules = [
./hosts/electra/configuration.nix
./modules/common.nix
./modules/users/alisceon.nix
home-manager.nixosModules.home-manager
];
}; };
}); });
} }

View file

@ -5,12 +5,23 @@
[ ./hardware-configuration.nix ]; [ ./hardware-configuration.nix ];
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [ "nix-command" "flakes" ];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-partlabel/luks";
boot.resumeDevice = "/dev/vg0/swap";
time.timeZone = "Europe/Stockholm";
i18n.defaultLocale = "sv_SE.UTF-8";
services.openssh.enable = true;
fileSystems."/".options = [ "compress=zstd" ];
networking.hostName = "electra"; networking.hostName = "electra";
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
time.timeZone = "UTC";
i18n.defaultLocale = "en_US.UTF-8";
services.xserver = { services.xserver = {
enable = true; enable = true;

52
hosts/electra/disko.nix Normal file
View file

@ -0,0 +1,52 @@
{
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
boot = {
size = "512M";
type = "EF00"; # EFI system partition
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
luks = {
size = "100%";
content = {
type = "luks";
name = "cryptroot";
settings.allowDiscards = true;
content = {
type = "lvm_pv";
vg = "vg0";
};
};
};
};
};
swap = {
size = "32G"; # Adjust to your RAM size
content = {
type = "swap";
resumeDevice = true;
};
};
lvm_vgs.vg0 = {
lvs = {
root = {
size = "100%FREE";
content = {
type = "filesystem";
format = "btrfs";
mountpoint = "/";
};
};
};
};
}